/* AtomicTime's daily challenge on the web: the look of the Atomic games
   (lib/theme/app_theme.dart) and of juegos.forjait.com. */

:root {
    --bg: #0B1026;
    --bg2: #1E1250;
    --glass: rgba(255, 255, 255, .06);
    --glass-strong: rgba(255, 255, 255, .1);
    --border: rgba(255, 255, 255, .14);
    --card: #1B1846;
    --panel: #1E1650;
    --text: #F1F5F9;
    --muted: #A5B4C8;
    --cyan: #22D3EE;
    --violet: #8B5CF6;
    --gold: #FBBF24;
    --orange: #FB923C;
    --success: #34D399;
    --error: #F87171;
    --on-accent: #2A1600;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* The flags font only exists where the page adds it (Windows, see
       app.js), and only draws flags. */
    font-family: "Twemoji Country Flags", Outfit, system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg) linear-gradient(180deg, var(--bg), var(--bg2)) fixed;
    -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

a { color: var(--cyan); }

button { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

/* Header and footer, as on the rest of the site. */

.top { padding: 18px 0 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: .5px; color: var(--text); text-decoration: none; }
.brand span, h1 span {
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.langs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.lang { font-size: 14px; font-weight: 600; text-decoration: none; padding: 4px 12px;
        border: 1px solid var(--border); border-radius: 20px; color: var(--text); }

main { flex: 1; padding-bottom: 32px; }

footer { padding: 20px 0 28px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
footer a { color: var(--muted); }

/* Buttons */

.primary {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 800;
    color: var(--on-accent);
    background: linear-gradient(135deg, var(--gold), var(--orange));
    box-shadow: 0 8px 24px rgba(251, 191, 36, .25);
    cursor: pointer;
}
.primary.big { font-size: 20px; padding: 16px 20px; }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .6; cursor: default; }

.ghost {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 11px 16px;
    font-size: 16px;
    font-weight: 700;
    background: var(--glass);
    cursor: pointer;
}

.link { background: none; border: 0; padding: 0; color: var(--cyan); text-decoration: underline; cursor: pointer; font-size: inherit; }
footer .link { color: var(--muted); }

.store {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--glass-strong);
    color: var(--text);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.panel {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    margin-top: 16px;
}
.panel h2 { margin: 0 0 4px; font-size: 18px; text-align: center; }
.panel > .muted { margin: 0; text-align: center; }

/* Presentation */

.hero { text-align: center; padding: 28px 0 8px; }
.icon { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.eyebrow { margin: 12px 0 0; font-weight: 700; letter-spacing: 1px; color: var(--muted); }
h1 { font-size: clamp(34px, 9vw, 52px); line-height: 1.1; margin: 4px 0 12px; font-weight: 800; }
.lead { color: var(--muted); font-size: 18px; margin: 0 auto 22px; max-width: 460px; }
.hero .muted.small { margin: 10px 0 0; }
#intro-country { margin: 6px 0 0; }

.how { margin: 20px 0 12px; padding: 0; list-style: none; counter-reset: how; }
.how li {
    counter-increment: how;
    position: relative;
    padding: 10px 12px 10px 48px;
    margin-bottom: 8px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.how li::before {
    content: counter(how);
    position: absolute;
    left: 12px;
    top: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--on-accent);
    background: var(--gold);
}

/* Country: a one-line field that opens the list, as in the apps
   ("País del jugador" in AtomicWordServer/docs/linea-atomic.md). */

.question { text-align: center; padding-top: 28px; }
.question h2 { font-size: 28px; margin: 0 0 6px; }
.question p { margin: 0 auto 18px; max-width: 440px; }
.note { margin: 0 0 14px; }

.field {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 12px;
    padding: 12px 12px 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--glass);
    text-align: left;
    cursor: pointer;
}
.field .value { flex: 1; min-width: 0; font-size: 17px; font-weight: 600;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field .count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.field .chevron { color: var(--muted); font-size: 14px; }

.sheet {
    width: 100%;
    max-width: 560px;
    height: 85vh;
    max-height: 85vh;
    margin: auto auto 0;
    padding: 0;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: var(--panel);
    color: var(--text);
}
.sheet::backdrop { background: rgba(5, 8, 20, .65); }
.sheet-body { display: flex; flex-direction: column; height: 100%; padding: 20px 20px 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head h2 { margin: 0; font-size: 21px; font-weight: 800; }
.sheet-head h2 span { font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.sheet .x {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--glass);
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
}
.search {
    width: 100%;
    margin: 12px 0 8px;
    padding: 12px 14px 12px 42px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-size: 16px; /* 16px or more: iPhones don't zoom in */
    color: var(--text);
    background: var(--glass) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23A5B4C8' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center;
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: 2px solid rgba(251, 191, 36, .6); }
.list-wrap { position: relative; flex: 1; min-height: 0; }
.list { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 40px; }
.group { margin: 14px 4px 4px; font-size: 14px; font-weight: 700; color: var(--gold); }
.group span { font-size: 12px; font-weight: 500; color: var(--muted); }
.options { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; }
.option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 9px 4px;
    border: 0;
    border-radius: 10px;
    background: none;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.option:hover, .option:focus-visible { background: var(--glass); }
.option::before {
    content: '';
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    border: 2px solid var(--muted);
    border-radius: 50%;
}
.option.selected { font-weight: 700; }
.option.selected::before {
    border-color: var(--gold);
    background: radial-gradient(circle, var(--gold) 0 4px, transparent 5px);
}
.option .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.none-option { margin-top: 8px; }
.more {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 0 4px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    background: linear-gradient(180deg, rgba(30, 22, 80, 0), var(--panel) 65%);
    pointer-events: none;
}
.empty { margin: 24px 0 0; text-align: center; color: var(--muted); }

@media (min-width: 600px) {
    .sheet { height: 80vh; margin: auto; border-bottom: 1px solid var(--border); border-radius: 24px; }
}

/* Game */

.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 0 10px;
    font-weight: 700;
}
.bar .progress { color: var(--muted); font-weight: 600; font-size: 15px; }
.lives { letter-spacing: 2px; font-size: 18px; }

.stage {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 8px 0 12px;
    background: linear-gradient(180deg, var(--bg) 85%, rgba(11, 16, 38, 0));
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .3);
}
.card .cat { font-size: 13px; font-weight: 700; }
.card .text { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 4px 0 6px; }
.card .year { font-size: 26px; font-weight: 800; color: var(--gold); }
.card .year.hidden { color: var(--muted); }
.card .fact { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.hint-button {
    border: 1px solid rgba(251, 191, 36, .45);
    background: rgba(251, 191, 36, .1);
    color: var(--gold);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.hint-shown { color: var(--gold); font-weight: 700; font-size: 15px; }
.tap-hint { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 14px; }

/* Sundays: the card's clock, red in its last 5 seconds, like the app's. */
.clock { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.clock-track { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.clock-fill { height: 100%; border-radius: 4px; background: var(--gold); transition: width .1s linear; }
.clock-left { min-width: 26px; text-align: right; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.clock.ending .clock-fill { background: var(--error); }
.clock.ending .clock-left { color: var(--error); }

.reveal-title { margin: 0 0 8px; text-align: center; font-size: 22px; font-weight: 800; }
.reveal-title.right { color: var(--success); }
.reveal-title.wrong { color: var(--error); }
.where { margin: 8px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.stage .primary { margin-top: 12px; }

/* The timeline */

.timeline { list-style: none; margin: 0; padding: 0; }

.tcard {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    margin: 4px 0;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background .4s, border-color .4s;
}
.tcard .year { flex: 0 0 auto; min-width: 72px; font-weight: 800; color: var(--gold); font-size: 17px; }
.tcard .body { flex: 1; min-width: 0; }
.tcard .text { font-weight: 600; line-height: 1.3; }
.tcard .cat { font-size: 12px; color: var(--muted); }
.tcard .fact { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.tcard .mark { flex: 0 0 auto; font-size: 16px; }
.tcard.anchor { border-color: rgba(34, 211, 238, .45); }
.tcard.anchor .year { color: var(--cyan); }
.tcard.right { border-color: rgba(52, 211, 153, .5); }
.tcard.right .year { color: var(--success); }
.tcard.wrong { border-color: rgba(248, 113, 113, .5); }
.tcard.wrong .year { color: var(--error); }
.tcard.landed { background: rgba(248, 113, 113, .14); border-style: dashed; }
.tcard.fresh { background: rgba(251, 191, 36, .16); }

.slot { display: flex; justify-content: center; }
.slot button {
    width: 100%;
    min-height: 40px;
    margin: 2px 0;
    border: 1px dashed rgba(251, 191, 36, .5);
    border-radius: 12px;
    background: rgba(251, 191, 36, .05);
    color: var(--gold);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}
.slot button:hover, .slot button:focus-visible { background: rgba(251, 191, 36, .16); }
.goes-here {
    margin: 4px 0;
    padding: 8px 12px;
    border: 2px dashed var(--gold);
    border-radius: 12px;
    text-align: center;
    color: var(--gold);
    font-weight: 800;
    font-size: 15px;
}

/* Result */

.result-head { text-align: center; padding-top: 22px; }
.result-head h2 { margin: 0; font-size: 26px; }
.result-head .challenge { margin: 0; color: var(--muted); font-weight: 600; }
.score { margin: 6px 0 0; font-size: 56px; font-weight: 800; line-height: 1.1; color: var(--gold); }
.grid { margin: 4px 0 0; font-size: 26px; letter-spacing: 2px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; margin: 18px 0; }
.stats b { display: block; font-size: 24px; font-weight: 800; }
.stats span { font-size: 12px; color: var(--muted); }

.copied { margin: 8px 0 0; text-align: center; color: var(--success); font-weight: 700; }

.standing { margin: 2px 0 0; text-align: center; color: var(--gold); font-weight: 800; font-size: 16px; }
.bars { margin-top: 10px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 13px; }
.bar-row .label { width: 34px; color: var(--muted); }
.bar-row .track { flex: 1; }
.bar-row .fill { height: 16px; min-width: 4px; border-radius: 6px; background: var(--violet); }
.bar-row .pct { width: 76px; text-align: right; color: var(--muted); }
.bar-row.mine .label, .bar-row.mine .pct { color: var(--gold); font-weight: 800; }
.bar-row.mine .fill { background: var(--gold); }

.rank-row { display: flex; gap: 8px; padding: 2px 0; }
.rank-row .pos { width: 34px; color: var(--muted); }
.rank-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .avg { font-weight: 800; }
.rank-row.mine { color: var(--gold); font-weight: 800; }
.rank-row.mine .pos { color: var(--gold); }

.countdown { text-align: center; margin: 18px 0 10px; font-size: 16px; }
.countdown b { font-variant-numeric: tabular-nums; }

.message { text-align: center; margin: 12px 0 0; }

.spinner {
    width: 26px;
    height: 26px;
    margin: 8px auto;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2s; }
    .tcard { transition: none; }
}

@media (min-width: 600px) {
    .hero { padding-top: 48px; }
}
