/* AtomicOrbit's daily orbit on the web: the look of the app
   (lib/theme/app_theme.dart, lib/widgets/orbit_board.dart) and of
   juegos.forjait.com. The country picker and panels are AtomicWord's web
   daily's; the accent is Plasma, violet to fuchsia, the game's own. */

: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;
    --plasma: #E879F9;
    --gold: #FBBF24;
    --orange: #FB923C;
    --success: #34D399;
    --error: #F87171;
    --pink: #F472B6;
    --teal: #14B8A6;
}

* { 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 {
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
h1 span {
    background: linear-gradient(90deg, var(--violet), var(--plasma));
    -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(--violet), var(--plasma));
    box-shadow: 0 8px 24px rgba(232, 121, 249, .35);
    cursor: pointer;
}
.primary.big { font-size: 20px; padding: 16px 20px; }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .45; cursor: default; box-shadow: none; }

.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(--violet), var(--plasma));
}

/* 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; }

.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(232, 121, 249, .6); }
.list-wrap { position: relative; flex: 1; min-height: 0; }
.list { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 40px; }
.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(--plasma);
    background: radial-gradient(circle, var(--plasma) 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; }
}

/* The orbit: the app's orbit screen (lib/screens/orbit_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 ··· Vuelta 2 🔥 2", the app's daily bar. */
.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 .lap { font-size: 14px; font-weight: 600; }
.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 spiral (orbit_board.dart): the road, the lit trail, the nucleus and
   a node per letter. Drawn in a 1000×1000 box. */
/* Small enough that the card, the field and the keyboard fit under it on
   a phone. */
.board { margin: 8px auto 0; width: min(100%, 340px, 34vh); }
.spiral { display: block; width: 100%; height: auto; }
.spiral .road { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 40; stroke-linecap: round; stroke-linejoin: round; }
.spiral .road-dash { fill: none; stroke: rgba(255, 255, 255, .16); stroke-width: 1.5; stroke-dasharray: 3 6; }
.spiral .trail { fill: none; stroke: url(#plasma); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.spiral .core { animation: beat 1.6s ease-in-out infinite alternate; transform-origin: 500px 500px; }
.spiral .core-value { font-size: 58px; font-weight: 800; fill: #fff; }
.spiral .core-label { font-size: 24px; font-weight: 700; fill: rgba(255, 255, 255, .85); letter-spacing: 2px; }
.node .glow { fill: none; }
.node .disc { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .24); stroke-width: 1.3; }
.node .label { font-size: 46px; font-weight: 700; fill: #CBD5E1; }
.node .strike { stroke: #64748B; stroke-width: 1.6; stroke-linecap: round; display: none; }
.node .dot, .node .dot-edge { display: none; }
.node.correct .disc { fill: url(#plasma); stroke: transparent; }
.node.correct .label { fill: #fff; }
.node.wrong .disc { fill: rgba(8, 10, 28, .9); stroke: rgba(148, 163, 184, .35); stroke-dasharray: 2 3; }
.node.wrong .label { fill: #556079; }
.node.wrong .strike { display: initial; }
/* Pink, never the TV show's yellow or blue for a passed letter. */
.node.passed .disc { fill: rgba(244, 114, 182, .08); stroke: var(--pink); stroke-dasharray: 4 3; }
.node.passed .label { fill: #FBCFE8; }
.node.after-pass .dot-edge { display: initial; fill: var(--bg); }
.node.after-pass .dot { display: initial; fill: var(--pink); }
.node.current { animation: grow .38s ease-out both; }
.node.current .glow { fill: url(#halo); animation: pulse 1.6s ease-in-out infinite alternate; }
.node.current .disc { fill: rgba(255, 255, 255, .14); stroke: var(--plasma); stroke-width: 2.2; stroke-dasharray: none; }
.node.current .label { fill: #fff; }
.node.current .strike { display: none; }
.board.shake { animation: shake .45s ease-in-out; }

@keyframes beat { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
@keyframes grow { from { transform: scale(1); } to { transform: scale(1.34); } }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(9px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(4px); }
}

/* The letter's card: how it's asked, the category and the definition. */
.definition {
    margin-top: 10px;
    padding: 14px 16px 16px;
    border-radius: 24px;
    background: var(--glass);
    border: 1px solid var(--border);
    text-align: center;
}
.ask-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.ask {
    padding: 6px 14px;
    border-radius: 30px;
    background: linear-gradient(90deg, var(--violet), var(--plasma));
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .5px;
    white-space: nowrap;
}
.chip {
    padding: 6px 14px;
    border-radius: 30px;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--plasma);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clue { margin: 10px 0 0; font-size: 19px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.definition .reward { margin: 4px 0; }

/* What's typed (the app's _AnswerField). */
.answer-field {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 16px;
    border: 1.5px solid rgba(232, 121, 249, .6);
    background: rgba(255, 255, 255, .06);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}
.answer-field .hint { font-size: 16px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.answer-field .caret { width: 2px; height: 28px; background: var(--plasma); animation: blink 1s steps(2) infinite; }
@keyframes blink { to { opacity: 0; } }
/* The verdict of an answer, in the field: green, or the word it was. */
.answer-field.right { border-color: var(--success); color: var(--success); letter-spacing: 0; text-transform: none; font-size: 20px; }
.answer-field.wrong { border-color: var(--pink); font-size: 20px; }
.answer-field .was { font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.answer-field.wrong b { color: var(--pink); }

.reward, .result-head h2.reward {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--violet), var(--plasma));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* "Paso" and "Responder" over 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%);
}
.action-row { display: flex; gap: 8px; margin-bottom: 8px; }
.action-row .pass { flex: 0 0 34%; padding: 10px 12px; }
.action-row .answer { flex: 1; padding: 10px 16px; font-size: 17px; border-radius: 14px; }
.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(44px, 15vw - 14px, 58px);
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .09);
    font-size: clamp(18px, 5vw, 23px);
    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 .challenge { margin: 0; color: var(--muted); font-weight: 600; }
.result-head .score { margin: 6px 0 0; font-size: 18px; color: var(--muted); }
.result-head .score b { font-size: 34px; font-weight: 800; color: var(--text); }
.grid { margin: 12px 0 0; font-size: 22px; letter-spacing: 3px; line-height: 1.25; white-space: pre-line; }

.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; }

/* "Repaso": the letters that got away (the app's _ReviewRow). */
.review h2 { margin-bottom: 10px; }
.review-rows { display: flex; flex-direction: column; gap: 10px; }
.review-row { display: flex; gap: 10px; align-items: flex-start; text-align: left; }
.review-row .letter {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .06);
    font-weight: 800;
}
.review-row.wrong .letter { background: rgba(8, 10, 28, .9); }
.review-body { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.35; }
.review-body b { font-size: 15px; }
.review-body .given { color: #8C94A8; font-size: 12px; }

.standing { margin: 2px 0 0; text-align: center; color: var(--plasma); 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: 60px; 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(--plasma); font-weight: 800; }
.bar-row.mine .fill { background: var(--plasma); }

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

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

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2s; }
    .spiral .core, .node.current, .node.current .glow, .board.shake, .answer-field .caret { animation: none !important; }
    .node.current { transform: scale(1.34); }
    .key { transition: none; }
}

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