/* country-detective.css — Country Detective deduction game */

.cd-page .study-main { display: flex; flex-direction: column; }
.cd-page [hidden] { display: none !important; }

.cd-screen { display: none; flex: 1; min-height: 0; }
.cd-screen--active { display: flex; flex-direction: column; }

/* ── Shared ─────────────────────────────────────────── */
.cd-menu, .cd-game, .cd-summary, .cd-locked {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 20px 18px 56px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cd-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary, #475569);
    padding: 60px 20px;
}
.cd-spinner {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 3px solid var(--border-glass, rgba(0,0,0,0.08));
    border-top-color: #d97706;
    animation: cd-spin 0.9s linear infinite;
}
@keyframes cd-spin { to { transform: rotate(360deg); } }

.cd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    line-height: 1.2;
}
.cd-btn:active { transform: scale(0.98); }
.cd-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.cd-btn--primary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.28);
}
.cd-btn--primary:not(:disabled):hover { box-shadow: 0 8px 20px rgba(217, 119, 6, 0.36); }
.cd-btn--ghost {
    background: var(--bg-surface, #fff);
    border-color: var(--border-glass, rgba(0,0,0,0.08));
    color: var(--text-primary, #0f172a);
}
.cd-btn--ghost:not(:disabled):hover { border-color: #d97706; }
.cd-btn--link {
    background: none;
    color: var(--text-muted, #64748b);
    padding: 10px 12px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.cd-btn--link:hover { color: #dc2626; }
.cd-btn small { font-weight: 500; opacity: 0.8; }

.cd-card {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 16px;
    padding: 16px 18px;
}

.cd-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0 0 10px;
}
.cd-section-title i { color: #d97706; font-size: 1.2rem; }

.cd-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.3);
    color: var(--text-primary, #0f172a);
    font-size: 0.9rem;
    line-height: 1.45;
}
.cd-banner i { color: #d97706; font-size: 1.15rem; flex-shrink: 0; margin-top: 1px; }
.cd-banner--resume { background: rgba(37, 99, 235, 0.08); border-color: rgba(37, 99, 235, 0.3); align-items: center; }
.cd-banner--resume i { color: #2563eb; }
.cd-banner--resume .cd-btn { margin-left: auto; padding: 8px 14px; }

/* ── Menu ───────────────────────────────────────────── */
.cd-hero { text-align: center; padding-top: 6px; }
.cd-hero__icon {
    display: inline-flex;
    font-size: 3rem;
    color: #d97706;
    margin-bottom: 4px;
}
.cd-hero h1 {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    margin: 0;
}
.cd-hero p { color: var(--text-secondary, #475569); margin: 6px 0 0; }

.cd-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}
.cd-stat {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 14px;
    padding: 12px 14px;
    text-align: center;
}
.cd-stat__value {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: #d97706;
}
.cd-stat__label { font-size: 0.78rem; color: var(--text-muted, #64748b); margin-top: 2px; }

.cd-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.cd-level {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cd-level--locked, .cd-level--empty { opacity: 0.72; }
.cd-level__head { display: flex; align-items: center; gap: 12px; }
.cd-level__num {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-weight: 800;
    font-size: 1.1rem;
    background: rgba(217, 119, 6, 0.12);
    color: #d97706;
    flex-shrink: 0;
}
.cd-level__head h3 { margin: 0; font-size: 1rem; font-family: var(--font-heading, 'Poppins', sans-serif); color: var(--text-primary, #0f172a); }
.cd-level__head p { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-muted, #64748b); }
.cd-level__bar { height: 8px; border-radius: 999px; background: var(--border-glass, rgba(0,0,0,0.08)); overflow: hidden; }
.cd-level__bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f59e0b, #d97706); transition: width 0.4s ease; }
.cd-level__medals { display: flex; gap: 12px; font-size: 0.85rem; color: var(--text-secondary, #475569); }
.cd-level__lock { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted, #64748b); }
.cd-level .cd-btn { align-self: flex-start; }

.cd-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cd-chip-btn {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.1));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}
.cd-chip-btn small { color: var(--text-muted, #64748b); margin-left: 4px; }
.cd-chip-btn.is-active { background: #d97706; border-color: #d97706; color: #fff; }
.cd-chip-btn.is-active small { color: rgba(255,255,255,0.8); }
.cd-chip-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.cd-how ol { margin: 0; padding-left: 20px; color: var(--text-secondary, #475569); line-height: 1.55; }
.cd-how li + li { margin-top: 6px; }

/* ── Game ───────────────────────────────────────────── */
.cd-game { padding-bottom: 24px; }

.cd-hud {
    position: sticky;
    /* The study topbar is sticky too; the engine measures it into --cd-topbar-h. */
    top: calc(var(--cd-topbar-h, 0px) + 8px);
    z-index: 5;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cd-hud__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cd-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-primary, #0f172a);
    font-size: 0.82rem;
    font-weight: 600;
}
.cd-chip--prize { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.cd-chip--prize strong { font-size: 1rem; }
.cd-chip--lives i { font-size: 1.05rem; color: #dc2626; }
.cd-chip--lives .cd-heart--lost { color: var(--text-muted, #94a3b8); opacity: 0.45; }
.cd-hud__pause { margin-left: auto; padding: 6px 10px; font-size: 0.82rem; }
.cd-rail { display: flex; align-items: center; gap: 10px; }
.cd-rail__label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted, #64748b); white-space: nowrap; }
.cd-rail__bar { flex: 1; display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.cd-rail__bar span { height: 6px; border-radius: 999px; background: var(--border-glass, rgba(0,0,0,0.1)); }
.cd-rail__bar span.is-open { background: #d97706; }

.cd-stack { display: flex; flex-direction: column; gap: 12px; }
.cd-clue {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 16px;
    padding: 14px 16px;
    animation: cd-rise 0.28s ease;
}
.cd-clue--latest { border-color: rgba(217, 119, 6, 0.55); box-shadow: 0 8px 24px rgba(217, 119, 6, 0.12); }
@keyframes cd-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cd-clue__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cd-clue__num {
    width: 26px; height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
    flex-shrink: 0;
}
.cd-clue__head i { color: #d97706; font-size: 1.1rem; }
.cd-clue__title { font-weight: 700; color: var(--text-primary, #0f172a); font-size: 0.92rem; }
.cd-clue__prize { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: var(--text-muted, #64748b); white-space: nowrap; }
.cd-clue__text { margin: 0; color: var(--text-primary, #0f172a); font-size: 1.02rem; line-height: 1.55; }
.cd-clue__text--muted { color: var(--text-muted, #64748b); font-size: 0.9rem; }
.cd-clue__big { margin: 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.5rem; font-weight: 700; color: var(--text-primary, #0f172a); }

.cd-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 14px; }
.cd-fact { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: rgba(100, 116, 139, 0.07); }
.cd-fact__label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted, #64748b); font-weight: 600; }
.cd-fact__value { font-weight: 600; color: var(--text-primary, #0f172a); font-size: 0.95rem; }

.cd-photo { margin: 0; position: relative; }
.cd-photo img {
    display: block;
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 12px;
    background: rgba(100, 116, 139, 0.12);
}
.cd-photo figcaption { margin-top: 8px; font-size: 0.88rem; color: var(--text-secondary, #475569); }
/* Portraits: keep the whole face, letterboxed on a soft ground instead of cropped. */
.cd-photo--person img { max-height: 420px; object-fit: contain; }
.cd-photo__reveal { margin-top: 6px; font-weight: 700; color: var(--text-primary, #0f172a); }
.cd-clue__single { display: flex; flex-direction: column; gap: 4px; }
.cd-clue__single .cd-fact__value { font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.35rem; }
.cd-photo__credit-btn {
    position: absolute; top: 8px; right: 8px;
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.cd-photo__credit { margin-top: 6px; font-size: 0.75rem; color: var(--text-muted, #64748b); }

.cd-shape { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cd-shape svg { width: 150px; height: 150px; flex-shrink: 0; fill: #d97706; opacity: 0.9; }
.cd-shape__side { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.cd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-tag { padding: 4px 10px; border-radius: 999px; background: rgba(100, 116, 139, 0.1); font-size: 0.85rem; font-weight: 600; color: var(--text-primary, #0f172a); }
.cd-tag--muted { color: var(--text-muted, #64748b); font-weight: 500; }

.cd-flag { display: block; width: 100%; max-width: 320px; height: auto; min-height: 60px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,0.15); font-size: 3rem; line-height: 1; }

/* platform-emojis.js swaps emoji for images; keep medals inline-sized inside game text. */
.cd-page .cd-stat .igeouz-emoji,
.cd-page .cd-level__medals .igeouz-emoji,
.cd-page .cd-summary__row .igeouz-emoji,
.cd-page .cd-casefile__banner .igeouz-emoji,
.cd-page .cd-pending__name .igeouz-emoji,
.cd-page .cd-suggest .igeouz-emoji {
    width: 1.15em !important;
    height: 1.15em !important;
    vertical-align: -0.2em;
    margin: 0 0.1em;
}

/* Guess controls */
.cd-controls {
    position: sticky;
    bottom: 12px;
    z-index: 4;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.08));
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
}
.cd-misses { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-miss { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: rgba(220, 38, 38, 0.1); color: #b91c1c; font-size: 0.82rem; font-weight: 600; text-decoration: line-through; }
.cd-miss i { font-size: 0.9rem; }

.cd-search { position: relative; }
.cd-search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted, #64748b); font-size: 1.1rem; pointer-events: none; }
.cd-search input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    border-radius: 12px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.12));
    background: var(--bg-glass, rgba(255,255,255,0.7));
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-size: 1rem;
    outline: none;
}
.cd-search input:focus { border-color: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18); }
.cd-suggest {
    list-style: none;
    margin: 6px 0 0;
    padding: 4px;
    position: absolute;
    left: 0; right: 0;
    bottom: calc(100% + 2px);
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.1));
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    z-index: 6;
}
.cd-suggest:empty { display: none; }
.cd-suggest li {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary, #0f172a);
}
.cd-suggest li small { color: var(--text-muted, #64748b); margin-left: auto; }
.cd-suggest li:hover, .cd-suggest li.is-active { background: rgba(217, 119, 6, 0.12); }
.cd-suggest__flag { font-size: 1.2rem; line-height: 1; }

.cd-pending { display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }
.cd-pending__label { font-size: 0.8rem; color: var(--text-muted, #64748b); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.cd-pending__name { display: flex; align-items: center; gap: 10px; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.3rem; color: var(--text-primary, #0f172a); }
.cd-pending__name span { font-size: 1.6rem; line-height: 1; }
.cd-pending__note { font-size: 0.85rem; color: #b45309; }
.cd-pending__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cd-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cd-actions .cd-btn--link { margin-left: auto; }

/* Case file */
.cd-casefile {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: cd-rise 0.3s ease;
}
.cd-casefile__banner {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
}
.cd-casefile--solved .cd-casefile__banner { background: rgba(5, 150, 105, 0.12); color: #047857; }
.cd-casefile--lost .cd-casefile__banner { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }
.cd-casefile__banner i { font-size: 1.6rem; }
.cd-casefile__banner strong { display: block; font-size: 1.05rem; }
.cd-casefile__banner span { font-size: 0.88rem; opacity: 0.9; }
.cd-casefile__country { display: flex; align-items: center; gap: 14px; }
.cd-casefile__country img { width: 84px; height: auto; border-radius: 8px; box-shadow: 0 3px 10px rgba(0,0,0,0.15); }
.cd-casefile__country h2 { margin: 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.5rem; color: var(--text-primary, #0f172a); }
.cd-casefile__country p { margin: 2px 0 0; color: var(--text-secondary, #475569); font-size: 0.9rem; }
.cd-casefile__desc { margin: 0; color: var(--text-secondary, #475569); line-height: 1.55; font-size: 0.95rem; }
.cd-casefile details { border-top: 1px solid var(--border-glass, rgba(0,0,0,0.06)); padding-top: 10px; }
.cd-casefile summary { cursor: pointer; font-weight: 600; color: var(--text-primary, #0f172a); }
.cd-casefile details .cd-stack { margin-top: 12px; }
.cd-casefile details .cd-clue { animation: none; background: rgba(100, 116, 139, 0.06); }
.cd-casefile__credit { font-size: 0.78rem; color: var(--text-muted, #64748b); margin: 0; }
.cd-casefile__credit a { color: inherit; }
.cd-casefile__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cd-casefile__actions .cd-btn--primary { margin-left: auto; }

/* ── Summary ────────────────────────────────────────── */
.cd-summary__hero { text-align: center; padding: 10px 0 4px; }
.cd-summary__hero i { font-size: 3rem; color: #d97706; }
.cd-summary__hero h2 { margin: 6px 0 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.6rem; color: var(--text-primary, #0f172a); }
.cd-summary__score { font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 2.6rem; font-weight: 800; color: #d97706; line-height: 1.1; margin-top: 6px; }
.cd-summary__score small { font-size: 1rem; color: var(--text-muted, #64748b); font-weight: 600; margin-left: 4px; }
.cd-summary__best { color: #047857; font-weight: 700; margin-top: 4px; }
.cd-summary__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cd-summary__row {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 14px;
    padding: 10px 14px;
}
.cd-summary__row > img { width: 44px; height: auto; border-radius: 6px; }
.cd-summary__row strong { display: block; color: var(--text-primary, #0f172a); }
.cd-summary__row span { font-size: 0.85rem; color: var(--text-secondary, #475569); }
.cd-summary__points { margin-left: auto; font-family: var(--font-heading, 'Poppins', sans-serif); font-weight: 700; font-size: 1.1rem; color: #d97706; white-space: nowrap; }
.cd-summary__points--zero { color: var(--text-muted, #64748b); }
.cd-summary__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ── Locked ─────────────────────────────────────────── */
.cd-locked { align-items: center; justify-content: center; flex: 1; }
.cd-locked__card {
    max-width: 440px;
    text-align: center;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 18px;
    padding: 32px 24px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cd-locked__card i { font-size: 2.6rem; color: #d97706; }
.cd-locked__card h2 { margin: 0; font-family: var(--font-heading, 'Poppins', sans-serif); color: var(--text-primary, #0f172a); }
.cd-locked__card p { margin: 0; color: var(--text-secondary, #475569); line-height: 1.5; }
.cd-locked__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* ── Dark theme touches ─────────────────────────────── */
[data-theme="dark"] .cd-controls { box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35); }
[data-theme="dark"] .cd-suggest { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
[data-theme="dark"] .cd-chip--prize { color: #fbbf24; }
[data-theme="dark"] .cd-clue__num, [data-theme="dark"] .cd-pending__note { color: #fbbf24; }
[data-theme="dark"] .cd-casefile--solved .cd-casefile__banner { color: #6ee7b7; }
[data-theme="dark"] .cd-casefile--lost .cd-casefile__banner { color: #fca5a5; }
[data-theme="dark"] .cd-miss { color: #fca5a5; }
[data-theme="dark"] .cd-summary__best { color: #6ee7b7; }

/* ── Phones ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .cd-menu, .cd-game, .cd-summary, .cd-locked { padding: 14px 12px 40px; }
    .cd-hero h1 { font-size: 1.6rem; }
    .cd-hud { border-radius: 12px; padding: 8px 10px; }
    .cd-chip { font-size: 0.76rem; padding: 5px 8px; }
    /* Icon-only Menu button so the HUD stays on one row on phones. */
    .cd-hud__pause { padding: 6px 9px; }
    .cd-hud__pause span { display: none; }
    .cd-hud__pause i { font-size: 1.05rem; }
    .cd-clue { padding: 12px 13px; }
    .cd-clue__text { font-size: 0.98rem; }
    .cd-controls { bottom: 8px; padding: 10px; }
    .cd-shape svg { width: 120px; height: 120px; }
    .cd-casefile__actions .cd-btn { flex: 1; }
    .cd-summary__actions .cd-btn { flex: 1; }
}

/* Difficulty mode */
.cd-chip--diff { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
[data-theme="dark"] .cd-chip--diff { color: #93c5fd; }
.cd-how__note { margin: 4px 0 0; font-size: 0.85rem; color: var(--text-muted, #64748b); line-height: 1.45; }

/* ── Case-file visual refresh (v2) ─────────────────── */
.cd-page {
    --cd-navy: #102a43;
    --cd-navy-deep: #071b2d;
    --cd-ink: #183247;
    --cd-paper: #fffdf7;
    --cd-paper-deep: #f7f0df;
    --cd-amber: #e99a22;
    --cd-amber-dark: #bd6610;
    --cd-green: #16836b;
    --cd-red: #c44a42;
    --cd-line: rgba(16, 42, 67, 0.13);
}

.cd-page .study-main {
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(circle at 92% 8%, rgba(233, 154, 34, 0.13), transparent 26rem),
        linear-gradient(rgba(16, 42, 67, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 42, 67, 0.025) 1px, transparent 1px),
        var(--bg-primary, #f5f7fa);
    background-size: auto, 28px 28px, 28px 28px, auto;
}

.cd-menu {
    max-width: 1080px;
    gap: 20px;
    padding-top: 24px;
}

.cd-game { max-width: 880px; gap: 16px; }
.cd-summary { max-width: 760px; }

.cd-btn {
    min-height: 44px;
    border-radius: 11px;
    letter-spacing: -0.01em;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.cd-btn:not(:disabled):hover { transform: translateY(-1px); }
.cd-btn:not(:disabled):active { transform: translateY(0) scale(0.985); }
.cd-btn--primary {
    background: linear-gradient(135deg, #f3ae35, var(--cd-amber-dark));
    box-shadow: 0 8px 22px rgba(189, 102, 16, 0.28), inset 0 1px rgba(255,255,255,0.28);
}
.cd-btn--primary:not(:disabled):hover { box-shadow: 0 11px 28px rgba(189, 102, 16, 0.36), inset 0 1px rgba(255,255,255,0.28); }
.cd-btn--ghost { background: rgba(255,255,255,0.72); border-color: var(--cd-line); color: var(--cd-navy); }
.cd-btn--reveal {
    color: var(--cd-navy);
    background: rgba(233, 154, 34, 0.11);
    border: 1px solid rgba(189, 102, 16, 0.28);
}
.cd-btn--reveal:not(:disabled):hover { background: rgba(233, 154, 34, 0.18); border-color: rgba(189, 102, 16, 0.48); }

/* Menu hero */
.cd-banner--preview {
    padding: 9px 13px;
    border-radius: 10px;
    background: rgba(16, 42, 67, 0.06);
    border-color: rgba(16, 42, 67, 0.12);
    color: var(--text-secondary, #475569);
    font-size: 0.82rem;
}
.cd-banner--preview i { color: var(--cd-navy); }

.cd-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 190px;
    padding: 32px 36px;
    text-align: left;
    border-radius: 24px;
    color: #fff;
    background:
        radial-gradient(circle at 85% 5%, rgba(244, 183, 67, 0.28), transparent 18rem),
        linear-gradient(125deg, var(--cd-navy-deep), var(--cd-navy) 64%, #164a59);
    box-shadow: 0 20px 45px rgba(7, 27, 45, 0.2);
}
.cd-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.13;
    background:
        repeating-radial-gradient(circle at 82% 50%, transparent 0 28px, rgba(255,255,255,0.8) 29px 30px),
        linear-gradient(90deg, transparent 49.5%, rgba(255,255,255,0.8) 50%, transparent 50.5%);
    transform: rotate(-8deg) scale(1.15);
    pointer-events: none;
}
.cd-hero > * { position: relative; z-index: 1; }
.cd-hero__copy { display: flex; align-items: center; gap: 22px; min-width: 0; }
.cd-hero__icon {
    width: 82px;
    height: 82px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin: 0;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 22px;
    color: #ffd37b;
    font-size: 3.35rem;
    background: rgba(255,255,255,0.08);
    box-shadow: inset 0 1px rgba(255,255,255,0.12);
}
.cd-hero__eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #f7c768;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.cd-hero h1 { color: #fff; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -0.04em; }
.cd-hero p { max-width: 570px; margin-top: 10px; color: rgba(255,255,255,0.76); font-size: 1rem; }
.cd-hero__rules { display: grid; gap: 8px; flex: 0 0 auto; }
.cd-hero__rules span {
    min-width: 76px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-weight: 700;
}
.cd-hero__rules i { color: #f7c768; font-size: 1.05rem; }

.cd-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--cd-line);
    border-radius: 16px;
    background: rgba(255,255,255,0.68);
    box-shadow: 0 10px 26px rgba(16, 42, 67, 0.06);
}
.cd-stat { border: 0; border-radius: 0; padding: 14px 18px; background: transparent; }
.cd-stat + .cd-stat { border-left: 1px solid var(--cd-line); }
.cd-stat__value { color: var(--cd-navy); font-size: 1.25rem; }
.cd-stat__label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.68rem; font-weight: 700; }

.cd-menu-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.cd-menu__main, .cd-menu__aside { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.cd-setup, .cd-freeplay, .cd-how {
    border: 1px solid var(--cd-line);
    border-radius: 18px;
    background: rgba(255,255,255,0.72);
    box-shadow: 0 10px 25px rgba(16, 42, 67, 0.055);
}
.cd-setup { padding: 17px 18px 14px; }
.cd-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.cd-section-heading p { max-width: 440px; margin: 1px 0 0; color: var(--text-muted, #64748b); font-size: 0.78rem; line-height: 1.45; text-align: right; }
.cd-section-title { margin-bottom: 11px; color: var(--cd-navy); }
.cd-section-title i { color: var(--cd-amber-dark); }

.cd-chips--difficulty { margin: 1px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px; gap: 4px; border-radius: 13px; background: rgba(16, 42, 67, 0.07); }
.cd-chips--difficulty .cd-chip-btn { border: 0; border-radius: 9px; background: transparent; font-weight: 700; }
.cd-chips--difficulty .cd-chip-btn.is-active { color: #fff; background: var(--cd-navy); box-shadow: 0 6px 14px rgba(16, 42, 67, 0.2); }

.cd-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cd-level {
    position: relative;
    overflow: hidden;
    min-height: 168px;
    padding: 17px;
    border-color: var(--cd-line);
    background: rgba(255,255,255,0.78);
    box-shadow: 0 8px 22px rgba(16, 42, 67, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.cd-level::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #d9a028; }
.cd-level:nth-child(2)::before { background: #318b7d; }
.cd-level:nth-child(3)::before { background: #5777ae; }
.cd-level:nth-child(4)::before { background: #805b8f; }
.cd-level:not(.cd-level--locked):hover { transform: translateY(-2px); border-color: rgba(189,102,16,0.28); box-shadow: 0 13px 28px rgba(16, 42, 67, 0.09); }
.cd-level__num { border-radius: 50%; background: var(--cd-navy); color: #fff; box-shadow: 0 5px 14px rgba(16,42,67,0.18); }
.cd-level__head h3 { color: var(--cd-navy); }
.cd-level__bar { height: 5px; background: rgba(16,42,67,0.09); }
.cd-level__bar > div { background: linear-gradient(90deg, var(--cd-amber), var(--cd-green)); }
.cd-level__medals { margin-top: auto; }
.cd-level .cd-btn { min-height: 38px; padding: 9px 15px; }

.cd-freeplay { position: relative; overflow: hidden; padding: 24px 20px 20px; color: #fff; background: linear-gradient(145deg, var(--cd-navy-deep), var(--cd-navy)); }
.cd-freeplay::after { content: ""; position: absolute; width: 180px; height: 180px; right: -80px; top: -85px; border: 28px solid rgba(255,255,255,0.045); border-radius: 50%; }
.cd-freeplay > * { position: relative; z-index: 1; }
.cd-freeplay__icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: rgba(247,199,104,0.14); color: #f7c768; font-size: 1.75rem; }
.cd-freeplay h2 { margin: 13px 0 12px; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.25rem; }
.cd-chips--continents { gap: 6px; }
.cd-chips--continents .cd-chip-btn { padding: 6px 10px; border-color: rgba(255,255,255,0.14); color: rgba(255,255,255,0.82); background: rgba(255,255,255,0.06); font-size: 0.77rem; }
.cd-chips--continents .cd-chip-btn small { color: rgba(255,255,255,0.5); }
.cd-chips--continents .cd-chip-btn.is-active { color: var(--cd-navy-deep); background: #f7c768; border-color: #f7c768; }
.cd-chips--continents .cd-chip-btn.is-active small { color: rgba(7,27,45,0.62); }
.cd-freeplay .cd-btn { width: 100%; margin-top: 3px; }

.cd-how { overflow: hidden; }
.cd-how summary { display: flex; align-items: center; gap: 9px; padding: 15px 17px; cursor: pointer; color: var(--cd-navy); font-weight: 700; list-style: none; }
.cd-how summary::-webkit-details-marker { display: none; }
.cd-how summary > i:first-child { color: var(--cd-amber-dark); font-size: 1.2rem; }
.cd-how summary > i:last-child { margin-left: auto; transition: transform 0.2s ease; }
.cd-how[open] summary > i:last-child { transform: rotate(180deg); }
.cd-how ol { margin: 0; padding: 0 22px 18px 38px; font-size: 0.85rem; line-height: 1.5; }

/* Investigation HUD and evidence */
.cd-hud {
    top: calc(var(--cd-topbar-h, 0px) + 10px);
    gap: 10px;
    padding: 11px 13px 12px;
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(120deg, rgba(7,27,45,0.98), rgba(16,42,67,0.97));
    box-shadow: 0 15px 35px rgba(7,27,45,0.2);
    backdrop-filter: blur(14px);
}
.cd-chip { color: rgba(255,255,255,0.82); background: rgba(255,255,255,0.08); }
.cd-chip--case { color: #fff; }
.cd-chip--case i { color: #f7c768; }
.cd-chip--lives { letter-spacing: 0.03em; }
.cd-chip--lives i { color: #ff7068; filter: drop-shadow(0 1px 5px rgba(255,112,104,0.35)); }
.cd-chip--lives .cd-heart--lost { color: rgba(255,255,255,0.28); }
.cd-chip--prize { margin-left: auto; color: #fff; background: rgba(233,154,34,0.19); border: 1px solid rgba(247,199,104,0.22); }
.cd-chip--prize strong { color: #ffd37b; font-size: 1.06rem; }
.cd-chip--prize small { color: rgba(255,255,255,0.58); font-size: 0.68rem; }
.cd-chip--diff { color: #b9def6; background: rgba(69,148,198,0.16); }
.cd-hud__pause { min-height: 34px; margin-left: 0; padding: 6px 10px; color: rgba(255,255,255,0.78); background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.12); }
.cd-rail__label { color: rgba(255,255,255,0.62); font-size: 0.72rem; letter-spacing: 0.03em; }
.cd-rail__bar { gap: 5px; align-items: center; }
.cd-rail__bar span { position: relative; height: 5px; overflow: visible; background: rgba(255,255,255,0.12); transition: background 0.3s ease, transform 0.3s ease; }
.cd-rail__bar span.is-open { background: rgba(247,199,104,0.72); }
.cd-rail__bar span.is-current { height: 8px; transform: scaleY(1.1); background: #ffd37b; box-shadow: 0 0 0 3px rgba(247,199,104,0.14), 0 0 12px rgba(247,199,104,0.42); }
.cd-rail__bar i { display: none; }

.cd-evidence {
    overflow: hidden;
    border: 1px solid var(--cd-line);
    border-radius: 14px;
    background: rgba(255,255,255,0.6);
}
.cd-evidence > summary { display: flex; align-items: center; gap: 10px; padding: 12px 15px; cursor: pointer; color: var(--cd-navy); list-style: none; }
.cd-evidence > summary::-webkit-details-marker { display: none; }
.cd-evidence > summary > span { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.cd-evidence > summary > span i { color: var(--cd-amber-dark); font-size: 1.15rem; }
.cd-evidence > summary strong { margin-left: auto; color: var(--text-muted, #64748b); font-size: 0.75rem; font-weight: 600; }
.cd-evidence > summary > i { color: var(--text-muted, #64748b); transition: transform 0.2s ease; }
.cd-evidence[open] > summary > i { transform: rotate(180deg); }
.cd-evidence > .cd-stack { padding: 0 12px 12px; }
.cd-evidence .cd-clue { padding: 11px 13px; background: rgba(255,255,255,0.58); box-shadow: none; }
.cd-evidence .cd-clue__text { font-size: 0.91rem; }

.cd-current { display: flex; flex-direction: column; gap: 8px; padding: 0; }
.cd-current__label { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; color: var(--text-muted, #64748b); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.cd-current .cd-clue {
    position: relative;
    overflow: hidden;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid rgba(189,102,16,0.25);
    border-radius: 20px;
    background:
        linear-gradient(rgba(16,42,67,0.026) 1px, transparent 1px),
        linear-gradient(105deg, #fffef9, var(--cd-paper));
    background-size: 100% 30px, auto;
    box-shadow: 0 18px 38px rgba(16,42,67,0.12), inset 4px 0 var(--cd-amber);
}
.cd-current .cd-clue::after { content: ""; position: absolute; width: 170px; height: 170px; right: -90px; bottom: -100px; border: 20px solid rgba(16,42,67,0.035); border-radius: 50%; pointer-events: none; }
.cd-current .cd-clue__head { margin-bottom: 16px; }
.cd-current .cd-clue__num { width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--cd-navy); }
.cd-current .cd-clue__head i { color: var(--cd-amber-dark); font-size: 1.3rem; }
.cd-current .cd-clue__title { color: var(--cd-navy); font-size: 1rem; }
.cd-current .cd-clue__prize { padding: 5px 9px; border-radius: 999px; color: var(--cd-amber-dark); background: rgba(233,154,34,0.12); }
.cd-current .cd-clue__text { max-width: 720px; color: var(--cd-ink); font-family: var(--font-heading, 'Poppins', sans-serif); font-size: clamp(1.08rem, 2.2vw, 1.32rem); line-height: 1.62; letter-spacing: -0.012em; }
.cd-current .cd-clue__single .cd-fact__value { color: var(--cd-navy); font-size: clamp(1.7rem, 4vw, 2.5rem); }
.cd-current .cd-fact { background: rgba(16,42,67,0.055); }
.cd-current .cd-photo img { max-height: 430px; }
.cd-current .cd-shape svg { fill: var(--cd-amber-dark); filter: drop-shadow(0 8px 15px rgba(189,102,16,0.18)); }

/* Guess console */
.cd-controls {
    bottom: 10px;
    padding: 14px;
    gap: 11px;
    border: 1px solid rgba(16,42,67,0.14);
    border-radius: 18px;
    background: rgba(252,253,253,0.92);
    box-shadow: 0 -8px 30px rgba(7,27,45,0.11), 0 8px 28px rgba(7,27,45,0.08);
    backdrop-filter: blur(16px);
}
.cd-controls__heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--cd-navy); }
.cd-controls__heading > span { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.045em; text-transform: uppercase; }
.cd-controls__heading i { color: var(--cd-amber-dark); font-size: 1rem; }
.cd-controls__heading small { color: var(--text-muted, #64748b); font-size: 0.76rem; }
.cd-search input { min-height: 52px; padding-left: 46px; border: 1px solid rgba(16,42,67,0.17); border-radius: 13px; color: var(--cd-navy); background: #fff; font-size: 1.03rem; box-shadow: inset 0 1px 2px rgba(16,42,67,0.035); }
.cd-search input:focus { border-color: var(--cd-amber); box-shadow: 0 0 0 4px rgba(233,154,34,0.14); }
.cd-search > i { left: 16px; color: var(--cd-amber-dark); }
.cd-suggest { bottom: calc(100% + 8px); padding: 6px; border-color: rgba(16,42,67,0.13); border-radius: 14px; }
.cd-suggest li { min-height: 43px; }
.cd-suggest li:hover, .cd-suggest li.is-active { background: rgba(233,154,34,0.12); }
.cd-miss { animation: cd-miss-in 0.28s ease both; }
.cd-miss:last-child { background: rgba(196,74,66,0.13); box-shadow: 0 0 0 2px rgba(196,74,66,0.06); }
@keyframes cd-miss-in { from { opacity: 0; transform: translateX(-8px) rotate(-2deg); } to { opacity: 1; transform: none; } }
.cd-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.cd-actions .cd-btn--reveal { justify-content: flex-start; }
.cd-actions .cd-btn--link { margin-left: 0; }
.cd-pending { padding: 3px 2px; }
.cd-pending__name { color: var(--cd-navy); }
.cd-pending__note { color: var(--cd-amber-dark); }

/* Result case file */
.cd-casefile {
    padding: 20px;
    gap: 17px;
    border-color: var(--cd-line);
    border-radius: 20px;
    background: rgba(255,255,255,0.83);
    box-shadow: 0 18px 38px rgba(16,42,67,0.1);
}
.cd-casefile__banner { padding: 15px 16px; border-radius: 14px; }
.cd-casefile--solved .cd-casefile__banner { color: #0d6c59; background: linear-gradient(110deg, rgba(22,131,107,0.15), rgba(22,131,107,0.06)); }
.cd-casefile--lost .cd-casefile__banner { color: #a63833; background: linear-gradient(110deg, rgba(196,74,66,0.15), rgba(196,74,66,0.06)); }
.cd-result-stamp { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 auto; border: 2px solid currentColor; border-radius: 50%; font-size: 1.45rem; transform: rotate(-7deg); animation: cd-stamp-in 0.38s cubic-bezier(.2,.9,.3,1.25) both; }
@keyframes cd-stamp-in { from { opacity: 0; transform: scale(1.7) rotate(-15deg); } to { opacity: 1; transform: scale(1) rotate(-7deg); } }
.cd-casefile__country { padding: 4px 2px; }
.cd-casefile__country img { width: 102px; }
.cd-casefile__country h2 { color: var(--cd-navy); font-size: 1.8rem; }
.cd-casefile details { border-color: var(--cd-line); }
.cd-casefile details .cd-clue { background: rgba(16,42,67,0.035); }

.cd-summary__hero { position: relative; overflow: hidden; padding: 30px 20px 24px; border-radius: 22px; color: #fff; background: linear-gradient(125deg, var(--cd-navy-deep), var(--cd-navy)); box-shadow: 0 18px 38px rgba(7,27,45,0.18); }
.cd-summary__trophy { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto; border: 1px solid rgba(247,199,104,0.28); border-radius: 50%; color: #ffd37b; background: rgba(247,199,104,0.1); animation: cd-trophy-in 0.55s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes cd-trophy-in { from { opacity: 0; transform: translateY(8px) scale(0.8); } to { opacity: 1; transform: none; } }
.cd-summary__hero .cd-summary__trophy i { color: inherit; font-size: 2.5rem; }
.cd-summary__hero h2 { color: #fff; }
.cd-summary__score { color: #ffd37b; }
.cd-summary__score small { color: rgba(255,255,255,0.62); }
.cd-summary__best { color: #8ef0d6; }
.cd-summary__row { padding: 13px 15px; border-color: var(--cd-line); background: rgba(255,255,255,0.76); }
.cd-summary__row > img { width: 52px; }
.cd-summary__row strong { color: var(--cd-navy); }
.cd-summary__points { color: var(--cd-amber-dark); }

.cd-locked__card { border-color: var(--cd-line); background: rgba(255,255,255,0.82); box-shadow: 0 18px 40px rgba(16,42,67,0.1); }
.cd-locked__card i, .cd-locked__card h2 { color: var(--cd-navy); }

/* Dark theme keeps the dossier contrast without turning every surface flat black. */
[data-theme="dark"] .cd-page .study-main {
    background:
        radial-gradient(circle at 92% 8%, rgba(233,154,34,0.10), transparent 26rem),
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px),
        var(--bg-primary, #07131f);
    background-size: auto, 28px 28px, 28px 28px, auto;
}
[data-theme="dark"] .cd-stats,
[data-theme="dark"] .cd-setup,
[data-theme="dark"] .cd-how,
[data-theme="dark"] .cd-evidence,
[data-theme="dark"] .cd-level,
[data-theme="dark"] .cd-casefile,
[data-theme="dark"] .cd-summary__row,
[data-theme="dark"] .cd-locked__card { background: rgba(15,31,44,0.82); border-color: rgba(255,255,255,0.09); }
[data-theme="dark"] .cd-stat + .cd-stat { border-color: rgba(255,255,255,0.09); }
[data-theme="dark"] .cd-stat__value,
[data-theme="dark"] .cd-section-title,
[data-theme="dark"] .cd-level__head h3,
[data-theme="dark"] .cd-how summary,
[data-theme="dark"] .cd-evidence > summary,
[data-theme="dark"] .cd-controls__heading,
[data-theme="dark"] .cd-pending__name,
[data-theme="dark"] .cd-casefile__country h2,
[data-theme="dark"] .cd-summary__row strong,
[data-theme="dark"] .cd-locked__card h2 { color: #e7f1f7; }
[data-theme="dark"] .cd-current .cd-clue {
    border-color: rgba(233,154,34,0.23);
    background:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(105deg, #142636, #102130);
    background-size: 100% 30px, auto;
    box-shadow: 0 18px 38px rgba(0,0,0,0.3), inset 4px 0 var(--cd-amber);
}
[data-theme="dark"] .cd-current .cd-clue__title,
[data-theme="dark"] .cd-current .cd-clue__text,
[data-theme="dark"] .cd-current .cd-clue__single .cd-fact__value { color: #edf4f7; }
[data-theme="dark"] .cd-controls { background: rgba(11,26,38,0.94); border-color: rgba(255,255,255,0.1); box-shadow: 0 -8px 30px rgba(0,0,0,0.3); }
[data-theme="dark"] .cd-search input { color: #eef5f8; background: rgba(255,255,255,0.055); border-color: rgba(255,255,255,0.13); }
[data-theme="dark"] .cd-btn--ghost { color: #e7f1f7; background: rgba(255,255,255,0.055); border-color: rgba(255,255,255,0.12); }
[data-theme="dark"] .cd-btn--reveal { color: #ffd37b; background: rgba(233,154,34,0.12); }
[data-theme="dark"] .cd-evidence .cd-clue,
[data-theme="dark"] .cd-casefile details .cd-clue { background: rgba(255,255,255,0.035); }

@media (max-width: 900px) {
    .cd-menu-grid { grid-template-columns: 1fr; }
    .cd-menu__aside { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr); align-items: start; }
    .cd-freeplay { min-height: 100%; }
}

@media (max-width: 640px) {
    .cd-menu, .cd-game, .cd-summary, .cd-locked { padding: 12px 10px 36px; }
    .cd-menu { gap: 14px; }
    .cd-banner--preview { font-size: 0.76rem; }
    .cd-hero { min-height: 0; padding: 23px 20px; border-radius: 19px; }
    .cd-hero__copy { gap: 14px; }
    .cd-hero__icon { width: 58px; height: 58px; border-radius: 16px; font-size: 2.35rem; }
    .cd-hero h1 { font-size: 1.72rem; }
    .cd-hero p { font-size: 0.86rem; line-height: 1.4; }
    .cd-hero__rules { display: none; }
    .cd-stats { grid-template-columns: 1fr 1fr; }
    .cd-stat { padding: 11px 8px; }
    .cd-stat:nth-child(2) { border-left: 1px solid var(--cd-line); }
    .cd-stat:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--cd-line); border-left: 0; }
    .cd-stat__value { font-size: 1.05rem; }
    .cd-section-heading { display: block; }
    .cd-section-heading p { margin-bottom: 11px; text-align: left; }
    .cd-chips--difficulty { grid-template-columns: repeat(2, 1fr); }
    .cd-levels { grid-template-columns: 1fr; }
    .cd-level { min-height: 0; }
    .cd-menu__aside { display: flex; }
    .cd-hud { top: calc(var(--cd-topbar-h, 0px) + 5px); padding: 8px 9px 10px; border-radius: 14px; }
    .cd-hud__row { gap: 5px; flex-wrap: nowrap; }
    .cd-chip { padding: 5px 7px; }
    .cd-chip--case i, .cd-chip--diff { display: none; }
    .cd-chip--prize { margin-left: 0; }
    .cd-chip--prize span, .cd-chip--prize small { display: none; }
    .cd-hud__pause { margin-left: auto; }
    .cd-rail { gap: 7px; }
    .cd-rail__bar { gap: 3px; }
    .cd-evidence > summary { padding: 10px 12px; }
    .cd-evidence > summary strong { display: none; }
    .cd-current .cd-clue { min-height: 190px; padding: 21px 18px 23px; border-radius: 17px; }
    .cd-current .cd-clue__head { margin-bottom: 13px; }
    .cd-current .cd-clue__text { font-size: 1.04rem; line-height: 1.55; }
    .cd-current .cd-photo img { max-height: 330px; }
    .cd-current .cd-shape { display: block; }
    .cd-current .cd-shape svg { display: block; margin: 0 auto 14px; }
    .cd-controls { bottom: 7px; padding: 11px; border-radius: 15px; }
    .cd-search input { min-height: 49px; }
    .cd-actions { grid-template-columns: 1fr auto; }
    .cd-actions .cd-btn--reveal { padding-inline: 13px; }
    .cd-actions .cd-btn--reveal small { font-size: 0.7rem; }
    .cd-casefile { padding: 15px; }
    .cd-casefile__country img { width: 78px; }
    .cd-casefile__country h2 { font-size: 1.45rem; }
}

/* The investigation is laid out on a desk, with each new clue unfurling from its center. */
.cd-hero__copy { max-width: 62%; }
.cd-hero__art {
    position: absolute;
    z-index: 0;
    width: min(39%, 390px);
    height: auto;
    right: 62px;
    top: 50%;
    transform: translateY(-50%) rotate(2deg);
    filter: drop-shadow(0 18px 20px rgba(0, 5, 15, .3));
    pointer-events: none;
}
.cd-hero__rules { position: relative; z-index: 2; }
.cd-freeplay::before {
    content: "";
    position: absolute;
    width: 210px;
    height: 170px;
    right: -66px;
    top: 9px;
    background: url('../images/games/country-detective-case.svg') center / contain no-repeat;
    opacity: .16;
    transform: rotate(13deg);
    pointer-events: none;
}
.cd-clue,
.cd-evidence .cd-clue,
.cd-casefile details .cd-clue,
.cd-current .cd-clue,
[data-theme="dark"] .cd-current .cd-clue,
[data-theme="dark"] .cd-evidence .cd-clue,
[data-theme="dark"] .cd-casefile details .cd-clue {
    position: relative;
    isolation: isolate;
    border: 1px solid #b69a63;
    color: #3f311e;
    background-color: #e9d5a2;
    background-image:
        radial-gradient(ellipse at 5% 6%, rgba(116, 77, 31, .22), transparent 27%),
        radial-gradient(ellipse at 96% 95%, rgba(133, 83, 28, .18), transparent 31%),
        repeating-linear-gradient(168deg, transparent 0 32px, rgba(103, 69, 35, .035) 33px, transparent 35px),
        linear-gradient(105deg, #c9a96e 0%, #f7e9bd 7%, #f4e5b8 50%, #efdbab 93%, #c6a269 100%);
    background-size: auto;
    box-shadow: 0 10px 26px rgba(65, 42, 14, .15), inset 0 0 22px rgba(110, 70, 25, .15);
}
.cd-clue::selection, .cd-clue *::selection { background: #bd8b45; color: #fff; }
.cd-clue__head,
.cd-clue__body { position: relative; z-index: 1; }
.cd-clue__title,
.cd-current .cd-clue__title,
[data-theme="dark"] .cd-current .cd-clue__title,
.cd-clue__text,
.cd-current .cd-clue__text,
[data-theme="dark"] .cd-current .cd-clue__text,
.cd-clue__big,
.cd-fact__value,
.cd-current .cd-clue__single .cd-fact__value,
[data-theme="dark"] .cd-current .cd-clue__single .cd-fact__value { color: #382b1b; }
.cd-clue__text--muted, .cd-fact__label { color: #715c3b; }
.cd-clue__head i, .cd-current .cd-clue__head i { color: #895927; }
.cd-clue__prize, .cd-current .cd-clue__prize { color: #67431f; background: rgba(133, 87, 35, .11); }
.cd-fact, .cd-current .cd-fact { background: rgba(128, 83, 30, .09); }
.cd-current .cd-clue {
    min-height: 225px;
    padding-inline: clamp(31px, 5vw, 52px);
    box-shadow: 0 20px 36px rgba(65, 42, 14, .18), inset 0 0 32px rgba(110, 70, 25, .17);
}
.cd-current .cd-clue--latest { animation: cd-unfurl .82s cubic-bezier(.22,.72,.19,1) both; }
.cd-current .cd-clue--latest .cd-clue__head,
.cd-current .cd-clue--latest .cd-clue__body { animation: cd-ink-reveal .48s .38s both; }
.cd-current .cd-clue--latest::before,
.cd-current .cd-clue--latest::after {
    content: "";
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    width: 25px;
    height: auto;
    border: 1px solid rgba(106, 66, 29, .42);
    border-radius: 50%;
    background: linear-gradient(90deg, #8c6031, #e2c48a 24%, #f6e5b4 52%, #b6874e 84%, #76502b);
    box-shadow: 0 0 14px rgba(68, 41, 17, .26);
    pointer-events: none;
}
.cd-current .cd-clue--latest::before { animation: cd-roller-left .82s cubic-bezier(.22,.72,.19,1) both; }
.cd-current .cd-clue--latest::after { animation: cd-roller-right .82s cubic-bezier(.22,.72,.19,1) both; }
@keyframes cd-unfurl {
    0% { clip-path: inset(0 49% 0 49% round 18px); filter: brightness(.88); }
    75% { clip-path: inset(0 0 0 0 round 18px); filter: brightness(1); }
    100% { clip-path: inset(0 0 0 0 round 18px); filter: none; }
}
@keyframes cd-roller-left {
    0% { left: 50%; opacity: 1; transform: translateX(-50%); }
    75% { left: 0; opacity: 1; transform: translateX(-50%); }
    100% { left: 0; opacity: 0; transform: translateX(-50%); }
}
@keyframes cd-roller-right {
    0% { right: 50%; opacity: 1; transform: translateX(50%); }
    75% { right: 0; opacity: 1; transform: translateX(50%); }
    100% { right: 0; opacity: 0; transform: translateX(50%); }
}
@keyframes cd-ink-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cd-summary__hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url('../images/games/country-detective-case.svg') right -42px center / 340px auto no-repeat;
    opacity: .16;
    pointer-events: none;
}
.cd-summary__hero > * { position: relative; z-index: 1; }
.cd-summary__hero--high { box-shadow: 0 20px 42px rgba(117, 72, 19, .22), inset 0 0 0 1px rgba(255, 211, 123, .3); }
.cd-confetti { position: fixed; inset: 0; z-index: 100; overflow: hidden; pointer-events: none; }
.cd-confetti span {
    position: absolute;
    left: var(--cd-x);
    top: -18px;
    width: 9px;
    height: 16px;
    border-radius: 2px;
    background: var(--cd-color);
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    animation: cd-confetti-fall var(--cd-duration) var(--cd-delay) ease-in both;
}
.cd-confetti span:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }
@keyframes cd-confetti-fall {
    0% { opacity: 0; transform: translate3d(0, -10px, 0) rotate(0deg); }
    8% { opacity: 1; }
    88% { opacity: 1; }
    100% { opacity: 0; transform: translate3d(var(--cd-drift), 105vh, 0) rotate(780deg); }
}
@media (max-width: 900px) {
    .cd-hero__art { right: 20px; width: 38%; opacity: .68; }
    .cd-hero__copy { max-width: 70%; }
}
@media (max-width: 640px) {
    .cd-hero__copy { max-width: 100%; }
    .cd-hero__art { right: -48px; top: 63%; width: 225px; opacity: .23; }
    .cd-current .cd-clue { min-height: 210px; padding-inline: 30px; }
    .cd-summary__hero::before { background-size: 230px auto; opacity: .11; }
}
@media (prefers-reduced-motion: reduce) {
    .cd-page *, .cd-page *::before, .cd-page *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
