html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 40% at 82% 12%, rgba(72, 52, 140, 0.16), transparent 70%),
    radial-gradient(55% 35% at 12% 88%, rgba(18, 86, 128, 0.14), transparent 70%),
    radial-gradient(120% 80% at 50% 45%, #0a1531 0%, #050a19 48%, #020409 100%);
  color: #cfe6ff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
}

#globe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: grab;
}

#globe.ready {
  opacity: 1;
}

#globe.dragging {
  cursor: grabbing;
}

#hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  color: rgba(196, 226, 255, 0.62);
  text-shadow: 0 0 12px rgba(90, 180, 255, 0.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1.2s ease 0.6s, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.6s, color 0.8s ease;
}

button { font: inherit; }
.screen { position: fixed; inset: 0; z-index: 10; }
.screen[hidden] { display: none; }
.glass { background: rgba(5, 12, 29, .82); border: 1px solid rgba(157, 211, 255, .22); box-shadow: 0 18px 60px rgba(0, 0, 0, .35), inset 0 1px rgba(255,255,255,.06); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

/* Postcard detail is sized from the 390px mobile layout first. */
.ppd { --ppd-screen-gutter: 12px; --ppd-control-inset: 6px; }
@media (min-width: 391px) {
  .ppd { --ppd-screen-gutter: 16px; }
}

/* A compact X with a full 44px tap target. Static buttons may retain fallback text,
   so the glyph is supplied as a background and their text is visually hidden. */
.home-nav-btn { position: fixed; z-index: 95; top: calc(env(safe-area-inset-top, 0px) + 6px); right: 6px; width: 44px; height: 44px; padding: 0; margin: 0; border: 0; border-radius: 50%; background: none; color: rgba(198,226,250,.7); font-size: 28px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.home-nav-btn:active { transform: scale(.9); background-color: rgba(157,211,255,.12); }
.home-nav-btn:focus-visible { outline: 2px solid rgba(127,210,244,.65); outline-offset: -5px; }

/* Settings: gear entry top-right on the home screen opens a modal over the start card */
.settings-entry { position: fixed; z-index: 95; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; margin: 0; border: 1px solid rgba(157, 211, 255, .22); border-radius: 50%; background-color: rgba(5, 12, 29, .78); box-shadow: 0 6px 18px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.05); color: #cfe6ff; font-size: 20px; line-height: 1; cursor: pointer; pointer-events: auto; touch-action: manipulation; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.settings-entry:active { transform: scale(.92); background-color: rgba(5, 12, 29, .92); }
.settings-entry:focus-visible { box-shadow: 0 6px 18px rgba(0,0,0,.32), 0 0 0 2px rgba(127,210,244,.5); }
.settings-screen { box-sizing: border-box; overflow: auto; padding: calc(env(safe-area-inset-top, 0px) + 18px) 14px calc(env(safe-area-inset-bottom, 0px) + 18px); background: rgba(2,4,9,.68); pointer-events: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.settings-card { position: relative; box-sizing: border-box; width: 100%; max-width: 440px; min-height: 100%; margin: auto; padding: 26px 18px 20px; border-radius: 24px; }
.settings-card h2 { margin: 0; color: #f5fbff; font-size: 21px; text-align: center; letter-spacing: -.02em; }
.settings-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: rgba(198,226,250,.7); font-size: 28px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.settings-main { margin-top: 22px; }
.settings-reset { width: 100%; min-height: 48px; padding: 0 18px; border: 0; border-radius: 14px; background: #e5484d; color: #fff; font-size: 15px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 18px rgba(229,72,77,.28); touch-action: manipulation; }
.settings-reset:active { transform: scale(.98); }
.settings-confirm { margin-top: 22px; }
.settings-confirm p { margin: 0; color: rgba(224,240,255,.82); font-size: 14px; line-height: 1.5; text-align: center; }
.settings-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.settings-danger, .settings-cancel { width: 100%; min-height: 48px; padding: 0 18px; border-radius: 14px; font-size: 15px; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.settings-danger { border: 0; background: #e5484d; color: #fff; box-shadow: 0 6px 18px rgba(229,72,77,.28); }
.settings-danger:active, .settings-cancel:active { transform: scale(.98); }
.settings-cancel { border: 1px solid rgba(157, 211, 255, .22); background: rgba(157,211,255,.08); color: #dcefff; }
body.game-settings #hud { opacity: 0; }
.start-screen { display: flex; box-sizing: border-box; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; background: linear-gradient(180deg, rgba(2,4,9,.12), rgba(2,4,9,.56)); }
.eyebrow { margin: 0 0 10px; color: #77caff; font-size: 11px; font-weight: 750; letter-spacing: .18em; text-transform: uppercase; }
h1 { max-width: 330px; margin: 0; color: #f1f8ff; font-size: clamp(46px, 15vw, 68px); line-height: .9; letter-spacing: -.065em; text-shadow: 0 0 30px rgba(77,176,255,.35); }
.how-to { max-width: 310px; margin: 24px 0 28px; color: rgba(218,237,255,.78); font-size: 15px; line-height: 1.5; }
.primary { min-width: 172px; min-height: 52px; padding: 0 24px; border: 0; border-radius: 999px; background: #ecf7ff; color: #071426; font-weight: 800; cursor: pointer; box-shadow: 0 8px 28px rgba(89,185,255,.28); touch-action: manipulation; }
.primary:active { transform: scale(.98); }
.streak { min-height: 20px; margin: 18px 0 0; color: #ffc76a; font-size: 13px; font-weight: 700; }
.round-screen { pointer-events: none; }
.round-header { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 12px; right: 12px; box-sizing: border-box; min-height: 56px; padding: 7px 52px 8px 12px; border-radius: 18px; text-align: left; }
/* Home sits in the card's top-right corner; the transparent outer area preserves a 44px target. */
.round-header .home-nav-btn { position: absolute; top: 6px; right: 5px; left: auto; z-index: auto; display: block; }
.round-header .home-nav-btn:active { transform: scale(.94); background-color: rgba(157,211,255,.16); }
.round-meta { display: flex; align-items: center; gap: 8px; min-height: 18px; color: rgba(193,224,250,.67); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.round-meta span:last-child { color: #ffc76a; }
.round-meta .mute-toggle { order: 1; margin: -9px -6px -9px auto; }
.daily-date { margin: 1px 0 0; color: rgba(193,224,250,.5); font-size: 11px; font-weight: 650; letter-spacing: .02em; }
.daily-date[hidden] { display: none; }
.round-header .survival-streak { margin: 2px 0 0; font-size: 15px; }
.round-header h2 { margin: 3px 0 1px; color: #f3f9ff; font-size: 19px; line-height: 1.2; letter-spacing: -.02em; }
#guess-hint { margin: 0; color: rgba(193,224,250,.58); font-size: 12px; }
.reveal-card { position: absolute; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); box-sizing: border-box; padding: 17px; border-radius: 20px; pointer-events: auto; }
.score-line { display: flex; align-items: center; justify-content: space-between; }
.score-line div { color: #fff; font-size: 22px; font-weight: 800; }
.score-line small { display: block; color: rgba(193,224,250,.56); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.score-line strong { color: #ffc76a; font-size: 28px; }
.score-math { display: flex; align-items: baseline; gap: 9px; }
.score-math .base { color: #fff; font-size: 14px; font-weight: 700; white-space: nowrap; }
.score-math .base b { font-size: 22px; font-weight: 800; }
.score-math .mult { color: rgba(193,224,250,.62); font-size: 15px; font-weight: 700; }
.score-math #round-score { color: #ffc76a; font-size: 28px; }
.reveal-card .primary { width: 100%; min-height: 48px; }

/* Reveal: the clue header collapses to the place name, a score pill floats
   under it while the map plays alone, then the bottom sheet peeks up. */
.reveal-name { display: none; margin: 0; overflow: hidden; color: #f3f9ff; font-size: 16px; font-weight: 750; letter-spacing: -.01em; line-height: 22px; text-overflow: ellipsis; white-space: nowrap; }
body.game-reveal .round-header { display: flex; align-items: center; justify-content: center; min-height: 0; height: 52px; padding: 0 56px; overflow: hidden; text-align: center; }
body.game-reveal .round-header > :not(.reveal-name):not(.home-nav-btn) { display: none; }
body.game-reveal .round-header .home-nav-btn { top: 4px; right: 4px; }
body.game-reveal .reveal-name { display: block; }
.reveal-pill { position: absolute; z-index: 1; top: calc(env(safe-area-inset-top, 0px) + 74px); left: 50%; margin: 0; padding: 6px 14px 5px; border: 1px solid rgba(255,199,106,.38); border-radius: 999px; background: rgba(5,12,29,.74); color: #ffc76a; font-size: 15px; font-weight: 850; letter-spacing: -.01em; white-space: nowrap; transform: translateX(-50%); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.reveal-pill[hidden] { display: none; }
.reveal-pill.safe { border-color: rgba(120,230,170,.4); color: #8ef0b8; }
.reveal-pill.miss { border-color: rgba(255,120,150,.4); color: #ff9db4; }

.reveal-sheet { position: absolute; left: 0; right: 0; bottom: 0; box-sizing: border-box; padding-bottom: env(safe-area-inset-bottom, 0px); border-width: 1px 0 0; border-radius: 20px 20px 0 0; pointer-events: auto; touch-action: none; }
.reveal-sheet[hidden] { display: none; }
.peek-bar { position: relative; display: flex; align-items: center; gap: 12px; box-sizing: border-box; height: 80px; padding: 10px 14px 8px; cursor: pointer; outline: none; }
.peek-bar:focus-visible { box-shadow: inset 0 0 0 2px rgba(127,210,244,.5); border-radius: 20px 20px 0 0; }
.peek-grip { position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: rgba(193,224,250,.32); transition: background .2s; }
.reveal-sheet.expanded .peek-grip { background: rgba(193,224,250,.55); }
.peek-slot { position: relative; flex: none; width: 52px; height: 52px; }
.peek-slot[hidden] { display: none; }
#peek-thumb { display: block; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; object-position: center 20%; box-shadow: var(--ring, none); }
.peek-slot.mystery::before { content: ""; position: absolute; inset: 0; box-sizing: border-box; border: 1.5px dashed rgba(193,224,250,.55); border-radius: 10px; background: rgba(193,224,250,.05); }
.peek-slot.mystery #peek-thumb { visibility: hidden; }
#peek-thumb.seen-no-postcard, #place-thumb.seen-no-postcard { filter: grayscale(1); opacity: 0.7; }
#peek-thumb.prox-postcard, #peek-thumb.prox-bullseye, #peek-thumb.prox-pinpoint,
#place-thumb.prox-postcard, #place-thumb.prox-bullseye, #place-thumb.prox-pinpoint { filter: none; opacity: 1; }
/* Rarity reads as a quiet frame colour plus a small tag on cards with room for
   text; gold stays exclusive to the Bullseye/Pinpoint accuracy ring so the two
   signals never fight for attention. */
.rarity-common { --rarity: #8b96a8; --rarity-bg: rgba(139,150,168,.14); --rarity-border: rgba(139,150,168,.45); }
.rarity-uncommon { --rarity: #4fcf8a; --rarity-bg: rgba(79,207,138,.14); --rarity-border: rgba(79,207,138,.45); }
.rarity-rare { --rarity: #6c8cff; --rarity-bg: rgba(108,140,255,.16); --rarity-border: rgba(108,140,255,.5); }
.rarity-legendary { --rarity: #c77dff; --rarity-bg: rgba(199,125,255,.16); --rarity-border: rgba(199,125,255,.5); }
.thumb-slot { position: relative; }
.rarity-tab { display: inline-flex; align-items: center; box-sizing: border-box; padding: 3px 9px; border: 1px solid var(--rarity-border, rgba(139,150,168,.45)); border-radius: 999px; background: var(--rarity-bg, rgba(139,150,168,.14)); color: var(--rarity, #8b96a8); font-size: 9.5px; font-weight: 800; line-height: 1.3; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.prox-postcard { --ring: 0 0 0 1.5px var(--rarity, transparent); }
.prox-bullseye { --ring: 0 0 0 2px #F5C451, 0 0 12px 1px rgba(245,196,81,.55); }
.prox-pinpoint { --ring: 0 0 0 3.5px #F5C451, 0 0 22px 4px rgba(245,196,81,.8); }
.peek-text { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.peek-name { overflow: hidden; color: #f3f9ff; font-size: 16px; font-weight: 750; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.peek-stats { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.peek-score { color: #ffc76a; font-size: 17px; font-weight: 850; }
.peek-score:empty { display: none; }
body.survival .peek-score { color: #8ef0b8; }
body.survival-miss .peek-score { color: #ff9db4; }
.peek-distance { color: rgba(193,224,250,.7); font-size: 13px; font-weight: 650; }
.peek-near-miss { display: none; min-width: 0; overflow: hidden; color: #ffd08a; font-size: 13px; font-weight: 750; text-overflow: ellipsis; }
.peek-bar.near-miss .peek-distance { display: none; }
.peek-bar.near-miss .peek-near-miss { display: inline; }
.peek-bar .peek-next { flex: none; min-width: 0; min-height: 44px; padding: 0 18px; font-size: 15px; }
.sheet-content { max-height: 0; overflow: hidden; transition: max-height .32s cubic-bezier(.2,.8,.2,1); }
.reveal-sheet.expanded .sheet-content { max-height: 320px; }
.sheet-inner { padding: 0 14px 14px; }
.sheet-content .score-math { margin: 0 0 8px; }
.sheet-content .score-math .base b { font-size: 16px; }
#place-thumb { display: block; width: 100%; height: 80px; margin: 0; border-radius: 10px; object-fit: cover; object-position: center 20%; box-shadow: var(--ring, none); }
#place-thumb[hidden] { display: none; }
#fact { margin: 10px 0 0; color: rgba(224,240,255,.8); font-size: 13px; line-height: 1.45; }

/* z-index 10: after the .screen sections in the DOM, so above the reveal sheet; below .ppd (11) and the postcard (13). */
.line-distance { position: fixed; z-index: 10; left: 0; top: 0; padding: 4px 10px 3px; border: 1px solid rgba(185,247,255,.5); border-radius: 999px; background: rgba(4,12,28,.8); color: #f4fdff; font-size: 14px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; pointer-events: none; will-change: transform; box-shadow: 0 0 16px rgba(70,205,255,.2); }
.line-distance[hidden] { display: none; }
.results-screen { box-sizing: border-box; overflow: auto; padding: calc(env(safe-area-inset-top, 0px) + 18px) 14px calc(env(safe-area-inset-bottom, 0px) + 18px); background: rgba(2,4,9,.42); pointer-events: auto; }
.results-card, .survival-results-card { position: relative; }
.results-card { box-sizing: border-box; width: 100%; max-width: 440px; min-height: 100%; margin: auto; padding: 18px 16px; border-radius: 24px; text-align: center; }
.results-card .home-nav-btn, .survival-results-card .home-nav-btn { position: absolute; top: 5px; right: 5px; }
.results-actions .home-nav-btn, .survival-result-actions .home-nav-btn { width: 44px; min-height: 44px; }
.results-card h2 { margin: 0; color: #f5fbff; font-size: 50px; line-height: 1; letter-spacing: -.05em; }
.results-card h2 small { color: rgba(198,226,250,.55); font-size: 18px; letter-spacing: 0; }
.results-card .streak { margin-top: 10px; }
#breakdown { margin: 18px 0; padding: 0; list-style: none; text-align: left; }
#breakdown li { display: grid; grid-template-columns: 25px 1fr auto; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(173,216,255,.11); font-size: 15px; }
#breakdown .place { overflow: hidden; color: rgba(225,240,255,.92); text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#breakdown .points { color: #ffc76a; font-weight: 800; text-align: right; font-size: 16px; }
#breakdown .points small { display: block; color: rgba(193,224,250,.5); font-weight: 500; }
.text-button { background: none; border: none; color: rgba(193,224,250,.55); font: 13px/1.4 system-ui, sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px; margin-top: 4px; }
#share-status { min-height: 16px; margin: 8px 0 0; color: #8bd9ff; font-size: 11px; }
body.game-start #hud, body.game-results #hud, body.game-reveal #hud { opacity: 0; }

@media (max-height: 700px) {
  .round-header { padding: 6px 52px 7px 12px; }
  .round-header h2 { font-size: 18px; }
  .reveal-card { padding: 13px 16px; }
  .peek-bar { height: 72px; padding-top: 8px; padding-bottom: 6px; }
  .peek-slot, #peek-thumb { width: 46px; height: 46px; }
  #fact { margin: 8px 0 0; }
  .results-card { padding-top: 18px; }
  #breakdown { margin: 12px 0; }
}

#hud.ready {
  opacity: 1;
  transform: none;
}

#hud.dim {
  color: rgba(196, 226, 255, 0.38);
}

#travel-distance {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: 24px;
  min-width: 120px;
  padding: 8px 16px 7px;
  border: 1px solid rgba(103, 232, 255, .28);
  border-radius: 14px;
  background: rgba(4, 12, 28, .68);
  box-shadow: 0 0 24px rgba(70, 205, 255, .16);
  color: #f4fdff;
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#travel-distance[hidden] { display: none; }
#travel-distance span { display: block; font-size: clamp(24px, 7vw, 36px); font-weight: 850; letter-spacing: -.04em; }
#travel-distance small { display: block; color: rgba(193, 235, 250, .66); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

#err {
  position: fixed;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 50;
  background: rgba(90, 12, 12, 0.94);
  color: #ffd7d7;
  font: 11px/1.5 ui-monospace, monospace;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: pre-wrap;
  pointer-events: none;
}

#err[hidden] {
  display: none;
}

/* Hold-to-confirm: target ticks at the press point, loupe floating above the thumb */

/* Lock in: fixed in the thumb zone, clear of the pin, so the finger never hides
   the placement. Fades in un-tappable for a beat (LOCK_ARM_MS) so a double tap
   on the globe can't confirm by accident. */
.lock-button { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); min-width: 220px; min-height: 54px; background: linear-gradient(135deg, #ffd166, #ff9f6a); color: #1b1230; font-size: 17px; letter-spacing: -.01em; box-shadow: 0 8px 28px rgba(255,159,106,.35), 0 2px 8px rgba(0,0,0,.4); pointer-events: auto; transform: translateX(-50%); animation: lock-in .35s ease-out both; }
.lock-button[hidden] { display: none; }
.lock-button:active { transform: translateX(-50%) scale(.96); }
@keyframes lock-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%); } }
body.has-guess #hud { opacity: 0; }

/* Collection locations stay completely secret until passport metadata records
   a visit. No image is mounted beneath these placeholders. */
.collection-thumb.mystery,
.collection-card.mystery .photo {
  background: radial-gradient(circle at 50% 38%, #172033, #080b12 72%);
}

.collection-thumb.mystery::after,
.collection-card.mystery .photo::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(214, 220, 232, .42);
  font-weight: 850;
}

.collection-thumb.mystery::after { font-size: 12px; }
.collection-card.mystery .photo::after { font-size: 28px; }
.collection-card.mystery { border-color: rgba(214, 220, 232, .09); background: #0d121d; }
.collection-card.mystery .collection-card-name { color: rgba(214, 220, 232, .42); letter-spacing: .12em; }
