/* ========================================================
   POP CITADEL // STYLES
   Dark navy command console with neon trim.
   ======================================================== */

:root {
  --pc-bg: #050a14;
  --pc-panel: #0a1322;
  --pc-panel-2: #0e1a2e;
  --pc-panel-3: #13223b;
  --pc-line: rgba(80, 200, 255, 0.14);
  --pc-line-strong: rgba(80, 200, 255, 0.42);

  --pc-cyan: #38e1ff;
  --pc-blue: #3b82f6;
  --pc-violet: #a78bfa;
  --pc-gold: #fcd34d;
  --pc-red: #fb7185;
  --pc-lime: #a3e635;

  --pc-text: #e6f1ff;
  --pc-muted: #8ea3c2;
  --pc-dim: #5a6e8e;

  --pc-display: var(--font-display, 'Fredoka', system-ui, sans-serif);
  --pc-body: var(--font-body, 'Manrope', system-ui, sans-serif);
  --pc-mono: var(--font-mono, 'JetBrains Mono', Consolas, monospace);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
  color: var(--pc-text);
  font-family: var(--pc-body);
  display: flex;
  flex-direction: column;
  user-select: none;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(56, 225, 255, 0.08), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(167, 139, 250, 0.08), transparent 60%),
    linear-gradient(rgba(80, 200, 255, 0.025) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(80, 200, 255, 0.025) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--pc-bg);
}

button, select, input { font-family: inherit; }

/* ---------------------------------------------------- TOP BAR */
.pc-header {
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: linear-gradient(180deg, rgba(14, 26, 46, 0.95), rgba(8, 15, 28, 0.95));
  border-bottom: 1px solid var(--pc-line);
  box-shadow: 0 1px 0 rgba(56, 225, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.pc-brand-group { display: flex; align-items: center; gap: 14px; }
.pc-brand { display: flex; align-items: center; gap: 10px; }

.pc-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 34% 30%, #ffffff 0 8%, rgba(56, 225, 255, 0.9) 22%, rgba(59, 130, 246, 0.55) 62%, rgba(167, 139, 250, 0.85) 100%);
  box-shadow: 0 0 14px rgba(56, 225, 255, 0.45), inset 0 0 6px rgba(255, 255, 255, 0.4);
}
.pc-brand-mark::after {
  content: '';
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(56, 225, 255, 0.5);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.pc-title {
  font-family: var(--pc-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #fff;
}
.pc-subtitle {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pc-cyan);
  opacity: 0.8;
  margin-top: 3px;
}

/* Stat chips */
.pc-stats { display: flex; align-items: center; gap: 8px; }

.pc-stat {
  --c: var(--pc-cyan);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 86px;
  padding: 5px 12px 5px 14px;
  background: linear-gradient(180deg, var(--pc-panel-2), var(--pc-panel));
  border: 1px solid var(--pc-line);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.pc-stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c);
  box-shadow: 0 0 10px var(--c);
}
.pc-stat-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pc-muted);
}
.pc-stat-value {
  font-family: var(--pc-mono);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--c);
  white-space: nowrap;
}
.pc-stat.stat-cash  { --c: var(--pc-gold); }
.pc-stat.stat-lives { --c: var(--pc-red); }
.pc-stat.stat-round { --c: var(--pc-cyan); }
.pc-stat.stat-cores { --c: var(--pc-violet); }
.pc-stat.flash { animation: statFlash 0.5s ease; }
@keyframes statFlash { 0% { background: rgba(251, 113, 133, 0.35); } 100% { background: var(--pc-panel); } }

/* Controls */
.pc-header-actions { display: flex; align-items: center; gap: 8px; }

.pc-select {
  background: var(--pc-panel-2);
  border: 1px solid var(--pc-line);
  color: var(--pc-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 9px;
  outline: none;
  cursor: pointer;
}
.pc-select:focus-visible { border-color: var(--pc-line-strong); }

.speed-control-group {
  display: flex;
  padding: 3px;
  gap: 2px;
  background: var(--pc-panel);
  border: 1px solid var(--pc-line);
  border-radius: 9px;
}
.btn-speed-toggle {
  background: transparent;
  border: none;
  color: var(--pc-muted);
  font-family: var(--pc-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-speed-toggle:hover { color: #fff; }
.btn-speed-toggle.active {
  background: linear-gradient(180deg, #22c3e6, #1683b8);
  color: #04111f;
  box-shadow: 0 0 10px rgba(56, 225, 255, 0.35);
}

.auto-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--pc-muted);
  cursor: pointer;
  padding: 0 4px;
}
.auto-toggle-wrap input { position: absolute; opacity: 0; pointer-events: none; }
.auto-switch {
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: var(--pc-panel-3);
  border: 1px solid var(--pc-line);
  position: relative;
  transition: background 0.2s ease;
}
.auto-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pc-muted);
  transition: transform 0.2s ease, background 0.2s ease;
}
.auto-toggle-wrap input:checked + .auto-switch { background: rgba(56, 225, 255, 0.25); border-color: var(--pc-line-strong); }
.auto-toggle-wrap input:checked + .auto-switch::after { transform: translateX(13px); background: var(--pc-cyan); box-shadow: 0 0 8px var(--pc-cyan); }
.auto-toggle-wrap input:focus-visible + .auto-switch { outline: 2px solid var(--pc-cyan); outline-offset: 2px; }

.btn-icon-head {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pc-panel-2);
  border: 1px solid var(--pc-line);
  border-radius: 9px;
  color: var(--pc-text);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-icon-head:hover { border-color: var(--pc-line-strong); background: var(--pc-panel-3); }

.btn-lab-open {
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  color: #fff;
  border: none;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-lab-open:hover { transform: translateY(-1px); box-shadow: 0 0 22px rgba(56, 225, 255, 0.45); }

/* ---------------------------------------------------- LAYOUT */
.pc-main-stage {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: 1fr clamp(340px, 24vw, 420px);
  gap: 14px;
  padding: 12px 16px 14px;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  overflow: hidden;
}

.playfield-column {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.canvas-frame {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(180deg, rgba(14, 26, 46, 0.6), rgba(6, 12, 22, 0.8));
  border: 1px solid var(--pc-line);
  border-radius: 16px;
  overflow: hidden;
}

.frame-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--pc-cyan);
  opacity: 0.7;
  pointer-events: none;
}
.frame-corner.tl { top: 6px; left: 6px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.frame-corner.tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.frame-corner.bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.frame-corner.br { bottom: 6px; right: 6px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

#game-canvas {
  width: min(100%, calc((100vh - 152px) * (960 / 600)));
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 152px);
  aspect-ratio: 960 / 600;
  display: block;
  cursor: crosshair;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(56, 225, 255, 0.18), 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Wave bar */
.round-control-bar {
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 8px;
  background: var(--pc-panel);
  border: 1px solid var(--pc-line);
  border-radius: 12px;
}

.btn-start-wave {
  height: 100%;
  padding: 0 22px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(180deg, #34e3ff, #0ea5e9);
  color: #04111f;
  font-family: var(--pc-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(56, 225, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-start-wave:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 26px rgba(56, 225, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-start-wave:active:not(:disabled) { transform: translateY(1px); }
.btn-start-wave:disabled {
  background: var(--pc-panel-3);
  color: var(--pc-muted);
  box-shadow: none;
  cursor: default;
}

.round-hint-text {
  font-size: 0.74rem;
  color: var(--pc-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.round-hint-text kbd {
  font-family: var(--pc-mono);
  font-size: 0.68rem;
  color: var(--pc-muted);
  background: var(--pc-panel-3);
  border: 1px solid var(--pc-line);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------------------------------------------------- SIDEBAR */
.sidebar-column {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.sidebar-box {
  background: linear-gradient(180deg, rgba(14, 26, 46, 0.9), rgba(8, 15, 28, 0.92));
  border: 1px solid var(--pc-line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-box.shelf-box { flex: 0 1 auto; max-height: 52%; }
.sidebar-box.upgrade-box { flex: 1 1 auto; overflow-y: auto; }

.sidebar-box-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--pc-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--pc-line);
}
.title-count {
  font-family: var(--pc-body);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pc-dim);
}

/* Tower shelf */
.tower-shelf-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  overflow-y: auto;
  padding-right: 3px;
}
.tower-shelf-grid::-webkit-scrollbar,
.sidebar-box::-webkit-scrollbar { width: 5px; }
.tower-shelf-grid::-webkit-scrollbar-thumb,
.sidebar-box::-webkit-scrollbar-thumb { background: var(--pc-panel-3); border-radius: 4px; }

.tower-shelf-card {
  --accent: var(--pc-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 5px;
  background: var(--pc-panel);
  border: 1px solid var(--pc-line);
  border-radius: 10px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.tower-shelf-card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.55;
}
.tower-shelf-card:hover { border-color: var(--accent); background: var(--pc-panel-2); transform: translateY(-1px); }
.tower-shelf-card.placing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent); }
.tower-shelf-card.unaffordable { opacity: 0.5; }
.tower-shelf-card.unaffordable .shelf-card-cost { color: var(--pc-red); }

.shelf-art {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  position: relative;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
}
.shelf-art img {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  object-fit: contain;
  transition: transform 0.25s ease;
}
.tower-shelf-card:hover .shelf-art img.head { transform: rotate(-20deg); }

.shelf-card-meta { display: flex; flex-direction: column; min-width: 0; }
.shelf-card-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--pc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shelf-card-cost {
  font-family: var(--pc-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--pc-gold);
}

/* Selected tower panel */
.tower-panel-empty {
  text-align: center;
  color: var(--pc-dim);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 26px 12px;
  border: 1px dashed var(--pc-line);
  border-radius: 10px;
}

.tower-inspect-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.tower-inspect-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tower-inspect-title .shelf-art { width: 48px; height: 48px; }
.tower-inspect-name { font-family: var(--pc-display); font-size: 1rem; font-weight: 700; color: #fff; }
.tower-inspect-sub { font-size: 0.72rem; color: var(--pc-muted); font-family: var(--pc-mono); }

.targeting-selector { display: flex; flex-direction: column; gap: 3px; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pc-dim); }
.targeting-selector select {
  background: var(--pc-panel-2);
  border: 1px solid var(--pc-line);
  color: var(--pc-text);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 7px;
  outline: none;
}

.tower-stat-row { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tower-stat {
  flex: 1;
  min-width: 58px;
  padding: 5px 8px;
  background: var(--pc-panel);
  border: 1px solid var(--pc-line);
  border-radius: 8px;
}
.tower-stat span { display: block; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pc-dim); }
.tower-stat b { font-family: var(--pc-mono); font-size: 0.82rem; color: var(--pc-text); }

.upgrades-dual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.upgrade-path-col { display: flex; flex-direction: column; gap: 6px; }

.path-title { display: flex; align-items: center; justify-content: space-between; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pc-muted); }
.path-pips { display: flex; gap: 3px; }
.path-pips i { width: 9px; height: 4px; border-radius: 2px; background: var(--pc-panel-3); }
.path-pips i.on { background: var(--pc-cyan); box-shadow: 0 0 6px var(--pc-cyan); }

.upgrade-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px;
  background: var(--pc-panel);
  border: 1px solid var(--pc-line);
  border-radius: 10px;
}
.upgrade-card.locked { opacity: 0.5; }
.upgrade-card.maxed { align-items: center; justify-content: center; color: var(--pc-cyan); font-size: 0.75rem; letter-spacing: 0.08em; min-height: 90px; }

.up-card-header { display: flex; justify-content: space-between; gap: 6px; font-size: 0.8rem; line-height: 1.25; color: #fff; }
.up-cost { font-family: var(--pc-mono); font-size: 0.74rem; font-weight: 700; color: var(--pc-gold); white-space: nowrap; }
.up-desc { flex: 1; font-size: 0.72rem; line-height: 1.4; color: var(--pc-muted); }

.btn-upgrade-buy {
  border: 1px solid var(--pc-line);
  background: var(--pc-panel-3);
  color: var(--pc-dim);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 6px;
  border-radius: 7px;
  cursor: not-allowed;
}
.btn-upgrade-buy.affordable {
  background: linear-gradient(180deg, #34e3ff, #0ea5e9);
  border-color: transparent;
  color: #04111f;
  cursor: pointer;
}
.btn-upgrade-buy.affordable:hover { filter: brightness(1.1); box-shadow: 0 0 12px rgba(56, 225, 255, 0.4); }

.ability-card { margin-top: 10px; }
.btn-ability-trigger {
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #f59e0b, #f43f5e);
  color: #fff;
  font-family: var(--pc-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.35);
}
.btn-ability-trigger:disabled { background: var(--pc-panel-3); color: var(--pc-muted); box-shadow: none; cursor: default; }

.tower-bottom-actions { margin-top: 10px; display: flex; }
.btn-tower-sell {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(251, 113, 133, 0.35);
  border-radius: 9px;
  color: var(--pc-red);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-tower-sell:hover { background: rgba(251, 113, 133, 0.12); }

/* ---------------------------------------------------- TECH LAB */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 14, 0.72);
  backdrop-filter: blur(6px);
}
.modal-overlay.hidden { display: none; }

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px;
  background: linear-gradient(180deg, var(--pc-panel-2), var(--pc-panel));
  border: 1px solid var(--pc-line-strong);
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(56, 225, 255, 0.12), 0 24px 60px rgba(0, 0, 0, 0.6);
}
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-title { font-family: var(--pc-display); font-size: 1.35rem; font-weight: 700; color: #fff; }
.modal-sub { font-size: 0.8rem; color: var(--pc-muted); margin-top: 3px; }
.modal-head-right { display: flex; align-items: center; gap: 12px; }
.lab-token-count { font-family: var(--pc-mono); font-weight: 700; color: var(--pc-violet); font-size: 1.05rem; }
.btn-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--pc-panel-3);
  border: 1px solid var(--pc-line);
  color: var(--pc-text);
  cursor: pointer;
}
.btn-modal-close:hover { border-color: var(--pc-line-strong); }

.lab-upgrades-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lab-upgrade-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--pc-panel);
  border: 1px solid var(--pc-line);
  border-radius: 12px;
}
.lab-upgrade-card.maxed { border-color: rgba(167, 139, 250, 0.45); }
.lab-card-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: var(--pc-panel-3);
  border-radius: 10px;
}
.lab-card-info { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.lab-card-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.lab-card-name { font-weight: 800; font-size: 0.86rem; color: #fff; }
.lab-card-lvl { font-family: var(--pc-mono); font-size: 0.7rem; color: var(--pc-muted); }
.lab-card-desc { font-size: 0.74rem; line-height: 1.4; color: var(--pc-muted); flex: 1; }
.lab-pips { display: flex; gap: 3px; }
.lab-pips i { flex: 1; height: 4px; border-radius: 2px; background: var(--pc-panel-3); }
.lab-pips i.on { background: var(--pc-violet); box-shadow: 0 0 6px var(--pc-violet); }

.btn-lab-buy {
  padding: 6px;
  border-radius: 7px;
  border: 1px solid var(--pc-line);
  background: var(--pc-panel-3);
  color: var(--pc-dim);
  font-size: 0.74rem;
  font-weight: 800;
  cursor: not-allowed;
}
.btn-lab-buy.affordable { background: linear-gradient(135deg, #7c3aed, #0ea5e9); border-color: transparent; color: #fff; cursor: pointer; }
.btn-lab-buy.affordable:hover { filter: brightness(1.1); }
.btn-lab-buy:disabled { cursor: default; }

/* ---------------------------------------------------- TOASTS */
#pc-toast-container {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.pc-toast {
  padding: 8px 16px;
  background: rgba(10, 19, 34, 0.95);
  border: 1px solid var(--pc-line-strong);
  border-radius: 999px;
  color: var(--pc-text);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: toastFadeIn 0.2s ease;
}
.pc-toast.toast-success { border-color: rgba(163, 230, 53, 0.55); }
.pc-toast.toast-warn { border-color: rgba(251, 113, 133, 0.6); color: #ffd1d9; }
.pc-toast.toast-exit { animation: toastFadeOut 0.25s ease forwards; }
@keyframes toastFadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toastFadeOut { to { opacity: 0; transform: translateY(-6px); } }

/* ---------------------------------------------------- SMALL SCREENS */
@media (max-width: 1280px) {
  .pc-stat { min-width: 0; padding: 4px 10px 4px 12px; }
  .pc-subtitle { display: none; }
  .pc-select { max-width: 150px; }
  .pc-header { gap: 10px; padding: 0 12px; }
}

/* ---------- Co-op ---------- */
.coop-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-shrink: 1;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--pc-muted);
  background: var(--pc-panel-2);
  border: 1px solid var(--pc-line);
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
}
.coop-bar[hidden] { display: none; }
.coop-bar b {
  font-family: var(--pc-display);
  font-weight: 600;
  color: var(--pc-text);
  letter-spacing: 0.02em;
}
.coop-bar span { overflow: hidden; text-overflow: ellipsis; }
.coop-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--pc-dim);
}
.coop-bar[data-state='on'] .coop-dot { background: var(--pc-lime); box-shadow: 0 0 8px var(--pc-lime); }
.coop-bar[data-state='wait'] .coop-dot { background: var(--pc-gold); animation: coop-blink 1.2s ease-in-out infinite; }
.coop-bar[data-state='away'] .coop-dot { background: var(--pc-red); }
.coop-bar[data-state='watch'] .coop-dot { background: var(--pc-violet); }
.coop-you { color: var(--pc-cyan); font-weight: 700; }
.coop-plus { color: var(--pc-dim); }
.coop-them { color: #fb923c; font-weight: 700; }
.coop-cash { font-family: var(--pc-mono); color: var(--pc-gold); }
.coop-note { color: var(--pc-red); }
@keyframes coop-blink { 50% { opacity: 0.35; } }

.coop-owner-note {
  margin: 4px 0 10px;
  padding: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--pc-muted);
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.35);
  border-radius: 10px;
}
.coop-owner-note b { color: #fb923c; }

.pc-select:disabled { opacity: 0.55; cursor: not-allowed; }

@media (max-width: 1100px) {
  .pc-brand > div, .round-hint-text { display: none; }
  .pc-stats { gap: 6px; }
  .pc-header-actions { gap: 6px; }
}

@media (max-width: 900px) {
  html, body { height: auto; max-height: none; overflow-y: auto; }
  .pc-header { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .pc-stats { order: 3; width: 100%; }
  .pc-stat { flex: 1; }
  .pc-main-stage { height: auto; grid-template-columns: 1fr; padding: 10px; overflow: visible; }
  .playfield-column, .sidebar-column { height: auto; overflow: visible; }
  .canvas-frame { padding: 6px; }
  #game-canvas { width: 100%; max-height: none; }
  .sidebar-box.shelf-box { max-height: none; }
  .tower-shelf-grid { grid-template-columns: repeat(3, 1fr); max-height: 300px; }
}

@media (max-width: 600px) {
  .pc-header-actions { flex-wrap: wrap; }
  .tower-shelf-grid { grid-template-columns: repeat(2, 1fr); }
  .lab-upgrades-grid, .upgrades-dual-grid { grid-template-columns: 1fr; }
}
