:root {
  --bg: #111318;
  --panel: #1b1f28;
  --panel-alt: #222735;
  --text: #eceff4;
  --muted: #9aa3b2;
  --accent: #7dd3fc;
  --good: #86efac;
  --warn: #fbbf24;
  --bad: #fca5a5;
  --sun: #fbbf24;
  --water: #60a5fa;
  --nutrient: #a3e635;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button {
  background: var(--accent);
  color: #09111b;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.neighbor-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.neighbor-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
}
.neighbor-choice-label {
  font-size: 14px;
  line-height: 1.25;
}
.neighbor-choice-description {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.35;
  opacity: 0.78;
}
.neighbor-choice:disabled {
  background: #718096;
  color: #e2e8f0;
  opacity: 0.58;
}
.start-build {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.04em;
}
#app { max-width: 1400px; margin: 0 auto; padding: 16px; }
.layout {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  gap: 16px;
  margin-top: 0;
}
#game-panel.center-panel {
  position: fixed;
  top: 8px;
  left: max(16px, calc((100vw - 1400px) / 2 + 16px));
  width: min(calc(100vw - 388px), 1028px);
  z-index: 100;
}
.right-panel {
  grid-column: 3;
}
.panel {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.collapsible-panel {
  position: relative;
}
.panel-corner-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  background: rgba(17, 19, 24, 0.78);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  z-index: 3;
}
.panel-corner-toggle:hover:not(:disabled) {
  background: rgba(34, 39, 53, 0.95);
}
.panel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 39, 53, 0.96);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
  font-weight: 600;
}
.panel-content {
  min-width: 0;
}
.panel-collapsed {
  padding: 10px;
  min-height: auto;
  background: transparent;
  box-shadow: none;
}
.panel-collapsed .panel-chip {
  display: inline-flex;
}
.species-list, .actions-list {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px;
}
.species-card, .action-card {
  background: var(--panel-alt);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
}
.action-card {
  transition: opacity 0.2s, border-color 0.2s, transform 0.1s;
}
.action-card:hover:not(.disabled) {
  border-color: var(--accent);
}
.action-card.disabled {
  opacity: 0.5;
  border-color: rgba(255,255,255,0.04);
}
.action-state {
  margin: -2px 0 9px;
  padding: 6px 8px;
  border-left: 2px solid rgba(251, 191, 36, 0.55);
  border-radius: 0 6px 6px 0;
  background: rgba(251, 191, 36, 0.07);
  color: #f4d58a;
  font-size: 11px;
  line-height: 1.35;
}
.action-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.action-header h4,
.action-title {
  margin: 0;
  flex: 1;
  text-align: left;
}
.action-icon {
  margin-left: auto;
  flex: 0 0 auto;
  text-align: right;
}
.prereq-missing {
  font-size: 11px;
  color: var(--bad);
  background: rgba(252, 165, 165, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}
.action-costs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.cost {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  line-height: 1;
}
.cost-icon {
  font-size: 15px;
}
.cost-number {
  display: grid;
  gap: 1px;
  min-width: 22px;
  text-align: center;
}
.cost-number strong {
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cost-number small {
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.68;
}
.cost.res-sun { color: var(--sun); }
.cost.res-water { color: var(--water); }
.cost.res-nutrient { color: var(--nutrient); }
.cost.res-low {
  color: var(--bad);
  background: rgba(252, 165, 165, 0.15);
}
.cost.res-low {
  border-color: rgba(252,165,165,0.32);
}
.phase-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 8px 0;
}
.phase-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 20px;
}
.phase-badge.action-phase {
  background: rgba(125, 211, 252, 0.2);
  color: var(--accent);
}
.phase-badge.event-phase {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warn);
}
.phase-hint {
  color: var(--muted);
  font-size: 13px;
}
.finish-turn-btn {
  width: 100%;
  margin: 0 0 10px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.finish-turn-btn:hover:not(:disabled) {
  background: rgba(125, 211, 252, 0.1);
}
.finish-turn-btn.hidden {
  display: none;
}
.species-card.selected { outline: 2px solid var(--accent); }
.species-card h3, .action-card h4, h2, h3 { margin-top: 0; }
canvas {
  width: 100%; height: auto; background: #111; border-radius: 12px; display: block;
}
.map-frame {
  position: relative;
}
.map-status {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px;
  color: rgba(255,255,255,0.92);
  background: rgba(17, 19, 24, 0.68);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  backdrop-filter: blur(7px);
  pointer-events: none;
}
#game-canvas { cursor: zoom-in; }
#game-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.map-explorer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 10, .82);
}
.map-explorer-shell {
  width: min(1180px, 100%);
  min-width: 0;
  max-height: calc(100vh - 36px);
  box-sizing: border-box;
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.map-explorer-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.map-explorer-header h2 { margin: 0 0 3px; }
.map-explorer-header p { margin: 0; color: var(--muted); font-size: 13px; }
.map-explorer-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex: 0 0 auto; }
.map-explorer-controls button { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; font-size: 18px; line-height: 1; }
.map-explorer-controls #map-explorer-reset { font-size: 12px; }
#map-explorer-close { font-size: 24px; }
#map-explorer-zoom-label { min-width: 46px; color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.map-explorer-viewport {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  height: min(76vh, 760px);
  overflow: auto;
  border-radius: 12px;
  background: #111;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: none;
}
.map-explorer-open { overflow: hidden; }
.map-explorer-viewport.dragging { cursor: grabbing; user-select: none; }
.map-explorer-viewport canvas { width: 4096px; height: 1200px; max-width: none; border-radius: 0; }
.map-explorer-viewport canvas.zoom-preview { will-change: transform; }
.map-stat {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}
.map-stat span {
  color: rgba(255,255,255,0.62);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.map-stat strong {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}
.map-build {
  color: rgba(255,255,255,0.5);
  font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.panel-collapsed canvas {
  display: none;
}

.actions-heading-count {
  color: var(--accent);
  font-size: 0.66em;
  font-weight: 650;
  white-space: nowrap;
}
.actions-heading-count.no-actions {
  color: var(--warn);
}
.growth-hint {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(134, 239, 172, 0.18);
  border-radius: 9px;
  background: rgba(134, 239, 172, 0.07);
  color: #bbf7d0;
  font-size: 13px;
  line-height: 1.4;
}
.actions-header { margin-bottom: 10px; }
.action-resource-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 10px;
  padding: 7px 9px;
  border: 1px solid rgba(125,211,252,0.14);
  border-radius: 9px;
  background: rgba(125,211,252,0.055);
  font-size: 13px;
}
.action-resource-label {
  margin-right: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.action-resource-total {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 40px;
  font-size: 13px;
}
.action-resource-total strong {
  font: 750 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.action-resource-total.res-sun { color: var(--sun); }
.action-resource-total.res-water { color: var(--water); }
.action-resource-total.res-nutrient { color: var(--nutrient); }
.action-resource-total.res-health {
  min-width: 52px;
  color: #f6a6a6;
  border-left: 1px solid rgba(255,255,255,0.12);
  padding-left: 7px;
}
.post-actions-status {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.09);
}

.threat-status {
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.threat-growing {
  background: rgba(157, 72, 42, 0.12);
  color: #f1aa85;
}

.threat-solved {
  background: rgba(56, 118, 71, 0.12);
  color: #9bd4a7;
}
.grove-effect {
  display: block;
  grid-column: 4;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
}
.resource-factors {
  display: flex;
  grid-column: 4;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
.resource-factor {
  padding: 3px 6px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.045);
  font-size: 10px;
  line-height: 1.25;
}
.resource-factor.positive {
  border-color: rgba(134,239,172,0.22);
  background: rgba(134,239,172,0.08);
  color: #9bd4a7;
}
.resource-factor.negative {
  border-color: rgba(252,165,165,0.24);
  background: rgba(252,165,165,0.08);
  color: #f1aa85;
}
.resource-factor.neutral { color: var(--muted); }
.grove-effect.positive { color: #9bd4a7; }
.grove-effect.negative { color: #f1aa85; }
.grove-effect.neutral { color: var(--muted); }
.unavailable-actions {
  padding-top: 4px;
}
.unavailable-actions > h4 {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.unavailable-actions-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.unavailable-action {
  padding: 9px 10px;
  border-left: 2px solid rgba(255,255,255,0.12);
  border-radius: 0 7px 7px 0;
  background: rgba(255,255,255,0.025);
  color: var(--muted);
  opacity: 0.66;
}
.unavailable-action-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.unavailable-action p {
  margin: 4px 0;
  font-size: 12px;
  line-height: 1.35;
}
.unavailable-action .action-costs {
  margin: 6px 0 4px;
}
.unavailable-reason {
  color: var(--bad);
}
.action-unlock {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--good);
  border-radius: 0 8px 8px 0;
  background: rgba(134, 239, 172, 0.08);
}
.turn-end-banner {
  margin: -4px 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.18), rgba(251, 191, 36, 0.08));
  color: #fde68a;
  font-weight: 600;
  line-height: 1.35;
}
.turn-end-banner.hidden {
  display: none;
}
.turn-end-banner strong {
  color: #fef3c7;
}

/* Grouped Stats */
.stats-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.stat-group {
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  overflow: hidden;
}
.stat-group-title {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-group-title:hover {
  background: rgba(255,255,255,0.06);
}
.stat-group-title::after {
  content: '▼';
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s;
}
.stat-group.collapsed .stat-group-title::after {
  transform: rotate(-90deg);
}
.stat-group.collapsed .stat-group-content {
  display: none;
}
.stat-group-content {
  padding: 8px 12px;
}
.stat-divider {
  height: 1px;
  margin: 8px 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.16), transparent);
}
.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: help;
  transition: background 0.15s;
}
.stat-row:last-child {
  border-bottom: none;
}
.stat-row:hover {
  background: rgba(255,255,255,0.03);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
}
.stat-row.compact {
  padding: 4px 0;
}
.stat-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}
.stat-name {
  flex: 1;
  font-size: 13px;
}
.stat-value {
  font-weight: 700;
  font-size: 14px;
  min-width: 30px;
  text-align: right;
}
.stat-max {
  font-size: 12px;
  color: var(--muted);
}
.season-guide {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 11px;
}
.season-guide summary {
  cursor: pointer;
  color: #cbd5e1;
  line-height: 1.4;
}
.season-guide-grid {
  display: grid;
  gap: 2px;
  margin-top: 7px;
}
.season-guide-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 6px;
}
.season-guide-row.current {
  background: rgba(125,211,252,0.09);
  color: var(--text);
}
.season-guide p {
  margin: 7px 6px 2px;
  line-height: 1.35;
}
.offspring-stats {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
}
.offspring-stats summary {
  cursor: pointer;
  color: #b7f7cb;
  font-weight: 700;
}
#offspring-stats-list {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}
.offspring-stat-card {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 7px;
  background: rgba(74, 222, 128, 0.07);
  color: var(--muted);
  line-height: 1.35;
}
.offspring-stat-card strong { color: #d9fbe3; }

/* Tooltip */
.tooltip {
  position: fixed;
  background: var(--panel-alt);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
  max-width: 240px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.tooltip.hidden {
  display: none;
}
.tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--panel-alt);
}

/* Floating Feedback */
.feedback-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1001;
  pointer-events: none;
}
.feedback {
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  max-width: 300px;
}
.feedback.success {
  background: rgba(134, 239, 172, 0.95);
  color: #064e3b;
}
.feedback.error {
  background: rgba(252, 165, 165, 0.95);
  color: #7f1d1d;
}
.feedback.info {
  background: rgba(125, 211, 252, 0.95);
  color: #0c4a6e;
}
.feedback.warning {
  background: rgba(251, 191, 36, 0.95);
  color: #78350f;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.future-actions {
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}
.future-actions summary {
  cursor: pointer;
  padding: 12px;
  font-weight: 700;
  color: var(--muted);
  list-style: none;
}
.future-actions summary::-webkit-details-marker { display: none; }
.future-actions-list {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.future-reason {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.log {
  background: #10141c; border-radius: 10px; padding: 10px; min-height: 180px; max-height: 300px; overflow: auto;
  font-size: 14px;
}
.log-entry { margin-bottom: 8px; color: var(--muted); }
.log-entry.success { color: var(--good); }
.log-entry.error { color: var(--bad); }
.log-entry.event { color: var(--accent); }
.hidden { display: none !important; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  z-index: 100;
}
.modal-card {
  width: min(680px, 100%); background: var(--panel); border-radius: 16px; padding: 20px;
}
.resource-summary {
  margin: 16px 0;
}
.res-line {
  display: grid;
  grid-template-columns: 28px minmax(80px, auto) 42px minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.res-line:last-of-type {
  border-bottom: none;
}
.res-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.res-name {
  font-weight: 600;
  min-width: 80px;
}
.res-value {
  font-weight: 700;
  color: var(--good);
  min-width: 40px;
}
.res-detail {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}
.actions-earned {
  margin-top: 16px;
  padding: 12px;
  background: rgba(125, 211, 252, 0.1);
  border-radius: 8px;
  text-align: center;
  color: var(--accent);
}
.event-major {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.event-major.event-critical {
  background: rgba(252, 165, 165, 0.15);
  border: 1px solid rgba(252, 165, 165, 0.3);
}
.event-major.event-bad {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.event-major.event-good {
  background: rgba(134, 239, 172, 0.1);
  border: 1px solid rgba(134, 239, 172, 0.2);
}
.event-major.event-neutral {
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.2);
}
.event-icon {
  font-size: 32px;
  line-height: 1;
}
.event-content h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
}
.event-content p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.event-consequences {
  margin-top: 8px;
  padding: 10px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  font-size: 13px;
}
.event-consequences ul {
  margin: 0;
  padding-left: 18px;
}
.event-consequences li {
  margin-bottom: 4px;
  color: var(--text);
}
.minor-events h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.minor-events ul {
  margin: 0;
  padding-left: 20px;
}
.minor-events li {
  margin-bottom: 6px;
  color: var(--text);
}
.no-events {
  color: var(--muted);
  font-style: italic;
}
.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.hud-header h2 {
  margin: 0;
}
.phase-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(125, 211, 252, 0.15);
  color: var(--accent);
}
.phase-pill.phase-action {
  background: rgba(125, 211, 252, 0.15);
  color: var(--accent);
}
.phase-pill.phase-event {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
}
.species-badge {
  background: var(--panel-alt);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text);
}
.species-card-detail {
  padding: 14px;
}
.species-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.species-summary.compact {
  gap: 8px;
}
.species-summary-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.species-summary-icon {
  font-size: 24px;
  line-height: 1;
}
.species-summary-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.species-summary h3 {
  margin: 0;
  color: var(--accent);
}
.species-summary-description {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.species-summary-bonus {
  border-left: 3px solid rgba(125, 211, 252, 0.55);
  padding-left: 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}
.stat-icon {
  display: inline-block;
  width: 20px;
  text-align: center;
  margin-right: 4px;
}
small { color: var(--muted); }
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
    padding-top: calc((100vw - 12px) * 2 / 3 + 6px);
  }
  #game-panel.center-panel {
    top: 0;
    left: 6px;
    width: calc(100vw - 12px);
  }
  .right-panel { grid-column: 1; }
}
@media (max-width: 560px) {
  #app { padding: 6px; }
  .panel { padding: 8px; border-radius: 12px; }
  .map-status { top: 6px; left: 6px; right: 6px; gap: 3px; padding: 5px 6px; }
  .map-stat { display: block; text-align: center; }
  .map-stat span { display: block; font-size: 8px; }
  .map-stat strong { display: block; font-size: 11px; }
  .map-build { display: none; }
  .map-explorer { padding: 6px; }
  .map-explorer-shell { max-height: calc(100vh - 12px); padding: 8px; }
  .map-explorer-header { align-items: center; gap: 8px; }
  .map-explorer-header h2 { font-size: 17px; }
  .map-explorer-header p { font-size: 11px; }
  .map-explorer-controls { gap: 3px; }
  .map-explorer-controls button { min-width: 30px; width: 30px; height: 30px; padding: 0; }
  .map-explorer-controls #map-explorer-reset { width: auto; padding: 0 8px; }
  #map-explorer-zoom-label { min-width: 38px; font-size: 10px; }
  .map-explorer-viewport { height: calc(100vh - 98px); }
  .action-resource-strip {
    margin-bottom: 7px;
  }
  .action-command-bar {
    position: sticky;
    top: calc((100vw - 12px) * 2 / 3 + 8px);
    z-index: 3;
    padding: 1px 0;
    background: rgba(28, 34, 44, 0.94);
    backdrop-filter: blur(10px);
  }
  .cost { padding: 5px 6px; gap: 3px; }
  .modal { padding: 10px; }
  .modal-card { padding: 16px; }
  .res-line { grid-template-columns: 26px 1fr auto; gap: 8px; }
  .resource-factors,
  .grove-effect { grid-column: 2 / -1; }
  .resource-factors { margin-top: 5px; }
}
.game-over-screen{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at top,#25382f 0,#111713 58%,#080b09 100%);color:#f0f4ee}.game-over-card{width:min(680px,100%);padding:clamp(26px,6vw,56px);border:1px solid rgba(190,220,190,.25);border-radius:24px;background:rgba(12,20,16,.92);box-shadow:0 24px 70px rgba(0,0,0,.45);text-align:center}.game-over-kicker{text-transform:uppercase;letter-spacing:.16em;color:#9fbd9f}.game-over-card h1{font-size:clamp(2rem,7vw,4rem);margin:.35em 0}.game-over-flavor{font-size:1.1rem;line-height:1.7;color:#d3ddd2}.game-over-stats{display:grid;gap:10px;margin:28px 0;text-align:left}.game-over-stats div{display:flex;justify-content:space-between;gap:18px;padding:12px 14px;border-radius:10px;background:rgba(255,255,255,.05)}.game-over-stats dt{color:#9fbd9f}.game-over-stats dd{margin:0;font-weight:700}.game-over-card blockquote{margin:28px auto;color:#c8d8c3;font-family:Georgia,serif;font-size:1.12rem;line-height:1.6}.game-over-card button{min-width:180px}
