:root {
  --bg: #0f1115;
  --fg: #e6edf3;
  --dim: #9aa4b2;
  --accent: #7ee787;
  --danger: #ff6b6b;
  --gold: #ffd166;
  --font-ui: 'Press Start 2P', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
   --font-body: 'Anonymous Pro', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* розміри для біолаби */
  --lab-font: 14px;
  --lab-font-small: 14px;
}

/* Retro fonts */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

/* Base */
html,
body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #0d1117 0%, #010409 100%);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


#wrap {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* HUD */
#hud {
  position: absolute;
  left: 8px;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

/* легенький трекінг, щоб нагадувало аркадні меню */
.panel, #hud { letter-spacing: 0.02em; }

.pill {
  background: #0b1220;
  border: 1px solid #27324a;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

#hud .pill,
#timer,
#stage,
#bio,
#dps,
#lvl,
#exp,
#orgs .tag {
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

@keyframes hud-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes hud-flash {
  0% { box-shadow: 0 0 0 rgba(34,197,94,0.0); }
  100% { box-shadow: 0 0 18px rgba(34,197,94,0.35); }
}

/* HP */
.hpbar {
  position: relative;
  width: 240px;
  height: 14px;
  border: 1px solid #2b344d;
  border-radius: 8px;
  overflow: hidden;
  background: #0b1220;
}

.hpfill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #2dd4bf, #22c55e);
}

/* Org tags */
#orgs {
  gap: 6px;
  flex-wrap: wrap;
  display: flex;
  max-width: 50vw;
}

#orgs .tag {
  border: 1px solid #2f3f66;
  border-radius: 6px;
  padding: 3px 6px;
  background: #0e1526;
  color: var(--dim);
  letter-spacing: .5px;
}

/* Timer alignment */
#timer {
  margin-left: auto;
}

/* Canvas */
#canvas {
  z-index: 0;
  flex: 0 0 auto;
  display: block; 
  background:
    /* вузли на великих перетинах */
    radial-gradient(circle, rgba(80,200,255,.12) 2px, transparent 2px),
    /* основна 40px сітка */
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(26,30,40,.35) 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(26,30,40,.35) 40px),
    /* великі 160px акценти */
    repeating-linear-gradient(0deg, transparent 0 159px, rgba(80,200,255,.08) 160px),
    repeating-linear-gradient(90deg, transparent 0 159px, rgba(80,200,255,.08) 160px),
    #0b0c10;
  background-size: 160px 160px, auto, auto, auto, auto, auto;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  image-rendering: pixelated;
  border: 2px solid #1e293b;
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(80,200,255,.15) inset, 0 0 24px rgba(0,0,0,.6);
}

#hud {
  font-size: 12px;
}

#hud .pill {
  transition: transform .2s ease, box-shadow .2s ease;
}

#hud .pill.hud-pulse {
  animation: hud-pulse .35s ease-out;
}

#hud .pill.hud-flash {
  animation: hud-flash .4s ease-out;
}

/* ===== START MENU: Aurora Grid (CSS-only) ===== */
#overlay.menu,
.overlay--menu {
  /* більш собі́дний, темний фон */
  background:
    radial-gradient(1200px 800px at 20% 15%, rgba(18,32,55,.55), transparent 55%),
    radial-gradient(900px 700px at 80% 70%, rgba(10,20,40,.45), transparent 60%),
    linear-gradient(180deg, #0b0f18 0%, #0a0f1d 50%, #0a0e17 100%);
  image-rendering: pixelated;
  overflow: hidden;
}

/* Дуже м’яка фактура */
#overlay.menu::after,
.overlay--menu::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.01) 0 2px, rgba(0,0,0,.01) 2px 4px),
    radial-gradient(circle, rgba(80,200,255,.06) 1px, transparent 2px);
  background-size: 4px 4px, 160px 160px;
  opacity: .35;
}

/* легка віньєтка */
#overlay.menu::before,
.overlay--menu::before {
  content: "";
  position: absolute;
  inset: -5%;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 35%, rgba(0,0,0,.6) 100%);
  opacity: .9;
}

/* Анімація: дуже повільне обертання аури */
@keyframes menu-aurora-spin {
  to {
    transform: rotate(1turn);
  }
}

/* Ввічливість до користувачів: якщо анімації вимкнені — робимо статично */
@media (prefers-reduced-motion: reduce) {
  #overlay.menu::after,
  .overlay--menu::after {
    animation: none;
    opacity: .5;
  }
}

/* Якщо десь ще лишилися зображення — глушимо їх для меню */
#overlay.menu {
  background-image: none !important;
}

/* Overlay / Panels */
#overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.45);
  z-index: 50;
}

#overlay.show {
  display: flex;
}

/* Трохи інший фон для біолаби */
#overlay.lab {
  backdrop-filter: blur(4px);
  background: radial-gradient(circle at 20% 0, rgba(34,197,94,0.18), transparent 55%),
              radial-gradient(circle at 80% 100%, rgba(56,189,248,0.12), transparent 55%),
              rgba(3,7,18,0.82);
}

.panel {
  background: #0c1426;
  border: 1px solid #22314f;
  border-radius: 12px;
  min-width: 320px;
  max-width: 92vw;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Grid / cards */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.card {
  border: 1px solid #2a3c63;
  border-radius: 10px;
  padding: 10px;
  background: #0d162c;
  cursor: pointer;
  transition: outline-color .15s ease, transform .05s ease;
  font-family: var(--font-body);
}

.card:hover {
  outline: 2px solid #4ade80;
  transform: translateY(-1px);
}

.mutTitle {
  color: var(--accent);
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.small {
  color: var(--dim);
  font-size: 14px;
}

/* Rows & buttons */
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  background: #1f2937;
  border: 1px solid #374151;
  color: #e5e7eb;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.btn.primary {
  background: #16a34a;
  border-color: #166534;
}

.btn:active {
  transform: translateY(1px);
}

.btn-mini {
  padding: 6px 10px;
  font-size: 12px;
}

/* Footer */
#footer {
  position: absolute;
  left: 8px;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type=range] {
  width: 180px;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
}

select {
  background: #0d162c;
  color: #fff;
  border: 1px solid #2a3c63;
  border-radius: 6px;
  padding: 6px;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.panel.wide {
  max-width: 860px;
}

.panel.menu-panel {
  max-width: 680px;
}

.panel.intro {
  background: rgba(7, 12, 20, 0.72);
  border: 1px solid #2a3550;
  padding: 18px 26px;
  min-width: 280px;
  max-width: 70vw;
  text-align: center;
}

.intro-title {
  font-family: var(--font-ui);
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #e2e8f0;
}

.card.selected {
  outline: 2px solid var(--accent);
}

#overlay {
  z-index: 50;
}

#hud {
  z-index: 10;
}

#canvas {
  z-index: 0;
}

/* Effects footer */
#effects {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

#effects .effect {
  border: 1px solid #2f3f66;
  border-radius: 6px;
  padding: 3px 6px;
  background: #0e1526;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ===== Biolab 2-column layout & stats box ===== */
.lab-2col {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 12px;
}

.panel.lab-panel {
  width: 92vw;
  max-width: 1400px;
  max-height: 92vh;
  background: linear-gradient(180deg, rgba(14,22,44,0.98), rgba(6,10,20,0.98));
  border: 1px solid #2a3c63;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6), inset 0 0 24px rgba(34,197,94,0.08);
  overflow: visible;
}

.panel.organ-panel {
  width: 72vw;
  max-width: 1100px;
  max-height: 88vh;
  background: linear-gradient(180deg, rgba(14,22,44,0.98), rgba(6,10,20,0.98));
  border: 1px solid #2a3c63;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6), inset 0 0 24px rgba(34,197,94,0.08);
}

.panel.compact {
  max-width: 520px;
  padding: 12px 14px;
}

.lab-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(42,60,99,0.6);
  margin-bottom: 10px;
}

.lab-title-main {
  font-family: var(--font-ui);
  letter-spacing: .6px;
  text-transform: uppercase;
  font-size: 16px;
  color: #e2e8f0;
}

.lab-subhead {
  font-size: 14px;
  color: #9aa4b2;
}

.lab-bio {
  padding: 6px 10px;
  border: 1px solid #2a3c63;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(250,204,21,0.12), rgba(13,22,44,0.85));
  color: #facc15;
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: .5px;
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 14px;
}

.lab-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lab-block {
  padding: 10px;
  border: 1px solid #2a3c63;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(12,18,34,0.96), rgba(8,12,22,0.96));
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.06);
}

.lab-block-title {
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
  font-size: 14px;
  color: #8bff9a;
  margin-bottom: 6px;
}

.lab-subtitle {
  font-size: 14px;
  color: #9aa4b2;
  margin: 6px 0;
}

.lab-stats {
  font-size: 14px;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lab-stats-title {
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #8bff9a;
  margin-bottom: 6px;
}

.lab-stats-title.plain {
  font-family: var(--font-body);
  letter-spacing: .2px;
  text-transform: none;
  color: #e2e8f0;
}

.lab-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.lab-stats-row b {
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.lab-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lab-stats-row .stat-val {
  color: #86efac;
  font-variant-numeric: tabular-nums;
}

.lab-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

.lab-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: stretch;
}

.lab-left {
  min-width: 0;
}

.lab-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lab-title {
  font-size: 14px;
  margin: 10px 0 6px;
  padding-left: 6px;
  position: relative;
}

.lab-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 14px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #22c55e, #86efac);
  border-radius: 2px;
}

.lab-organs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lab-upg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.lab-card {
  padding: 12px;
  border: 1px solid #2a3c63;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(15,23,42,0.96), rgba(9,13,24,0.96));
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
}

.lab-upg-card {
  padding: 10px;
  border: 1px solid #2a3c63;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(17,24,39,0.96), rgba(10,15,28,0.96));
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.lab-upg-card .mutTitle {
  font-size: 14px;
}

.lab-upg-card .small {
  font-size: 14px;
  line-height: 1.3;
}

.lab-right .tag {
  font-size: 14px;
}

.inv-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inv-title {
  font-size: 12px;
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #8bff9a;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.inv-grid.inv-weapons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.inv-grid.inv-arts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inv-grid.inv-compact {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.inv-slot {
  border: 1px solid #2a3c63;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(14,22,38,0.98), rgba(9,13,22,0.98));
  padding: 8px;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  font-size: 14px;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.inv-slot.icon-slot {
  min-height: 52px;
  padding: 6px 4px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.inv-slot.icon-slot .glyph {
  margin: 0 auto;
}

.lab-tooltip.card-tip {
  padding: 12px 14px;
  width: var(--card-width, 320px);
  max-width: var(--card-width, 320px);
  left: 50%;
  right: auto;
  transform: translate(-50%, 110%);
}

.lab-tooltip.card-tip .item-card {
  gap: 8px;
}

.inv-slot.drag-over {
  outline: 2px dashed #86efac;
  box-shadow: 0 0 0 2px rgba(134,239,172,0.35);
}

.inv-slot.empty {
  color: #6b7280;
  font-size: 14px;
  text-align: center;
  background: linear-gradient(180deg, rgba(10,15,26,0.9), rgba(7,10,18,0.9));
}

.inv-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  justify-content: center;
}

.inv-actions .btn {
  padding: 4px 8px;
  font-size: 12px;
  border-color: #2f3f66;
  background: rgba(30,41,59,0.9);
}

.item-slot.weapon {
  background: linear-gradient(180deg, rgba(30,41,59,0.85), rgba(12,18,34,0.92));
}

.item-slot.artifact {
  background: linear-gradient(180deg, rgba(30,41,59,0.85), rgba(12,18,34,0.92));
}

.inv-slot.active-slot.weapon {
  background: linear-gradient(180deg, rgba(34,197,94,0.22), rgba(12,18,34,0.95));
  box-shadow: inset 0 0 0 1px rgba(34,197,94,0.18);
}

.inv-slot.active-slot.weapon.synergy-on {
  box-shadow: inset 0 0 0 1px rgba(34,197,94,0.25), 0 0 0 2px rgba(34,197,94,0.8), 0 0 16px rgba(34,197,94,0.35);
  border-color: rgba(34,197,94,0.9);
}

.inv-slot.active-slot.artifact {
  background: linear-gradient(180deg, rgba(250,204,21,0.22), rgba(12,18,34,0.95));
  box-shadow: inset 0 0 0 1px rgba(250,204,21,0.18);
}

.has-tooltip {
  position: relative;
}

.lab-tooltip {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -6px;
  transform: translateY(100%);
  background: rgba(12,20,38,0.98);
  border: 1px solid #2a3c63;
  border-radius: 8px;
  padding: 8px 10px;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 10px 18px rgba(0,0,0,0.35);
  display: block;
}

.has-tooltip:hover .lab-tooltip {
  opacity: 1;
  transform: translateY(calc(100% - 6px));
}

.has-tooltip:hover .lab-tooltip.card-tip {
  transform: translate(-50%, 100%);
}

.item-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
}

.item-card--stack {
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.item-card--stack .glyph {
  margin: 0 auto 2px;
}

.item-name {
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #e2e8f0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.item-desc {
  font-size: 14px;
  color: #facc15;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-params {
  font-size: 14px;
  color: #fca5a5;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.item-synergy {
  margin-top: 6px;
  font-size: 14px;
  color: #86efac;
  line-height: 1.3;
}

.lab-upg-title {
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
  font-size: 14px;
  color: #e2e8f0;
}

.glyph {
  width: 32px;
  height: 32px;
  position: relative;
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 25%, rgba(148,163,184,0.25), rgba(8,12,20,0.6) 55%),
    linear-gradient(180deg, rgba(15,23,42,0.9), rgba(8,12,20,0.95));
  border: 1px solid rgba(148,163,184,0.45);
  box-shadow:
    inset 0 0 12px rgba(59,130,246,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 4px 10px rgba(0,0,0,0.35);
  overflow: hidden;
}

.glyph::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 6px;
  box-shadow: inset 0 0 10px rgba(255,255,255,0.05);
}

.glyph::before,
.glyph::after {
  content: "";
  position: absolute;
}

.glyph-spit::before {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #93c5fd, #3b82f6);
  top: 9px; left: 9px;
  box-shadow: 0 0 6px rgba(59,130,246,0.55);
}
.glyph-spit::after {
  width: 6px; height: 6px; border-radius: 50%;
  background: #bfdbfe; top: 4px; right: 5px;
  box-shadow: 0 0 4px rgba(191,219,254,0.7);
}
.glyph-pierce::before {
  width: 20px; height: 3px; background: linear-gradient(90deg, #e2e8f0, #94a3b8);
  top: 14px; left: 6px; transform: rotate(-8deg);
  box-shadow: 0 0 6px rgba(148,163,184,0.5);
}
.glyph-pierce::after {
  width: 6px; height: 6px; border-radius: 2px;
  background: #f1f5f9; top: 11px; right: 6px;
}
.glyph-bomb::before {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fde68a, #f59e0b);
  top: 9px; left: 9px;
  box-shadow: 0 0 8px rgba(245,158,11,0.6);
}
.glyph-bomb::after {
  width: 8px; height: 3px; border-radius: 3px;
  background: #fbbf24; top: 6px; right: 6px;
}
.glyph-chain::before {
  width: 16px; height: 16px; border: 2px dashed #38bdf8; top: 7px; left: 7px;
  box-shadow: 0 0 6px rgba(56,189,248,0.5);
}
.glyph-chain::after {
  width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid rgba(56,189,248,0.6); bottom: 5px; right: 5px;
}
.glyph-saw::before {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #f43f5e; top: 7px; left: 7px;
  box-shadow: 0 0 6px rgba(244,63,94,0.5);
}
.glyph-saw::after {
  width: 4px; height: 14px; background: #fb7185; top: 7px; left: 14px;
  transform: rotate(45deg);
}
.glyph-frost::before {
  width: 14px; height: 14px; background: #93c5fd; top: 8px; left: 8px;
  transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(147,197,253,0.6);
}
.glyph-flare::before {
  width: 10px; height: 18px; background: linear-gradient(180deg, #fdba74, #fb923c);
  top: 6px; left: 11px; border-radius: 6px;
  box-shadow: 0 0 6px rgba(251,146,60,0.6);
}
.glyph-flare::after {
  width: 6px; height: 6px; border-radius: 50%;
  background: #f97316; bottom: 6px; left: 6px;
}
.glyph-rail::before {
  width: 20px; height: 3px; background: linear-gradient(90deg, #fde68a, #facc15);
  top: 14px; left: 6px;
  box-shadow: 0 0 6px rgba(250,204,21,0.6);
}
.glyph-rail::after {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(250,204,21,0.7); top: 6px; left: 6px;
}
.glyph-drone::before {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #a855f7; top: 8px; left: 8px;
  box-shadow: 0 0 6px rgba(168,85,247,0.6);
}
.glyph-drone::after {
  width: 6px; height: 6px; border-radius: 50%;
  background: #c4b5fd; top: 6px; right: 6px;
}
.glyph-turret::before {
  width: 14px; height: 14px; background: #fcd34d; top: 8px; left: 8px;
  box-shadow: 0 0 6px rgba(252,211,77,0.6);
}
.glyph-turret::after {
  width: 12px; height: 3px; background: #fde68a; bottom: 6px; left: 6px;
}
.glyph-acid::before {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #86efac, #22c55e);
  top: 8px; left: 8px;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
}
.glyph-leech::before {
  width: 12px; height: 18px; border-radius: 8px;
  background: linear-gradient(180deg, #67e8f9, #22d3ee);
  top: 6px; left: 10px;
  box-shadow: 0 0 6px rgba(34,211,238,0.6);
}
.glyph-leech::after {
  width: 6px; height: 6px; border-radius: 50%;
  background: #a5f3fc; bottom: 5px; right: 6px;
}
.glyph-shrapnel::before {
  width: 14px; height: 14px; border: 2px solid #fb7185; top: 8px; left: 8px;
  box-shadow: 0 0 6px rgba(251,113,133,0.6);
}
.glyph-shrapnel::after {
  width: 4px; height: 12px; background: #fecdd3; top: 9px; left: 14px;
  transform: rotate(25deg);
}
.glyph-vortex::before {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #a855f7; top: 8px; left: 8px;
  box-shadow: 0 0 6px rgba(168,85,247,0.6);
}
.glyph-vortex::after {
  width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid rgba(196,181,253,0.7); top: 12px; left: 12px;
}

.glyph-prism::before {
  width: 14px; height: 14px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  transform: rotate(45deg);
  top: 9px; left: 9px;
  box-shadow: 0 0 6px rgba(167,139,250,0.6);
}
.glyph-prism::after {
  width: 6px; height: 6px; border-radius: 50%;
  background: #facc15; bottom: 6px; right: 6px;
}

.glyph-pulse::before {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #22c55e; top: 8px; left: 8px;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
}
.glyph-pulse::after {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(34,197,94,0.6); top: 12px; left: 12px;
}

.glyph-electric::before { width: 18px; height: 3px; background: linear-gradient(90deg, #93c5fd, #60a5fa); top: 14px; left: 7px; box-shadow: 0 0 6px rgba(96,165,250,0.6); }
.glyph-acid::after { width: 7px; height: 7px; background: #16a34a; border-radius: 50%; top: 6px; right: 6px; box-shadow: 0 0 4px rgba(34,197,94,0.6); }
.glyph-blood::before { width: 12px; height: 12px; background: radial-gradient(circle at 30% 30%, #fecaca, #f87171); border-radius: 50%; top: 9px; left: 9px; }
.glyph-frost::after { width: 2px; height: 18px; background: #7dd3fc; top: 6px; left: 15px; }
.glyph-explosive::before { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fed7aa, #fb923c); top: 9px; left: 9px; }
.glyph-survival::before { width: 14px; height: 14px; border: 2px solid #22c55e; top: 9px; left: 9px; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.glyph-hybrid::before { width: 14px; height: 14px; border: 2px solid #a855f7; top: 9px; left: 9px; box-shadow: 0 0 6px rgba(168,85,247,0.5); }
.glyph-utility::before { width: 14px; height: 3px; background: #94a3b8; top: 14px; left: 9px; }
.glyph-control::before { width: 14px; height: 14px; border-radius: 4px; border: 2px solid #60a5fa; top: 9px; left: 9px; }
.glyph-magnet::before { width: 14px; height: 14px; border-radius: 4px; border: 2px solid #0ea5e9; top: 9px; left: 9px; box-shadow: 0 0 6px rgba(14,165,233,0.5); }
.glyph-damage::before { width: 14px; height: 14px; border-radius: 2px; background: #fb923c; top: 9px; left: 9px; box-shadow: 0 0 6px rgba(251,146,60,0.5); }
.glyph-mobility::before { width: 16px; height: 3px; background: #38bdf8; top: 14px; left: 8px; box-shadow: 0 0 6px rgba(56,189,248,0.5); }

.item-slot.arch-agg { border-color: rgba(248,113,113,0.9); }
.item-slot.arch-ctrl { border-color: rgba(59,130,246,0.9); }
.item-slot.arch-para { border-color: rgba(34,197,94,0.9); }
.item-slot.arch-swarm { border-color: rgba(245,158,11,0.9); }

.item-slot.art-electric { box-shadow: 0 0 10px rgba(59,130,246,0.25) inset; }
.item-slot.art-acid { box-shadow: 0 0 10px rgba(34,197,94,0.25) inset; }
.item-slot.art-blood { box-shadow: 0 0 10px rgba(248,113,113,0.25) inset; }
.item-slot.art-frost { box-shadow: 0 0 10px rgba(125,211,252,0.25) inset; }
.item-slot.art-explosive { box-shadow: 0 0 10px rgba(251,146,60,0.25) inset; }
.item-slot.art-survival { box-shadow: 0 0 10px rgba(34,197,94,0.25) inset; }
.item-slot.art-hybrid { box-shadow: 0 0 10px rgba(168,85,247,0.25) inset; }
.item-slot.art-utility { box-shadow: 0 0 10px rgba(148,163,184,0.25) inset; }
.item-slot.art-control { box-shadow: 0 0 10px rgba(59,130,246,0.25) inset; }
.item-slot.art-magnet { box-shadow: 0 0 10px rgba(14,165,233,0.25) inset; }
.item-slot.art-damage { box-shadow: 0 0 10px rgba(251,146,60,0.25) inset; }
.item-slot.art-mobility { box-shadow: 0 0 10px rgba(56,189,248,0.25) inset; }

@media (max-width: 980px) {
  .lab-grid {
    grid-template-columns: 1fr;
  }
  .lab-organs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .lab-organs {
    grid-template-columns: 1fr;
  }
  .lab-upg-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .lab-2col {
    grid-template-columns: 1fr;
  }

  .lab-right {
    order: -1;
  }
}

.lab-sub {
  margin: 8px 0;
  font-size: var(--lab-font);
}

.upgList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title actions" "scale actions";
  gap: 6px 10px;
  padding: 8px;
  border: 1px solid #2a3c63;
  border-radius: 10px;
  background: #0d162c;
  font-size: var(--lab-font);
}

.upg-title {
  grid-area: title;
  font-family: var(--font-ui);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.upg-scale {
  grid-area: scale;
  display: flex;
  gap: 4px;
  align-items: center;
}

.upg-scale .tick {
  width: 16px;
  height: 8px;
  border: 1px solid #2f3f66;
  border-radius: 3px;
  background: #0e1526;
}

.upg-scale .tick.filled {
  background: #22c55e;
  border-color: #166534;
}

.upg-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.upg-actions .upg-cost {
  color: var(--dim);
  font-size: var(--lab-font-small);
}

.statsBox {
  border: 1px solid #2a3c63;
  border-radius: 10px;
  padding: 10px;
  background: #0d162c;
  font-family: var(--font-body);
  font-size: 14px; /* дрібніший шрифт для читабельності */
}

.stats-title {
  font-size: var(--lab-font);
}

.statsRow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 3px 0;
}

.statsRow b {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.statsBox .dim {
  color: var(--dim);
}

.hero-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 8px 0;
  padding: 6px 0;
  border-bottom: 1px dashed #2a3c63;
}

#heroPrev {
  image-rendering: pixelated;
  border: 1px solid #2a3c63;
  border-radius: 12px;
  background: #0b1120;
}

/* Головний заголовок у стартовому меню */
.panel .game-title {
  font-family: var(--font-ui);
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.1;
  text-align: center;
  margin: 0 0 16px;
  color: var(--fg);
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
/* Трохи збільшуємо та робимо білим заголовок у картці зброї */
.panel .card .title.small{
  font-size: calc(var(--lab-font) + 2px);
  color: #fff;
}
#canvas { box-sizing: border-box; image-rendering: pixelated; }

/* === audio toggle (text version) === */
.audio-toggle{
  position: fixed;
  right: 16px;
  bottom: 16px;

  /* робимо під текст, а не квадрат */
  min-width: 110px;
  height: 40px;
  padding: 0 12px;

  border-radius: 10px;
  border: 1px solid #2a3c63;
  background: #0b1220;
  color: #e2e8f0;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);

  display: flex;
  align-items: center;
  justify-content: center;

  font: 600 13px var(--font-ui, ui-sans-serif);
  letter-spacing: .4px;
  text-transform: none;

  cursor: pointer;
  user-select: none;
}

/* активна музика — просто слово */
.audio-toggle.is-on{
  text-decoration: none;
}

/* вимкнена музика — перекреслене слово */
.audio-toggle.is-off{
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #f87171;   /* м’яко-червоне перекреслення */
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;   /* щоб лінія не «обтікала» літери */
}

.audio-toggle:hover{ box-shadow: 0 12px 26px rgba(0,0,0,.42); }

/* HUD: індикатор музики біля таймера */
.hud-music{
  display:inline-block;
  min-width: 20px;
  padding: 0 6px;
  height: 20px;
  line-height: 20px;
  border: 1px solid #2a3c63;
  border-radius: 6px;
  background: #0b1220;
  color: #e2e8f0;
  font: 700 12px var(--font-ui, ui-sans-serif);
  text-align: center;
  margin-right: 6px;            /* трохи відступу від таймера */
  cursor: pointer;
  user-select: none;
}
.hud-music.is-off{
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #f87171;
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
}
/* опційно: приховувати кнопку, коли оверлей схований (тобто під час гри)
#overlay.hidden ~ .audio-toggle { display: none; } */
