/* =============================================================================
 * Dhakar Koi? — styles
 * Night-map glass panels over the Colored Pencil basemap. Handwritten type,
 * water→shore→land gradients, contour-line textures, neon bloom.
 * ========================================================================== */
:root {
    --night: #0a1230;
    --night-2: #111d47;
    --text: #eef4ff;
    --text-2: #b9c8e8;
    --text-3: #8396bf;
    --line: rgba(140, 180, 255, .18);
    --cyan: #22d3ee;
    --blue: #3b82f6;
    --blue-deep: #2563eb;
    --green: #34d399;
    --gold: #facc15;
    --pink: #f472b6;
    --amber: #f59e0b;
    --red: #ef4444;
    --coral: #e5484d;
    --grad-map: linear-gradient(120deg, #2563eb 0%, #06b6d4 55%, #34d399 100%);
    --grad-hot: linear-gradient(120deg, #f59e0b, #ef4444 55%, #ec4899);
    --glow: 0 0 18px rgba(34, 211, 238, .55);
    --bar-h: 58px;
    --r: 18px;
    --topo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='none' stroke='%237cc4ff' stroke-opacity='.11' stroke-width='1.3'%3E%3Cpath d='M130 30c50 0 92 34 86 82s-48 98-98 92-88-42-82-96 44-78 94-78z'/%3E%3Cpath d='M130 58c34 0 64 24 60 58s-34 68-68 64-60-30-56-68 30-54 64-54z'/%3E%3Cpath d='M131 86c19 0 36 14 33 33s-19 38-38 35-33-17-31-38 17-30 36-30z'/%3E%3Cpath d='M-10 250c45-34 100-22 145 0s110 32 140-12'/%3E%3Cpath d='M-10 228c45-34 100-22 145 0s110 32 140-12'/%3E%3C/g%3E%3C/svg%3E");
    --font: "Patrick Hand", "Atma", "Comic Sans MS", system-ui, sans-serif;
    --font-display: "Permanent Marker", "Galada", "Patrick Hand", cursive;
}
html[lang="bn"] {
    --font: "Atma", "Patrick Hand", system-ui, sans-serif;
    --font-display: "Galada", "Atma", cursive;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--night); color: var(--text); font: 17px/1.4 var(--font); -webkit-text-size-adjust: 100%; color-scheme: dark; }
html[lang="bn"] body { font-size: 16px; }
#app { position: fixed; inset: 0; }
h1, h2 { margin: 0; font-family: var(--font-display); font-weight: 400; line-height: 1.15; letter-spacing: .01em; text-wrap: balance; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
html[lang="bn"] h1 { font-size: 2.1rem; }
html[lang="bn"] h2 { font-size: 1.5rem; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.grad-text { background: var(--grad-map); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Top bar ---------- */
#topbar {
    position: absolute; inset: 0 0 auto 0; height: var(--bar-h); z-index: 30;
    display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px;
    background: var(--topo) 0 0 / 260px, linear-gradient(90deg, #0a1230, #0f1f52 50%, #0a1230);
    box-shadow: 0 6px 24px rgba(2, 6, 23, .45);
}
.brand { display: flex; align-items: center; gap: 10px; font: 1.3rem var(--font-display); white-space: nowrap; text-shadow: 0 0 14px rgba(34, 211, 238, .45); }
.brand img { display: block; border-radius: 9px; filter: drop-shadow(0 0 8px rgba(34, 211, 238, .5)); }
.tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; background: none; border: 0; border-radius: 12px; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateY(-1px); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#btn-sound .mute { display: none; }
#btn-sound[aria-pressed="false"] .waves { display: none; }
#btn-sound[aria-pressed="false"] .mute { display: inline; }
.lang-btn { height: 36px; margin-left: 4px; padding: 0 14px; border: 1px solid rgba(34, 211, 238, .5); border-radius: 999px; background: rgba(34, 211, 238, .08); color: #fff; font: 1rem var(--font); cursor: pointer; transition: box-shadow .2s; }
.lang-btn:hover { box-shadow: var(--glow); }

/* HUD */
#hud { position: absolute; left: 50%; top: 0; height: var(--bar-h); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; }
.hud-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 66px; height: 44px; padding: 0 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.hud-label { font-size: .72rem; color: var(--text-3); line-height: 1; letter-spacing: .04em; }
.hud-cell b { font: 1.3rem/1.15 var(--font-display); white-space: nowrap; color: #fff; text-shadow: 0 0 12px rgba(34, 211, 238, .55); }
html[lang="bn"] .hud-cell b { font-family: var(--font); font-weight: 700; font-size: 1.25rem; }
#score-text.pop { display: inline-block; animation: bump .5s ease-out; }
.hud-time { min-width: 86px; transition: background-color 2s, border-color 2s, box-shadow 2s; }
.hud-time b { font-size: 1.45rem; transition: color 2s, text-shadow 2s; }
.mult { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 8px; font: .85rem/1.5 var(--font); color: var(--text-3); background: rgba(255, 255, 255, .08); text-shadow: none; vertical-align: 3px; }
.hud-streak.hot { border-color: rgba(245, 158, 11, .7); box-shadow: 0 0 16px rgba(239, 68, 68, .45); background: rgba(245, 158, 11, .1); }
.hud-streak.hot .mult { color: #fff; background: var(--grad-hot); box-shadow: 0 0 10px rgba(239, 68, 68, .7); }
.hud-streak.hot b { text-shadow: 0 0 12px rgba(245, 158, 11, .8); }
.hud-streak.bump { animation: bump .6s ease-out; }

#timebar { position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; pointer-events: none; }
#timebar i { display: block; height: 100%; background: var(--grad-map); background-size: 200% 100%; transform-origin: left; transition: transform .25s linear; box-shadow: 0 0 12px rgba(34, 211, 238, .8); animation: shimmer 3s linear infinite; }
#app:not([data-phase="play"]):not([data-phase="reveal"]) #timebar { display: none; }

/* Urgency: warn (amber, gradual) -> urgent (red, gentle pulse) -> final (stronger pulse + soft edge) */
#app[data-urgency="warn"] .hud-time { background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .6); }
#app[data-urgency="warn"] .hud-time b { color: #fde68a; text-shadow: 0 0 12px rgba(245, 158, 11, .8); }
#app[data-urgency="warn"] #timebar i { background: linear-gradient(90deg, #f59e0b, #facc15); box-shadow: 0 0 12px rgba(245, 158, 11, .8); }
#app[data-urgency="urgent"] .hud-time, #app[data-urgency="final"] .hud-time { background: rgba(239, 68, 68, .18); border-color: rgba(239, 68, 68, .8); box-shadow: 0 0 18px rgba(239, 68, 68, .5); transition-duration: .6s; }
#app[data-urgency="urgent"] .hud-time b, #app[data-urgency="final"] .hud-time b { color: #fecaca; text-shadow: 0 0 14px rgba(239, 68, 68, .95); transition-duration: .6s; }
#app[data-urgency="urgent"] #timebar i, #app[data-urgency="final"] #timebar i { background: linear-gradient(90deg, #ef4444, #ec4899); box-shadow: 0 0 14px rgba(239, 68, 68, .9); }
#app[data-urgency="urgent"] .hud-time b { display: inline-block; animation: pulse 1s ease-in-out infinite; }
#app[data-urgency="final"] .hud-time b { display: inline-block; animation: pulse-strong .5s ease-in-out infinite alternate; }
#edge { position: absolute; inset: var(--bar-h) 0 0 0; z-index: 5; pointer-events: none; opacity: 0; box-shadow: inset 0 0 0 3px rgba(239, 68, 68, .55), inset 0 0 90px rgba(239, 68, 68, .3); transition: opacity 1s; }
#app[data-urgency="final"] #edge { opacity: 1; animation: breathe 1s ease-in-out infinite alternate; }

/* ---------- Map ---------- */
#gameMap { position: absolute; inset: var(--bar-h) 0 0 0; z-index: 0; display: block; background: #efe9dc; }
#app[data-phase="play"] #gameMap { cursor: crosshair; }

/* ---------- Panels ---------- */
.panel {
    position: absolute; z-index: 20; color: var(--text);
    background: var(--topo) 0 0 / 260px, linear-gradient(160deg, rgba(20, 34, 84, .96), rgba(10, 18, 48, .97));
    border: 1px solid rgba(125, 180, 255, .28); border-radius: var(--r);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, .08), 0 18px 50px rgba(2, 6, 23, .55), 0 0 40px rgba(37, 99, 235, .25);
    backdrop-filter: blur(6px);
}
.side { top: calc(var(--bar-h) + 18px); left: 18px; width: 390px; max-height: calc(100% - var(--bar-h) - 36px); padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; animation: slide-in .45s cubic-bezier(.2, 1.3, .4, 1); }
.dock { left: 18px; bottom: 18px; width: 370px; max-height: calc(100% - var(--bar-h) - 36px); overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 6px; animation: rise .4s cubic-bezier(.2, 1.4, .4, 1); }
.center { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100vw - 32px)); padding: 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.side > *, .dock > * { flex-shrink: 0; } /* scroll the panel, never squash its blocks */
.side::-webkit-scrollbar, .dock::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb, .dock::-webkit-scrollbar-thumb { background: rgba(140, 180, 255, .25); border-radius: 8px; }

#start-title { font-size: 2.6rem; background: var(--grad-map); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 14px rgba(34, 211, 238, .45)); transform: rotate(-2deg); transform-origin: left; }
.lead { font-size: 1.15rem; color: var(--text-2); margin-top: -10px; }
.intro { font-size: 1.05rem; }
.kicker { font-size: .95rem; color: var(--cyan); letter-spacing: .03em; }
.alt { color: var(--text-3); }
.alt:empty, .clue:empty, .facts:empty, .quip:empty { display: none; }
.hint { font-size: .92rem; color: var(--text-3); }

.rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rules li { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); font-size: .98rem; color: var(--text-2); transition: transform .2s, border-color .2s; }
.rules li:hover { transform: translateX(4px); border-color: rgba(34, 211, 238, .5); }
.rules b { font: 1.35rem var(--font-display); text-align: center; background: var(--grad-map); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 6px rgba(34, 211, 238, .5)); }
html[lang="bn"] .rules b { font-family: var(--font); font-weight: 700; }
#rule-time-n { background: var(--grad-hot); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 6px rgba(245, 158, 11, .6)); }

/* form */
#form-start { display: flex; flex-direction: column; gap: 12px; }
.field-row { display: flex; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .95rem; color: var(--text-2); }
.field.grow { flex: 1; min-width: 0; }
.field.age { width: 92px; }
.opt { font-style: normal; color: var(--text-3); font-size: .85rem; }
.field input, .field select {
    width: 100%; height: 46px; padding: 0 14px; font: 1.1rem var(--font); color: #fff;
    background: rgba(255, 255, 255, .07); border: 1.5px solid rgba(140, 180, 255, .35); border-radius: 12px;
    transition: border-color .2s, box-shadow .2s;
}
.field select { padding-right: 34px; appearance: none; font-size: 1rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2322d3ee' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.field select option { background: var(--night-2); color: #fff; }
.field input:focus, .field select:focus { outline: 0; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .2), var(--glow); }
.field input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 12px rgba(239, 68, 68, .45); }
.field input::placeholder { color: #7186b3; }
.field-msg { margin-top: -6px; font-size: .95rem; color: #fca5a5; }
.form-error { padding: 8px 12px; background: rgba(239, 68, 68, .15); border: 1px solid rgba(239, 68, 68, .45); color: #fecaca; border-radius: 12px; font-size: .95rem; }

/* buttons */
.btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden;
    min-height: 46px; padding: 0 18px; font: 1.1rem var(--font); text-decoration: none; color: #fff;
    background: rgba(255, 255, 255, .07); border: 1.5px solid rgba(140, 180, 255, .35); border-radius: 14px; cursor: pointer;
    transition: transform .15s, box-shadow .2s, border-color .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--cyan); box-shadow: var(--glow); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--grad-map); border-color: transparent; box-shadow: 0 6px 22px rgba(6, 182, 212, .45), inset 0 1px 0 rgba(255, 255, 255, .35); text-shadow: 0 1px 2px rgba(2, 6, 23, .35); }
.btn-primary:hover { filter: brightness(1.1) saturate(1.1); border-color: transparent; box-shadow: 0 8px 30px rgba(6, 182, 212, .7), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-20deg); animation: sheen 3.2s ease-in-out infinite; }
.btn-quiet { border-color: transparent; background: none; color: var(--text-2); padding: 0 12px; }
.btn-quiet:hover { background: rgba(255, 255, 255, .06); box-shadow: none; border-color: transparent; }
.btn:disabled { background: rgba(255, 255, 255, .05); border-color: var(--line); color: #6c7ea8; box-shadow: none; cursor: not-allowed; transform: none; filter: none; text-shadow: none; }
.btn:disabled::after { display: none; }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font: 1.5rem var(--font-display); letter-spacing: .03em; animation: ready 2.4s ease-in-out infinite; }
html[lang="bn"] .btn-lg { font-family: var(--font); font-weight: 700; font-size: 1.35rem; }
.grow { flex: 1 1 auto; }
.floating { position: absolute; z-index: 20; left: 50%; bottom: 22px; transform: translateX(-50%); }
.floating:hover { transform: translateX(-50%) translateY(-2px); }
.text-btn { padding: 0; background: none; border: 0; color: var(--cyan); font: 1rem var(--font); cursor: pointer; text-decoration: none; }
.text-btn:hover { text-shadow: 0 0 10px rgba(34, 211, 238, .8); }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.actions.wrap { flex-wrap: wrap; }
.links { display: flex; gap: 18px; margin: 2px 0 6px; }

/* top players preview */
.top-box { border-top: 1px dashed rgba(140, 180, 255, .3); padding-top: 14px; }
.top-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 1rem; color: var(--text-2); }
#top-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
#top-list li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .04); }
#top-list li .n { font: 1.1rem var(--font-display); color: var(--text-3); }
#top-list li:nth-child(1) .n { color: var(--gold); text-shadow: 0 0 10px rgba(250, 204, 21, .7); }
#top-list li:nth-child(2) .n { color: #e2e8f0; }
#top-list li:nth-child(3) .n { color: #fdba74; }
#top-list li .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#top-list li .s { font-weight: 700; color: var(--cyan); }
#top-list li.empty { display: block; color: var(--text-3); }

/* guess card */
.card-meta { display: flex; justify-content: space-between; align-items: center; font-size: .92rem; color: var(--text-3); }
.bonus { padding: 2px 10px; border-radius: 999px; background: rgba(34, 211, 238, .12); border: 1px solid rgba(34, 211, 238, .45); color: var(--cyan); }
.bonus.up { background: var(--grad-hot); border-color: transparent; color: #fff; box-shadow: 0 0 14px rgba(239, 68, 68, .55); animation: wiggle 1.6s ease-in-out infinite; }
#clue-photo { width: calc(100% + 36px); height: 140px; margin: 4px -18px 4px; object-fit: cover; }
#clue-name { font-size: 1.6rem; text-shadow: 0 0 16px rgba(34, 211, 238, .35); }
.clue { margin-top: 4px; font-size: 1rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clue.open { display: block; -webkit-line-clamp: unset; }
#btn-more { align-self: flex-start; font-size: .95rem; }

/* reveal card */
.reveal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.result-score b { display: block; font: 2.7rem/1 var(--font-display); background: var(--grad-map); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 12px rgba(34, 211, 238, .6)); }
html[lang="bn"] .result-score b { font-family: var(--font); font-weight: 700; }
.result-score span { display: block; margin-top: 4px; font-size: .95rem; color: var(--text-3); }
#card-reveal[data-tier="miss"] .result-score b { background: linear-gradient(120deg, #fde68a, #f59e0b); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 10px rgba(245, 158, 11, .5)); }
#card-reveal[data-tier="miss"][data-heat="far"] .result-score b, #card-reveal[data-tier="miss"][data-heat="veryFar"] .result-score b { background: var(--grad-hot); -webkit-background-clip: text; background-clip: text; }
#card-reveal[data-tier="skipped"] .result-score b { background: none; color: var(--text-3); filter: none; }
.result-score.pop { animation: bump .55s ease-out; }
.verdict { margin-top: 6px; font: 1.35rem var(--font-display); color: var(--cyan); text-shadow: 0 0 12px rgba(34, 211, 238, .6); }
html[lang="bn"] .verdict { font-family: var(--font); font-weight: 700; }
#card-reveal[data-tier="miss"] .verdict { color: #fcd34d; text-shadow: 0 0 12px rgba(245, 158, 11, .6); }
#card-reveal[data-tier="miss"][data-heat="veryFar"] .verdict, #card-reveal[data-tier="miss"][data-heat="far"] .verdict { color: #fca5a5; text-shadow: 0 0 12px rgba(239, 68, 68, .6); }
#card-reveal[data-tier="skipped"] .verdict { color: var(--text-3); text-shadow: none; }
#card-reveal.shake { animation: shake .45s ease-in-out; }
.quip { position: relative; align-self: flex-start; margin: 4px 0 6px; padding: 7px 14px; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, .1); border: 1.5px dashed rgba(255, 255, 255, .35); font-size: 1.08rem; color: #fff; transform: rotate(-1.2deg); animation: pop-in .5s cubic-bezier(.2, 1.6, .4, 1) .15s both; }
.facts { font-size: 1rem; color: var(--text); }
#rv-details { margin-bottom: 2px; }

/* compass */
.compass { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.compass svg { width: 68px; height: 68px; display: block; filter: drop-shadow(0 0 10px rgba(34, 211, 238, .35)); }
.compass .dial { fill: rgba(10, 18, 48, .9); stroke: rgba(34, 211, 238, .6); stroke-width: 2; }
.compass .ticks path { stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; }
.compass .ticks .minor { stroke: rgba(140, 180, 255, .45); stroke-width: 1.5; }
.compass text { font: 700 9px sans-serif; fill: var(--cyan); }
.needle { transform-origin: 32px 32px; transform: rotate(0deg); transition: transform 1s cubic-bezier(.3, 1.45, .55, 1); }
.needle.instant { transition: none; }
.needle .tip { fill: var(--cyan); filter: drop-shadow(0 0 3px #22d3ee); }
.needle .tail { fill: rgba(140, 180, 255, .45); }
.needle circle { fill: #fff; }
#compass-dir { font-size: .95rem; color: var(--cyan); }

/* results */
.final { position: relative; padding: 18px; border-radius: 16px; overflow: hidden; background: var(--topo) 0 0 / 220px, var(--grad-map); box-shadow: 0 10px 30px rgba(6, 182, 212, .45), inset 0 1px 0 rgba(255, 255, 255, .35); text-shadow: 0 1px 3px rgba(2, 6, 23, .35); }
.final::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%); transform: translateX(-100%); animation: sweep 3.5s ease-in-out infinite; }
.final > span { font-size: 1rem; opacity: .9; }
.final b { display: block; font: 3.4rem/1.05 var(--font-display); text-shadow: 0 0 22px rgba(255, 255, 255, .55), 0 2px 0 rgba(2, 6, 23, .25); }
html[lang="bn"] .final b { font-family: var(--font); font-weight: 700; }
.bonus-line { display: inline-block; margin: 4px 0; padding: 3px 12px; border-radius: 999px; background: rgba(10, 18, 48, .35); font-size: .95rem; }
#st-standing { font-size: 1rem; opacity: .95; }
#st-standing:empty { display: none; }
.stats { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.stats div:last-child:nth-child(3n+2) { grid-column: span 2; }
.stats dt { font-size: .85rem; color: var(--text-3); }
.stats dd { margin: 0; font: 1.35rem var(--font-display); white-space: nowrap; color: #fff; text-shadow: 0 0 10px rgba(34, 211, 238, .5); }
html[lang="bn"] .stats dd { font-family: var(--font); font-weight: 700; }
.save-status { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 1rem; color: var(--text-3); }
.save-status[data-state="ok"] { color: var(--green); text-shadow: 0 0 10px rgba(52, 211, 153, .5); }
.save-status[data-state="error"] { color: #fca5a5; }
.recap summary { cursor: pointer; font-size: 1.05rem; }
.recap ol { margin: 8px 0 0; padding: 0; list-style: none; }
.recap li { display: grid; grid-template-columns: 24px 1fr auto 52px; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px dashed var(--line); font-size: .98rem; }
.recap .n { color: var(--text-3); }
.recap .d { color: var(--text-3); font-size: .9rem; white-space: nowrap; }
.recap .p { text-align: right; font-weight: 700; }
.recap .p small { display: block; font-size: .78rem; color: var(--amber); }
.recap li.hit .p { color: var(--cyan); }
.recap li.none { color: var(--text-3); }

/* thana familiarity report */
.thana-report { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.thana-report h3 { margin: 0; font: 1.25rem var(--font-display); font-weight: 400; background: var(--grad-map); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[lang="bn"] .thana-report h3 { font-weight: 400; }
.coverage { font-size: 1rem; color: var(--text); }
.coverage b { color: var(--cyan); text-shadow: 0 0 10px rgba(34, 211, 238, .6); }
.th-highlights { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.th-highlights div { padding: 8px 10px; border-radius: 10px; background: rgba(10, 18, 48, .45); }
.th-highlights span { display: block; font-size: .82rem; color: var(--text-3); }
.th-highlights b { display: block; font-size: 1.05rem; overflow-wrap: anywhere; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .85rem; color: var(--text-2); }
.legend .lg-title { width: 100%; font-size: .8rem; color: var(--text-3); }
.legend span.item { display: inline-flex; align-items: center; gap: 5px; }
.legend i, .th-list i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(15, 27, 45, .9); flex: none; }
.legend i.hatch, .th-list i.hatch { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 2px, transparent 2px 5px); }
.th-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.th-list li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 9px; background: rgba(255, 255, 255, .04); cursor: pointer; font-size: .95rem; transition: background .15s; }
.th-list li:hover, .th-list li.sel { background: rgba(34, 211, 238, .14); }
.th-list .g { color: var(--text-3); font-size: .85rem; white-space: nowrap; }
.th-list .v { font-weight: 700; min-width: 2.2em; text-align: right; }
.th-note { font-size: .82rem; }

.map-legend { right: 18px; bottom: 18px; width: 240px; padding: 12px 14px; z-index: 19; animation: rise .35s ease-out; }
.thana-pop { right: 18px; top: calc(var(--bar-h) + 18px); width: 290px; padding: 14px 16px; z-index: 22; animation: pop-in .3s cubic-bezier(.2, 1.4, .4, 1); }
.pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pop-head h3 { margin: 0; font: 1.25rem var(--font-display); font-weight: 400; overflow-wrap: anywhere; }
.pop-class { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 8px; font-size: .95rem; color: var(--text-2); }
.pop-class:empty { display: none; }
.pop-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pop-stats:empty { display: none; }
.pop-stats div { padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); }
.pop-stats dt { font-size: .78rem; color: var(--text-3); }
.pop-stats dd { margin: 0; font-size: 1.1rem; font-weight: 700; }
#pop-msg:empty { display: none; }

/* ---------- Modals ---------- */
.modal { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(2, 6, 23, .6); backdrop-filter: blur(3px); }
.modal-box { position: relative; width: min(660px, 100%); max-height: 100%; padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { background: var(--grad-map); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 14px; background: rgba(255, 255, 255, .06); color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; font: 1rem var(--font); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--grad-map); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.table-wrap { overflow: auto; min-height: 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 1rem; }
th { position: sticky; top: 0; background: #101b45; padding: 6px 8px; text-align: right; font-size: .85rem; font-weight: 400; color: var(--text-3); white-space: nowrap; }
td { padding: 8px; text-align: right; white-space: nowrap; background: rgba(255, 255, 255, .04); }
td:first-child { border-radius: 10px 0 0 10px; }
td:last-child { border-radius: 0 10px 10px 0; }
th:first-child, td:first-child { text-align: left; width: 2.4em; font: 1.1rem var(--font-display); color: var(--text-3); }
th:nth-child(2), td:nth-child(2) { text-align: left; white-space: normal; overflow-wrap: anywhere; }
td:nth-child(3) { font-weight: 700; color: var(--cyan); }
tr.me td { background: rgba(34, 211, 238, .16); box-shadow: inset 0 1px 0 rgba(34, 211, 238, .4), inset 0 -1px 0 rgba(34, 211, 238, .4); }
tr.gap td { text-align: center; color: var(--text-3); background: none; padding: 0; }
tr[data-rank="1"] td:first-child { color: var(--gold); text-shadow: 0 0 10px rgba(250, 204, 21, .7); }
tr[data-rank="2"] td:first-child { color: #e2e8f0; }
tr[data-rank="3"] td:first-child { color: #fdba74; }
.tag { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--grad-map); color: #fff; font-size: .78rem; }
#share-canvas { width: 100%; max-width: 360px; height: auto; align-self: center; border-radius: 14px; box-shadow: 0 0 30px rgba(34, 211, 238, .35); }

/* ---------- Feedback ---------- */
#toast {
    position: absolute; z-index: 35; left: 50%; top: calc(var(--bar-h) + 16px); transform: translate(-50%, -12px) scale(.9);
    padding: 9px 18px; border-radius: 999px; background: rgba(10, 18, 48, .92); border: 1px solid rgba(34, 211, 238, .5); color: #fff; font-size: 1.1rem;
    box-shadow: var(--glow); opacity: 0; pointer-events: none; transition: opacity .25s, transform .35s cubic-bezier(.2, 1.5, .4, 1);
    white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#toast.blue { background: var(--grad-hot); border-color: transparent; box-shadow: 0 0 22px rgba(239, 68, 68, .6); }
#toast.urgent { background: rgba(239, 68, 68, .9); border-color: transparent; box-shadow: 0 0 22px rgba(239, 68, 68, .7); }

#celebrate { position: absolute; z-index: 36; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; opacity: 0; width: min(92vw, 640px); }
#celebrate b { position: relative; display: block; font: 4.2rem/1.05 var(--font-display); background: linear-gradient(120deg, #facc15, #f472b6 45%, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 16px rgba(255, 255, 255, .7)) drop-shadow(0 0 30px rgba(244, 114, 182, .6)); transform: rotate(-4deg); }
html[lang="bn"] #celebrate b { font-size: 4rem; }
#celebrate span { position: relative; display: inline-block; margin-top: 10px; padding: 6px 16px; border-radius: 999px; background: rgba(10, 18, 48, .9); border: 1px solid rgba(250, 204, 21, .6); color: #fff; font-size: 1.2rem; box-shadow: 0 0 20px rgba(250, 204, 21, .45); }
#celebrate .flare { position: absolute; left: 50%; top: 40%; width: 420px; height: 420px; margin: -210px 0 0 -210px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .95) 0 4%, rgba(250, 204, 21, .55) 10%, rgba(244, 114, 182, .25) 28%, transparent 60%),
                repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .28) 0deg 3deg, transparent 3deg 18deg);
    -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%);
    mix-blend-mode: screen; animation: spin 6s linear infinite; }
#celebrate.small b { font-size: 3rem; }
#celebrate.small .flare { width: 240px; height: 240px; margin: -120px 0 0 -120px; }
#celebrate.show { animation: celebrate 2s ease-out forwards; }

#confetti { position: absolute; inset: 0; z-index: 34; pointer-events: none; overflow: hidden; }
#confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: burst 1.2s ease-out forwards; box-shadow: 0 0 6px currentColor; }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 35; pointer-events: none; }

.spinner { width: 46px; height: 46px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, #22d3ee, #34d399); -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%); mask: radial-gradient(circle, transparent 54%, #000 56%); animation: spin .9s linear infinite; filter: drop-shadow(0 0 8px #22d3ee); }

@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-30px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.7) rotate(-4deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bump { 40% { transform: scale(1.3); } }
@keyframes pulse { 50% { transform: scale(1.07); } }
@keyframes pulse-strong { from { transform: scale(1); } to { transform: scale(1.16); } }
@keyframes breathe { from { opacity: .45; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes sheen { 0%, 60% { left: -60%; } 100% { left: 130%; } }
@keyframes sweep { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes ready { 50% { box-shadow: 0 6px 34px rgba(34, 211, 238, .85), inset 0 1px 0 rgba(255, 255, 255, .35); } }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-4deg); } 90% { transform: rotate(4deg); } 95% { transform: rotate(-2deg); } }
@keyframes shake { 20% { transform: translateX(-7px) rotate(-.6deg); } 40% { transform: translateX(6px) rotate(.5deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes burst { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@keyframes celebrate { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-8deg); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); } 24% { transform: translate(-50%, -50%) scale(1) rotate(0); } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -62%) scale(1); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
    #confetti, #fx, #celebrate .flare { display: none; }
    #celebrate.show { opacity: 1; }
    #app[data-urgency="final"] #edge { opacity: .8; }
}

/* ---------- Phones ---------- */
@media (max-width: 720px) {
    :root { --bar-h: 54px; }
    #topbar { padding: 0 6px 0 10px; gap: 6px; }
    #brand-name { display: none; }
    #app[data-phase="play"] .brand, #app[data-phase="reveal"] .brand { display: none; }
    #hud { position: static; transform: none; height: auto; margin-right: auto; gap: 4px; }
    .hud-cell { padding: 0 7px; min-width: 0; height: 40px; border-radius: 10px; }
    .hud-label { font-size: .62rem; }
    .hud-cell b { font-size: 1.05rem; }
    html[lang="bn"] .hud-cell b { font-size: 1.02rem; }
    .hud-time { min-width: 60px; }
    .hud-time b { font-size: 1.2rem; }
    .mult { margin-left: 3px; padding: 0 4px; font-size: .72rem; }
    .icon-btn { width: 36px; height: 36px; }
    .lang-btn { padding: 0 10px; font-size: .9rem; }
    #app[data-phase="play"] #btn-leaderboard, #app[data-phase="reveal"] #btn-leaderboard { display: none; }
    .side { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: calc(100% - var(--bar-h) - 24px); border-radius: 22px 22px 0 0; border-bottom: 0; padding: 20px 18px; gap: 14px; }
    .dock { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 50%; padding: 14px 16px; }
    .map-legend { left: 8px; right: 8px; bottom: 78px; width: auto; padding: 8px 10px; }
    #app[data-phase="over"] .map-legend { display: none; }
    .thana-pop { left: 8px; right: 8px; top: calc(var(--bar-h) + 8px); width: auto; }
    #clue-name { font-size: 1.35rem; }
    .clue { -webkit-line-clamp: 2; }
    #clue-photo { height: 90px; width: calc(100% + 32px); margin: 4px -16px; }
    .result-score b { font-size: 2.2rem; }
    .compass svg { width: 56px; height: 56px; }
    #start-title { font-size: 2.2rem; }
    .final b { font-size: 2.7rem; }
    .stats dd { font-size: 1.15rem; }
    #celebrate { top: 30%; }
    #celebrate b { font-size: 3rem; }
    html[lang="bn"] #celebrate b { font-size: 2.8rem; }
}
@media (max-width: 380px) {
    .hud-rank { display: none !important; }
    .hud-cell { padding: 0 5px; }
}
