:root {
  color-scheme: dark;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --ink: #10253d;
  --ink-deep: #071828;
  --cream: #fff5cf;
  --lime: #99ef63;
  --yellow: #ffd95a;
  --cyan: #5ce8ee;
  --pink: #ff759f;
  --coral: #ff8a57;
  --glass: rgba(8, 27, 47, 0.82);
  --line: rgba(255, 255, 255, 0.58);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #061623;
  touch-action: none;
}

button {
  font: inherit;
}

.game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: #173f5a;
  user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  z-index: 5;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(112px, calc(10px + env(safe-area-inset-right)));
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 9px;
  pointer-events: none;
}

.hud-chip {
  position: relative;
  min-height: 54px;
  padding: 8px 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 18px;
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), transparent 42%),
    linear-gradient(155deg, rgba(10, 51, 73, 0.9), rgba(6, 23, 42, 0.91));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -2px 0 rgba(0, 0, 0, 0.16),
    0 8px 24px rgba(3, 18, 31, 0.23);
  backdrop-filter: blur(11px) saturate(1.2);
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.22);
}

.hud-chip::after {
  position: absolute;
  right: 10px;
  bottom: 3px;
  left: 10px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(92, 232, 238, 0.72), transparent);
  content: "";
  opacity: 0.62;
}

.hud-chip strong {
  display: block;
  font-size: clamp(0.78rem, 1.45vw, 1rem);
  line-height: 1.1;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #ffe179;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.objective-chip {
  justify-self: center;
  min-width: min(42vw, 440px);
  text-align: center;
}

.stats-chip {
  display: flex;
  align-items: center;
  gap: 11px;
}

.stat {
  color: var(--cyan);
  font-size: 1.08rem;
  white-space: nowrap;
}

.stat strong {
  display: inline;
  color: white;
  font-size: 1rem;
}

.coin-stat {
  color: var(--yellow);
}

.ammo-stat {
  color: #ffb46a;
}

.secret-stat {
  color: #d7a9ff;
}

.hearts {
  color: #ff6d83;
  letter-spacing: 0.1em;
}

.top-actions {
  position: absolute;
  z-index: 8;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  color: white;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.19), transparent 36%),
    rgba(7, 29, 49, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 7px 18px rgba(2, 16, 29, 0.27);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.icon-button:active {
  transform: scale(0.94);
}

.notice {
  position: absolute;
  z-index: 9;
  top: 22%;
  left: 50%;
  max-width: min(80vw, 560px);
  padding: 12px 22px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  color: white;
  background:
    linear-gradient(135deg, rgba(92, 232, 238, 0.18), transparent 38%),
    rgba(7, 27, 47, 0.91);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 10px 34px rgba(3, 18, 31, 0.31);
  font-size: clamp(0.88rem, 2vw, 1.08rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -14px) scale(0.96);
  transition: opacity 160ms ease, transform 220ms ease;
}

.notice.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.power-chip {
  position: absolute;
  z-index: 10;
  top: max(78px, calc(70px + env(safe-area-inset-top)));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 13px;
  border: 2px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  color: white;
  background: rgba(54, 42, 92, 0.88);
  box-shadow: 0 7px 20px rgba(6, 22, 38, 0.22);
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  pointer-events: none;
  transform: translateX(-50%);
}

.power-chip[hidden] {
  display: none;
}

.power-chip > span {
  color: var(--yellow);
  font-size: 1.05rem;
}

.touch-controls {
  position: absolute;
  z-index: 7;
  right: max(22px, calc(14px + env(safe-area-inset-right)));
  bottom: max(20px, calc(14px + env(safe-area-inset-bottom)));
  left: max(22px, calc(14px + env(safe-area-inset-left)));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.movement-control {
  position: relative;
  display: grid;
  width: clamp(112px, 17vw, 138px);
  height: clamp(112px, 17vw, 138px);
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.47);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 29%, rgba(255, 255, 255, 0.14), transparent 34%),
    radial-gradient(circle, rgba(9, 39, 61, 0.22) 0 49%, rgba(7, 25, 43, 0.45) 50% 100%);
  box-shadow:
    inset 0 0 0 5px rgba(5, 25, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 28px rgba(2, 19, 33, 0.19);
  opacity: 0.38;
  backdrop-filter: blur(2px) saturate(1.05);
  pointer-events: auto;
  touch-action: none;
  transition: opacity 120ms ease, filter 120ms ease, transform 120ms ease;
}

.movement-control::before,
.movement-control::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.movement-control::before {
  inset: 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.movement-control::after {
  inset: 46%;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 15px rgba(92, 232, 238, 0.38);
}

.movement-glow {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 44%, rgba(92, 232, 238, 0.09) 65%, transparent 69%);
  pointer-events: none;
}

.movement-arrows {
  position: absolute;
  inset: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.64);
  font: 400 clamp(2rem, 5vw, 3rem)/1 system-ui, sans-serif;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.movement-arrows b {
  font-weight: 300;
}

.movement-knob {
  position: relative;
  z-index: 2;
  display: grid;
  width: clamp(48px, 7vw, 58px);
  height: clamp(48px, 7vw, 58px);
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 27%, rgba(255, 255, 255, 0.42), transparent 30%),
    linear-gradient(145deg, rgba(40, 119, 141, 0.86), rgba(8, 44, 70, 0.9));
  box-shadow:
    inset 0 0 0 4px rgba(3, 24, 42, 0.14),
    0 7px 15px rgba(1, 18, 32, 0.32),
    0 0 24px rgba(92, 232, 238, 0.16);
  transform: translate3d(0, 0, 0);
  transition: transform 80ms ease-out, filter 120ms ease;
  will-change: transform;
  pointer-events: none;
}

.movement-knob i {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(92, 232, 238, 0.52);
}

.movement-control.active .movement-knob {
  filter: brightness(1.13) saturate(1.16);
  transition: none;
}

.movement-control.active {
  opacity: 0.82;
  filter: brightness(1.12);
}

.control-button {
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.62);
  color: white;
  background: rgba(11, 33, 55, 0.38);
  box-shadow: inset 0 0 0 4px rgba(7, 25, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 28px rgba(2, 19, 33, 0.2);
  opacity: 0.5;
  backdrop-filter: blur(2px) saturate(1.05);
  pointer-events: auto;
  touch-action: none;
  transition: opacity 120ms ease, filter 120ms ease, transform 120ms ease;
}

.action-controls {
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.6vw, 18px);
  pointer-events: none;
}

.action-controls > button {
  pointer-events: auto;
}

.seed-button {
  display: flex;
  width: clamp(76px, 10vw, 92px);
  height: clamp(76px, 10vw, 92px);
  flex-direction: column;
  gap: 1px;
  border-color: rgba(153, 239, 99, 0.78);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 27%, rgba(255, 255, 255, 0.24), transparent 31%),
    linear-gradient(145deg, rgba(56, 139, 103, 0.7), rgba(21, 70, 73, 0.68));
  color: #f8ffe8;
  font-size: clamp(0.62rem, 1.35vw, 0.76rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 3px rgba(8, 49, 40, 0.5);
}

.seed-icon {
  color: #dfffa2;
  font: 1000 clamp(1.35rem, 2.8vw, 1.75rem)/0.88 "Trebuchet MS", sans-serif;
  transform: scaleX(0.78);
}

.seed-button.charging {
  opacity: 0.9;
  border-color: #fff4a7;
  filter: brightness(1.16);
  box-shadow:
    inset 0 0 0 4px rgba(7, 25, 42, 0.1),
    0 0 26px rgba(155, 237, 96, 0.45);
  transform: scale(0.96);
}

.seed-button.empty {
  filter: grayscale(0.55);
  opacity: 0.42;
}

.jump-button {
  display: flex;
  width: clamp(98px, 15vw, 122px);
  height: clamp(98px, 15vw, 122px);
  flex-direction: column;
  gap: 1px;
  border-color: rgba(255, 234, 128, 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 27%, rgba(255, 255, 255, 0.25), transparent 31%),
    linear-gradient(145deg, rgba(255, 143, 82, 0.69), rgba(198, 71, 69, 0.64));
  color: #fffbe8;
  font-size: clamp(0.76rem, 1.8vw, 0.94rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 3px rgba(76, 28, 35, 0.45);
}

.jump-icon {
  margin-bottom: -2px;
  color: #fff4a7;
  font: 1000 clamp(1.5rem, 3.4vw, 2rem)/0.85 system-ui, sans-serif;
  text-shadow: 0 0 14px rgba(255, 225, 90, 0.62);
}

.control-button.pressed,
.control-button:active {
  opacity: 0.9;
  background:
    radial-gradient(circle at 34% 27%, rgba(255, 255, 255, 0.3), transparent 31%),
    rgba(255, 144, 72, 0.78);
  filter: brightness(1.12);
  transform: scale(0.93);
}

.screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 42%, rgba(72, 174, 166, 0.13), transparent 46%),
    rgba(4, 19, 33, 0.5);
  backdrop-filter: blur(10px) saturate(1.24);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 230ms ease, visibility 230ms ease;
}

.screen.active {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.screen-card {
  position: relative;
  width: min(92vw, 520px);
  padding: clamp(24px, 4vw, 38px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 34px;
  color: var(--cream);
  background:
    radial-gradient(circle at 80% 10%, rgba(92, 232, 238, 0.21), transparent 34%),
    radial-gradient(circle at 8% 90%, rgba(155, 237, 96, 0.11), transparent 35%),
    linear-gradient(150deg, rgba(20, 70, 82, 0.97), rgba(7, 27, 49, 0.985));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -3px 0 rgba(1, 14, 27, 0.28),
    0 28px 90px rgba(1, 13, 25, 0.48),
    0 0 0 7px rgba(7, 31, 50, 0.22);
  text-align: center;
}

.screen-card::before {
  position: absolute;
  top: 0;
  left: 12%;
  width: 76%;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--yellow), transparent);
  content: "";
  opacity: 0.82;
}

.logo-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  color: var(--ink);
  background: radial-gradient(circle at 34% 28%, #fffbd4, var(--yellow) 42%, #e29435 100%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.55), 0 6px 0 rgba(4, 29, 46, 0.3), 0 0 24px rgba(255, 217, 90, 0.2);
  font-size: 2rem;
}

.kicker {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 1000;
  letter-spacing: 0.19em;
}

.screen-card h1 {
  margin: 0;
  color: white;
  font-size: clamp(2.5rem, 8vw, 4.8rem);
  font-weight: 1000;
  letter-spacing: -0.055em;
  line-height: 0.78;
  text-shadow: 0 5px 0 rgba(4, 26, 45, 0.42), 0 10px 28px rgba(2, 19, 34, 0.24);
}

.screen-card h1 span {
  color: var(--lime);
}

.screen-card h2 {
  margin: 6px 0 22px;
  color: white;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1;
}

.level-name {
  margin: 18px 0 10px;
  color: var(--yellow);
  font-size: 1rem;
  font-weight: 1000;
  letter-spacing: 0.13em;
}

.start-copy {
  max-width: 420px;
  margin: 0 auto 18px;
  color: rgba(255, 255, 255, 0.88);
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.42;
}

.control-hints {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.control-hints span {
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  color: white;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(4, 24, 41, 0.34));
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.primary-button,
.secondary-button {
  min-width: 190px;
  min-height: 52px;
  padding: 12px 28px;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.primary-button {
  border: 2px solid white;
  color: var(--ink);
  background: linear-gradient(180deg, #fff48c, var(--yellow) 58%, #efaa40);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.58), 0 7px 0 #b96f2e, 0 12px 24px rgba(2, 18, 31, 0.24);
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 #d2933b;
}

.secondary-button {
  display: block;
  margin: 14px auto 0;
  border: 2px solid rgba(255, 255, 255, 0.45);
  color: white;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.13);
}

.compact-card {
  width: min(88vw, 430px);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 0 24px;
}

.adventure-results {
  grid-template-columns: repeat(3, 1fr);
}

.results-grid div {
  padding: 13px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: rgba(5, 24, 41, 0.28);
}

.results-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.results-grid strong {
  color: white;
  font-size: 1.06rem;
}

.finish-mark {
  background: var(--lime);
}

.map-card {
  width: min(94vw, 900px);
}

.map-route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 8px 0 24px;
}

.map-fox {
  position: absolute;
  z-index: 3;
  top: -17px;
  left: var(--map-position, 10%);
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 50%;
  background: rgba(16, 39, 62, .92);
  box-shadow: 0 5px 14px rgba(3,18,31,.35);
  font-size: 1.1rem;
  pointer-events: none;
  transform: translateX(-50%);
  transition: left 900ms cubic-bezier(.2,.8,.2,1), top 900ms cubic-bezier(.2,.8,.2,1);
}

.chapter-screen {
  z-index: 24;
  background:
    radial-gradient(circle at 50% 45%, rgba(155,237,96,.18), transparent 46%),
    rgba(4, 19, 33, .76);
}

.chapter-card {
  width: min(92vw, 760px);
  padding: clamp(22px, 5vw, 48px);
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 32px;
  color: white;
  background:
    linear-gradient(135deg, rgba(92,232,238,.13), transparent 38%),
    linear-gradient(155deg, rgba(24,90,82,.97), rgba(7,27,49,.98));
  box-shadow: inset 0 1px rgba(255,255,255,.24), 0 28px 90px rgba(1,13,25,.48);
  text-align: center;
}

.chapter-step,
.chapter-next {
  margin: 0;
  color: var(--yellow);
  font-size: clamp(.72rem, 2vw, .94rem);
  font-weight: 1000;
  letter-spacing: .18em;
}

.chapter-route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(16px, 4vw, 44px);
  width: min(92%, 610px);
  margin: 22px auto 25px;
}

.chapter-route::before {
  position: absolute;
  z-index: -1;
  top: 50%;
  right: 4%;
  left: 4%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  content: "";
  transform: translateY(-50%);
}

.chapter-route span {
  display: grid;
  width: clamp(38px, 7vw, 50px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border: 3px solid rgba(255,255,255,.38);
  border-radius: 50%;
  color: rgba(255,255,255,.7);
  background: #4d5b66;
  font-weight: 1000;
}

.chapter-route span.done {
  color: var(--ink);
  background: var(--lime);
}

.chapter-route span.next {
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 0 24px rgba(255,231,106,.5);
}

.chapter-route b {
  position: absolute;
  z-index: 2;
  top: -23px;
  left: var(--chapter-from-position, 10%);
  font-size: 1.7rem;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.35));
  transform: translateX(-50%);
  transition: left 1000ms cubic-bezier(.2,.8,.2,1);
}

.chapter-screen.traveling .chapter-route b {
  left: var(--chapter-to-position, 30%);
}

.chapter-card h2 {
  margin: 7px 0 6px;
  color: white;
  font-size: clamp(1.8rem, 6vw, 3.4rem);
  line-height: 1;
}

.chapter-card > p:last-child {
  margin: 0;
  color: rgba(255,255,255,.78);
  font-family: system-ui, sans-serif;
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .08em;
}

.map-route::before {
  position: absolute;
  z-index: -1;
  top: 34px;
  right: 7%;
  left: 7%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  content: "";
}

.map-node {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 6px;
  padding: 10px 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 17px;
  color: rgba(255, 255, 255, 0.52);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(5, 24, 41, 0.42));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.map-dot {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  color: white;
  background: #4d5b66;
  font-size: 1.1rem;
  font-weight: 1000;
}

.map-node strong {
  font-size: 0.72rem;
  line-height: 1.15;
  letter-spacing: 0.06em;
}

.map-node small {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.map-node.current {
  border-color: rgba(255, 231, 106, 0.74);
  color: white;
  background: rgba(71, 76, 62, 0.58);
}

.map-node.current .map-dot {
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 0 24px rgba(255, 231, 106, 0.45);
}

.map-node.completed {
  color: white;
}

.map-node.completed .map-dot {
  color: var(--ink);
  background: var(--lime);
}

.map-node.completed small {
  color: var(--lime);
}

.map-node.locked {
  filter: saturate(0.45);
  opacity: 0.58;
}

.rotate-tip {
  position: absolute;
  z-index: 12;
  right: 50%;
  bottom: max(11px, env(safe-area-inset-bottom));
  padding: 8px 14px;
  border-radius: 999px;
  color: white;
  background: rgba(10, 35, 55, 0.78);
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateX(50%);
}

.build-badge {
  position: absolute;
  z-index: 6;
  right: auto;
  left: 50%;
  bottom: max(6px, env(safe-area-inset-bottom));
  padding: 2px 7px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(8, 27, 44, 0.4);
  font-family: system-ui, sans-serif;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  pointer-events: none;
  transform: translateX(-50%);
}

body.is-arcade-embed .top-actions {
  display: none;
}

body.is-arcade-embed .hud {
  top: max(58px, calc(50px + env(safe-area-inset-top)));
  right: max(12px, env(safe-area-inset-right));
  left: max(12px, env(safe-area-inset-left));
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

body.is-arcade-embed .world-chip,
body.is-arcade-embed .secret-stat {
  display: none;
}

body.is-arcade-embed .hud-chip {
  min-height: 38px;
  padding: 5px 11px;
  border-color: rgba(255, 255, 255, 0.38);
  border-radius: 13px;
  background: rgba(7, 29, 48, 0.68);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 4px 12px rgba(3, 18, 31, 0.16);
  backdrop-filter: blur(5px);
}

body.is-arcade-embed .hud-chip::after,
body.is-arcade-embed .eyebrow {
  display: none;
}

body.is-arcade-embed .objective-chip {
  width: 100%;
  min-width: 0;
  justify-self: stretch;
  text-align: left;
}

body.is-arcade-embed .objective-chip strong {
  overflow: hidden;
  font-size: clamp(0.68rem, 1.5vw, 0.88rem);
  text-overflow: ellipsis;
}

body.is-arcade-embed .stats-chip {
  gap: 8px;
  padding-inline: 10px;
}

body.is-arcade-embed .stat,
body.is-arcade-embed .stat strong {
  font-size: 0.84rem;
}

body.is-arcade-embed .power-chip {
  top: max(104px, calc(96px + env(safe-area-inset-top)));
}

@media (pointer: fine) and (min-width: 900px) {
  .touch-controls {
    opacity: 1;
  }
}

@media (orientation: portrait) and (max-width: 700px) {
  .rotate-tip {
    bottom: max(140px, calc(130px + env(safe-area-inset-bottom)));
    opacity: 1;
  }

  .hud {
    right: max(106px, calc(8px + env(safe-area-inset-right)));
    grid-template-columns: 1fr auto;
  }

  .objective-chip {
    position: absolute;
    top: 60px;
    left: 0;
    padding: 7px 10px;
    text-align: left;
  }

  .objective-chip .eyebrow {
    display: none;
  }

  .objective-chip strong {
    font-size: 0.67rem;
  }

  .world-chip {
    padding-inline: 10px;
  }

  .world-chip strong {
    font-size: 0.74rem;
  }

  .stats-chip {
    padding-inline: 10px;
    gap: 8px;
  }

  .stat {
    font-size: 0.9rem;
  }

  .stat strong {
    font-size: 0.86rem;
  }

  .secret-stat {
    display: none;
  }

  .adventure-results {
    grid-template-columns: repeat(2, 1fr);
  }

  .map-route {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .map-route::before {
    top: 7%;
    right: auto;
    bottom: 7%;
    left: 31px;
    width: 5px;
    height: auto;
  }

  .map-fox {
    top: var(--map-position, 10%);
    left: 54px;
    transform: translateY(-50%);
  }

  .map-node {
    grid-template-columns: 50px 1fr auto;
    justify-items: start;
    align-items: center;
    padding: 7px 12px 7px 7px;
    text-align: left;
  }

  .map-dot {
    width: 46px;
    height: 46px;
  }

  .start-card {
    margin-block: auto;
  }
}

@media (max-height: 520px) {
  .hud-chip {
    min-height: 44px;
    padding-block: 6px;
  }

  .eyebrow {
    font-size: 0.56rem;
  }

  .screen-card {
    width: min(88vw, 680px);
    padding: 18px 24px;
  }

  .start-card {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas:
      "mark kicker play map"
      "mark title play map"
      "level copy hints hints";
    align-items: center;
    gap: 6px 18px;
    text-align: left;
  }

  .start-card .logo-mark { grid-area: mark; margin: 0; }
  .start-card .kicker { grid-area: kicker; margin: 0; }
  .start-card h1 { grid-area: title; font-size: clamp(2rem, 8vh, 3.2rem); }
  .start-card .level-name { grid-area: level; margin: 0; font-size: 0.76rem; }
  .start-card .start-copy { grid-area: copy; margin: 0; font-size: 0.78rem; }
  .start-card .control-hints { grid-area: hints; margin: 0; justify-content: flex-end; }
  .start-card .primary-button { grid-area: play; min-width: 120px; }
  .start-card #mapButton { grid-area: map; min-width: 120px; margin: 0; }

  .movement-control {
    width: 112px;
    height: 112px;
  }

  .movement-knob {
    width: 48px;
    height: 48px;
  }

  .jump-button {
    width: 88px;
    height: 88px;
  }

  .seed-button {
    width: 68px;
    height: 68px;
  }

  .action-controls {
    gap: 8px;
  }

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

  .adventure-results {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }

  .adventure-results div {
    padding: 9px 5px;
  }

  .adventure-results span {
    font-size: 0.56rem;
  }

  .adventure-results strong {
    font-size: 0.88rem;
  }

  .finish-card h2 {
    margin-bottom: 12px;
  }

  .finish-card .logo-mark {
    display: none;
  }

  .map-card {
    width: min(96vw, 980px);
    padding: 14px 20px;
  }

  .map-card h2 {
    margin-bottom: 10px;
  }

  .map-route {
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 12px;
  }

  .map-node {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 6px;
    text-align: center;
  }

  .map-dot {
    width: 37px;
    height: 37px;
    font-size: 0.9rem;
  }

  .map-card .primary-button,
  .map-card .secondary-button {
    display: inline-grid;
    min-width: 150px;
    min-height: 44px;
    margin: 0 5px;
    place-items: center;
  }

  .chapter-card {
    width: min(92vw, 720px);
    padding: 15px 24px;
  }

  .chapter-route {
    margin: 14px auto 15px;
  }

  .chapter-card h2 {
    margin-block: 4px;
    font-size: clamp(1.55rem, 8vh, 2.25rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Keep live travel visible, without a map overlay or stopping the fox. */
.chapter-screen.active { display:flex; flex-direction:column; background:none; backdrop-filter:none; pointer-events:none; justify-content:flex-start; align-items:center; padding:70px 12px 0; }
.chapter-screen .chapter-card { background:rgba(12,33,38,.88); border:1px solid #efd484; padding:12px 22px; width:auto; max-width:80vw; box-shadow:0 8px 28px #0004; }
.chapter-screen .chapter-route,.chapter-screen .chapter-next { display:none; }
.chapter-screen h2 { font-size:clamp(20px,3vw,32px); }
.chapter-screen .chapter-step { font-size:12px; }
.seed-button[hidden] { display:none!important; }

@media(max-height:440px){.chapter-screen.active{padding-top:62px}.chapter-screen .chapter-card{padding:8px 16px}.chapter-screen .chapter-subtitle{font-size:12px;margin:4px 0}}

/* Let the objective and readouts share the available width without overlapping. */
.hud { grid-template-columns: minmax(110px, .8fr) minmax(0, 1.35fr) auto; }
.hud-chip { min-width: 0; }
.objective-chip { min-width: 0; width: 100%; justify-self: stretch; }
.hud-chip strong { overflow: hidden; text-overflow: ellipsis; }
.objective-chip strong { white-space: normal; font-size: clamp(.72rem, 1.35vw, 1rem); line-height: 1.2; }
.stats-chip { gap: 9px; }
@media (orientation: landscape) and (max-width: 950px) {
  .hud { left: 8px; right: 94px; gap: 5px; grid-template-columns: minmax(90px,.65fr) minmax(0,1fr) auto; }
  .hud-chip { min-height: 42px; padding: 6px 8px; }
  .eyebrow { font-size: .55rem; }
  .world-chip strong { font-size: .72rem; }
  .stat, .stat strong { font-size: .8rem; }
  .stats-chip { gap: 6px; }
  .secret-stat { display: none; }
}
@media (orientation: portrait) and (max-width: 700px) {
  .hud { grid-template-columns: minmax(0,1fr) auto; }
  .objective-chip { top: 58px; max-width: 100%; }
  .objective-chip strong { font-size: .8rem; }
  .secret-stat { display: none; }
}
body.is-arcade-embed .hud { grid-template-columns: minmax(0,1fr) auto; }
body.is-arcade-embed .objective-chip { position: static; }
