/* Fort Frenzy — styles */
:root {
  --sky-1: #5fc3ff;
  --sky-2: #2b86d9;
  --navy: #14365e;
  --navy-2: #1d4a7c;
  --navy-3: #0c2443;
  --line: #0a1c33;
  --gold: #ffcf3a;
  --gold-2: #f29b0c;
  --gold-dark: #9a5b00;
  --red: #e8413a;
  --red-dark: #8f1d18;
  --green: #5bd24a;
  --green-dark: #2a7d22;
  --blue: #5ec8ff;
  --stone: #a9afb8;
  --text: #ffffff;
  --muted: #b7cbe6;
  --sidebar-w: 288px;
  --hud-h: 64px;
  --gap: 12px;
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255,255,255,0.35), transparent 60%),
    linear-gradient(180deg, var(--sky-1), var(--sky-2));
  color: var(--text);
  font-family: var(--body);
  font-weight: 800;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px var(--gap) var(--gap);
  gap: 8px;
}

/* ---------------- HUD ---------------- */
#hud {
  width: calc(var(--stage-w) + var(--sidebar-w) + var(--gap));
  max-width: 100%;
  height: var(--hud-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  border: 3px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--line), 0 10px 24px rgba(0, 30, 70, 0.35);
}
.hud-logo { height: 52px; width: auto; border-radius: 10px; margin-right: 4px; }
.stat {
  display: flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 14px 0 10px;
  background: var(--navy-3);
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.5);
  min-width: 96px;
}
.stat .ico { width: 24px; height: 24px; fill: var(--red); filter: drop-shadow(0 2px 0 rgba(0,0,0,0.4)); }
.stat.gold { color: var(--gold); min-width: 120px; }
.stat.wave .lbl { font-size: 15px; color: var(--muted); margin-right: 2px; }
.stat.wave small { font-size: 15px; color: var(--muted); }
.stat.hurt { animation: hurt 0.4s; }
.stat.shake { animation: shakeX 0.35s; }
@keyframes hurt { 0%, 100% { background: var(--navy-3); } 30% { background: #7a1712; transform: scale(1.08); } }
@keyframes shakeX { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.coin {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6b0 0 18%, var(--gold) 20% 60%, var(--gold-2) 62%);
  border: 2px solid var(--gold-dark);
  vertical-align: -2px;
  flex: none;
}
.coin.big { width: 22px; height: 22px; }
.hud-spacer { flex: 1; }

.hud-btn {
  height: 42px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, #3b6ea6, #27507f);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--line), inset 0 2px 0 rgba(255,255,255,0.18);
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
  transition: transform 0.08s, filter 0.15s;
}
.hud-btn:hover:not(:disabled) { filter: brightness(1.12); }
.hud-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.hud-btn .ico { width: 22px; height: 22px; fill: #fff; }
.hud-btn .ico .stroke { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; }
.hud-btn.icon { width: 42px; padding: 0; }
.hud-btn .off-ico { display: none; }
#btn-mute.off .on-ico { display: none; }
#btn-mute.off .off-ico { display: block; }
.hud-btn.toggle.on, #btn-speed.on { background: linear-gradient(180deg, #4fbf43, #2d8a26); }
.ff { font-size: 11px; letter-spacing: -2px; margin-right: 2px; }

.hud-btn.play {
  min-width: 150px; height: 46px; font-size: 20px;
  background: linear-gradient(180deg, #74e35f, #34a82a);
  border-color: #134d10;
  box-shadow: 0 4px 0 #134d10, inset 0 2px 0 rgba(255,255,255,0.35);
}
.hud-btn.play:disabled {
  background: linear-gradient(180deg, #5c7590, #3f5670);
  border-color: var(--line); box-shadow: 0 3px 0 var(--line);
  color: #d3e0ef;
}
.hud-btn.play.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); filter: brightness(1.15); } }

.hud-btn.ability {
  position: relative; width: 50px; padding: 0; overflow: hidden;
  background: linear-gradient(180deg, #c18a4e, #8c5a2a);
  border-color: #3d220b; box-shadow: 0 3px 0 #3d220b, inset 0 2px 0 rgba(255,255,255,0.25);
}
.hud-btn.ability .ico { width: 28px; height: 28px; fill: #cfd3d9; stroke: #4b505a; stroke-width: 1.5; }
.hud-btn.ability .ico .hl { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; }
.hud-btn.ability::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(8, 20, 40, 0.72);
  transform-origin: bottom; transform: scaleY(var(--cd, 0));
}
.hud-btn.ability.active { outline: 3px solid var(--gold); outline-offset: 1px; }
#boulder-cd {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ---------------- Main layout ---------------- */
#main {
  --stage-w: min(calc(100vw - var(--sidebar-w) - var(--gap) * 3), calc((100vh - var(--hud-h) - 40px) * 1.6));
  display: flex;
  gap: var(--gap);
  align-items: stretch;
}
#app { --stage-w: min(calc(100vw - var(--sidebar-w) - var(--gap) * 3), calc((100vh - var(--hud-h) - 40px) * 1.6)); }

#stage {
  position: relative;
  width: var(--stage-w);
  aspect-ratio: 8 / 5;
  border: 3px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 0 var(--line), 0 14px 30px rgba(0, 30, 70, 0.35);
  background: #5fb83c;
}
#game { display: block; width: 100%; height: 100%; touch-action: none; image-rendering: pixelated; image-rendering: crisp-edges; }

#banner {
  position: absolute; left: 50%; top: 34%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0; pointer-events: none;
  text-align: center;
  white-space: nowrap;
}
#banner.show { animation: banner 2.2s ease-out forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1); }
}
.b-title {
  font-family: var(--display);
  font-size: clamp(36px, 6vw, 64px);
  color: var(--gold);
  -webkit-text-stroke: 3px #5a2a00;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #5a2a00, 0 10px 24px rgba(0,0,0,0.35);
}
.b-sub {
  display: inline-block; margin-top: 6px;
  padding: 6px 18px;
  background: var(--red);
  border: 3px solid var(--red-dark);
  border-radius: 10px;
  font-family: var(--display);
  font-size: clamp(15px, 2vw, 21px);
  box-shadow: 0 4px 0 var(--red-dark);
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}

/* ---------------- Sidebar ---------------- */
#sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  border: 3px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--line), 0 14px 30px rgba(0, 30, 70, 0.35);
  padding: 12px;
  overflow-y: auto;
  max-height: calc(var(--stage-w) / 1.6);
}
#sidebar h2 {
  margin: 0 0 10px;
  font-family: var(--display); font-weight: 400;
  font-size: 22px; letter-spacing: 0.5px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 4px 7px;
  background: linear-gradient(180deg, #2f5f94, #24497a);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--line), inset 0 2px 0 rgba(255,255,255,0.12);
  transition: transform 0.08s, filter 0.15s;
}
.shop-card:hover { filter: brightness(1.15); transform: translateY(-2px); }
.shop-card .icon { width: 56px; height: 56px; }
.shop-card .name { font-size: 13px; line-height: 1.1; margin-top: 2px; text-align: center; }
.shop-card .price { display: flex; align-items: center; gap: 4px; color: var(--gold); font-family: var(--display); font-size: 16px; margin-top: 2px; }
.shop-card .price .coin { width: 13px; height: 13px; }
.shop-card .hk {
  position: absolute; top: 4px; left: 6px;
  font-size: 11px; color: var(--muted);
  background: rgba(0,0,0,0.25); border-radius: 5px; padding: 0 5px;
}
.shop-card.poor { filter: grayscale(0.85) brightness(0.75); }
.shop-card.poor .price { color: #ff8a80; }
.shop-card.active { background: linear-gradient(180deg, #ffd85a, #f2a114); border-color: var(--gold-dark); color: #3b2200; box-shadow: 0 3px 0 var(--gold-dark); }
.shop-card.active .price { color: #6b3a00; }

.info {
  margin-top: 10px; padding: 10px 12px; min-height: 104px;
  background: var(--navy-3); border: 2px solid var(--line); border-radius: 12px;
  font-weight: 700; font-size: 13.5px; line-height: 1.35; color: var(--muted);
}
.info h4 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 18px; color: #fff; }
.info p { margin: 0 0 6px; }
.info .stats { color: var(--gold); font-weight: 800; margin: 0; }
.info .hint b { color: #fff; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; font-size: 12px; color: var(--muted); font-weight: 700; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 5px; text-align: center;
  background: #2a5486; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 5px;
  font-family: var(--body); font-size: 11px; color: #fff;
}

/* tower view */
.tv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#tv-icon canvas { width: 52px; height: 52px; display: block; }
#tv-icon { background: var(--navy-3); border: 2px solid var(--line); border-radius: 12px; padding: 2px; }
.tv-title { flex: 1; min-width: 0; }
.tv-title h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.1; text-shadow: 0 2px 0 rgba(0,0,0,0.4); }
.tv-title p { margin: 2px 0 0; font-size: 13px; color: var(--gold); }
.x-btn {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--red); border: 2px solid var(--red-dark); box-shadow: 0 3px 0 var(--red-dark);
  font-size: 15px;
}
.targeting { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 10px; }
.target-btn {
  padding: 6px 0; font-size: 12.5px;
  background: var(--navy-3); border: 2px solid var(--line); border-radius: 9px; color: var(--muted);
}
.target-btn.on { background: var(--blue); color: #08243f; }

.path-card {
  position: relative;
  padding: 10px 10px 10px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #2f5f94, #24497a);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--line);
}
.path-card[data-path="0"] { border-left: 6px solid var(--gold); }
.path-card[data-path="1"] { border-left: 6px solid var(--blue); }
.pc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 12px; height: 12px; border-radius: 50%; background: var(--navy-3); border: 2px solid var(--line); }
.path-card[data-path="0"] .pips i.on { background: var(--gold); }
.path-card[data-path="1"] .pips i.on { background: var(--blue); }
.owned { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-name { font-family: var(--display); font-size: 18px; letter-spacing: 0.3px; }
.next-desc { font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.3; margin: 2px 0 8px; min-height: 34px; }
.up-btn {
  width: 100%; height: 38px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, #74e35f, #34a82a);
  border: 2px solid #134d10; border-radius: 10px;
  box-shadow: 0 3px 0 #134d10, inset 0 2px 0 rgba(255,255,255,0.3);
  font-family: var(--display); font-size: 19px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
.up-btn:hover:not(:disabled) { filter: brightness(1.1); }
.up-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #134d10; }
.up-btn:disabled { background: #43576e; border-color: var(--line); box-shadow: 0 3px 0 var(--line); color: #a8b8ca; }
.path-card.maxed .up-btn:disabled { background: linear-gradient(180deg, #ffd85a, #f2a114); color: #5a3000; text-shadow: none; border-color: var(--gold-dark); }
.pc-key { position: absolute; top: 8px; right: 9px; font-size: 11px; color: var(--muted); background: rgba(0,0,0,0.25); border-radius: 5px; padding: 0 5px; }
.sell-btn {
  width: 100%; height: 40px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, #f2675f, #c4302a);
  border: 2px solid var(--red-dark); border-radius: 10px;
  box-shadow: 0 3px 0 var(--red-dark);
  font-family: var(--display); font-size: 18px;
}
.sell-btn:hover { filter: brightness(1.1); }

/* ---------------- Overlays ---------------- */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(10, 30, 60, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  z-index: 10;
}
.overlay.show { opacity: 1; pointer-events: auto; }
#ov-title { background: linear-gradient(180deg, rgba(60,170,255,0.55), rgba(20,70,140,0.6)); backdrop-filter: blur(2px); }
.panel {
  width: min(720px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px;
  text-align: center;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--line), 0 24px 60px rgba(0, 20, 50, 0.5);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.3s cubic-bezier(.2,1.4,.4,1);
}
.overlay.show .panel { transform: none; }
.panel.small { width: min(400px, 100%); }
.panel h2 { margin: 0 0 14px; font-family: var(--display); font-weight: 400; font-size: 38px; text-shadow: 0 3px 0 rgba(0,0,0,0.4); }
.panel h2.bad { color: #ff8a80; }
.panel h2.good { color: var(--gold); }
.summary { font-weight: 700; color: var(--muted); font-size: 16px; margin: 0 0 18px; }
.summary b { color: #fff; }

.title-panel { background: transparent; border: 0; box-shadow: none; padding: 0; }
.title-logo {
  width: min(560px, 90%);
  height: auto;
  border-radius: 24px;
  border: 4px solid var(--line);
  box-shadow: 0 6px 0 var(--line), 0 20px 50px rgba(0,20,50,0.45);
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-8px) rotate(-0.6deg); } }
.tagline {
  font-size: 18px; margin: 18px 0 16px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
.diff-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.diff-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px 12px;
  border: 3px solid var(--line); border-radius: 16px;
  box-shadow: 0 5px 0 var(--line);
  transition: transform 0.1s, filter 0.15s;
}
.diff-btn:hover { transform: translateY(-3px); filter: brightness(1.1); }
.diff-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.diff-btn.easy { background: linear-gradient(180deg, #74e35f, #34a82a); }
.diff-btn.medium { background: linear-gradient(180deg, #ffd85a, #f29b0c); color: #3b2200; }
.diff-btn.hard { background: linear-gradient(180deg, #f2675f, #c4302a); }
.d-name { font-family: var(--display); font-size: 28px; text-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.diff-btn.medium .d-name { text-shadow: 0 2px 0 rgba(255,255,255,0.4); }
.d-map { font-family: var(--display); font-size: 15px; letter-spacing: 0.3px; opacity: 0.95; }
.d-meta { font-size: 13px; }
.d-best { font-size: 12px; opacity: 0.85; margin-top: 4px; padding: 2px 8px; background: rgba(0,0,0,0.18); border-radius: 8px; }
.fine { font-size: 14px; color: #e3f1ff; margin: 16px 0 0; text-shadow: 0 1px 0 rgba(0,0,0,0.4); }

.big-btn {
  display: block; width: 100%; height: 50px; margin-top: 10px;
  background: linear-gradient(180deg, #3b6ea6, #27507f);
  border: 3px solid var(--line); border-radius: 14px;
  box-shadow: 0 4px 0 var(--line);
  font-family: var(--display); font-size: 21px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
.big-btn.green { background: linear-gradient(180deg, #74e35f, #34a82a); border-color: #134d10; box-shadow: 0 4px 0 #134d10; }
.big-btn.ghost { background: transparent; box-shadow: none; border-color: rgba(255,255,255,0.25); }
.big-btn:hover { filter: brightness(1.1); }
.big-btn:active { transform: translateY(2px); }

/* ---------------- Smaller screens ---------------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  #app, #main { --stage-w: calc(100vw - var(--gap) * 2); }
  #app { height: auto; min-height: 100vh; }
  #hud { flex-wrap: wrap; height: auto; width: 100%; }
  .hud-logo { display: none; }
  .stat { font-size: 19px; min-width: 0; height: 36px; padding: 0 10px; }
  .hud-btn { height: 38px; font-size: 15px; padding: 0 10px; }
  .hud-btn.play { min-width: 0; height: 38px; font-size: 16px; }
  #main { flex-direction: column; width: 100%; }
  #sidebar { width: 100%; max-height: none; }
  .shop-grid { grid-template-columns: repeat(3, 1fr); }
  .diff-row { grid-template-columns: 1fr; }
  .keys { display: none; }
}


/* ---------------- Sign-in & leaderboards (online.js) ---------------- */
.who-line { margin-top: 14px; font-size: 14px; font-weight: 700; color: #e3f1ff; text-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.who-line b { color: #fff; }
.who-line .code { font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: 2px; color: var(--gold); }
.who-line.hud-who { flex: none; margin: 0 0 0 10px; padding: 0 12px; height: 40px; display: flex; align-items: center; gap: 6px;
  font-size: 14px; white-space: nowrap; background: var(--navy-3); border: 2px solid var(--line); border-radius: 12px;
  color: var(--muted); text-shadow: none; max-width: 260px; overflow: hidden; }
.who-line.hud-who.guest { border-color: var(--gold-dark); color: #fff; box-shadow: 0 0 10px rgba(255,207,58,.45); }
.who-line.hud-who b { overflow: hidden; text-overflow: ellipsis; }
.who-line.hud-who .code { font-size: 18px; }
@media (max-width: 900px) { .who-line.hud-who { margin: 0; height: 36px; } }
.board-btn { margin-top: 14px; padding: 9px 22px; font-family: var(--display); font-size: 19px;
  background: linear-gradient(180deg, #3b6ea6, #27507f); border: 3px solid var(--line); border-radius: 14px;
  box-shadow: 0 4px 0 var(--line); text-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.board-btn:hover { filter: brightness(1.1); }
.board-panel { width: min(520px, 100%); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tab { padding: 8px 0; font-family: var(--display); font-size: 18px; border: 3px solid var(--line); border-radius: 12px;
  opacity: 0.55; box-shadow: 0 3px 0 var(--line); }
.tab.on { opacity: 1; }
.tab.easy { background: linear-gradient(180deg, #74e35f, #34a82a); }
.tab.medium { background: linear-gradient(180deg, #ffd85a, #f29b0c); color: #3b2200; }
.tab.hard { background: linear-gradient(180deg, #f2675f, #c4302a); }
.online-note { margin: -6px 0 10px; font-size: 14.5px; font-weight: 700; color: var(--muted); }
.online-note b { color: var(--gold); }
ol.top { list-style: none; margin: 0 0 6px; padding: 6px 12px; text-align: left; font-size: 14.5px;
  background: var(--navy-3); border: 2px solid var(--line); border-radius: 12px; }
ol.top:empty { display: none; }
ol.top li { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.07); }
ol.top li:last-child { border-bottom: 0; }
ol.top .n { width: 22px; color: var(--muted); }
ol.top .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.top .sc { font-family: var(--display); font-weight: 400; color: var(--gold); }
ol.top .pp { width: 70px; text-align: right; color: var(--muted); font-size: 12.5px; }
ol.top li.me { color: var(--gold); }
ol.top li.empty { justify-content: center; color: var(--muted); }
.fine.small { font-size: 12px; margin: 6px 0 4px; }

/* ---------------- Tall screens (arcade cabinets, 4:3 or portrait) ----------------
   When the window is not wide enough for the map and the tower panel side by side,
   the tower panel moves under the map and the whole screen is used. */
@media (max-aspect-ratio: 3/2) and (min-width: 901px) {
  #app, #main {
    --shop-h: 190px;
    --stage-w: min(calc(100vw - var(--gap) * 2), calc((100vh - var(--hud-h) - var(--shop-h) - 52px) * 1.6));
  }
  #hud { width: var(--stage-w); }
  #main { flex-direction: column; align-items: center; flex: 1; min-height: 0; }
  #sidebar { width: var(--stage-w); max-height: none; flex: 1; min-height: var(--shop-h); }
  #sidebar h2 { display: none; }
  #shop-view:not([hidden]) { display: grid; grid-template-columns: 1fr minmax(220px, 30%); gap: 10px; align-items: start; }
  .shop-grid { grid-template-columns: repeat(6, 1fr); }
  #shop-info { margin-top: 0; min-height: 0; height: 100%; }
  #shop-view .keys, #shop-view .who-line { grid-column: 1 / -1; }
  #tower-view:not([hidden]) {
    display: grid; gap: 8px 10px; align-items: start;
    grid-template-columns: minmax(220px, 1fr) 1fr 1fr;
    grid-template-areas: "head p0 p1" "target p0 p1" "sell p0 p1";
  }
  #tower-view .tv-head { grid-area: head; margin-bottom: 0; }
  #tower-view .targeting { grid-area: target; margin-bottom: 0; }
  #tower-view .path-card[data-path="0"] { grid-area: p0; margin: 0; }
  #tower-view .path-card[data-path="1"] { grid-area: p1; margin: 0; }
  #tower-view .sell-btn { grid-area: sell; margin: 0; }
}

@media (max-width: 900px) { .info { min-height: 0; } #sidebar h2 { margin-bottom: 6px; } }

/* =====================================================================
   8-BIT LOOK - pixel fonts, square corners and hard stepped edges, like an old arcade game.
   (Everything above still sets the layout; this only changes how things look.)
   ===================================================================== */
@font-face { font-family: "Press Start 2P"; src: url(../fonts/press-start-2p.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "VT323"; src: url(../fonts/vt323.woff2) format("woff2"); font-display: block; }
:root {
  --display: "Press Start 2P", monospace;
  --body: "VT323", monospace;
  --px-edge: #0a1c33;
}
body {
  font-weight: 400; -webkit-font-smoothing: none; font-size: 20px;
  background: #2b86d9;
  background-image: linear-gradient(45deg, rgba(255,255,255,.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.06) 75%),
                    linear-gradient(45deg, rgba(255,255,255,.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.06) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
*, *::before, *::after { border-radius: 0 !important; }
b, strong, h1, h2, h3, h4 { font-weight: 400; }

/* the hard stepped edge used on every box */
.stat, .hud-btn, #stage, #sidebar, .shop-card, .info, .path-card, .panel, .diff-btn, .big-btn, .board-btn, .tab, kbd,
.target-btn, .up-btn, .sell-btn, .x-btn, .who-line.hud-who {
  border: 0 !important;
  box-shadow: 0 -3px 0 var(--px-edge), 0 3px 0 var(--px-edge), -3px 0 0 var(--px-edge), 3px 0 0 var(--px-edge), 4px 6px 0 rgba(0,0,0,.35) !important;
}
.hud-btn:active:not(:disabled), .big-btn:active, .diff-btn:active, .up-btn:active:not(:disabled) { transform: translate(2px, 3px) !important; }
.shop-card.active, .diff-btn:hover, .tab.on, .target-btn.on {
  box-shadow: 0 -3px 0 #ffcf3a, 0 3px 0 #ffcf3a, -3px 0 0 #ffcf3a, 3px 0 0 #ffcf3a, 4px 6px 0 rgba(0,0,0,.35) !important;
}

/* pixel text sizes: the arcade font is wide, so headings and numbers get a little smaller */
.stat { font-family: var(--display); font-size: 15px; }
.stat.wave .lbl { font-size: 10px; }
.stat.wave small { font-size: 10px; }
.hud-btn { font-family: var(--display); font-size: 11px; }
.hud-btn.play span { font-size: 12px; }
#sidebar h2, .panel h2 { font-family: var(--display); font-size: 16px; line-height: 1.4; }
.shop-card .name { font-family: var(--body); font-size: 19px; line-height: 1; }
.shop-card .price { font-family: var(--display); font-size: 11px; }
.shop-card .hk { font-family: var(--display); font-size: 9px; }
.info, .info p, .keys, .next-desc, .summary, .tagline, .fine, .online-note, .d-meta, .d-best, .tv-title p { font-family: var(--body); font-size: 19px; line-height: 1.15; }
.info h4, .next-name, .tv-title h3, .d-name, .d-map { font-family: var(--display); font-size: 11px; line-height: 1.5; }
.d-name { font-size: 14px; }
.big-btn, .up-btn, .sell-btn, .board-btn, .tab, .target-btn { font-family: var(--display); font-size: 11px; }
.big-btn { font-size: 13px; }
kbd { font-family: var(--display); font-size: 9px; }
.who-line { font-family: var(--body); font-size: 19px; }
.who-line .code, .who-line.hud-who .code { font-family: var(--display); font-size: 13px; }
.who-line.hud-who { font-family: var(--display); font-size: 10px; }
#banner .b-title { font-family: var(--display); }
#banner .b-sub { font-family: var(--body); font-size: 22px; }
ol.top { font-family: var(--display); font-size: 11px; line-height: 1.9; }
.title-logo, .hud-logo { image-rendering: pixelated; }
.title-panel { box-shadow: none !important; }
.title-logo { border: 0 !important; box-shadow: 0 -4px 0 var(--px-edge), 0 4px 0 var(--px-edge), -4px 0 0 var(--px-edge), 4px 0 0 var(--px-edge), 6px 8px 0 rgba(0,0,0,.35) !important; }
.overlay { backdrop-filter: none; background: rgba(10, 30, 60, 0.6); }
