/* Tidal Defense styles. Same family as Rock Pool and Riptide: fonts, colours and
   building blocks (cards, pill buttons, sheets). Fonts are self-hosted (fonts/). */

@font-face {
  font-family: 'Syne';
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url('../fonts/syne.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/outfit.woff2') format('woff2');
}

:root {
  --abyss: #061014;
  --depth: #0e2c30;
  --foam: #e8f6f3;
  --mist: #93b0b4;
  --tide: #2ee6c7;
  --flare: #ff5d3a;
  --sand: #f0c14d;
  --leaf: #8fce5c;
  --panel: rgba(12, 30, 33, 0.96);
  --line: rgba(232, 246, 243, 0.14);
  /* Reserved band at the top (as in Riptide and Rock Pool) so a ~44px platform
     badge can never cover the game. Short landscape phones use the side layout. */
  --badge-reserve: 56px;
  --safe-top: calc(var(--badge-reserve) + env(safe-area-inset-top, 0px));
  --safe-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  --gutter: 16px;
  --pad: 12px;
  --display: 'Syne', 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (max-width: 359px) {
  :root { --gutter: 6px; }
}

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

html, body {
  margin: 0;
  height: 100%;
  background: #040b0e;
  color: var(--foam);
  font-family: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body {
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(14, 58, 60, 0.55), transparent 60%),
    radial-gradient(80% 60% at 50% -10%, rgba(14, 44, 48, 0.35), transparent 70%),
    #040b0e;
}
p, h1, h2, ol, dl { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; }
.nums { font-variant-numeric: tabular-nums; }
.noscript { position: fixed; inset: auto 0 20px; text-align: center; }

/* ---------- Layout (sizes set by js/app.js, layout()) ---------- */

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  padding: var(--safe-top) max(var(--gutter), env(safe-area-inset-right, 0px)) var(--safe-bottom) max(var(--gutter), env(safe-area-inset-left, 0px));
}
.app.wide { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: clamp(24px, 3vw, 64px); }
.app.wide .stage { grid-column: 2; }
.app.split {
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
}
.rail { min-width: 0; display: none; }
.app.wide .rail { display: block; }
.rail-left { justify-self: end; }
.rail-right { justify-self: start; }
.rail-copy, .rail .rules { width: min(300px, 100%); }
.rail-left .rail-copy { margin-left: auto; }
.rail-title { margin: 10px 0 14px; font-family: var(--display); font-weight: 800; line-height: 1; }
.rail .lede { opacity: 0.9; }

.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.rules li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; align-items: start; color: var(--mist); font-size: 14px; line-height: 1.5; }
.rules strong { display: block; color: var(--foam); font-weight: 600; font-size: 15px; }
.pip { width: 9px; height: 9px; border-radius: 50%; background: var(--tide); margin-top: 6px; }
.pip.sand { background: var(--sand); }
.pip.flare { background: var(--flare); }

.stage {
  position: relative;
  width: min(420px, 100%);
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
  background: var(--abyss);
  border: 1px solid rgba(147, 176, 180, 0.2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(46, 230, 199, 0.03);
  user-select: none;
  -webkit-user-select: none;
  container-type: inline-size;
}
.stage.compact { border-radius: 20px; }
/* narrow phones: a little less padding so 5 command buttons of 56 px fit side by side */
@container (max-width: 340px) {
  .stage .play { padding: 8px 6px; row-gap: 6px; }
  .stage .hud { gap: 6px; }
  .stage .hud-stats { gap: 9px; }
  .stage .stat { gap: 3px; }
  .stage .stat strong { font-size: 18px; }
  .stage .stat-fish strong { font-size: 20px; }
  .stage .stat-icon { width: 18px; height: 18px; }
}

.fit { white-space: nowrap; overflow: visible; }
.fit > span { display: inline-block; white-space: nowrap; }

/* ---------- Shared text + buttons ---------- */

.kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mist); }
.lede { font-size: 15px; line-height: 1.5; font-weight: 500; }
.fine-print { font-size: 11.5px; line-height: 1.4; color: var(--mist); }

.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: 1px solid rgba(232, 246, 243, 0.22); background: rgba(6, 16, 20, 0.35);
  display: grid; place-items: center; padding: 0;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: rgba(232, 246, 243, 0.06); }

.launch {
  width: 100%; min-height: 54px; border: 0; border-radius: 999px;
  background: var(--tide); color: #03201b;
  font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: 0.2em; text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(46, 230, 199, 0.18);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.launch:hover { filter: brightness(1.06); }
.launch:active { transform: scale(0.98); }
.launch .btn-main { display: block; line-height: 1.1; }
.launch .btn-sub { display: block; margin-top: 2px; font-family: var(--text); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: none; opacity: 0.85; }
.ghost {
  width: 100%; min-height: 46px; border-radius: 999px; border: 1px solid rgba(232, 246, 243, 0.22);
  background: transparent; font-weight: 600; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; padding: 0 8px;
}
.ghost:hover { background: rgba(232, 246, 243, 0.05); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Game screen ---------- */

.play {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px 24px 30px minmax(0, 1fr) 34px auto;
  grid-template-areas: "hud" "pool" "tide" "map" "status" "cmd";
  row-gap: 8px;
  padding: var(--pad);
}
.hud { grid-area: hud; display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-stats { flex: 1; min-width: 0; display: flex; justify-content: center; align-items: center; gap: 18px; }
.stat { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mist); white-space: nowrap; }
/* numbers use Outfit: Syne's extra-bold 0 reads like a ring and its 9 like a g */
.stat strong { color: var(--foam); font-family: var(--text); font-weight: 700; font-size: 21px; line-height: 1; min-width: 1.4ch; }
.stat-fish strong { color: var(--sand); font-size: 24px; }
.stat-defeated strong { color: #ffb59e; }
.stat-leaves strong { color: var(--leaf); }
/* v4 survival: home hearts + the survived clock (in the tide row) */
.hud-hearts { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; }
.hearts { display: inline-flex; gap: 1px; }
.hearts i { display: block; width: 14px; height: 14px; }
.hearts svg { width: 100%; height: 100%; display: block; fill: #ff6f91; stroke: #fff; stroke-width: 1.6; }
.hearts i.lost svg { fill: rgba(232, 246, 243, 0.14); stroke: rgba(232, 246, 243, 0.4); }
.survived { font-size: 12.5px; font-weight: 700; color: var(--foam); }
.hud-hearts.bump .hearts { animation: bump 0.4s ease; }
/* v5: holes (mound + nest leaves left) replace the v4 home hearts */
.hearts { gap: 4px; }
.hearts i.hole, .app.split.tight .hearts i.hole { width: auto; height: 14px; display: inline-flex; align-items: center; gap: 1px; }
.hearts i.hole svg { width: 14px; height: 14px; fill: #b98a5a; stroke: #fff; stroke-width: 1.2; }
.hearts i.hole svg .pit { fill: #2a1d12; stroke: none; }
.hearts i.hole b { font-size: 11px; line-height: 1; font-weight: 700; color: #fff6c8; }
.hearts i.hole.lost svg { fill: rgba(232, 246, 243, 0.14); stroke: rgba(232, 246, 243, 0.4); }
.hearts i.hole.lost b { color: #ffb59e; }
.mark.new-best { color: #ffd0e0; }
.stat-icon { width: 22px; height: 22px; flex: none; }
.stat.bump strong { animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: scale(1.35); } }

/* the dam pool and the egg progress (leaves brought home toward the next egg) */
.pool-row { grid-area: pool; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 14px; min-width: 0; }
.row-icon { width: 18px; height: 18px; flex: none; }
.row-name { font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 10.5px; color: #7fd8e6; }
.pool { display: flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; min-width: 0; }
#pool-text { color: var(--foam); font-weight: 700; }
.pool.dry #pool-text { color: var(--sand); }
.pool.wet #pool-text { color: #9fe9ff; }
.pool.none #pool-text { color: var(--mist); font-weight: 600; }
.egg-wrap { display: grid; grid-template-columns: 18px auto minmax(0, 1fr) auto; align-items: center; column-gap: 6px; min-width: 0; }
.egg-wrap .row-name { color: #f3d9a8; }
.egg-bar { position: relative; min-width: 40px; height: 12px; border-radius: 999px; background: rgba(3, 8, 12, 0.6); border: 1px solid rgba(243, 217, 168, 0.45); overflow: hidden; }
.egg-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, #6ea84a, #bff59a 75%, #f3e6c8); transition: width 0.25s ease; }
.egg-text { font-size: 12.5px; font-weight: 700; color: var(--foam); white-space: nowrap; min-width: 4.4ch; text-align: right; }
.egg-wrap.off .egg-text { color: var(--mist); font-weight: 600; }
.egg-wrap.off .egg-bar { opacity: 0.5; }
.egg-wrap.paused .egg-bar { border-color: rgba(240, 193, 77, 0.8); border-style: dashed; }
.egg-wrap.paused .egg-fill { filter: grayscale(0.7) brightness(0.8); }
.egg-wrap.paused .egg-text { color: var(--sand); }
.egg-wrap.live .egg-fill { background: linear-gradient(90deg, #ff8fb4, #ffd0e0); }
.egg-wrap.live .egg-text { color: #ffd0e0; }
.egg-wrap.alert .egg-fill { background: linear-gradient(90deg, #8a4fd1, #c9a2ff); }
.egg-wrap.alert .egg-text { color: #e2c9ff; }
.egg-wrap.alert .egg-bar { animation: drypulse 0.6s ease-in-out infinite alternate; }
@keyframes drypulse { to { background: rgba(201, 162, 255, 0.25); } }
.egg-wrap.bump .egg-text { animation: bump 0.35s ease; }
.tide { grid-area: tide; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; column-gap: 10px; min-width: 0; }
.tide-label { font-size: 12.5px; color: var(--mist); white-space: nowrap; min-width: 0; }
#tide-text { color: var(--foam); font-weight: 600; }
.tide.soon #tide-text, .tide.rising #tide-text { color: #9fe9ff; }
.tide.falling #tide-text { color: #bff59a; }
.tide-bar { position: relative; height: 12px; border-radius: 999px; background: rgba(3, 8, 12, 0.6); border: 1px solid rgba(127, 216, 230, 0.35); overflow: hidden; }
.tide-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, #1d6a76, #3ea3a6 70%, #a9eef2); }
.tide.rising .tide-fill { animation: surgepulse 0.9s ease-in-out infinite alternate; }
@keyframes surgepulse { to { filter: brightness(1.35); } }

.map-wrap { grid-area: map; position: relative; min-width: 0; min-height: 0; border-radius: 16px; overflow: hidden; background: #0b1d20; }
.map-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
.status { grid-area: status; font-size: 13px; line-height: 17px; color: var(--mist); text-align: center; display: grid; align-items: center; overflow: hidden; }
.status.good { color: var(--leaf); font-weight: 600; }
.status.warn { color: var(--sand); font-weight: 600; }
/* a job button is armed: the status line says what to tap */
.status.arm { color: #ffe58a; font-weight: 700; background: rgba(240, 193, 77, 0.12); border: 1px solid rgba(240, 193, 77, 0.45); border-radius: 12px; padding: 0 8px; }
/* short phones: the status line floats over the bottom of the map (taps pass through) */
.stage.short .play { grid-template-rows: 44px 24px 30px minmax(0, 1fr) auto; grid-template-areas: "hud" "pool" "tide" "map" "cmd"; }
.stage.short .status {
  grid-area: map; align-self: end; justify-self: center; z-index: 2; pointer-events: none;
  margin: 0 6px 5px; padding: 3px 9px; min-height: 0; border-radius: 10px; font-size: 12px; line-height: 15px;
  background: rgba(6, 16, 20, 0.86); border: 1px solid rgba(232, 246, 243, 0.14);
}
.stage.short .status.arm { background: rgba(40, 30, 6, 0.92); border-color: rgba(240, 193, 77, 0.7); }

/* ---------- v3 command bar: 7 jobs + Go (hero) + Idle: n + Upgrade; every button >= 56 px ---------- */
.cmdbar { grid-area: cmd; display: grid; grid-template-columns: repeat(5, minmax(56px, 1fr)); gap: 6px; min-width: 0; }
.cmdbar.one-row { grid-template-columns: repeat(10, minmax(56px, 1fr)); }
.cmd {
  position: relative; min-width: 56px; min-height: 56px; padding: 5px 2px 4px; border-radius: 14px;
  border: 1.5px solid rgba(232, 246, 243, 0.18); background: rgba(14, 44, 48, 0.55); color: var(--foam);
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; row-gap: 1px;
  touch-action: manipulation; transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.cmd:hover { background: rgba(46, 230, 199, 0.08); }
.cmd:active { transform: scale(0.95); }
.cmd-icon { width: 27px; height: 27px; display: block; }
.cmd-label { font-size: 12px; font-weight: 700; line-height: 1.1; letter-spacing: 0.01em; white-space: nowrap; }
.cmd[aria-disabled="true"] { opacity: 0.4; }
.cmd[aria-disabled="true"]:active { transform: none; }
.cmd.current { border-color: var(--tide); background: rgba(46, 230, 199, 0.14); box-shadow: inset 0 0 0 1px rgba(46, 230, 199, 0.35); }
.cmd.current .cmd-label { color: #9ff5e4; }
.cmd.armed { border-color: #ffe58a; background: rgba(240, 193, 77, 0.3); box-shadow: 0 0 0 2px rgba(255, 229, 138, 0.45); animation: armpulse 0.9s ease-in-out infinite alternate; }
.cmd.armed .cmd-label { color: #fff6c8; }
@keyframes armpulse { to { box-shadow: 0 0 0 4px rgba(255, 229, 138, 0.18); background: rgba(240, 193, 77, 0.42); } }
.cmd-badge { display: none; position: absolute; top: 4px; right: 4px; width: 13px; height: 13px; }
.cmd.bonus .cmd-badge { display: block; background: var(--sand);
  clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 61%, 80% 98%, 50% 77%, 20% 98%, 30% 61%, 0 38%, 38% 35%); }
.cmd-idle.has { border-color: rgba(240, 193, 77, 0.75); }
.cmd-idle.has .cmd-label { color: var(--sand); }
.cmd-shop.has { border-color: rgba(143, 206, 92, 0.8); }
.cmd-shop.has .cmd-badge { display: block; width: 11px; height: 11px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 2px rgba(6, 16, 20, 0.9); animation: dotpulse 1s ease-in-out infinite alternate; }
@keyframes dotpulse { to { transform: scale(1.3); } }
@container (max-width: 340px) {
  .cmdbar { gap: 4px; }
  .cmd-label { font-size: 11px; }
  .cmd-icon { width: 25px; height: 25px; }
}
.play.behind { visibility: hidden; }

/* Side layout (short landscape phones): the map on the left, a slim panel on the right. */
.app.split .play {
  grid-template-columns: var(--map-w, 60%) minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "map hud" "map pool" "map tide" "map ." "map status" "map cmd";
  column-gap: 12px;
  row-gap: 10px;
  padding: 8px;
}
.app.split .hud { flex-wrap: wrap; justify-content: space-between; row-gap: 8px; }
.app.split .stat-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app.split .hud-stats { order: 3; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-start; gap: 6px 14px; }
.app.split .cmdbar { grid-template-columns: repeat(5, minmax(56px, 1fr)); gap: 4px; }
.app.split .tide { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }
.app.split .tide-bar { grid-column: 1 / -1; }
.app.split .pool-row { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
.app.split .egg-wrap { grid-template-columns: 18px auto minmax(0, 1fr) auto; }
.app.split .tide-label { white-space: normal; line-height: 1.3; }
.app.split .status { white-space: normal; line-height: 1.35; text-align: left; align-self: end; }
/* tight side layout (667x375, 568x320): one HUD row, pool + egg and tide on one line each.
   tiny (568x320 only): a 250 px panel with 48 px buttons so the map stays big enough to play. */
.app.split.tight .play { row-gap: 6px; column-gap: 10px; padding: 8px; }
.app.split.tight .hud { flex-wrap: nowrap; gap: 6px; row-gap: 0; }
.app.split.tight .hud-stats { order: 0; flex: 1 1 auto; flex-wrap: nowrap; justify-content: center; gap: 4px 10px; }
.app.split.tight .pool-row { grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 0; }
.app.split.tight .row-name { display: none; }
.app.split.tight .egg-wrap { grid-template-columns: 18px minmax(0, 1fr) auto; }
.app.split.tight .tide { grid-template-columns: auto auto minmax(0, 1fr); row-gap: 0; column-gap: 8px; }
.app.split.tight .tide-bar { grid-column: auto; }
.app.split.tight .hearts i { width: 12px; height: 12px; }
.app.split.tight .tide-label { white-space: nowrap; font-size: 11.5px; }
.app.split.tight .status { font-size: 12px; line-height: 1.3; }
.app.split.tight .hud { gap: 4px; }
.app.split.tight .hud-stats { justify-content: space-evenly; gap: 4px 6px; }
.app.split.tight .stat-icon { width: 18px; height: 18px; }
/* tight: the upgrades panel and end screen squeeze to fit 300-355 px tall */
.app.split.tight #shop-card { padding: 4px; }
.app.split.tight .card.shop { padding: 6px 10px; gap: 4px; }
.app.split.tight .card.shop .card-title { font-size: 18px; }
.app.split.tight .shop-art { width: 28px; height: 28px; }
.app.split.tight .shop-row-head { grid-template-columns: 28px minmax(0, 1fr); }
.app.split.tight .shop-row { padding: 6px; gap: 4px; }
.app.split.tight .shop-buy { min-height: 44px; }
.app.split.tight .card.shop .shop-done { min-height: 44px; }
.app.split.tight .shop-note { font-size: 11px; line-height: 1.25; }
.app.split .almanac { flex-wrap: wrap; row-gap: 4px; }
.app.split .crab-tile { flex: 0 0 calc(20% - 4px); max-width: 56px; }
.app.split.tiny .cmdbar { grid-template-columns: repeat(5, minmax(46px, 1fr)); gap: 4px; }
.app.split.tiny .cmd { min-width: 46px; min-height: 48px; padding: 3px 1px 2px; border-radius: 12px; }
.app.split.tiny .cmd-icon { width: 22px; height: 22px; }
.app.split.tiny .cmd-label { font-size: 10px; }

/* ---------- Sheets (title, end) ---------- */

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 18px 20px;
  background: linear-gradient(180deg, rgba(14, 34, 38, 0.97), rgba(9, 24, 27, 0.99));
  border-top: 1px solid var(--line);
  z-index: 3;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet.cover { top: 0; border-top: 0; }
.sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-title { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.15; margin-top: 2px; }
.title-head { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-height: 0; overflow: hidden; }
.title-head .hero { min-height: 0; }
/* Keep Play/mute on-screen: title-head may shrink; actions never scroll away first */
.title-actions { display: grid; gap: 10px; flex: 0 0 auto; }
.wordmark { margin: 2px 0 0; font-family: var(--display); font-weight: 800; line-height: 1; }
.hero { flex: 1 1 0; min-height: 0; position: relative; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tips { list-style: none; padding: 0; display: grid; gap: 8px; }
.tips li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; line-height: 1.35; color: var(--mist); }
.tips strong { color: var(--foam); font-weight: 700; margin-right: 3px; }
.tip-art { width: 44px; height: 44px; border-radius: 12px; background: #6f5238; display: block; }
.title-row { min-height: 44px; }
.keys-note { flex: 1; min-width: 0; }
  font-size: inherit; color: var(--mist); text-decoration: underline; text-underline-offset: 3px;
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 3px;
}

/* End of round */
.end { justify-content: center; align-items: center; }
.end-main, .end .actions { width: 100%; max-width: 440px; }
.end-main { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.actions { display: grid; gap: 10px; }
.sheet.end.enter { animation: sheetup 0.32s ease-out both; }
@keyframes sheetup { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.mark { font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sand); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats > div { min-width: 0; padding: 9px 10px; border-radius: 12px; background: rgba(3, 8, 12, 0.55); border: 1px solid rgba(232, 246, 243, 0.06); }
.stats dt { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mist); }
.stats dd { margin: 4px 0 0; font-family: var(--text); font-weight: 700; font-size: 22px; line-height: 1.2; }
#end-safe { color: var(--leaf); }
.score-card { padding: 8px 12px 10px; border-radius: 14px; background: rgba(240, 193, 77, 0.08); border: 1px solid rgba(240, 193, 77, 0.35); }
.score-name { font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sand); }
.score-big { font-family: var(--text); font-weight: 800; font-size: 34px; line-height: 1.1; color: var(--foam); }
.stats.mini { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stats.mini > div { padding: 6px 6px; border-radius: 10px; }
.stats.mini dt { font-size: 9px; letter-spacing: 0.08em; white-space: nowrap; }
.stats.mini dd { font-size: 17px; margin-top: 2px; }
#end-fish { color: var(--sand); }
#end-defeated { color: #ffb59e; }
.score-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.score-card.crabs { background: rgba(224, 83, 58, 0.08); border-color: rgba(255, 181, 158, 0.4); }
.score-card.crabs .score-name { color: #ffb59e; }
.almanac-wrap { display: grid; gap: 4px; }
.almanac-title { font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mist); }
.almanac { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; row-gap: 4px; }
/* one row always: tiles share the width (up to 54 px each) */
.crab-tile { flex: 0 1 calc(16.6% - 5px); min-width: 0; max-width: 54px; display: grid; justify-items: center; gap: 2px; padding: 4px 2px 3px; border-radius: 10px;
  background: rgba(3, 8, 12, 0.45); border: 1px dashed rgba(232, 246, 243, 0.18); }
.crab-tile.met { border-style: solid; border-color: rgba(255, 181, 158, 0.45); background: rgba(3, 8, 12, 0.6); }
.crab-tile canvas { width: 100%; max-width: 40px; height: auto; aspect-ratio: 5 / 4; display: block; }
.crab-tile span { font-size: 9.5px; font-weight: 700; line-height: 1.1; color: var(--mist); text-align: center; }
.crab-tile.met span { color: var(--foam); }

/* Wide stages (landscape tablets and desktops) and the side layout: sheets in two columns. */
.app.landscape #title-sheet, .app.split #title-sheet {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 22px; align-items: center;
}
.app.landscape #title-sheet { padding: 28px 32px; column-gap: 36px; }
.app.landscape #title-sheet[hidden], .app.split #title-sheet[hidden] { display: none !important; }
.app.landscape .title-head, .app.split .title-head { height: 100%; }
.app.split .sheet { padding: 10px 14px; gap: 8px; }
.app.split .title-head { gap: 4px; }
.app.split .title-actions { gap: 6px; }
.app.split .lede { font-size: 13px; line-height: 1.35; }
.app.split .tips { gap: 4px; }
.app.split .tips li { font-size: 11.5px; line-height: 1.25; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
.app.split .launch { min-height: 46px; }
.app.split .launch .btn-sub { display: none; }
.app.split .keys-note { display: none; }
.app.split .title-row { display: none; }
.app.split .end { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); column-gap: 18px; row-gap: 6px; align-items: center; align-content: center; }
/* side layout: the stats on the left, the crab almanac above the buttons on the right */
.app.split .end-main { display: contents; }
.app.split .end-main > * { grid-column: 1; }
.app.split .end .almanac-wrap { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.app.split .end .actions { grid-column: 2; grid-row: 4 / span 3; align-self: center; }
.app.split .end .almanac-title { display: block; text-align: center; }
.app.split .end[hidden] { display: none !important; }
.app.split .end-main { gap: 6px; }
.app.split .stats > div { padding: 5px 6px; }
.app.split .stats dd { font-size: 17px; margin-top: 1px; }
.app.split .stats.mini dd { font-size: 14px; margin-top: 0; }
.app.split .stats.mini > div { padding: 3px 5px; }
.app.split .score-card { padding: 4px 10px 5px; }
.app.split .score-big { font-size: 24px; }
.app.split .end-next { display: none; }
.app.split .sheet-title { font-size: 20px; }

/* ---------- Modal (pause) ---------- */

.modal {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; align-items: safe center;
  padding: 14px; overflow-y: auto; background: rgba(3, 8, 12, 0.72); backdrop-filter: blur(3px);
}
.card {
  width: 100%; max-width: 360px; display: grid; gap: 12px; padding: 20px 18px; border-radius: 20px;
  background: var(--panel); border: 1px solid rgba(46, 230, 199, 0.35); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.card-title { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.15; }
/* the baby's power choice: big, friendly cards */
.card.choice { border-color: rgba(255, 175, 205, 0.6); max-width: 420px; gap: 10px; }
.picks { display: grid; gap: 8px; }
.pick {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; column-gap: 12px; text-align: left;
  min-height: 64px; padding: 6px 12px 6px 6px; border-radius: 16px; border: 2px solid rgba(46, 230, 199, 0.35);
  background: rgba(3, 8, 12, 0.5); color: var(--foam);
}
.pick:hover, .pick:focus-visible { border-color: var(--tide); background: rgba(46, 230, 199, 0.1); }
.pick canvas { width: 52px; height: 52px; border-radius: 12px; display: block; }
.pick-name { display: block; font-weight: 800; font-size: 16px; line-height: 1.2; }
.pick-what { display: block; font-size: 12.5px; line-height: 1.3; color: var(--mist); margin-top: 1px; }
.pick-body { display: block; min-width: 0; }
.pick-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pick-cost { display: inline-flex; align-items: center; gap: 3px; flex: none; padding: 2px 8px 2px 5px; border-radius: 999px;
  background: rgba(143, 206, 92, 0.14); border: 1px solid rgba(143, 206, 92, 0.5); font-size: 13px; color: #d8f5c2; }
.pick-cost b { font-weight: 800; }
.pick-cost .leaf-ico { width: 15px; height: 15px; }
.pick.cant { border-style: dashed; border-color: rgba(232, 246, 243, 0.25); background: rgba(3, 8, 12, 0.35); }
.pick.cant canvas { filter: grayscale(0.85) brightness(0.7); }
.pick.cant .pick-name { color: var(--mist); }
.pick.cant .pick-what { color: var(--sand); font-weight: 600; }
.pick.cant .pick-cost { background: rgba(232, 246, 243, 0.06); border-color: rgba(232, 246, 243, 0.2); color: var(--mist); }
.pick.cant:hover, .pick.cant:focus-visible { border-color: rgba(240, 193, 77, 0.7); background: rgba(3, 8, 12, 0.35); }
.choice-note.warn { color: var(--sand); font-weight: 600; }

/* the upgrades panel */
.card.shop { max-width: 400px; gap: 10px; border-color: rgba(143, 206, 92, 0.55); }
.card.shop > * { min-width: 0; }
.shop-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 10px; }
.shop-stock { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 6px; border-radius: 999px; white-space: nowrap;
  background: rgba(143, 206, 92, 0.14); border: 1px solid rgba(143, 206, 92, 0.5); font-size: 13px; color: #d8f5c2; }
.shop-stock strong { font-size: 18px; font-weight: 800; color: #ecffdf; }
.leaf-ico { width: 18px; height: 18px; flex: none; }
.shop-rows { display: grid; gap: 10px; }
.shop-row { display: grid; gap: 8px; padding: 10px; border-radius: 16px; background: rgba(3, 8, 12, 0.5); border: 1px solid rgba(232, 246, 243, 0.12); }
.shop-row-head { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; align-items: center; }
.shop-art { width: 48px; height: 48px; border-radius: 12px; display: block; }
.shop-name { font-weight: 800; font-size: 16px; }
.shop-now { font-size: 12.5px; line-height: 1.3; color: var(--mist); }
.shop-tiers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.shop-tiers li { display: grid; justify-items: center; gap: 1px; padding: 5px 3px; border-radius: 10px; text-align: center;
  background: rgba(14, 44, 48, 0.6); border: 1px solid rgba(232, 246, 243, 0.12); min-width: 0; }
.tier-n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; background: rgba(232, 246, 243, 0.12); }
.tier-name { font-size: 11.5px; font-weight: 700; line-height: 1.15; }
.tier-cost { font-size: 10.5px; color: var(--mist); }
.shop-tiers li.own { border-color: rgba(46, 230, 199, 0.55); background: rgba(46, 230, 199, 0.1); }
.shop-tiers li.own .tier-n { background: var(--tide); color: #03201b; }
.shop-tiers li.next { border-color: rgba(143, 206, 92, 0.75); }
.shop-tiers li.next .tier-cost { color: #d8f5c2; font-weight: 700; }
.shop-tiers li.cant { opacity: 0.55; border-style: dashed; }
.shop-buy { min-height: 48px; border-radius: 999px; border: 0; background: var(--leaf); color: #10240a; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; }
.shop-buy .buy-cost { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px 2px 4px; border-radius: 999px; background: rgba(16, 36, 10, 0.18); }
.shop-buy .leaf-ico { width: 16px; height: 16px; }
.shop-buy.cant { background: rgba(232, 246, 243, 0.08); color: var(--sand); border: 1px dashed rgba(240, 193, 77, 0.55); font-weight: 700; }
.shop-buy.done { background: rgba(46, 230, 199, 0.15); color: #9ff5e4; border: 1px solid rgba(46, 230, 199, 0.5); }
.card.shop .shop-done { min-height: 50px; }
.shop-note { text-align: center; min-height: 2.6em; display: grid; align-items: center; }
.shop-note.good { color: var(--leaf); font-weight: 700; }
.shop-note.warn { color: var(--sand); font-weight: 600; }
@media (max-height: 700px) {
  #shop-card { padding: 8px; }
  .card.shop { padding: 10px; gap: 6px; }
  .card.shop .kicker { display: none; }
  .card.shop .card-title { font-size: 20px; }
  .shop-row { padding: 7px; gap: 5px; }
  .shop-row-head { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
  .shop-art { width: 34px; height: 34px; border-radius: 9px; }
  .shop-now { display: none; }
  .shop-tiers li { padding: 3px 2px; }
  .shop-buy { min-height: 44px; font-size: 14px; }
  .shop-note { min-height: 0; }
  .card.shop .shop-done { min-height: 46px; }
}
@container (max-width: 340px) {
  .tier-name { font-size: 10.5px; }
}
.pick.collector { border-color: rgba(240, 193, 77, 0.55); }
.pick.defence { border-color: rgba(110, 170, 255, 0.6); }
.pick.attack { border-color: rgba(255, 120, 110, 0.6); }
.pick.construction { border-color: rgba(255, 196, 90, 0.6); }
.pick:hover, .pick:focus-visible { border-color: var(--tide); }
.choice-note { text-align: center; }
.app.split .card.choice { padding: 10px 14px; gap: 6px; max-width: 640px; }
.app.split .picks { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.app.split .pick { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 6px; row-gap: 2px; }
.app.split .pick canvas { width: 40px; height: 40px; }
.app.split .pick-what { font-size: 11px; }
.app.split .pick-body { width: 100%; }
.app.split .choice-note { display: none; }
.app.split .pick-top { flex-direction: column; gap: 2px; }
.app.split .card.shop { max-width: 640px; grid-template-columns: minmax(0, 1fr); }
.app.split .shop-rows { grid-template-columns: 1fr 1fr; }
.app.split .shop-now { display: none; }

.toast {
  position: absolute; left: 50%; top: 136px; transform: translateX(-50%); z-index: 4; pointer-events: none;
  width: max-content; max-width: calc(100% - 28px); padding: 10px 16px; border-radius: 14px;
  background: rgba(9, 24, 27, 0.94); border: 1px solid rgba(46, 230, 199, 0.5); color: var(--foam);
  font-size: 15px; font-weight: 700; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: toastin 0.25s ease-out both;
}
.toast.tide-toast { border-color: rgba(127, 216, 230, 0.8); color: #c9f4ff; }
.toast.mate-toast { border-color: rgba(255, 143, 180, 0.8); color: #ffe0ea; }
.toast.egg-toast { border-color: rgba(243, 217, 168, 0.9); color: #fff3da; }
.toast.dry-toast { border-color: rgba(240, 193, 77, 0.9); color: #ffe9b3; }
.toast.crab-toast { border-color: rgba(255, 150, 120, 0.9); color: #ffe3d8; font-size: 14px; max-width: min(340px, calc(100% - 28px)); }
.toast.robber-toast { border-color: rgba(190, 140, 255, 0.95); color: #efe0ff; background: rgba(30, 14, 46, 0.95); }
.app.split .toast { top: 14px; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Small / short screens ---------- */

/* narrow phones: the HUD labels hide visually (still read out), icons + stars carry them */
@container (max-width: 430px) {
  .stat-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hud-stats { gap: 16px; }
}
@container (max-width: 340px) {
  .hud-stats { gap: 12px; }
  .sheet { padding: 14px 12px 16px; gap: 10px; }
  .lede { font-size: 13.5px; line-height: 1.4; }
  .tips li { font-size: 12px; line-height: 1.3; }
  .tide-label { font-size: 11.5px; }
  .row-name { display: none; }
  .pool-row { column-gap: 10px; }
  .hearts i { width: 12px; height: 12px; }
  .hearts i.hole { width: auto; }
  .tide { column-gap: 8px; }
  .survived { font-size: 11.5px; }
  .pick { min-height: 58px; grid-template-columns: 46px minmax(0, 1fr); column-gap: 9px; padding: 5px 9px 5px 5px; }
  .pick canvas { width: 46px; height: 46px; }
  .pick-what { font-size: 11.5px; }
  .pick-name { font-size: 15px; }
  .almanac { gap: 4px; }
  .card.choice { padding: 14px 12px; gap: 8px; }
  .choice .card-title { font-size: 19px; }
}
@media (max-height: 700px) {
  .sheet { gap: 9px; padding: 14px 14px 16px; }
  .launch { min-height: 50px; }
  /* the end screen squeezes: score on one line, smaller stars and stat tiles */
  .end-main { gap: 8px; }
  .score-card { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 12px; }
  .score-big { font-size: 28px; }
  .stats.mini > div { padding: 4px 5px; }
  .stats.mini dd { font-size: 15px; margin-top: 1px; }
  .crab-tile canvas { max-width: 34px; }
}
@media (max-height: 620px) {
  #end-kicker { display: none; }
  .end .sheet-title, .end-main .sheet-title { font-size: 21px; }
  .end-main { gap: 6px; }
  .stats.mini { gap: 4px; }
  .stats.mini > div { padding: 3px 4px; }
  .stats.mini dd { font-size: 14px; }
  .end-next { font-size: 11.5px; }
  .almanac-title { display: none; }
  .crab-tile { padding: 2px 1px; }
  .crab-tile canvas { max-width: 30px; }
}
/* the hatch choice on short portrait phones: tighter cards so all 4 fit */
@media (max-height: 620px) {
  .card.choice { padding: 12px 12px; gap: 6px; }
  .pick { min-height: 54px; }
  .choice-note { display: none; }
}
.app.split .score-card { display: flex; align-items: center; justify-content: center; gap: 10px; }
.app.split .stats.mini { gap: 3px; }
.app.split .stats.mini dt { font-size: 8.5px; }
/* Keyboard keys only matter with a keyboard and mouse */
@media (pointer: coarse) {
  .keys-note { visibility: hidden; }
}
@media (max-height: 620px) and (orientation: portrait) {
  .title-head .lede { display: none; }
  .launch .btn-sub { display: none; }
}
/* Short phones: Play first so it is never below the fold under the tip list */
@media (max-height: 740px) and (orientation: portrait) {
  .title-actions { display: flex; flex-direction: column; gap: 10px; }
  .title-actions > .launch { order: -2; }
  .title-actions > .title-row { order: -1; }
  .title-actions > .tips { order: 0; max-height: min(28vh, 180px); overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .launch { transition: none; }
  .sheet.end.enter, .stat.bump strong, .tide.rising .tide-fill, .toast, .egg-wrap.alert .egg-bar, .egg-wrap.bump .egg-text,
  .cmd.armed, .cmd-shop.has .cmd-badge { animation: none; }
  .cmd { transition: none; }
  .egg-fill { transition: none; }
}

/* v4: survival can show many crabs on the end screen; keep it on one screen on short phones */
@media (max-height: 680px) { .end .crab-tile canvas { max-width: 30px; } .end .almanac-title { display: none; } }
@media (max-height: 340px) { .app.split .end .almanac-title { display: none; } }
@media (max-height: 620px) { .end .crab-tile canvas { max-width: 26px; } .end .almanac { row-gap: 3px; } }

/* ---------- v7 QoL: portrait phones get compact chrome so the map is bigger ----------
   A thin frame (no 56 px badge band: the private preview has no platform badge), 48 px HUD buttons,
   slimmer pool/tide rows, and 48 px command buttons on the tiniest phones (320x568). Set by layout() in app.js. */
.app.phone {
  --badge-reserve: 6px;
  --safe-top: calc(6px + env(safe-area-inset-top, 0px));
  --safe-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  --gutter: 4px;
}
.app.phone .stage { border-radius: 18px; box-shadow: none; }
.app.phone .stage .play { padding: 6px; row-gap: 5px; grid-template-rows: 48px 20px 22px minmax(0, 1fr) 30px auto; }
.app.phone .stage.short .play { grid-template-rows: 48px 20px 22px minmax(0, 1fr) auto; }
.app.phone .hud { gap: 6px; }
.app.phone .hud .icon-btn, .app.phone .title-row .icon-btn { width: 48px; height: 48px; }
.app.phone .title-row { min-height: 48px; }
.app.phone .map-wrap { border-radius: 12px; }
.app.phone .status { font-size: 12.5px; line-height: 15px; }
.app.phone .stage.short .status { margin: 0 4px 4px; }
.app.phone-tiny .cmdbar { gap: 4px; }
.app.phone-tiny .cmd { min-height: 48px; padding: 3px 2px; border-radius: 12px; }
.app.phone-tiny .cmd-icon { width: 22px; height: 22px; }

/* v11: game over heading + the king tide ending + congratulations */
.game-over { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.1; letter-spacing: 0.08em; text-transform: uppercase; color: #ffe2a8; margin: 0; }
.stats.mini > div[hidden] { display: none; }
.end.king .kicker { font-size: 13px; color: #9fe3ff; }
.congrats .congrats-title { font-size: 24px; line-height: 1.25; color: #fff6d8; overflow-wrap: anywhere; padding: 0 6px; }
.congrats .congrats-line { margin: 0; color: var(--mist); font-size: 15px; line-height: 1.4; }
.sheet.congrats.enter { animation: sheetup 0.32s ease-out both; }
.app.split .congrats { display: flex; flex-direction: column; justify-content: center; align-items: center; }
.app.split .congrats .end-main { display: flex; }
.app.split .congrats[hidden] { display: none !important; }
@media (max-height: 600px), (max-width: 340px) { .game-over { font-size: 20px; } .congrats .congrats-title { font-size: 20px; } }
@media (max-height: 780px) { .game-over { font-size: 17px; } }
@media (max-height: 620px) { .end.king #end-kicker { display: block; font-size: 11px; } .game-over { font-size: 15px; } }
@media (max-height: 360px) { .game-over { font-size: 13px; line-height: 1; } .app.split .end { row-gap: 2px; } }

/* v12: music credit on the title (small but legible on a 390x844 phone) and the Credits card */
.credit-line { margin: 6px 0 0; font-size: 10.5px; line-height: 1.35; color: var(--mist); text-align: center; overflow-wrap: anywhere; }
.credits-link { display: inline-block; vertical-align: middle; font: inherit; font-size: 12px; font-weight: 700; color: inherit; text-decoration: underline; background: none; border: 0; padding: 0 6px; min-width: 64px; min-height: 44px; cursor: pointer; }
.card.credits { max-width: 420px; }
.credits-body { max-height: 52vh; overflow-y: auto; text-align: left; font-size: 13px; line-height: 1.45; color: var(--mist); overflow-wrap: anywhere; margin-bottom: 14px; }
.credits-body p { margin: 0 0 8px; }
.credits-body strong { color: inherit; }
/* short landscape: the tips scroll so the credit line fits under Play */
.app.split .title-actions { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
.app.split .title-actions > .tips { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.app.split .credit-line { margin-top: 0; font-size: 10px; line-height: 1.3; }
.app.split #title-sheet { grid-template-rows: minmax(0, 1fr); }

/* v13: title links row (No ads, Credits, site pages) and the no-ads offer / restore-code / ad-break cards */
.title-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 4px; }
.title-links > * { font-size: 12px; }
.noads-btn { font: inherit; font-size: 12px; font-weight: 800; color: var(--foam); background: rgba(46, 230, 199, 0.12); border: 1px solid rgba(46, 230, 199, 0.45); border-radius: 999px; padding: 0 14px; min-height: 44px; min-width: 64px; cursor: pointer; }
.ads-removed { margin: 0; font-size: 12px; font-weight: 700; color: var(--tide); padding: 0 6px; }
.site-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 4px; color: var(--mist); }
.card.offer { max-width: 420px; }
.offer-body { display: grid; gap: 8px; font-size: 14px; line-height: 1.4; }
.offer-body p { margin: 0; }
.offer-body #offer-free, .offer-body #offer-paid { display: grid; gap: 8px; }
.offer-body [hidden] { display: none !important; }
.offer-links a, .offer-body .fine-print a { color: inherit; }
.gate { font-size: 13px; }
.gate-input { font: inherit; font-size: 18px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(46, 230, 199, 0.45); background: rgba(3, 8, 12, 0.5); color: var(--foam); min-height: 44px; }
.gate-err { color: #ffb4a0; font-size: 13px; }
.restore-code { font-size: 26px; font-weight: 800; letter-spacing: 0.06em; text-align: center; margin: 0; }
.app.split .title-links > * { font-size: 11px; }
/* v13: "Title" and the free "No ads" share one row on the game-over screen (no extra height) */
.end-pair { display: flex; gap: 10px; }
.end-pair > button { flex: 1 1 0; min-width: 0; min-height: 44px; }
.end-pair > [hidden] { display: none; }

/* v15: Remove a wall */
.cmd-remove.armed { border-color: #ff8a7a; background: rgba(226, 90, 74, 0.22); }
.card.remove .remove-note { margin: 4px 0 14px; font-size: 15px; }
.card.remove .launch.remove-yes { background: #ff7a66; color: #2a0804; box-shadow: 0 10px 30px rgba(255, 122, 102, 0.22); margin-bottom: 10px; }
.card.remove .ghost { width: 100%; min-height: 48px; }
.map-remove {
  position: absolute; left: 6px; top: 6px; z-index: 2; min-width: 44px; min-height: 44px; padding: 4px 12px 4px 6px;
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  border: 1.5px solid rgba(255, 138, 122, 0.7); background: rgba(14, 44, 48, 0.82); color: var(--foam);
  font-weight: 700; font-size: 14px; touch-action: manipulation;
}
.map-remove[hidden] { display: none; }
.map-remove .cmd-icon { width: 26px; height: 26px; display: block; }
.map-remove.armed { background: rgba(226, 90, 74, 0.85); border-color: #ffd2ca; color: #fff; }
