:root {
    --bg: #050b14;
    --panel: rgba(8, 18, 30, 0.72);
    --panel-strong: rgba(7, 15, 24, 0.92);
    --line: rgba(151, 196, 255, 0.18);
    --line-strong: rgba(151, 196, 255, 0.38);
    --text: #f3f8ff;
    --muted: #b5c9e4;
    --brand: #ffb56a;
    --brand-strong: #ff8b3d;
    --danger: #ff9d8f;
    --shadow: 0 24px 80px rgba(2, 7, 12, 0.45);
    --font-ui: "Space Grotesk", sans-serif;
    --font-mono: "IBM Plex Mono", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(255, 139, 61, 0.18), transparent 24%),
        radial-gradient(circle at top right, rgba(77, 155, 255, 0.18), transparent 28%),
        linear-gradient(180deg, #07111b 0%, #08111d 55%, #050b14 100%);
    color: var(--text);
    font-family: var(--font-ui);
}

html.native-inline,
html.native-inline body {
    background: transparent;
}

html.shell-webos {
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 149, 82, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(112, 174, 255, 0.14), transparent 30%),
        linear-gradient(180deg, #040a12 0%, #07101b 48%, #040912 100%);
    --font-ui: "Segoe UI", "Trebuchet MS", sans-serif;
    --font-mono: Consolas, "Courier New", monospace;
}

.shell-webos body,
.shell-webos .player-app,
.shell-webos .player-stage {
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
}

.shell-webos body {
    position: fixed;
    inset: 0;
    overscroll-behavior: none;
    touch-action: manipulation;
}

button,
input,
select {
    font: inherit;
}

.player-app,
.player-stage {
    width: 100%;
    height: 100%;
}

.player-stage {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(23, 42, 64, 0.42), transparent 44%),
        linear-gradient(180deg, rgba(4, 10, 17, 0.96) 0%, rgba(4, 10, 17, 0.62) 100%);
    outline: none;
}

.shell-webos .player-stage {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 50% 38%, rgba(31, 55, 84, 0.3), transparent 40%),
        linear-gradient(180deg, rgba(3, 8, 14, 0.98) 0%, rgba(4, 10, 17, 0.7) 100%);
}

html.native-inline .player-stage.is-player-open {
    background: transparent;
}

.fallback-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    object-fit: cover;
    background: #000;
}

.fallback-video.is-active {
    display: block;
}

.subtitle-overlay {
    position: absolute;
    inset-inline: 0;
    bottom: 190px;
    z-index: 3;
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 0 28px;
    pointer-events: none;
}

.subtitle-overlay:empty {
    display: none;
}

.subtitle-cue {
    max-width: min(1100px, calc(100vw - 56px));
    padding: 10px 16px;
    border-radius: 18px;
    background: rgba(5, 11, 20, 0.74);
    color: #f8fbff;
    font-size: clamp(1.02rem, 2vw, 1.48rem);
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
    text-wrap: balance;
}

.shell-webos .subtitle-overlay {
    bottom: 236px;
    padding-inline: 72px;
}

.shell-webos .subtitle-cue {
    max-width: min(1440px, calc(100vw - 144px));
    padding: 14px 22px;
    border-radius: 20px;
    font-size: clamp(1.24rem, 1.8vw, 2rem);
    line-height: 1.5;
}

.stage-gradient {
    position: absolute;
    inset-inline: 0;
    pointer-events: none;
    z-index: 1;
}

.stage-gradient-top {
    top: 0;
    height: 26vh;
    background: linear-gradient(180deg, rgba(2, 8, 14, 0.88), rgba(2, 8, 14, 0));
}

.stage-gradient-bottom {
    bottom: 0;
    height: 36vh;
    background: linear-gradient(0deg, rgba(2, 8, 14, 0.94), rgba(2, 8, 14, 0));
}

.hud {
    position: absolute;
    inset-inline: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    pointer-events: none;
}

.hud-top {
    top: 0;
    padding: 28px 28px 0;
    align-items: flex-start;
}

.hud-bottom {
    bottom: 0;
    padding: 0 28px 28px;
    flex-direction: column;
    gap: 18px;
}

.shell-webos .hud-top {
    padding: 48px 64px 0;
}

.shell-webos .hud-bottom {
    padding: 0 64px 48px;
    gap: 22px;
}

.headline-wrap {
    max-width: min(840px, 70vw);
}

.shell-webos .headline-wrap {
    max-width: min(980px, 72vw);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: var(--brand);
}

h1,
h2 {
    margin: 0;
    letter-spacing: -0.04em;
}

h1 {
    font-size: clamp(2.4rem, 4.6vw, 4.8rem);
    line-height: 0.95;
}

h2 {
    font-size: 1.6rem;
}

.status-copy {
    max-width: 56ch;
    margin: 14px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 1.8vw, 1.28rem);
    line-height: 1.65;
}

.shell-webos h1 {
    font-size: clamp(3.2rem, 5vw, 5.4rem);
}

.shell-webos .status-copy {
    max-width: 60ch;
    font-size: clamp(1.12rem, 1.7vw, 1.5rem);
}

.badge-cluster,
.meta-strip,
.control-row,
.hint-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hud-badge,
.meta-strip span {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: #d9e8ff;
    backdrop-filter: blur(14px);
}

.shell-webos .hud-badge,
.shell-webos .meta-strip span {
    min-height: 50px;
    padding-inline: 18px;
    font-size: 1rem;
}

.hud-badge-accent {
    border-color: rgba(255, 181, 106, 0.32);
    background: rgba(255, 181, 106, 0.12);
    color: #ffe4c4;
}

.hero-actions {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.hero-play {
    min-width: 280px;
    min-height: 76px;
    border: 0;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: #1f1409;
    font-size: 1.34rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow);
    pointer-events: auto;
    transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.shell-webos .hero-play {
    min-width: 360px;
    min-height: 88px;
    border-radius: 28px;
    font-size: 1.52rem;
}

.player-stage.is-player-open .hero-play {
    opacity: 0;
    pointer-events: none;
}

.timeline-wrap {
    display: grid;
    gap: 10px;
    pointer-events: auto;
}

.timeline {
    position: relative;
    width: 100%;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: visible;
    cursor: pointer;
    touch-action: none;
}

.shell-webos .timeline {
    height: 22px;
}

.timeline::after {
    content: "";
    position: absolute;
    inset: -10px 0;
}

.timeline-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--brand-strong));
}

.timeline-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff1dd;
    border: 3px solid rgba(8, 17, 29, 0.92);
    transform: translate(-50%, -50%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.shell-webos .timeline-thumb {
    width: 34px;
    height: 34px;
}

.time-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.shell-webos .time-row {
    font-size: 1rem;
}

.control-row,
.hint-row {
    pointer-events: auto;
}

.control-button,
.sheet-close,
.track-option {
    min-height: 62px;
    padding: 0 22px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(9, 20, 32, 0.76);
    color: var(--text);
    cursor: pointer;
    backdrop-filter: blur(14px);
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.shell-webos .control-row {
    gap: 14px;
}

.shell-webos .control-button,
.shell-webos .sheet-close,
.shell-webos .track-option {
    min-height: 72px;
    padding-inline: 24px;
    border-radius: 22px;
    font-size: 1.06rem;
}

.control-button-primary {
    border-color: rgba(255, 181, 106, 0.46);
    background: rgba(255, 181, 106, 0.16);
    color: #fff1dd;
}

.hint-row {
    color: var(--muted);
    font-size: 0.95rem;
}

.shell-webos .hint-row {
    gap: 16px;
    font-size: 1rem;
}

.track-sheet {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(2, 8, 14, 0.54);
    backdrop-filter: blur(14px);
}

.shell-webos .track-sheet {
    padding: 48px;
}

.track-sheet[hidden] {
    display: none;
}

.track-card {
    width: min(620px, 100%);
    max-height: min(82vh, 840px);
    overflow: auto;
    padding: 24px;
    border: 1px solid var(--line-strong);
    border-radius: 28px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
}

.shell-webos .track-card {
    width: min(860px, 100%);
    max-height: 84vh;
    padding: 32px;
    border-radius: 32px;
}

.track-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.track-options {
    display: grid;
    gap: 12px;
}

.track-empty-state {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.track-option {
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
    justify-content: space-between;
    text-align: left;
}

.track-option.is-selected {
    border-color: rgba(255, 181, 106, 0.5);
    background: rgba(255, 181, 106, 0.12);
    color: #fff1dd;
}

.track-option-label,
.track-option-state {
    display: block;
}

.track-option-state {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.92rem;
}

.hero-play:hover,
.control-button:hover,
.sheet-close:hover,
.track-option:hover {
    transform: translateY(-1px);
}

.hero-play:focus-visible,
.control-button:focus-visible,
.sheet-close:focus-visible,
.track-option:focus-visible,
.timeline:focus-visible {
    outline: none;
    border-color: rgba(255, 181, 106, 0.92);
    box-shadow: 0 0 0 4px rgba(255, 181, 106, 0.22);
}

.shell-webos .hero-play:focus-visible,
.shell-webos .control-button:focus-visible,
.shell-webos .sheet-close:focus-visible,
.shell-webos .track-option:focus-visible,
.shell-webos .timeline:focus-visible {
    box-shadow: 0 0 0 5px rgba(255, 181, 106, 0.28);
}

.timeline:focus-visible {
    border-radius: 999px;
}

@media (max-width: 980px) {
    .hud-top,
    .hud-bottom {
        padding-inline: 18px;
    }

    .headline-wrap {
        max-width: none;
    }

    .hero-play {
        min-width: 220px;
        min-height: 64px;
        font-size: 1.08rem;
    }

    .control-button,
    .sheet-close,
    .track-option {
        min-height: 54px;
        border-radius: 16px;
    }

    .subtitle-overlay {
        bottom: 158px;
        padding-inline: 16px;
    }

    .hint-row {
        display: none;
    }
}
