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

:root {
    --bg: #0B1026;
    --bg2: #1E1250;
    --glass: rgba(255, 255, 255, .08);
    --glass-strong: rgba(255, 255, 255, .12);
    --border: rgba(255, 255, 255, .15);
    --panel: #1E1650;
    --text: #F1F5F9;
    --muted: #94A3B8;
    --cyan: #22D3EE;
    --violet: #8B5CF6;
    --pink: #F472B6;
    --gold: #FBBF24;
    --orange: #FB923C;
    --success: #34D399;
    --error: #F87171;
}

* { 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; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 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: the app's PrimaryButton (cyan to violet) and GhostButton. */

.primary {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    box-shadow: 0 8px 24px rgba(139, 92, 246, .35);
    cursor: pointer;
}
.primary.big { font-size: 20px; padding: 16px 20px; }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .6; cursor: default; }
.primary:focus-visible, .ghost:focus-visible, .store:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.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='%2394A3B8' 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). */

.game { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding-top: 14px; }

.status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--border);
}
.status-bar .title { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-bar .cal { margin-right: 8px; }
.streak { color: var(--orange); font-weight: 700; white-space: nowrap; }
.streak:empty { display: none; }
.dots { display: flex; gap: 4px; }
.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1.5px solid var(--muted);
    transition: background .25s, border-color .25s;
}
.dot.on { background: var(--pink); border-color: var(--pink); }

.chip {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 6px 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-align: center;
}
.chip .flag { font-size: 16px; letter-spacing: 0; }

.stage { display: flex; justify-content: center; padding: 4px 0; }
.drawing { width: auto; height: clamp(150px, 30vh, 230px); overflow: visible; color: var(--cyan); }
.drawing.won { color: var(--success); }
.drawing.lost { color: var(--error); }
.drawing line, .drawing path { fill: none; stroke-linecap: round; }
.gallows line { stroke: rgba(148, 163, 184, .55); stroke-width: 3.5; }
.rope { stroke: rgba(251, 191, 36, .7); stroke-width: 3.5; }
.figure { filter: drop-shadow(0 0 2.5px currentColor); }
.part {
    stroke: currentColor;
    stroke-width: 3;
    stroke-dasharray: 1 2;
    stroke-dashoffset: 1.05;
    opacity: 0;
    transition: stroke-dashoffset .45s ease-out, stroke .25s;
}
.part.on { stroke-dashoffset: 0; opacity: 1; }
.eyes line { stroke: currentColor; stroke-width: 1.6; }
.eyes { opacity: 0; transition: opacity .2s .45s; }
.drawing.lost .eyes { opacity: 1; }
.drawing.instant .part, .drawing.instant .eyes { transition: none; }

/* The word: one box per letter (the app's _WordSlots). */

.slots-wrap { container-type: inline-size; width: 100%; }
.slots { display: flex; justify-content: center; gap: 6px; }
.slots > span {
    --size: min(44px, calc((100cqi - (var(--n) - 1) * 6px) / var(--n)));
    flex: 0 0 auto;
}
.slot {
    width: var(--size);
    height: calc(var(--size) * 1.2);
    display: grid;
    place-items: center;
    border-radius: calc(var(--size) * .2);
    background: var(--glass);
    border-bottom: 3px solid rgba(241, 245, 249, .7);
    font-size: calc(var(--size) * .55);
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}
.slot.hidden { border-bottom-color: var(--cyan); }
.space { width: calc(var(--size) * .5); }
.slots.won .slot { color: var(--success); border-bottom-color: rgba(52, 211, 153, .7); }
.slots.lost .slot { color: var(--error); border-bottom-color: rgba(248, 113, 113, .7); }
.slot.pop { animation: pop .25s ease-out; }
.slots.shake { animation: shake .4s ease-in-out; }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
@keyframes shake {
    20% { transform: translateX(-8px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(3px); }
}

.below { min-height: 22px; }
.below p { margin: 0; }
.definition { text-align: center; }
.definition p { margin: 0; font-size: 16px; line-height: 1.35; }
.definition .slang { margin-bottom: 4px; font-size: 14px; font-weight: 700; color: var(--cyan); }

/* The keyboard (the app's GameKeyboard). */

.keyboard { --keys: 10; transition: opacity .25s; }
.keyboard.over { opacity: .45; }
.krow { display: flex; justify-content: center; margin-bottom: 8px; }
.key {
    flex: 0 0 auto;
    width: calc(100% / var(--keys) - 6px);
    aspect-ratio: 1 / 1.35;
    min-height: 42px;
    max-height: 58px;
    margin: 0 3px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .09);
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
    touch-action: manipulation;
}
.key:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.key:active:not(:disabled) { transform: scale(.94); }
.key:disabled { cursor: default; }
.key.hit { background: rgba(52, 211, 153, .22); border-color: rgba(52, 211, 153, .6); color: var(--success); }
.key.miss { background: rgba(255, 255, 255, .03); border-color: rgba(248, 113, 113, .35); color: rgba(248, 113, 113, .6); }
.key:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }

/* The round over: ¡Salvado! or ¡Ahorcado! */

.outcome { margin-top: 0; text-align: center; padding: 14px 20px 16px; }
.outcome.won { border-color: rgba(52, 211, 153, .5); }
.outcome.lost { border-color: rgba(248, 113, 113, .5); }
.outcome-title { margin: 0 0 12px; font-size: 28px; font-weight: 800; line-height: 1.2; }
.outcome.won .outcome-title { color: var(--success); }
.outcome.lost .outcome-title { color: var(--error); }
.outcome-title .flag { margin-left: 12px; font-size: 24px; }
.outcome.appear { animation: appear .35s ease-out .3s both; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Result */

.result-head { text-align: center; padding-top: 22px; }
.result-head h2 { margin: 0; font-size: 28px; font-weight: 800; }
.result-head h2.won { color: var(--success); }
.result-head h2.lost { color: var(--error); }
.result-head .challenge { margin: 0; color: var(--muted); font-weight: 600; }
.mini { display: flex; justify-content: center; margin: 6px 0; }
.mini .drawing { height: 130px; }
.lives-line { margin: 0; font-size: 22px; letter-spacing: 2px; }
#screen > .chip { display: flex; width: fit-content; margin: 14px auto 10px; }
#screen > .definition { margin-top: 12px; }

.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: 74px; 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; 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; }

.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; }
    .slot.pop, .slots.shake, .outcome.appear { animation: none; }
    .part, .eyes, .dot, .key, .keyboard { transition: none; }
}

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