/* ═══════════════════════════════════════════════════════════════════════════
   Songless Unlimited

   The interface is modelled on the faceplate of a hi-fi amplifier in a dim
   room: near-black panels with a green undertone, silkscreened labels in small
   caps, tabular numerals like a tape counter, and indicator lamps that report
   state at a glance. Depth comes from hairline borders and small shifts in
   panel lightness — no drop shadows competing for attention.

   The recurring motif is the status lamp: a coloured edge or dot that says
   correct / missed / in progress / unlit. It appears on progress rows, recap
   rows, mode buttons and calendar cells, so one visual language carries state
   across the whole site.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Inter, self-hosted rather than pulled from Google Fonts: one fewer external
   dependency, one fewer DNS/TLS round trip before the UI's own type appears,
   and it keeps working for visitors whose network blocks Google's font CDN.
   Variable font — two files (latin + latin-ext) cover the full 100–900 weight
   range this stylesheet uses, so there's no per-weight request. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/inter-latin-var.woff2') format('woff2-variations'),
         url('/fonts/inter-latin-var.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                   U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                   U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/inter-latin-ext-var.woff2') format('woff2-variations'),
         url('/fonts/inter-latin-ext-var.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                   U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                   U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* Panel surfaces — one hue, lightness only. Higher number = closer to you. */
    --panel-0: #111311;   /* the room behind the unit */
    --panel-1: #1a1e1a;   /* the faceplate */
    --panel-2: #232823;   /* a raised control */
    --panel-3: #2e342e;   /* a control under the pointer */
    --panel-inset: #0b0d0b; /* recessed — inputs receive content, so they sink */

    /* Hairlines. Low-alpha so they define edges without drawing the eye. */
    --line-soft: rgba(255, 255, 255, 0.09);
    --line: rgba(255, 255, 255, 0.15);
    --line-strong: rgba(255, 255, 255, 0.26);

    /* Four levels of text, each with a job. */
    --ink: #f7f9f7;        /* headlines, answers */
    --ink-2: #d4dad4;      /* body */
    --silkscreen: #9aa39a; /* printed labels, metadata */
    --ink-dim: #6e766e;    /* disabled, unlit, placeholder */

    /* Indicator lamps. One accent (green); amber and red are status, not decor. */
    --lamp: #3ddc84;
    --lamp-bright: #5ce89b;
    --lamp-amber: #e5a94a;
    --lamp-red: #ef6f68;

    /* Lamp-tinted panels for state rows. */
    --panel-good: #16281c;
    --panel-bad: #2a1a19;
    --panel-warm: #282013;

    --radius-sm: 6px;   /* buttons, inputs, cells */
    --radius-md: 10px;  /* cards, rows */
    --radius-lg: 14px;  /* modals */

    /* 4px base unit. */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;

    --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", sans-serif;
    /* Numerals, labels and scores keep the tape-counter voice (uppercase,
       tracked-out, tabular-nums) but in Inter like everything else — Inter's
       tabular figures line up numerals just as well as an actual monospace
       face, without switching typefaces mid-site. */
    --font-mono: var(--font);

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

/* Browsers give form controls their own UA-default font instead of
   inheriting the page's — button/input/select/textarea would silently
   render in Arial even though every rule above them says Inter. Force the
   inherit so no current or future control can slip through. */
button, input, select, textarea { font-family: inherit; }

/* ── Embed Escape Banner ─────────────────────────────────────────────────────
   Shown only when the page is loaded inside someone else's iframe — see the
   inline script in <head> that sets html.is-embedded synchronously, before
   first paint, so this never causes a layout shift on load. Direct visitors
   never see it: `.embed-banner` stays display:none until that class exists. */

.embed-banner {
    display: none;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--s2) var(--s3);
    width: 100%;
    padding: var(--s3) var(--s5);
    background-color: var(--panel-good);
    border-bottom: 1px solid rgba(61, 220, 132, 0.3);
    position: relative;
    z-index: 20;
}

html.is-embedded .embed-banner { display: flex; }

.embed-banner-text {
    margin: 0;
    font-size: 0.86rem;
    color: var(--ink-2);
}

.embed-banner-link {
    color: var(--lamp);
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.embed-banner-link:hover { color: var(--lamp-bright); }

.embed-banner-dismiss {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--ink-dim);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.embed-banner-dismiss:hover { color: var(--ink); background-color: var(--panel-2); }

/* ── Page shell ──────────────────────────────────────────────────────────── */

body {
    background-color: var(--panel-0);
    color: var(--ink-2);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    text-align: center;
    -webkit-font-smoothing: antialiased;
    transition: filter 0.3s var(--ease);
}

/* Drifting notes belong behind the glass, not on it. */
#notesBg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}

.blurred {
    filter: blur(5px);
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 640px;
    padding: var(--s5);
    margin: 0 auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.screen { display: none; }
.screen.active { display: block; }

/* ── Type ────────────────────────────────────────────────────────────────── */

.game-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-align: center;
    margin: 0 0 var(--s2);
    flex-grow: 1;
}

.title-word { display: inline-block; }

.section-title {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--silkscreen);
    margin: 0;
}

.tagline {
    color: var(--silkscreen);
    font-size: 0.94rem;
    margin: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

/* One control geometry everywhere: same height, radius, weight and easing.
   Only the fill changes between roles. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    min-height: 44px;
    padding: 0 var(--s5);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background-color: var(--panel-2);
    color: var(--ink-2);
    font-family: var(--font);
    font-size: 0.94rem;
    font-weight: 550;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s var(--ease),
                border-color 0.15s var(--ease),
                color 0.15s var(--ease);
}

.btn:hover { background-color: var(--panel-3); color: var(--ink); }
.btn:active { transform: translateY(0.5px); }

.btn:focus-visible {
    outline: 2px solid var(--lamp);
    outline-offset: 2px;
}

/* The one lit control on any given screen. */
.btn-primary {
    background-color: var(--lamp);
    border-color: var(--lamp);
    color: #05230f;
    font-weight: 650;
}

.btn-primary:hover {
    background-color: var(--lamp-bright);
    border-color: var(--lamp-bright);
    color: #05230f;
}

/* Quiet outline — secondary actions that shouldn't compete. */
.btn-ghost {
    background-color: transparent;
    border-color: var(--line);
    color: var(--silkscreen);
}

.btn-ghost:hover {
    background-color: var(--panel-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn--disabled,
.btn--disabled:hover,
.btn:disabled {
    background-color: var(--panel-2);
    border-color: transparent;
    color: var(--ink-dim);
    cursor: not-allowed;
}

.btn-block { width: 100%; }

/* ── Home ────────────────────────────────────────────────────────────────── */

#home-page-content.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    flex-grow: 1;
    gap: var(--s6);
    width: 100%;
    padding: var(--s6) 0;
}

.section-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s3);
    width: 100%;
    max-width: 420px;
}

.masthead { gap: var(--s2); }

.how-to-block {
    padding-top: var(--s4);
    gap: var(--s2);
}

/* Segmented control — one recessed track, the active segment lifts out of it. */
.input-mode-selector {
    display: flex;
    gap: var(--s1);
    padding: var(--s1);
    width: 100%;
    background-color: var(--panel-inset);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
}

.mode-btn {
    flex: 1;
    min-height: 38px;
    padding: 0 var(--s2);
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--silkscreen);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 550;
    cursor: pointer;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.mode-btn:hover { color: var(--ink-2); }

.mode-btn.active {
    background-color: var(--panel-2);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
}

/* Fixed height so switching modes doesn't shunt the start button up and down. */
.mode-panels {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 74px;
}

.daily-song-container,
.artist-input-container,
.genre-input-container {
    width: 100%;
}

.field-label {
    display: block;
    margin-bottom: var(--s2);
    text-align: left;
}

/* Inputs are inset — darker than their surroundings, so they read as
   "put something here" without a heavy border. */
input[type="text"],
select,
#guess-input {
    width: 100%;
    min-height: 44px;
    padding: 0 var(--s3);
    background-color: var(--panel-inset);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.94rem;
    transition: border-color 0.15s var(--ease);
}

input[type="text"]::placeholder,
#guess-input::placeholder { color: var(--ink-dim); }

input[type="text"]:focus,
select:focus,
#guess-input:focus {
    outline: none;
    border-color: var(--lamp);
}

select {
    appearance: none;
    -webkit-appearance: none;
    /* Chevron drawn in the border colour so it belongs to the control. */
    background-image: linear-gradient(45deg, transparent 50%, var(--silkscreen) 50%),
                      linear-gradient(135deg, var(--silkscreen) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: var(--s7);
    cursor: pointer;
}

#validation-message {
    font-size: 0.84rem;
    line-height: 20px;
    min-height: 20px;
    color: var(--lamp-amber);
    margin: 0;
}

/* Today's line — a readout, so monospace with tabular figures. */
.daily-stats {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--silkscreen);
    text-align: center;
    margin: 0;
    min-height: 18px;
}

.daily-stats--complete { color: var(--lamp); }

/* Share + copy sit below the primary action and read as a subordinate pair:
   same height, ghost fill, no emoji shouting for attention. */
.daily-share-row {
    display: flex;
    gap: var(--s2);
    width: 100%;
}

.home-share-btn,
.home-copy-btn { flex: 1; }

.how-to-hint {
    font-size: 0.78rem;
    color: var(--ink-dim);
    margin: 0;
}

.how-to-play-btn {
    padding: 0 var(--s6);
    min-height: 38px;
    font-size: 0.84rem;
    font-weight: 500;
}

/* Elements that come and go keep their slot, so the page never reflows. */
.is-hidden {
    visibility: hidden;
    pointer-events: none;
}

/* ── Archive entry point ─────────────────────────────────────────────────── */

.daily-archive { width: 100%; }

.archive-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    width: 100%;
    min-height: 52px;
    padding: 0 var(--s4);
    background-color: var(--panel-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--ink-2);
    text-decoration: none;
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 550;
    cursor: pointer;
    transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.archive-link:hover {
    background-color: var(--panel-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.archive-link-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.archive-link-sub {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    font-weight: 400;
    color: var(--silkscreen);
}

.archive-link-caret {
    color: var(--ink-dim);
    font-size: 1.1rem;
    line-height: 1;
}

/* ── Calendar ────────────────────────────────────────────────────────────── */

#calendar-page.active {
    display: flex;
    flex-direction: column;
    gap: var(--s5);
    width: 100%;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    width: 100%;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--s1);
    min-height: 44px;
    color: var(--silkscreen);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 550;
    transition: color 0.15s var(--ease);
}

.back-link:hover { color: var(--ink); }

/* Balances the back link so the title sits centred. */
.page-header-spacer { width: 64px; flex-shrink: 0; }

.calendar-summary {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--silkscreen);
    text-align: center;
    margin: 0;
}

.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s5);
    width: 100%;
}

.month-label { min-width: 170px; }

.month-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    margin: 0;
}

.month-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    flex-shrink: 0;
    background-color: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
                color 0.15s var(--ease);
}

.month-btn:hover:not(:disabled) {
    background-color: var(--panel-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.month-btn:disabled {
    color: var(--ink-dim);
    border-color: var(--line-soft);
    cursor: not-allowed;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--s1);
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.calendar-weekday {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--silkscreen);
    text-align: center;
    padding-bottom: var(--s1);
}

.calendar-blank { aspect-ratio: 1; }

/* A day is an indicator lamp. Its three dots are the three songs, so a whole
   month of results reads at a glance without a single number being parsed. */
.calendar-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    background-color: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
                color 0.15s var(--ease);
}

.calendar-day:hover:not(:disabled) {
    background-color: var(--panel-3);
    border-color: var(--line-strong);
    color: var(--ink);
}

.calendar-day:focus-visible {
    outline: 2px solid var(--lamp);
    outline-offset: 1px;
}

/* Unlit: the day hasn't arrived, or predates the archive. Inert on purpose. */
.calendar-day--locked,
.calendar-day--locked:hover {
    background-color: transparent;
    border-color: transparent;
    color: var(--ink-dim);
    opacity: 0.55;
    cursor: not-allowed;
}

.calendar-day--complete {
    background-color: var(--panel-good);
    border-color: rgba(61, 220, 132, 0.38);
    color: var(--ink);
}

.calendar-day--partial {
    background-color: var(--panel-warm);
    border-color: rgba(229, 169, 74, 0.4);
    color: var(--ink);
}

/* Today wears the lamp ring even before it's played. */
.calendar-day--today {
    border-color: var(--lamp);
    color: var(--ink);
}

.calendar-day-num { line-height: 1; }

.calendar-day-dots {
    display: flex;
    gap: 3px;
    height: 5px;
}

.day-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--ink-dim);
}

.day-dot--correct { background-color: var(--lamp); }
.day-dot--wrong { background-color: var(--lamp-red); }

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s2) var(--s4);
    width: 100%;
    padding-top: var(--s4);
    border-top: 1px solid var(--line-soft);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--silkscreen);
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    border: 1px solid var(--line);
    background-color: var(--panel-2);
}

.legend-swatch--complete {
    background-color: var(--panel-good);
    border-color: rgba(61, 220, 132, 0.5);
}

.legend-swatch--partial {
    background-color: var(--panel-warm);
    border-color: rgba(229, 169, 74, 0.5);
}

.legend-swatch--locked {
    background-color: transparent;
    border-color: var(--line-soft);
}

.calendar-empty {
    font-size: 0.86rem;
    color: var(--silkscreen);
    text-align: center;
    margin: 0;
}

/* ── Game screen ─────────────────────────────────────────────────────────── */

#game-screen.active {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    position: relative;
    transition: filter 0.3s var(--ease);
}

.game-main {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
}

.game-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 44px;
    margin-bottom: var(--s2);
}

.game-header .game-title {
    font-size: 1.2rem;
    margin: 0;
}

.home-icon-btn,
.settings-icon-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--s2);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--silkscreen);
    text-decoration: none;
    font-family: var(--font);
    font-size: 0.86rem;
    font-weight: 550;
    cursor: pointer;
    transition: color 0.15s var(--ease);
}

.home-icon-btn { left: 0; }
.settings-icon-btn { right: 0; font-size: 1.15rem; }

.home-icon-btn:hover,
.settings-icon-btn:hover { color: var(--ink); }

/* Guess rows — one per stage, filled top-down as the round goes on. */
.guess-boxes-container {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    margin: 0 0 var(--s3);
}

.guess-box {
    display: flex;
    align-items: center;
    gap: var(--s3);
    min-height: 36px;
    padding: 0 var(--s4);
    background-color: var(--panel-1);
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--panel-3);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    text-align: left;
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.guess-box.empty {
    min-height: 30px;
    background-color: transparent;
    border-color: var(--line-soft);
    border-left-color: var(--panel-3);
}

.guess-box.skipped {
    background-color: var(--panel-1);
    border-left-color: var(--silkscreen);
}

.guess-box.skipped::after {
    content: "Skipped";
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--silkscreen);
    margin-left: auto;
}

.guess-box.wrong {
    background-color: var(--panel-bad);
    border-left-color: var(--lamp-red);
}

.guess-box.correct {
    background-color: var(--panel-good);
    border-left-color: var(--lamp);
}

.guess-box .guess-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
}

.guess-box .status {
    flex-shrink: 0;
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--lamp-red);
}

.guess-box .status.correct-status { color: var(--lamp); }

/* Stage readout */
.game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s3);
}

.stage-info {
    display: flex;
    align-items: baseline;
    gap: var(--s2);
}

.stage-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--silkscreen);
}

.stage-duration {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--lamp);
}

#timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s2);
    width: 100%;
}

.time-display {
    display: flex;
    align-items: center;
    width: 100%;
}

.time-label { display: none; }

.current-time {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--silkscreen);
}

.progress-bar-container {
    flex-grow: 1;
    height: 4px;
    background-color: var(--panel-2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--lamp);
    transition: width 0.15s linear;
}

/* The one round control — a physical knob, so the circle is earned. */
.play-control {
    display: flex;
    justify-content: center;
    margin: var(--s1) 0 var(--s2);
}

.play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--lamp);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.play-btn:hover { background-color: var(--lamp-bright); }
.play-btn:active { transform: scale(0.96); }

.play-icon,
.pause-icon {
    font-size: 1.4rem;
    color: #05230f;
    line-height: 1;
}

.play-icon { margin-left: 3px; }

.game-controls {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
}

.search-container {
    position: relative;
    width: 100%;
}

.autocomplete-results {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    margin-bottom: var(--s1);
    background-color: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    max-height: 180px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.autocomplete-results.active { display: block; }

.autocomplete-item {
    padding: var(--s3) var(--s4);
    cursor: pointer;
    font-size: 0.88rem;
    text-align: left;
    color: var(--ink-2);
    transition: background-color 0.1s var(--ease), color 0.1s var(--ease);
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: var(--panel-3);
    color: var(--ink);
}

.button-container {
    display: flex;
    gap: var(--s2);
}

#skip-button { flex: 1; }
#submit-button { flex: 2; }

/* ── Daily progress panel (game screen) ──────────────────────────────────── */

.daily-progress-panel {
    display: none; /* JS reveals it in daily mode */
    width: 100%;
    margin-top: var(--s2);
}

.progress-panel-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-dim);
    margin: 0 0 var(--s2);
    text-align: left;
}

.progress-panel-items {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
}

.progress-bar-item {
    display: flex;
    align-items: center;
    gap: var(--s3);
    min-height: 36px;
    padding: 0 var(--s3);
    background-color: var(--panel-1);
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--panel-2);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.progress-bar-item.pbi--current {
    background-color: var(--panel-2);
    border-left-color: var(--lamp);
}

.progress-bar-item.pbi--correct {
    background-color: var(--panel-good);
    border-left-color: var(--lamp);
}

.progress-bar-item.pbi--wrong {
    background-color: var(--panel-bad);
    border-left-color: var(--lamp-red);
}

.pbi-num {
    flex-shrink: 0;
    width: 14px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-dim);
}

.pbi-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-size: 0.8rem;
    color: var(--silkscreen);
}

.progress-bar-item.pbi--correct .pbi-info { color: var(--lamp); }
.progress-bar-item.pbi--wrong .pbi-info { color: var(--lamp-red); }

.pbi-status {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--silkscreen);
}

/* ── Modals ──────────────────────────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--s4);
    background-color: rgba(6, 7, 6, 0.72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.modal.active { display: flex; }

.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s4);
    background-color: rgba(6, 7, 6, 0.72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 380px;
    padding: var(--s6);
    background-color: var(--panel-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--s4);
}

.modal-content h2 {
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--ink);
    margin: 0;
}

.modal-content p {
    font-size: 0.94rem;
    color: var(--ink-2);
    margin: 0;
}

/* Outcome is carried by the lamp on the heading, not a border around everything. */
.modal-content.success h2 { color: var(--lamp); }
.modal-content.failure h2 { color: var(--lamp-red); }

.modal-album-art {
    width: 128px;
    height: 128px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: 0 auto;
    display: block;
}

.modal-title { font-size: 1.15rem; font-weight: 650; color: var(--ink); margin: 0; }

.settings-content { max-width: 340px; }

.setting-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--s3);
    width: 100%;
}

.volume-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--silkscreen);
    text-align: left;
}

.close-btn {
    position: absolute;
    top: var(--s3);
    right: var(--s3);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--ink-dim);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.close-btn:hover { color: var(--ink); background-color: var(--panel-2); }

/* Volume slider — a fader on the panel. */
#volume-slider-modal {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--panel-3);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
}

#volume-slider-modal::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--lamp);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
}

#volume-slider-modal::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--lamp);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

#volume-slider-modal::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--panel-3);
    border-radius: 2px;
}

/* How to play */
.how-to-play-content {
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--ink-2);
    max-height: 62vh;
    overflow-y: auto;
    padding-right: var(--s2);
}

.how-to-play-content h3 {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--lamp);
    margin: var(--s5) 0 var(--s2);
}

.how-to-play-content h3:first-child { margin-top: 0; }
.how-to-play-content p { margin: 0 0 var(--s3); font-size: 0.9rem; }
.how-to-play-content ul { margin: 0 0 var(--s3); padding-left: var(--s5); }
.how-to-play-content li { margin-bottom: var(--s2); }
.how-to-play-content strong { color: var(--ink); font-weight: 600; }

/* ── Results card (recap + saved day) ────────────────────────────────────── */

.recap-modal-overlay { align-items: center; }

.recap-card {
    width: 100%;
    max-width: 380px;
    padding: var(--s6);
    background-color: var(--panel-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: var(--s4);
}

.recap-heading {
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--ink);
    text-align: center;
    margin: 0;
}

/* The score is the payload — big, mono, tabular. */
.recap-score {
    font-family: var(--font-mono);
    font-size: 2.1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--lamp);
    text-align: center;
    line-height: 1;
    margin: calc(var(--s3) * -1) 0 0;
}

.recap-score-sub {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--silkscreen);
    text-align: center;
    margin: var(--s2) 0 0;
}

.recap-song-list {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    max-height: 300px;
    overflow-y: auto;
}

.recap-song-row {
    display: flex;
    align-items: center;
    gap: var(--s2);
    min-height: 38px;
    padding: 0 var(--s3);
    background-color: var(--panel-2);
    border-left: 3px solid var(--panel-3);
    border-radius: var(--radius-sm);
}

.recap-song-row.recap-correct {
    background-color: var(--panel-good);
    border-left-color: var(--lamp);
}

.recap-song-row.recap-wrong {
    background-color: var(--panel-bad);
    border-left-color: var(--lamp-red);
}

.recap-song-num {
    flex-shrink: 0;
    width: 12px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-dim);
}

.recap-song-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-size: 0.84rem;
    color: var(--ink);
}

.recap-song-meta {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: var(--silkscreen);
}

.recap-summary {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    color: var(--silkscreen);
    text-align: center;
    margin: 0;
    padding-top: var(--s3);
    border-top: 1px solid var(--line-soft);
}

.recap-actions {
    display: flex;
    gap: var(--s2);
}

.recap-actions--stacked { flex-direction: column; }

.recap-actions-secondary {
    display: flex;
    gap: var(--s2);
}

.recap-actions-secondary .recap-close-btn { flex: 1; }

.recap-share-btn { flex: 2; }
.recap-close-btn { flex: 1; }

/* ── Loading ─────────────────────────────────────────────────────────────── */

.loading-screen-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(6, 7, 6, 0.8);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 2000;
}

.loading-screen-overlay.active { display: flex; }

.loading-message {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--silkscreen);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
    text-align: center;
    padding: var(--s5) 0;
    margin-top: auto;
    border-top: 1px solid var(--line-soft);
    width: 100%;
    position: relative;
    z-index: 1;
}

footer p {
    font-size: 0.72rem;
    color: var(--ink-dim);
    margin: 0;
}

/* ── Narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .container { padding: var(--s4); }

    #home-page-content.active { gap: var(--s6); padding-top: var(--s5); }

    .game-title { font-size: 1.45rem; }

    .play-btn { width: 56px; height: 56px; }

    .calendar-grid { gap: 3px; }
    .calendar-day { font-size: 0.74rem; gap: 4px; }
    .day-dot { width: 4px; height: 4px; }

    .modal-content,
    .recap-card { padding: var(--s5); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
