:root {
  --acc: #e0a635;
  --bg: #0d1117;
  --panel: #161d27;
  --panel2: #1d2632;
  --border: #2b3646;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #e0a635;
  --accent2: #46a758;
  --danger: #d05353;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ============ HEADER ============ */
#topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.brand-logo { height: 48px; width: auto; display: block; }
.accent { color: var(--accent); }

#hud { display: flex; gap: 26px; }
.hud-item { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.hud-label { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
#hud-round, #hud-score { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pro-btn {
  background: linear-gradient(135deg, #e0a635, #c07f16);
  color: #1a1205;
  border: none;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.pro-btn:hover { filter: brightness(1.1); }

/* ============ GAME LAYOUT ============ */
#game-screen {
  display: flex;
  height: calc(100% - 56px);
}

#photo-panel {
  flex: 1.15;
  min-width: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#photo-frame { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; cursor: zoom-in; }

#photo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  transition: transform 0.08s ease-out;
  will-change: transform;
}

#photo-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 17, 23, 0.82);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

#guess-panel {
  flex: 1;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

#map { flex: 1; min-height: 0; }

#controls {
  padding: 14px 18px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#year-row { display: flex; flex-direction: column; gap: 4px; }

#year-display {
  align-self: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#year-slider {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--panel2);
  outline: none;
  cursor: pointer;
}
#year-slider::-webkit-slider-thumb {
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff2d4;
  cursor: grab;
}
#year-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff2d4;
  cursor: grab;
}

.year-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

/* ============ BUTTONS ============ */
.big-btn {
  background: var(--accent2);
  color: #06130a;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.big-btn:hover:not(:disabled) { filter: brightness(1.12); }
.big-btn:active:not(:disabled) { transform: scale(0.98); }
.big-btn:disabled { background: var(--panel2); color: var(--muted); cursor: not-allowed; }
.free-btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); }

.pro-tag {
  background: linear-gradient(135deg, #e0a635, #c07f16);
  color: #1a1205;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 6px;
}

.archive-row { display: flex; gap: 8px; }
.archive-row input {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
}
.archive-row input:focus { border-color: var(--accent); }
.archive-go { width: auto; padding: 10px 22px; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 6px;
}
.link-btn:hover { color: var(--text); }

/* ============ OVERLAYS ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 16, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  z-index: 50;
  overflow-y: auto;
  padding: 20px;
}
/* auto margins center when there's room but NEVER clip the top when the
   content is taller than the viewport (align-items:center does clip) */
.overlay > * { margin: auto; }

.start-card, .result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 38px;
  max-width: 540px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.logo { font-size: 52px; font-weight: 900; letter-spacing: 8px; }
.start-logo { width: 100%; max-width: 430px; height: auto; align-self: center; filter: drop-shadow(0 6px 24px rgba(0,0,0,0.55)); }
.logo.small { font-size: 30px; letter-spacing: 4px; }
.tagline { color: var(--accent); font-weight: 600; letter-spacing: 1px; margin-top: -10px; }
.desc { color: var(--muted); font-size: 15px; line-height: 1.55; }
.desc strong { color: var(--text); }

.rules { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.rule {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.rule-pts { color: var(--accent); font-weight: 800; font-size: 16px; white-space: nowrap; }

.best-score { color: var(--muted); font-size: 13px; }
.best-score b { color: var(--accent); }

/* ============ HOME / GAME PICKER ============ */
#home-screen { flex-direction: column; }
.home-wrap {
  max-width: 900px;
  width: 100%;
  margin: auto;
  padding: 30px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.home-welcome { color: var(--muted); font-size: 16px; letter-spacing: 1px; margin-bottom: -10px; }
.home-title { font-size: 46px; font-weight: 900; letter-spacing: 2px; }
.home-sub { color: var(--muted); font-size: 15.5px; line-height: 1.55; }

.game-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 10px;
}
.game-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.game-card:hover { transform: translateY(-4px); }
.card-wardle:hover { border-color: var(--accent); box-shadow: 0 14px 44px rgba(224, 166, 53, 0.18); }
.card-history:hover { border-color: #4aa3df; box-shadow: 0 14px 44px rgba(74, 163, 223, 0.18); }

/* identical logo slot on both cards so everything below lines up */
.gc-logo {
  height: 235px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 16px rgba(0,0,0,0.5));
}
.gc-desc {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 62px;
  /* absorb the card's spare height so chip + button pin to the bottom */
  margin-top: auto;
  margin-bottom: auto;
}
.gc-desc strong { color: var(--text); }
.gc-chip {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
}
.gc-play {
  width: 100%;
  border-radius: 10px;
  padding: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 14.5px;
}
.play-wardle { background: linear-gradient(135deg, #e0a635, #c07f16); color: #1a1205; }
.play-history { background: linear-gradient(135deg, #4aa3df, #2c6ea8); color: #06131f; }

/* History Guesser text logo */
.hg-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 18px 8px;
}
.hg-icon { font-size: 52px; filter: drop-shadow(0 4px 10px rgba(74,163,223,0.4)); }
.hg-word {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1.1;
  text-align: left;
  background: linear-gradient(135deg, #7ec3f0, #2c6ea8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hg-logo-big { align-self: center; }
.hg-logo-big .hg-icon { font-size: 64px; }
.hg-logo-big .hg-word { font-size: 38px; }

.home-foot { color: var(--muted); font-size: 13.5px; }
.home-about { text-align: left; }
.back-home { align-self: flex-start; margin-bottom: -8px; padding: 0; }

@media (max-width: 760px) {
  .game-cards { grid-template-columns: 1fr; }
  .home-title { font-size: 34px; }
}

/* each game's accent drives the final-screen gauge, score and rank */
body.game-history { --acc: #4aa3df; }
body.game-landmark { --acc: #2bb3a3; }
body.game-estimate { --acc: #9b6fd6; }
body.game-zoomed { --acc: #58b368; }
body.game-gramble { --acc: #e8743c; }

/* history-mode accents on the start screen + game */
body.game-history .big-btn:not(.free-btn):not(:disabled) { background: linear-gradient(135deg, #4aa3df, #2c6ea8); color: #06131f; }
body.game-history #year-display { color: #6fb8e8; }
body.game-history .rule-pts { color: #6fb8e8; }

#start-screen { flex-direction: column; }
#start-screen .start-card { flex-shrink: 0; }

.seo-about {
  max-width: 540px;
  margin: 26px auto 40px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.seo-about h1 { font-size: 17px; color: var(--text); margin-bottom: 8px; }
.seo-about h2 { font-size: 14.5px; color: var(--text); margin: 16px 0 6px; }
.seo-about p { margin-bottom: 8px; }
.seo-about strong { color: var(--text); }

.pro-tease {
  border: 1px dashed #6b5620;
  background: rgba(224, 166, 53, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}
.pro-tease-title { color: var(--accent); font-weight: 800; letter-spacing: 1px; margin-bottom: 3px; }

/* ============ RESULT ============ */
.result-total { font-size: 58px; font-weight: 900; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--muted); font-size: 13px; margin-top: -12px; }

.result-rows { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.result-row-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.pts { color: var(--accent); font-variant-numeric: tabular-nums; }

.bar { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 4px; transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1); }

.result-detail { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.answer-box {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
}
.ans-title { font-weight: 800; font-size: 16px; }
.ans-meta { color: var(--accent); font-size: 13px; margin: 3px 0 7px; }
.ans-caption { color: var(--muted); font-size: 13px; line-height: 1.5; }

.final-score { font-size: 46px; font-weight: 900; color: var(--acc); line-height: 1; font-variant-numeric: tabular-nums; }
.final-rank { font-size: 17px; font-weight: 700; color: var(--acc); letter-spacing: 0.5px; }

.fs-gauge-wrap { position: relative; width: min(250px, 66vw); margin: -6px auto -10px; }
.fs-gauge-wrap svg { width: 100%; height: auto; display: block; }
#fs-track { stroke: var(--panel2); }
#fs-arc { stroke: var(--acc); stroke-dasharray: 283; stroke-dashoffset: 283; }
.fs-score-box { position: absolute; left: 0; right: 0; bottom: 2px; }
.fs-score-box .result-sub { margin-top: 2px; }

.fs-rounds { display: flex; justify-content: center; gap: 10px; }
.fsr-bar {
  width: 30px; height: 56px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 5px;
  display: flex; align-items: flex-end;
  overflow: hidden;
}
.fsr-bar span {
  display: block; width: 100%;
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.fs-rounds.grow .fsr-bar span { transform: scaleY(1); }
.fsr-n { font-size: 10px; color: var(--muted); margin-top: 3px; text-align: center; font-variant-numeric: tabular-nums; }

/* gramble finale keeps the pixel voice */
body.game-gramble #final-score { font-family: 'Press Start 2P', monospace; font-size: 30px; font-weight: 400; padding-top: 8px; }
body.game-gramble .fsr-bar { border-radius: 0; }
body.game-gramble .final-rank { font-family: 'Press Start 2P', monospace; font-size: 12px; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  #fs-arc, .fsr-bar span { transition: none !important; }
}

/* ============ PRO MODAL ============ */
.pro-list { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; color: var(--text); padding-left: 6px; }
.pro-price { font-size: 40px; font-weight: 900; color: var(--accent); }
.pro-price span { font-size: 15px; color: var(--muted); font-weight: 600; }

/* ============ MAP MARKERS ============ */
/* pointer-events: none — markers must never intercept or follow the cursor */
.guess-marker {
  font-size: 30px; line-height: 1; pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6));
  animation: pin-drop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.actual-marker { font-size: 26px; line-height: 1; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6)); }

.target-wrap { position: relative; width: 38px; height: 38px; pointer-events: none; }
.target-pop {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 27px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.65));
  animation: target-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pulse-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(224, 166, 53, 0.85);
  animation: pulse 1.8s ease-out infinite;
}
.pulse-ring.ring2 { animation-delay: 0.6s; }

@keyframes target-pop {
  0% { transform: scale(0) rotate(-30deg); }
  60% { transform: scale(1.35) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes pulse {
  0% { transform: scale(0.45); opacity: 0.9; }
  100% { transform: scale(2.3); opacity: 0; }
}
@keyframes pin-drop {
  0% { transform: translateY(-18px) scale(0.6); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ============ HINTS ============ */
#hint-box {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}
.hint-btn {
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  backdrop-filter: blur(4px);
}
.hint-btn:hover:not(:disabled) { border-color: var(--accent); }
.hint-btn:disabled { cursor: default; opacity: 0.95; }
.hint-btn.revealed { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.hint-cost { color: var(--muted); font-size: 11px; margin-left: 4px; }
.hint-btn.revealed .hint-cost { display: none; }

/* ============ FINAL / SHARE ============ */
.final-percentile { font-size: 15px; color: var(--text); }
.final-percentile b { color: var(--accent); }
.final-streak { font-size: 14px; color: var(--muted); }
.final-streak b { color: var(--accent2); }
.share-box { display: flex; flex-direction: column; gap: 10px; }
.share-text {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
  color: var(--text);
}
.share-btn { background: var(--accent); color: #1a1205; }

/* ============ RESULT BAR ============ */
.result-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: rgba(18, 24, 32, 0.97);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
  transform: translateY(110%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.result-bar.show { transform: translateY(0); pointer-events: auto; }

.rb-score { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
.rb-total { font-size: 40px; font-weight: 900; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.rb-max { font-size: 11px; color: var(--muted); }

.rb-breakdown { display: flex; flex-direction: column; gap: 6px; }
.rb-line { font-size: 14px; display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.rb-pts { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 48px; }
.rb-note { color: var(--muted); font-size: 12.5px; }

.rb-answer { flex: 1; min-width: 220px; }
.rb-title { font-weight: 800; font-size: 15px; }
.rb-meta { color: var(--accent); font-size: 12.5px; margin: 2px 0 4px; }
.rb-caption { color: var(--muted); font-size: 12px; line-height: 1.45; max-width: 640px; }

.rb-next { width: auto; padding: 13px 30px; flex-shrink: 0; }

@media (max-width: 900px) {
  .result-bar { gap: 14px; padding: 12px 16px; }
  .rb-caption { display: none; }
  .rb-next { width: 100%; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .logo { font-size: 34px; letter-spacing: 5px; }
  .start-card, .result-card { padding: 26px 22px; }
  #game-screen { flex-direction: column; height: auto; min-height: calc(100% - 56px); }
  #photo-panel { min-height: 38vh; flex: none; }
  #guess-panel { min-width: 0; border-left: none; border-top: 1px solid var(--border); flex: none; }
  #map { flex: none; height: 44vh; }
}

/* Pro members don't see PRO gates */
body.is-pro .pro-tag { display: none; }

/* History Guesser badge logo (same slot height as the Wardle logo) */
.gc-logo-hg { height: 235px; }
.start-logo-hg { max-width: 320px; }

/* ============ FIVE-GAME HOME GRID ============ */
.game-cards { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }

/* generic text logos for the new games (same slot height as image logos) */
.tlogo {
  height: 235px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.tl-icon { font-size: 64px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5)); }
.tl-word {
  font-size: 27px; font-weight: 900; letter-spacing: 4px; line-height: 1.15;
  text-align: center;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tl-landmark .tl-word { background-image: linear-gradient(135deg, #63d3c5, #1e8c7e); }
.tl-estimate .tl-word { background-image: linear-gradient(135deg, #c9a6f5, #7b4fc2); }
.tl-zoomed .tl-word { background-image: linear-gradient(135deg, #8fd89a, #3a8f4a); }
.tlogo-big { height: auto; padding: 14px 0; align-self: center; }

.card-landmark:hover { border-color: #2bb3a3; box-shadow: 0 14px 44px rgba(43,179,163,0.18); }
.card-estimate:hover { border-color: #9b6fd6; box-shadow: 0 14px 44px rgba(155,111,214,0.18); }
.card-zoomed:hover { border-color: #58b368; box-shadow: 0 14px 44px rgba(88,179,104,0.18); }
.play-landmark { background: linear-gradient(135deg, #47c6b6, #1e8c7e); color: #03211d; }
.play-estimate { background: linear-gradient(135deg, #b48ae8, #7b4fc2); color: #170b26; }
.play-zoomed { background: linear-gradient(135deg, #79cf88, #3a8f4a); color: #07230d; }

/* per-game accent on the start/game screens */
body.game-landmark .big-btn:not(.free-btn):not(:disabled) { background: linear-gradient(135deg, #47c6b6, #1e8c7e); color: #03211d; }
body.game-estimate .big-btn:not(.free-btn):not(:disabled) { background: linear-gradient(135deg, #b48ae8, #7b4fc2); color: #170b26; }
body.game-zoomed .big-btn:not(.free-btn):not(:disabled) { background: linear-gradient(135deg, #79cf88, #3a8f4a); color: #07230d; }

/* ============ ALT SCREEN (estimate / zoomed) ============ */
#alt-screen { height: calc(100% - 56px); overflow-y: auto; display: flex; }
.alt-wrap {
  max-width: 660px; width: 100%;
  margin: auto;
  padding: 24px 16px 140px;
  display: flex; flex-direction: column; gap: 18px; align-items: center;
}
#alt-photo-frame {
  width: 100%; max-width: 560px; aspect-ratio: 4 / 3;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
#alt-photo { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.alt-tier { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alt-tier b { color: var(--accent); }
.alt-question { font-size: 22px; font-weight: 700; text-align: center; line-height: 1.4; max-width: 560px; }
.alt-input-row { display: flex; gap: 10px; align-items: center; width: 100%; max-width: 520px; }
.alt-input-row input {
  flex: 1; background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 22px; font-weight: 700; padding: 14px 16px; outline: none;
  font-variant-numeric: tabular-nums; min-width: 0;
}
.alt-input-row input:focus { border-color: var(--accent); }
.alt-unit { color: var(--muted); font-size: 14px; white-space: nowrap; }
.alt-go { width: auto; padding: 14px 26px; }
.alt-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 560px; }
.alt-opts button {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 15px; font-weight: 600; padding: 14px 10px; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.06s ease;
}
.alt-opts button:hover:not(:disabled) { border-color: var(--accent); }
.alt-opts button:active:not(:disabled) { transform: scale(0.97); }
.alt-opts button:disabled { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }

/* ============ GRAMBLE ============ */
@font-face {
  font-family: 'Press Start 2P';
  src: url('../fonts/PressStart2P.ttf') format('truetype');
  font-display: swap;
}
/* palette: ink #101419 · dial cream #f3e9d4 · brass #c9a04e · needle red #d84b3a · coral #e8743c */
.tl-gramble .tl-word { background-image: linear-gradient(135deg, #f2a177, #cf5a2a); }
.card-gramble:hover { border-color: #e8743c; box-shadow: 0 14px 44px rgba(232, 116, 60, 0.18); }
.play-gramble { background: linear-gradient(135deg, #ef8752, #cf5a2a); color: #21100a; }
body.game-gramble .big-btn:not(.free-btn):not(:disabled) { background: linear-gradient(135deg, #ef8752, #cf5a2a); color: #21100a; }
body.game-gramble .rule-pts { color: #f0905c; }
body.game-gramble .rb-total, body.game-gramble .rb-pts, body.game-gramble .rb-meta { color: #f0905c; }
body.game-gramble .result-bar { border-top-color: #e8743c; }

/* the descent: pixel strata fill the screen; a scrim keeps the game readable.
   --gh is the stratum hue — green surface, clay, teal, violet, ember */
#alt-screen { position: relative; }
body.game-gramble #alt-screen { --gh: 145; background: #0a0c10; }

#gram-bg { position: absolute; inset: 0; display: none; overflow: hidden; pointer-events: none; }
body.game-gramble #gram-bg { display: block; }
#gram-terrain {
  position: absolute; inset: 0; width: 100%; height: 100%;
  image-rendering: pixelated;
}
#gram-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#gram-bg::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 85% 60% at 50% 38%, rgba(9, 11, 15, 0.38), rgba(9, 11, 15, 0.78) 85%),
    radial-gradient(ellipse 90% 30% at 50% 106%, hsla(var(--gh), 70%, 55%, 0.18), transparent 70%);
}
#alt-screen .alt-wrap { position: relative; z-index: 1; transition: opacity 0.4s ease; }
/* finale: the game chrome fades out and the depth you earned stays on screen */
#alt-screen.gram-final .alt-wrap { opacity: 0; pointer-events: none; }
#alt-screen.gram-final #gram-reveal { display: none; }
body.game-gramble #final-screen { background: rgba(8, 11, 16, 0.55); backdrop-filter: blur(2px); }
body.game-gramble #final-screen .start-card { background: rgba(22, 29, 39, 0.92); }

.weight-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gram-meter { display: flex; gap: 7px; margin-bottom: 2px; }
.gm-cell {
  width: 44px; height: 9px;
  border: 1px solid #5a4a33;
  border-radius: 5px;
  background: rgba(243, 233, 212, 0.07);
  overflow: hidden;
  display: inline-block;
}
.gm-cell.gm-live { border-color: #c9a04e; box-shadow: 0 0 8px rgba(201, 160, 78, 0.35); }
.gm-fill { display: block; height: 100%; background: linear-gradient(90deg, #ef8752, #cf5a2a); }

/* every item renders as the same cream silhouette — one uniform treatment,
   growing from / shrinking toward its floor shadow as the slider moves */
.gram-stage {
  position: relative;
  width: 100%; height: 124px;
  display: flex; align-items: flex-end; justify-content: center;
}
.gram-glyph {
  font-size: 60px; line-height: 1; display: block;
  position: relative; z-index: 1;
  filter: brightness(0) invert(0.94) sepia(0.4) drop-shadow(0 10px 22px rgba(0, 0, 0, 0.5));
  transform-origin: 50% 100%;
  transition: transform 0.18s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.gram-shadow {
  position: absolute; bottom: -9px; left: 50%;
  width: 96px; height: 15px; margin-left: -48px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.6), transparent 70%);
  transition: transform 0.18s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.gram-item { font-size: 21px; font-weight: 700; text-align: center; }
.gram-depth {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px; letter-spacing: 1px;
  color: #9fd8a8;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}
body.game-gramble .gram-readout {
  font-family: 'Press Start 2P', monospace;
  font-size: 26px; font-weight: 400;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
}
body.game-gramble .gr-verdict { font-family: 'Press Start 2P', monospace; font-size: clamp(13px, 2vw, 18px); font-weight: 400; }
body.game-gramble .gm-cell { border-radius: 0; }
body.game-gramble #gram-slider { border-radius: 0; }
body.game-gramble #gram-slider::-webkit-slider-thumb { border-radius: 0; }
body.game-gramble #gram-slider::-moz-range-thumb { border-radius: 0; }
body.game-gramble .gram-go {
  border-radius: 0;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.45);
}
body.game-gramble .gram-go:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }

/* reveal: a full-screen weigh-in — the balance IS the moment */
#gram-reveal {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 42%, hsla(var(--gh, 19), 70%, 55%, 0.14), transparent 55%),
    rgba(7, 9, 13, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
#gram-reveal.show { opacity: 1; }
.gr-inner {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%; padding: 0 16px 96px;
}
.gr-item { font-size: clamp(22px, 3.4vw, 30px); font-weight: 800; text-align: center; }
#gr-balance svg {
  width: min(92vw, 640px); height: auto; display: block;
  filter: drop-shadow(0 20px 48px rgba(0, 0, 0, 0.6));
}
.gr-verdict { font-size: clamp(18px, 2.6vw, 24px); font-weight: 800; color: #f0905c; }
.gr-verdict span { color: var(--muted); font-weight: 600; font-size: 0.8em; }

/* ---- the perfect weigh-in turns gold ---- */
.gb-gold {
  filter: brightness(0) invert(0.85) sepia(1) saturate(4.5) hue-rotate(-12deg);
  animation: gb-goldpulse 1.1s ease-in-out infinite alternate;
}
@keyframes gb-goldpulse {
  from { filter: brightness(0) invert(0.85) sepia(1) saturate(4.5) hue-rotate(-12deg) drop-shadow(0 0 2px rgba(245, 200, 76, 0.6)); }
  to   { filter: brightness(0) invert(0.9) sepia(1) saturate(5) hue-rotate(-12deg) drop-shadow(0 0 7px rgba(245, 200, 76, 0.95)); }
}
@keyframes gold-pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.gr-inner { position: relative; }
#gr-sparks { position: absolute; inset: 0; pointer-events: none; }
.gr-spark {
  position: absolute; width: 7px; height: 7px;
  opacity: 0;
  animation: spark-rise 1.7s ease-out forwards;
}
@keyframes spark-rise {
  0% { opacity: 0; transform: translateY(16px) scale(0.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-74px) scale(1.05); }
}
/* shot clock */
.gram-timer {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px; color: #f3e9d4;
  margin-top: -4px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  font-variant-numeric: tabular-nums;
}
.gram-timer.urgent { color: #e05252; animation: timer-pulse 0.5s ease-in-out infinite alternate; }
@keyframes timer-pulse { from { transform: scale(1); } to { transform: scale(1.3); } }
#alt-screen.gram-urgent::before {
  content: '';
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 46%, rgba(224, 60, 60, 0.5) 100%);
  animation: urgent-vignette 0.75s ease-in-out infinite alternate;
}
@keyframes urgent-vignette { from { opacity: 0.25; } to { opacity: 1; } }

/* score tiers: white → red → purple → gold */
.gr-verdict.tier-white { color: #f3e9d4; }
.gr-verdict.tier-red { color: #e05252; text-shadow: 0 0 10px rgba(224, 82, 82, 0.4), 0 3px 0 rgba(0, 0, 0, 0.55); }
.gr-verdict.tier-purple { color: #b06df0; text-shadow: 0 0 10px rgba(176, 109, 240, 0.45), 0 3px 0 rgba(0, 0, 0, 0.55); }
.gr-verdict.tier-gold {
  color: #f5c84c;
  text-shadow: 0 0 14px rgba(245, 200, 76, 0.55), 0 3px 0 rgba(0, 0, 0, 0.55);
  animation: gold-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* perfect: gold screen flash + ring burst */
#gram-reveal.flash::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255, 235, 170, 0.8), transparent 62%);
  opacity: 0;
  animation: gold-flash 0.6s ease-out forwards;
}
@keyframes gold-flash { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
.gr-burst {
  position: absolute; left: 24%; top: 50%;
  width: 6px; height: 6px; background: #f5c84c;
  opacity: 0;
  animation: burst-fly 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes burst-fly {
  0% { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 0; transform: translate(var(--bx), var(--by)); }
}

.gm-cell.gm-gold { border-color: #f5c84c; box-shadow: 0 0 10px rgba(245, 200, 76, 0.45); }
.gm-cell.gm-gold .gm-fill { background: linear-gradient(90deg, #ffe28a, #e8a93c); }
@media (prefers-reduced-motion: reduce) {
  .gb-gold, .gr-verdict.tier-gold, .gr-spark, .gr-burst, .gram-timer.urgent, #alt-screen.gram-urgent::before { animation: none; }
  .gr-spark, .gr-burst { display: none; }
  #alt-screen.gram-urgent::before { opacity: 0.7; }
}
.gb-beam, .gb-pan {
  transform-box: view-box;
  transition: transform 0.8s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.gb-beam { transform-origin: 160px 36px; }
.gb-glyph { filter: brightness(0) invert(0.94) sepia(0.4); }
.gb-balanced { animation: gb-settle 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s; }
@keyframes gb-settle {
  0% { transform: rotate(6deg); }
  40% { transform: rotate(-3.5deg); }
  70% { transform: rotate(1.5deg); }
  100% { transform: rotate(0deg); }
}

/* calibration landmarks above the slider — a coin to the Eiffel Tower */
.gram-slider-wrap { width: 100%; max-width: 440px; position: relative; padding-top: 30px; }
.gram-marks { position: absolute; top: 0; left: 13px; right: 13px; height: 28px; }
.gram-marks span {
  position: absolute; transform: translateX(-50%);
  font-size: 15px; line-height: 1; text-align: center;
  filter: brightness(0) invert(0.94) sepia(0.4);
  opacity: 0.48;
}
.gram-marks span::after {
  content: ''; display: block;
  width: 1px; height: 6px; margin: 3px auto 0;
  background: rgba(243, 233, 212, 0.35);
}
.gram-slider-cap {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted); margin-top: 7px; letter-spacing: 0.5px;
}

.gram-dial { width: min(330px, 82vw); margin: -4px 0 -10px; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55)); }
.gram-dial svg { display: block; width: 100%; height: auto; }
.gneedle {
  transform-box: view-box;
  transform-origin: 50% 50.7%; /* the hub at (150,142) in the 300×280 viewBox */
  transition: transform 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.gneedle-answer { opacity: 0; transition: transform 0.9s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.3s ease; }

.gram-read { text-align: center; line-height: 1.1; }
.gram-readout {
  font-family: "Avenir Next Condensed", "Arial Narrow", "Avenir Next", sans-serif;
  font-size: 38px; font-weight: 800; color: #f3e9d4;
  font-variant-numeric: tabular-nums;
}
.gram-imperial { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

#gram-slider {
  width: 100%; max-width: 440px;
  appearance: none;
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #2a3240, #3a4556 50%, #2a3240);
  border: 1px solid #435062;
  outline: none; cursor: pointer;
}
#gram-slider::-webkit-slider-thumb {
  appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: #e8743c; border: 3px solid #f3e9d4;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  cursor: grab;
}
#gram-slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: #e8743c; border: 3px solid #f3e9d4;
  cursor: grab;
}
#gram-slider:focus-visible { box-shadow: 0 0 0 3px rgba(232, 116, 60, 0.45); }
#gram-slider:disabled { opacity: 0.6; cursor: default; }
.gram-go { max-width: 440px; }

@media (prefers-reduced-motion: reduce) {
  .gneedle, .gneedle-answer, #alt-photo, .gb-beam, .gb-pan, #gram-reveal { transition: none; }
  .gb-balanced { animation: none; }
}
