:root {
  --ink: #2d2a32;
  --muted: #6f6878;
  --paper: #fffaf1;
  --paper-strong: #fff4d8;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --accent: #ff8fab;
  --accent-strong: #f45c82;
  --mint: #a8e6cf;
  --sky: #bde0fe;
  --sun: #ffd166;
  --lilac: #cdb4db;
  --leaf: #7ac58d;
  --ocean: #bde0fe;
  --land: #fff0b8;
  --line: rgba(45, 42, 50, 0.14);
  --shadow: 0 18px 50px rgba(92, 66, 118, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --globe-keyboard-inset: 0px;
  --globe-visual-bottom: 100vh;
  color-scheme: light dark;
  font-family: Inter, ui-rounded, "Nunito", "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.dark-mode {
  --ink: #f5f1ff;
  --muted: #a8a2b3;
  --paper: #1a1822;
  --paper-strong: #242230;
  --card: rgba(35, 33, 46, 0.86);
  --card-solid: #23212e;
  --line: rgba(245, 241, 255, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
:root.dark-mode body {
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 209, 102, .18), transparent 26rem),
    radial-gradient(circle at 85% 10%, rgba(189, 224, 254, .22), transparent 25rem),
    radial-gradient(circle at 30% 88%, rgba(205, 180, 219, .14), transparent 22rem),
    linear-gradient(180deg, #1f1c28 0%, #1a1822 54%, #181d26 100%);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 209, 102, .42), transparent 26rem),
    radial-gradient(circle at 85% 10%, rgba(189, 224, 254, .64), transparent 25rem),
    radial-gradient(circle at 30% 88%, rgba(205, 180, 219, .35), transparent 22rem),
    linear-gradient(180deg, #fff8e9 0%, #fffaf1 54%, #f8fbff 100%);
  overflow-x: hidden;
}



button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -100px;
  z-index: 1000;
  padding: .7rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  transition: top .2s;
}
.skip-link:focus { top: 1rem; }

.page-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 0 calc(24px + var(--safe-bottom));
}
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 30px rgba(45,42,50,.07);
  backdrop-filter: blur(14px);
  position: sticky;
  top: calc(8px + var(--safe-top));
  z-index: 20;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 10px rgba(244,92,130,.2));
}
.brand strong { display: block; font-size: clamp(1rem, 2.6vw, 1.2rem); letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: .78rem; margin-top: .1rem; }
.top-nav {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.top-nav a, .ghost-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .72rem .95rem;
  color: var(--ink);
  text-decoration: none;
  background: transparent;
}
.top-nav a:hover, .ghost-button:hover { background: var(--paper-strong); border-color: var(--line); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 1.2rem;
  align-items: stretch;
}
.panel, .game-shell, .card {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.panel { padding: clamp(1.2rem, 3vw, 2rem); overflow: hidden; position: relative; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .36rem .7rem;
  border-radius: 999px;
  background: #fff0f4;
  color: #a63556;
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; letter-spacing: -.04em; line-height: 1.04; }
h1 { font-size: clamp(2.2rem, 8vw, 5.2rem); max-width: 12ch; margin: 1rem 0; }
h2 { font-size: clamp(1.7rem, 4vw, 3rem); }
h3 { font-size: clamp(1.1rem, 2.2vw, 1.45rem); }
p { color: var(--muted); line-height: 1.65; }
.lede { font-size: clamp(1.02rem, 2vw, 1.25rem); max-width: 62ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }
.button, .primary-button, .secondary-button, .tiny-button, .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  max-width: 100%;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: .82rem 1.05rem;
  text-decoration: none;
  text-align: center;
  white-space: normal;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  touch-action: manipulation;
}
.button:hover, .primary-button:hover, .secondary-button:hover, .tiny-button:hover, .danger-button:hover { transform: translateY(-1px); }
.primary-button { background: var(--accent); color: white; border-color: rgba(244,92,130,.25); box-shadow: 0 12px 28px rgba(244,92,130,.24); font-weight: 900; }
.secondary-button { background: white; color: var(--ink); font-weight: 800; }
.tiny-button { min-height: 36px; padding: .54rem .75rem; font-size: .88rem; background: white; font-weight: 800; }
.danger-button { background: #fff1f1; color: #9e3343; border-color: rgba(158,51,67,.18); font-weight: 800; }

.mascot-card {
  min-height: 360px;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
}
.mascot-card::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 42% 58% 50% 50%;
  background: linear-gradient(135deg, rgba(255,143,171,.28), rgba(189,224,254,.34));
  z-index: -1;
  transform: rotate(-8deg);
}
.mascot-card svg { width: min(96%, 420px); filter: drop-shadow(0 20px 22px rgba(45,42,50,.12)); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.game-card {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  overflow: hidden;
  position: relative;
}
.game-card::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -42px;
  top: -42px;
  border-radius: 50%;
  background: rgba(255,209,102,.35);
}
.game-card .icon-bubble {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: #fff4d8;
  font-size: 2.1rem;
  margin-bottom: 1rem;
}
.game-card p { flex: 1; }
.pill-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px solid var(--line);
  font-size: .84rem;
  color: var(--muted);
}

.game-shell { padding: clamp(.8rem, 2vw, 1.3rem); }
.game-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}
.game-title-block p { margin: .45rem 0 0; }
.game-title-block h1 {
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  max-width: none;
  margin: .65rem 0 0;
}
.game-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; justify-content: flex-end; }
.select, .input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .75rem .9rem;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.select:focus, .input:focus { border-color: rgba(244,92,130,.45); box-shadow: 0 0 0 4px rgba(255,143,171,.16); }
.select {
  width: auto;
  max-width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232d2a32' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 1.1rem center !important;
  background-size: 1.1rem !important;
  padding-right: 2.75rem !important;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
  margin: .9rem 0;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  padding: .75rem;
}
.stat strong { display: block; font-size: 1.1rem; }
.stat strong, .stat small { overflow-wrap: anywhere; }
.stat small { display: block; color: var(--muted); margin-top: .16rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.play-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}
.play-header h1 {
  font-size: clamp(2.1rem, 5vw, 4rem);
  max-width: none;
  margin: .65rem 0 0;
}
.trade-play-layout {
  display: grid;
  grid-template-columns: minmax(285px, .58fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.play-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.8);
  padding: 1rem;
  position: sticky;
  top: calc(90px + var(--safe-top));
  min-width: 0;
}
.trade-clue {
  display: grid;
  gap: .3rem;
  padding: 1rem;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff7df 0%, #f2fbff 100%);
  border: 1px solid rgba(45,42,50,.1);
}
.trade-clue span,
.trade-clue small {
  color: var(--muted);
  font-weight: 800;
}
.trade-clue span { text-transform: uppercase; font-size: .76rem; letter-spacing: .06em; }
.trade-clue strong {
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  line-height: .98;
  letter-spacing: 0;
}
.guess-form.play-first {
  grid-template-columns: minmax(0, 1fr) auto;
  margin: .85rem 0 .55rem;
}
.typeahead-list {
  display: grid;
  gap: .35rem;
  max-height: 244px;
  overflow: auto;
  padding: .35rem;
  margin: -.2rem 0 .7rem;
  border: 1px solid rgba(45,42,50,.1);
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 30px rgba(45,42,50,.1);
}
.typeahead-list button {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  padding: .55rem .7rem;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 850;
}
.typeahead-list li {
  min-height: 40px;
  border-radius: 12px;
  padding: .55rem .7rem;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}
.typeahead-list li:hover,
.typeahead-list li:focus,
.typeahead-list li.active {
  background: #fff4e7;
  outline: none;
}
.typeahead-list button:hover,
.typeahead-list button:focus {
  background: #fff4e7;
  outline: none;
}
.guess-count {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 850;
  margin: .2rem 0 .7rem;
}
.guess-list.compact {
  max-height: min(34vh, 360px);
  overflow: auto;
  padding-right: .15rem;
}
.guess-row.correct {
  background: #f3fff1;
  border-color: rgba(122,197,141,.34);
}
.trade-data {
  display: grid;
  gap: .75rem;
  min-width: 0;
}
.product-list {
  display: grid;
  gap: .4rem;
}
.product-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto auto;
  gap: .55rem;
  align-items: center;
  min-height: 48px;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.76);
}
.product-row span {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: #fff4d8;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}
.product-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 850;
}
.product-row b {
  font-weight: 950;
  white-space: nowrap;
}
.game-notes {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: .85rem;
  color: var(--muted);
}
.game-notes summary {
  width: fit-content;
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
}
.easter-crew {
  position: relative;
  min-height: 72px;
  margin-top: .75rem;
  overflow: hidden;
  opacity: .78;
  pointer-events: none;
  contain: layout paint;
  mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
}
.easter-buddy {
  position: absolute;
  left: var(--start, 0);
  bottom: .18rem;
  transform: translate3d(0, 0, 0);
  animation: buddy-stroll var(--speed, 8s) cubic-bezier(.25, 1, .5, 1) infinite alternate;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}
.easter-buddy::before,
.easter-buddy::after {
  content: "";
  position: absolute;
  bottom: 0px;
  width: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(45,42,50,.22);
  animation: buddy-footsteps .54s ease-in-out infinite alternate;
}
.easter-buddy::before { left: 16px; }
.easter-buddy::after {
  left: 28px;
  animation-delay: .27s;
}

.buddy-shirt-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 50px;
  height: 62px;
}
.buddy-animal {
  font-size: 26px;
  line-height: 1;
  z-index: 2;
  margin-bottom: -10px;
  animation: buddy-nod 1.08s ease-in-out infinite alternate;
}
.shirt-svg {
  width: 38px;
  height: 38px;
  z-index: 1;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.1));
}
.shirt-text {
  pointer-events: none;
  font-family: inherit;
}

.easter-buddy.mint {
  --shirt-color: #a8e6cf;
  --shirt-text-color: #1e463a;
}
.easter-buddy.sun {
  --shirt-color: #ffd166;
  --shirt-text-color: #4a3705;
}
.easter-buddy.sky {
  --shirt-color: #bde0fe;
  --shirt-text-color: #1b354e;
}
.easter-buddy.rose {
  --shirt-color: #ff8fab;
  --shirt-text-color: #591624;
}
.globe-crew { margin-top: .55rem; }
@keyframes buddy-stroll {
  0% { transform: translate3d(0, 0, 0) rotate(-1deg); }
  25% { transform: translate3d(calc(var(--walk-x, 50px) * .22), -2px, 0) rotate(1deg); }
  50% { transform: translate3d(calc(var(--walk-x, 50px) * .52), 0, 0) rotate(-.8deg); }
  75% { transform: translate3d(calc(var(--walk-x, 50px) * .78), -2px, 0) rotate(.8deg); }
  100% { transform: translate3d(var(--walk-x, 50px), 0, 0) rotate(-1deg); }
}
@keyframes buddy-nod {
  from { transform: translateY(0); }
  to { transform: translateY(-1px); }
}
@keyframes buddy-footsteps {
  from { transform: translateY(0) scaleX(1); opacity: .42; }
  to { transform: translateY(2px) scaleX(.72); opacity: .18; }
}

.trade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, .6fr);
  gap: .9rem;
  align-items: start;
}
.trade-layout > *, .globe-layout > *, .hero > *, .game-grid > * { min-width: 0; }
.treemap-card, .side-card, .map-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
}
.treemap-card { padding: .7rem; }
.treemap-wrap {
  width: 100%;
  aspect-ratio: 900 / 620;
  border-radius: 18px;
  background: #fffaf4;
  overflow: hidden;
  border: 1px solid rgba(45,42,50,.08);
}
.treemap-wrap svg { display: block; width: 100%; height: 100%; }
.treemap-label { pointer-events: none; font-weight: 900; fill: rgba(45,42,50,.86); paint-order: stroke; stroke: rgba(255,255,255,.82); stroke-width: 4px; stroke-linejoin: round; }
.treemap-value { pointer-events: none; font-weight: 700; fill: rgba(45,42,50,.65); paint-order: stroke; stroke: rgba(255,255,255,.7); stroke-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .7rem; }
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: var(--muted);
  padding: .25rem .55rem;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.legend-chip:hover { transform: translateY(-1px); }
.legend-chip.inactive { opacity: .35; }
.legend-dot { width: .72rem; height: .72rem; border-radius: 50%; border: 1px solid rgba(45,42,50,.12); }
.treemap-wrap { position: relative; }
.treemap-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  max-width: 240px;
  padding: .55rem .75rem;
  border-radius: 14px;
  background: rgba(45,42,50,.9);
  color: white;
  font-size: .84rem;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(45,42,50,.2);
  opacity: 0;
  transition: opacity .12s ease;
}
.treemap-tooltip.show { opacity: 1; }
.treemap-wrap svg rect { cursor: pointer; transition: opacity .15s ease; }
.treemap-wrap svg rect.dimmed { opacity: .25; }
.dark-mode .legend-chip { background: rgba(255,255,255,.1); }

.compass {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
}
.compass svg { width: 100%; height: 100%; }

.hint-card {
  border: 1px dashed rgba(45,42,50,.18);
  border-radius: 18px;
  padding: .85rem 1rem;
  background: #fffaf6;
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: .75rem;
}
.hint-card strong { color: var(--ink); }
.dark-mode .hint-card { background: rgba(255,255,255,.06); }

.celebrate-banner {
  background: linear-gradient(135deg, rgba(255,209,102,.22), rgba(122,197,141,.22));
  border: 1px solid rgba(122,197,141,.35);
  border-radius: 16px;
  padding: .7rem .9rem;
  text-align: center;
  display: grid;
  gap: .15rem;
  margin: .6rem 0;
}
.celebrate-banner strong { color: var(--ink); font-size: 1.05rem; }
.celebrate-banner span { color: var(--muted); font-size: .85rem; }
.dark-mode .celebrate-banner {
  background: linear-gradient(135deg, rgba(255,209,102,.14), rgba(122,197,141,.14));
  border-color: rgba(122,197,141,.28);
}

.progress-dots {
  display: flex;
  gap: .35rem;
  margin: .35rem 0 .7rem;
}
.progress-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(45,42,50,.12);
}
.progress-dots span.filled { background: var(--accent); }
.dark-mode .progress-dots span { background: rgba(245,241,255,.18); }
.side-card { padding: 1rem; }
.guess-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; margin: .75rem 0 1rem; }
.hint-card {
  border: 1px dashed rgba(45,42,50,.18);
  border-radius: 18px;
  padding: .8rem;
  background: #fffaf6;
  color: var(--muted);
}
.guess-list { display: grid; gap: .45rem; margin-top: .7rem; }
.guess-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
  padding: .65rem .72rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.guess-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guess-meta { display: flex; flex-wrap: wrap; gap: .4rem; color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.distance-badge { font-weight: 900; font-size: 1.1rem; }
.result-card {
  display: grid;
  gap: .65rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: .9rem;
  background: #f8fff6;
  margin-top: .8rem;
}
.result-card.lost { background: #fff7f7; }
.share-box {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .7rem;
  background: rgba(255,255,255,.9);
  color: var(--ink);
}

.globe-layout {
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1fr);
  gap: .9rem;
}
.control-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 1rem;
}
.control-card .compact-help {
  margin: .55rem 0 .5rem;
}
.globe-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .8rem 0 0;
}
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: #fff4e7;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .25rem;
  gap: .25rem;
  margin: .8rem 0;
}
.segmented button {
  border: 0;
  background: transparent;
  border-radius: 13px;
  min-height: 42px;
  font-weight: 900;
  color: var(--muted);
  min-width: 0;
  padding: .45rem .55rem;
  overflow-wrap: anywhere;
}
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 5px 14px rgba(45,42,50,.08); }
.name-form { display: grid; gap: .55rem; margin: .8rem 0; }
.prompt-card {
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: .25rem;
  border-radius: 20px;
  border: 1px solid rgba(244,92,130,.16);
  background: linear-gradient(135deg, #fff4f8, #fffdf4);
  padding: 1rem;
}
.prompt-card strong { font-size: clamp(1.3rem, 4vw, 2.1rem); letter-spacing: -.03em; }
.progress-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(45,42,50,.08);
  overflow: hidden;
  margin: .8rem 0;
}
.progress-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--accent)); transition: width .3s ease; }
.found-list {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  max-height: 168px;
  overflow: auto;
  padding-right: .2rem;
}
.found-chip {
  border-radius: 999px;
  padding: .3rem .55rem;
  background: #f4fff2;
  border: 1px solid rgba(122,197,141,.22);
  color: #357047;
  font-size: .78rem;
  font-weight: 800;
}
.map-card { position: relative; min-height: 560px; }
.mobile-map-answer { display: none; }
#globe-canvas {
  display: block;
  width: 100%;
  height: min(72vh, 720px);
  min-height: 520px;
  touch-action: none;
  cursor: grab;
}
#globe-canvas:active { cursor: grabbing; }
.map-overlay {
  position: absolute;
  left: .75rem;
  top: .75rem;
  right: .75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .6rem;
  pointer-events: none;
}
.map-help, .zoom-controls {
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
  padding: .55rem .65rem;
  color: var(--muted);
  font-size: .83rem;
  box-shadow: 0 8px 22px rgba(45,42,50,.08);
}
.zoom-controls { display: flex; gap: .35rem; padding: .35rem; }
.zoom-controls button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  font-weight: 1000;
}
.map-tooltip {
  position: absolute;
  left: 50%;
  bottom: .85rem;
  transform: translateX(-50%);
  max-width: calc(100% - 1.5rem);
  border-radius: 999px;
  background: rgba(45,42,50,.86);
  color: white;
  padding: .55rem .85rem;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(45,42,50,.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.map-tooltip.show { opacity: 1; }
#globe-time.timer-low { color: #d93025; }
.dark-mode #globe-time.timer-low { color: #ff8a80; }
.globe-actions:has(#skip-target) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.zoom-controls button { width: 44px; height: 44px; }

.about-doc {
  display: grid;
  gap: 1rem;
}
.about-doc section { padding: 1.2rem; }
.about-doc ul, .about-doc ol { color: var(--muted); line-height: 1.7; }
.about-doc code {
  background: #fff4e7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .08rem .28rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translate(-50%, 18px);
  opacity: 0;
  z-index: 80;
  max-width: min(92vw, 520px);
  border-radius: 999px;
  padding: .75rem 1rem;
  background: rgba(45,42,50,.9);
  color: white;
  box-shadow: 0 14px 40px rgba(45,42,50,.22);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  font-weight: 800;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  padding: 1.1rem .4rem 0;
  font-size: .9rem;
}
.site-footer a { color: var(--ink); font-weight: 800; text-decoration: none; }

.confetti-piece {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 90;
  animation: confetti-fall 900ms ease-in forwards;
}
@keyframes confetti-fall {
  to { transform: translate3d(var(--dx), 100vh, 0) rotate(720deg); opacity: 0; }
}

@media (max-width: 900px) {
  .hero, .trade-layout { grid-template-columns: 1fr; }
  .trade-play-layout, .globe-layout { display: flex; flex-direction: column; }
  .trade-play-layout { align-items: stretch; }
  .trade-play-layout .play-card { order: 1; width: 100%; }
  .trade-play-layout .trade-data { order: 2; width: 100%; }
  .globe-layout .map-card { order: 1; }
  .globe-layout #globe-controls { order: 2; }
  .play-card { position: relative; top: auto; }
  .game-grid { grid-template-columns: 1fr; }
  .site-header { align-items: flex-start; border-radius: 24px; flex-direction: column; }
  .top-nav { justify-content: flex-start; width: 100%; }
  .top-nav a, .ghost-button { padding: .62rem .74rem; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mascot-card { min-height: 260px; }
  .map-card { min-height: 480px; }
  #globe-canvas { min-height: 460px; height: 62vh; }
}
@media (max-width: 560px) {
  .page-shell { width: min(100% - 18px, 1180px); }
  h1 { max-width: 10ch; }
  .play-header { grid-template-columns: 1fr; }
  .play-header h1 { max-width: none; }
  .game-header { flex-direction: column; }
  .globe-game .game-header { margin-bottom: .55rem; }
  .globe-game .game-title-block h1 { font-size: 2rem; margin-top: .45rem; }
  .globe-game .game-toolbar { display: none; }
  .game-toolbar { justify-content: stretch; width: 100%; }
  .select { width: 100%; }
  .guess-form, .guess-form.play-first { grid-template-columns: 1fr; }
  .primary-button, .secondary-button, .danger-button { width: 100%; }
  .hero-actions, .hero-actions > * { width: 100%; }
  .trade-clue strong { font-size: clamp(2rem, 14vw, 3rem); }
  .product-row { grid-template-columns: 2rem minmax(0, 1fr) auto; }
  .product-row b { grid-column: 2 / -1; }
  .stats-row { gap: .45rem; }
  .globe-game .control-card .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; }
  .control-card .compact-help { display: none; }
  .stat { padding: .65rem; }
  .globe-game .control-card .stat { padding: .42rem .35rem; border-radius: 13px; }
  .globe-game .control-card .stat strong { font-size: .92rem; }
  .globe-game .control-card .stat small { font-size: .68rem; }
  .globe-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .35rem;
    margin-top: .62rem;
  }
  .globe-actions .tiny-button,
  .globe-actions .danger-button {
    width: 100%;
    min-height: 36px;
    padding: .42rem .32rem;
    font-size: .76rem;
  }
  .map-overlay { align-items: stretch; flex-direction: column; }
  .zoom-controls { align-self: flex-end; }
  .map-help { font-size: .78rem; }
  .easter-crew { margin-top: .55rem; }
}
@media (max-width: 420px) {
  .stats-row { grid-template-columns: 1fr; }
  .globe-game .control-card .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .game-shell { padding: .8rem; }
  .control-card, .side-card { padding: .85rem; }
  .segmented { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .globe-game.mode-name .map-card {
    min-height: 430px;
  }
  .globe-game.mode-name #globe-canvas {
    height: clamp(430px, 66vh, 600px);
    min-height: 430px;
  }
  .globe-game.mode-name .control-card .name-form {
    display: none;
  }
  .globe-game.mode-name .map-overlay {
    top: calc(.65rem + var(--safe-top));
    bottom: auto;
    align-items: flex-start;
    flex-direction: row;
  }
  .globe-game.mode-name .map-help {
    max-width: min(62vw, 320px);
    font-size: .76rem;
  }
  .globe-game.mode-name .map-tooltip {
    bottom: 5.35rem;
  }
  .globe-game.mode-name .mobile-map-answer {
    position: absolute;
    z-index: 6;
    top: auto;
    bottom: calc(.65rem + var(--safe-bottom));
    left: .65rem;
    right: .65rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .45rem;
    padding: .42rem;
    border: 1px solid rgba(45,42,50,.14);
    border-radius: 18px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 14px 34px rgba(45,42,50,.14);
    backdrop-filter: blur(12px);
  }
  .globe-game.mode-name .mobile-map-answer.is-keyboard-floating {
    position: fixed;
    top: calc(var(--globe-visual-bottom, 100vh) - .65rem - var(--safe-bottom));
    bottom: auto;
    transform: translateY(-100%);
    z-index: 100;
  }
  .globe-game.mode-name.is-keyboard-active {
    backdrop-filter: none;
  }
  .globe-game.mode-name .mobile-map-answer .input {
    min-height: 46px;
    min-width: 0;
    border-radius: 14px;
    padding: .72rem .82rem;
  }
  .globe-game.mode-name .mobile-map-answer .primary-button {
    width: auto;
    min-height: 46px;
    border-radius: 14px;
    padding: .5rem .95rem;
    white-space: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .easter-crew {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .38rem;
    min-height: auto;
    overflow: visible;
    mask-image: none;
  }
  .easter-buddy {
    position: relative;
    left: auto;
    bottom: auto;
    animation: none;
    transform: none;
    will-change: auto;
  }
  .easter-buddy::before,
  .easter-buddy::after,
  .buddy-face {
    animation: none;
  }
}

.dark-mode .secondary-button, .dark-mode .tiny-button {
  background: rgba(255,255,255,.08);
  color: var(--ink);
  border-color: rgba(255,255,255,.12);
}
.dark-mode .secondary-button:hover, .dark-mode .tiny-button:hover {
  background: rgba(255,255,255,.12);
}
.dark-mode .danger-button {
  background: rgba(244, 92, 130, 0.12);
  color: #ff8fab;
  border-color: rgba(244, 92, 130, 0.25);
}
.dark-mode .danger-button:hover {
  background: rgba(244, 92, 130, 0.18);
}

.dark-mode .globe-game.mode-name .mobile-map-answer {
  background: rgba(22, 30, 39, 0.95);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}
.dark-mode .globe-game.mode-name .mobile-map-answer .input {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
  color: var(--ink);
}

/* Trade Flow Accent Themes */
.trade-game.flow-export {
  --accent: #ff8fab;
  --accent-glow: rgba(255, 143, 171, 0.24);
}
.trade-game.flow-import {
  --accent: #3a86c8;
  --accent-glow: rgba(58, 134, 200, 0.24);
}

/* Custom Dataset Picker Styling */
.custom-dataset-picker {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.flow-slider {
  display: inline-flex;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  position: relative;
}
.flow-btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: auto;
}
.flow-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 10px var(--accent-glow);
}
.year-bubble-wrap {
  position: relative;
}
.year-bubble-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  min-width: 72px;
  min-height: auto;
  transition: all 0.2s ease;
}
.year-bubble-btn:hover {
  background: var(--line);
}
.year-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(45, 42, 50, 0.18);
  z-index: 50;
  display: none;
  min-width: 100px;
  padding: 4px;
  backdrop-filter: blur(16px);
}
.year-dropdown.show {
  display: block;
}
.year-option {
  padding: 0.55rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.year-option:hover {
  background: var(--paper-strong);
  color: var(--ink);
}
.year-option.selected {
  background: var(--accent);
  color: white;
}

/* Legend Circular Dot Controls */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.7rem;
  justify-content: center;
}
.legend-dot-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.legend-dot-btn:hover {
  transform: scale(1.18);
}
.legend-dot-btn.active {
  border-color: var(--ink);
  transform: scale(1.18);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.legend-dot-btn.inactive {
  opacity: 0.35;
}

/* Global Dark Mode Accent and Contrast Overrides */
.dark-mode .site-header {
  background: rgba(22, 30, 39, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.dark-mode .play-card {
  background: rgba(22, 30, 39, 0.82);
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .stat {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .pill {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .select, .dark-mode .input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  color: var(--ink);
}
.dark-mode .select option {
  background: #161e27;
  color: var(--ink);
}
.dark-mode .trade-clue {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.08) 0%, rgba(189, 224, 254, 0.08) 100%);
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .guess-row {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .guess-row.correct {
  background: rgba(122, 197, 141, 0.12);
  border-color: rgba(122, 197, 141, 0.25);
}
.dark-mode .result-card {
  background: rgba(122, 197, 141, 0.12);
  border-color: rgba(122, 197, 141, 0.2);
}
.dark-mode .result-card.lost {
  background: rgba(244, 92, 130, 0.12);
  border-color: rgba(244, 92, 130, 0.2);
}
.dark-mode .share-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}
.dark-mode .product-row {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .product-row span {
  background: rgba(255, 255, 255, 0.15);
  color: var(--ink);
}
.dark-mode .typeahead-list {
  background: rgba(22, 30, 39, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.dark-mode .typeahead-list li:hover,
.dark-mode .typeahead-list li:focus,
.dark-mode .typeahead-list li.active,
.dark-mode .typeahead-list button:hover,
.dark-mode .typeahead-list button:focus {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.15s ease;
  margin-left: 0.35rem;
}
.theme-toggle-btn:hover {
  background: var(--paper-strong);
  transform: scale(1.05);
}
.theme-toggle-btn:active {
  transform: scale(0.95);
}
.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.theme-toggle-btn .sun-icon { display: none; }
.theme-toggle-btn .moon-icon { display: block; }

.dark-mode .theme-toggle-btn .sun-icon { display: block; }
.dark-mode .theme-toggle-btn .moon-icon { display: none; }

/* Portrait Treemap Wrapper aspect ratio override */
@media (max-width: 700px) {
  .treemap-wrap {
    aspect-ratio: 600 / 750 !important;
  }
}

/* Dark Mode Contrast Overrides */
.dark-mode input::placeholder {
  color: rgba(255, 255, 255, 0.65) !important;
}
.dark-mode .eyebrow {
  background: rgba(244, 92, 130, 0.18) !important;
  color: #ffb3c7 !important;
}
.dark-mode .hint-card {
  background: rgba(22, 30, 39, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: rgba(255, 255, 255, 0.8) !important;
}
.dark-mode .hint-card strong {
  color: #ffffff !important;
}

/* Consistent premium card backgrounds in Dark Mode */
.dark-mode .play-card,
.dark-mode .treemap-card,
.dark-mode .side-card,
.dark-mode .map-card,
.dark-mode .control-card {
  background: rgba(26, 24, 34, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Customized premium select dropdown chevron in Dark Mode */
.dark-mode .select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f5f1ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>") !important;
  color: var(--ink) !important;
}

/* Explicit Segmented Button styles for light/dark themes */
.segmented {
  background: #fff4e7 !important;
  border: 1px solid rgba(45, 42, 50, 0.14) !important;
}
.segmented button {
  color: #6f6878 !important;
  background: transparent !important;
}
.segmented button.active {
  background: #ffffff !important;
  color: #2d2a32 !important;
  box-shadow: 0 5px 14px rgba(45,42,50,.08) !important;
}
.dark-mode .segmented {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.dark-mode .segmented button {
  color: rgba(255, 255, 255, 0.6) !important;
  background: transparent !important;
}
.dark-mode .segmented button.active {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25) !important;
}

/* Stat Box Contrast in Dark Mode */
.dark-mode .stat {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
.dark-mode .stat strong {
  color: #ffffff !important;
}
.dark-mode .stat small {
  color: rgba(255, 255, 255, 0.65) !important;
}

/* Dark Mode Map Overlays & Zoom Controls */
.dark-mode .map-help,
.dark-mode .zoom-controls {
  background: rgba(30, 28, 38, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: var(--muted) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4) !important;
}
.dark-mode .zoom-controls button {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: var(--ink) !important;
}
.dark-mode .zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}
/* Dark Mode Treemap labels and contrast */
.dark-mode .treemap-wrap {
  background: var(--paper-strong) !important;
  border-color: var(--line) !important;
}
.dark-mode .treemap-label {
  fill: #ffffff !important;
  stroke: rgba(0, 0, 0, 0.75) !important;
}
.dark-mode .treemap-value {
  fill: rgba(255, 255, 255, 0.85) !important;
  stroke: rgba(0, 0, 0, 0.7) !important;
}

/* Dark Mode Legend Dot active border */
.dark-mode .legend-dot-btn.active {
  border-color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.25) !important;
}

/* Dark Mode Primary Button contrast */
.dark-mode .primary-button {
  background: var(--accent-strong) !important;
  color: #ffffff !important;
  border-color: rgba(244, 92, 130, 0.4) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3) !important;
}
.dark-mode .primary-button:hover {
  background: #ff7096 !important;
}

.dark-mode .prompt-card {
  background: linear-gradient(135deg, rgba(244, 92, 130, 0.12) 0%, rgba(22, 30, 39, 0.85) 100%) !important;
  border-color: rgba(244, 92, 130, 0.28) !important;
}
.dark-mode .prompt-card strong {
  color: var(--ink) !important;
}
.dark-mode .prompt-card small,
.dark-mode .prompt-card span {
  color: var(--muted) !important;
}
