:root {
  --forest-950: #102d29;
  --forest-900: #153b34;
  --forest-800: #1d5145;
  --forest-700: #2b6a55;
  --moss: #7da668;
  --fern: #a8c47c;
  --cream: #fff8e8;
  --paper: #f8f1de;
  --orange: #e86f3d;
  --orange-dark: #b94729;
  --gold: #f2be5c;
  --ink: #18332f;
  --muted: #667a70;
  --line: rgba(24, 51, 47, .14);
  --shadow: 0 18px 60px rgba(18, 45, 39, .16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --header-h: 72px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 18%, rgba(242, 190, 92, .13), transparent 24rem),
    radial-gradient(circle at 92% 46%, rgba(125, 166, 104, .14), transparent 28rem),
    var(--paper);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  height: var(--header-h);
  padding: 0 clamp(18px, 4vw, 64px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid rgba(24, 51, 47, .1);
  background: rgba(248, 241, 222, .9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--forest-900);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -.035em;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  padding: 5px;
  display: grid;
  place-items: center;
  color: var(--orange);
  border-radius: 12px;
  background: #fff8e7;
  box-shadow: inset 0 0 0 1px rgba(24, 51, 47, .08);
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.main-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a {
  padding: 9px 13px;
  color: #516a61;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 750;
  text-decoration: none;
  transition: .2s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--forest-900);
  background: rgba(255, 255, 255, .68);
}

.account-chip {
  min-width: 130px;
  padding: 9px 13px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(24, 51, 47, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .65);
  color: var(--forest-800);
  font-size: .78rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: #a69e8b;
  box-shadow: 0 0 0 1px rgba(24, 51, 47, .12);
}

.status-dot.signed-in {
  background: #52ae65;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .65);
}

.nav-toggle span {
  width: 100%;
  height: 2px;
  margin: 4px 0;
  display: block;
  border-radius: 2px;
  background: var(--forest-900);
}

.game-page-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(30px, 5vw, 64px) 0 72px;
}

.game-heading {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--orange-dark);
  font-size: .7rem;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.eyebrow.light {
  color: #ffd896;
}

.game-heading h1,
.page-hero h1,
.auth-copy h1 {
  margin: 0;
  color: var(--forest-950);
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  line-height: .94;
  letter-spacing: -.065em;
}

.heading-copy {
  width: min(410px, 42%);
  margin: 0;
  color: #597168;
  font-size: .96rem;
  line-height: 1.65;
}

.game-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(17, 53, 46, .18);
  border-radius: var(--radius-xl);
  background: var(--forest-950);
  box-shadow: var(--shadow);
}

.game-stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #b7d7b8;
}

#gameCanvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  outline: none;
  touch-action: none;
  cursor: pointer;
}

.game-hud {
  position: absolute;
  z-index: 7;
  inset: 0 0 auto;
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  color: white;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(8, 31, 27, .25);
}

.hud-stat {
  display: flex;
  flex-direction: column;
}

.hud-stat > span {
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .15em;
}

.hud-stat strong {
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: .98;
  letter-spacing: -.06em;
}

.hud-stat small {
  margin-left: 4px;
  font-size: .75rem;
  letter-spacing: 0;
}

.hud-center {
  width: 142px;
  padding-top: 3px;
  text-align: center;
}

.hud-center > span {
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.speed-track {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, .25);
}

.speed-track i {
  width: 4%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #ffca6b;
  transition: width .2s linear;
}

.icon-button {
  width: 39px;
  height: 39px;
  padding: 9px;
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: rgba(20, 59, 51, .28);
  color: white;
  cursor: pointer;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.icon-button svg,
.small-icon-button svg,
.setting-button svg {
  width: 100%;
  height: 100%;
}

.game-overlay {
  position: absolute;
  z-index: 9;
  inset: 0;
  padding: 22px;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  background: rgba(13, 46, 40, .28);
  transition: opacity .28s ease, visibility .28s;
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  pointer-events: none;
}

.game-overlay.visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.start-panel,
.compact-panel {
  width: min(490px, 94%);
  padding: clamp(25px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 28px;
  background: rgba(20, 59, 51, .88);
  color: var(--cream);
  text-align: center;
  box-shadow: 0 24px 70px rgba(8, 28, 25, .32);
}

.start-panel h2,
.compact-panel h2 {
  margin: 0 0 10px;
  font-size: clamp(2.3rem, 6vw, 4.3rem);
  line-height: .95;
  letter-spacing: -.065em;
}

.start-panel > p:not(.eyebrow, .save-hint),
.compact-panel > p:not(.eyebrow) {
  margin: 0 auto 22px;
  max-width: 380px;
  color: rgba(255, 248, 232, .78);
  line-height: 1.55;
}

.mini-fox {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--orange);
  color: #fff3ce;
  font-size: 1.4rem;
  transform: rotate(-7deg);
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  min-height: 48px;
  padding: 13px 19px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  border-radius: 14px;
  background: var(--orange);
  color: white;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(157, 54, 30, .25);
  transition: transform .15s ease, background .15s ease;
}

.primary-button:hover {
  background: #f17843;
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(1px) scale(.99);
}

.primary-button:disabled {
  opacity: .58;
  cursor: wait;
  transform: none;
}

.game-start-button {
  width: min(320px, 100%);
}

kbd {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-bottom-width: 3px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .12);
  font-size: .7rem;
  font-family: inherit;
}

.control-hints {
  margin: 18px auto 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  color: rgba(255, 248, 232, .7);
  font-size: .72rem;
}

.control-hints b {
  color: var(--cream);
}

.save-hint {
  margin: 15px 0 0;
  color: rgba(255, 248, 232, .58);
  font-size: .7rem;
}

.text-button {
  margin-top: 12px;
  padding: 8px 12px;
  background: transparent;
  font-size: .8rem;
  font-weight: 800;
}

.light-button {
  color: rgba(255, 248, 232, .78);
}

.game-over-overlay {
  overflow: auto;
  align-items: center;
}

.game-over-panel {
  width: min(840px, 98%);
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(235px, .85fr) minmax(310px, 1.15fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 26px;
  background: rgba(20, 59, 51, .94);
  color: var(--cream);
  box-shadow: 0 26px 80px rgba(7, 27, 23, .36);
}

.result-summary {
  padding: clamp(22px, 4vw, 38px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.result-summary h2 {
  margin: 0;
  color: white;
  font-size: clamp(3.5rem, 8vw, 6.6rem);
  line-height: .88;
  letter-spacing: -.08em;
}

.result-summary h2 small {
  margin-left: 8px;
  color: #ffd58c;
  font-size: 1.1rem;
  letter-spacing: 0;
}

.result-summary > p:not(.eyebrow, .save-status) {
  margin: 14px 0 17px;
  color: rgba(255, 248, 232, .72);
  font-size: .86rem;
}

.best-line {
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, .12);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  color: rgba(255, 248, 232, .72);
  font-size: .78rem;
}

.best-line strong {
  color: #ffd58c;
}

.save-status {
  min-height: 34px;
  margin: 12px 0 8px;
  color: rgba(255, 248, 232, .66);
  font-size: .7rem;
  line-height: 1.4;
}

.save-status.success {
  color: #bfe29b;
}

.save-status.error {
  color: #ffc49e;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.secondary-button {
  min-height: 41px;
  padding: 10px 14px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 12px;
  color: var(--cream);
  font-size: .78rem;
  font-weight: 850;
}

.leaderboard-card {
  padding: clamp(20px, 3vw, 32px);
  overflow: auto;
  background: var(--cream);
  color: var(--ink);
}

.leaderboard-heading {
  margin-bottom: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.leaderboard-heading h3 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -.035em;
}

.small-icon-button {
  width: 34px;
  height: 34px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--forest-700);
  cursor: pointer;
}

.small-icon-button.loading svg {
  animation: spin .8s linear infinite;
}

.leaderboard-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  list-style: none;
  counter-reset: ranks;
}

.leaderboard-list li:not(.board-loading, .board-empty, .board-error) {
  min-height: 32px;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 8px;
  border-radius: 9px;
  font-size: .76rem;
  counter-increment: ranks;
}

.leaderboard-list li:not(.board-loading, .board-empty, .board-error)::before {
  content: counter(ranks);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(29, 81, 69, .08);
  color: var(--forest-700);
  font-size: .64rem;
  font-weight: 900;
}

.leaderboard-list li:nth-child(1)::before {
  background: #f2be5c;
  color: #5f4316;
}

.leaderboard-list li:nth-child(2)::before {
  background: #d8dfda;
}

.leaderboard-list li:nth-child(3)::before {
  background: #e4a975;
}

.leaderboard-list li:nth-child(odd) {
  background: rgba(29, 81, 69, .035);
}

.board-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-score {
  color: var(--orange-dark);
  font-weight: 900;
}

.board-loading,
.board-empty,
.board-error {
  padding: 28px 10px;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

.board-error {
  color: #9c4c37;
}

.milestone {
  position: absolute;
  z-index: 8;
  top: 26%;
  left: 50%;
  padding: 8px 13px;
  border-radius: 99px;
  background: rgba(255, 248, 232, .9);
  color: var(--orange-dark);
  font-size: .78rem;
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px) scale(.85);
}

.milestone.show {
  animation: milestonePop 1.25s ease both;
}

.game-control-bar {
  min-height: 82px;
  padding: 13px clamp(15px, 2.5vw, 26px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  background: #153b34;
  color: white;
}

.leap-button {
  min-width: 210px;
  padding: 9px 18px 9px 10px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--orange);
  color: white;
  cursor: pointer;
  touch-action: none;
  box-shadow: inset 0 -3px 0 rgba(92, 31, 20, .25);
  transition: transform .1s ease;
}

.leap-button:active,
.leap-button.pressed {
  transform: translateY(2px);
  box-shadow: inset 0 -1px 0 rgba(92, 31, 20, .25);
}

.leap-icon {
  width: 44px;
  height: 44px;
  padding: 9px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
}

.leap-icon svg {
  width: 100%;
  height: 100%;
}

.leap-button > span:last-child {
  display: flex;
  flex-direction: column;
  align-items: start;
}

.leap-button b {
  font-size: .9rem;
  letter-spacing: .08em;
}

.leap-button small {
  color: rgba(255, 255, 255, .72);
  font-size: .62rem;
}

.trail-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, .63);
  font-size: .72rem;
  line-height: 1.4;
}

.tip-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  color: rgba(255, 255, 255, .88);
  font-weight: 900;
}

.quick-settings {
  display: flex;
  gap: 7px;
}

.setting-button {
  min-width: 74px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  color: rgba(255, 255, 255, .58);
  font-size: .58rem;
  cursor: pointer;
}

.setting-button svg {
  width: 18px;
  height: 18px;
}

.setting-button.active {
  border-color: rgba(255, 215, 145, .32);
  background: rgba(255, 215, 145, .12);
  color: #ffdb9a;
}

.feature-strip {
  margin-top: 25px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature-strip article {
  min-height: 120px;
  padding: 25px clamp(16px, 3vw, 30px);
  display: flex;
  gap: 16px;
}

.feature-strip article + article {
  border-left: 1px solid var(--line);
}

.feature-number {
  color: var(--orange);
  font-size: .68rem;
  font-weight: 950;
}

.feature-strip h3 {
  margin: 0 0 7px;
  color: var(--forest-900);
  font-size: .92rem;
}

.feature-strip p {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.5;
}

.page-main {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(38px, 7vw, 82px) 0 90px;
}

.page-hero {
  margin-bottom: clamp(30px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: end;
  gap: 45px;
}

.page-hero h1 {
  max-width: 700px;
}

.page-hero > p,
.page-hero .hero-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .75fr);
  align-items: start;
  gap: 24px;
}

.panel {
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 12px 45px rgba(23, 52, 46, .08);
}

.panel.dark-panel {
  background: var(--forest-900);
  color: var(--cream);
}

.panel-header {
  margin-bottom: 23px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
}

.panel-header h2,
.panel h2 {
  margin: 0;
  color: var(--forest-950);
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  letter-spacing: -.045em;
}

.dark-panel h2 {
  color: white;
}

.panel-header p,
.panel > p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.55;
}

.dark-panel > p,
.dark-panel .panel-header p {
  color: rgba(255, 248, 232, .66);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--forest-800);
  font-size: .74rem;
  font-weight: 850;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(24, 51, 47, .18);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, .82);
  color: var(--ink);
  transition: border .15s ease, box-shadow .15s ease;
}

.field textarea {
  min-height: 145px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(232, 111, 61, .12);
}

.field-help {
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.45;
}

.form-message {
  min-height: 21px;
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.45;
}

.form-message.success {
  color: #34723f;
}

.form-message.error {
  color: #a6402d;
}

.full-button {
  width: 100%;
}

.auth-layout {
  width: min(1050px, calc(100% - 32px));
  min-height: calc(100vh - var(--header-h));
  margin: 0 auto;
  padding: clamp(35px, 7vw, 80px) 0;
  display: grid;
  grid-template-columns: .82fr 1.18fr;
  align-items: center;
  gap: clamp(35px, 7vw, 90px);
}

.auth-copy p:not(.eyebrow) {
  max-width: 430px;
  margin: 22px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-benefits {
  margin: 30px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
  list-style: none;
}

.auth-benefits li {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--forest-800);
  font-size: .82rem;
  font-weight: 750;
}

.check-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(125, 166, 104, .2);
  color: var(--forest-700);
  font-size: .72rem;
}

.auth-card {
  min-height: 450px;
}

.auth-tabs {
  margin-bottom: 28px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 13px;
  background: rgba(29, 81, 69, .07);
}

.auth-tab {
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 850;
  cursor: pointer;
}

.auth-tab.active {
  background: white;
  color: var(--forest-900);
  box-shadow: 0 4px 14px rgba(23, 52, 46, .08);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: grid;
}

.signed-in-card {
  display: none;
}

.signed-in-card.active {
  display: block;
}

.account-avatar {
  width: 74px;
  height: 74px;
  margin-bottom: 23px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: var(--orange);
  color: white;
  font-size: 1.8rem;
  font-weight: 950;
  transform: rotate(-3deg);
}

.account-email {
  margin: 8px 0 25px;
  overflow-wrap: anywhere;
  color: var(--forest-700);
  font-weight: 800;
}

.account-meta {
  margin-bottom: 26px;
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.account-meta div {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, .85);
  font-size: .73rem;
}

.account-meta span {
  color: var(--muted);
}

.danger-button {
  padding: 11px 15px;
  border: 1px solid rgba(166, 64, 45, .22);
  border-radius: 11px;
  background: rgba(166, 64, 45, .06);
  color: #a6402d;
  font-weight: 850;
  cursor: pointer;
}

.score-editor {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.score-editor .primary-button {
  min-height: 47px;
}

.own-score-list {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.score-record {
  padding: 15px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .62);
}

.score-medallion {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(232, 111, 61, .12);
  color: var(--orange-dark);
  font-weight: 950;
}

.score-record strong {
  display: block;
  color: var(--forest-900);
  font-size: 1rem;
}

.score-record small {
  color: var(--muted);
}

.record-actions {
  display: flex;
  gap: 6px;
}

.record-actions button {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--forest-700);
  font-size: .68rem;
  font-weight: 850;
  cursor: pointer;
}

.record-actions .delete-record,
.record-actions .delete-guest-record {
  color: #a6402d;
}

.empty-state {
  padding: 35px 20px;
  border: 1px dashed rgba(24, 51, 47, .2);
  border-radius: 14px;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

.large-board {
  display: grid;
  gap: 6px;
}

.large-board .leaderboard-list li:not(.board-loading, .board-empty, .board-error) {
  min-height: 43px;
  padding: 8px 10px;
  font-size: .82rem;
}

.signin-prompt {
  padding: 25px;
  border-radius: 16px;
  background: rgba(242, 190, 92, .12);
  text-align: center;
}

.signin-prompt h3 {
  margin: 0 0 7px;
}

.signin-prompt p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.5;
}

.note-card {
  padding: 20px;
  border-radius: 16px;
  background: rgba(29, 81, 69, .06);
}

.note-card h3 {
  margin: 0 0 7px;
  font-size: .92rem;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.55;
}

.contact-aside-list {
  margin: 23px 0 0;
  padding: 0;
  display: grid;
  gap: 19px;
  list-style: none;
}

.contact-aside-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
}

.contact-aside-list i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, .1);
  color: #ffd58c;
  font-style: normal;
}

.contact-aside-list b {
  display: block;
  color: white;
  font-size: .8rem;
}

.contact-aside-list span {
  color: rgba(255, 248, 232, .6);
  font-size: .72rem;
  line-height: 1.45;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  width: min(360px, calc(100% - 36px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 13px;
  background: rgba(20, 59, 51, .95);
  color: var(--cream);
  box-shadow: 0 14px 38px rgba(12, 37, 32, .24);
  font-size: .76rem;
  line-height: 1.45;
  animation: toastIn .25s ease both;
}

.toast.error {
  background: rgba(129, 54, 39, .96);
}

.toast.success {
  background: rgba(35, 102, 67, .96);
}

.skeleton-line {
  height: 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(24, 51, 47, .06), rgba(24, 51, 47, .13), rgba(24, 51, 47, .06));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.hidden {
  display: none !important;
}

.account-secondary,
.page-secondary {
  border-color: var(--line);
  color: var(--forest-800);
  background: rgba(255,255,255,.42);
}

.dark-field label {
  color: #fff1cf;
}

.dark-field input {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.1);
  color: white;
}

.dark-field input::placeholder {
  color: rgba(255,255,255,.42);
}

.dark-field .field-help,
.dark-message {
  color: rgba(255,248,232,.58);
}

.dark-message.success {
  color: #bfe29b;
}

.dark-message.error {
  color: #ffc49e;
}

.form-disabled {
  opacity: .62;
}

.trail-divider {
  height: 1px;
  margin: 26px 0;
  background: rgba(255,255,255,.12);
}

.score-note-card {
  background: rgba(255,255,255,.07);
}

.score-note-card h3 {
  color: white;
}

.score-note-card p {
  color: rgba(255,248,232,.62);
}

.score-play-link {
  margin-top: 18px;
}

.score-summary-grid {
  margin: -4px 0 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(24,51,47,.07);
}

.score-summary-grid div {
  padding: 15px;
  background: rgba(255,255,255,.66);
}

.score-summary-grid div + div {
  border-left: 1px solid var(--line);
}

.score-summary-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.score-summary-grid strong {
  color: var(--forest-900);
  font-size: 1.2rem;
}

.owner-board-panel {
  margin-top: 24px;
}

.edit-dialog {
  width: min(480px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: transparent;
}

.edit-dialog::backdrop {
  background: rgba(9,34,29,.64);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.dialog-card {
  position: relative;
  padding: 30px;
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 0 24px 80px rgba(6,27,22,.35);
}

.dialog-card h2 {
  margin: 0;
  color: var(--forest-950);
  letter-spacing: -.04em;
}

.dialog-card > p:not(.eyebrow, .form-message) {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.5;
}

.dialog-card .primary-button {
  margin-top: 12px;
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.consent-line {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.5;
}

.consent-line input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--orange);
}

.contact-success {
  padding: 35px 15px;
  text-align: center;
  outline: none;
}

.contact-success .success-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(81,155,91,.14);
  color: #34723f;
  font-size: 1.5rem;
  font-weight: 950;
}

.contact-success h2 {
  margin: 0;
}

.contact-success > p:not(.eyebrow) {
  max-width: 440px;
  margin: 12px auto 24px;
  color: var(--muted);
  line-height: 1.6;
}

.contact-success-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.contact-safety-note {
  margin-top: 28px;
  padding-top: 20px;
  display: grid;
  gap: 4px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.contact-safety-note strong {
  color: #ffd58c;
  font-size: .78rem;
}

.contact-safety-note span {
  color: rgba(255,248,232,.56);
  font-size: .7rem;
  line-height: 1.45;
}

@keyframes milestonePop {
  0% { opacity: 0; transform: translate(-50%, 15px) scale(.85); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  75% { opacity: 1; transform: translate(-50%, -4px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -25px) scale(.95); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

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

@media (max-width: 840px) {
  .site-header {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
  }

  .nav-toggle {
    display: block;
    justify-self: end;
    order: 2;
  }

  .account-chip {
    display: none;
  }

  .main-nav {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    right: 16px;
    width: min(260px, calc(100% - 32px));
    padding: 10px;
    display: grid;
    visibility: hidden;
    opacity: 0;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--cream);
    box-shadow: var(--shadow);
    transform: translateY(-8px);
    transition: .18s ease;
  }

  .main-nav.open {
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  .main-nav a {
    padding: 12px 14px;
  }

  .game-heading,
  .page-hero {
    grid-template-columns: 1fr;
    display: grid;
  }

  .heading-copy {
    width: auto;
  }

  .game-over-panel {
    grid-template-columns: .8fr 1.2fr;
  }

  .game-control-bar {
    grid-template-columns: auto 1fr;
  }

  .quick-settings {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .trail-tip {
    display: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    text-align: center;
  }

  .auth-copy p:not(.eyebrow) {
    margin-left: auto;
    margin-right: auto;
  }

  .auth-benefits {
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }
}

@media (max-width: 620px) {
  :root {
    --header-h: 62px;
  }

  .site-header {
    padding: 0 16px;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
  }

  .game-page-main,
  .page-main {
    width: min(100% - 20px, 1100px);
  }

  .game-page-main {
    padding-top: 28px;
  }

  .game-heading {
    gap: 14px;
  }

  .heading-copy {
    font-size: .84rem;
  }

  .game-card {
    border-radius: 22px;
  }

  #gameCanvas {
    aspect-ratio: 4 / 3;
  }

  .game-hud {
    padding: 13px;
  }

  .hud-center {
    width: 100px;
  }

  .game-overlay {
    padding: 10px;
  }

  .start-panel {
    width: min(390px, 95%);
    padding: 24px 18px;
    border-radius: 22px;
  }

  .start-panel h2 {
    font-size: 3rem;
  }

  .start-panel > p:not(.eyebrow, .save-hint) {
    font-size: .82rem;
  }

  .mini-fox,
  .start-panel .eyebrow {
    display: none;
  }

  .control-hints {
    gap: 12px;
  }

  .game-over-overlay {
    align-items: start;
    padding: 8px;
  }

  .game-over-panel {
    width: 100%;
    max-height: none;
    grid-template-columns: 1fr;
    border-radius: 19px;
  }

  .result-summary {
    padding: 18px;
  }

  .result-summary h2 {
    font-size: 3.9rem;
  }

  .result-summary > p:not(.eyebrow, .save-status) {
    margin: 8px 0 10px;
  }

  .save-status {
    min-height: 25px;
    margin: 8px 0 5px;
  }

  .result-actions {
    grid-template-columns: 1fr 1fr;
  }

  .leaderboard-card {
    padding: 17px;
  }

  .leaderboard-list {
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
  }

  .leaderboard-list li:not(.board-loading, .board-empty, .board-error) {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    padding: 4px;
    font-size: .65rem;
  }

  .board-loading,
  .board-empty,
  .board-error {
    grid-column: 1 / -1;
  }

  .game-control-bar {
    min-height: 76px;
    padding: 10px;
    grid-template-columns: 1fr auto;
    gap: 9px;
  }

  .leap-button {
    min-width: 0;
    width: 100%;
  }

  .setting-button {
    min-width: 48px;
    padding: 7px;
  }

  .setting-button span {
    display: none;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

  .feature-strip article {
    min-height: 0;
    padding: 20px 8px;
  }

  .feature-strip article + article {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .page-hero {
    margin-bottom: 28px;
    gap: 18px;
  }

  .form-row,
  .score-editor {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 21px 17px;
  }

  .auth-layout {
    width: min(100% - 20px, 1050px);
    padding: 32px 0 60px;
    gap: 30px;
  }

  .auth-copy h1 {
    font-size: 2.7rem;
  }

  .score-record {
    grid-template-columns: auto 1fr;
  }

  .record-actions {
    grid-column: 1 / -1;
    justify-content: end;
  }

  .score-summary-grid {
    grid-template-columns: 1fr;
  }

  .score-summary-grid div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .contact-success-actions {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}