@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #F6F3EC;
  --card: #FFFFFF;
  --ink: #1F2421;
  --ink-2: #5F665F;
  --line: #E3DED2;
  --sign: #0B5D3B;      /* highway sign green */
  --sign-d: #08472D;
  --lane: #F4B400;      /* lane-line yellow */
  --tape: #EADFC1;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }

.app { max-width: 560px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 40px; }

.top { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { background: var(--sign); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: 0.08em; white-space: nowrap; padding: 6px 11px; border-radius: 7px; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--sign); }
.num { font-weight: 700; color: var(--ink-2); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.num .tag { padding: 2px 7px; border-radius: 999px; background: #E7E1D4; font-size: 12px; }
.actions { display: flex; gap: 2px; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); display: grid; place-items: center; }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:hover { background: var(--line); }

.prompt { text-align: center; font-size: 18px; font-weight: 700; line-height: 1.3; margin: 10px 0 12px; }

/* the plate, zoomed in on a detail; each wrong guess zooms out */
.viewer { position: relative; width: 100%; aspect-ratio: 2 / 1; overflow: hidden; border-radius: 14px; background: #ddd; box-shadow: 0 10px 28px rgba(30, 30, 20, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05); }
#plate, .tapes { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; transition: transform 0.9s cubic-bezier(0.22, 0.8, 0.25, 1); }
#plate { object-fit: fill; user-select: none; -webkit-user-drag: none; }
.tapes { pointer-events: none; }
.tapes i { position: absolute; background: linear-gradient(180deg, #EFE6CC, var(--tape) 45%, #E2D5B2); box-shadow: 1px 2px 4px rgba(40, 30, 10, 0.3); transform-origin: 0% 50%; }
.tapes i.peel { animation: peel 0.9s cubic-bezier(0.5, 0, 0.6, 1) forwards; }
@keyframes peel {
  0% { transform: rotate(var(--r)) translate(0, 0); opacity: 1; }
  35% { transform: rotate(calc(var(--r) - 6deg)) translate(4%, -8%) scaleX(0.96); opacity: 1; }
  100% { transform: rotate(-28deg) translate(60%, -160%) scaleX(0.8); opacity: 0; }
}

.tries { display: flex; justify-content: center; gap: 8px; margin: 14px 0 10px; }
.tries span { width: 34px; height: 8px; border-radius: 4px; background: var(--line); }
.tries span.used { background: var(--ink-2); }
.tries span.win { background: var(--sign); }

.guess-box { position: relative; }
#guess { width: 100%; height: 54px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); padding: 0 16px; font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); outline: none; }
#guess:focus { border-color: var(--sign); }
#suggest { position: absolute; left: 0; right: 0; top: 58px; z-index: 5; list-style: none; margin: 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 30px rgba(30, 30, 20, 0.15); }
#suggest li { padding: 11px 12px; border-radius: 10px; font-weight: 600; }
#suggest li.on { background: #E7F2EC; }
#suggest li.used { color: var(--ink-2); text-decoration: line-through; }
#suggest[hidden] { display: none; }
.hint-line { text-align: center; color: var(--ink-2); font-size: 13px; margin: 10px 0 0; }

.guesses { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
.guesses li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 600; }
.guesses li.new { animation: pop 0.35s ease; }
.guesses .dist { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.guesses .dir { font-size: 18px; width: 24px; text-align: center; }
.guesses li.right { background: #E7F2EC; border-color: #B9DCC8; }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

.map-wrap { margin: 16px 0 0; }
#map { width: 100%; height: auto; display: block; }
#map path.state { fill: #E6E0D2; stroke: #fff; stroke-width: 1; transition: fill 0.5s; }

#done { margin-top: 4px; }
.done-card { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 18px; }
.done-title { font-size: 30px; font-weight: 800; margin: 2px 0 2px; letter-spacing: -0.01em; }
.done-sub { color: var(--ink-2); margin: 0 0 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 50px; padding: 0 28px; border-radius: 999px; border: 0; background: var(--sign); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; }
.btn:hover { background: var(--sign-d); }
.btn.soft { display: flex; width: 100%; height: 46px; margin-top: 8px; background: #EFEBE1; color: var(--ink); }
.btn.soft:hover { background: #E6E0D2; }
.btn.soft[hidden] { display: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0 6px; }
.stats div { display: grid; }
.stats b { font-size: 24px; }
.stats span { font-size: 12px; color: var(--ink-2); }
.dist { display: grid; gap: 4px; margin: 10px 0 4px; text-align: left; }
.dist div { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.dist i { display: block; height: 18px; min-width: 22px; border-radius: 5px; background: #D9D3C6; color: var(--ink); font-style: normal; font-size: 12px; text-align: right; padding: 1px 6px; }
.dist i.me { background: var(--sign); color: #fff; }
.next { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; margin: 12px 0 4px; }

.list-title { margin: 22px 0 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.xpromo { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; padding: 10px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.xpromo:hover { border-color: #CFC7B6; }
.xpromo img { width: 40px; height: 40px; flex: none; border-radius: 10px; }
.xpromo span { flex: 1; min-width: 0; }
.xpromo small { display: block; margin-bottom: 2px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.xpromo b { display: block; font-size: 15px; line-height: 1.3; }
.xpromo svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }

/* ads: invisible until Google fills them, gone when it does not */
.ad-slot { width: 100%; margin: 14px 0 4px; text-align: center; }
.ad-slot[hidden] { display: none; }
.ad-slot.pending { height: 0; margin: 0; overflow: hidden; }
.res-banner { display: inline-block; width: 320px; height: 100px; }
.ad-rail { position: fixed; top: 50%; left: calc(50% + 310px); transform: translateY(-50%); z-index: 1; }
.ad-rail[hidden] { display: none; }
.ad-rail.pending { visibility: hidden; }
.rail-ins { display: inline-block; width: 160px; height: 600px; }
@media (min-width: 1280px) { .rail-ins { width: 300px; } }
@media (max-width: 999px), (max-height: 659px) { .ad-rail { display: none !important; } }
.ad-slot ins, .ad-rail ins { opacity: 0; transition: opacity 0.3s ease; }
.ad-slot ins[data-ad-status='filled'], .ad-rail ins[data-ad-status='filled'] { opacity: 1; }
.ad-slot ins[data-ad-status='unfilled'], .ad-rail ins[data-ad-status='unfilled'] { display: none !important; }

.credit { color: var(--ink-2); font-size: 12px; text-align: center; margin-top: 18px; }
.credit a { color: inherit; }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--ink); }

.sheet { border: 0; border-radius: 20px; padding: 22px; max-width: 420px; width: calc(100% - 32px); color: var(--ink); }
.sheet::backdrop { background: rgba(20, 25, 20, 0.45); }
.sheet h2 { margin: 0 0 8px; }
.sheet ul { padding-left: 18px; line-height: 1.5; }
.small { color: var(--ink-2); font-size: 13px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; }
.archive-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: min(60vh, 520px); overflow-y: auto; display: grid; gap: 6px; }
.archive-list a { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.archive-list a:hover { background: #F3EFE6; }
.archive-list .anum { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.archive-list .aname { font-weight: 600; }
.archive-list .aname small { display: block; font-weight: 500; color: var(--ink-2); font-size: 12px; }
.archive-list .astate { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.archive-list .astate.won { color: var(--sign); }
.archive-list .astate.lost { color: #B23A2A; }
.archive-list .today { border-color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; transition: 0.25s; pointer-events: none; z-index: 20; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
