/* Deepwing: Defense. The moon fills the screen behind everything; the menu sits on a card,
   and while playing the counts run along the top and the buttons along the bottom. */
:root {
  --kGlow1: rgba(0, 0, 0, .6);
  --kGlow2: rgba(0, 0, 0, .7);
  --kBg1: #10151e;
  --kBg2: #222c3b;
  --kBg3: #34425a;
  --kBg4: #0b0f16;
  --kBg5: rgba(14, 19, 28, .97);
  --kBg6: rgba(16, 22, 32, .66);
  --kBg7: rgba(16, 22, 32, .2);
  --kBg8: #33415a;
  --kBg9: #1b2431;
  --kBg10: rgba(0, 0, 0, .18);
  --kBg11: #1f2836;
  --kBg12: #3a4964;
  --kBg13: rgba(16, 22, 32, .82);
  --kBg14: rgba(16, 22, 32, .9);
  --kBg15: rgba(16, 22, 32, 0);
  --kBg16: rgba(16, 22, 32, .92);
  --kBg17: rgba(255, 255, 255, .12);
  --kBg19: rgba(0, 0, 0, .55);
  --kBg20: rgba(8, 11, 18, .5);
  --kInk1: #ffffff;
  --kInk2: #ffe27a;
  --kInk3: #99ff99;
  --kLine1: #222c3b;
  --kLine2: #ffd27a;
  --hotInk: #2a1a02;
  --bg: #141a24;
  --ink: #f3f6fb;
  --dim: #c4cddb;
  --card: rgba(18, 24, 34, .9);
  --line: rgba(255, 255, 255, .16);
  --hot: #ffb338;
  --good: #57d68d;
  --bad: #ff6b5b;
}

/* R-C40: the light look. This product's own is dark; the other is chosen with the switch beside Home. */
:root[data-theme="light"] {
  --kGlow1: rgba(255, 255, 255, .6);
  --kGlow2: rgba(255, 255, 255, .7);
  --kBg1: #dde4ee;
  --kBg2: #c9d3e1;
  --kBg3: #b4c1d3;
  --kBg4: #e9eef5;
  --kBg5: rgba(236, 241, 247, .98);
  --kBg6: rgba(236, 241, 247, .7);
  --kBg7: rgba(236, 241, 247, .2);
  --kBg8: #b6c4d8;
  --kBg9: #e3e9f1;
  --kBg10: rgba(255, 255, 255, .3);
  --kBg11: #d6dee9;
  --kBg12: #b6c4d8;
  --kBg13: rgba(236, 241, 247, .88);
  --kBg14: rgba(236, 241, 247, .92);
  --kBg15: rgba(236, 241, 247, 0);
  --kBg16: rgba(236, 241, 247, .94);
  --kBg17: rgba(20, 26, 36, .1);
  --kBg19: rgba(255, 255, 255, .7);
  --kBg20: rgba(220, 226, 236, .55);
  --kInk1: #10151e;
  --kInk2: #6b4a00;
  --kInk3: #075a07;
  --kLine1: #c9d3e1;
  --kLine2: #6b4a00;
  --hotInk: #ffffff;
  --bg: #eef2f7;
  --ink: #141a24;
  --dim: #3d4757;
  --card: rgba(240, 244, 249, .92);
  --line: rgba(13, 13, 13, .16);
  --hot: #a35f00;
  --good: #027a45;
  --bad: #c0284e;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#app { display: flex; flex-direction: column; height: 100%; }

#hdr {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px;
  background: var(--kBg1); border-bottom: 1px solid var(--kLine1); position: relative; z-index: 5;
}
#hdrTitle { flex: 1 1 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; font-size: 15px; }
@media (max-width: 380px) { #hdrTitle { visibility: hidden; } }
/* R-C26: [hidden] loses to any display of our own */
[hidden] { display: none !important; }
.pill { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: var(--kBg2); color: var(--ink); font-size: 18px; cursor: pointer; }
.pill:active { background: var(--kBg3); }

#main { position: relative; flex: 1; min-height: 0; }
#stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; background: var(--kBg4); }
#cvs, #ovl { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#ovl { pointer-events: none; }
#glFail { position: absolute; inset: 20% 12% auto; padding: 14px; border-radius: 12px; z-index: 30; background: var(--kBg1); color: var(--ink); font-size: 14px; line-height: 1.5; }

.scr { display: none; position: absolute; inset: 0; overflow-y: auto; padding: 12px; }
.scr.on { display: block; }
#scr-play { padding: 0; overflow: hidden; pointer-events: none; }
#scr-play .ovl, #scr-play .ovl *, #bar, #bar *, #tray, #tray *, #panel, #panel *, #sendBar, #sendBar * { pointer-events: auto; }
#scr-how { background: var(--kBg5); }
#scr-how > * { max-width: 640px; margin-left: auto; margin-right: auto; }

/* the menu: words at the top, a card at the bottom, a level playing itself between */
#scr-menu { display: none; flex-direction: column; justify-content: space-between; }
#scr-menu.on { display: flex; }
#menuTop { max-width: 560px; width: 100%; margin: 0 auto; padding: 4px 10px 8px; border-radius: 16px;
           background: linear-gradient(var(--kBg6), var(--kBg7)); text-shadow: 0 1px 3px var(--kGlow1); }
h1 { font-size: 30px; margin: 4px 0 4px; }
.sub { color: var(--kInk1); font-size: 15px; line-height: 1.4; margin-bottom: 4px; max-width: 30em; }
#menuCard { max-width: 560px; width: 100%; margin: 12px auto 0; background: var(--card); border: 1px solid var(--line);
            border-radius: 18px; padding: 10px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.stat { color: var(--dim); font-size: 13px; margin: 6px 2px 0; }
.goal { color: var(--dim); font-size: 13.5px; line-height: 1.4; margin: 4px 2px 2px; min-height: 18px; }
.big { display: block; width: 100%; min-height: 52px; margin: 8px 0; border: 1px solid var(--line); border-radius: 14px;
       background: var(--kBg2); color: var(--ink); font-size: 17px; font-weight: 600; cursor: pointer; }
.big.primary { background: var(--hot); border-color: var(--kLine2); color: var(--hotInk); }

.pickRow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 2px 0 6px; }
.pick { min-width: 0; min-height: 66px; background: var(--kBg2); color: var(--ink); border: 2px solid transparent; border-radius: 14px;
        padding: 6px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; }
.pick .te { font-size: 22px; }
.pick b { font-size: 14px; }
.pick small { color: var(--dim); font-size: 11px; }
.pick.sel { border-color: var(--hot); background: var(--kBg8); }
.modeRow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 4px 0 6px; }
.mode { min-width: 0; min-height: 46px; border-radius: 12px; border: 2px solid transparent; background: var(--kBg9); color: var(--dim); font-size: 14px; font-weight: 700; cursor: pointer; padding: 2px 4px; line-height: 1.15; }
.mode.sel { border-color: var(--hot); color: var(--kInk1); background: var(--kBg8); }

/* the levels: a row of five a moon, a grid that wraps, never a row that scrolls sideways */
.moon { margin: 6px 0 2px; }
.moonName { font-size: 12px; font-weight: 700; color: var(--dim); letter-spacing: .04em; text-transform: uppercase; margin: 0 2px 3px; }
.lvRow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.lv { min-height: 52px; min-width: 0; border-radius: 12px; border: 2px solid transparent; background: var(--kBg9); color: var(--ink);
      cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 3px 2px; font-size: 16px; font-weight: 700; }
.lv small { font-size: 10.5px; letter-spacing: -1px; color: var(--hot); min-height: 13px; }
.lv.sel { border-color: var(--hot); background: var(--kBg8); }
.lv.locked { opacity: .4; cursor: default; }
.lv.next { box-shadow: inset 0 0 0 2px var(--good); }
.setNav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 4px; }
#setName { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setBtn { min-width: 52px; min-height: 44px; border-radius: 12px; border: 0; background: var(--kBg2); color: var(--ink); font-size: 18px; cursor: pointer; }
.setBtn:disabled { opacity: .3; cursor: default; }
#making { z-index: 20; }
#pickCard { margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: var(--kBg10); border: 1px solid var(--line); }
#pickName { font-weight: 700; font-size: 15px; }
.chalRow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 2px; }
.chal { min-height: 44px; border-radius: 10px; border: 2px solid transparent; background: var(--kBg11); color: var(--dim); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.chal.sel { border-color: var(--hot); color: var(--ink); background: var(--kBg12); }
.chal.done { box-shadow: inset 0 -3px 0 var(--good); }
#endlessList { display: grid; gap: 6px; }
.endless { min-height: 52px; border-radius: 12px; border: 2px solid transparent; background: var(--kBg9); color: var(--ink); cursor: pointer;
           display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; font-size: 15px; font-weight: 700; }
.endless small { color: var(--dim); font-weight: 600; font-size: 12.5px; }
.endless.sel { border-color: var(--hot); background: var(--kBg8); }
/* R24.1 Tower Wars' lanes: a row a lane, as Endless's fields */
#warsList { display: grid; gap: 6px; }

#custom { margin: 8px 0 0; border: 1px solid var(--line); border-radius: 14px; background: var(--kBg10); }
#custom > summary { list-style: none; }
#custom > summary::-webkit-details-marker { display: none; }
#custom > summary::after { content: "▾"; margin-left: auto; color: var(--dim); }
#custom[open] > summary::after { content: "▴"; }
summary { min-height: 48px; display: flex; align-items: center; padding: 0 12px; cursor: pointer; font-weight: 600; }
.setBody { padding: 4px 12px 12px; }
.setRow { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.setLbl { flex: 1 1 120px; font-size: 14px; }
.setNote { color: var(--dim); font-size: 12px; line-height: 1.4; }
.knob { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.knobBtn { min-height: 44px; min-width: 56px; border-radius: 10px; border: 1px solid var(--line); background: var(--kBg11); color: var(--dim); font-size: 13px; cursor: pointer; }
.knobBtn.on { background: var(--kBg12); color: var(--ink); border: 2px solid var(--hot); font-weight: 700; }

/* R23.13 the tower guide in the help */
#btnGuideJump { margin: 4px 0 8px; }
#guideKey { font-size: 13px; color: var(--dim); margin: 2px 0 6px; }
#guideList { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); column-gap: 14px; }
#guideList h3 { grid-column: 1 / -1; font-size: 15px; margin: 12px 0 4px; }
.gcard { border-top: 1px solid var(--line); padding: 8px 0; min-width: 0; }
.gcard .gh { display: flex; align-items: baseline; gap: 8px; }
.gcard .gi { font-size: 20px; }
.gcard .gh small { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--dim); }
.gcard p { margin: 2px 0; }
.gcard .gm { font-size: 13px; }
.card { background: var(--kBg9); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0; font-size: 14px; line-height: 1.5; }
.card h2 { font-size: 17px; margin: 0 0 4px; }

/* ---- playing ---------------------------------------------------------------------------- */
#hud { position: absolute; top: 6px; left: 8px; right: 8px; height: 40px; display: flex; gap: 6px; align-items: center; pointer-events: none; }
/* R-G HUD: chips sized by a fixed track, never by their text, so nothing jumps */
.chip { background: var(--kBg13); color: var(--kInk1); border-radius: 14px; padding: 5px 10px; font-size: 16px; font-weight: 700;
        white-space: nowrap; overflow: hidden; min-width: 0; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
#chipCrystals { width: 78px; }
#chipCogs { width: 88px; }
#chipWave { width: 86px; }
/* R24.15 Tower Wars' counts: five fixed tracks, a label over a number, so nothing jumps or overflows at 320 px */
#warsHud { position: absolute; top: 6px; left: 8px; right: 8px; height: 40px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.3fr); gap: 4px; pointer-events: none; }
.wchip { min-width: 0; background: var(--kBg13); color: var(--kInk1); border-radius: 10px; padding: 2px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center;
         overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wchip small { font-size: 10px; line-height: 12px; color: var(--dim); font-weight: 700; }
.wchip b { font-size: 14px; line-height: 18px; }
#wStreamNum { font-size: 13px; }
/* the ring to the next payment: app.js sets --k, the share of the 10 s gone */
#wRing { display: inline-block; width: 9px; height: 9px; margin-right: 2px; vertical-align: -1px; border-radius: 50%; background: conic-gradient(var(--good) var(--k, 0deg), var(--kBg3) 0); }
/* R20.13 the coach's line sits in the band the map is fitted clear of (app.js places it: upright between the map and
   the bar, sideways between the map and the side bar), on a card, so it never covers the map or the mouth's label */
#coachLine { position: absolute; box-sizing: border-box; text-align: center; font-size: 15px; line-height: 1.25; font-weight: 700; color: var(--kInk1);
             background: var(--kBg13); border-radius: 12px; padding: 4px 8px; overflow: hidden; pointer-events: none; }
#bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; align-items: center; justify-content: center;
       padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 10px); background: linear-gradient(var(--kBg15), var(--kBg16)); }
.barBtn { min-width: 48px; min-height: 52px; border-radius: 16px; border: 1px solid var(--line); background: var(--kBg2); color: var(--ink);
          font-size: 18px; font-weight: 700; cursor: pointer; padding: 0 8px; white-space: nowrap; flex: 0 0 auto; }
/* R20.12: the labels never wrap; the wave button gives way, its words shrink before they wrap */
.barBtn.wide { flex: 1 1 auto; min-width: 0; max-width: 280px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
#btnSpeed { min-width: 52px; }
/* R21.10 the speeds: over the bar's own space while open, never over the map */
#speedRow { position: absolute; inset: 0; z-index: 2; display: flex; gap: 6px; align-items: center; justify-content: center;
            padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 10px); background: var(--kBg16); }
#speedRow[hidden] { display: flex; visibility: hidden; }   /* R-C19: absolute in the bar, hidden by visibility */
.spd { flex: 1 1 0; max-width: 90px; min-width: 48px; min-height: 52px; border-radius: 16px; border: 1px solid var(--line); background: var(--kBg2);
       color: var(--ink); font-size: 18px; font-weight: 700; cursor: pointer; }
.spd.on { box-shadow: inset 0 0 0 3px var(--hot); }
@media (max-width: 359px) { .barBtn.wide { font-size: 13px; } .barBtn { padding: 0 6px; } }
.barBtn.primary { background: var(--hot); color: var(--hotInk); border-color: var(--kLine2); }
.barBtn.on { box-shadow: inset 0 0 0 3px var(--hot); }
.barBtn:disabled { opacity: .45; cursor: default; }

/* R20.4 the tray of towers and a tower's panel: docked at the bottom where the bar is, the map fitted above
   them (app.js DOCK_UP is this height), so neither covers the map, the way or the store */
#tray, #panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: 150px; overflow: hidden;
                padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 6px); background: var(--kBg16); border-top: 1px solid var(--line); }
/* R23.9 the line says the sentence of the tower the coach marks or the finger is on; its type steps down (13 to 10 px,
   app.js fitLine) rather than be cut, so it keeps one line and the buttons keep their room */
#trayLine { font-weight: 700; font-size: 13px; line-height: 16px; min-height: 16px; margin: 0 4px 3px; white-space: nowrap; overflow: hidden; color: var(--kInk1); }
#trayLine.bad { color: var(--bad); }
#trayBtns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-width: 460px; margin: 0 auto; }
.trayBtn { min-width: 0; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--kBg2); color: var(--ink);
           cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0 2px; font-size: 17px; line-height: 18px; }
.trayBtn b { font-size: 11px; line-height: 12px; font-weight: 700; white-space: nowrap; }
.trayBtn small { font-size: 11px; line-height: 12px; font-weight: 700; color: var(--dim); }
/* R23.9 what a tower is good and weak against: a picture for each (✈️ 🛡️ 👥 💨) with a small ✅ or ❌ on its corner */
.trayBtn .tags { display: flex; gap: 1px; height: 12px; font-style: normal; }
.tg { position: relative; display: inline-block; font-style: normal; font-size: 10px; line-height: 12px; padding: 0 3px 0 0; }
.tg::after { position: absolute; right: -1px; bottom: -1px; font-size: 7px; line-height: 7px; }
.tg.ok::after { content: "✅"; }
.tg.no::after { content: "❌"; }
.trayBtn:disabled { opacity: .4; cursor: default; }
.trayBtn.hint { box-shadow: inset 0 0 0 3px var(--hot); }
.trayBtn.armed { box-shadow: inset 0 0 0 3px var(--good); background: var(--kBg12); }
/* the close button reads as live: outlined, full strength */
.trayBtn.close { border: 2px solid var(--dim); font-size: 16px; }
#panelName { font-weight: 700; font-size: 15px; line-height: 17px; margin: 0 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* R21.2 what the tower does, one line under its name */
#panelDoes { font-size: 12px; line-height: 14px; margin: 0 4px; color: var(--dim); white-space: nowrap; overflow: hidden; }
/* R23.12 what it is good and weak against, then its reach, hit and how often, one line; the type steps down, never cut */
#panelStats { font-size: 12px; line-height: 14px; height: 14px; margin: 0 4px 1px; color: var(--kInk1); white-space: nowrap; overflow: hidden; display: flex; align-items: center; gap: 3px; }
#panelStats .tg { font-size: 12px; line-height: 14px; }
#panelBtns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; max-width: 460px; margin: 0 auto; }
.panBtn { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--kBg2); color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; padding: 2px 4px; line-height: 1.15; }
.panBtn.primary { background: var(--kBg12); color: var(--ink); border: 2px solid var(--hot); }
.panBtn.warn { background: var(--kBg12); }
.panBtn:disabled { opacity: .4; cursor: default; }
/* R24.15 the send bar: docked where the bar is, as the tray is (app.js DOCK_WARS is this height: the map is fitted clear of
   it); twelve robots in two rows of six, each 44 px or more, then the tier, the pack and close */
#sendBar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: 184px; overflow: hidden;
           padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 6px); background: var(--kBg16); border-top: 1px solid var(--line); }
#sendLine { font-weight: 700; font-size: 13px; line-height: 16px; min-height: 16px; margin: 0 4px 3px; white-space: nowrap; overflow: hidden; color: var(--kInk1); }
#sendLine.bad { color: var(--bad); }
#sendBtns { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; max-width: 460px; margin: 0 auto; }
.sendBtn { min-width: 44px; min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--kBg2); color: var(--ink); cursor: pointer;
           display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0 1px; font-size: 16px; line-height: 18px; overflow: hidden; }
.sendBtn small { font-size: 11px; line-height: 13px; font-weight: 700; white-space: nowrap; }
.sendBtn i { font-style: normal; font-size: 10px; line-height: 12px; font-weight: 700; white-space: nowrap; color: var(--good); }
.sendBtn i.boom { color: var(--bad); }
/* dimmed, never disabled: a tap on one says why on the line above (R24.15) */
.sendBtn.off, .sendAct.off { opacity: .45; }
.sendBtn.off.cogs small { color: var(--bad); }
#setRow { position: absolute; inset: 0; z-index: 2; display: flex; flex-wrap: wrap; align-content: center; gap: 6px; align-items: center; justify-content: center; padding: 10px; background: var(--kBg16); }
#setRow[hidden] { display: flex; visibility: hidden; }
#sendRow { display: grid; grid-template-columns: 1fr 2fr 2fr 1fr; gap: 4px; max-width: 460px; margin: 4px auto 0; }
.sendAct { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--kBg2); color: var(--ink); font-size: 13px; font-weight: 700;
           cursor: pointer; padding: 2px 4px; line-height: 15px; overflow: hidden; }
.sendAct.armed { box-shadow: inset 0 0 0 3px var(--hot); background: var(--kBg12); }
.sendAct.close { border: 2px solid var(--dim); font-size: 16px; }
#btnLook.on { box-shadow: inset 0 0 0 3px var(--hot); }
#fpsNow { position: absolute; left: 8px; top: 52px; background: var(--kBg19); color: var(--kInk3); font: 12px ui-monospace, monospace; padding: 3px 6px; border-radius: 6px; pointer-events: none; z-index: 4; }

.ovl { position: absolute; inset: 0; display: none; align-items: flex-start; justify-content: center; overflow-y: auto; background: var(--kBg20); padding: 12px; z-index: 10; }
.ovl.on { display: flex; }
.ovlCard { width: min(420px, 100%); margin: auto; background: var(--kBg9); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; text-align: center; }
.ovlCard h2 { margin: 4px 0 8px; font-size: 24px; }
.ovlCard p { color: var(--dim); font-size: 15px; line-height: 1.45; margin: 6px 0; }
#overStars { font-size: 34px; color: var(--hot); margin: 2px 0; }
.toast { background: var(--kBg14); color: var(--ink); padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 15px; margin-bottom: 90px; border: 1px solid var(--line); }
.toast-host { position: fixed; left: 0; right: 0; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 40; }
/* a phone on its side: the menu words shrink, the cards put their buttons in a row */
@media (max-height: 480px) {
  .ovlCard { padding: 10px 12px; }
  .ovlCard h2 { font-size: 19px; margin: 2px 0; }
  #over .big, #paused .big { display: inline-block; width: calc(33% - 8px); min-width: 120px; min-height: 46px; margin: 4px 2px; padding: 0 8px; font-size: 15px; }
  #paused .big { width: calc(50% - 8px); }
  #menuTop .sub { display: none; }
  h1 { font-size: 22px; }
  /* R20.12 the side column starts at the top (the counts are on the left) and stops above the version chip */
  #bar { left: auto; top: 0; bottom: 0; flex-direction: column; justify-content: flex-end; width: 78px; background: linear-gradient(90deg, var(--kBg15), var(--kBg16));
         padding: 6px 6px calc(var(--chiph, 44px) + 10px); }
  .barBtn.wide { flex: 0 0 auto; max-width: none; width: 66px; font-size: 13px; min-height: 56px; white-space: normal; }
  /* sideways the column stops above the version chip, as the bar's buttons do (R-C24) */
  #speedRow { flex-direction: column; justify-content: flex-end; bottom: calc(var(--chiph, 44px) + 8px); padding: 6px 6px 2px; }
  .spd { flex: 0 0 auto; width: 66px; max-width: none; min-height: 52px; }
  /* sideways the tray and the panel take the bar's side (app.js DOCK_SIDE is this width) */
  #tray, #panel { left: auto; top: 0; bottom: calc(var(--chiph, 44px) + 8px); width: 204px; height: auto; border-top: 0; border-left: 1px solid var(--line);
                  border-bottom: 1px solid var(--line); background: var(--kBg16); padding: 6px 8px 8px; overflow-y: auto; }
  #trayLine { white-space: normal; font-size: 13px; }
  #panelDoes, #panelStats { white-space: normal; flex-wrap: wrap; height: auto; }
  #trayBtns { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .trayBtn { min-height: 54px; font-size: 16px; line-height: 17px; }
  #panelBtns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* sideways Tower Wars' counts stop short of the side column (the send bar's 204 px and its edge) */
  #warsHud { right: 212px; }
  /* sideways the send bar takes the bar's side too: three robots a row */
  #sendBar { left: auto; top: 0; bottom: calc(var(--chiph, 44px) + 8px); width: 204px; height: auto; border-top: 0; border-left: 1px solid var(--line);
             border-bottom: 1px solid var(--line); padding: 6px 8px 8px; overflow-y: auto; }
  #sendLine { white-space: normal; }
  #sendBtns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #sendRow { grid-template-columns: 1fr 1fr; }
}
#setRow .spd { flex: 1 1 22%; max-width: none; }
.plan { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
.plan th, .plan td { text-align: left; vertical-align: top; padding: 4px 3px; border-bottom: 1px solid var(--line); }
.plan th { font-size: 11px; color: var(--dim); }
