@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #FBF6EE;
  --card: #FFFFFF;
  --ink: #2A2522;
  --ink-2: #6E645B;
  --line: #EDE4D6;
  --accent: #E2522F;
  --accent-d: #B83D1F;
  --gold: #F2B705;
}

* { 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: 540px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 40px; }

.top { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.logo { font-family: 'Fraunces', Georgia, serif; font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.num { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.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); }

.question { text-align: center; margin: 6px 0 4px; }
.q-emoji { font-size: 44px; line-height: 1.1; }
.q-text { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; margin: 4px 0 4px; }
.q-text b { color: var(--accent); font-weight: 800; }
.q-sub { margin: 0; color: var(--ink-2); font-size: 14px; }

.globe-wrap { position: relative; margin: 8px auto 4px; width: 100%; max-width: 440px; aspect-ratio: 1; }
#globe { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#globe:active { cursor: grabbing; }
.legend { position: absolute; right: 2px; bottom: 6px; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--ink-2); background: rgba(251, 246, 238, 0.85); padding: 3px 8px; border-radius: 999px; }
.legend i { width: 70px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #CFE0EE, #9EC2DE, #F3D58C, #F09A4E, #E2522F, #9E1C10); }

.guess-box { position: relative; margin-top: 6px; }
#guess { width: 100%; height: 54px; padding: 0 18px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); font-size: 17px; font-weight: 500; outline: none; box-shadow: 0 2px 10px rgba(80, 60, 30, 0.06); }
#guess:focus { border-color: var(--accent); }
#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(80, 60, 30, 0.15); }
#suggest li { padding: 11px 12px; border-radius: 10px; font-weight: 500; }
#suggest li.on { background: #FCEDE6; }
#suggest li.used { color: var(--ink-2); text-decoration: line-through; }
#suggest[hidden] { display: none; }

.hint-btn { display: block; margin: 10px auto 0; border: 0; background: none; color: var(--accent-d); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.hint-btn[hidden], .hint-text[hidden] { display: none; }
.hint-text { text-align: center; margin: 10px 0 0; font-weight: 600; }

.list-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 18px; }
.list-head span { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.list-title { margin: 18px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.list-head .list-title { margin: 0 0 8px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rows li { display: grid; grid-template-columns: 18px 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border-radius: 12px; border: 1px solid var(--line); }
.rows li.new { animation: pop 0.45s ease; border-color: var(--ink); }
.top10 li { grid-template-columns: 20px 18px 1fr auto; }
.chip { width: 18px; height: 18px; border-radius: 6px; }
.gname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gval { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.grank { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.trank { font-weight: 700; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }

#done[hidden], #play[hidden] { display: none; }
.done-card { margin-top: 10px; padding: 18px; background: var(--card); border-radius: 20px; border: 1px solid var(--line); text-align: center; box-shadow: 0 6px 24px rgba(80, 60, 30, 0.08); }
.done-card h2 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 30px; font-weight: 800; }
.fact { margin: 8px 0 4px; font-size: 16px; line-height: 1.45; }
.score { margin: 0 0 14px; color: var(--ink-2); font-weight: 600; }
.btn { display: block; width: 100%; height: 52px; border: 0; border-radius: 16px; font-weight: 700; font-size: 17px; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:active { transform: translateY(1px); }
.stats { display: flex; justify-content: center; gap: 26px; margin: 14px 0 6px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 22px; }
.stats span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.next { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }

.source { margin: 22px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.45; text-align: center; }

.sheet { border: 0; border-radius: 22px; padding: 22px 22px 18px; max-width: 420px; width: calc(100% - 32px); color: var(--ink); background: var(--card); box-shadow: 0 20px 60px rgba(40, 30, 20, 0.25); }
.sheet::backdrop { background: rgba(42, 37, 34, 0.45); }
.sheet h2 { margin: 0 0 10px; font-family: 'Fraunces', Georgia, serif; font-size: 26px; }
.sheet ul { padding-left: 18px; margin: 0 0 12px; line-height: 1.5; }
.sheet li { margin-bottom: 8px; }
.sheet .small { font-size: 13px; color: var(--ink-2); line-height: 1.45; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 10px); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: 0.25s; z-index: 20; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@keyframes pop { 0% { transform: scale(0.96); } 60% { transform: scale(1.02); } 100% { transform: none; } }

.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 14px; font-size: 13px; }
.foot a { color: var(--ink-2); text-decoration: none; padding: 4px 0; }
.foot a:hover { color: var(--ink); }

.actions { display: flex; gap: 2px; }
.btn.soft { display: flex; align-items: center; justify-content: center; margin-top: 8px; background: #F3ECE1; color: var(--ink); text-decoration: none; }
.btn.soft[hidden] { display: none; }

/* sister games: one quiet card each */
.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: #D9CDBB; }
.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; }
.res-banner { display: inline-block; width: 320px; height: 100px; }
.ad-rail { position: fixed; top: 50%; left: calc(50% + 300px); transform: translateY(-50%); z-index: 1; }
.ad-rail[hidden] { display: none; }
.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; }

/* archive */
.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: 44px 30px 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: #FCF4EA; }
.archive-list .anum { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.archive-list .aemoji { font-size: 22px; }
.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: #2E8B57; }
.archive-list .today { border-color: var(--ink); }
.num .tag { margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: #F3ECE1; font-size: 12px; }
.ad-slot.pending { height: 0; margin: 0; overflow: hidden; }

/* region rounds: a clear label over the question, faded suggestions outside the region */
.round { display: inline-block; margin: 0 0 6px; padding: 5px 12px; border-radius: 999px; background: #FCEDE6; color: var(--ink); font-size: 13px; }
.round[hidden] { display: none; }
.round b { color: var(--accent); }
#suggest li.out { color: var(--ink-2); }
#suggest li.out small { margin-left: 8px; font-size: 12px; }
.archive-list .aname i { font-style: normal; color: var(--accent); font-weight: 600; }
