/* ORBITUM — sci-fi tower defense
   All UI chrome lives in the DOM on top of the canvas battlefield. */

:root {
  --bg:        #05070f;
  --panel:     rgba(12, 20, 40, 0.82);
  --panel-2:   rgba(18, 30, 58, 0.92);
  --line:      rgba(120, 180, 255, 0.22);
  --line-hot:  rgba(120, 200, 255, 0.6);
  --text:      #cfe2ff;
  --text-dim:  #7c93bb;
  --accent:    #5ad1ff;
  --accent-2:  #7c8cff;
  --gold:      #ffcf6b;
  --danger:    #ff5f7e;
  --ok:        #6bffb0;
  --hud-top:   54px;
  --hud-bot:   96px;
  --font: "Rajdhani", "Eurostile", "Bahnschrift", "DIN Alternate", "Avenir Next Condensed", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#app { position: fixed; inset: 0; }
canvas#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  letter-spacing: .06em;
}
button:disabled { cursor: not-allowed; }

/* ---------------------------------------------------------- HUD ---- */

#hud {
  position: absolute; top: 0; left: 0; right: 0;
  height: var(--hud-top);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(8px + env(safe-area-inset-left, 0px));
  padding-right: calc(8px + env(safe-area-inset-right, 0px));
  z-index: 20;
}

.hud-bar {
  height: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px;
  background: linear-gradient(180deg, rgba(10,18,38,.94), rgba(8,14,30,.78));
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 26px rgba(0,0,0,.55), inset 0 1px 0 rgba(140,200,255,.09);
}

.hud-spacer { flex: 1; }

.stat {
  display: flex; flex-direction: column; justify-content: center;
  padding: 2px 10px;
  min-width: 62px;
  border-left: 1px solid rgba(120,180,255,.12);
}
.stat-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--text-dim); line-height: 1;
}
.stat-value {
  font-size: 19px; font-weight: 700; line-height: 1.15;
  color: #eaf4ff; text-shadow: 0 0 12px rgba(90,209,255,.5);
  font-variant-numeric: tabular-nums;
}
.stat-lives .stat-value { color: #ff9db1; text-shadow: 0 0 12px rgba(255,95,126,.45); }
.stat-credits .stat-value { color: var(--gold); text-shadow: 0 0 12px rgba(255,207,107,.45); }
.stat-value.bump { animation: bump .28s ease-out; }
@keyframes bump { 0%{transform:scale(1)} 35%{transform:scale(1.32)} 100%{transform:scale(1)} }

.icon-btn {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(30,50,92,.4);
  transition: background .15s, border-color .15s, transform .1s;
}
.icon-btn:hover { background: rgba(50,90,160,.5); border-color: var(--line-hot); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.off svg { stroke: var(--text-dim); opacity: .5; }

.speed-group { display: flex; gap: 4px; align-items: center; }
.speed-btn {
  width: 36px; height: 38px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(30,50,92,.32);
  font-weight: 700; font-size: 13px; color: var(--text-dim);
  transition: all .15s;
}
.speed-btn:hover { color: var(--text); border-color: var(--line-hot); }
.speed-btn.active {
  color: #061018; background: linear-gradient(180deg, #8fe4ff, #43b6e8);
  border-color: #9fe8ff; box-shadow: 0 0 14px rgba(90,209,255,.55);
}

.wave-btn {
  height: 38px; padding: 0 18px;
  border-radius: 9px; font-weight: 700; font-size: 14px;
  text-transform: uppercase;
  border: 1px solid rgba(160,255,220,.5);
  background: linear-gradient(180deg, rgba(60,220,160,.32), rgba(20,120,90,.32));
  color: #b6ffe0;
  box-shadow: 0 0 18px rgba(60,220,160,.22), inset 0 1px 0 rgba(180,255,230,.2);
  transition: all .15s;
  white-space: nowrap;
}
.wave-btn:hover { background: linear-gradient(180deg, rgba(80,255,190,.45), rgba(24,150,110,.45)); }
.wave-btn.running {
  border-color: rgba(160,200,255,.28); color: var(--text-dim);
  background: rgba(20,34,64,.5); box-shadow: none;
}

/* --------------------------------------------------- BUILD BAR ---- */

#buildbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  min-height: var(--hud-bot);
  z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px calc(8px + env(safe-area-inset-left,0px)) calc(8px + env(safe-area-inset-bottom,0px));
  flex-wrap: nowrap;
}

.tower-card {
  position: relative;
  width: 92px; height: 78px;
  border: 1px solid var(--line); border-radius: 11px;
  background: linear-gradient(180deg, rgba(14,24,48,.94), rgba(9,16,34,.86));
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .12s, border-color .15s, box-shadow .15s;
  overflow: hidden;
}
.tower-card canvas { width: 34px; height: 34px; }
.tower-card .tc-name {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); line-height: 1;
}
.tower-card .tc-cost {
  font-size: 13px; font-weight: 700; color: var(--gold);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.tower-card .tc-key {
  position: absolute; top: 4px; left: 6px;
  font-size: 9px; color: var(--text-dim); opacity: .7;
}
.tower-card:hover { transform: translateY(-3px); border-color: var(--line-hot); }
.tower-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 26px rgba(90,209,255,.45);
  transform: translateY(-4px);
}
.tower-card.broke { opacity: .45; }
.tower-card.broke .tc-cost { color: var(--danger); }
.tower-card.locked { opacity: .34; filter: grayscale(1); }
.tower-card.locked .tc-cost { visibility: hidden; }
.tower-card.locked::after {
  content: "LOCKED"; position: absolute; inset: auto 0 6px 0;
  font-size: 9px; letter-spacing: .14em; color: var(--text-dim);
}

/* -------------------------------------------------- INSPECTOR ---- */

#inspector {
  position: absolute; right: 12px; top: calc(var(--hud-top) + 10px);
  width: 232px; z-index: 22;
  padding: 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { opacity:0; transform: translateX(14px); } to { opacity:1; transform:none; } }

.insp-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.insp-head canvas { width: 38px; height: 38px; flex: 0 0 38px; }
.insp-title { font-size: 15px; font-weight: 700; letter-spacing: .04em; line-height: 1.1; }
.insp-lvl { font-size: 10px; letter-spacing: .16em; color: var(--accent); text-transform: uppercase; }

.insp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; margin: 9px 0; }
.insp-stat { font-size: 11px; color: var(--text-dim); display: flex; justify-content: space-between; gap: 4px; }
.insp-stat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.insp-stat .up { color: var(--ok); font-size: 10px; }

.insp-perk {
  font-size: 10.5px; line-height: 1.35; color: #a9c8f5;
  border-left: 2px solid var(--accent-2); padding: 3px 0 3px 7px; margin: 8px 0;
}

.insp-btn {
  width: 100%; height: 34px; margin-top: 6px;
  border-radius: 8px; border: 1px solid var(--line);
  background: rgba(40,70,130,.4);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .14s;
}
.insp-btn:hover:not(:disabled) { background: rgba(60,110,190,.55); border-color: var(--line-hot); }
.insp-btn:disabled { opacity: .4; }
.insp-btn.up { border-color: rgba(120,255,190,.4); color: #b6ffe0; background: rgba(30,110,80,.35); }
.insp-btn.up:hover:not(:disabled) { background: rgba(40,160,115,.5); }
.insp-btn.sell { border-color: rgba(255,120,150,.35); color: #ffb3c4; background: rgba(120,30,50,.3); }
.insp-btn.sell:hover { background: rgba(170,40,70,.45); }
.insp-btn .cost { color: var(--gold); }
.insp-target {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-dim); margin-top: 8px;
}
.insp-target button {
  font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .08em;
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px;
  background: rgba(30,60,110,.4);
}

/* ----------------------------------------------------- BANNER ---- */

#banner {
  position: absolute; left: 50%; top: 26%;
  transform: translateX(-50%);
  z-index: 15; pointer-events: none; text-align: center;
  animation: bannerIn 2.6s ease-out forwards;
}
#banner .b-sub { font-size: 11px; letter-spacing: .4em; color: var(--accent); text-transform: uppercase; }
#banner .b-main {
  font-size: 40px; font-weight: 700; letter-spacing: .08em;
  color: #eaf6ff; text-shadow: 0 0 34px rgba(90,209,255,.8), 0 4px 20px rgba(0,0,0,.7);
}
#banner .b-main.danger { color: #ffd8e0; text-shadow: 0 0 38px rgba(255,60,110,.9); }
@keyframes bannerIn {
  0%   { opacity: 0; transform: translateX(-50%) scale(.86); }
  12%  { opacity: 1; transform: translateX(-50%) scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1.05); }
}

/* ---------------------------------------------------- OVERLAY ---- */

#overlay {
  position: absolute; inset: 0; z-index: 40;
  background: radial-gradient(ellipse at 50% 40%, rgba(14,26,54,.82), rgba(3,5,12,.95));
  backdrop-filter: blur(7px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.screen { width: 100%; max-width: 940px; animation: fadeUp .3s ease-out; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: none; } }

.logo { text-align: center; margin-bottom: 22px; }
.logo h1 {
  font-size: clamp(38px, 9vw, 78px); font-weight: 700; letter-spacing: .22em;
  background: linear-gradient(180deg, #ffffff, #7fd5ff 55%, #3f7fd0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 26px rgba(90,209,255,.45));
  line-height: 1;
}
.logo p { font-size: clamp(10px, 2.4vw, 13px); letter-spacing: .5em; color: var(--text-dim); text-transform: uppercase; margin-top: 8px; }

.menu-list { display: flex; flex-direction: column; gap: 10px; max-width: 340px; margin: 0 auto; }
.big-btn {
  width: 100%; padding: 15px 20px;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, rgba(24,44,86,.85), rgba(12,22,46,.85));
  font-size: 16px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: all .16s;
}
.big-btn:hover { border-color: var(--accent); box-shadow: 0 0 26px rgba(90,209,255,.3); transform: translateY(-2px); }
.big-btn.primary {
  background: linear-gradient(180deg, rgba(70,180,255,.34), rgba(24,80,150,.34));
  border-color: rgba(120,220,255,.55); color: #eaf8ff;
  box-shadow: 0 0 30px rgba(90,209,255,.25);
}
.big-btn small { font-size: 10px; letter-spacing: .12em; color: var(--text-dim); font-weight: 400; text-transform: none; }
.big-btn:disabled { opacity: .35; }
.big-btn:disabled:hover { transform: none; box-shadow: none; border-color: var(--line); }

.screen-title {
  text-align: center; font-size: clamp(22px, 5vw, 34px); font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; margin-bottom: 4px;
  text-shadow: 0 0 26px rgba(90,209,255,.4);
}
.screen-sub { text-align: center; font-size: 12px; letter-spacing: .22em; color: var(--text-dim); text-transform: uppercase; margin-bottom: 22px; }

.world-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.world-card {
  position: relative; text-align: left; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 13px;
  background: rgba(10,18,38,.75);
  transition: all .16s;
}
.world-card:hover:not(.locked) { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 34px rgba(90,209,255,.22); }
.world-card canvas { display: block; width: 100%; height: 92px; }
.wc-body { padding: 9px 11px 11px; }
.wc-idx { font-size: 9px; letter-spacing: .26em; color: var(--accent); text-transform: uppercase; }
.wc-name { font-size: 16px; font-weight: 700; letter-spacing: .04em; line-height: 1.2; }
.wc-meta { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; letter-spacing: .06em; }
.wc-stars { position: absolute; top: 8px; right: 10px; display: flex; gap: 3px; }
.wc-stars i { width: 11px; height: 11px; display: block; background: var(--text-dim); opacity: .35;
  clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); }
.wc-stars i.on { background: var(--gold); opacity: 1; box-shadow: 0 0 8px var(--gold); }
.world-card.locked { opacity: .42; filter: saturate(.25); cursor: not-allowed; }
.world-card.locked::after {
  content: "◈ LOCKED"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 12px; letter-spacing: .22em;
  background: rgba(4,8,18,.55);
}

.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .mode-row { grid-template-columns: 1fr; } }

.result-panel {
  max-width: 460px; margin: 0 auto; text-align: center;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel-2); padding: 26px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.result-panel h2 { font-size: 34px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.result-panel h2.win { color: #b6ffe0; text-shadow: 0 0 30px rgba(60,220,160,.6); }
.result-panel h2.lose { color: #ffb3c4; text-shadow: 0 0 30px rgba(255,95,126,.6); }
.result-panel .r-sub { font-size: 12px; letter-spacing: .2em; color: var(--text-dim); text-transform: uppercase; margin-bottom: 16px; }
.result-stars { display: flex; justify-content: center; gap: 10px; margin: 14px 0 18px; }
.result-stars i { width: 34px; height: 34px; display: block; background: var(--text-dim); opacity: .28;
  clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); }
.result-stars i.on { background: var(--gold); opacity: 1; box-shadow: 0 0 20px var(--gold); animation: starPop .45s backwards; }
.result-stars i.on:nth-child(2) { animation-delay: .14s; }
.result-stars i.on:nth-child(3) { animation-delay: .28s; }
@keyframes starPop { from { transform: scale(0) rotate(-45deg); opacity: 0; } }
.result-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.result-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-dim); }
.result-row b { color: var(--text); font-weight: 700; }
.unlock-note {
  font-size: 12px; color: var(--gold); letter-spacing: .08em;
  border: 1px dashed rgba(255,207,107,.4); border-radius: 8px; padding: 8px; margin-bottom: 14px;
}

/* ---------------------------------------------- ACCOUNT / STORE ---- */

.menu-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(14,24,48,.8); font-size: 12px; letter-spacing: .06em;
  transition: all .15s; max-width: 100%;
}
.chip:hover { border-color: var(--accent); }
.chip b { color: var(--text); font-weight: 700; }
.chip .who {
  max-width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text);
}
.chip .sub { color: var(--text-dim); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.coin {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; display: inline-block;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #e0a33a 65%, #a06f19);
  box-shadow: 0 0 8px rgba(255,207,107,.5), inset 0 0 0 1px rgba(255,255,255,.32);
}
.chip.coins b { color: var(--gold); font-variant-numeric: tabular-nums; }
.chip.offline { opacity: .55; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.chip .dot.warn { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

.auth-panel { max-width: 380px; margin: 0 auto; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-tabs button {
  flex: 1; padding: 11px 0; font-size: 12px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-dim); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 5px;
}
.field input {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(6,12,26,.75); color: var(--text);
  font-family: inherit; font-size: 14px; letter-spacing: .02em;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(90,209,255,.14); }
.field .hint { font-size: 10.5px; color: var(--text-dim); margin-top: 5px; }
.form-msg { font-size: 12px; line-height: 1.5; padding: 9px 11px; border-radius: 9px; margin-bottom: 12px; }
.form-msg.err { color: #ffb3c4; background: rgba(255,95,126,.1); border: 1px solid rgba(255,95,126,.34); }
.form-msg.ok  { color: #b6ffe0; background: rgba(107,255,176,.09); border: 1px solid rgba(107,255,176,.32); }
.form-msg a { color: inherit; }
.form-msg code { font-size: 10.5px; word-break: break-all; opacity: .85; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.pack-card {
  position: relative; text-align: center; padding: 18px 14px 16px;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,34,66,.85), rgba(9,16,34,.85));
  transition: all .16s;
}
.pack-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 10px 34px rgba(255,207,107,.16); }
.pack-card:disabled { opacity: .5; }
.pack-card .stack {
  width: 56px; height: 56px; margin: 0 auto 10px; position: relative;
}
.pack-card .stack i {
  position: absolute; left: 50%; width: 34px; height: 34px; margin-left: -17px; border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffeeb6, #e2a63c 62%, #93630f);
  box-shadow: 0 3px 10px rgba(0,0,0,.5), inset 0 0 0 1.5px rgba(255,255,255,.3);
}
.pack-card .pk-amt { font-size: 22px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.pack-card .pk-bonus { font-size: 11px; color: var(--ok); margin-top: 1px; }
.pack-card .pk-name { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim); margin-top: 4px; }
.pack-card .pk-price {
  margin-top: 12px; padding: 9px 0; border-radius: 9px;
  border: 1px solid rgba(255,207,107,.4); background: rgba(255,207,107,.09);
  font-size: 15px; font-weight: 700; color: var(--gold);
}
.pack-card .pk-tag {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase; padding: 3px 10px;
  border-radius: 999px; background: linear-gradient(180deg,#8fe4ff,#43b6e8); color: #061018; font-weight: 700;
}
.shop-note {
  margin-top: 16px; font-size: 11px; line-height: 1.55; color: var(--text-dim); text-align: center;
}

#toast {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(92vw, 460px);
}
.toast {
  padding: 11px 18px; border-radius: 11px; font-size: 12.5px; letter-spacing: .04em;
  border: 1px solid var(--line); background: rgba(10,18,38,.96); color: var(--text);
  box-shadow: 0 10px 34px rgba(0,0,0,.6); animation: toastIn .3s ease-out;
  text-align: center; line-height: 1.45;
}
.toast.ok { border-color: rgba(107,255,176,.5); color: #b6ffe0; }
.toast.err { border-color: rgba(255,95,126,.5); color: #ffb3c4; }
.toast.gold { border-color: rgba(255,207,107,.5); color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 20px; }
@media (max-width: 660px) { .help-cols { grid-template-columns: 1fr; } }
.help-block h3 { font-size: 12px; letter-spacing: .22em; color: var(--accent); text-transform: uppercase; margin-bottom: 8px; }
.help-block ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.help-block li { font-size: 12.5px; line-height: 1.45; color: #a9c1e4; display: flex; gap: 8px; }
.help-block li .t { flex: 1 1 auto; }
.help-block li span.k {
  flex: 0 0 auto; min-width: 20px; text-align: center;
  border: 1px solid var(--line); border-radius: 5px; padding: 0 5px;
  font-size: 11px; color: var(--text); background: rgba(30,50,92,.5);
}
.help-block li em { color: var(--text); font-style: normal; font-weight: 700; }

.bestiary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; }
.beast { display: flex; gap: 9px; align-items: center; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px; background: rgba(10,18,38,.6); }
.beast canvas { width: 34px; height: 34px; flex: 0 0 34px; }
.beast .b-n { font-size: 12.5px; font-weight: 700; line-height: 1.1; }
.beast .b-d { font-size: 10px; color: var(--text-dim); line-height: 1.25; margin-top: 2px; }

.back-row { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.ghost-btn {
  padding: 11px 26px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700;
  background: rgba(16,28,54,.6); transition: all .15s;
}
.ghost-btn:hover { border-color: var(--accent); color: #fff; }

.pause-note { text-align:center; font-size: 12px; color: var(--text-dim); letter-spacing: .14em; margin-top: 14px; }

/* ------------------------------------------------ ROTATE HINT ---- */

#rotate-hint { display: none; }
@media (max-height: 430px) and (orientation: portrait) , (max-width: 560px) and (orientation: portrait) {
  #rotate-hint {
    position: absolute; inset: 0; z-index: 90;
    background: var(--bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  }
  #rotate-hint svg { width: 84px; height: 84px; fill: none; stroke: var(--accent); stroke-width: 1.5; animation: rot 2.4s ease-in-out infinite; }
  #rotate-hint p { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-dim); }
  @keyframes rot { 0%,40%{transform:rotate(0)} 60%,100%{transform:rotate(90deg)} }
}

/* --------------------------------------------- SMALL SCREENS ---- */

/* Phone landscape: the battlefield needs every pixel of height it can get. */
@media (max-height: 540px) {
  :root { --hud-top: 42px; --hud-bot: 66px; }
  .hud-bar { padding: 0 6px; gap: 6px; }
  .stat { min-width: 48px; padding: 1px 6px; }
  .stat-label { font-size: 8px; letter-spacing: .12em; }
  .stat-value { font-size: 14px; }
  .icon-btn, .speed-btn { width: 30px; height: 30px; flex-basis: 30px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .speed-btn { font-size: 11px; }
  .wave-btn { height: 30px; padding: 0 10px; font-size: 11px; }
  #buildbar { gap: 5px; padding: 4px 6px 6px; }
  .tower-card { width: 62px; height: 54px; border-radius: 9px; }
  .tower-card canvas { width: 24px; height: 24px; }
  .tower-card .tc-name { font-size: 8px; }
  .tower-card .tc-cost { font-size: 11px; }
  #inspector { width: 168px; padding: 8px; right: 6px; top: calc(var(--hud-top) + 6px); }
  .insp-head canvas { width: 28px; height: 28px; flex-basis: 28px; }
  .insp-title { font-size: 12.5px; }
  .insp-lvl { font-size: 9px; }
  .insp-stats { gap: 2px 6px; margin: 6px 0; }
  .insp-stat { font-size: 10px; }
  .insp-btn { height: 28px; font-size: 10.5px; margin-top: 4px; }
  .insp-perk { font-size: 9.5px; margin: 5px 0; }
  #banner .b-main { font-size: 24px; }
  #banner { top: 20%; }
}

@media (max-width: 900px) {
  :root { --hud-top: 46px; --hud-bot: 78px; }
  .stat { min-width: 52px; padding: 2px 7px; }
  .stat-value { font-size: 16px; }
  .tower-card { width: 74px; height: 66px; }
  .tower-card canvas { width: 28px; height: 28px; }
  .icon-btn, .speed-btn { width: 32px; height: 32px; flex-basis: 32px; }
  .wave-btn { height: 32px; padding: 0 12px; font-size: 12px; }
  #inspector { width: 196px; right: 8px; }
  #banner .b-main { font-size: 28px; }
  .stat-value { font-size: 15px; }
}
@media (max-width: 560px) {
  #stat-world { display: none; }
  .tower-card .tc-key { display: none; }
}
