:root {
  --bg: #0b1020; --bg-2: #141c37; --bg-3: #1f2a4f; --ink: #f2f4ff; --muted: #98a3c7; --line: rgba(255, 255, 255, 0.1);
  --gold: #f5c542; --green: #2fbf71; --red: #3a4566; --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: radial-gradient(700px 380px at 50% -12%, rgba(245, 197, 66, 0.12), transparent 70%), var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.err { color: #ff7a85; text-align: center; padding: 40px 16px; }

.bar { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(11, 16, 32, 0.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.brand { justify-self: center; text-decoration: none; color: var(--ink); font: 800 26px/1 var(--display); letter-spacing: 0.04em; white-space: nowrap; }
.brand em, .drawer-head em { font-style: normal; color: var(--gold); }
.ic { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); font-size: 18px; display: grid; place-items: center; }

main { max-width: 520px; margin: 0 auto; padding: 14px 12px 24px; }
.practice { text-align: center; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--gold); font-weight: 700; text-decoration: underline; }

.art { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: #d9dbe3; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; }
.tiles { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 3px; background: transparent; }
.tile { background: #d9dbe3; box-shadow: 0 0 0 1.5px #1a2140; transition: opacity 0.5s, transform 0.5s; }
.tile.off { opacity: 0; }
.tile.flip { animation: flip 0.6s ease-in forwards; }
@keyframes flip { 0% { opacity: 1; transform: rotateY(0); } 60% { opacity: 1; transform: rotateY(90deg); } 100% { opacity: 0; transform: rotateY(90deg); } }
.art.done { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 3px var(--gold); }
.hint { text-align: center; margin: 12px 0; color: #dfe4f7; }

.ask { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }
.field { position: relative; }
.field input { width: 100%; font: 600 18px system-ui, sans-serif; color: var(--ink); background: var(--bg-2); border: 2px solid #2fbf71; border-radius: 14px; padding: 12px 14px; }
.field input:focus { outline: none; box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.3); }
.sugg { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--line); box-shadow: 0 16px 30px rgba(0, 0, 0, 0.5); max-height: 320px; overflow: auto; }
.sugg li { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.sugg li.on, .sugg li:hover { background: rgba(255, 255, 255, 0.08); }
.sugg small { margin-left: auto; color: var(--muted); }
.go { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 14px; padding: 12px 18px; font: 800 18px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; color: #062012; background: linear-gradient(180deg, #d4f25c, #2fbf71); box-shadow: 0 8px 20px rgba(47, 191, 113, 0.25); }
.go.alt { color: #1a1100; background: linear-gradient(180deg, #ffd766, var(--gold) 55%, #e3ad2b); box-shadow: 0 8px 20px rgba(245, 197, 66, 0.25); }

.legend-row, .row { display: grid; grid-template-columns: 1.7fr 1.1fr 0.8fr 0.75fr 0.75fr; gap: 4px; }
.legend-row { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 0 2px 4px; }
.legend-row span { text-align: center; } .legend-row span:first-child { text-align: left; padding-left: 8px; }
.rows { display: grid; gap: 6px; }
.row { min-height: 44px; }
.row.empty { border: 2px dashed rgba(255, 255, 255, 0.12); border-radius: 12px; background: rgba(255, 255, 255, 0.02); }
.cell { display: flex; align-items: center; justify-content: center; gap: 5px; border-radius: 10px; padding: 6px; font: 800 17px/1 var(--display); background: var(--red); border: 2px solid transparent; min-width: 0; }
.cell.ok { background: var(--green); color: #04200f; }
.cell.name { justify-content: flex-start; padding-left: 10px; background: var(--bg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; }
.cell.name.ok { background: var(--green); }
.cell i { font-style: normal; font-size: 15px; }
.cell .flag { width: 30px; height: 20px; border-radius: 3px; }
.cell b { font-size: 15px; }
.row.fresh .cell { animation: pop 0.35s ease-out both; }
.row.fresh .cell:nth-child(2) { animation-delay: 0.08s; } .row.fresh .cell:nth-child(3) { animation-delay: 0.16s; } .row.fresh .cell:nth-child(4) { animation-delay: 0.24s; } .row.fresh .cell:nth-child(5) { animation-delay: 0.32s; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.badge { width: 16px; height: 16px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--c1) 50%, var(--c2) 50%); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.35); display: inline-block; vertical-align: middle; }
.counter { text-align: center; font: 800 16px/1 var(--display); letter-spacing: 0.12em; color: var(--muted); margin: 12px 0 0; }

.result { margin-top: 16px; padding: 18px; border-radius: 20px; text-align: center; background: linear-gradient(180deg, var(--bg-2), #0e1530); border: 1px solid var(--line); animation: pop 0.4s ease-out; }
.result.won { border-color: rgba(47, 191, 113, 0.6); box-shadow: 0 0 40px rgba(47, 191, 113, 0.15); }
.result h2 { margin: 0 0 4px; font: 800 32px/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.result .who { margin: 6px 0 0; font-size: 18px; }
.result .who b { color: var(--gold); }
.result .fd-stars { margin: 14px auto 0; max-width: 420px; padding: 10px 14px; border-radius: 12px; background: rgba(245, 197, 66, 0.12); border: 1px solid rgba(245, 197, 66, 0.4); font-size: 14px; }
.result .fd-stars a { color: var(--gold); font-weight: 700; }
.result .title { margin: 2px 0 6px; font-weight: 700; color: #dfe4f7; }
.result .meta { margin: 0 0 14px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; }
.result .meta .flag { width: 21px; height: 14px; border-radius: 2px; }
.cta { display: grid; gap: 8px; }
.next { margin: 14px 0 6px; color: var(--muted); }
.next b { color: var(--ink); font-family: var(--display); font-size: 20px; letter-spacing: 0.04em; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 12px 30px; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }

.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(3, 6, 16, 0.6); }
.drawer[hidden] { display: none; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 88vw); background: var(--bg-2); border-left: 1px solid var(--line); padding: 14px; overflow: auto; animation: slide 0.2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; font: 800 22px/1 var(--display); letter-spacing: 0.04em; }
.drawer-sub { margin: 4px 0 8px; color: var(--muted); font-size: 13px; }
.drawer h3 { margin: 16px 0 6px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.mi { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 12px; border: 0; background: none; text-align: left; text-decoration: none; color: var(--ink); font-weight: 700; }
.mi:hover { background: rgba(255, 255, 255, 0.06); }
.mi span { display: grid; }
.mi small { color: var(--muted); font-weight: 500; font-size: 12px; }

.back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 16, 0.75); }
.modal { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; border-radius: 20px; background: var(--bg-2); border: 1px solid var(--line); }
.modal h2 { margin: 0 0 10px; font: 800 28px/1 var(--display); text-transform: uppercase; }
.modal h3 { margin: 16px 0 8px; font: 800 18px/1 var(--display); text-transform: uppercase; color: var(--muted); }
.modal .x { position: absolute; top: 12px; right: 12px; }
.how { padding-left: 18px; }
.how-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; font-size: 14px; }
.how-row .cell { width: 44px; height: 32px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpis div { display: grid; text-align: center; padding: 10px 4px; border-radius: 12px; background: var(--bg); }
.kpis b { font: 800 28px/1 var(--display); }
.kpis span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.dist { display: grid; gap: 4px; }
.dist div { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; font-weight: 800; }
.dist i { font-style: normal; display: block; text-align: right; padding: 3px 8px; border-radius: 6px; background: var(--green); color: #04200f; }
.ta { width: 100%; font: 14px ui-monospace, monospace; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 800; }
.toast[hidden] { display: none; }

@media (max-width: 420px) {
  .brand { font-size: 22px; }
  .legend-row, .row { grid-template-columns: 1.5fr 1fr 0.75fr 0.7fr 0.7fr; gap: 3px; }
  .cell { font-size: 15px; padding: 5px 3px; }
  .cell.name { font-size: 16px; padding-left: 7px; }
  .cell b { font-size: 13px; }
  .cell .flag { width: 24px; height: 16px; }
  .badge { width: 13px; height: 13px; }
}
@media (prefers-reduced-motion: reduce) { .tile, .tile.flip, .row.fresh .cell, .result, .drawer-panel { animation: none; transition: none; } }

/* ad under the result (app.js AD_SLOT): hidden until Google fills it */
.ad { margin: 16px 0 0; text-align: center; }
.ad span { display: none; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ad:has(ins[data-ad-status="filled"]) span { display: block; margin-bottom: 4px; }
.ad ins[data-ad-status="unfilled"] { display: none !important; }
