/* AtomicWord's daily challenge on the web: the look of the app
   (lib/theme/app_theme.dart, lib/widgets/) and of juegos.forjait.com.
   The country picker and panels are AtomicTime's web daily's. */

:root {
    --bg: #0B1026;
    --bg2: #1E1250;
    --glass: rgba(255, 255, 255, .08);
    --glass-strong: rgba(255, 255, 255, .1);
    --border: rgba(255, 255, 255, .15);
    --card: #1B1846;
    --panel: #1E1650;
    --text: #F1F5F9;
    --muted: #94A3B8;
    --cyan: #22D3EE;
    --violet: #8B5CF6;
    --gold: #FBBF24;
    --orange: #FB923C;
    --success: #34D399;
    --error: #F87171;
    --pink: #F472B6;
    --teal: #14B8A6;
    --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: 700;
    letter-spacing: .5px;
    color: #fff;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    box-shadow: 0 8px 24px rgba(139, 92, 246, .45);
    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: #fff;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
}

/* 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(34, 211, 238, .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(--cyan); }
.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(--cyan);
    background: radial-gradient(circle, var(--cyan) 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: the app's game screen (lib/screens/game_screen.dart). */

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

/* "📅 Reto diario #3 ··· 🔥 2", the app's _DailyBar. */
.daily-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 16px;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--border);
    font-size: 16px;
}
.daily-bar .spacer { flex: 1; }
.daily-bar .flame { font-weight: 800; font-size: 17px; color: var(--muted); filter: grayscale(1); }
.daily-bar .flame.on { color: var(--orange); filter: none; }

/* The category, as the app's top bar shows it. */
.chip-row { display: flex; justify-content: center; margin-top: 12px; }
.chip {
    padding: 7px 16px;
    border-radius: 30px;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--cyan);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The definition card (_DefinitionCard): ✨ or the country's flag. */
.definition {
    margin-top: 12px;
    padding: 22px 22px 24px;
    border-radius: 24px;
    background: var(--glass);
    border: 1px solid var(--border);
    text-align: center;
}
.sparkle { display: flex; justify-content: center; }
.slang { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slang .flag { font-size: 30px; line-height: 1; }
.slang-label { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--cyan); }
.clue { margin: 14px 0 0; font-size: 21px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }

/* The tiles (letter_tile.dart): one per letter, 20 to 54 px wide. */
.tiles-wrap { margin-top: 24px; }
.tiles {
    --size: 44px;
    display: flex;
    justify-content: center;
    gap: 6px;
}
.tiles.static { gap: 5px; margin: 6px 0 0; }
.tile {
    position: relative;
    flex: 0 0 auto;
    width: var(--size);
    height: calc(var(--size) * 1.15);
    display: grid;
    place-items: center;
    border-radius: calc(var(--size) * .22);
    border: 2px solid rgba(139, 92, 246, .45);
    background: var(--glass);
    font-size: calc(var(--size) * .52);
    font-weight: 700;
    color: #fff;
    line-height: 1;
    user-select: none;
}
/* Empty: the violet border breathes, like the app's superposition. */
.tile.empty { animation: breathe 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.37s); }
.tile.filled { background: rgba(255, 255, 255, .10); border-color: rgba(34, 211, 238, .7); }
.tile.wrong { background: rgba(248, 113, 113, .22); border-color: var(--error); }
.tile.hinted { background: rgba(251, 191, 36, .18); border-color: var(--gold); color: var(--gold); }
.tile.solved {
    background: linear-gradient(135deg, var(--success), var(--teal));
    border-color: var(--success);
    box-shadow: 0 0 14px rgba(52, 211, 153, .45);
    animation: flip .48s ease-in-out both;
    animation-delay: calc(var(--i) * 90ms);
}
.tiles.static .tile.solved { animation: none; }
/* A letter typed jumps in, and a cyan ring flashes out (the collapse). */
.tile.pop { animation: pop .42s ease-out; }
.tile.pop::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    border: 3px solid var(--cyan);
    box-shadow: 0 0 18px rgba(34, 211, 238, .55);
    animation: ring .42s ease-out forwards;
    pointer-events: none;
}
.tiles.shake { animation: shake .45s ease-in-out; }

@keyframes breathe {
    0%, 100% { border-color: rgba(139, 92, 246, .35); }
    50% { border-color: rgba(139, 92, 246, .6); }
}
@keyframes pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.14); }
    100% { transform: scale(1); }
}
@keyframes ring {
    from { opacity: .9; transform: scale(1); }
    to { opacity: 0; transform: scale(1.7); }
}
@keyframes flip {
    0% { transform: perspective(400px) rotateX(0); }
    50% { transform: perspective(400px) rotateX(90deg); }
    100% { transform: perspective(400px) rotateX(0); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(9px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(4px); }
}

/* "Intentos ● ● ○" (_AttemptsBar). */
.attempts { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 14px 0 0; }
.attempts .label { color: var(--muted); font-size: 13px; }
.attempts .dots { display: flex; gap: 6px; }
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(248, 113, 113, .7);
    transition: background .25s, border-color .25s;
}
.dot.left { background: var(--cyan); border-color: var(--cyan); }

.actions { min-height: 52px; display: flex; align-items: center; justify-content: center; margin: 6px 0 4px; text-align: center; }
.actions p { margin: 0; }
.no-help { font-size: 15px; }
.reward, .result-head h2.reward {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.revealed { font-size: 18px; font-weight: 700; color: var(--pink); }
.result-head h2.revealed { font-size: 26px; }
.ghost-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--glass);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* The keyboard (game_keyboard.dart), at the bottom while playing. */
.bottom {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0 -16px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(30, 18, 80, 0), var(--bg2) 22%);
}
.keyboard { --keys: 10; display: flex; flex-direction: column; gap: 7px; }
.krow { display: flex; justify-content: center; gap: 5px; }
.key {
    flex: 0 0 calc((100% - (var(--keys) - 1) * 5px) / var(--keys));
    min-width: 0;
    height: clamp(48px, 17vw - 14px, 66px);
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .09);
    font-size: clamp(19px, 5.5vw, 25px);
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    display: grid;
    place-items: center;
    transition: transform 90ms;
}
.key:active { transform: scale(.94); }
.key.wide { flex-basis: calc((100% - (var(--keys) - 1) * 5px) / var(--keys) * 1.6); background: rgba(139, 92, 246, .30); }
.bottom .primary { margin: 0; }



/* Result */

.result-head { text-align: center; padding-top: 22px; }
.result-head h2 { margin: 2px 0 0; font-size: 28px; font-weight: 800; }
.result-head > .muted { margin: 2px 0 12px; }
.result-clue { margin: 14px auto 0; max-width: 460px; color: var(--muted); font-size: 16px; line-height: 1.4; }
.result-clue .slang-label { color: var(--cyan); font-weight: 700; }
.result-head .challenge { margin: 0; color: var(--muted); font-weight: 600; }
.grid { margin: 12px 0 0; font-size: 26px; letter-spacing: 4px; }

.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(--cyan); 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: 84px; flex: 0 0 auto; color: var(--muted); white-space: nowrap; }
.bar-row .track { flex: 1; }
.bar-row .fill { height: 16px; min-width: 4px; border-radius: 6px; background: var(--violet); }
.bar-row .pct { width: 70px; flex: 0 0 auto; text-align: right; color: var(--muted); }
.bar-row.mine .label, .bar-row.mine .pct { color: var(--cyan); font-weight: 800; }
.bar-row.mine .fill { background: var(--cyan); }

.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(--cyan); font-weight: 800; }
.rank-row.mine .pos { color: var(--cyan); }

.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(--cyan);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2s; }
    .tile, .tile::after, .tiles.shake { animation: none !important; }
    .key, .dot { transition: none; }
}

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