:root {
  --game-ink: #1a3d2e;
  --game-paper: rgba(255, 252, 248, 0.96);
  --game-accent: #2d9a5c;
  --game-accent-dark: #1f7a47;
  --game-accent-soft: #d4f5e0;
  --game-sky: #7dd3fc;
  --game-meadow: #86efac;
  --game-meadow-dark: #4ade80;
  --game-yellow: #fbbf24;
  --game-coral: #f59e0b;
  --game-font: "Nunito", "Manrope", system-ui, sans-serif;
  --game-display: "Fredoka", "Syne", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--game-font);
  color: var(--game-ink);
  background: #fffef9;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(251, 191, 36, .12) 0 2.5rem, transparent 2.6rem),
    radial-gradient(circle at 92% 18%, rgba(134, 239, 172, .18) 0 3rem, transparent 3.1rem),
    radial-gradient(circle at 85% 88%, rgba(251, 191, 36, .1) 0 2rem, transparent 2.1rem);
}

body.is-setup,
body.is-playing {
  background: #0b1412;
}

body.game-body {
  position: relative;
}

body.is-setup .game-camera,
body.is-playing .game-camera {
  opacity: 1;
  visibility: visible;
  object-fit: contain;
  background: #0b1412;
}

.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.game-overlay > * {
  pointer-events: auto;
}

.game-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem;
}

.game-brand {
  display: grid;
  gap: .15rem;
}

.game-badge {
  display: inline-flex;
  width: fit-content;
  margin: 0;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: rgba(45, 154, 92, 0.92);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.game-badge-card {
  margin: 0 auto .5rem;
}

.game-logo {
  font-family: var(--game-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.45);
  margin: 0;
  line-height: 1.2;
}

.game-stats-play {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .55rem;
  align-items: stretch;
  padding: 0 .65rem calc(.65rem + env(safe-area-inset-bottom));
  margin-top: auto;
}

.stat-pill-squats {
  min-height: 7.5rem;
}

.stat-pill-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .85rem .65rem 1rem;
  border-radius: 1.15rem;
  border-width: 3px;
  min-height: 7.5rem;
}

.stat-pill-label {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #6b7a74;
}

.stat-pill strong {
  color: var(--game-coral);
  font-size: 1rem;
}

.stat-pill-big strong {
  font-family: var(--game-display);
  font-size: 4.25rem;
  line-height: .95;
  color: var(--game-coral);
}

.game-btn-finish {
  align-self: stretch;
  min-width: 6.5rem;
  padding: .75rem .85rem;
  border-radius: 1.15rem;
  border: 0;
  background: linear-gradient(180deg, #f06a55, var(--game-coral));
  color: #fff;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 8px 0 #b84332, 0 12px 24px rgba(224, 90, 69, .28);
}

.game-btn-finish:active {
  transform: scale(.98);
}

.stat-pill {
  background: var(--game-paper);
  border: 2px solid rgba(255,255,255,.65);
  border-radius: 1rem;
  padding: .35rem .75rem;
  font-size: .82rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

.btn-back-hub {
  appearance: none;
  border: 2px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.85);
  color: var(--game-ink);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.game-top-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

.btn-sound {
  appearance: none;
  border: 2px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.85);
  color: var(--game-ink);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.btn-sound.is-muted {
  opacity: .85;
}

.setup-top .btn-sound {
  margin-left: auto;
}

.game-panel-hub {
  background: linear-gradient(165deg, rgba(29, 79, 140, .88), rgba(8, 18, 16, .82));
}

.hub-success {
  margin-top: 1rem;
  padding: .75rem .9rem;
  border-radius: 1rem;
  background: #fff8e8;
  border: 2px solid #fde68a;
  text-align: left;
}

.hub-success p {
  margin: 0;
  color: var(--game-ink);
  font-size: .9rem;
  line-height: 1.45;
}

.hub-success strong {
  color: var(--game-coral);
}

.camera-gate {
  margin-top: 1rem;
  padding: .9rem;
  border-radius: 1rem;
  background: #f4f8fc;
  border: 2px solid #dceeff;
  text-align: left;
}

.camera-gate-head {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-bottom: .75rem;
}

.camera-gate-ico {
  font-size: 1.5rem;
  line-height: 1;
}

.camera-gate-head strong {
  display: block;
  font-size: .95rem;
}

.camera-gate-sub {
  margin: .15rem 0 0;
  font-size: .82rem;
  color: #6b7a74;
}

.game-btn-camera {
  width: 100%;
}

.game-btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

.camera-status {
  margin: .55rem 0 0;
  font-size: .82rem;
  line-height: 1.4;
  color: #6b7a74;
}

.camera-status.bad {
  color: #b42318;
}

.camera-status.ok {
  color: #0f766e;
}

.game-hint-wrap {
  padding: 0 .85rem;
  display: flex;
  justify-content: center;
}

.game-hint {
  max-width: 22rem;
  text-align: center;
  background: var(--game-paper);
  border-radius: 1.25rem;
  padding: .85rem 1.1rem;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 12px 32px rgba(0,0,0,.22);
  border: 3px solid #fff;
  transition: transform .2s ease, background .2s ease;
}

.game-hint[data-mood="happy"] {
  background: #fff8e8;
  transform: scale(1.02);
}

.game-hint[data-mood="active"] {
  background: #e8f2ff;
}

.game-board {
  margin: 0 .65rem .85rem;
  background: linear-gradient(180deg, #fffef9 0%, #f3efe4 100%);
  border: 4px solid #fff;
  border-radius: 1.35rem;
  padding: .85rem .75rem 1.35rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
  position: relative;
  overflow: visible;
}

.track-label {
  margin: 0 0 .55rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b7a74;
  text-align: center;
}

.track-cells {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: .25rem;
  position: relative;
  min-height: 3.2rem;
  align-items: center;
}

.track-cell {
  aspect-ratio: 1;
  border-radius: .65rem;
  background: #e8efe9;
  border: 2px dashed #c5d4cc;
  display: grid;
  place-items: center;
  font-size: .75rem;
}

.track-cell.is-start {
  background: #e3f0ff;
  border-style: solid;
  border-color: var(--game-accent);
}

.track-cell.is-finish {
  background: #fff4d6;
  border: 2px solid var(--game-yellow);
}

.track-dot,
.finish-star {
  font-size: .95rem;
  line-height: 1;
}

.game-hero {
  position: absolute;
  bottom: .15rem;
  width: 3rem;
  height: 3rem;
  margin-left: -1.5rem;
  display: grid;
  place-items: center;
  font-size: 2rem;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.25));
  z-index: 3;
}

.game-panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(8, 18, 16, .72);
  backdrop-filter: blur(8px);
}

[data-screen][hidden],
.setup-screen[hidden] {
  display: none !important;
}

.game-camera {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.game-card-wide {
  width: min(26rem, 100%);
}

.game-card {
  width: min(24rem, 100%);
  background: #fffef9;
  border-radius: 1.5rem;
  padding: 1.5rem 1.35rem;
  text-align: center;
  border: 4px solid #fff;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

.game-card h1 {
  font-family: var(--game-display);
  font-size: 1.65rem;
  margin: .35rem 0 .5rem;
  line-height: 1.15;
}

.game-card p {
  margin: 0;
  color: #5f6b66;
  font-size: .95rem;
  line-height: 1.5;
}

.game-lead {
  margin-top: .35rem !important;
}

.game-note {
  margin-top: .75rem !important;
  font-size: .82rem !important;
  color: #7a8680 !important;
}

.contest-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin-top: 1rem;
}

.contest-stat {
  background: var(--game-accent-soft);
  border: 2px solid #fff;
  border-radius: 1rem;
  padding: .65rem .5rem;
}

.contest-stat-label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5f6b66;
  margin-bottom: .2rem;
}

.contest-stat strong {
  font-family: var(--game-display);
  font-size: 1.65rem;
  color: var(--game-accent);
  line-height: 1;
}

.game-emoji {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: .25rem;
}

.game-actions {
  display: grid;
  gap: .55rem;
  margin-top: 1.15rem;
}

.game-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: .85rem 1.1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.game-btn:active {
  transform: scale(.98);
}

.game-btn-primary {
  background: linear-gradient(180deg, #4ade80, var(--game-accent));
  color: #fff;
  box-shadow: 0 8px 0 var(--game-accent-dark), 0 14px 28px rgba(45, 154, 92, .28);
}

.game-btn-ghost {
  background: #eef2ef;
  color: var(--game-ink);
}

.game-loading {
  font-weight: 700;
  color: #fff;
  font-size: 1.1rem;
  margin: 0;
}

.loading-box {
  text-align: center;
  max-width: 20rem;
  padding: 0 1rem;
}

.loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto .85rem;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loading-spin .85s linear infinite;
}

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

.loading-hint {
  margin: .65rem 0 0;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  line-height: 1.4;
}

.loading-error {
  margin: 1rem 0 0;
  padding: .75rem .9rem;
  border-radius: .85rem;
  background: rgba(180, 35, 24, .25);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: .88rem;
  line-height: 1.45;
  text-align: left;
}

.loading-back {
  margin-top: 1rem;
  width: 100%;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10%;
  width: .55rem;
  height: .85rem;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

.player-gate {
  margin-top: 1rem;
  text-align: left;
}

.field-label {
  display: block;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5f6b66;
  margin-bottom: .35rem;
}

.player-input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid #dceeff;
  border-radius: 0;
  padding: .55rem 0;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--game-ink);
  background: transparent;
}

.player-input:focus {
  outline: none;
  border-bottom-color: var(--game-accent);
}

.player-hint {
  margin: .4rem 0 0;
  font-size: .82rem;
  color: #b42318;
}

.hub-agree {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: 0 0 .55rem;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.4;
  color: #4a6358;
  cursor: pointer;
}

.hub-agree input {
  margin-top: .2rem;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  accent-color: var(--game-accent);
}

.hub-agree-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--game-accent-dark);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .3rem;
  margin: 0 0 .85rem;
  padding: .25rem;
  border-radius: 999px;
  background: var(--game-accent-soft);
}

.auth-mode-tab {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: .55rem .4rem;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 800;
  color: #5f6b66;
  background: transparent;
  cursor: pointer;
}

.auth-mode-tab.is-active {
  background: #fff;
  color: var(--game-accent-dark);
  box-shadow: 0 3px 10px rgba(45, 154, 92, .16);
}

.auth-form {
  margin: 0;
}

.auth-guest-hint {
  display: block;
  margin: 1.35rem 0 0.35rem;
  padding: 0.65rem 0.25rem 0.25rem;
  clear: both;
  position: relative;
  z-index: 0;
}

.hub-auth-badge {
  margin: 0 0 .75rem;
  padding: .45rem .6rem;
  border-radius: .7rem;
  background: var(--game-accent-soft);
  font-size: .88rem;
  font-weight: 700;
  color: #3d5c4a;
}

.hub-auth-badge strong {
  color: var(--game-accent-dark);
}

.hub-register-status {
  margin: 0 0 .75rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--game-accent-dark);
}

.hub-register-status.is-error,
.player-hint.is-error {
  color: #b42318;
}

.terms-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 40, 30, .45);
}

.terms-modal[hidden] {
  display: none !important;
}

.terms-dialog {
  width: min(100%, 26rem);
  max-height: min(82vh, 36rem);
  overflow: auto;
  background: #fffef9;
  border-radius: 1rem;
  padding: 1.1rem 1rem 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}

.terms-title {
  margin: 0 0 .65rem;
  font-family: var(--game-display);
  font-size: 1.2rem;
  color: var(--game-accent-dark);
}

.terms-body {
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.45;
  color: #4a6358;
  margin-bottom: .9rem;
}

.terms-body p {
  margin: 0 0 .65rem;
}

.terms-body ol {
  margin: 0 0 .65rem;
  padding-left: 1.15rem;
}

.terms-body li {
  margin-bottom: .4rem;
}

.terms-version {
  font-size: .75rem;
  color: #7a9488;
}

.setup-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.setup-screen > * {
  pointer-events: auto;
}

.setup-panel {
  margin: 0 .75rem calc(.75rem + env(safe-area-inset-bottom));
  padding: 1rem;
  border-radius: 1.25rem;
  background: var(--game-paper);
  border: 3px solid #fff;
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
}

.setup-top {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .75rem;
}

.setup-title {
  margin: 0;
  font-family: var(--game-display);
  font-size: 1rem;
  font-weight: 700;
}

.setup-guide {
  padding: .85rem;
  border-radius: 1rem;
  background: #eef6ff;
  border: 2px solid #dceeff;
  text-align: center;
  transition: background .2s, border-color .2s;
}

.setup-guide[data-ready="1"] {
  background: #e8faf3;
  border-color: #6ee7b7;
}

.setup-figure {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: .35rem;
}

.setup-guide-text {
  margin: 0;
  font-size: .9rem;
  font-weight: 700;
  color: #5f6b66;
}

.setup-status {
  margin: .65rem 0 0;
  font-size: .95rem;
  font-weight: 800;
  text-align: center;
  color: var(--game-ink);
}

.setup-status.ok {
  color: #0f766e;
}

.setup-countdown {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.setup-countdown span {
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  border: 6px solid var(--game-coral);
  display: grid;
  place-items: center;
  font-family: var(--game-display);
  font-size: 5rem;
  font-weight: 700;
  color: var(--game-coral);
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
  animation: countdown-pop .35s ease;
  text-shadow: 0 2px 0 rgba(255,255,255,.8);
}

@keyframes countdown-pop {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.setup-boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(8, 18, 16, .72);
  backdrop-filter: blur(8px);
}

.setup-boot[hidden] {
  display: none;
}

.setup-boot-card {
  text-align: center;
  padding: 0 1rem;
  max-width: 20rem;
}

.setup-boot-card p {
  margin: .75rem 0 0;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.game-panel-results {
  background: linear-gradient(165deg, rgba(29, 79, 140, .88), rgba(8, 18, 16, .82));
}

.results-card {
  width: min(24rem, 100%);
  background: #fffef9;
  border-radius: 1.5rem;
  padding: 1.5rem 1.35rem;
  text-align: center;
  border: 4px solid #fff;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

.results-banner {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: .25rem;
}

.results-label {
  margin: 0;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b7a74;
}

.results-title {
  font-family: var(--game-display);
  font-size: 1.45rem;
  margin: .35rem 0 .85rem;
  line-height: 1.2;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  margin-bottom: .75rem;
}

.results-stat {
  background: var(--game-accent-soft);
  border-radius: .85rem;
  padding: .55rem .35rem;
}

.results-stat-label {
  display: block;
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7a74;
  margin-bottom: .15rem;
}

.results-stat strong {
  font-family: var(--game-display);
  font-size: 1.35rem;
  color: var(--game-accent);
  line-height: 1;
}

.results-note {
  margin: 0 0 1rem;
  font-size: .88rem;
  color: #6b7a74;
}

/* ——— Fullscreen white hub ——— */
.hub-shell,
.results-shell {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: #fffef9;
  color: var(--game-ink);
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
  overflow: hidden;
  max-width: 32rem;
  margin: 0 auto;
  left: 0;
  right: 0;
}

.hub-header {
  text-align: center;
  padding: .35rem 0 .25rem;
}

.hub-org-name {
  margin: .2rem 0 0;
  font-family: var(--game-font);
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.38;
  color: var(--game-ink);
  text-wrap: balance;
}

.hub-kicker {
  margin: .15rem 0 0;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--game-accent);
}

.hub-title {
  margin: .45rem 0 0;
  font-family: var(--game-display);
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--game-accent-dark);
  font-weight: 700;
}

.hub-subtitle {
  margin: .35rem 0 0;
  font-size: .88rem;
  font-weight: 700;
  color: #5f7a6a;
  line-height: 1.35;
}

.hub-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  margin: .65rem 0 .75rem;
  padding: .3rem;
  border-radius: 999px;
  background: var(--game-accent-soft);
  flex-shrink: 0;
}

.hub-tabs-4 {
  grid-template-columns: repeat(4, 1fr);
}

.hub-tabs-4 .hub-tab {
  font-size: .78rem;
  padding: .55rem .2rem;
}

.hub-shell.is-meadow-focus {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.hub-shell.is-meadow-focus .hub-header,
.hub-shell.is-meadow-focus .hub-footer {
  display: none;
}

.hub-shell.is-meadow-focus .hub-tabs {
  margin-top: .25rem;
  margin-bottom: .35rem;
  margin-left: 1rem;
  margin-right: 1rem;
}

.hub-shell.is-meadow-focus .hub-tab {
  font-size: .82rem;
  padding: .58rem .35rem;
}

.hub-panel[data-hub-panel="progress"] {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.hub-panel[data-hub-panel="table"] {
  min-height: 0;
  overflow: auto;
}

.hub-tab {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: .65rem .5rem;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 800;
  color: #5f6b66;
  background: transparent;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}

.hub-tab.is-active {
  background: #fff;
  color: var(--game-accent-dark);
  box-shadow: 0 4px 14px rgba(45, 154, 92, .18);
}

.hub-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.hub-panel[hidden] {
  display: none !important;
}

.hub-lead {
  margin: 0 0 .85rem;
  color: #5f6b66;
  font-size: .92rem;
  line-height: 1.45;
}

.hub-field {
  margin-bottom: .85rem;
}

.hub-field-row {
  display: grid;
  grid-template-columns: 1fr 6.5rem;
  gap: .55rem;
  margin-bottom: .85rem;
}

.field-optional {
  font-weight: 700;
  font-size: .72rem;
  color: #8aa396;
  text-transform: none;
  letter-spacing: 0;
}

.player-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b8f7a 50%), linear-gradient(135deg, #6b8f7a 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.6rem;
}

.hub-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin-bottom: .35rem;
}

.hub-metric {
  position: relative;
  padding: .55rem 0;
  border-top: 3px solid var(--game-accent-soft);
}

.hub-metric-unit {
  margin-left: .2rem;
  font-size: .95rem;
}

.hub-metrics-note {
  margin: 0 0 1rem;
  font-size: .78rem;
  font-weight: 700;
  color: #7a9488;
  text-align: center;
}

.hub-metric-label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7a74;
}

.hub-metric strong {
  font-family: var(--game-display);
  font-size: 1.85rem;
  color: var(--game-accent);
  line-height: 1.1;
}

.hub-section {
  margin-bottom: 1rem;
  padding-top: .85rem;
  border-top: 1px solid #e8efe9;
}

.hub-section-title {
  margin: 0 0 .55rem;
  font-size: .95rem;
  font-weight: 800;
}

.hub-actions {
  display: grid;
  gap: .55rem;
  margin-top: .5rem;
  margin-bottom: .35rem;
}

.hub-panel[data-hub-panel="account"] .hub-actions .game-btn-primary {
  margin-bottom: .35rem;
}

.hub-footer {
  margin: .75rem 0 0;
  text-align: center;
  font-size: .78rem;
  color: #8a9690;
}

.hub-footer p {
  margin: 0;
  line-height: 1.45;
}

.hub-footer-dev {
  margin: 0 !important;
  font-size: .72rem;
}

.hub-footer a {
  color: var(--game-accent);
  font-weight: 800;
  text-decoration: none;
}

.hub-footer a:hover {
  text-decoration: underline;
}

.game-btn-outline {
  background: transparent;
  color: var(--game-accent);
  border: 2px solid #a7e3bf;
}

/* ——— Meadow / daisies ——— */
.meadow-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .45rem .65rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, .72) 70%, transparent 100%);
  pointer-events: none;
}

.meadow-toolbar > * {
  pointer-events: auto;
}

.meadow-caption {
  margin: 0;
  flex: 1;
  text-align: left;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.35;
  color: #3d5c4a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}

.meadow-zoom {
  display: inline-flex;
  gap: .25rem;
  flex-shrink: 0;
}

.meadow-zoom-btn {
  width: 2rem;
  height: 2rem;
  border: 2px solid #a7e3bf;
  border-radius: 999px;
  background: #fff;
  color: var(--game-accent-dark);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.meadow-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background: #7dd3fc;
}

.meadow-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.meadow-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom, 0);
  z-index: 3;
  margin: 0;
  padding: .35rem .65rem .55rem;
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  pointer-events: none;
}

.progress-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid #e8efe9;
  padding-top: .35rem;
}

.table-rank-note {
  margin: 0 0 .35rem;
}

.table-mode-tabs {
  display: flex;
  gap: .4rem;
  margin: 0 0 .45rem;
}

.table-mode-tab {
  flex: 1;
  border: 1px solid #d5e5da;
  background: #f7fbf8;
  color: #4a6356;
  border-radius: 999px;
  padding: .45rem .55rem;
  font-family: var(--game-font);
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}

.table-mode-tab.is-active {
  background: var(--game-accent);
  border-color: var(--game-accent);
  color: #fff;
}

.group-rank-block {
  margin: 0 0 1rem;
}

.group-rank-block:last-child {
  margin-bottom: .25rem;
}

.group-rank-title {
  margin: 0 0 .35rem;
  font-family: var(--game-font);
  font-size: .92rem;
  font-weight: 800;
  color: var(--game-ink);
}

.progress-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.progress-table th,
.progress-table td {
  padding: .55rem .35rem;
  text-align: left;
  border-bottom: 1px solid #eef2ef;
}

.progress-table th {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7a74;
}

.progress-table tr.is-me {
  background: #ecfdf3;
}

.progress-table tr.is-me td {
  color: var(--game-accent-dark);
  font-weight: 800;
}

.parent-tips {
  margin: 0 0 .85rem;
  padding: .55rem .7rem;
  border-radius: 12px;
  background: #f3faf5;
  border: 1px solid #d8eee0;
}

.parent-tips-summary {
  cursor: pointer;
  font-family: var(--game-font);
  font-size: .86rem;
  font-weight: 800;
  color: var(--game-accent-dark);
  list-style: none;
}

.parent-tips-summary::-webkit-details-marker {
  display: none;
}

.parent-tips-summary::before {
  content: '▸ ';
}

.parent-tips[open] .parent-tips-summary::before {
  content: '▾ ';
}

.parent-tips-list {
  margin: .55rem 0 0;
  padding: 0 0 0 1.1rem;
  font-size: .8rem;
  line-height: 1.45;
  color: #3d5348;
}

.parent-tips-list li {
  margin: 0 0 .35rem;
}

.parent-tips-list li:last-child {
  margin-bottom: 0;
}

/* ——— Fullscreen white results ——— */
.results-shell {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.results-shell .results-banner {
  font-size: 3.5rem;
  line-height: 1;
}

.results-shell .results-title {
  font-family: var(--game-display);
  font-size: 1.55rem;
  margin: .35rem 0 1rem;
}

.results-shell .results-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
  width: 100%;
  max-width: 22rem;
  margin-bottom: .75rem;
}

.results-shell .results-stat {
  background: transparent;
  border-top: 3px solid var(--game-accent-soft);
  border-radius: 0;
  padding: .5rem .25rem;
}

.results-shell .hub-actions {
  width: 100%;
  max-width: 22rem;
}

@keyframes traveler-walk {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes leader-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-4deg); }
}

@keyframes shadow-pulse {
  0%, 100% { transform: scaleX(1); opacity: .85; }
  50% { transform: scaleX(.82); opacity: .55; }
}



@media (max-width: 420px) {
  .track-cells {
    gap: .15rem;
  }
  .game-hero {
    width: 2.5rem;
    height: 2.5rem;
    margin-left: -1.25rem;
    font-size: 1.65rem;
  }
  .game-hint {
    font-size: .95rem;
  }
  .stat-pill-big strong {
    font-size: 3.6rem;
  }
  .setup-countdown span {
    width: 7.5rem;
    height: 7.5rem;
    font-size: 4.25rem;
  }
  .meadow-viewport {
    min-height: 14rem;
  }
  .hub-field-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 700px) {
  .game-board {
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
  }
}
