@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 800; font-display: swap; src: url(fonts/inter-latin-800-normal.woff2) format('woff2'); }

:root {
  --bg: #0A0A0A; --card: #121214; --line: #232327; --field: #18181B; --field-line: #2E2E33;
  --text: #FAFAFA; --muted: #A1A1AA; --faint: #71717A; --accent: #FACC15; --accent-ink: #0A0A0A;
  --good: #22C55E; --bad: #F87171; --radius: 12px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--text); }
button { font: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); gap: 12px; }
.hub { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.hub-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.top nav { display: flex; gap: 18px; align-items: center; }
.top nav a, .navbtn { color: var(--muted); text-decoration: none; font-size: 14px; background: none; border: 0; padding: 0; cursor: pointer; }
.top nav a:hover, .navbtn:hover, .hub:hover { color: var(--accent); }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 30px 0 6px; text-align: center; }
.hero h1 { margin: 0; font-size: clamp(34px, 6vw, 52px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.hero h1 .no { color: var(--accent); }
.lead { margin: 8px auto 0; color: var(--muted); font-size: 16px; max-width: 520px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--field); border: 1px solid var(--field-line); border-radius: 9px; padding: 3px; gap: 3px; margin: 18px auto 0; max-width: 420px; }
.seg button { white-space: nowrap; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

.btn { appearance: none; border: 1px solid var(--field-line); background: var(--field); color: var(--text); border-radius: 8px; padding: 9px 14px; font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { border-color: #4A4A52; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.center { justify-content: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* puzzle bar */
.bar { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; font-size: 14px; color: var(--muted); }
.bar b { color: var(--text); }
.tries { display: flex; gap: 5px; }
.tries i { width: 10px; height: 10px; border-radius: 3px; background: var(--field-line); }
.tries i.used { background: var(--bad); }
.tries i.won { background: var(--good); }

/* clues */
.clues { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.clue { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-height: 92px; display: flex; flex-direction: column; gap: 2px; position: relative; }
.clue .k { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.clue .k .i { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; letter-spacing: 0; }
.clue .v { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.clue .src { font-size: 11px; color: var(--faint); margin-top: auto; }
.clue.locked { background: transparent; border-style: dashed; }
.clue.locked .v { color: var(--faint); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.clue.locked .k .i { background: var(--field-line); color: var(--muted); }
.clue.new { animation: pop .5s ease; border-color: var(--accent); }
.clue.wide { grid-column: 1 / -1; }
.clue.wide .body { display: flex; align-items: center; gap: 16px; }
.sil { width: 120px; height: 90px; border-radius: 6px; overflow: hidden; flex: none; background: var(--field); }
.sil img { width: 100%; height: 100%; display: block; filter: grayscale(1) blur(3px) contrast(1.1); transform: scale(1.08); }
@keyframes pop { 0% { transform: scale(.97); opacity: .4; } 100% { transform: none; opacity: 1; } }

/* input */
.guessbox { position: relative; margin: 14px 0 6px; }
.guessbox input { width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--field-line); border-radius: 10px; padding: 13px 110px 13px 14px; font: inherit; font-size: 16px; outline: none; }
.guessbox input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(250, 204, 21, .18); }
.guessbox .go { position: absolute; right: 6px; top: 6px; bottom: 6px; }
.sugs { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--field-line); border-radius: 10px; list-style: none; margin: 0; padding: 4px; z-index: 20; box-shadow: 0 12px 30px rgba(0,0,0,.5); max-height: 320px; overflow: auto; }
.sugs li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 15px; }
.sugs li img { width: 28px; height: 21px; border-radius: 3px; flex: none; }
.sugs li .al { color: var(--faint); font-size: 13px; }
.sugs li.on { background: var(--field); }
.sugs li.done { opacity: .4; cursor: default; }
.msg { min-height: 20px; font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.msg.warn { color: var(--accent); }

/* guesses */
.guesses { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.g { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 34px; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; animation: pop .35s ease; }
.g img.f { width: 36px; height: 27px; border-radius: 4px; }
.g .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g .cmp { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 1px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--field); border: 1px solid var(--field-line); border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--text); white-space: nowrap; }
.chip.up, .chip.down { border-color: rgba(250, 204, 21, .45); }
.chip.yes { border-color: rgba(34, 197, 94, .5); color: #86EFAC; }
.chip.no { border-color: rgba(248, 113, 113, .45); color: #FCA5A5; }
.g .km { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; text-align: right; white-space: nowrap; }
.g .km small { display: block; font-size: 11px; color: var(--faint); font-weight: 500; }
.arrow { width: 34px; height: 34px; border-radius: 50%; background: var(--field); display: grid; place-items: center; }
.arrow svg { width: 18px; height: 18px; }
.g.win { border-color: var(--good); }
.g.win .arrow { background: rgba(34,197,94,.15); font-size: 17px; }

/* result */
.result { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 16px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.result .flag { width: 220px; max-width: 70%; aspect-ratio: 4 / 3; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.result h2 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.result .verdict { margin: 0; color: var(--muted); }
.result .verdict b { color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; font-size: 12.5px; text-align: left; }
.facts div { background: var(--field); border-radius: 8px; padding: 6px 9px; }
.facts span { display: block; color: var(--faint); font-size: 11px; }
.next { font-size: 13px; color: var(--muted); }
.next b { font-variant-numeric: tabular-nums; color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 9px 16px; border-radius: 999px; z-index: 50; font-size: 14px; }
.cardout { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cardout img { width: 260px; border-radius: 8px; border: 1px solid var(--line); }
label.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* archive */
.arch { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 18px; }
.arch button { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.arch button:hover { border-color: var(--accent); }
.arch b { font-size: 17px; }
.arch span { font-size: 12px; color: var(--faint); }
.arch em { font-style: normal; font-size: 12px; font-weight: 600; }
.arch .won em { color: #86EFAC; } .arch .lost em { color: #FCA5A5; } .arch .play em { color: var(--accent); }

/* dialog */
dialog { background: var(--card); color: var(--text); border: 1px solid var(--field-line); border-radius: 14px; padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog h2 { margin: 0 0 12px; font-size: 20px; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-bottom: 14px; }
.nums b { display: block; font-size: 26px; font-weight: 800; }
.nums span { font-size: 11.5px; color: var(--muted); }
.dist { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.dist div { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; }
.dist i { display: block; background: var(--field-line); color: var(--text); font-style: normal; font-weight: 700; padding: 1px 7px; border-radius: 4px; text-align: right; min-width: 24px; width: max(24px, var(--w)); }
.dist i.hot { background: var(--accent); color: var(--accent-ink); }
.close { position: absolute; right: 14px; top: 12px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }

/* how */
.how { padding: 30px 0 8px; }
.how h2 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 12px; }
.steps { margin: 0 0 22px; padding-left: 22px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.steps b { color: var(--text); }
.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--muted); margin: 8px 0 0; }
.foot { max-width: 720px; margin: 20px auto 0; padding: 22px 20px 40px; color: var(--faint); font-size: 13.5px; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }
.foot p { margin: 4px 0; }

@media (max-width: 560px) {
  .top { padding: 12px 16px; }
  .top nav { gap: 12px; }
  .top nav .hide-sm { display: none; }
  .clue .v { font-size: 19px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g { grid-template-columns: 30px minmax(0, 1fr) auto 30px; gap: 8px; }
  .g img.f { width: 30px; height: 22px; }
  .sil { width: 96px; height: 72px; }
}
.g > div:nth-child(2) { min-width: 0; }
.g .cmp .chip { white-space: normal; line-height: 1.35; padding: 2px 8px; }
.crowd { margin: 0; font-size: 14px; color: var(--text); background: var(--field); border: 1px solid var(--field-line); border-radius: 10px; padding: 8px 12px; }
.crowd b { color: var(--accent); }
