/* Globeplop. A full-screen globe printed like a risograph poster: flat, loud inks, a slightly
   off-register shadow under the land, and grain. Each pin uses a different ink set. */

:root, body[data-ink="riso"] {
  --space: #2b4bff; --sea: #2b4bff; --land: #ffd23f; --land2: #ff4b3e; --line: #111; --grid: rgba(255,255,255,.22);
  --panel: #fff6e0; --ink: #111; --soft: #4b4b4b; --accent: #ff4b3e; --pop: #2b4bff;
}
body[data-ink="mint"] { --space: #00a19a; --sea: #00a19a; --land: #fff1d0; --land2: #ff7a2f; --grid: rgba(255,255,255,.25); --panel: #fff1d0; --accent: #ff5a1f; --pop: #007f79; }
body[data-ink="night"] { --space: #0f1438; --sea: #18205a; --land: #39d98a; --land2: #ff5fa2; --line: #0a0d24; --grid: rgba(255,255,255,.12); --panel: #fdf3ff; --accent: #ff3d8b; --pop: #18205a; }
body[data-ink="bubble"] { --space: #ff86b0; --sea: #ff86b0; --land: #fff5a8; --land2: #5b2bff; --grid: rgba(255,255,255,.3); --panel: #fff5f8; --accent: #5b2bff; --pop: #e23a7c; }
body[data-ink="desert"] { --space: #0e8f84; --sea: #12a397; --land: #f6a85c; --land2: #8b2fc9; --grid: rgba(255,255,255,.22); --panel: #fff4e6; --accent: #c2185b; --pop: #0e8f84; }
body[data-ink="lava"] { --space: #1a1a1a; --sea: #1f2a2e; --land: #ff7b29; --land2: #ffe14d; --line: #000; --grid: rgba(255,255,255,.1); --panel: #fff3e8; --accent: #ff4d00; --pop: #1f2a2e; }
body[data-ink="ice"] { --space: #9fd3ff; --sea: #9fd3ff; --land: #ffffff; --land2: #2b4bff; --grid: rgba(17,17,17,.12); --panel: #ffffff; --accent: #ff3b30; --pop: #2b4bff; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--space); color: var(--ink); font-family: "Work Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; transition: background-color .8s ease; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
.display, .brand, .ask, .plop-btn, .go-btn, .r-num, .landing .pts b, .landing .nm { font-family: "Bowlby One", "Work Sans", sans-serif; font-weight: 400; }

/* ---------- The globe fills the whole screen ---------- */
.globe { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; cursor: grab; }
.marks { position: fixed; inset: 0; width: 100vw; height: 100dvh; pointer-events: none; overflow: visible; }
.globe:active { cursor: grabbing; }
.marks .ring { fill: none; stroke: #fff; stroke-width: 2; }
.marks .ring.pulse { animation: ring 2.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ring { 0% { opacity: .95; transform: scale(.4); } 100% { opacity: 0; transform: scale(2.6); } }
.marks .pin { fill: var(--accent); stroke: var(--line); stroke-width: 2; }
.marks .pin-eye { fill: #fff; stroke: var(--line); stroke-width: 1.2; }
.marks .arc { fill: none; stroke: #fff; stroke-width: 3; stroke-dasharray: 7 5; stroke-linecap: round; }
.marks .arc-under { fill: none; stroke: var(--line); stroke-width: 5.5; stroke-linecap: round; opacity: .55; }
.marks .ans { fill: #fff; stroke: var(--line); stroke-width: 2.4; }
.marks .splash { fill: none; stroke: #fff; stroke-width: 2.5; }
.marks .ans-label { font-family: "Bowlby One", sans-serif; font-size: 15px; fill: #fff; paint-order: stroke; stroke: var(--line); stroke-width: 4px; stroke-linejoin: round; }

.grain { position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"); }

/* ---------- Top bar floats over the globe ---------- */
.top { position: fixed; z-index: 5; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { font-size: 22px; color: #fff; letter-spacing: .01em; -webkit-text-stroke: 1.5px var(--line); paint-order: stroke fill; text-shadow: 2px 2px 0 var(--line); flex: 1; }
.pips { display: flex; gap: 5px; padding: 6px 8px; background: var(--panel); border: 2px solid var(--line); border-radius: 99px; }
.pips i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); }
.pips i.now { background: var(--accent); }
.pips i.done { background: var(--line); }
.pips i.final { border-radius: 2px; transform: rotate(45deg) scale(.88); }
.ic { width: 36px; height: 36px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line); font-weight: 800; box-shadow: 2px 2px 0 var(--line); }
.ic.off { opacity: .55; text-decoration: line-through; }
.recenter { position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); top: calc(max(10px, env(safe-area-inset-top)) + 50px);
  padding: 7px 14px; background: var(--panel); border: 2px solid var(--line); border-radius: 99px; font-weight: 800; font-size: 14px; box-shadow: 2px 2px 0 var(--line); }

/* ---------- Bottom panel covers the bottom of the globe ---------- */
.panel {
  position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  background: var(--panel); border: 2.5px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0;
  padding: 14px 16px max(14px, env(safe-area-inset-bottom)); box-shadow: 0 -4px 0 var(--line);
  transition: background-color .8s ease;
}
.kicker { margin: 0; font-size: 12.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.ask { margin: 2px 0 10px; font-size: clamp(22px, 6.4vw, 30px); line-height: 1.05; color: var(--ink); }
.panel.swap { animation: swapin .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes swapin { from { transform: translateY(30px); } }

.field { display: flex; gap: 8px; align-items: center; }
.field input {
  flex: 1; min-width: 0; font: inherit; font-size: 19px; font-weight: 600; color: var(--ink); background: #fff;
  border: 2.5px solid var(--line); border-radius: 14px; padding: 10px 12px; outline: none; box-shadow: inset 0 2px 0 rgba(0,0,0,.06);
}
.field input:focus { border-color: var(--pop); }
.field input:disabled { opacity: .55; }
.plop-btn { flex: none; padding: 11px 16px 10px; background: var(--accent); color: #fff; font-size: 18px; border: 2.5px solid var(--line); border-radius: 14px; box-shadow: 3px 3px 0 var(--line); letter-spacing: .02em; }
.plop-btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.plop-btn:disabled { opacity: .5; }
.clock { position: relative; width: 46px; height: 46px; flex: none; }
.clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock-bg { fill: #fff; stroke: var(--line); stroke-width: 2.5; }
.clock-fg { fill: none; stroke: var(--pop); stroke-width: 5; stroke-dasharray: 119.4; stroke-dashoffset: 0; stroke-linecap: round; }
.clock b { position: absolute; inset: 0; display: grid; place-items: center; font-family: "Bowlby One", sans-serif; font-weight: 400; font-size: 16px; font-variant-numeric: tabular-nums; }
.clock.hurry .clock-fg { stroke: var(--accent); }
.clock.hurry b { color: var(--accent); animation: thump 1s ease infinite; }
@keyframes thump { 10% { transform: scale(1.18); } 30% { transform: none; } }
.clock.paused { opacity: .5; }

.dym { margin: 0 0 10px; padding: 10px 12px; background: #fff; border: 2.5px solid var(--line); border-radius: 14px; box-shadow: 3px 3px 0 var(--line);
  display: grid; gap: 8px; font-size: 16px; line-height: 1.3; animation: pop .3s cubic-bezier(.2, 1.5, .4, 1) both; }
.dym i { color: var(--soft); }
.dym-btns { display: flex; gap: 8px; }
.dym-btns button { padding: 8px 14px; border: 2px solid var(--line); border-radius: 10px; font-weight: 800; font-size: 15px; background: #fff; }
.dym-btns .yes { background: var(--accent); color: #fff; box-shadow: 2px 2px 0 var(--line); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.say { margin: 8px 2px 0; font-size: 14.5px; line-height: 1.35; min-height: 1.35em; color: var(--soft); font-weight: 600; }
.say:empty { display: none; }
.say.warn { color: var(--accent); }

.landing { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; background: #fff;
  border: 2.5px solid var(--line); border-radius: 16px; box-shadow: 3px 3px 0 var(--line); animation: pop .45s cubic-bezier(.2, 1.5, .4, 1) both; }
.landing .thumb { width: 52px; height: 60px; object-fit: cover; object-position: 50% 20%; border: 2px solid var(--line); border-radius: 10px; display: block; background: var(--land); }
.landing .nm { font-size: 18px; line-height: 1.1; }
.landing .off { font-size: 14px; color: var(--soft); font-weight: 600; margin-top: 3px; }
.landing .pts { text-align: right; }
.landing .pts b { display: block; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.landing .pts span { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

.go-btn { display: block; width: 100%; margin: 10px 0 0; padding: 14px; background: var(--line); color: #fff; font-size: 19px; border-radius: 14px; letter-spacing: .02em; }
.go-btn:active { transform: translateY(1px); }
.go-btn.alt { background: #fff; color: var(--ink); border: 2.5px solid var(--line); box-shadow: 3px 3px 0 var(--line); }

/* ---------- Results ---------- */
.results { position: fixed; inset: 0; z-index: 12; overflow: auto; background: var(--space); padding: max(16px, env(safe-area-inset-top)) 14px 32px; animation: rise .6s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.r-card { max-width: 520px; margin: 0 auto; background: var(--panel); border: 2.5px solid var(--line); border-radius: 22px; box-shadow: 5px 5px 0 var(--line); padding: 18px 16px 16px; text-align: center; }
.r-head { display: flex; justify-content: center; gap: 10px; align-items: baseline; font-weight: 800; color: var(--soft); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.r-num { display: block; font-size: clamp(60px, 20vw, 92px); line-height: .9; margin-top: 8px; font-variant-numeric: tabular-nums; }
.r-title { margin: 6px 0 2px; font-family: "Bowlby One", sans-serif; font-size: 22px; color: var(--accent); }
.r-sub { margin: 0; color: var(--soft); font-weight: 600; font-size: 15px; }
.dist { margin: 16px 0 4px; }
.dist svg { width: 100%; height: auto; display: block; overflow: visible; }
.dist .bar { fill: var(--land); stroke: var(--line); stroke-width: 1.2; }
.dist .bar.you { fill: var(--accent); }
.dist .you-t { font-family: "Bowlby One", sans-serif; font-size: 13px; fill: var(--ink); }
.dist .axis-t { font-size: 10px; fill: var(--soft); font-weight: 600; }
.dist-note { font-size: 12px; color: var(--soft); margin: 2px 0 0; font-weight: 600; }
.r-map { display: block; width: 100%; margin: 14px auto 0; }
.rounds { list-style: none; margin: 14px 0 0; padding: 0; text-align: left; }
.rounds li { display: grid; grid-template-columns: 26px 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 2px dashed rgba(0,0,0,.15); align-items: start; }
.rounds .n { width: 24px; height: 24px; border-radius: 50%; background: var(--line); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.rounds .a { font-weight: 800; font-size: 16px; }
.rounds .a i { font-weight: 600; color: var(--soft); font-style: normal; }
.rounds .p { grid-row: 1 / span 2; grid-column: 3; text-align: right; font-family: "Bowlby One", sans-serif; font-size: 20px; font-variant-numeric: tabular-nums; }
.rounds .meta { grid-column: 2; font-size: 13.5px; color: var(--soft); font-weight: 600; }
.next { text-align: center; font-size: 14px; color: var(--soft); margin: 12px 0 0; font-weight: 600; }
.next b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Help ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; }
.sheet-card { max-width: 420px; width: 100%; background: var(--panel); color: var(--ink); padding: 22px 20px 12px; border: 2.5px solid var(--line); border-radius: 22px; box-shadow: 6px 6px 0 var(--line); }
.sheet-card h2 { font-family: "Bowlby One", sans-serif; font-weight: 400; font-size: 28px; line-height: 1.05; margin: 0 0 12px; }
.sheet-card p { margin: 0 0 10px; font-size: 16.5px; line-height: 1.45; }
.sheet-card .small { font-size: 13px; color: var(--soft); margin-top: 10px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--line); color: #fff; padding: 10px 14px; border-radius: 12px; z-index: 30; font-weight: 600; max-width: calc(100% - 32px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; }
}
