*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #000;
}

body {
    line-height: 1.43;
    overscroll-behavior: none;
}

button {
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

table {
    border-collapse: collapse;
}

td {
    padding: 0;
}

#mobile-view {
    position: fixed;
    inset: 0;
    overflow-y: scroll;
    overscroll-behavior-y: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}

#mobile-view::-webkit-scrollbar {
    display: none;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 1170px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    overflow: hidden;
    background: #16191c;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.poster, .feed-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Okładka zostaje widoczna, dopóki film nie ruszy: bez czarnego błysku. */
.feed-video {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.feed-video.is-ready {
    opacity: 1;
}

.play-btn {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: none;
    border: none;
    touch-action: pan-y;
}

.center-control {
    position: relative;
    display: inline-block;
    width: 84px;
    height: 84px;
    vertical-align: middle;
}

.play-heart,
.pause-bars {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: #d9a441;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s linear, transform 0.15s ease-out;
}

.pause-bars {
    padding: 14px;
    box-sizing: border-box;
}

.is-paused .play-btn,
.is-paused .play-heart,
.show-pause .pause-bars {
    opacity: 1;
}

.is-paused .play-heart,
.show-pause .pause-bars {
    transform: none;
}

/* Lekkie przyciemnienie góry, żeby białe logo i głośność były czytelne na jasnych filmach. */
.video-container::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 2;
    height: 110px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.home-link {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 10px);
    left: 10px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #fff;
    text-decoration: none;
}

.home-link:hover,
.home-link:focus {
    color: #fff;
    text-decoration: none;
}

.home-link svg {
    fill: currentColor;
}

.mute-btn {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 10px);
    right: 0;
    z-index: 3;
    padding: 10px;
    background: none;
    border: none;
}

.mute-btn img {
    height: 25px;
}

.slide-info {
    position: absolute;
    bottom: 0;
    z-index: 4;
    width: 100%;
    padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
    overflow: hidden;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 30%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none; /* stuknięcie w film przechodzi przez gradient do pauzy */
}

.slide-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 0 14px 12px 20px;
}

.slide-text {
    flex: 1;
    min-width: 0;
    max-height: 30vh;
    overflow-y: auto;
    pointer-events: auto;
    text-align: left;
}

.description-container {
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 200;
    line-height: 1.4;
}

.slide-name {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 500;
}

.slide-title {
    display: block;
    font-weight: 400;
}

.slide-desc {
    display: block;
    margin-top: 4px;
}

.profile-btn {
    flex: none;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 2px solid #d9a441;
    border-radius: 50%;
    background: #000;
    overflow: hidden;
    pointer-events: auto;
}

.profile-btn img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
}

.slide-progress .progress-bar {
    flex: 1;
    min-width: 0;
    width: auto;
    pointer-events: auto;
}

.time-display {
    flex: none;
    color: #fff;
    font-size: 12px;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
}

/* Widoczny pasek ma 2 px, ale palec trafia w 22 px. */
.progress-bar {
    display: block;
    height: 22px;
    margin: 0;
    padding: 10px 0;
    background-clip: content-box !important;
    touch-action: none;
}

.progress-bar:hover {
    height: 22px;
}

/* Tablety mają szeroki ekran, ale nie mają kursora, który odsłoni kontrolki. */
@media (hover: none) {
    .play-btn,
    .mute-btn,
    .video-container .progress-container,
    .video-container .current-time,
    .video-container .duration {
        opacity: 1;
    }
}

/* Ciemna fala płynie nad okładką, dopóki film się ładuje. */
.loading-tile {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(105deg, rgba(0, 0, 0, 0.62) 30%, rgba(38, 42, 47, 0.42) 50%, rgba(0, 0, 0, 0.62) 70%);
    background-size: 260% 100%;
    visibility: hidden;
    pointer-events: none;
}

.is-loading .loading-tile,
.is-buffering .loading-tile {
    visibility: visible;
    animation: tile-wave 3.2s ease-in-out infinite;
}

/* Krótkie zacięcia nie powinny migać. */
.is-buffering:not(.is-loading) .loading-tile {
    animation-delay: 0.3s;
}

@keyframes tile-wave {
    from { background-position: 120% 0; }
    to { background-position: -20% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .is-loading .loading-tile,
    .is-buffering .loading-tile {
        animation: none;
    }
}

#account {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    background-color: #0e1114;
    overscroll-behavior: contain;
    animation: profile-in 0.28s ease-out;
}

@keyframes profile-in {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}

.profile-back {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 12px);
    left: 12px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
}

.profile-back img {
    height: 20px;
}

.profile-hero {
    position: relative;
    flex: none;
    width: 100%;
    padding: calc(env(safe-area-inset-top) + 56px) 24px 36px;
    overflow: hidden;
    text-align: center;
}

/* Rozmyte zdjęcie osoby jako ciepłe tło nagłówka. */
.profile-hero::before {
    content: "";
    position: absolute;
    inset: -40px -40px 30%;
    background: var(--profile-cover) center / cover;
    filter: blur(44px);
    opacity: 0.4;
}

.profile-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(14, 17, 20, 0) 20%, #0e1114 72%);
}

.profile-hero > * {
    position: relative;
    z-index: 1;
}

.profile-avatar {
    width: 124px;
    height: 124px;
    padding: 4px;
    border: 2px solid #e2a44d;
    border-radius: 50%;
    object-fit: cover;
}

.profile-name {
    margin: 18px 0 4px;
    font-size: 34px;
    font-weight: 300;
    letter-spacing: -0.01em;
}

.profile-count {
    font-size: 13px;
    font-weight: 300;
    color: #e2a44d;
}

.profile-story {
    max-width: 34em;
    margin: 20px auto 0;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.6;
    color: #dfe3e6;
}

.profile-story.is-collapsed {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.profile-more {
    min-height: 44px;
    padding: 0 12px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
}

.account-grid {
    flex: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    max-width: 680px;
    padding: 0 3px calc(env(safe-area-inset-bottom) + 24px);
}

.account-grid-item {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border: none;
    border-radius: 6px;
    background: linear-gradient(105deg, #101316 30%, #1d2126 50%, #101316 70%);
    background-size: 260% 100%;
    animation: tile-wave 3.2s ease-in-out infinite;
}

.account-grid-item .cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-grid-item::after {
    content: "";
    position: absolute;
    inset: 55% 0 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}

.cover-title {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 8px;
    z-index: 1;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.25;
    text-align: left;
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    #account,
    .account-grid-item {
        animation: none;
    }
}
