/* PlaneTilt page styles. Flat file: the CrazyGames bundle has no folders. */

:root {
  --bg: #1b1410;
  --panel: rgba(24, 18, 14, 0.92);
  --ink: #f4ead9;
  --ink-dim: #b8a88f;
  --accent: #f0b23a;
  --good: #3fbf7f;
  --line: rgba(244, 234, 217, 0.14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: calc(64px + var(--safe-bottom));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 600 16px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  /* A drag steers the ball; the page must not scroll, zoom or select under it. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
}

/* --- buttons --------------------------------------------------------- */
.maze-btn {
  font: inherit;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: rgba(40, 31, 24, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 20px;
  min-height: 48px;
  cursor: pointer;
}
.maze-btn { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); transition: transform 80ms ease, box-shadow 80ms ease; }
.maze-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.maze-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The big button is the chunky "toy" kind casual games use: a glossy face on
   a darker edge, pressed down into the edge on tap. */
.maze-btn-big {
  background: linear-gradient(#ffd66e, #f4b63c 50%, #e69a22);
  color: #3a2408;
  border: 0;
  border-radius: 16px;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 14px 36px;
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.6);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(150, 80, 0, 0.25), 0 5px 0 #a8650e, 0 10px 18px rgba(0, 0, 0, 0.45);
}
.maze-btn-big:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(150, 80, 0, 0.25), 0 1px 0 #a8650e, 0 4px 10px rgba(0, 0, 0, 0.45);
}
.maze-btn-small { min-width: 48px; padding: 8px 12px; }

.coin-dot {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe08a, #e8a21c 60%, #a96d08);
  margin-right: 6px;
  vertical-align: -0.05em;
}

/* --- level select ------------------------------------------------------ */
.maze-select {
  position: fixed;
  inset: 0 0 var(--tabbar-h) 0;   /* stops above the tab bar */
  display: flex;
  flex-direction: column;
  background: var(--panel);
  padding-top: var(--safe-top);
}
.maze-selecthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.maze-selecthead h1 { margin: 0; font-size: 1.3rem; letter-spacing: 0.18em; }
.maze-wallet { color: var(--accent); }
.maze-selectlist {
  flex: 1;
  overflow-y: auto;
  touch-action: pan-y;    /* the list scrolls; nothing else on the page does */
  padding: 8px 16px 24px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.maze-worldname {
  margin: 18px 0 8px;
  color: var(--ink-dim);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
}
.maze-levelrow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 8px;
  padding: 10px 12px;
  min-height: 56px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.maze-levelrow.is-next { border-color: var(--accent); background: rgba(240, 178, 58, 0.12); }
.maze-levelrow.is-locked { opacity: 0.45; cursor: default; }
.maze-levelidx {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.maze-levelrow.is-cleared .maze-levelidx { background: var(--good); color: #10241a; }
.maze-levelmain { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.maze-levellabel { font-size: 1rem; }
.maze-levelmeta { font-size: 0.8rem; font-weight: 500; color: var(--ink-dim); }
.maze-leveltier { flex: none; font-size: 1.3rem; }

/* --- in-level HUD -------------------------------------------------------- */
/* The HUD lets drags through to the board everywhere except its controls. */
.maze-hud { position: fixed; inset: 0; pointer-events: none; }
.maze-hud .maze-btn { pointer-events: auto; }
.maze-topbar {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.maze-cambtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; display: block; margin: 0 auto; }
.maze-cambtn.is-on { color: #3a2408; background: linear-gradient(#ffd66e, #e69a22); border-color: transparent; }
.maze-soundbtn .sound-off { display: none; }
.maze-soundbtn.is-muted .sound-on { display: none; }
.maze-soundbtn.is-muted .sound-off { display: inline; }
.maze-soundbtn.is-muted { opacity: 0.75; }
.maze-levelname {
  flex: 1;
  text-align: center;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.maze-coins { color: var(--accent); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); padding: 0 6px; }
.maze-status, .maze-powerups {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  padding: 0 16px;
}
.maze-status { top: calc(66px + var(--safe-top)); font-size: 1.05rem; }
.maze-powerups { top: calc(94px + var(--safe-top)); font-size: 0.85rem; color: #9fe6ff; }
.maze-bottombar, .maze-winpanel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(20px + var(--safe-bottom));
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 16px;
}
.maze-winpanel .maze-btn { pointer-events: auto; }
/* The near miss: the medal still to win and how far off this run was. Close
   misses glow and put RETRY first. */
.near-miss {
  flex-basis: 100%;
  order: -2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0 auto 2px;
  max-width: max-content;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(10, 7, 5, 0.78);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}
.near-miss .medal { width: 1.1em; height: 1.1em; }
.near-miss.is-close { font-size: 1.02rem; border: 2px solid rgba(255, 214, 110, 0.6); color: #ffd66e; animation: near-pop 500ms cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes near-pop { from { scale: 0.6; opacity: 0; } to { scale: 1; opacity: 1; } }
.maze-winpanel .is-retry { order: -1; }

/* --- store and profile ------------------------------------------------------ */
.shop-section {
  margin: 20px 0 8px;
  color: var(--ink-dim);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
}
.shop-msg:empty { display: none; }
.shop-msg {
  margin: 8px 16px 0;
  text-align: center;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.shop-msg.is-good { color: var(--good); }
.shop-msg.is-bad { color: #ff8a6b; }
.shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.shop-rowmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-rowtitle { font-size: 1rem; }
.shop-rowblurb { font-size: 0.8rem; font-weight: 500; color: var(--ink-dim); }
.shop-rowside { flex: none; display: flex; align-items: center; gap: 10px; }
.shop-buy { min-width: 92px; padding: 10px 14px; font-variant-numeric: tabular-nums; }
.shop-buy:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.shop-buy:disabled { opacity: 0.5; cursor: default; }
.shop-owned { color: var(--ink-dim); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.shop-locked { color: var(--ink-dim); font-size: 0.8rem; }
.shop-empty { color: var(--ink-dim); font-weight: 500; font-size: 0.9rem; }
.shop-pips { display: inline-flex; gap: 4px; }
.shop-pip { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--accent); }
.shop-pip.is-on { background: var(--accent); }

/* Power-up and prize markers: the same colours as the pickups in the maze
   (mazeProps3d.js), so the store teaches what the gems are. */
.pu-dot { flex: none; display: inline-block; width: 14px; height: 14px; transform: rotate(45deg); border-radius: 3px; margin-right: 4px; }
.pu-shield { background: #48d6ff; }
.pu-slowmo { background: #b57bff; }
.pu-magnet { background: #ff4d5e; }
.prize-badge { flex: none; display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--accent), #fff3cf, var(--accent)); }

/* Marbles */
.marble-swatch {
  --m: #f2f2f2;
  flex: none;
  display: inline-block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 32%),
    radial-gradient(circle at 60% 70%, var(--m), color-mix(in srgb, var(--m) 45%, #000) 95%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.marble-swatch.is-big { width: 72px; height: 72px; }
/* A skinned swatch: the skin's drawing, shaded and lit like the plain one. */
.marble-swatch.is-skin {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 45% 40%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 100%),
    var(--skin) center / 200% 100%;
}
.look-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.look-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}
.look-card.is-selected { border-color: var(--accent); background: rgba(240, 178, 58, 0.1); }
.look-card .marble-swatch { width: 44px; height: 44px; }
.look-name { font-size: 0.8rem; text-align: center; line-height: 1.15; min-height: 2.3em; display: grid; place-items: center; }
.look-action { min-width: 0; width: 100%; min-height: 36px; padding: 6px 4px; font-size: 0.8rem; justify-content: center; }
.look-card.is-locked .look-action { color: var(--ink-dim); }
.trail-swatch { width: 100%; height: 44px; border-radius: 22px 6px 6px 22px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.trail-swatch.is-none { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 6px, transparent 6px 12px); }
.profile-hero { display: flex; align-items: center; gap: 16px; margin: 12px 0 4px; }
.profile-hero .shop-section { margin: 0 0 2px; }
.profile-marblename { margin: 0; font-size: 1.5rem; letter-spacing: 0.06em; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.profile-stat { display: flex; flex-direction: column; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.profile-statvalue { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.profile-statlabel { font-size: 0.72rem; color: var(--ink-dim); letter-spacing: 0.06em; }
.marble-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.marble-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.marble-card.is-selected { border-color: var(--accent); background: rgba(240, 178, 58, 0.1); }
.marble-cardhead { display: flex; align-items: center; gap: 10px; }
.marble-name { font-size: 1.05rem; }
.marble-blurb { margin: 0; font-size: 0.78rem; font-weight: 500; color: var(--ink-dim); flex: 1; }
.marble-bars { display: flex; flex-direction: column; gap: 4px; }
.marble-bar { display: grid; grid-template-columns: 6em 1fr; align-items: center; gap: 6px; font-size: 0.7rem; color: var(--ink-dim); }
.marble-bartrack { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.marble-barfill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.marble-action { width: 100%; }
.marble-action + .marble-action { margin-top: 6px; justify-content: center; }
.profile-inventory { display: flex; flex-direction: column; gap: 6px; }
.profile-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.profile-itemname { flex: 1; }

/* In-run power-up buttons */
.maze-charges {
  position: absolute;
  right: 8px;
  bottom: calc(96px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.maze-charge { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.maze-charge .count { color: var(--accent); }

/* --- tab bar ----------------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-h);
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(18, 13, 10, 0.96);
  border-top: 1px solid var(--line);
  z-index: 5;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  background: none;
  border: 0;
  cursor: pointer;
}
.tab svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab { position: relative; transition: color 120ms ease; }
.tab svg { transition: transform 160ms cubic-bezier(0.2, 1.6, 0.4, 1); }
.tab.is-active { color: var(--accent); }
.tab.is-active svg {
  width: 40px;
  height: 40px;
  padding: 7px;
  margin-top: -18px;
  border-radius: 14px;
  color: #3a2408;
  stroke-width: 2.2;
  background: linear-gradient(#ffd66e, #e69a22);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 3px 0 #a8650e, 0 6px 12px rgba(0, 0, 0, 0.5);
}
.tab:active svg { transform: scale(0.9); }
.tab-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 8px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 18px;
  letter-spacing: 0;
  color: #fff;
  background: #e8413c;
  box-shadow: 0 0 0 2px rgba(18, 13, 10, 0.96);
  animation: badge-pop 1.6s ease-in-out infinite;
}
.tab.is-active .tab-badge { top: -10px; left: calc(50% + 12px); }
@keyframes badge-pop { 0%, 70%, 100% { scale: 1; } 80% { scale: 1.25; } 90% { scale: 0.95; } }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

/* --- home ---------------------------------------------------------------------- */
/* Transparent: the planet behind it IS the home screen. */
.home { position: fixed; inset: 0 0 var(--tabbar-h) 0; pointer-events: none; }
.home .maze-btn { pointer-events: auto; }
.home-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(12px + var(--safe-top)) 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(rgba(10, 7, 5, 0.85), rgba(10, 7, 5, 0.55) 70%, rgba(10, 7, 5, 0));
}
.home-stats { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.home-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.home-statlabel { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.2em; color: var(--ink-dim); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
/* Resource chips: tappable, a dark capsule with a bright rim, the icon riding
   its left edge and a green + where the store sells more. */
.hud-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  border-radius: 999px;
  background: linear-gradient(rgba(12, 8, 5, 0.82), rgba(30, 22, 16, 0.82));
  border: 2px solid rgba(255, 226, 170, 0.22);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 80ms ease;
}
.hud-chip:active { transform: scale(0.95); }
.hud-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-icon { flex: none; }
.coin-icon {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(120, 70, 0, 0.55) 54%, transparent 60%),
              radial-gradient(circle at 35% 30%, #fff3bf, #f6c445 40%, #d98f12 75%, #8f5806);
  box-shadow: 0 2px 0 #7a4a05, 0 0 8px rgba(255, 200, 80, 0.45);
}
.hud-coins { padding-left: 4px; padding-right: 4px; color: #ffd66e; font-size: 1.05rem; }
.hud-coins .chip-value { min-width: 2.6em; text-align: center; }
.chip-plus {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  background: linear-gradient(#5fe08e, #2f9e5a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 0 #1d6a3b;
}
.hud-chip.is-bump { animation: chip-bump 420ms ease; }
@keyframes chip-bump { 0% { transform: scale(1); } 35% { transform: scale(1.15); } 100% { transform: scale(1); } }
.hud-medals { font-size: 0.9rem; }
.hud-medals .medal { margin-left: 6px; }
.hud-medals .medal:first-child { margin-left: 0; }
.medal { display: inline-block; width: 0.85em; height: 0.85em; border-radius: 50%; }
.medal-gold { background: radial-gradient(circle at 35% 35%, #fff1b0, #e3b02e 65%, #9a6f0c); }
.medal-silver { background: radial-gradient(circle at 35% 35%, #ffffff, #b9c2cc 65%, #6e7781); }
.medal-bronze { background: radial-gradient(circle at 35% 35%, #ffd2a8, #c27a3e 65%, #7a4416); }
.hud-powerups { font-size: 0.9rem; gap: 8px; }
.home-pu { display: inline-flex; align-items: center; }
.home-pu .pu-dot { width: 0.72em; height: 0.72em; border-radius: 2px; margin-right: 5px; box-shadow: 0 0 6px currentColor; }
/* The PlaneTilt wordmark: system fonts only (the bundle ships no font files),
   heaviest weight, leaning like a tilted board. The i's dot is a marble. */
.home-logo {
  margin: 4px 0 0;
  align-self: center;
  font-size: clamp(2.2rem, 11vw, 3.4rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.01em;
  transform: rotate(-4deg);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45)) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
  white-space: nowrap;
  animation: logo-in 650ms cubic-bezier(0.2, 1.6, 0.4, 1) both, logo-bob 3.2s ease-in-out 650ms infinite;
}
@keyframes logo-in { from { scale: 0.4; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes logo-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.logo-plane, .logo-tilt { -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-plane { background-image: linear-gradient(#fffaf0, #e8d6b8); }
.logo-tilt { background-image: linear-gradient(#ffd77a, #f0b23a 55%, #d4861c); }
.logo-i {
  /* Drawn, not typed: a stem at x-height plus a marble for the dot, so it is
     the same on every device whatever fonts it has. An inline-block with no
     text sits its bottom on the baseline. */
  display: inline-block;
  position: relative;
  width: 0.27em;
  height: 0.53em;
  margin: 0 0.02em;
}
.logo-i::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0.17em;
  height: 100%;
  transform: translateX(-50%);
  border-radius: 0.02em;
  background: linear-gradient(#ffd77a, #f0b23a 55%, #d4861c);
}
.logo-i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -0.33em;
  width: 0.25em;
  height: 0.25em;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #ffd77a 35%, #e0782a 75%, #8a3c10);
  box-shadow: 0 0 0.18em rgba(255, 190, 90, 0.7);
}
.home-play {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}
.home-goal {
  margin: 0;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink);
  background: rgba(10, 7, 5, 0.6);
  border: 1px solid var(--line);
  text-align: center;
}
.home-playbtn {
  min-width: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 40px 10px;
  border-radius: 20px;
  position: relative;
}
/* A locked world: PLAY greys out and stops pulsing. */
.home-playbtn:disabled, .home-playbtn.is-locked {
  filter: grayscale(1) brightness(0.62);
  cursor: default;
}
.home-playbtn.is-locked::after { display: none; }
.home-playbtn.is-locked .play-label { font-size: 1.35rem; }
/* Home's world picker: arrows either side of the world's name and its dots. */
.home-worldnav {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.world-arrow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 7, 5, 0.55);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.world-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.world-arrow:disabled { opacity: 0.25; cursor: default; }
.home-worldname {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 150px;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.home-worldname .world-planet { font-size: 1.05rem; font-weight: 900; letter-spacing: 0.2em; }
.home-worldname .world-place { font-size: 0.66rem; letter-spacing: 0.16em; opacity: 0.75; margin-top: -3px; }
.home-worldname .is-locked-name { opacity: 0.7; }
.world-dots { display: flex; gap: 6px; }
.world-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}
.world-dots i.is-on { background: #ffd66e; box-shadow: 0 0 6px rgba(255, 214, 110, 0.8); }
.world-dots i.is-locked { background: rgba(255, 255, 255, 0.12); }
/* The pulse is a glow ring behind the button, never the button itself: a
   target that keeps moving is harder to hit (and tests cannot tap it). */
.home-playbtn::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 24px;
  border: 3px solid rgba(255, 214, 110, 0.9);
  pointer-events: none;
  animation: play-pulse 1.8s ease-out infinite;
}
.play-label { font-size: 1.7rem; letter-spacing: 0.16em; line-height: 1; }
.play-sub { font-size: 0.72rem; letter-spacing: 0.18em; opacity: 0.8; }
.play-sub:empty { display: none; }
@keyframes play-pulse { 0% { opacity: 0.9; scale: 1; } 100% { opacity: 0; scale: 1.12 1.35; } }

/* The side rail: round reward buttons at the screen edge. DAILY is gold,
   MISSIONS blue, FREE (the ad) green. */
.home-side { position: absolute; left: 12px; top: 30%; display: flex; flex-direction: column; gap: 14px; }
.side-btn {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink);
}
.side-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(#6be39a, #2f9e5a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 4px 0 #1d6a3b, 0 8px 14px rgba(0, 0, 0, 0.45);
  transition: transform 80ms ease;
}
.side-btn:active .side-icon { transform: translateY(3px); }
.side-icon svg { width: 32px; height: 32px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.3)); }
.home-side-right { left: auto; right: 12px; }
.side-maze .side-icon { background: linear-gradient(#b49aff, #6a43d8); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 4px 0 #2b1766, 0 8px 14px rgba(0, 0, 0, 0.45); }
.side-maze.is-locked .side-icon { filter: grayscale(0.9) brightness(0.65); }
.side-maze.is-done .side-label { color: #5fe08e; }
.side-maze .side-badge { right: auto; left: -8px; padding: 0 6px; font-size: 0.62rem; letter-spacing: 0.06em; }
.side-daily .side-icon { background: linear-gradient(#ffd66e, #e69a22); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 4px 0 #a8650e, 0 8px 14px rgba(0, 0, 0, 0.45); }
.side-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
  color: #fff;
  background: #e8413c;
  box-shadow: 0 0 0 2px rgba(18, 13, 10, 0.9);
  animation: badge-pop 1.6s ease-in-out infinite;
}
.side-daily:has(.side-badge:not([hidden])) .side-icon { animation: side-wiggle 4s ease-in-out infinite; }
.side-play {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.side-play::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  border-left: 8px solid #2f9e5a;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.side-label {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(10, 7, 5, 0.75);
  font-variant-numeric: tabular-nums;
}
.side-free:not(:disabled) .side-icon { animation: side-wiggle 4s ease-in-out infinite; }
.side-free:disabled { cursor: default; }
.side-free:disabled .side-icon { filter: grayscale(0.85) brightness(0.7); }
@keyframes side-wiggle { 0%, 84%, 100% { rotate: 0deg; } 88% { rotate: -9deg; } 92% { rotate: 8deg; } 96% { rotate: -4deg; } }

.home-toast {
  position: absolute;
  left: 50%;
  top: 40%;
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  translate: -50% 0;
  background: rgba(10, 7, 5, 0.85);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 200ms ease;
}
.home-toast.is-on { opacity: 1; }
.home-toast.is-good { color: #ffd66e; font-size: 1.3rem; font-weight: 900; }

/* --- worlds (solar system) ---------------------------------------------------- */
/* Transparent over the system; only the header, labels and sheet take taps,
   and a tap anywhere else lands on the canvas, where menus.js picks a planet. */
.worlds { position: fixed; inset: 0 0 var(--tabbar-h) 0; pointer-events: none; }
.worlds-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  background: linear-gradient(rgba(7, 6, 10, 0.85), rgba(7, 6, 10, 0));
}
.worlds-head h1 { margin: 0; font-size: 1.3rem; letter-spacing: 0.18em; }
.world-labels { position: absolute; inset: 0; overflow: hidden; }
.world-label {
  position: absolute;
  transform: translate(-50%, 0);
  pointer-events: auto;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(10, 8, 7, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
}
.world-label.is-selected { border-color: var(--accent); color: var(--accent); }
.world-label.is-coming { color: var(--ink-dim); }
.world-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: auto;
  padding: 10px 16px 10px;
  background: rgba(20, 15, 12, 0.94);
  border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 560px;
  margin: 0 auto;
}
.world-sheethead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.world-sheetname { margin: 0; font-size: 1.05rem; letter-spacing: 0.04em; text-wrap: balance; }
.mode-switch { display: inline-flex; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); }
.mode-btn { font: inherit; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.12em; padding: 5px 12px; border: 0; border-radius: 999px; color: var(--ink-dim); background: none; cursor: pointer; }
.mode-btn.is-on { color: #3a2408; background: linear-gradient(#ffd66e, #e69a22); }
#modeWalk.is-on { color: #fff; background: linear-gradient(#6fc3ff, #2f74d0); }
.world-sheetdone { color: var(--ink-dim); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.world-sheetnote { margin: 0; font-size: 0.75rem; font-weight: 500; color: var(--ink-dim); min-height: 1.2em; }
.world-sheetprize { margin: 0; font-size: 0.7rem; font-weight: 500; color: var(--ink-dim); display: flex; align-items: center; gap: 8px; }
.world-sheetprize:empty { display: none; }
/* One row of ten small nodes: the sheet stays a strip under the solar system. */
.level-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 34px)); justify-content: space-between; gap: 4px; }
.level-node {
  position: relative;
  aspect-ratio: 1;
  max-width: 100%;
  display: grid;
  place-items: center;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--line);
  padding: 0;
  min-width: 0;
  border-radius: 50%;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.level-node.is-cleared { background: rgba(63, 191, 127, 0.18); border-color: var(--good); }
.level-node[data-tier="gold"] { border-color: #e3b02e; }
.level-node[data-tier="silver"] { border-color: #b9c2cc; }
.level-node[data-tier="bronze"] { border-color: #c27a3e; }
.level-node.is-next { border-color: var(--accent); background: rgba(240, 178, 58, 0.22); box-shadow: 0 0 0 3px rgba(240, 178, 58, 0.18); }
.level-node.is-locked { opacity: 0.35; cursor: default; }
.level-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.level-node .node-medal { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .level-node.is-next { animation: nodePulse 1.8s ease-in-out infinite; }
  @keyframes nodePulse { 50% { box-shadow: 0 0 0 5px rgba(240, 178, 58, 0.08); } }
}

/* --- ads (CrazyGames only; platform.js) ------------------------------------ */
/* A rewarded-ad button: green, with a play mark, so it never reads as a buy. */
.maze-btn-ad { background: #2f9e5a; color: #fff; border-color: transparent; display: inline-flex; align-items: center; gap: 8px; }
.maze-btn-ad .ad-play { font-size: 0.75em; opacity: 0.9; }
.maze-fallpanel { flex-direction: row; align-items: center; }
/* x2 COINS gets a row of its own above NEXT / REPLAY / LEVELS. */
#mazeDoubleBtn { flex: 0 0 auto; margin: 0 calc(50% - 150px); justify-content: center; width: 300px; max-width: 100%; }
.fall-countdown { flex-basis: 100%; height: 4px; max-width: 260px; margin: 2px auto 0; background: rgba(255, 255, 255, 0.15); border-radius: 2px; overflow: hidden; }
.fall-countdown span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
/* Banner slots at the foot of the store and gear pages. Responsive banners
   pick a size that fits: 320x50 on a phone, 728x90 on a wide screen. Nothing
   on the web build, which has no ads. */
.ad-banner { display: none; flex: 0 0 auto; width: 100%; max-width: 728px; height: 50px; margin: 0 auto; }
html[data-platform="crazygames"] .ad-banner { display: block; }
@media (min-width: 760px) { .ad-banner { height: 90px; } }
.ad-shield { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: var(--ink-dim); letter-spacing: 0.3em; font-size: 0.8rem; }
.shop-buy.maze-btn-ad { color: #fff; }
.shop-note { margin: -2px 0 8px; font-size: 0.75rem; color: var(--ink-dim); }
/* A row offering a free step stacks its controls -- pips, FREE, price -- so
   the description keeps its width on a phone. */
.shop-rowside:has(.shop-free) { flex-direction: column; align-items: stretch; gap: 6px; }
.shop-rowside:has(.shop-free) .shop-pips { align-self: center; }
.shop-free { justify-content: center; padding-top: 7px; padding-bottom: 7px; }

/* Motion is decoration only: honour the system setting to cut it. */
@media (prefers-reduced-motion: reduce) {
  .home-logo, .home-playbtn::after, .near-miss.is-close, .side-icon, .tab-badge, .hud-chip.is-bump { animation: none !important; }
}

/* Narrow phones: the three chips tighten to share the row. */
@media (max-width: 400px) {
  .home-stats { gap: 4px; }
  .hud-chip { height: 30px; padding: 0 7px; gap: 3px; font-size: 0.82rem; }
  .hud-medals, .hud-powerups { font-size: 0.8rem; }
  .hud-coins { padding: 0 3px; font-size: 0.92rem; }
  .hud-coins .chip-value { min-width: 0; }
  .coin-icon { width: 22px; height: 22px; }
  .chip-plus { width: 19px; height: 19px; font-size: 0.95rem; }
  .hud-medals .medal { margin-left: 4px; }
  .hud-powerups { gap: 5px; }
  .home-pu .pu-dot { margin-right: 3px; }
  .home-statlabel { font-size: 0.56rem; letter-spacing: 0.14em; }
}

/* The player level under the HUD chips: a numbered badge and an XP bar. */
.home-levelbar {
  pointer-events: auto;
  align-self: center;
  display: flex;
  align-items: center;
  width: min(100%, 300px);
  padding: 0;
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
}
.lvl-badge {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a98bff, #6a43d8 60%, #43259a);
  border: 2px solid #d9cbff;
  box-shadow: 0 3px 0 #2b1766, 0 6px 12px rgba(0, 0, 0, 0.45);
  line-height: 1;
}
.lvl-word { font-size: 0.45rem; font-weight: 900; letter-spacing: 0.12em; opacity: 0.85; }
.lvl-num { font-size: 1.15rem; font-weight: 900; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.lvl-track {
  position: relative;
  flex: 1;
  height: 20px;
  margin-left: -10px;
  border-radius: 0 10px 10px 0;
  background: rgba(10, 7, 5, 0.75);
  border: 2px solid rgba(217, 203, 255, 0.35);
  overflow: hidden;
}
.lvl-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#b49aff, #7650e6); transition: width 400ms ease; }
.lvl-text { position: relative; display: block; text-align: center; font-size: 0.7rem; font-weight: 800; line-height: 16px; letter-spacing: 0.04em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); font-variant-numeric: tabular-nums; }

/* --- modals: daily reward and missions ---------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: rgba(6, 4, 3, 0.72);
  animation: modal-fade 160ms ease both;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  width: min(100%, 380px);
  max-height: 100%;
  overflow-y: auto;
  padding: 20px 16px 18px;
  border-radius: 22px;
  background: linear-gradient(#2c2119, #1a130e);
  border: 2px solid rgba(255, 214, 110, 0.35);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.6);
  animation: modal-pop 280ms cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
@keyframes modal-pop { from { scale: 0.8; opacity: 0; } to { scale: 1; opacity: 1; } }
.modal-title { margin: 0; text-align: center; font-size: 1.35rem; font-weight: 900; letter-spacing: 0.12em; color: #ffd66e; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.modal-note { margin: 6px 0 14px; min-height: 1.3em; text-align: center; font-size: 0.85rem; color: var(--ink-dim); text-wrap: balance; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}
.modal-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 16px; }
.modal-actions .maze-btn-big { min-width: 200px; }
.modal-actions .maze-btn:disabled { filter: grayscale(0.7) brightness(0.75); cursor: default; }

.daily-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.daily-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--line);
}
.daily-tile.is-big { grid-column: 1 / -1; background: linear-gradient(rgba(255, 214, 110, 0.16), rgba(255, 214, 110, 0.05)); }
.daily-day { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.16em; color: var(--ink-dim); }
.daily-tile.is-today { border-color: #ffd66e; background: linear-gradient(rgba(255, 214, 110, 0.3), rgba(255, 214, 110, 0.08)); box-shadow: 0 0 16px rgba(255, 200, 80, 0.4); animation: today-glow 1.6s ease-in-out infinite; }
.daily-tile.is-today .daily-day { color: #ffd66e; }
@keyframes today-glow { 50% { box-shadow: 0 0 26px rgba(255, 200, 80, 0.7); } }
.daily-tile.is-claimed { opacity: 0.55; }
.daily-check {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  font-size: 0.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  background: #2f9e5a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.reward-bits { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; font-weight: 900; font-variant-numeric: tabular-nums; }
.reward-coin { width: 18px; height: 18px; box-shadow: 0 1px 0 #7a4a05; }
.reward-amt { color: #ffd66e; font-size: 0.95rem; }
.reward-gem { display: inline-flex; align-items: center; }
.reward-gem .pu-dot { width: 11px; height: 11px; margin: 0 2px; }

.missions-list { display: flex; flex-direction: column; gap: 10px; }
.mission {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--line);
}
.mission.is-done { border-color: #5fe08e; }
.mission.is-claimed { opacity: 0.55; }
.mission-body { flex: 1; min-width: 0; }
.mission-text { margin: 0 0 6px; font-size: 0.92rem; }
.mission-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.mission-fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #6fc3ff, #2f74d0); }
.mission.is-done .mission-fill, .mission.is-claimed .mission-fill { background: linear-gradient(90deg, #6be39a, #2f9e5a); }
.mission-count { margin: 4px 0 0; font-size: 0.72rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.mission-reward, .mission-claim { flex: none; display: inline-flex; align-items: center; gap: 5px; font-weight: 900; font-variant-numeric: tabular-nums; }
.mission-reward { color: #ffd66e; }
.mission-claim { min-height: 40px; padding: 8px 14px; font-size: 0.95rem; }
.mission-check { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; background: #2f9e5a; }
.missions-bonus { margin: 14px 0 0; text-align: center; font-size: 0.85rem; color: var(--ink-dim); }
.missions-bonus.is-won { color: #ffd66e; font-weight: 900; }

@media (prefers-reduced-motion: reduce) {
  .modal, .modal-card, .daily-tile.is-today, .side-badge, .side-daily .side-icon { animation: none !important; }
}

/* The level card: the number in a burst, what this level gave, what is next. */
.level-burst { display: grid; place-items: center; margin: 8px 0 4px; }
.level-big {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  font-size: 2.6rem;
  font-weight: 900;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #b49aff, #6a43d8 60%, #43259a);
  border: 3px solid #d9cbff;
  box-shadow: 0 0 0 6px rgba(106, 67, 216, 0.25), 0 6px 0 #2b1766, 0 12px 26px rgba(0, 0, 0, 0.5);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
#levelPanel.is-up .level-big { animation: level-pop 700ms cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes level-pop { 0% { scale: 0.3; rotate: -20deg; } 100% { scale: 1; rotate: 0deg; } }
.level-rewards { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.level-reward { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 214, 110, 0.1); border: 1px solid rgba(255, 214, 110, 0.3); font-weight: 800; }
.level-reward .reward-coin { width: 20px; height: 20px; }
.level-reward .pu-dot { width: 13px; height: 13px; margin: 0 3px; }
.level-lookicon { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(#ff5d5d, #ffd66e, #5fe08e, #6fc3ff, #b49aff, #ff5d5d); }
.level-nexthead { margin: 14px 0 6px; font-size: 0.7rem; letter-spacing: 0.2em; color: var(--ink-dim); }
.level-next { display: flex; flex-direction: column; gap: 6px; }
.level-nextrow { display: flex; align-items: baseline; gap: 10px; font-size: 0.82rem; }
.level-nextnum { flex: none; min-width: 3.2em; font-weight: 900; color: #b49aff; }
.level-nexttext { color: var(--ink-dim); margin: 0; }
@media (prefers-reduced-motion: reduce) { #levelPanel.is-up .level-big, .lvl-fill { animation: none !important; transition: none !important; } }

/* --- the Labyrinth (walking a level) ----------------------------------------- */
.walk-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.75) 100%);
}
/* Touch controls: on phones and tablets only, while walking. Translucent at
   rest so the maze shows through; brighter while held. */
.walk-touch { display: none; }
@media (pointer: coarse), (any-pointer: coarse) {
  body.is-walking .walk-touch { display: grid; }
  /* Room for the controls: the compass goes up top, the power-up buttons up a row. */
  body.is-walking .walk-compass { bottom: auto; top: calc(116px + var(--safe-top)); }
  body.is-walking .maze-charges { bottom: calc(176px + var(--safe-bottom)); }
}
.walk-stick {
  position: fixed;
  left: 84px;
  top: calc(100% - 96px - var(--safe-bottom));
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  place-items: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(10, 7, 5, 0.28));
  opacity: 0.55;
  pointer-events: none;
  z-index: 4;
  transition: opacity 120ms ease;
}
.walk-stick.is-active { opacity: 0.95; transition: none; }
.walk-knob {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(216, 208, 194, 0.85) 70%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  transform: translate(var(--dx, 0), var(--dy, 0));
}
.walk-pad {
  position: fixed;
  right: 24px;
  bottom: calc(36px + var(--safe-bottom));
  width: 120px;
  height: 120px;
  place-items: center;
  align-content: center;
  gap: 2px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(10, 7, 5, 0.22));
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  opacity: 0.55;
  pointer-events: none;
  z-index: 4;
  transition: opacity 120ms ease;
}
.walk-pad svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.walk-pad.is-active { opacity: 0.95; border-style: solid; transition: none; }
.maze-viewbtn { font-weight: 900; letter-spacing: 0.04em; }
.maze-walkbtn { display: inline-flex; align-items: center; gap: 6px; background: linear-gradient(#6fc3ff, #2f74d0); color: #fff; border-color: transparent; box-shadow: 0 3px 0 #1d4a8a; }
.walk-icon { font-size: 1.05em; }

.walk-compass {
  position: absolute;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: rgba(10, 7, 5, 0.72);
  border: 1px solid var(--line);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.compass-arrow {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 224, 142, 0.25), rgba(95, 224, 142, 0) 70%);
  position: relative;
}
.compass-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 1px;
  margin-left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 22px solid #5fe08e;
}
.compass-label { font-size: 0.62rem; letter-spacing: 0.16em; color: var(--ink-dim); }
.walk-map {
  position: absolute;
  top: calc(128px + var(--safe-top));
  right: 10px;
  border-radius: 10px;
  border: 2px solid rgba(255, 214, 110, 0.4);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.comfort-list { display: flex; flex-direction: column; gap: 10px; }
.comfort-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); font-size: 0.9rem; }
.comfort-row input[type=range] { grid-column: 1 / -1; grid-row: 2; width: 100%; accent-color: #6fc3ff; }
.comfort-val { grid-column: 2; grid-row: 1; color: #6fc3ff; font-weight: 900; font-variant-numeric: tabular-nums; }
.comfort-toggle input { width: 22px; height: 22px; accent-color: #6fc3ff; }
.explorer-badge { flex: none; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(#6fc3ff, #2f74d0); position: relative; }
.explorer-compass::after { content: ""; position: absolute; left: 6px; top: 3px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 15px solid #fff; }
.explorer-map { border-radius: 5px; background: repeating-linear-gradient(90deg, #f4ead9 0 6px, #6b4a2e 6px 8px), #f4ead9; }

/* --- account card (Gear) and leaderboards ------------------------------------ */
.cloud-card { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); }
.cloud-help { margin: 4px 0 0; color: var(--ink-dim); font-size: 0.8rem; font-weight: 500; }
.cloud-msg { margin: 0; min-height: 1.2em; font-size: 0.8rem; color: var(--ink-dim); }

.maze-rankbtn span + span { margin-left: 6px; }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.board-list li { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); font-size: 0.9rem; }
.board-list li.is-you { background: rgba(255, 214, 110, 0.18); outline: 1px solid rgba(255, 214, 110, 0.5); }
.board-rank { font-weight: 900; color: #ffd66e; font-variant-numeric: tabular-nums; }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-ms { font-weight: 800; font-variant-numeric: tabular-nums; }
.board-empty { text-align: center; color: var(--ink-dim); padding: 12px; }
.board-you { margin: 12px 0 0; text-align: center; font-size: 0.85rem; color: var(--ink-dim); min-height: 1.2em; }

/* --- rewards card: daily / missions / achievements tabs ---------------------- */
.rewards-card { width: min(100%, 420px); }
.rewards-tabs { display: flex; gap: 4px; margin: 12px 0 2px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); }
.rewards-tab {
  position: relative;
  /* Sized by their labels, so ACHIEVEMENTS gets the room it needs. */
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
}
.rewards-tab.is-active { background: linear-gradient(#ffd66e, #e69a22); color: #2a1a08; box-shadow: 0 2px 0 #a8650e; }
.tab-dot { position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #e8413c; box-shadow: 0 0 0 2px #1a130e; }
.rewards-pane .modal-note { margin-top: 10px; }
.rewards-pane .missions-list { max-height: min(56vh, 460px); overflow-y: auto; padding-right: 2px; }
.achievement-name { margin: 0 0 2px; font-weight: 900; letter-spacing: 0.04em; color: #ffd66e; font-size: 0.95rem; }
.achievement .mission-text { color: var(--ink-dim); font-size: 0.82rem; }
.achievement.is-claimed .achievement-name { color: var(--ink); }

/* --- account card and panel ---------------------------------------------------- */
.acct-block { display: flex; flex-direction: column; gap: 10px; }
.acct-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-buttons .maze-btn { flex: 1 1 auto; }
.acct-who { margin: 0; font-weight: 800; }
.acct-who small { display: block; font-weight: 500; color: var(--ink-dim); }
.acct-link { align-self: center; padding: 6px 8px; border: 0; background: none; color: #6fc3ff; font: inherit; font-size: 0.85rem; text-decoration: underline; cursor: pointer; }
.acct-danger { color: #ff8a7a; }
.acct-card { width: min(100%, 380px); }
.acct-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.acct-form input { padding: 12px 14px; border-radius: 12px; border: 2px solid rgba(255, 214, 110, 0.3); background: rgba(0, 0, 0, 0.35); color: var(--ink); font: inherit; font-size: 1rem; }
.acct-form input:focus { outline: none; border-color: #ffd66e; }
.acct-form .maze-btn-big { align-self: stretch; }
.acct-code { text-align: center; font-size: 1.6rem !important; font-weight: 900; letter-spacing: 0.4em; font-variant-numeric: tabular-nums; }
.acct-note { margin: 0; font-size: 0.82rem; color: var(--ink-dim); text-wrap: pretty; }
.acct-msg { margin: 10px 0 0; min-height: 1.2em; text-align: center; font-size: 0.88rem; font-weight: 700; color: #ff8a7a; }
.acct-msg.is-ok { color: #4fd18b; }
.acct-delete:not(:disabled) { background: linear-gradient(#ff7a6a, #c9372a); color: #fff; box-shadow: 0 3px 0 #7d1d14; }

/* The sign-in gate (features.requireLogin): above every other panel, no close. */
#accountPanel.is-gate { z-index: 80; background: rgba(6, 4, 3, 0.92); }
#accountPanel.is-gate .modal-close { display: none; }
.acct-gate-note { margin: 8px 0 0; text-align: center; font-size: 0.88rem; color: var(--ink-dim); text-wrap: balance; }
.acct-gate-note p { margin: 0 0 4px; }

/* --- the landing site (index.html's LANDING; web only) ------------------------- */
.landing {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  /* The game page stops all touch scrolling and selection (body); the
     site is a page to read, so it scrolls, and its text can be selected. */
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
  overscroll-behavior: contain;
  background: #15100c;
  color: var(--ink);
  text-align: left;
}
.lp-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: calc(10px + var(--safe-top)) max(16px, calc(50% - 560px)) 10px;
  background: rgba(21, 16, 12, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 214, 110, 0.14);
}
.lp-brand { font-size: 1.6rem; font-weight: 900; line-height: 1; text-decoration: none; white-space: nowrap; letter-spacing: -0.01em; }
.lp-links { display: none; gap: 22px; margin-left: 8px; }
.lp-links a { color: var(--ink-dim); text-decoration: none; font-weight: 700; font-size: 0.9rem; }
.lp-links a:hover { color: var(--ink); }
.lp-auth { margin-left: auto; display: flex; gap: 8px; }
.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 0;
  font: inherit;
  font-weight: 900;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
}
.lp-gold { background: linear-gradient(#ffd66e, #e9a43a); color: #2a1a08; box-shadow: 0 3px 0 #a8650e; }
.lp-gold:active { transform: translateY(2px); box-shadow: 0 1px 0 #a8650e; }
.lp-ghost { background: rgba(255, 255, 255, 0.06); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(244, 234, 217, 0.3); }
.lp-big { min-height: 52px; padding: 0 28px; font-size: 1.05rem; }
.landing main { display: block; }
.lp-hero { position: relative; min-height: min(78vh, 720px); display: grid; align-items: end; overflow: hidden; }
.lp-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lp-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21, 16, 12, 0.15) 0%, rgba(21, 16, 12, 0.35) 45%, #15100c 100%); }
.lp-hero-text { position: relative; z-index: 1; padding: 0 16px 40px; max-width: 1120px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.lp-logo { margin: 0; font-size: clamp(3rem, 15vw, 6rem); font-weight: 900; line-height: 1; letter-spacing: -0.01em; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.5)) drop-shadow(0 10px 24px rgba(0, 0, 0, 0.6)); }
.lp-tagline { margin: 14px 0 6px; font-size: clamp(1.3rem, 5vw, 2rem); font-weight: 900; text-wrap: balance; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7); }
.lp-sub { margin: 0 0 22px; max-width: 34em; color: #e8dcc6; font-size: 1rem; line-height: 1.5; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.lp-ctas { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* PLAY AS GUEST (features.guestPlay): a quiet link under the big buttons, so
   making an account stays the obvious choice. 44px tall for a thumb. */
.lp-guest { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; padding: 0 4px; border: 0; background: none; color: #e8dcc6; font: inherit; font-size: 0.95rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); cursor: pointer; }
.lp-guest:hover { color: var(--ink); }
.lp-guest[hidden] { display: none; }
.lp-section { max-width: 1120px; margin: 0 auto; padding: 64px 16px; box-sizing: border-box; }
.lp-section + .lp-section { border-top: 1px solid rgba(255, 214, 110, 0.08); }
.lp-kicker { margin: 0 0 8px; color: #ffd66e; font-weight: 900; font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; }
.lp-section h2 { margin: 0 0 12px; font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 900; line-height: 1.1; text-wrap: balance; }
.lp-lead { margin: 0 0 18px; max-width: 36em; color: #d8cbb4; font-size: 1.02rem; line-height: 1.55; }
.lp-points { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; max-width: 34em; }
.lp-points li { position: relative; padding-left: 22px; color: #d8cbb4; line-height: 1.5; }
.lp-points li::before { content: ""; position: absolute; left: 2px; top: 0.55em; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6dc, #f0b23a 60%, #a8650e); }
.lp-points b { color: var(--ink); }
.lp-worlds { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 26px 0 0; }
.lp-world { display: grid; grid-template-rows: auto 1fr; border-radius: 16px; overflow: hidden; background: #221a14; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); }
.lp-world img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.lp-world > div { padding: 14px 16px 16px; }
.lp-world h3 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.lp-world h3 small { font-size: 0.78rem; font-weight: 700; opacity: 0.6; }
.lp-world h3 span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #ffd66e; color: #2a1a08; font-size: 0.85rem; }
.lp-world p { margin: 0 0 10px; color: #c9bba3; font-size: 0.92rem; line-height: 1.45; }
.lp-world ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lp-world li { padding: 4px 10px; border-radius: 999px; background: rgba(255, 214, 110, 0.12); color: #ffd66e; font-size: 0.78rem; font-weight: 800; }
.lp-cta-row { margin-top: 26px; }
.lp-split { display: grid; gap: 28px; align-items: center; }
.lp-shot img { display: block; width: 100%; height: auto; border-radius: 18px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.lp-shot:not(.lp-phone) img { aspect-ratio: 3 / 2; object-fit: cover; }
.lp-phone { justify-self: center; width: min(68%, 300px); }
.lp-phone img { border-radius: 28px; border: 6px solid #2b211a; box-shadow: 0 0 0 1px rgba(255, 214, 110, 0.2), 0 18px 44px rgba(0, 0, 0, 0.55); }
.lp-final { text-align: center; padding-block: 80px; }
.lp-final .lp-lead { margin-inline: auto; }
.lp-final .lp-ctas { justify-content: center; }
.lp-foot { padding: 28px 16px calc(28px + var(--safe-bottom)); text-align: center; color: var(--ink-dim); font-size: 0.82rem; border-top: 1px solid rgba(255, 214, 110, 0.08); }
/* A phone's top bar has to hold the brand and both buttons in ~358px. */
@media (max-width: 480px) {
  .lp-nav { gap: 8px; }
  .lp-brand { font-size: 1.3rem; }
  .lp-auth { gap: 6px; }
  .lp-nav .lp-btn { min-height: 36px; padding: 0 11px; font-size: 0.78rem; }
  .lp-hero { min-height: 0; }
  .lp-hero-text { padding-top: 46vw; }
}
@media (max-width: 350px) {
  .lp-brand { font-size: 1.1rem; }
  .lp-nav .lp-btn { padding: 0 9px; font-size: 0.72rem; }
}
@media (min-width: 720px) {
  .lp-links { display: flex; }
  .lp-worlds { grid-template-columns: repeat(2, 1fr); }
  .lp-split { grid-template-columns: 1fr 1fr; gap: 48px; }
  .lp-split.lp-flip .lp-shot { order: 2; }
  .lp-hero-text { padding-bottom: 64px; }
}
/* Five worlds: three across, then the last two sharing the row. */
@media (min-width: 1000px) {
  .lp-worlds { grid-template-columns: repeat(6, 1fr); }
  .lp-world { grid-column: span 2; }
  .lp-world:nth-child(4), .lp-world:nth-child(5) { grid-column: span 3; }
}
/* Over the landing site, the account panel is a normal closable card. */
#accountPanel.over-landing { z-index: 90; }
