/* Colors as tokens so dark mode (shared/theme.js) only has to swap values. */
:root {
    --bg: #f6f7f9;
    --text: #1f2937;
    --muted: #6b7280;
    --card: #ffffff;
    --border: #dfe2e8;
    --accent: #0e8f8f;
    --accent-text: #ffffff;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.06);
    /* Score bands: 9+, 7+, 4+, under 4 (the recap bars, and the shared 🟩🟨🟧🟥) */
    --tier-0: #2fa45a;
    --tier-1: #e0b028;
    --tier-2: #f08a2c;
    --tier-3: #e5484d;
    --bar: #e7e9ee;
    /* The stage's surround: the same mid-grey in both themes, so the colors on it look the same */
    --surround: #767676;
}

:root[data-theme="dark"] {
    --bg: #15161a;
    --text: #e7e9ee;
    --muted: #9aa0ab;
    --card: #1f2127;
    --border: #2f323a;
    --accent: #3cc8c4;
    --accent-text: #0b2222;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
    --tier-0: #4ade80;
    --tier-1: #facc15;
    --tier-2: #fb923c;
    --tier-3: #f87171;
    --bar: #2f323a;
}

/* No double-tap zoom (pinch zoom still works) */
html {
    touch-action: manipulation;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

main {
    max-width: 520px;
    margin: auto;
    padding: 64px 16px 40px;
}

header {
    text-align: center;
}

h1 {
    margin: 0 0 6px;
    font-size: 2rem;
}

.tagline {
    margin: 0;
    color: var(--muted);
}

.tagline strong {
    color: var(--text);
}

.scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin: 16px 0 20px;
    color: var(--muted);
    font-size: 0.95rem;
}

.scores b {
    color: var(--text);
    font-size: 1.15rem;
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.help {
    width: 26px;
    height: 26px;
    padding: 0;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
}

/* ---------- The stage ---------- */

.stage {
    position: relative;
    display: grid;
    place-items: center;
    height: 240px;
    padding: 20px;
    background: var(--surround);
    border-radius: 20px;
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

.stage:focus {
    outline: none;
}

.stage > .swatch {
    width: 100%;
    height: 100%;
}

.swatch {
    border-radius: 14px;
}

.swatch[hidden],
.pair[hidden],
.timer[hidden],
.stage-text[hidden] {
    display: none;
}

.stage-text {
    margin: 0;
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
}

/* Target and pick side by side after Lock in */
.pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    height: 100%;
}

.pair figure {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
}

.pair .swatch {
    flex: 1;
}

.pair figcaption {
    margin-top: 6px;
    color: #ffffff;
    font-weight: 700;
    text-align: center;
}

/* Shrinks over the 3 seconds the color shows */
.timer {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 8px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    overflow: hidden;
}

.timer span {
    display: block;
    height: 100%;
    background: #ffffff;
    transform-origin: left;
}

.timer.run span {
    animation: timer 3s linear forwards;
}

@keyframes timer {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* ---------- Sliders ---------- */

.sliders[hidden] {
    display: none;
}

.slider {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    margin: 12px 0;
}

.slider-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.slider output {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Range inputs restyled so each track shows the colors it would make (--track, set in script.js),
   with a big thumb that's easy to drag with a thumb */
.slider input {
    grid-column: 1 / -1;
    width: 100%;
    height: 44px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider input::-webkit-slider-runnable-track {
    height: 20px;
    border-radius: 999px;
    background: var(--track, var(--border));
    border: 1px solid var(--border);
}

.slider input::-moz-range-track {
    height: 20px;
    border-radius: 999px;
    background: var(--track, var(--border));
    border: 1px solid var(--border);
}

.slider input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 34px;
    height: 34px;
    margin-top: -8px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #1f2937;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.slider input::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #1f2937;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.slider input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 999px;
}

/* ---------- Result and buttons ---------- */

.result {
    min-height: 1.5em;
    margin: 16px 0 8px;
    text-align: center;
    font-weight: 600;
}

.result .de {
    margin-left: 6px;
    color: var(--muted);
    font-size: 0.85rem;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

.go {
    min-width: 160px;
    padding: 12px 32px;
    font: inherit;
    font-weight: 700;
    color: var(--accent-text);
    background: var(--accent);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.go[hidden] {
    display: none;
}

.go:focus-visible,
.help:focus-visible,
.intro-actions button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- End of game ---------- */

.summary[hidden],
.play[hidden] {
    display: none;
}

.summary-kind {
    margin: 0 0 4px;
    text-align: center;
    color: var(--muted);
    font-weight: 600;
}

.summary h2 {
    margin: 0 0 16px;
    text-align: center;
    font-size: 1.6rem;
}

.recap {
    margin: 0 auto 8px;
    padding: 0;
    max-width: 400px;
    list-style: none;
}

.recap li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.recap li + li {
    margin-top: 8px;
}

/* The day's color and yours, overlapping, on the grey surround */
.recap-pair {
    display: flex;
    flex: none;
    padding: 4px;
    background: var(--surround);
    border-radius: 10px;
}

.swatch-sm {
    width: 30px;
    height: 30px;
    border-radius: 7px;
}

.swatch-sm + .swatch-sm {
    margin-left: 4px;
}

/* How close each round was, out of 10 */
.recap-bar {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: var(--bar);
    overflow: hidden;
}

.recap-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.recap-bar .tier-0 { background: var(--tier-0); }
.recap-bar .tier-1 { background: var(--tier-1); }
.recap-bar .tier-2 { background: var(--tier-2); }
.recap-bar .tier-3 { background: var(--tier-3); }

.recap b {
    min-width: 2.2em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* "Next daily" link under the results (shared/next-daily.css) */
.next-daily {
    margin-top: 14px;
}

/* ---------- How to play ---------- */

.intro {
    width: min(420px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    padding: 0;
    color: var(--text);
    background: var(--card);
    border: 0;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* ::backdrop doesn't see :root's tokens in every browser, so it gets a plain color */
.intro::backdrop {
    background: rgba(15, 23, 42, 0.55);
}

.intro-body {
    padding: 20px;
}

.intro h2 {
    margin: 0 0 14px;
    font-size: 1.3rem;
    text-align: center;
}

.intro-steps {
    margin: 0;
    padding-left: 20px;
    font-size: 0.92rem;
    line-height: 1.4;
}

.intro-steps li + li {
    margin-top: 6px;
}

.intro-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.intro-actions button {
    padding: 10px 18px;
    font: inherit;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
}

.intro-hide {
    color: var(--muted);
    background: transparent;
    border: 2px solid var(--border);
}

.intro-ok {
    min-width: 88px;
    color: var(--accent-text);
    background: var(--accent);
    border: 2px solid var(--accent);
}

@media (max-width: 480px) {
    .stage {
        height: 200px;
        padding: 16px;
    }

    .timer {
        left: 16px;
        right: 16px;
        bottom: 6px;
    }
}
