/* DailyDle shared look (dark ember): the same background, fonts, header, Back button, panel and
 * buttons on every game page, matching the homepage and the Trivia Gauntlet.
 * Linked AFTER each page's own <style>, so it wins on equal specificity. Puzzle colours that carry
 * meaning (green / yellow / red feedback) are left alone. */
:root {
    --e-bg: #130f0d; --e-bg2: #1b1512; --e-surface: #211a16; --e-surface2: #2a211c;
    --e-line: #43352c; --e-text: #f4eadf; --e-muted: #ab9b8d;
    --e-ember: #ff7a30; --e-ember2: #e8601c; --e-gold: #f5c04f; --e-good: #58c27a; --e-bad: #e5484d;
    --e-serif: 'Cinzel', Georgia, 'Times New Roman', serif;
    --e-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    /* kept for older references */
    --site-bg: radial-gradient(900px 420px at 50% 108%, rgba(255,122,48,.22), transparent 70%), radial-gradient(600px 300px at 12% -5%, rgba(217,58,92,.10), transparent 70%), linear-gradient(180deg, var(--e-bg2), var(--e-bg));
}

html { background: var(--e-bg); }

body {
    font-family: var(--e-sans);
    background: var(--site-bg);
    background-attachment: fixed;
    color: var(--e-text);
}

/* ---------- header ---------- */
.header { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 26px; }

.back-button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; padding: 0 16px;
    background: var(--e-surface); border: 1px solid var(--e-line); border-radius: 999px;
    font-family: inherit; font-size: 0.9rem; font-weight: 600; color: var(--e-text);
    text-decoration: none; white-space: nowrap; cursor: pointer;
    box-shadow: none; transition: border-color .2s, background .2s, transform .2s;
}
.back-button:hover { border-color: var(--e-ember); background: var(--e-surface2); transform: translateY(-1px); box-shadow: none; }

.title {
    font-family: var(--e-serif); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
    font-size: clamp(1.6rem, 5.4vw, 2.6rem); color: var(--e-text); text-align: center;
    text-shadow: 0 0 24px rgba(255, 122, 48, 0.45);
}
.date-info { text-align: center; font-size: 1rem; margin-bottom: 18px; color: var(--e-muted); opacity: 1; }

.game-container {
    background: linear-gradient(180deg, var(--e-surface2), var(--e-surface));
    border: 1px solid var(--e-line); border-radius: 18px; padding: 28px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4); width: 100%;
}

@media (max-width: 768px) {
    .back-button { padding: 0 14px; }
    .game-container { padding: 18px 14px; }
}

/* =====================================================================
 * Guess The Country
 * ===================================================================== */
body.country .country-display,
body.country .completed-country-display { background: var(--e-bg2); border: 1px solid var(--e-line); border-radius: 14px; }
body.country .country-outline path, body.country .completed-country-outline path { fill: var(--e-text) !important; }
body.country .country-outline { filter: drop-shadow(0 0 14px rgba(255, 122, 48, 0.35)); }
body.country .country-input {
    background: var(--e-bg2); border: 1px solid var(--e-line); color: var(--e-text); border-radius: 12px;
}
body.country .country-input::placeholder { color: var(--e-muted); }
body.country .country-input:focus { border-color: var(--e-ember); outline: none; }
body.country .autocomplete-dropdown { background: var(--e-surface2); border: 1px solid var(--e-line); backdrop-filter: none; box-shadow: 0 12px 26px rgba(0,0,0,.5); }
body.country .autocomplete-item { color: var(--e-text); border-bottom: 1px solid var(--e-line); }
body.country .autocomplete-item:hover, body.country .autocomplete-item.selected { background: var(--e-ember); color: #1a0f08; }
body.country .guess-button, body.country .view-game-button {
    background: linear-gradient(180deg, #ff8a45, var(--e-ember2)); color: #1a0f08; font-weight: 800; border-radius: 12px;
    box-shadow: 0 8px 22px rgba(255, 122, 48, 0.3);
}
body.country .guess-button:hover:not(:disabled), body.country .view-game-button:hover { filter: brightness(1.08); }
body.country .guess-button:disabled { background: var(--e-surface2); color: var(--e-muted); box-shadow: none; }
body.country .guess-row { background: var(--e-bg2); border: 1px solid var(--e-line); color: var(--e-text); border-radius: 12px; }
body.country .attempts-remaining, body.country .attempts-info { color: var(--e-text); text-shadow: none; }
body.country .modal-content { background: var(--e-surface); border: 1px solid var(--e-line); color: var(--e-text); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
body.country .modal-content h1, body.country .modal-content h2, body.country .modal-content h3 { color: var(--e-text); font-family: var(--e-serif); }
body.country .modal-content p { color: var(--e-muted); }

/* ---------- popups: ember buttons, no leftover coloured edges ---------- */
body.country .close-modal {
    background: linear-gradient(180deg, #ff8a45, var(--e-ember2)); color: #1a0f08; font-weight: 800;
    border: 1px solid #ffb27a; border-radius: 12px; box-shadow: 0 8px 22px rgba(255,122,48,.3);
}

/* ---------- Country: guess colours, help button, community stat ---------- */
body.country .guess-row.wrong {
    background: linear-gradient(180deg, rgba(229,72,77,.30), rgba(229,72,77,.16)); border: 1px solid #e5484d; color: #ffd9da;
    box-shadow: 0 6px 16px rgba(229,72,77,.18);
}
body.country .guess-row.correct-continent {
    background: linear-gradient(180deg, rgba(245,192,79,.32), rgba(245,192,79,.16)); border: 1px solid var(--e-gold); color: #fff0c8;
    box-shadow: 0 6px 16px rgba(245,192,79,.18);
}
body.country .guess-row.correct {
    background: linear-gradient(180deg, rgba(88,194,122,.38), rgba(88,194,122,.20)); border: 1px solid var(--e-good); color: #dcf7e4;
    box-shadow: 0 6px 16px rgba(88,194,122,.2);
}
body.country .help-button {
    flex: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    background: var(--e-surface); border: 1px solid var(--e-line); color: var(--e-text); font: 700 1rem var(--e-sans);
}
body.country .help-button:hover { border-color: var(--e-ember); background: var(--e-surface2); }
body.country .help-content { max-width: 460px; }
body.country .help-content p { font-size: 1rem; font-weight: 600; margin-bottom: 18px; }
body.country .help-legend { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; text-align: left; }
body.country .help-legend .guess-row { min-height: 0; padding: 12px 16px; font-size: .95rem; animation: none; gap: 10px; }
body.country .help-legend .guess-row::before { content: none; }
body.country .help-legend .guess-row span { font-weight: 800; min-width: 56px; }
body.country .community-stat { font-weight: 700; color: var(--e-gold); margin: 6px 0 18px; }
body.country .completed-message h2 { color: var(--e-text); font-family: var(--e-serif); }

/* shared help ("?") button used in game headers */
.help-button {
    flex: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    background: var(--e-surface); border: 1px solid var(--e-line); color: var(--e-text); font: 700 1rem var(--e-sans);
}
.help-button:hover { border-color: var(--e-ember); background: var(--e-surface2); }

/* ---------- Country: distance rows, reveal fact, share button ---------- */
body.country .gr-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
body.country .gr-name { font-weight: 800; }
body.country .gr-meta { font-size: .82rem; font-weight: 600; opacity: .88; line-height: 1.3; }
body.country .reveal-fact { color: var(--e-muted); font-size: .95rem; line-height: 1.5; margin: 10px 0 14px; }
body.country .share-country-btn {
    display: block; margin: 8px auto 10px; padding: 12px 28px; border-radius: 12px; cursor: pointer; font: 800 1rem var(--e-sans);
    background: linear-gradient(180deg, #ff8a45, var(--e-ember2)); color: #1a0f08; border: 1px solid #ffb27a;
    box-shadow: 0 8px 22px rgba(255,122,48,.3);
}
body.country .share-country-btn:hover { filter: brightness(1.08); }

/* Country game: world-map reveal */
body.country .world-reveal { margin: 12px 0 4px; }
body.country .world-reveal svg { width: 100%; height: auto; display: block; }
body.country .wm-land { fill: var(--e-line); stroke: var(--e-bg); stroke-width: .4; }
body.country .wm-target { fill: var(--e-ember); stroke: var(--e-gold); stroke-width: .8; filter: drop-shadow(0 0 6px rgba(255, 122, 48, .7)); }
body.country .wm-dot { fill: var(--e-bad); stroke: var(--e-bg); stroke-width: 1; }
body.country .wm-dot.near { fill: var(--e-gold); }
body.country .wm-num { fill: #fff; font: 700 5.5px var(--e-sans); text-anchor: middle; }
body.country .modal-content h2 { font-size: clamp(1.5rem, 7vw, 2rem); overflow-wrap: anywhere; }
body.country .result-banner { border-radius: 14px; padding: 14px 16px; margin: 0 0 16px; text-align: center; border: 1px solid; }
body.country .result-banner .rb-title { font-family: var(--e-serif); font-size: 1.9rem; font-weight: 700; line-height: 1.15; }
body.country .result-banner .rb-sub { margin-top: 4px; font-size: 1rem; color: var(--e-text); opacity: .9; }
body.country .result-banner.won { background: rgba(60, 200, 120, .12); border-color: var(--e-good); }
body.country .result-banner.won .rb-title { color: var(--e-good); }
body.country .result-banner.lost { background: rgba(230, 70, 70, .14); border-color: var(--e-bad); }
body.country .result-banner.lost .rb-title { color: var(--e-bad); }

/* Country game: win moment (only right after solving, not on reload) */
.fx-confetti { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 50; }
.fx-confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .95; animation: confettiFall 2s linear forwards; }
@keyframes confettiFall { to { transform: translate(var(--sway), 105vh) rotate(720deg); opacity: .9; } }
@keyframes ddPop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes ddPulse { 0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 122, 48, .5)); } 50% { filter: drop-shadow(0 0 14px rgba(255, 210, 74, .95)); } }
body.country .fresh-win .result-banner.won { animation: ddPop .6s ease-out both; }
body.country .fresh-win .completed-country-outline { animation: ddPop .8s .25s ease-out both; }
body.country .fresh-win .wm-target { animation: ddPulse 1.4s .9s ease-in-out 3; }
@media (prefers-reduced-motion: reduce) {
  body.country .fresh-win .result-banner.won, body.country .fresh-win .completed-country-outline, body.country .fresh-win .wm-target { animation: none; }
}
body.country .input-msg { min-height: 1.2em; margin: -4px 0 8px; font-size: .9rem; color: var(--e-gold); text-align: center; }
