:root {
  --ink: #0B1626; --ink2: #13233A; --line: #24384F; --par: #F2EBDD; --mist: #9FB0C6; --brass: #C8A262; --verm: #E2643B;
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--par); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
a { color: var(--brass); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { position: relative; max-width: 480px; min-height: 100%; margin: 0 auto; overflow: hidden; }
.screen { position: relative; min-height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.screen.fixed { height: 100dvh; overflow: hidden; }
.pad { padding: 0 20px; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* type */
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--mist); }
.eyebrow.brass { color: var(--brass); }
.serif { font-family: var(--serif); }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 600; }
.display { font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1.05; letter-spacing: -.01em; margin: 0; }
.display em, .wordmark em { font-style: italic; color: var(--brass); font-weight: 500; }
.muted { color: var(--mist); }
.num { font-variant-numeric: tabular-nums; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; position: relative; z-index: 3; }
.wordmark { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; }
.chip { height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; background: rgba(11,22,38,.6); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: rgba(11,22,38,.6); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; flex-shrink: 0; }
.icon-btn svg, .btn svg, .chip svg { flex-shrink: 0; }
.progress { display: flex; gap: 4px; width: 132px; }
.progress i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.progress i.done { background: var(--brass); } .progress i.cur { background: var(--par); }
.round-meta { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; color: var(--mist); }
.score-mini { width: 44px; text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* buttons */
.btn { height: 56px; width: 100%; border-radius: 16px; border: none; background: var(--brass); color: var(--ink); font-size: 16px; font-weight: 600; letter-spacing: .01em; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--par); border: 1px solid var(--line); height: 52px; font-weight: 500; font-size: 15px; }
.btn.soft { background: var(--ink2); color: var(--par); border: 1px solid var(--line); height: 52px; justify-content: flex-start; padding: 0 16px; font-weight: 500; font-size: 15px; }
.btn.soft .grow { flex: 1; text-align: left; } .btn.soft small { font-size: 13px; color: var(--mist); font-weight: 400; }
.btn.small { height: 40px; width: auto; padding: 0 14px; border-radius: 20px; font-size: 13px; }
.link { background: none; border: none; color: var(--par); padding: 0; cursor: pointer; text-decoration: none; display: flex; align-items: center; gap: 12px; min-height: 44px; width: 100%; text-align: left; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* cards */
.card { background: var(--ink2); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.dd-tag { display: inline-flex; align-items: center; justify-content: center; height: 26px; padding: 0 10px; border-radius: 13px; background: rgba(200,162,98,.16); border: 1px solid rgba(200,162,98,.6); color: var(--brass); font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.hint-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; border: 1px solid var(--line); color: var(--mist); font-size: 11px; font-weight: 600; white-space: nowrap; }
.sponsor-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mist); }

/* globe */
.globe-wrap { position: relative; }
.globe-wrap canvas, .map-full canvas { display: block; width: 100%; height: 100%; }
.fade-top { position: absolute; left: 0; right: 0; top: 0; height: 120px; background: linear-gradient(180deg, var(--ink), rgba(11,22,38,0)); pointer-events: none; }
.fade-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 100px; background: linear-gradient(0deg, var(--ink), rgba(11,22,38,0)); pointer-events: none; }
.map-full { position: absolute; inset: 0; }
.zoom { position: absolute; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 3; }

/* bottom sheet */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; background: var(--ink); border-top: 1px solid var(--line); border-radius: 26px 26px 0 0; padding: 12px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; }
.place { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.place h1 { font-size: 40px; line-height: 1; }
.place.long h1 { font-size: 30px; line-height: 1.08; }
.place span { font-size: 16px; color: var(--mist); }
.hint-box { background: rgba(200,162,98,.08); border: 1px solid rgba(200,162,98,.45); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.hint-box p { margin: 0; font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.3; }
.hint-box .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sub-btn { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink); display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer; font-size: 14px; font-weight: 500; width: 100%; }
.sub-btn .grow { flex: 1; text-align: left; } .sub-btn small { font-size: 12px; color: var(--mist); }

/* tab bar */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 10; height: calc(72px + var(--safe-b)); padding: 6px 12px var(--safe-b); display: flex; background: rgba(11,22,38,.94); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: none; color: var(--mist); font-size: 11px; font-weight: 500; cursor: pointer; min-height: 52px; }
.tabbar button[aria-current="page"] { color: var(--brass); }
.with-tabs { padding-bottom: calc(96px + var(--safe-b)); }

/* round intro */
.numeral { font-family: var(--serif); font-size: 120px; font-weight: 500; line-height: .9; }
.meter { display: flex; gap: 6px; } .meter i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); } .meter i.on { background: var(--brass); }

/* lists */
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row-item { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--ink2); }
.row-item.me { border-color: rgba(200,162,98,.6); background: rgba(200,162,98,.10); }
.row-item.pending { background: transparent; border-style: dashed; }
.rank { width: 22px; font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--mist); }
.rank.first { color: var(--brass); }
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--par); color: var(--ink); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.me { background: var(--brass); }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.grow { flex: 1 1 auto; min-width: 0; }
.name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub { font-size: 12px; color: var(--mist); display: flex; align-items: center; gap: 4px; }

.segment { margin: 20px 20px 0; padding: 4px; border-radius: 16px; background: var(--ink2); border: 1px solid var(--line); display: flex; gap: 4px; }
.segment button { flex: 1; height: 40px; border: none; border-radius: 12px; background: transparent; color: var(--mist); font-size: 14px; font-weight: 600; cursor: pointer; }
.segment button[aria-pressed="true"] { background: var(--par); color: var(--ink); }
.pills { display: flex; justify-content: space-between; gap: 6px; }
.pills button { width: 48px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: transparent; font-family: var(--serif); font-size: 17px; font-weight: 600; cursor: pointer; padding: 0; }
.pills button[aria-pressed="true"] { background: var(--par); color: var(--ink); border-color: var(--par); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--ink2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; }
.stat span { font-size: 12px; color: var(--mist); }

/* results */
.round-card { background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; gap: 14px; }
.round-card .n { width: 40px; flex-shrink: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--brass); padding-top: 2px; }
.round-card h3 { font-size: 21px; line-height: 1.15; }
.fact { margin: 0; font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.4; color: #D9D1C2; }
.big-score { font-family: var(--serif); font-size: 84px; font-weight: 600; line-height: .95; }

/* forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; color: var(--mist); }
.field input { height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--ink2); padding: 0 16px; font-size: 17px; }
.field input:focus { outline: none; border-color: var(--brass); }
.code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 22px; letter-spacing: .12em; text-align: center; padding: 16px; border-radius: 16px; border: 1px dashed rgba(200,162,98,.6); background: rgba(200,162,98,.06); color: var(--par); user-select: all; }

/* sponsor (premium, editorial) */
.sponsor-slot { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--ink2); }
.sponsor-slot .art { height: 120px; background-size: cover; background-position: center; }
.sponsor-slot .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.explore { position: fixed; inset: 0; z-index: 50; background: var(--ink); display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
.explore .hero { position: relative; height: 46vh; min-height: 280px; background: #13233A center/cover no-repeat; }
.explore .hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,22,38,.15) 0%, rgba(11,22,38,0) 40%, var(--ink) 100%); }
.explore .hero.plain { background: radial-gradient(120% 90% at 30% 20%, #1E3A5F 0%, #11243D 60%, var(--ink) 100%); }
.explore .close { position: absolute; top: calc(16px + var(--safe-t)); right: 16px; z-index: 2; }
.explore .content { padding: 0 24px calc(28px + var(--safe-b)); margin-top: -40px; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; flex: 1; overflow-y: auto; }
.explore h2 { font-size: 40px; line-height: 1.05; font-weight: 500; }
.explore p { margin: 0; font-size: 16px; line-height: 1.55; color: #D9D1C2; }
.explore .presented { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--mist); }
.explore .rule { height: 1px; background: var(--line); margin: 4px 0; }
.explore .fine { font-size: 12px; color: var(--mist); line-height: 1.5; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* toast & loading */
.toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%); z-index: 60; background: var(--par); color: var(--ink); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; max-width: 90%; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.center { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; text-align: center; padding: 24px; }
.spin { animation: turn 3s linear infinite; } @keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin, .explore { animation: none; } }
.rows.pad { padding-left: 20px; padding-right: 20px; }
