:root {
    color-scheme: dark;
    --background: #05070a;
    --surface: rgba(7, 10, 14, 0.58);
    --text: #f7f9fc;
    --muted: #b9c1ce;
    --accent: #2ed573;
    --line: rgba(255, 255, 255, 0.16);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    overflow: hidden;
}

.feed {
    height: 100dvh;
    width: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}

.feed::-webkit-scrollbar {
    display: none;
}

.video-card,
.empty-state {
    position: relative;
    min-height: 100dvh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    background: linear-gradient(160deg, #05070a 0%, #10151c 52%, #06080b 100%);
}

.player-shell {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: clamp(10px, 2.6vw, 28px);
}

.player {
    width: min(100vw, 56.25dvh);
    height: min(177.78vw, 100dvh);
    max-width: 100%;
    max-height: 100%;
    border: 0;
    background: #000;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.video-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 42%;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
}

.video-info {
    position: absolute;
    z-index: 2;
    left: clamp(16px, 4vw, 56px);
    right: clamp(16px, 4vw, 56px);
    bottom: max(22px, env(safe-area-inset-bottom));
    max-width: 680px;
    padding-right: 92px;
}

.channel {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 750;
}

.video-info h1 {
    margin: 0;
    max-width: 18ch;
    color: var(--text);
    font-size: clamp(1.4rem, 3.8vw, 3.7rem);
    line-height: 1.02;
    letter-spacing: 0;
    text-wrap: balance;
}

.video-info a {
    display: inline-flex;
    align-items: center;
    margin-top: 18px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
    font-weight: 700;
    backdrop-filter: blur(16px);
}

.video-actions {
    position: absolute;
    z-index: 3;
    right: clamp(12px, 3vw, 34px);
    bottom: max(24px, env(safe-area-inset-bottom));
    display: grid;
    gap: 10px;
    width: 62px;
}

.action-button {
    width: 62px;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: rgba(5, 7, 10, 0.7);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    backdrop-filter: blur(16px);
}

.action-button span,
.action-button strong {
    display: block;
    line-height: 1.15;
}

.action-button span {
    font-size: 0.72rem;
}

.action-button strong {
    margin-top: 3px;
    font-size: 0.82rem;
}

.action-button:hover,
.action-button:focus-visible,
.action-button.is-liked {
    border-color: var(--accent);
    color: #06100a;
    background: var(--accent);
    outline: none;
}

.comment-panel {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.58);
}

.comment-panel.is-open {
    display: flex;
}

.comment-panel-inner {
    position: relative;
    width: min(620px, 100%);
    max-height: min(78dvh, 720px);
    display: grid;
    grid-template-rows: auto minmax(160px, 1fr) auto;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b0f14;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.5);
}

.comment-panel h2 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0;
}

.close-comments {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #151b22;
    font-size: 1.2rem;
    cursor: pointer;
}

.comment-list {
    overflow: auto;
    padding-right: 4px;
}

.comment-item {
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.comment-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 0.9rem;
}

.comment-item p,
.comment-empty {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.comment-form {
    display: grid;
    gap: 10px;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #151b22;
    font: inherit;
    padding: 11px 12px;
    resize: vertical;
}

.website-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.comment-form button {
    justify-self: end;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    color: #06100a;
    background: var(--accent);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.toast {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: 20px;
    max-width: min(92vw, 460px);
    min-height: 42px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 8px;
    color: var(--text);
    background: rgba(5, 7, 10, 0.86);
    border: 1px solid var(--line);
    transform: translateX(-50%);
}

.toast.is-visible {
    display: flex;
}

.empty-state {
    display: grid;
    place-items: center;
    padding: 24px;
    text-align: center;
}

.empty-state h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 8vw, 5rem);
    letter-spacing: 0;
}

.empty-state p {
    margin: 0;
    max-width: 34rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.5;
}

@media (min-width: 900px) {
    .player {
        border-radius: 8px;
    }
}

@media (max-width: 640px) {
    .player-shell {
        padding: 0;
    }

    .player {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .video-info h1 {
        max-width: 14ch;
        font-size: clamp(1.28rem, 8vw, 2.25rem);
    }

    .video-info {
        padding-right: 76px;
    }

    .video-actions {
        width: 54px;
        gap: 8px;
    }

    .action-button {
        width: 54px;
        min-height: 50px;
    }

    .action-button span {
        font-size: 0.64rem;
    }
}
