:root {
  --bg: #070b14;
  --panel: #0f172a;
  --panel2: #141d33;
  --line: #1f2a44;
  --text: #e2e8f0;
  --muted: #8b9ab3;
  --accent: #2dd4bf;
  --accent-ink: #042f2e;
  --gold: #fde047;
  --danger: #fb7185;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
kbd {
  font: 600 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #0b1222;
  color: var(--muted);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

#app {
  display: flex;
  gap: 16px;
  padding: 16px;
  min-height: 100%;
  align-items: flex-start;
  justify-content: center;
}

#stage { flex: 1 1 auto; min-width: 0; max-width: calc((var(--app-h) - 130px) * 1.5); }
#board-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
#board {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  cursor: crosshair;
  touch-action: none;
}
.statusbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 12px;
  margin-bottom: 8px;
  padding: 6px 8px 6px 12px;
  min-height: 46px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}
.sb-item { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; flex: none; }
.sb-next { flex: 1 1 auto; min-width: 0; }
.sb-next b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-item span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.sb-item b { font-size: 15px; font-weight: 650; }
.sb-item.gold b { color: var(--gold); }
.sb-item.low b, .sb-item.warn b { color: var(--danger); }
.sb-next b { font-weight: 500; font-size: 14px; }
.sb-sep { width: 1px; height: 22px; background: var(--line); }
.sb-sel {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.sb-sel canvas { width: 26px; height: 26px; flex: 0 0 auto; }
.sb-sel .lvl { color: var(--muted); font-size: 12px; margin-left: 2px; }
.sb-sel button { padding: 5px 10px; font-size: 13px; }
.sb-sel button b { font-weight: 700; }
.sb-sel button.primary b { color: var(--accent-ink); }
.sb-sel .cost { color: var(--gold); font-weight: 650; }
.sb-sel .short { color: var(--danger); font-size: 12px; }
.sb-sel .gain { color: var(--accent); font-size: 12px; }
.sb-sel .sell { color: var(--gold); }
.hint {
  min-height: 22px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.hint.bad { color: var(--danger); }

#side {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#side section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
#side h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.02em; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--panel2); border-radius: 8px; padding: 6px 10px; }
.stat span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat.gold b { color: var(--gold); }
.stat.low b { color: var(--danger); }

.wave-info { margin-bottom: 8px; font-size: 13px; }
.wave-info b { color: var(--text); }
.upcoming { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid transparent;
}
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip.now { color: var(--text); border-color: var(--line); }
.chip.boss { color: var(--danger); }

button {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
button:hover:not(:disabled) { border-color: #33415f; background: #18223b; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 650; }
button.primary:hover:not(:disabled) { background: #5eead4; }
button.wide { width: 100%; }
button.big { padding: 10px 18px; font-size: 15px; }
button.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tower-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
}
.tower-btn canvas { width: 36px; height: 36px; }
.tower-btn .tname { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.15; }
.tower-btn .tcost { font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; }
.tower-btn kbd { position: absolute; top: 4px; left: 4px; }
.tower-btn.poor .tcost { color: var(--danger); }
.tower-btn.poor canvas { opacity: 0.55; }

.info { min-height: 150px; font-size: 13px; }
.info-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.info-head canvas { width: 40px; height: 40px; flex: 0 0 auto; }
.info-name { font-weight: 650; font-size: 15px; }
.info-name .lvl { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 4px; }
.info-desc { color: var(--muted); font-size: 12px; }
.info table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.info td { padding: 2px 0; }
.info td:first-child { color: var(--muted); }
.info td.next { color: var(--accent); text-align: right; }
.info .meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.modes { display: flex; gap: 4px; margin-bottom: 8px; }
.modes button { flex: 1; padding: 4px 0; font-size: 12px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.actions .sell { color: var(--gold); }
.help p { margin: 0 0 8px; color: var(--muted); }
.help ul { margin: 0; padding-left: 18px; color: var(--muted); }
.help li { margin: 3px 0; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 20, 0.72);
  backdrop-filter: blur(2px);
}
.overlay .card {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 28px;
  max-width: 90%;
}
.overlay h2 { margin: 0 0 6px; font-size: 26px; }
.overlay h2.win { color: var(--accent); }
.overlay h2.lose { color: var(--danger); }
.overlay .row { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.overlay dl { display: grid; grid-template-columns: auto auto; gap: 2px 16px; margin: 12px auto 0; width: max-content; text-align: left; }
.overlay dt { color: var(--muted); }
.overlay dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 32px 16px;
  background: rgba(4, 7, 13, 0.86);
  backdrop-filter: blur(3px);
}
.menu-card {
  width: min(820px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.menu-card h1 { margin: 0; font-size: 34px; letter-spacing: 0.02em; }
.menu-card .tag { margin: 4px 0 16px; color: var(--muted); }
.menu-card h3 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.map-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.map-card {
  text-align: left;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.map-card canvas { width: 100%; aspect-ratio: 3 / 2; border-radius: 6px; display: block; }
.map-card .mname { font-weight: 650; }
.map-card .mdesc { color: var(--muted); font-size: 12px; }
.map-card .mbest { color: var(--gold); font-size: 11px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 120px; text-align: left; }
.seg button small { display: block; color: var(--muted); font-size: 11px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; cursor: pointer; }
.check em { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
.menu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.other-game {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(253, 224, 71, 0.45);
  background: rgba(253, 224, 71, 0.08);
  color: var(--gold);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.other-game img { width: 18px; height: 18px; }
.other-game:hover { background: rgba(253, 224, 71, 0.16); }
.menu-actions { display: flex; gap: 8px; margin-top: 20px; }
.howto { margin-top: 18px; color: var(--muted); }
.howto summary { cursor: pointer; color: var(--text); }
.howto li { margin: 4px 0; }

@media (max-width: 960px) {
  #app { flex-direction: column; align-items: stretch; padding: 12px 16px; }
  #stage { max-width: none; }
  #side { flex: none; }
  .palette { grid-template-columns: repeat(6, 1fr); }
  .tower-btn kbd { display: none; }
  .statusbar { flex-wrap: wrap; }
  .sb-sel { margin-left: 0; padding-left: 0; border-left: 0; flex-basis: 100%; flex-wrap: wrap; white-space: normal; }
  .sb-sep { display: none; }
}
@media (max-width: 560px) {
  .palette { grid-template-columns: repeat(3, 1fr); }
  .menu-card { padding: 16px; }
}

/* owl logo */
h1 { display: flex; align-items: center; gap: 8px; }
.logo { width: 1.3em; height: 1.3em; flex: none; }

/* ---- touch ---------------------------------------------------------------- */
button { touch-action: manipulation; }
#app { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#board { -webkit-touch-callout: none; }
body.touch kbd, body.touch .mouse-only { display: none !important; }
body:not(.touch) .touch-only { display: none !important; }

/* ---- phones held upright: ask to rotate. main.js sets body.rotate-ui on
   upright touch screens (or with ?phone=portrait). ------------------------- */
.rotate { display: none; }
body.rotate-ui .rotate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}
body.rotate-ui .rotate img { width: 72px; height: 72px; margin-bottom: 8px; animation: tilt 2.4s ease-in-out infinite; }
body.rotate-ui .rotate p { margin: 0; font-size: 18px; font-weight: 650; }
body.rotate-ui .rotate span { color: var(--muted); }

@keyframes tilt { 0%, 30% { transform: rotate(0deg); } 60%, 100% { transform: rotate(-90deg); } }

/* ---- short landscape screens (phones on their side). main.js sets
   body.landscape-ui for these (or with ?phone). Welcome screen rules here;
   the in-game phone layout is under "phone and tablet layout" below. */






















body.landscape-ui .modal { padding: 10px; }
body.landscape-ui .menu-card { padding: 14px 16px; }
body.landscape-ui .menu-card h1 { font-size: 24px; }
body.landscape-ui .menu-card .tag { margin-bottom: 8px; }
body.landscape-ui .menu-card h3 { margin: 10px 0 6px; }
body.landscape-ui .map-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
body.landscape-ui .map-card .mdesc { display: none; }
body.landscape-ui .menu-actions { margin-top: 12px; }


/* ---- ?phone preview: a device picker and a phone-sized frame --------------- */
:root { --app-h: 100vh; }
@supports (height: 100dvh) { :root { --app-h: 100dvh; } }
html.phone-preview, html.phone-preview body { background: #000; }
.phone-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 6px;
  color: #8b9ab3;
  font-size: 13px;
}
.phone-bar select {
  margin-left: 6px;
  font: inherit;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
}
.phone-stage { position: relative; margin: 8px auto 30px; }
#phone-frame {
  --app-h: var(--frame-h);
  position: absolute;
  top: 0;
  left: 0;
  width: var(--frame-w);
  height: var(--frame-h);
  overflow: hidden;
  transform-origin: 0 0; /* also keeps fixed overlays inside the frame */
  border-radius: 22px;
  box-shadow: 0 0 0 10px #1f2937, 0 20px 60px rgba(0, 0, 0, 0.6);
  background: var(--bg);
}
#phone-frame:not([style*="scale"]) { transform: translateZ(0); }
#phone-frame #app { min-height: 0; }

/* Phone column: everything fits beside the board without scrolling. Details
   (stats, targeting) stay in the desktop panel; the status bar carries what
   a phone needs: wave, lives, gold, next wave, and upgrade/sell. */
.refund-line { display: none; }















/* Welcome screen on a phone on its side: two columns, no scrolling.
   Left: the fields as a 2x2 grid of small cards. Right: difficulty,
   the restricted option and Start. */
body.landscape-ui .modal { align-items: center; padding: 8px; }
body.landscape-ui .menu-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  grid-template-rows: auto auto auto auto 1fr;
  column-gap: 16px;
  padding: 10px 14px 12px;
  width: 100%;
}
body.landscape-ui .menu-card h1 { grid-column: 1 / -1; font-size: 22px; margin-bottom: 2px; }
body.landscape-ui .menu-head { grid-column: 1 / -1; }
body.landscape-ui .other-game { padding: 3px 9px; font-size: 12px; }
body.landscape-ui .other-game img { width: 15px; height: 15px; }
body.landscape-ui .menu-card .tag, body.landscape-ui .howto { display: none; }
body.landscape-ui .menu-card h3 { margin: 6px 0 5px; font-size: 11px; }
body.landscape-ui .menu-card h3:nth-of-type(1) { grid-column: 1; grid-row: 2; }
body.landscape-ui #mapList { grid-column: 1; grid-row: 3 / span 3; align-self: start; }
body.landscape-ui .menu-card h3:nth-of-type(2) { grid-column: 2; grid-row: 2; }
body.landscape-ui #diffList { grid-column: 2; grid-row: 3; }
body.landscape-ui .menu-card .check { grid-column: 2; grid-row: 4; margin-top: 8px; font-size: 13px; }
body.landscape-ui .menu-card .check em { font-size: 11px; }
body.landscape-ui .menu-actions { grid-column: 2; grid-row: 5; margin-top: 10px; align-self: end; }
body.landscape-ui .menu-actions button.big { flex: 1; padding: 9px 10px; font-size: 14px; }
body.landscape-ui .map-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
body.landscape-ui .map-card { flex-direction: row; align-items: center; gap: 8px; padding: 5px; }
body.landscape-ui .map-card canvas { width: 78px; flex: none; }
body.landscape-ui .map-card .mname { font-size: 13px; }
body.landscape-ui .map-card .mbest { font-size: 11px; }
body.landscape-ui .seg { flex-wrap: nowrap; gap: 4px; }
body.landscape-ui .seg button { flex: 1 1 0; padding: 7px 4px; text-align: center; font-size: 13px; }
body.landscape-ui .seg button small { display: none; }
/* a little tighter so 375px-tall phones (iPhone SE, 13 mini) fit too */




body.landscape-ui .map-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 0;
  align-items: center;
}
body.landscape-ui .map-card canvas { grid-row: 1 / span 2; }
body.landscape-ui .map-card .mname { align-self: end; }
body.landscape-ui .map-card .mbest { align-self: start; }

/* What a tower can hit: on every tower button and in the status bar. */
.hits { font-size: 11px; font-weight: 600; white-space: nowrap; }
.hits-both { color: var(--muted); }
.hits-ground { color: #d6a77a; }
.hits-air { color: #9db4d6; }
.tower-btn .hits { font-size: 10.5px; line-height: 1.1; }



/* ---- full screen and Home Screen app ---------------------------------------- */
.home-tip { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.home-tip b { color: var(--text); font-weight: 600; }
#btnPath.on { border-color: #33415f; }
body.landscape-ui .home-tip { grid-column: 2; grid-row: 6; margin-top: 6px; font-size: 11px; line-height: 1.35; }



/* keep clear of the notch / Dynamic Island when the page runs edge to edge */

.fs-icon { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }


/* final squeeze so a selected tower before wave 1 fits on 375px-tall phones */






/* ---- phone and tablet layout (body.landscape-ui) ------------------------------
   Top bar (gold, wave, lives, score, speed, pause), the board, and a bottom
   bar (menu, upcoming waves, start/next). No side panel: towers are built
   from a ring that pops up where you tap, and a tapped tower shows sell and
   upgrade buttons beside it. */
.m-top, .m-bottom { display: none; }
.pop.hidden { display: none; }
body.landscape-ui #app {
  --m-top-h: 34px;
  --m-bottom-h: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--m-top-h) minmax(0, 1fr) var(--m-bottom-h);
  gap: 6px;
  height: var(--app-h);
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
           max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
body.landscape-ui #stage { display: contents; }
body.landscape-ui #statusbar, body.landscape-ui #side, body.landscape-ui .hint { display: none; }
body.landscape-ui #board-wrap {
  grid-row: 2;
  justify-self: center;
  align-self: center;
  width: min(100%, calc((var(--app-h) - var(--m-top-h) - var(--m-bottom-h) - 24px) * 1.5));
  overflow: visible;
}
body.landscape-ui #board { border-radius: var(--radius); }

body.landscape-ui .m-top, body.landscape-ui .m-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 6px 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}
body.landscape-ui .m-top { grid-row: 1; }
body.landscape-ui .m-bottom { grid-row: 3; gap: 8px; padding: 0 5px; }
.m-stat { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.m-stat span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.m-stat b { font-size: 14px; font-weight: 650; }
.m-stat.gold b { color: var(--gold); }
.m-stat.low b { color: var(--danger); }
.m-now { flex: 1 1 auto; min-width: 0; }
.m-now b { font-size: 12px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.m-tools { display: flex; gap: 4px; margin-left: auto; }
.m-tools button { min-width: 34px; height: 26px; padding: 0 8px; font-size: 13px; font-weight: 600; }
.m-tools svg, .m-menu svg { width: 15px; height: 15px; vertical-align: -3px; fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.m-tools svg.solid { fill: currentColor; stroke: none; }
.m-menu { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; flex: none; }
.m-next { flex: none; height: 36px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
.m-next small { font-weight: 500; opacity: 0.75; margin-left: 4px; }
.m-waves { flex: 1 1 auto; min-width: 0; display: flex; gap: 4px; overflow: hidden; justify-content: center; }
.m-wave {
  flex: none;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  padding: 0 7px 0 3px;
  border-radius: 8px;
  background: var(--panel2);
  border: 1px solid transparent;
  font-size: 11px;
  color: var(--muted);
}
.m-wave canvas { width: 30px; height: 30px; }
.m-wave b { display: block; color: var(--text); font-size: 12px; line-height: 1.1; }
.m-wave.now { border-color: #33415f; }
.m-wave.boss { border-color: rgba(251, 113, 133, 0.6); }
.m-wave.boss b { color: var(--danger); }

/* popups over the board */
.pop { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 4; }
.pop-btn {
  position: absolute;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid var(--line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}
.pop-btn canvas { width: 28px; height: 28px; }
.pop-btn.off { opacity: 0.4; filter: grayscale(1); }
.pop-btn.off span { color: var(--muted); }
.pop-btn.sell { color: #fca5a5; border-color: rgba(251, 113, 133, 0.7); }
.pop-btn.sell svg { width: 20px; height: 20px; fill: none; stroke: #fb7185; stroke-width: 3; stroke-linecap: round; }
.pop-btn.up { border-color: var(--accent); }
.pop-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.92);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
body:not(.landscape-ui) .pop { display: none; }
.m-waves > :first-child { margin-left: auto; }
.m-waves > :last-child { margin-right: auto; }
.m-waves { justify-content: flex-start; }
.m-wave { width: 54px; justify-content: center; padding: 0 2px; }
.m-waves > :first-child, .m-waves > :last-child { margin: 0; }
.m-waves { justify-content: center; }
/* the next wave sits on the right, beside the Start / Next button; later waves run leftward */
.m-waves { flex-direction: row-reverse; }
.pop-mode {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px 0 9px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  touch-action: manipulation;
}
.pop-mode b { color: var(--text); font-weight: 700; }
.pop-mode svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pop-badge {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  padding: 1px 7px;
  border-radius: 7px;
  background: #facc15;
  color: #1c1917;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 12px;
  white-space: nowrap;
  box-shadow: 0 0 6px rgba(250, 204, 21, 0.6);
  animation: pop-badge-bob 1.25s ease-in-out infinite;
}
@keyframes pop-badge-bob {
  50% { transform: translate(-50%, calc(-50% - 1.5px)); }
}
.pop-note {
  position: absolute;
  z-index: 5;
  left: 0;
  top: 0;
  transform: translateX(-50%);
  pointer-events: none;
  padding: 3px 9px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  font-weight: 700;
  line-height: 14px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
}
.pop-note.show { visibility: visible; animation: pop-note 1.8s ease-out forwards; }
@keyframes pop-note {
  0% { opacity: 0; transform: translate(-50%, 4px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  75% { opacity: 1; transform: translate(-50%, -3px); }
  100% { opacity: 0; transform: translate(-50%, -6px); visibility: hidden; }
}
body:not(.landscape-ui) .pop-note { display: none; }
/* Next button: one fixed size for Start / Next +25g 20s / Last wave */
.m-next {
  width: 138px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
}
.m-next .nb { min-width: 4ch; text-align: left; font-size: 13px; }
.m-next small { min-width: 3ch; margin-left: 0; text-align: right; }
.m-next { align-items: center; line-height: 1; }
.m-next .nb, .m-next small { line-height: 1; }
/* seven fields on the phone welcome screen: smaller cards so it still fits */
body.landscape-ui .map-card { grid-template-columns: 60px minmax(0, 1fr); padding: 4px; }
body.landscape-ui .map-card canvas { width: 60px; }
body.landscape-ui .map-list { gap: 4px; }
