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

/* ── Hover tooltip ───────────────────────────────────────────────────────── */
.hover-tooltip {
  display: none;
  position: fixed;
  background: #1e1e3a;
  border: 1px solid #5a5a90;
  border-radius: 6px;
  padding: clamp(8px, 0.7vw, 14px);
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  min-width: 140px;
  max-width: 280px;
}
.hover-tooltip.visible { display: block; }
.hover-tooltip-title { font-weight: 700; color: #f3f4f6; font-size: clamp(12px, 1vw, 18px); margin-bottom: 4px; border-bottom: 1px solid #3a3a60; padding-bottom: 4px; }
.hover-tooltip-stat { color: #d1d5db; font-size: clamp(11px, 0.9vw, 16px); line-height: 1.6; }

@keyframes hud-hit-flash {
  0%   { background: rgba(220,0,0,0.5); box-shadow: 0 0 18px 6px rgba(255,0,0,0.7); }
  40%  { background: rgba(220,0,0,0.2); box-shadow: 0 0 10px 3px rgba(255,0,0,0.4); }
  100% { background: transparent; box-shadow: none; }
}
.hit-flash {
  border-radius: 6px;
  animation: hud-hit-flash 0.6s ease-out forwards;
}

body {
  background: #0d0d1a;
  color: #e5e7eb;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: clamp(14px, 1.1vw + 6px, 22px);
  height: 100vh;
  overflow: hidden;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.visible { display: flex; }

.modal-content {
  background: #161626;
  border: 1px solid #2e2e50;
  border-radius: 14px;
  padding: 2rem 1.5rem;
  max-width: 720px;
  width: 100%;
}
.modal-content h2 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  color: #f9fafb;
}
.modal-content > p {
  text-align: center;
  color: #bfc7d0;
  margin-bottom: 1.4rem;
  font-size: 0.88rem;
}

.faction-cards {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.faction-card {
  flex: 1 1 180px;
  background: #0f0f1f;
  border: 1px solid #2e2e50;
  border-radius: 10px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}
.faction-icon { font-size: 2rem; }
.faction-card h3 { font-size: 0.95rem; color: #f3f4f6; }
.faction-card p { font-size: 0.8rem; color: #bfc7d0; line-height: 1.45; }
.faction-towers { font-size: 0.8rem; color: #9ca3af; line-height: 1.7; }
.faction-card button {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.45rem 0.8rem;
  background: #2e2e50;
  color: #e5e7eb;
  border: 1px solid #4b4b80;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.faction-card button:hover { background: #3e3e70; border-color: #7c7cc0; }
.faction-card[data-faction="dairy"] button:hover  { background: #92400e; border-color: #d97706; }
.faction-card[data-faction="fungi"] button:hover  { background: #14532d; border-color: #16a34a; }
.faction-card[data-faction="pepper"] button:hover { background: #7f1d1d; border-color: #dc2626; }

/* ── Game container ──────────────────────────────────────────────────────── */
#game-container {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin: 0 auto;
  padding: 0.5rem;
  gap: 0.5rem;
  height: 100vh;
  overflow: hidden;
}

/* ── HUD top ─────────────────────────────────────────────────────────────── */
#hud-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #161626;
  border: 1px solid #2e2e50;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.back-link {
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.8rem;
  white-space: nowrap;
}
.back-link:hover { color: #d1d5db; }

.hud-section {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.hud-label {
  font-size: 0.78rem;
  color: #bfc7d0;
  white-space: nowrap;
}
.hud-val {
  font-size: 1rem;
  font-weight: 700;
  color: #f3f4f6;
}
.hud-val.gold { color: #fbbf24; }

#curd-production {
  font-size: 0.72em;
  color: #d97706;
  font-weight: 600;
  margin-left: 0.25em;
  opacity: 0.85;
}

#auto-wave-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
#auto-wave-btn:hover { background: #334155; color: #e2e8f0; }
#auto-wave-btn.active {
  background: #14532d;
  color: #86efac;
  border-color: #16a34a;
  box-shadow: 0 0 6px #16a34a60;
}
#auto-wave-btn.active:hover { background: #166534; }

.bar-wrap {
  position: relative;
  width: 8rem;
  height: 18px;
  background: #0f0f1f;
  border: 1px solid #2e2e50;
  border-radius: 4px;
  overflow: hidden;
}
.bar {
  height: 100%;
  width: 0;
  transition: width 0.5s, background 0.5s;
  border-radius: 3px;
}
.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 0 4px #000, 0 0 2px #000;
  pointer-events: none;
  white-space: nowrap;
}


/* ── Game main area ──────────────────────────────────────────────────────── */
#game-main {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Tower column ────────────────────────────────────────────────────────── */
#tower-column {
  width: clamp(160px, 13vw, 260px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Building column ─────────────────────────────────────────────────────── */
#building-column {
  width: clamp(160px, 13vw, 260px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 0;
  overflow: hidden;
}

/* ── Tower panel ─────────────────────────────────────────────────────────── */
#tower-panel {
  width: 100%;
  flex-shrink: 0;
  background: #161626;
  border: 1px solid #2e2e50;
  border-radius: 8px;
  padding: clamp(4px, 0.4vw, 8px);
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.3vw, 6px);
  overflow: hidden;
  min-height: 0;
}

/* ── Building panel ──────────────────────────────────────────────────────── */
#building-panel {
  width: 100%;
  flex-shrink: 0;
  background: #161626;
  border: 1px solid #2e2e50;
  border-radius: 8px;
  padding: clamp(4px, 0.4vw, 8px);
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.3vw, 6px);
  overflow: hidden;
  min-height: 0;
}

/* ── Chicken Skills panel ────────────────────────────────────────────────── */
#chicken-skills-panel {
  width: 100%;
  flex-shrink: 0;
  background: #161626;
  border: 1px solid #2e2e50;
  border-radius: 8px;
  padding: clamp(4px, 0.4vw, 8px);
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.3vw, 6px);
  overflow: hidden;
  min-height: 0;
}

#chicken-skills-list {
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.3vw, 4px);
  min-height: 0;
  overflow: hidden;
}

#chicken-skills-list .chicken-ability-btn {
  width: 100%;
}

/* ── Left info panel (tabs: Defenders / Runs) ────────────────────────────── */
#left-info-panel {
  width: clamp(160px, 13vw, 260px);
  flex-shrink: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  background: #161626;
  border: 1px solid #2e2e50;
  border-radius: 8px;
  padding: clamp(4px, 0.4vw, 8px);
  overflow: hidden;
  position: relative;
  max-height: 100%;
}

#hover-info-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #161626;
  border-radius: 8px;
  padding: clamp(4px, 0.4vw, 8px);
  flex-direction: column;
  gap: clamp(2px, 0.3vw, 6px);
  overflow-y: auto;
  z-index: 2;
}
#hover-info-overlay.visible { display: flex; }

#info-tabs {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin-bottom: 0.3rem;
}

.info-tab {
  flex: 1;
  background: #0f0f1f;
  border: 1px solid #2e2e50;
  border-radius: 4px 4px 0 0;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.2rem 0.2rem;
  font-size: clamp(9px, 0.8vw, 13px);
  font-weight: 600;
  transition: background 0.12s, color 0.12s;
}
.info-tab:hover { background: #1a1a30; color: #d1d5db; }
.info-tab.active { background: #1e1e3a; color: #c4b5fd; border-bottom-color: #1e1e3a; }

.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
}
.tab-content.active { display: flex; }


.panel-title {
  font-size: clamp(11px, 1vw, 18px);
  font-weight: 700;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#tower-list {
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.3vw, 4px);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tower-btn {
  display: flex;
  align-items: center;
  gap: clamp(3px, 0.3vw, 6px);
  padding: clamp(2px, 0.3vw, 6px) clamp(4px, 0.4vw, 8px);
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #2e2e50;
  background: #0f0f1f;
  transition: all 0.12s;
  user-select: none;
  flex-shrink: 1;
  min-height: 0;
}
.tower-btn:hover:not(.disabled) {
  background: #1a1a30;
  border-color: #4b4b80;
}
.tower-btn.selected {
  border-color: #60a5fa;
  background: #0c1f3f;
  box-shadow: 0 0 0 1px #60a5fa40;
}
.tower-btn.disabled { opacity: 0.4; cursor: not-allowed; }

.tower-btn-icon {
  width: clamp(24px, 2vw, 36px);
  height: clamp(24px, 2vw, 36px);
  border-radius: 4px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.3);
}
.tower-btn-name {
  font-size: clamp(10px, 0.85vw, 15px);
  color: #e5e7eb;
  line-height: 1.2;
}
.tower-btn-cost {
  font-size: clamp(9px, 0.8vw, 14px);
  color: #fbbf24;
}

#tower-desc {
  font-size: clamp(14px, 1.1vw, 20px);
  color: #f3f4f6;
  line-height: 1.5;
  min-height: clamp(36px, 4vw, 60px);
}

#sell-btn {
  display: none;
  width: 100%;
  padding: clamp(6px, 0.6vw, 12px);
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid #b91c1c;
  border-radius: 6px;
  cursor: pointer;
  font-size: clamp(12px, 1vw, 18px);
  font-weight: 600;
  transition: background 0.15s;
}
#sell-btn:hover { background: #991b1b; }


/* ── Building panel ──────────────────────────────────────────────────────── */
#building-list {
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.3vw, 4px);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}


.building-btn {
  display: flex;
  align-items: center;
  gap: clamp(3px, 0.3vw, 6px);
  padding: clamp(2px, 0.3vw, 6px) clamp(4px, 0.4vw, 8px);
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #2e4040;
  background: #0a1a1a;
  transition: all 0.12s;
  user-select: none;
  flex-shrink: 1;
  min-height: 0;
}
.building-btn:hover:not(.disabled) {
  background: #122525;
  border-color: #3a6060;
}
.building-btn.selected {
  border-color: #34d399;
  background: #0a2a20;
  box-shadow: 0 0 0 1px #34d39940;
}
.building-btn.disabled { opacity: 0.4; cursor: not-allowed; }

.building-btn-icon {
  width: clamp(24px, 2vw, 36px);
  height: clamp(24px, 2vw, 36px);
  border-radius: 50%;
  border: 2px dashed rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(11px, 1vw, 16px);
  flex-shrink: 0;
}
.building-btn-name {
  font-size: clamp(10px, 0.85vw, 15px);
  color: #e5e7eb;
  line-height: 1.2;
}
.building-btn-cost {
  font-size: clamp(9px, 0.8vw, 14px);
  color: #fbbf24;
}

/* ── Canvas ──────────────────────────────────────────────────────────────── */
#canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 0;
  overflow: hidden;
}

#game-canvas {
  display: block;
  border: 1px solid #2e2e50;
  border-radius: 6px;
  cursor: none;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  touch-action: none;
}


/* ── Leaderboard list ────────────────────────────────────────────────────── */
#lb-list { display: flex; flex-direction: column; gap: clamp(3px, 0.3vw, 8px); }

.lb-entry {
  display: flex;
  align-items: center;
  gap: clamp(5px, 0.5vw, 10px);
  padding: clamp(4px, 0.4vw, 8px) 0;
  border-bottom: 1px solid #1a1a30;
  font-size: clamp(13px, 1.1vw, 20px);
}
.lb-entry.online .lb-name { color: #4ade80; }
.lb-icon { flex-shrink: 0; font-size: clamp(16px, 1.4vw, 24px); }
.lb-color {
  display: inline-block;
  width: clamp(8px, 0.8vw, 14px);
  height: clamp(8px, 0.8vw, 14px);
  border-radius: 2px;
  flex-shrink: 0;
}
.lb-name { flex: 1; color: #c9d1d9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-stat { color: #fbbf24; font-size: clamp(12px, 1vw, 18px); white-space: nowrap; }

/* ── Event log ───────────────────────────────────────────────────────────── */
#event-log {
  position: fixed;
  bottom: 0.5rem;
  left: 0.5rem;
  width: clamp(160px, 13vw, 260px);
  background: #161626;
  border: 1px solid #2e2e50;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  max-height: 130px;
  overflow: hidden;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

#event-log .panel-title {
  flex-shrink: 0;
  margin-bottom: 0.2rem;
}

#event-entries { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.1rem; }
.event-entry {
  font-size: 0.72rem;
  color: #9ca3af;
  padding: 0.1rem 0;
}
.event-entry:first-child { color: #c4b5fd; }
.event-entry.warn { color: #fca5a5; }
.event-entry.good { color: #86efac; }

/* ── Run history list ────────────────────────────────────────────────────── */
#run-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}


.node-info-header {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.node-info-desc {
  font-size: 0.75rem;
  color: #bfc7d0;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.node-info-stat {
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.5;
}

.run-history-empty {
  font-size: 0.72rem;
  color: #8b95a3;
}

.run-entry {
  background: #0f0f1f;
  border: 1px solid #2e2e50;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  min-width: 120px;
  max-width: 200px;
}

.run-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.run-wave {
  font-size: 0.85rem;
  font-weight: 700;
  color: #c4b5fd;
}

.run-time {
  font-size: 0.75rem;
  color: #8b95a3;
}

.run-players {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.run-player {
  font-size: 0.78rem;
  color: #a8b2bf;
  display: flex;
  justify-content: space-between;
  gap: 0.3rem;
}

.run-player.top {
  color: #e5e7eb;
  font-weight: 600;
}

.run-kills {
  color: #fbbf24;
}


.enemy-entry {
  display: flex;
  align-items: center;
  gap: clamp(5px, 0.5vw, 10px);
  padding: clamp(4px, 0.4vw, 8px) 0;
  border-bottom: 1px solid #1a1a30;
}
.enemy-entry:last-child { border-bottom: none; }
.enemy-color {
  display: inline-block;
  width: clamp(8px, 0.8vw, 14px);
  height: clamp(8px, 0.8vw, 14px);
  border-radius: 2px;
  flex-shrink: 0;
}
.enemy-emoji { font-size: clamp(18px, 1.6vw, 28px); flex-shrink: 0; }
.enemy-info { display: flex; flex-direction: column; gap: clamp(2px, 0.2vw, 5px); min-width: 0; }
.enemy-name { font-size: clamp(13px, 1.1vw, 20px); color: #e5e7eb; font-weight: 600; }
.enemy-stats { font-size: clamp(11px, 0.9vw, 17px); color: #a8b2bf; }

/* ── Sound button ─────────────────────────────────────────────────────────── */
#sound-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
#sound-btn:hover { background: #334155; color: #e2e8f0; }
#sound-btn.active {
  background: #1e1b4b;
  color: #a5b4fc;
  border-color: #6366f1;
  box-shadow: 0 0 6px #6366f160;
}

/* ── Scene scroller ──────────────────────────────────────────────────────── */
#scroller-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  margin-left: auto;
  padding-left: 0.75rem;
  border-left: 1px solid #2e2e50;
}

#scroller-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.scroller-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}
.scroller-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.scroller-slider {
  position: absolute;
  inset: 0;
  background: #1a1a30;
  border: 1px solid #3e3e60;
  border-radius: 20px;
  transition: background 0.2s, border-color 0.2s;
}
.scroller-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: #6b7280;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.scroller-switch input:checked + .scroller-slider {
  background: #3b0764;
  border-color: #7c3aed;
}
.scroller-switch input:checked + .scroller-slider::before {
  transform: translateX(16px);
  background: #c4b5fd;
}

#scroller-mode-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #8b95a3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  min-width: 46px;
  user-select: none;
}

#scroller-custom-text {
  flex: 1;
  background: #0f0f1f;
  border: 1px solid #2e2e50;
  border-radius: 4px;
  color: #e5e7eb;
  font-size: 0.75rem;
  padding: 0.22rem 0.55rem;
  outline: none;
  opacity: 0.35;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  transition: opacity 0.15s, border-color 0.15s;
}
#scroller-custom-text:not(:disabled) {
  opacity: 1;
  border-color: #7c3aed;
}
#scroller-custom-text::placeholder {
  color: #374151;
  text-transform: none;
  font-family: inherit;
}

#scroller-canvas {
  display: block;
  width: 100%;
  height: clamp(14px, 1.8vh, 26px);
  image-rendering: pixelated;
  border-radius: 4px;
}

/* ── Tech tree tier headers ──────────────────────────────────────────────── */
.tier-header {
  font-size: clamp(10px, 0.85vw, 14px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0 0.1rem;
  border-bottom: 1px solid #2e2e50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.15rem;
}
.tier-header:first-child { margin-top: 0; }
.tier-header.unlocked { color: #4ade80; border-color: #16a34a40; }
.tier-header.locked   { color: #6b7280; border-color: #2e2e50; }
.tier-header .tier-req {
  font-size: clamp(9px, 0.75vw, 12px);
  color: #9ca3af;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
/* ── Faction section headers in tower panel ──────────────────────────────── */
.faction-header {
  font-size: clamp(10px, 0.85vw, 14px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0 0.1rem;
  border-bottom: 2px solid #4b5563;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  color: #e2e8f0;
}
.faction-header:first-child { margin-top: 0; }
.faction-header .tier-req {
  font-size: clamp(9px, 0.75vw, 12px);
  color: #9ca3af;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
/* ── Hotkey badge ────────────────────────────────────────────────────────── */
.hotkey-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(16px, 1.2vw, 22px);
  height: clamp(16px, 1.2vw, 22px);
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #ccc;
  font-size: clamp(9px, 0.75vw, 13px);
  font-family: monospace;
  flex-shrink: 0;
}

.tower-btn.locked, .building-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
  border-style: dashed;
}
.tier-progress {
  font-size: clamp(10px, 0.8vw, 14px);
  color: #9ca3af;
  text-align: right;
  padding: 0.15rem 0 0.3rem;
}

/* ── Changelog modal ─────────────────────────────────────────────────────── */
.changelog-content {
  max-height: 70vh;
  overflow-y: auto;
}
#changelog-entries {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  max-height: 50vh;
  overflow-y: auto;
}
.changelog-entry {
  background: #0f0f1f;
  border: 1px solid #2e2e50;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
}
.changelog-date {
  font-size: 0.75rem;
  color: #9ca3af;
}
.changelog-text {
  font-size: 0.88rem;
  color: #e5e7eb;
  margin-top: 0.2rem;
}
#changelog-close-btn {
  width: 100%;
  padding: 0.6rem;
  background: #2e2e50;
  color: #e5e7eb;
  border: 1px solid #4b4b80;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
#changelog-close-btn:hover {
  background: #3e3e70;
  border-color: #7c7cc0;
}
#changelog-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
#changelog-btn:hover { background: #334155; color: #e2e8f0; }

/* ── Cheese Chicken HUD ──────────────────────────────────────────────────── */
.chicken-dead-label {
  color: #ef4444;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.chicken-respawn-btn {
  background: #7c2d12;
  color: #fef3c7;
  border: 1px solid #c2410c;
  border-radius: 4px;
  padding: 0.18rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.chicken-respawn-btn:hover:not(:disabled) { background: #9a3412; }
.chicken-respawn-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chicken-hint {
  font-size: 0.68rem;
  color: #6b7280;
  white-space: nowrap;
}

/* ── Chicken abilities ───────────────────────────────────────────────────── */
.chicken-xp-label {
  font-size: 0.7rem;
  color: #a78bfa;
  white-space: nowrap;
  font-weight: 600;
}

.chicken-abilities {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.chicken-ability-btn {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: #1e293b;
  border: 1px solid #3b4a6b;
  border-radius: 5px;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  font-size: 0.72rem;
  color: #e2e8f0;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
  line-height: 1.3;
}

.chicken-ability-btn:hover:not(.locked):not(.disabled) {
  background: #2d3f5e;
  border-color: #60a5fa;
}

.chicken-ability-btn.locked {
  opacity: 0.55;
  cursor: default;
  border-color: #374151;
}

.chicken-ability-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chicken-ability-btn.active {
  border-color: #f97316;
  background: #1c2d1a;
  box-shadow: 0 0 6px rgba(249,115,22,0.5);
}

.ca-emoji { font-size: 0.85rem; }
.ca-name  { font-weight: 600; font-size: 0.7rem; }
.ca-cost  { color: #fbbf24; font-size: 0.68rem; }
.ca-cd    { color: #f87171; font-size: 0.68rem; font-weight: 700; }
.ca-req   { color: #9ca3af; font-size: 0.65rem; }
.ca-maxlvl { color: #4ade80; font-size: 0.6rem; font-weight: 700; }

.ca-upgrade-btn {
  background: #064e3b;
  border: 1px solid #059669;
  border-radius: 3px;
  color: #6ee7b7;
  font-size: 0.62rem;
  padding: 0.05rem 0.2rem;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.1s;
}
.ca-upgrade-btn:hover:not(.disabled) { background: #065f46; }
.ca-upgrade-btn.disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  #game-main { flex-direction: column; }
  #tower-column, #building-column, #left-info-panel { width: 100%; align-self: auto; }
  #tower-list { flex-direction: row; flex-wrap: wrap; }
  .tower-btn { flex: 1 1 120px; }
  #scroller-section { display: none; }
  .bar-wrap { width: 6rem; }
  #event-log { width: calc(100% - 1rem); }
}
