:root {
    --green-950: #082a21;
    --green-900: #0d3b2e;
    --green-800: #155140;
    --gold: #bd8929;
    --gold-soft: #dfbc73;
    --paper: #f7f2e6;
    --paper-2: #eee4cf;
    --surface: #fffdf7;
    --ink: #173329;
    --muted: #6c756e;
    --line: rgba(43, 69, 56, .17);
    --danger: #9e3d34;
    --shadow: 0 18px 48px rgba(8, 42, 33, .14);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    background: var(--paper);
}

body {
    min-width: 280px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(rgba(112, 89, 51, .045) 1px, transparent 1px),
        radial-gradient(circle at 10% 0, rgba(189, 137, 41, .13), transparent 28rem),
        var(--paper);
    background-size: 100% 5px, auto, auto;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button {
    touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid var(--gold-soft);
    outline-offset: 3px;
}

.app-shell {
    width: min(1440px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    background: rgba(247, 242, 230, .66);
}

.topbar {
    position: sticky;
    z-index: 40;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    padding: 9px clamp(12px, 3vw, 28px);
    color: #fff;
    background: rgba(8, 42, 33, .97);
    border-bottom: 3px solid var(--gold);
    box-shadow: 0 8px 25px rgba(8, 42, 33, .18);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--gold-soft);
    border: 1px solid var(--gold);
    border-radius: 50%;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

.brand-copy strong,
.brand-copy small {
    display: block;
    line-height: 1.15;
}

.brand-copy strong {
    color: var(--gold-soft);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
}

.brand-copy small {
    margin-top: 4px;
    color: rgba(255, 255, 255, .64);
    font-size: .64rem;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.icon-button,
.control-button,
.quiet-button,
.text-button,
.danger-button {
    border: 0;
    cursor: pointer;
}

.icon-button {
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    color: #fff;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .17);
    border-radius: 10px;
    font-size: 1.15rem;
}

.icon-button:hover {
    color: var(--gold-soft);
    border-color: var(--gold);
}

.text-button,
.danger-button,
.quiet-button {
    min-height: 42px;
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: 750;
}

.text-button {
    color: var(--green-950);
    background: var(--gold-soft);
}

.text-button:hover {
    background: #e8c982;
}

.install-button {
    min-height: 40px;
}

.main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, .72fr);
    gap: clamp(18px, 3vw, 34px);
    padding: clamp(20px, 4vw, 42px);
}

.player-column {
    min-width: 0;
}

.intro {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--gold);
    font-size: .69rem;
    font-weight: 850;
    letter-spacing: .17em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    color: var(--green-950);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    line-height: 1.12;
}

h1 {
    max-width: 650px;
    font-size: clamp(1.8rem, 3.4vw, 3.25rem);
}

h2 {
    font-size: clamp(1.45rem, 2vw, 2rem);
}

.intro-copy {
    max-width: 360px;
    margin: 0;
    color: var(--muted);
    font-size: .88rem;
}

.player-card,
.now-card,
.discovery-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.player-card {
    position: relative;
    overflow: hidden;
    border-top: 5px solid var(--gold);
}

.video-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    min-height: 190px;
    background:
        radial-gradient(circle at center, rgba(189, 137, 41, .15), transparent 45%),
        var(--green-950);
}

#ytFrame,
#ytFrame iframe {
    width: 100%;
    height: 100%;
}

#ytFrame iframe {
    position: absolute;
    inset: 0;
    border: 0;
}

.player-loading {
    position: absolute;
    inset: 0;
    display: grid;
    padding: 24px;
    place-content: center;
    color: rgba(255, 255, 255, .75);
    text-align: center;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}

.player-loading.is-hidden {
    visibility: hidden;
    opacity: 0;
}

.loading-mark {
    color: var(--gold-soft);
    font-size: clamp(3.5rem, 9vw, 6rem);
    line-height: 1;
}

.player-loading strong,
.player-loading small {
    display: block;
}

.player-loading small {
    margin-top: 5px;
    color: rgba(255, 255, 255, .5);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 62px;
    padding: 9px 12px;
    color: #fff;
    background: var(--green-950);
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.control-button {
    display: grid;
    width: 43px;
    height: 43px;
    padding: 0;
    place-items: center;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
}

.control-button.primary {
    color: var(--green-950);
    background: var(--gold-soft);
    border-color: var(--gold-soft);
}

.control-button:hover {
    border-color: var(--gold);
}

.control-spacer {
    flex: 1;
}

.fullscreen-wake {
    display: none;
    position: absolute;
    z-index: 55;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    cursor: default;
    background: transparent;
    border: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.now-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 13px;
    padding: 15px;
    border-left: 4px solid var(--gold);
}

.now-art {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--gold);
    background: var(--paper);
    border: 1px solid rgba(189, 137, 41, .3);
    border-radius: 50%;
}

.now-copy {
    min-width: 0;
    flex: 1;
}

.now-copy span,
.now-copy strong,
.now-copy small {
    display: block;
}

.now-copy span {
    color: var(--gold);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.now-copy strong {
    overflow: hidden;
    margin: 2px 0;
    color: var(--green-950);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.now-copy small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.discovery-card {
    align-self: start;
    overflow: hidden;
    border-top: 5px solid var(--gold);
}

.section-head,
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.section-head {
    padding: 22px;
    border-bottom: 1px solid var(--line);
}

.quiet-button {
    color: var(--green-800);
    background: transparent;
    border: 1px solid var(--line);
    font-size: .73rem;
}

.quiet-button:hover {
    border-color: var(--gold);
}

.media-list {
    display: grid;
}

.media-item {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 13px;
    padding: 13px;
    color: inherit;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    text-align: left;
}

.media-item:hover {
    background: rgba(189, 137, 41, .07);
}

.media-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--green-950);
    border-radius: 8px;
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb span {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: var(--green-950);
    background: var(--gold-soft);
    border-radius: 50%;
    font-size: .65rem;
}

.media-info {
    min-width: 0;
    align-self: center;
}

.media-info strong {
    display: -webkit-box;
    overflow: hidden;
    color: var(--green-950);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-family: Georgia, "Times New Roman", serif;
    font-size: .92rem;
    line-height: 1.3;
}

.media-info small {
    display: block;
    overflow: hidden;
    margin-top: 6px;
    color: var(--muted);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.mini-button {
    min-height: 30px;
    padding: 5px 9px;
    color: var(--green-900);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
    font-size: .68rem;
    font-weight: 750;
}

.mini-button:hover {
    border-color: var(--gold);
}

.mini-button.danger {
    color: var(--danger);
}

.empty-state {
    padding: 34px 22px;
    color: var(--muted);
    text-align: center;
}

.empty-state[hidden] {
    display: none;
}

.empty-state > span {
    color: var(--gold);
    font-size: 2rem;
}

.empty-state p {
    margin: 7px auto 0;
    max-width: 320px;
    font-size: .82rem;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 0 clamp(20px, 4vw, 42px);
    padding: 21px 0;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.footer span:first-child {
    color: var(--gold);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

.modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
    background: rgba(8, 42, 33, .76);
    backdrop-filter: blur(9px);
}

.modal.open {
    display: flex;
}

.modal-panel {
    overflow: hidden;
    width: min(760px, 100%);
    max-height: min(820px, 92dvh);
    background: var(--surface);
    border: 1px solid rgba(223, 188, 115, .55);
    border-top: 5px solid var(--gold);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .35);
}

.compact-panel {
    width: min(590px, 100%);
}

.modal-head {
    padding: 20px 22px;
    background: var(--green-950);
}

.modal-head h2 {
    color: #fff;
}

.modal-head .eyebrow {
    color: var(--gold-soft);
}

.modal-body {
    overflow: auto;
    max-height: calc(92dvh - 104px);
    padding: 20px 22px;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.search-form input {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid rgba(189, 137, 41, .4);
    border-radius: 10px;
}

.primary-action {
    min-width: 90px;
}

.helper {
    margin: 10px 0 15px;
    color: var(--muted);
    font-size: .76rem;
}

.modal-list {
    overflow: hidden;
    border: 1px solid var(--line);
}

.modal-list .media-item {
    grid-template-columns: 130px minmax(0, 1fr);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 15px;
}

.modal-footer small {
    color: var(--muted);
}

.danger-button {
    color: var(--danger);
    background: rgba(158, 61, 52, .08);
    border: 1px solid rgba(158, 61, 52, .22);
}

.prose {
    color: #394a42;
    line-height: 1.75;
}

.prose p {
    margin: 0 0 15px;
}

.sr-only {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

body.modal-open {
    overflow: hidden;
}

body.player-css-fullscreen {
    overflow: hidden;
    overscroll-behavior: none;
}

body.player-fullscreen .player-card {
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: #000;
    border: 0;
    box-shadow: none;
}

body.player-css-fullscreen .player-card {
    position: fixed;
    z-index: 2147483000;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
}

body.player-fullscreen .video-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
    background: #000;
}

body.player-fullscreen .player-controls {
    position: absolute;
    z-index: 70;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 62px;
    padding-bottom: max(9px, env(safe-area-inset-bottom));
    background: rgba(8, 42, 33, .96);
    border-top-color: rgba(255, 255, 255, .12);
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition:
        transform .22s ease,
        opacity .18s ease,
        visibility 0s linear 0s;
}

body.player-fullscreen.fullscreen-controls-hidden .player-controls {
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transform: translateY(calc(100% + env(safe-area-inset-bottom)));
    transition:
        transform .22s ease,
        opacity .18s ease,
        visibility 0s linear .22s;
}

body.player-fullscreen.fullscreen-controls-hidden .fullscreen-wake {
    display: block;
}

body.player-fullscreen.fullscreen-controls-hidden,
body.player-fullscreen.fullscreen-controls-hidden * {
    cursor: none;
}

body.player-fullscreen.fullscreen-controls-hidden .fullscreen-wake {
    cursor: none;
}

@supports not (height: 100dvh) {
    body.player-css-fullscreen .player-card {
        height: 100vh;
    }
}

@media (max-width: 980px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .discovery-card {
        width: 100%;
    }

    .media-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .media-item {
        border-right: 1px solid var(--line);
    }

    .modal-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .topbar {
        min-height: 62px;
        padding-inline: 10px;
    }

    .brand-mark {
        width: 39px;
        height: 39px;
    }

    .brand-copy strong {
        font-size: .98rem;
    }

    .brand-copy small {
        display: none;
    }

    .top-actions {
        gap: 4px;
    }

    .icon-button {
        width: 38px;
        height: 38px;
    }

    .install-button {
        display: none !important;
    }

    .main-layout {
        gap: 18px;
        padding: 20px 10px 28px;
    }

    .intro {
        display: block;
        padding-inline: 5px;
    }

    .intro-copy {
        margin-top: 10px;
    }

    .video-wrap {
        min-height: 176px;
    }

    .player-controls {
        min-height: 58px;
    }

    .now-card {
        align-items: flex-start;
    }

    .now-card .text-button {
        padding-inline: 10px;
        font-size: .72rem;
    }

    .now-art {
        display: none;
    }

    .section-head {
        padding: 18px 15px;
    }

    .media-list {
        grid-template-columns: 1fr;
    }

    .media-item,
    .modal-list .media-item {
        grid-template-columns: 108px minmax(0, 1fr);
        padding: 11px;
        border-right: 0;
    }

    .footer {
        display: block;
        margin-inline: 15px;
        text-align: center;
    }

    .footer span {
        display: block;
    }

    .footer span + span {
        margin-top: 6px;
    }

    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-panel {
        max-height: 93dvh;
        border-inline: 0;
        border-bottom: 0;
        border-radius: 20px 20px 0 0;
    }

    .modal-head,
    .modal-body {
        padding-inline: 15px;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .primary-action {
        width: 100%;
    }

    .modal-footer {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 390px) {
    .brand-copy {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
