:root {
  --bg: #04050d;
  --panel: rgba(8, 11, 36, 0.92);
  --gold: #ffd23a;
  --gold-line: #ffcf3a;
  --cyan: #3df5ff;
  --ink: #ffffff;
  --muted: #c9cfee;
  --pink: #f0195c;
  --font: "Segoe UI Black", "Arial Black", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--body); overflow: hidden; overscroll-behavior: none; }
#city { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 0; pointer-events: none; }
.logo { pointer-events: auto; display: inline-flex; align-items: center; text-decoration: none; font-family: var(--font); font-weight: 900;
  font-size: clamp(22px, 5vw, 30px); letter-spacing: -0.01em; color: var(--gold); text-shadow: 0 3px 0 #6a4700, 0 0 18px rgba(255, 190, 40, 0.5); }
.moon { width: 1em; height: 1em; fill: var(--gold); margin-right: -0.06em; filter: drop-shadow(0 0 10px rgba(255, 200, 60, 0.6)); }
.counter { pointer-events: auto; text-align: right; padding: 8px 14px 9px; border-radius: 14px; background: var(--panel); border: 2px solid var(--gold-line);
  box-shadow: 0 0 20px rgba(255, 200, 50, 0.25); font-family: var(--font); line-height: 1.1; }
.counter .label { display: block; font-size: 10px; letter-spacing: 0.14em; color: var(--muted); }
.counter .num { font-size: 14px; white-space: nowrap; }
.counter .sub { display: block; margin-top: 3px; font: 700 11px var(--body); color: var(--muted); white-space: nowrap; }
.counter .sub:empty { display: none; }
.counter b { font-size: 24px; color: var(--gold); font-variant-numeric: tabular-nums; }

.search { position: fixed; left: 50%; top: calc(74px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(560px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 999px; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.search svg { width: 22px; height: 22px; flex: none; fill: none; stroke: #111; stroke-width: 2.4; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 600 17px var(--body); color: #111; padding: 10px 0; }
.search input::-webkit-search-cancel-button { display: none; }
.search button { flex: none; border: 0; border-radius: 999px; padding: 11px 20px; background: var(--pink); color: #fff; font: 800 16px var(--body); cursor: pointer; }
.search button:hover { background: #d4124e; }
.search:focus-within { outline: 3px solid var(--cyan); outline-offset: 2px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; border-radius: 18px; background: var(--panel);
  border: 2px solid var(--gold-line); max-height: 46vh; overflow: auto; display: none; }
.suggest.open { display: block; }
.suggest li { padding: 10px 12px; border-radius: 12px; font: 600 16px var(--body); cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.suggest li span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.suggest li[aria-selected="true"], .suggest li:hover { background: rgba(255, 210, 58, 0.16); }
.suggest .none { color: var(--muted); cursor: default; }

.plate { position: fixed; left: 0; top: 0; transform: translate(-50%, -100%); pointer-events: none; text-align: center; padding: 6px 16px 8px; border-radius: 14px;
  background: var(--panel); border: 2px solid var(--gold-line); font-family: var(--font); white-space: nowrap; will-change: transform; }
.tag { font-size: 11px; letter-spacing: 0.14em; color: var(--gold); font-family: var(--font); }
.plate .name { font-size: 20px; }

.card { position: fixed; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(460px, calc(100vw - 32px));
  padding: 16px 18px 18px; border-radius: 20px; background: var(--panel); border: 2px solid var(--gold-line); box-shadow: 0 0 30px rgba(255, 200, 50, 0.2); }
.card h1 { margin: 2px 0 6px; font: 900 clamp(22px, 6vw, 30px) var(--font); overflow-wrap: anywhere; }
.card p { margin: 0 0 14px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.card .row { display: flex; gap: 10px; flex-wrap: wrap; }
.card .close { position: absolute; right: 8px; top: 6px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); font-size: 26px; cursor: pointer; }
.primary, .ghost { flex: 1 1 160px; text-align: center; padding: 12px 14px; border-radius: 999px; font: 800 15px var(--body); cursor: pointer; text-decoration: none; }
.primary { border: 0; background: var(--gold); color: #141414; }
.ghost { border: 2px solid rgba(255, 255, 255, 0.35); background: transparent; color: #fff; }
.paint { margin: 0 0 14px; }
.paint[hidden], .note[hidden] { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sw { width: 34px; height: 34px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.25); cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { outline: 3px solid #fff; outline-offset: 2px; }
.note { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.nick { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding: 0 14px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.06); }
.nick[hidden] { display: none; }
.nick span { color: var(--gold); font: 800 17px var(--body); }
.nick input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font: 600 16px var(--body); padding: 11px 0; }
.nick input::placeholder { color: #8f97c4; }
.nick:focus-within { border-color: var(--cyan); }
.save { display: block; width: 100%; margin-top: 12px; }
.save:disabled { opacity: 0.6; cursor: default; }
.primary.off { background: rgba(255, 255, 255, 0.16); color: var(--muted); cursor: default; }
.row [hidden] { display: none; }
.proof { margin: 0 0 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.proof[hidden], #proofCode[hidden] { display: none; }
.proof .note { margin: 4px 0 10px; }
.wide { display: block; width: 100%; }
.wide[hidden] { display: none; }
.style { margin: -4px 0 14px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 210, 58, 0.07); border: 1px solid rgba(255, 210, 58, 0.3); }
.style[hidden] { display: none; }
.style .note { margin: 4px 0 0; }
.style .wide { margin-top: 10px; }
.code { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  border: 2px dashed var(--gold-line); background: rgba(255, 210, 58, 0.08); color: #fff; font: 800 20px ui-monospace, Consolas, monospace; letter-spacing: 0.06em; cursor: pointer; }
.code span { font: 700 12px var(--body); color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; }
button:disabled { opacity: 0.6; cursor: default; }
.card { max-height: 46vh; overflow: auto; }
@media (min-width: 900px) { .card { left: 24px; bottom: 56px; transform: none; max-height: 72vh; } }
.card[hidden], .plate[hidden], .toast[hidden] { display: none; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 18px; border-radius: 999px;
  background: #fff; color: #111; font: 700 14px var(--body); z-index: 5; }
.foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); text-align: center; font-size: 12.5px; color: var(--muted);
  background: linear-gradient(180deg, rgba(4, 5, 13, 0) 0%, rgba(4, 5, 13, 0.85) 60%); pointer-events: none; }
.foot a { color: var(--gold); pointer-events: auto; }
.foot .sep { margin: 0 6px; opacity: 0.5; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 10; transition: opacity 0.5s; text-align: center; font-family: var(--font); color: var(--gold); }
.loading .moon { width: 72px; height: 72px; animation: bob 1.6s ease-in-out infinite; }
.loading.done { opacity: 0; pointer-events: none; }
@keyframes bob { 50% { transform: translateY(-8px); } }

button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
@media (max-width: 520px) {
  #hint, .foot .sep { display: none; }
  .counter b { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .loading .moon { animation: none; } }
.save[hidden] { display: none; }

.ladder { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.ladder li { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); opacity: 0.75; }
.ladder li.done { opacity: 1; background: rgba(53, 208, 127, 0.13); }
.ladder li.next { opacity: 1; background: rgba(255, 210, 58, 0.14); outline: 1px solid rgba(255, 210, 58, 0.55); }
.ladder .ic { flex: none; width: 28px; text-align: center; font-size: 18px; }
.ladder li.done .ic { color: #35d07f; font-weight: 900; }
.ladder b { display: block; font: 800 13.5px var(--body); color: #fff; }
.ladder small { display: block; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.help { pointer-events: auto; border: 0; background: rgba(255, 210, 58, 0.16); color: var(--gold); font: 800 12.5px var(--body); padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.help:hover { background: rgba(255, 210, 58, 0.28); }
.coffee-btn { margin-left: 6px; background: var(--gold); color: #141414; }
.coffee-btn:hover { background: #ffe07a; }
.ladder li.gold { cursor: pointer; background: linear-gradient(90deg, rgba(255, 210, 58, 0.22), rgba(255, 210, 58, 0.06)); opacity: 1; }
.ladder li.gold.done { background: linear-gradient(90deg, rgba(255, 210, 58, 0.45), rgba(255, 210, 58, 0.15)); }
.wall { margin: 0 0 14px; padding: 10px 12px; border-radius: 14px; border: 1px solid rgba(255, 210, 58, 0.45); background: rgba(255, 210, 58, 0.06); }
.wall[hidden] { display: none; }
.wall .tag span { color: var(--muted); margin-left: 6px; }
.wall ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; }
.wall li button { border: 0; border-radius: 999px; padding: 6px 11px; background: rgba(255, 210, 58, 0.18); color: #fff; font: 700 13px var(--body); cursor: pointer; }
.wall li button:disabled { cursor: default; opacity: 0.7; }
.wall .note { margin: 8px 0 0; }
.wide[hidden], .style .wide[hidden] { display: none; }
