:root {
  color-scheme: dark;
  --cozy-cream: #fff7dc;
  --cozy-paper: rgba(255, 247, 220, 0.92);
  --cozy-ink: #3f4935;
  --cozy-moss: #617b3a;
  --cozy-gold: #d69a43;
  --cozy-water: #69b8c1;
  --bg: #02090b;
  --panel: rgba(4, 18, 18, 0.78);
  --panel-strong: rgba(3, 14, 15, 0.95);
  --line: rgba(108, 238, 216, 0.2);
  --muted: #729b94;
  --text: #e7fff8;
  --lime: #c9ff72;
  --mint: #62f4e2;
  --amber: #ffd36b;
  --danger: #ff806c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  --hud-header: linear-gradient(90deg, rgba(6, 30, 31, .98), rgba(4, 22, 27, .98));
}

* { box-sizing: border-box; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}
body::before, body::after { content: ''; position: fixed; z-index: 7; inset: 0; pointer-events: none; }
body::before {
  opacity: .06;
  background: repeating-linear-gradient(180deg, transparent 0, transparent 3px, rgba(145,255,228,.16) 4px);
  mix-blend-mode: screen;
}
body::after {
  box-shadow: inset 0 0 180px rgba(0,0,0,.7);
  background: radial-gradient(circle at 50% 45%, transparent 34%, rgba(0,5,7,.35) 100%);
}
body::before, body::after { display: none; }
button, input, select { font: inherit; }
button { color: inherit; }
button { touch-action: manipulation; }

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: radial-gradient(circle at 55% 42%, #0b3028, #02090b 70%);
}
#world.dragging { cursor: grabbing; }
#world.tool-active { cursor: crosshair; }

#world-3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(#c8dcae, #e8d6a0);
}
#world-3d:active { cursor: grabbing; }
body[data-world-renderer="procedural-3d"] #world { display: none; }
.world-3d-loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: #f8ffe9;
  text-align: center;
  letter-spacing: .05em;
  background: radial-gradient(circle at 50% 45%, rgba(47,112,78,.72), rgba(9,24,24,.96));
  transition: opacity .6s ease, visibility .6s ease;
  pointer-events: none;
}
.world-3d-loading.done { opacity: 0; visibility: hidden; }
.world-3d-loading small { color: rgba(232,255,219,.76); }
.world-3d-loader-orb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(235,255,206,.2);
  border-top-color: #e9ff9d;
  box-shadow: 0 0 28px rgba(218,255,142,.42);
  animation: world-3d-spin 1s linear infinite;
}
@keyframes world-3d-spin { to { transform: rotate(360deg); } }
.world-3d-error {
  position: fixed;
  z-index: 100;
  left: 50%;
  top: 90px;
  transform: translateX(-50%);
  max-width: min(680px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid rgba(255,153,120,.7);
  border-radius: 12px;
  color: #fff4eb;
  background: rgba(91,27,21,.94);
  box-shadow: 0 16px 40px rgba(0,0,0,.32);
}

.cozy-zoom-controls {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 22px;
  display: flex;
  gap: 5px;
  padding: 6px;
  transform: translateX(-50%);
  border: 1px solid rgba(91, 82, 51, .22);
  border-radius: 18px;
  background: var(--cozy-paper);
  box-shadow: 0 12px 35px rgba(63, 48, 25, .24), inset 0 1px rgba(255,255,255,.8);
  color: var(--cozy-ink);
  backdrop-filter: blur(12px) saturate(1.08);
}
.cozy-zoom-controls button {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 12px;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.cozy-zoom-controls button[aria-pressed="true"] {
  color: #fffdf2;
  background: linear-gradient(145deg, #78964e, #526d34);
  box-shadow: 0 5px 12px rgba(61, 82, 39, .28), inset 0 1px rgba(255,255,255,.24);
}
.touch-gesture-hint { display: none; }

@media (pointer: coarse) {
  .touch-gesture-hint {
    display: block; margin: 12px 0 0; padding: 9px 11px; border: 1px solid rgba(98,244,226,.2);
    border-radius: 9px; color: #b9d8cf; background: rgba(98,244,226,.055); font-size: 11px; line-height: 1.45;
  }
  .panel-toggle { min-width: 38px; min-height: 38px; }
  .icon-button { min-width: 42px; min-height: 42px; }
  .analysis-button, .cta, select { min-height: 42px; }
}

.glass {
  background:
    linear-gradient(135deg, rgba(13,37,34,.76), rgba(2,14,15,.86)),
    radial-gradient(circle at 30% 0%, rgba(66,222,186,.08), transparent 48%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: none;
}
body.performance-lite .glass { backdrop-filter: none; }
body.performance-lite::before { display: none; }
body.performance-lite::after { box-shadow: inset 0 0 90px rgba(0,0,0,.52); background: none; }
body.performance-lite .brand-mark::after { animation: none; }

.dock-panel { --panel-z: 9; z-index: var(--panel-z); contain: layout paint; transition: width .18s ease, height .18s ease, box-shadow .18s ease; }
.dock-panel.panel-front { box-shadow: 0 30px 90px rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.06); }
.panel-handle {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  min-height: 32px; cursor: default; user-select: none;
  background: var(--hud-header);
}
.panel-handle:active, .dock-panel.panel-dragging .panel-handle { cursor: grabbing; }
.panel-handle:focus-visible { outline: 1px solid var(--mint); outline-offset: 4px; border-radius: 6px; }
.panel-title { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; flex: 1; min-width: 0; }
.panel-title > span, .panel-title > small { display: block; }
.panel-toggle {
  flex: 0 0 28px; width: 28px; height: 28px; margin-left: 10px; padding: 0;
  border: 1px solid rgba(98,244,226,.2); border-radius: 7px; color: var(--mint);
  background: rgba(98,244,226,.045); cursor: pointer; font-size: 17px; line-height: 1;
}
.panel-toggle:hover { border-color: rgba(98,244,226,.55); background: rgba(98,244,226,.11); }
.panel-chrome { margin: -8px -4px 10px; padding: 0 4px 8px; border-bottom: 1px solid var(--line); }
.panel-chrome > span { flex: 1; padding-left: 38px; color: var(--lime); font-size: var(--font-xs, 10px); font-weight: 700; letter-spacing: .2em; text-align: center; }
.tool-heading, .panel-chrome, .chronicle-title {
  background: var(--hud-header); border-bottom: 1px solid rgba(98,244,226,.18);
}
.tool-heading .panel-title { padding-left: 38px; }
.chronicle-title { position: relative; justify-content: flex-end; }
.chronicle-title > span:first-child { position: absolute; left: 50%; transform: translateX(-50%); }
.dock-panel.collapsed {
  width: min(180px, calc(100vw - 16px)) !important; height: 42px !important; min-height: 0 !important;
  max-height: 42px !important; padding: 6px 9px !important; overflow: hidden !important; border-radius: 9px !important;
}
.left-dock-stack .dock-panel.collapsed { width: 100% !important; }
.dock-panel.collapsed > :not(.panel-handle) { display: none !important; }
.dock-panel.collapsed .panel-handle { min-height: 28px; margin: 0; padding: 0; border: 0; }
.dock-panel.collapsed .panel-title small, .dock-panel.collapsed #chronicleBtn { display: none; }

.topbar {
  position: fixed;
  z-index: 10;
  top: 18px;
  left: 18px;
  right: 18px;
  height: 78px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-radius: 18px 18px 11px 11px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 270px; }
.brand-mark {
  position: relative; width: 46px; height: 46px; border: 1px solid rgba(98,244,226,.38); border-radius: 50%;
  display: grid; place-items: center; color: var(--lime); font-family: Georgia, serif; font-size: 23px;
  background: radial-gradient(circle, rgba(98,244,226,.12), transparent 68%);
  box-shadow: 0 0 20px rgba(98,244,226,.08), inset 0 0 24px rgba(199,255,114,.05);
}
.brand-mark::after { content: ''; position: absolute; inset: 7px; border: 1px dashed rgba(98,244,226,.32); border-radius: 50%; animation: brand-orbit 11s linear infinite; }
.brand strong { display: block; font-size: 15px; letter-spacing: .16em; }
.brand span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.home-button {
  display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 7px 8px;
  border: 1px solid rgba(98,244,226,.2); border-radius: 8px; color: #a9d9cf;
  background: rgba(98,244,226,.045); text-decoration: none; font-size: 9px; letter-spacing: .04em;
}
.home-button:hover, .home-button:focus-visible { color: var(--lime); border-color: rgba(199,243,106,.48); outline: none; background: rgba(199,243,106,.08); }
.home-button .home-label { margin: 0; color: inherit; font-size: inherit; letter-spacing: inherit; }
.world-stats { flex: 1; display: grid; grid-template-columns: repeat(8, minmax(62px, 1fr)); gap: 6px; margin: 0 12px; }
.stat-tile {
  min-width: 0; min-height: 52px; padding: 7px 9px; border: 1px solid rgba(98,244,226,.12); border-radius: 9px;
  color: var(--text); background: rgba(3,17,13,.38); text-align: left; cursor: pointer;
}
.stat-tile:hover, .stat-tile:focus-visible, .stat-tile[aria-expanded="true"] { outline: none; border-color: rgba(98,244,226,.42); background: rgba(98,244,226,.075); }
.world-stats span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .15em; }
.world-stats strong { display: block; max-width: 100%; margin-top: 5px; overflow: hidden; font-size: 14px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.stat-value-row { display: flex !important; align-items: center; gap: 5px; min-height: 19px; }
.stat-value-row strong { margin-top: 0; }
.trend-slot { position: static; display: inline-flex; align-items: center; font-style: normal; }
.trend-arrow { display: inline-block; font-size: 19px; font-weight: 850; line-height: 1; text-shadow: 0 0 9px currentColor; }
.trend-arrow.strong-up { color: #4dff92; transform: scale(1.18); }
.trend-arrow.up { color: #8ce6a6; }
.trend-arrow.steady { color: #8c9c95; }
.trend-arrow.down { color: #f68a73; }
.trend-arrow.strong-down { color: #ff4f5f; transform: scale(1.18); }
.icon-button {
  border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 9px;
  width: 36px; height: 36px; cursor: pointer; color: var(--muted); font-size: 18px;
}
.icon-button:hover { color: var(--lime); border-color: rgba(199,243,106,.35); }
.icon-button.active { color: #9ce8e0; border-color: rgba(84,199,223,.55); background: rgba(84,199,223,.1); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.analysis-button {
  height: 36px; padding: 0 13px; border: 1px solid rgba(112,225,172,.25); border-radius: 9px;
  background: rgba(112,225,172,.055); color: var(--mint); cursor: pointer; font-size: 10px;
}
.analysis-button:hover { border-color: rgba(112,225,172,.5); background: rgba(112,225,172,.1); }
.reset-button { border-color: rgba(255,128,108,.3); color: #ffb2a6; background: rgba(255,128,108,.055); }
.reset-button:hover { border-color: rgba(255,128,108,.62); background: rgba(255,128,108,.12); }
.pause-button { border-color: rgba(239,193,101,.34); color: #ffd889; background: rgba(239,193,101,.065); }
.pause-button:hover { border-color: rgba(239,193,101,.65); background: rgba(239,193,101,.13); }

.left-dock-stack {
  position: fixed; z-index: 9; top: var(--panel-top, 106px); left: 18px; width: var(--tools-width, 280px);
  bottom: 10px; max-height: none;
  display: flex; flex-direction: column; gap: 8px; overflow: auto; scrollbar-width: thin;
}
.left-dock-stack .dock-panel:not(.collapsed) { flex: 1 1 auto; min-height: 0; overflow: auto; }
.god-tools {
  position: relative; flex: 0 0 auto; width: 100%; max-height: none; overflow: hidden; padding: 16px; border-radius: 11px 24px 11px 11px;
}
.observation-tools {
  position: relative; flex: 0 0 auto; width: 100%; padding: 16px; border-radius: 11px; max-height: none; overflow: hidden;
}
.favorites-panel { margin: 10px 0; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); }
.favorites-heading { margin-bottom: 7px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.favorites-heading span { color: var(--lime); }
.favorites-list { display: grid; gap: 5px; max-height: 210px; overflow: auto; }
.favorites-list > p { margin: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.favorites-list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 3px 7px; padding: 7px; border: 1px solid rgba(98,244,226,.13); border-radius: 7px; color: var(--text); background: rgba(3,17,13,.45); text-align: left; cursor: pointer; }
.favorites-list button:hover { border-color: rgba(199,243,106,.42); background: rgba(199,243,106,.06); }
.favorites-list button span { display: flex; align-items: center; gap: 5px; min-width: 0; }
.favorites-list button span:nth-child(2) { justify-content: flex-end; }
.favorites-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.favorites-list small, .favorites-list b { color: var(--muted); font-size: 7px; font-weight: 600; }
.favorites-list em { grid-column: 1 / -1; overflow: hidden; color: #9eb7ad; font-size: 8px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.climate-legend {
  position: fixed; z-index: 8; top: var(--panel-top, 106px); right: calc(34px + var(--inspector-width, 350px));
  width: 218px; padding: 12px; border-radius: 12px;
}
.climate-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 8px; }
.climate-title .panel-title > span { color: var(--lime); font-size: 9px; letter-spacing: .18em; font-weight: 750; }
.climate-title .panel-title > small { color: var(--muted); font-size: 8px; }
.climate-content { display: grid; }
.climate-card { display: grid; gap: 2px; margin-top: 6px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,15,22,.68); }
.climate-card b { font-size: 10px; }
.climate-card span { color: #cddbd4; font-size: 9px; }
.climate-card small { color: var(--muted); font-size: 8px; line-height: 1.35; }
.climate-card.cold { border-left: 3px solid #69bfff; }
.climate-card.cold b { color: #8fd1ff; }
.climate-card.temperate { border-left: 3px solid #70e1ac; }
.climate-card.temperate b { color: #91edbd; }
.climate-card.warm { border-left: 3px solid #ff806d; }
.climate-card.warm b { color: #ff9d8d; }
.sex-split { display: block; margin-top: 2px; color: #a8c4b7; font-size: 8px; white-space: nowrap; }
.observation-action {
  width: 100%; display: grid; grid-template-columns: 30px 1fr; gap: 4px 9px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--mint);
  background: rgba(112,225,172,.055); text-align: left; cursor: pointer;
}
.observation-action > span { grid-row: 1 / 3; font-size: 20px; text-align: center; }
.observation-action strong { font-size: 11px; }
.observation-action small { color: var(--muted); font-size: 9px; }
.observation-action:hover { border-color: rgba(112,225,172,.5); background: rgba(112,225,172,.1); }
.climate-analysis-action { margin-top: 7px; color: #9fd9ff; border-color: rgba(105,191,255,.24); background: rgba(105,191,255,.055); }
.climate-analysis-action:hover { border-color: rgba(105,191,255,.52); background: rgba(105,191,255,.1); }
.overlay-select { display: grid; gap: 6px; margin-top: 8px; color: #b9c8c0; font-size: 10px; }
.overlay-select select {
  width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); background: #0c211a;
}
.tool-heading { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 14px; }
.tool-heading span, .chronicle-title span { color: var(--lime); font-size: 10px; letter-spacing: .2em; font-weight: 700; }
.tool-heading small { color: var(--muted); font-size: 10px; }
.tool { position: relative; width: 100%; min-height: 62px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 46px;
  align-items: center; gap: 9px; padding: 10px; margin: 7px 0; text-align: left;
  background: linear-gradient(120deg, rgba(255,255,255,.03), rgba(98,244,226,.012)); border: 1px solid var(--line); border-radius: 11px; cursor: pointer;
  transition: .18s ease;
}
.tool:hover:not(:disabled), .tool.active { transform: translateY(-2px); border-color: rgba(98,244,226,.5); background: rgba(98,244,226,.075); box-shadow: 0 10px 24px rgba(0,0,0,.18), inset 0 0 20px rgba(98,244,226,.025); }
.tool.primary { grid-template-columns: 38px 1fr; background: rgba(199,243,106,.09); border-color: rgba(199,243,106,.28); }
.tool:disabled { opacity: .42; cursor: not-allowed; }
.tool-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(199,243,106,.08); color: var(--lime); }
.tool strong { display: block; font-size: 12px; font-weight: 650; }
.tool small { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }
.tool-cost {
  justify-self: end; min-width: 42px; padding: 5px 6px; border: 1px solid rgba(199,243,106,.42);
  border-radius: 999px; color: #e5ff9d; background: rgba(199,243,106,.1);
  font-size: 9px; font-weight: 800; letter-spacing: .04em; text-align: center; white-space: nowrap;
}
.charge { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: #07120f; background: var(--lime); font-size: 11px; }
.tool-separator { height: 1px; background: var(--line); margin: 14px 4px; }
.toggle-row { display: flex; gap: 9px; align-items: center; padding: 7px 4px; color: #b9c8c0; font-size: 10px; cursor: pointer; }
.toggle-row input { accent-color: var(--lime); }
.camera-help { margin: 12px 4px 0; color: #65776e; font-size: 9px; line-height: 1.65; }

.inspector {
  position: fixed; z-index: 9; top: 106px; right: 18px; bottom: 10px; width: 300px; min-height: 0;
  max-height: none; overflow: auto; padding: 20px; border-radius: 18px 11px 11px 11px;
}
.inspector.inspector-empty { display: none; }
.empty-inspector { text-align: center; padding: 55px 16px; color: var(--muted); }
.empty-inspector h2 { color: var(--text); font-size: 16px; margin: 12px 0 7px; }
.empty-inspector p { font-size: 11px; line-height: 1.55; }
.scan-symbol { color: var(--mint); font-size: 44px; opacity: .75; }
.inspector-title { display: flex; align-items: center; gap: 11px; }
.inspector-title > div:nth-child(2) { flex: 1; min-width: 0; }
.inspector-title h2 { font-size: 15px; margin: 3px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creature-title { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 9px; align-items: center; }
.creature-title-actions { grid-column: 2; display: flex; gap: 5px; }
.follow-button {
  width: 34px; height: 34px; min-height: 34px; margin: 0; padding: 0; display: grid; place-items: center;
  border: 1px solid rgba(98,244,226,.26); border-radius: 8px; color: var(--mint); background: rgba(98,244,226,.055); cursor: pointer;
}
.follow-button span { font-size: 19px; line-height: 1; }
.follow-button:hover, .follow-button.active { border-color: rgba(199,243,106,.62); color: var(--lime); background: rgba(199,243,106,.11); }
.favorite-button.active { color: #ffd65f; }
.creature-preview { display: block; width: 76px; height: 58px; margin: 0; border: 1px solid rgba(98,244,226,.28); border-radius: 8px; background: #102c24; box-shadow: inset 0 0 12px rgba(2,9,11,.7); }
.creature-title { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.creature-preview-3d {
  position: relative; grid-column: 1 / 3; width: 100%; height: 178px; overflow: hidden;
  border: 1px solid rgba(211, 241, 161, .52); border-radius: 16px;
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 224, 149, .34), transparent 31%),
    radial-gradient(circle at 23% 62%, rgba(89, 211, 146, .22), transparent 36%),
    linear-gradient(155deg, #223b31 0%, #18352e 46%, #10241f 100%);
  box-shadow: inset 0 1px rgba(255,255,255,.18), inset 0 -28px 40px rgba(5, 18, 14, .34), 0 10px 24px rgba(37, 63, 39, .16);
}
.creature-preview-3d::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg, rgba(255,255,255,.08), transparent 34% 68%, rgba(132,255,215,.045));
}
.creature-preview-3d .creature-preview,
.creature-preview-3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: inherit; background: transparent; box-shadow: none; }
.creature-preview-3d-canvas { z-index: 1; display: block; }
.creature-preview-3d.is-ready .creature-preview { display: none; }
.creature-preview-badge {
  position: absolute; z-index: 3; top: 9px; left: 10px; padding: 4px 7px; border-radius: 999px;
  color: #f7f2cf; background: rgba(12, 30, 25, .66); border: 1px solid rgba(209, 244, 179, .3);
  font-size: 7px; font-weight: 800; letter-spacing: .14em; backdrop-filter: blur(7px);
}
.creature-preview-3d.has-error .creature-preview-badge { display: none; }
.creature-name-inline { display: flex; align-items: center; gap: 5px; min-width: 0; }
.creature-name-inline h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-edit-button { width: 25px; height: 25px; flex: 0 0 25px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; opacity: .66; }
.creature-name-inline:hover .name-edit-button, .name-edit-button:focus-visible { color: var(--mint); border-color: rgba(98,244,226,.28); background: rgba(98,244,226,.07); opacity: 1; }
.creature-name-form { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; }
.creature-name-form[hidden] { display: none; }
.creature-name-form input { min-width: 72px; flex: 1; height: 30px; padding: 6px 8px; border: 1px solid rgba(98,244,226,.42); border-radius: 7px; color: var(--text); background: rgba(2,14,15,.92); }
.creature-name-form button { width: 29px; height: 30px; padding: 0; border: 1px solid rgba(98,244,226,.28); border-radius: 7px; color: var(--mint); background: rgba(98,244,226,.06); cursor: pointer; font-size: 13px; }
.creature-name-form button:last-child { color: #d7aaa4; border-color: rgba(239,102,89,.2); }
.intent-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 7px; margin: 2px 0 7px; padding: 7px 8px 8px; border: 1px solid rgba(112,225,172,.13); border-radius: 8px; }
.intent-filters:has(input:checked) { opacity: 1; }
.intent-filters.disabled, .intent-filters:has(input:not(:checked)):not(:has(input:checked)) { opacity: .5; }
.intent-filters legend { padding: 0 4px; color: var(--muted); font-size: 7px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.intent-filters label { display: flex; align-items: center; gap: 5px; min-width: 0; color: #b9c8c0; font-size: 9px; cursor: pointer; }
.intent-filters input { accent-color: var(--lime); }
.intent-filters span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creature-filters { margin-top: 1px; border-color: rgba(98,244,226,.16); }
.creature-filters legend { color: rgba(152,210,196,.8); }
.plant-swatch {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  color: #83cf69; font-size: 24px; border: 1px solid rgba(112,225,172,.3);
  background: radial-gradient(circle at 50% 70%, rgba(112,225,172,.18), rgba(112,225,172,.035));
}
.eyebrow { color: var(--lime); font-size: 9px; font-weight: 700; letter-spacing: .18em; }
.inspector section { padding-top: 17px; margin-top: 17px; border-top: 1px solid var(--line); }
.inspector section h3 { margin: 0 0 12px; color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.section-label, .trait > div:first-child { display: flex; justify-content: space-between; font-size: 11px; }
.section-label span, .trait span { color: var(--muted); }
.meter, .mini-meter { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.06); }
.meter i, .mini-meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--lime)); transition: width .3s; }
.current-action { margin: 10px 0 0; color: var(--mint); font-size: 10px; }
.action-disclosure { width: 100%; display: flex; align-items: center; justify-content: space-between; text-align: left; cursor: pointer; }
.action-disclosure::after { content: '＋'; font-size: 14px; font-weight: 400; }
.action-disclosure[aria-expanded="true"]::after { content: '−'; }
.dominant-need { margin: 5px 0 0; color: #dce9df; font-size: 9px; }
.decision-reason { margin: 8px 0 0; padding: 8px 9px; border-left: 2px solid var(--mint); color: #9fb4aa; background: rgba(112,225,172,.035); font-size: 9px; line-height: 1.5; }
.pregnancy-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; padding: 8px 9px; border: 1px solid rgba(255,196,92,.35); border-radius: 8px; background: linear-gradient(90deg, rgba(255,174,55,.12), rgba(255,220,145,.035)); box-shadow: inset 0 0 18px rgba(255,196,92,.05); }
.pregnancy-status[hidden] { display: none; }
.pregnancy-status span { color: #ffc45c; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.pregnancy-status strong { color: #ffe0a3; font-size: 9px; font-weight: 600; text-align: right; }
.need-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.need-grid > div { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 5px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.02); }
.need-grid span, .need-grid strong { position: relative; z-index: 1; font-size: 8px; }
.need-grid span { color: var(--muted); }
.need-grid i { position: absolute; inset: auto 0 0; height: 2px; background: rgba(255,255,255,.05); }
.need-grid i b { display: block; width: 0; height: 100%; background: var(--mint); transition: width .3s; }
.need-grid > div:nth-child(1) i b { background: #54c7df; }
.need-grid > div:nth-child(2) i b { background: #ffc56f; }
.need-grid > div:nth-child(3) i b { background: #ff7fac; }
.need-grid > div:nth-child(4) i b { background: #9fae8d; }
.decision-blockers { margin-top: 7px; color: #758a80; font-size: 8px; line-height: 1.45; }
.decision-blockers summary { cursor: pointer; color: #a8b8b0; }
.decision-blockers p { margin: 5px 0; padding-left: 7px; border-left: 1px solid rgba(255,197,111,.35); }
.hydration-label { margin-top: 13px; }
.hydration-meter i { background: linear-gradient(90deg, #32789b, #54c7df, #9ce8e0); }
.mating-drive-label { margin-top: 13px; padding: 5px 6px; border: 1px solid transparent; border-radius: 6px; }
.mating-drive-meter i { background: linear-gradient(90deg, #7d3655, #dc648f, #ffafca); }

.creature-status h3 { margin: 14px 0 9px; }
.creature-status h3:first-child { margin-top: 0; }
.body-needs-heading {
  margin: 14px 0 9px !important; padding-top: 13px; border-top: 1px solid var(--line);
}
.creature-status .current-action { padding: 9px 10px; border: 1px solid rgba(112,225,172,.18); border-radius: 8px; background: rgba(112,225,172,.055); font-size: 12px; font-weight: 700; }
.rest-explanation { margin: 13px 0 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.rest-explanation strong { color: var(--text); }
.trait { margin: 11px 0; }
.mini-meter { height: 3px; margin-top: 6px; }
.trait-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.trait-grid div { background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
.trait-grid span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.trait-grid strong { display: block; margin-top: 4px; font-size: 11px; }
.color-genes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.color-genes div { position: relative; overflow: hidden; border-radius: 7px; padding: 8px; border: 1px solid var(--line); }
.color-genes div::before { content: ''; position: absolute; inset: 0; opacity: .1; pointer-events: none; }
.color-genes .red::before { background: #ee4349; }
.color-genes .yellow::before { background: #f6ce37; }
.color-genes .blue::before { background: #4174ee; }
.color-genes span, .color-genes strong { position: relative; display: block; font-size: 8px; }
.color-genes span { color: var(--muted); text-transform: uppercase; }
.color-genes strong { margin-top: 4px; font-size: 10px; }
.plant-meter i { background: linear-gradient(90deg, #6f7542, #46a55d, #8bd36b); }
.food-explanation { margin: 14px 1px 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.lineage { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: #b4c4bb; font-size: 10px; line-height: 1.6; }
.lineage > span { flex-basis: 100%; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.lineage button, .inline-link { padding: 4px 7px; border: 1px solid rgba(112,225,172,.2); border-radius: 6px; color: var(--mint); background: rgba(112,225,172,.04); cursor: pointer; font-size: 9px; }
.lineage button:hover, .inline-link:hover { background: rgba(112,225,172,.12); }
.family-separator { flex-basis: 100%; height: 1px; margin: 5px 0; background: var(--line); }
.life-timeline { display: grid; gap: 6px; }
.life-event { width: 100%; padding: 8px 9px; border: 0; border-left: 2px solid rgba(199,243,106,.42); color: #adbbb4; background: rgba(255,255,255,.025); text-align: left; }
.life-event:not(:disabled) { cursor: pointer; }
.life-event:not(:disabled):hover { background: rgba(112,225,172,.08); }
.life-event time { display: block; margin-bottom: 3px; color: #667b70; font-size: 8px; }
.life-event span { display: block; font-size: 9px; line-height: 1.4; }

.creature-heading h2 { margin-bottom: 4px; }
.identity-summary { display: flex; flex-wrap: wrap; gap: 4px 9px; color: var(--muted); font-size: 8px; }
.identity-summary span { white-space: nowrap; }
.identity-summary strong, .identity-sex { color: #d9e7de; font-weight: 700; }
.compact-status { padding-top: 12px !important; margin-top: 12px !important; }
.compact-status h3 { margin: 9px 0 6px; }
.compact-status .current-action { margin-top: 0; padding: 6px 8px; }
.compact-status .decision-reason { margin-top: 5px; padding: 5px 8px; line-height: 1.35; }
.need-row { margin-top: 7px; padding: 5px 6px; border: 1px solid transparent; border-radius: 7px; }
.need-row .section-label { font-size: 9px; }
.need-meter { position: relative; height: 7px; margin-top: 4px; overflow: visible; background: rgba(255,255,255,.08); }
.need-meter i { position: absolute; inset: 0 auto 0 0; background: #43b85d; transition: width .3s, background-color .3s; }
.threshold-marker { position: absolute; z-index: 2; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: rgba(244,248,241,.92); box-shadow: 0 0 3px rgba(0,0,0,.8); }
.threshold-marker.emergency-marker { width: 3px; margin-left: -1.5px; background: #f05d59; box-shadow: 0 0 4px rgba(240,93,89,.78); }
.threshold-marker.comfort-marker { width: 3px; margin-left: -1.5px; background: #efc66c; box-shadow: 0 0 4px rgba(239,198,108,.7); }
.threshold-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; margin: 5px 2px 0; color: #d8dfdb; font-size: 7px; }
.threshold-legend .emergency-legend { color: #f08078; }
.threshold-legend .comfort-legend { color: #cba95f; }
.core-traits { padding-top: 12px !important; margin-top: 12px !important; }
.compact-traits { gap: 5px; margin-top: 7px; }
.compact-traits div { min-height: 40px; padding: 6px 7px; }
.compact-traits span { font-size: 7px; }
.compact-traits strong { margin-top: 2px; font-size: 10px; }
.inspector section h3 small { float: right; color: #8da098; font-size: 8px; letter-spacing: 0; text-transform: none; }
.info-field { cursor: help; transition: border-color .18s, background .18s, transform .18s; }
.info-field:hover, .info-field:focus { outline: none; border-color: rgba(112,225,172,.42) !important; background: rgba(112,225,172,.07) !important; transform: translateY(-1px); }
.context-tooltip {
  position: fixed; z-index: 80; width: 250px; pointer-events: none; opacity: 0;
  padding: 10px 12px; border: 1px solid rgba(112,225,172,.28); border-radius: 9px;
  color: #dcebe2; background: rgba(5,17,13,.97); box-shadow: var(--shadow);
  font-size: 10px; line-height: 1.55; transition: opacity .13s;
}
.context-tooltip.visible { opacity: 1; }
.stat-details {
  position: fixed; z-index: 28; padding: 18px; border-radius: 13px; box-shadow: 0 18px 45px rgba(0,0,0,.5);
}
.stat-details h2 { margin: 5px 0 8px; font-family: Georgia, serif; font-size: 22px; font-weight: 400; }
.stat-details > strong { display: block; color: var(--mint); font-size: 24px; }
.stat-details p { margin: 8px 0; color: #c4d6cd; font-size: 11px; line-height: 1.45; }
.stat-details > small { display: block; color: var(--muted); font-size: 10px; line-height: 1.5; }
.stat-details-close { position: absolute; right: 8px; top: 6px; width: 36px; height: 36px; border: 0; color: var(--muted); background: transparent; font-size: 22px; cursor: pointer; }

.chronicle {
  position: fixed; z-index: 8; left: 50%; right: auto; bottom: 10px;
  width: min(700px, calc(100vw - var(--tools-width) - var(--inspector-width) - 76px));
  height: var(--chronicle-height); transform: translateX(-50%);
  min-height: 112px; padding: 12px 16px; border-radius: 11px 11px 18px 18px;
}
.chronicle-title { display: flex; justify-content: flex-end; align-items: center; }
.chronicle-title-actions { display: flex; align-items: center; gap: 7px; }
.chronicle-title b { color: var(--muted); font-size: 9px; font-weight: 500; }
.chronicle-title button { border: 0; background: none; padding: 3px; color: var(--muted); cursor: pointer; font-size: 9px; }
.chronicle-title button:hover, .chronicle-title button:hover b { color: var(--mint); }
.chronicle-title .panel-toggle { width: 28px; height: 28px; padding: 0; border: 1px solid rgba(98,244,226,.2); background: rgba(98,244,226,.045); color: var(--mint); font-size: 17px; }
.event-list { display: flex; gap: 9px; overflow-x: auto; overflow-y: hidden; margin-top: 10px; scrollbar-width: thin; }
.event-list > .event-card, .event-list > p { min-width: 180px; max-width: 240px; margin: 0; }
.event-card {
  display: block; width: 100%; padding: 9px 11px; border: 0; border-left: 2px solid var(--mint);
  background: rgba(255,255,255,.025); color: #acbdb4; font-size: 9px; line-height: 1.4; text-align: left;
}
.event-card time { display: block; color: #64776c; margin-bottom: 3px; }
.event-card span { display: block; }
.event-card small { display: block; margin-top: 7px; color: var(--mint); }
.event-card.navigable { cursor: pointer; }
.event-card.navigable:hover { background: rgba(112,225,172,.075); }
.event-card:disabled { opacity: 1; }
.event-birth { border-left-color: var(--lime); }
.event-death, .event-plant-death { border-left-color: var(--danger); }

.modal-layer { position: fixed; z-index: 30; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; display: grid; place-items: center; color: var(--text); background: rgba(1,8,6,.68); backdrop-filter: blur(7px); }
.modal-layer:not([open]) { display: none; }
.modal-layer::backdrop { background: transparent; }
.welcome-card { width: min(650px, calc(100vw - 40px)); padding: 42px; border-radius: 20px; }
.welcome-card h1 { margin: 10px 0 16px; font-family: Georgia, serif; font-weight: 400; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; }
.welcome-card h1 em { color: var(--lime); font-style: normal; }
.welcome-card > p { max-width: 560px; color: #a9bab1; line-height: 1.65; font-size: 13px; }
.welcome-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 26px 0; }
.welcome-rules div { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.welcome-rules b { display: block; color: var(--lime); font-size: 10px; }
.welcome-rules span { display: block; margin-top: 7px; font-size: 10px; color: #b7c6be; }
.cta { border: 0; border-radius: 10px; padding: 13px 20px; color: #09120e; background: var(--lime); font-weight: 750; font-size: 11px; letter-spacing: .05em; cursor: pointer; }
.cta:hover { filter: brightness(1.08); transform: translateY(-1px); }

.summary-dialog { width: min(600px, calc(100vw - 36px)); border-radius: 18px; padding: 30px; color: var(--text); }
.summary-dialog::backdrop { background: rgba(1,8,6,.72); backdrop-filter: blur(8px); }
.summary-dialog h2 { font-family: Georgia, serif; font-size: 30px; font-weight: 400; margin: 8px 0 20px; }
.dialog-close {
  position: sticky; z-index: 5; top: 12px; display: block; width: 36px; height: 36px;
  margin: 0 0 -36px auto; padding: 0; border: 0; background: rgba(3, 15, 15, .9);
  color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer;
}
.summary-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.summary-counts div { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 10px; }
.summary-counts b { color: var(--lime); margin-right: 6px; }
.summary-highlights { margin: 18px 0; max-height: 240px; overflow: auto; }
.summary-highlights p { border-left: 2px solid var(--mint); padding: 6px 12px; color: #b9c7c0; font-size: 10px; }

.data-dialog {
  width: min(900px, calc(100vw - 40px)); max-height: calc(100vh - 60px); overflow: auto;
  border-radius: 18px; padding: 28px; color: var(--text);
}
.data-dialog::backdrop { background: rgba(1,8,6,.78); backdrop-filter: blur(8px); }
.data-dialog h2 { margin: 6px 0 20px; font-family: Georgia, serif; font-size: 30px; font-weight: 400; }
.reset-dialog { width: min(560px, calc(100vw - 36px)); }
.reset-dialog > p { color: #b7c9c1; line-height: 1.65; }
.reset-dialog .reset-duration-note { padding: 9px 11px; border-left: 2px solid var(--amber); color: #d7cba8; background: rgba(255,211,107,.055); font-size: 10px; }
.reset-form { display: grid; gap: 9px; margin-top: 22px; }
.reset-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.reset-actions button { min-height: 40px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; color: #bdd2ca; background: rgba(255,255,255,.025); cursor: pointer; }
.reset-actions .reset-submit { border-color: rgba(255,128,108,.48); color: #ffe0da; background: rgba(127,35,30,.32); }
.reset-actions .reset-submit:disabled { opacity: .38; cursor: not-allowed; }
.dialog-toolbar { display: flex; justify-content: flex-end; margin: -48px 45px 20px 0; }
.dialog-toolbar label { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.dialog-toolbar select { margin-left: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #0c211a; }
.chronicle-full-list { display: grid; gap: 8px; max-height: 62vh; overflow: auto; padding-right: 5px; }
.chronicle-full-list .event-card { padding: 12px 14px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 8px; }
.chronicle-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.chronicle-pagination button { min-height: 34px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--mint); background: rgba(98,244,226,.05); cursor: pointer; }
.chronicle-pagination button:disabled { opacity: .35; cursor: default; }
.chronicle-pagination span { min-width: 90px; color: var(--muted); font-size: 9px; text-align: center; }
.empty-data { color: var(--muted); font-size: 11px; }
.statistics-range-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: -5px 0 16px; }
.statistics-range-row > span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.statistics-range-control { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: rgba(2,13,11,.55); }
.statistics-range-control button { min-width: 60px; min-height: 34px; padding: 7px 11px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 700; }
.statistics-range-control button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.statistics-range-control button.active { color: #04120e; border-color: rgba(143,255,209,.5); background: linear-gradient(135deg, var(--mint), #9fe6b8); box-shadow: 0 0 14px rgba(102,255,188,.18); }
.statistics-range-coverage { margin-left: auto; color: var(--muted); font-size: 8px; }
.analysis-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.analysis-cards div { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.analysis-cards span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.analysis-cards strong { display: block; margin-top: 7px; font-size: 12px; }
.analysis-series { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 4px 0 14px; }
.analysis-series-group { padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); }
.analysis-series-group h3 { margin: 0 0 7px; color: var(--mint); font-size: 9px; letter-spacing: .11em; text-transform: uppercase; }
.analysis-series-group > div { display: flex; flex-wrap: wrap; gap: 6px; }
.analysis-scale-info { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: -5px 0 12px; min-height: 14px; }
.analysis-scale-info span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; }
.analysis-scale-info i { width: 7px; height: 7px; border-radius: 50%; background: var(--series-color); }
.series-toggle {
  display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.02); cursor: pointer; font-size: 9px;
}
.series-toggle i { width: 9px; height: 9px; border-radius: 50%; background: var(--series-color); opacity: .35; }
.series-toggle.active { color: var(--text); border-color: color-mix(in srgb, var(--series-color) 55%, transparent); background: color-mix(in srgb, var(--series-color) 10%, transparent); }
.series-toggle.active i { opacity: 1; box-shadow: 0 0 8px var(--series-color); }
.chart-card { margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); }
.chart-card > div { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 10px; }
.chart-card > div span { color: var(--muted); }
.chart-card canvas { display: block; width: 100%; height: auto; border-radius: 8px; }
.chart-card i { display: inline-block; width: 10px; height: 2px; margin: 0 5px 3px 12px; }
.population-key { background: var(--mint); }
.biomass-key { background: var(--lime); }
.speed-key { background: var(--amber); }
.vision-key { background: #73a1ff; }
.analysis-note { color: var(--muted); font-size: 9px; line-height: 1.55; }
.interactive-chart { cursor: crosshair; touch-action: none; }
.climate-analysis-dialog { width: min(1120px, calc(100vw - 40px)); }
.climate-analysis-intro { max-width: 820px; margin: -10px 0 18px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.climate-zone-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.climate-zone-card { overflow: hidden; padding: 14px; border: 1px solid color-mix(in srgb, var(--zone-color) 38%, transparent); border-radius: 12px; background: linear-gradient(145deg, color-mix(in srgb, var(--zone-color) 9%, transparent), rgba(255,255,255,.018)); }
.climate-zone-card header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid color-mix(in srgb, var(--zone-color) 24%, transparent); }
.climate-zone-card header span { color: var(--zone-color); font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
.climate-zone-card header strong { font-size: 16px; }
.zone-vitals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 11px 0; }
.zone-vitals span { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; }
.zone-vitals b { display: block; margin-top: 3px; color: var(--text); font-size: 11px; text-transform: none; letter-spacing: 0; }
.climate-zone-card footer { color: #b8cbc1; font-size: 9px; }
.climate-comparison-table { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0 20px; }
.climate-metric-group { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.015); }
.climate-metric-group h3 { margin: 0 0 8px; color: var(--mint); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.climate-table-scroll { overflow-x: auto; }
.climate-metric-group table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8px; }
.climate-metric-group th, .climate-metric-group td { padding: 7px 6px; border-top: 1px solid rgba(125,170,151,.12); text-align: right; vertical-align: middle; }
.climate-metric-group thead th { border-top: 0; color: var(--zone-color, var(--muted)); font-size: 8px; }
.climate-metric-group th:first-child { width: 34%; color: var(--muted); text-align: left; font-weight: 500; }
.climate-metric-group td { position: relative; overflow: hidden; }
.climate-metric-group td::before { content: ''; position: absolute; z-index: 0; left: 3px; right: auto; bottom: 3px; width: var(--metric-width); height: 2px; border-radius: 2px; background: var(--zone-color); opacity: .65; }
.climate-metric-group td span { position: relative; z-index: 1; white-space: nowrap; }
.climate-chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 9px; }
.climate-chart-toolbar label { text-transform: uppercase; letter-spacing: .1em; }
.climate-chart-toolbar select { margin-left: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #0c211a; }
.climate-chart-card { margin-top: 8px; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 148px; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; background: #e9f2eb; color: #0b1713; padding: 10px 16px; border-radius: 9px; font-size: 10px; font-weight: 650; transition: .25s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.tool-hint { position: fixed; z-index: 12; left: 50%; top: 105px; transform: translateX(-50%); display: none; color: #122015; background: var(--lime); padding: 8px 14px; border-radius: 20px; font-size: 10px; box-shadow: var(--shadow); }
.tool-hint.visible { display: block; }

.topbar::after, .god-tools::after, .observation-tools::after, .inspector::after, .chronicle::after {
  content: ''; position: absolute; pointer-events: none; inset: 5px; border: 1px solid rgba(98,244,226,.035); border-radius: inherit;
}
.topbar::before { content: ''; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(98,244,226,.48), transparent); }
.icon-button, .analysis-button, .text-button, .dialog-close {
  box-shadow: inset 0 0 18px rgba(98,244,226,.018);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.icon-button:hover, .analysis-button:hover, .text-button:hover, .dialog-close:hover {
  border-color: rgba(98,244,226,.5); background: rgba(98,244,226,.075); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.24), inset 0 0 18px rgba(98,244,226,.035);
}
.stat-bar { background: rgba(1,10,11,.72); box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.stat-bar i { box-shadow: 0 0 9px color-mix(in srgb, var(--lime) 60%, transparent); }
.data-dialog { border-color: rgba(98,244,226,.24); background: linear-gradient(145deg, rgba(7,27,25,.98), rgba(2,12,14,.98)); box-shadow: 0 40px 120px rgba(0,0,0,.72), inset 0 1px rgba(255,255,255,.04); }
.context-tooltip { border-color: rgba(98,244,226,.3); background: rgba(2,14,15,.96); box-shadow: 0 16px 38px rgba(0,0,0,.46); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(2,11,12,.45); }
::-webkit-scrollbar-thumb { background: rgba(98,244,226,.22); border-radius: 10px; }
@keyframes brand-orbit { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Readability scale: "large" is the accessible default selected by app.js. */
:root[data-ui-size="compact"] {
  --topbar-height: 68px; --panel-top: 88px; --tools-width: 220px; --inspector-width: 280px; --chronicle-height: 112px;
  --font-tiny: 8px; --font-xs: 9px; --font-sm: 10px; --font-md: 12px; --font-lg: 14px;
}
:root[data-ui-size="standard"] {
  --topbar-height: 72px; --panel-top: 92px; --tools-width: 230px; --inspector-width: 295px; --chronicle-height: 112px;
  --font-tiny: 9px; --font-xs: 10px; --font-sm: 11px; --font-md: 13px; --font-lg: 15px;
}
:root[data-ui-size="large"] {
  --topbar-height: 78px; --panel-top: 98px; --tools-width: 250px; --inspector-width: 315px; --chronicle-height: 112px;
  --font-tiny: 10px; --font-xs: 11px; --font-sm: 12px; --font-md: 14px; --font-lg: 17px;
}
:root[data-ui-size="extra-large"] {
  --topbar-height: 84px; --panel-top: 104px; --tools-width: 280px; --inspector-width: 350px; --chronicle-height: 116px;
  --font-tiny: 11px; --font-xs: 12px; --font-sm: 13px; --font-md: 16px; --font-lg: 19px;
}

.topbar { top: 10px; left: 10px; right: 10px; height: var(--topbar-height); padding: 0 14px; border-radius: 14px 14px 9px 9px; }
.brand { min-width: var(--tools-width); }
.brand strong { font-size: var(--font-lg); }
.brand span, .world-stats span, .eyebrow { font-size: var(--font-tiny); }
.world-stats strong { font-size: var(--font-md); }
.icon-button { width: 42px; height: 42px; font-size: var(--font-lg); }
.analysis-button { min-height: 42px; padding: 0 15px; font-size: var(--font-xs); }
.god-tools { top: var(--panel-top); left: 10px; width: var(--tools-width); max-height: calc(100vh - var(--panel-top) - 10px); padding: 12px; }
.observation-tools {
  top: var(--panel-top); left: calc(20px + var(--tools-width)); width: var(--tools-width);
  max-height: calc(100vh - var(--panel-top) - 10px); padding: 12px;
}
.observation-action strong { font-size: var(--font-sm); }
.observation-action small, .overlay-select { font-size: var(--font-xs); }
.tool-heading span, .chronicle-title span, .tool-heading small { font-size: var(--font-xs); }
.tool { min-height: 54px; grid-template-columns: 34px minmax(0, 1fr) 42px; gap: 8px; padding: 8px; }
.tool.primary { grid-template-columns: 42px 1fr; }
.tool-icon { width: 32px; height: 32px; font-size: var(--font-md); }
.tool strong { font-size: var(--font-md); }
.tool small, .toggle-row, .camera-help { font-size: var(--font-xs); }
.toggle-row { min-height: 38px; line-height: 1.45; }
.charge { width: 25px; height: 25px; font-size: var(--font-xs); }
.inspector {
  top: var(--panel-top); right: 10px; bottom: 10px; width: var(--inspector-width); min-height: 0;
  max-height: none; padding: 16px;
}
.left-dock-stack .god-tools, .left-dock-stack .observation-tools { top: auto; left: auto; width: 100%; max-height: none; }
.empty-inspector h2, .inspector-title h2 { font-size: var(--font-lg); }
.empty-inspector p, .section-label, .trait > div:first-child, .lineage { font-size: var(--font-sm); }
.inspector section h3, .trait-grid span, .color-genes span, .color-genes strong, .life-event time { font-size: var(--font-tiny); }
.current-action, .dominant-need, .decision-reason, .decision-blockers, .food-explanation, .life-event span { font-size: var(--font-xs); }
.decision-reason { padding: 10px 11px; line-height: 1.6; }
.need-grid span, .need-grid strong { font-size: var(--font-tiny); }
.need-grid > div { min-height: 38px; padding: 9px; }
.decision-blockers summary { min-height: 30px; display: flex; align-items: center; }
.trait-grid div { min-height: 54px; padding: 10px; }
.trait-grid strong { font-size: var(--font-sm); }
.color-genes strong, .lineage button, .inline-link { font-size: var(--font-xs); }
.lineage button, .inline-link { min-height: 32px; padding: 6px 9px; }
.chronicle {
  left: 50%; right: auto;
  width: min(700px, calc(100vw - var(--tools-width) - var(--inspector-width) - 76px));
  height: var(--chronicle-height); padding: 10px 14px;
}
.chronicle-title b, .chronicle-title button, .event-card { font-size: var(--font-xs); }
.event-list { height: 52px; margin-top: 6px; }
.event-card { min-width: 180px; height: 50px; padding: 6px 9px; font-size: var(--font-tiny); line-height: 1.25; overflow: hidden; }
.event-card time { margin-bottom: 2px; }
.event-card span {
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.context-tooltip { width: 290px; padding: 12px 14px; font-size: var(--font-xs); }
.environment-swatch {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px;
  color: var(--mint); font-size: 25px; border: 1px solid rgba(98,244,226,.32);
  background: radial-gradient(circle, rgba(98,244,226,.14), rgba(98,244,226,.025));
  box-shadow: inset 0 0 20px rgba(98,244,226,.06), 0 0 18px rgba(98,244,226,.06);
}
.environment-description { margin: 0; color: #b8cbc2; font-size: var(--font-sm); line-height: 1.65; }
.environment-grid { grid-template-columns: 1fr; }
.display-dialog { width: min(720px, calc(100vw - 40px)); }
.display-dialog > p { color: #b8cbc2; font-size: var(--font-sm); line-height: 1.65; }
.display-dialog > h3 { margin: 22px 0 0; color: #d8eee6; font-size: var(--font-md); }
.display-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 22px; }
.graphics-options { grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.display-options button {
  min-height: 86px; padding: 16px; text-align: left; cursor: pointer; border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); background: rgba(255,255,255,.025);
}
.display-options button:hover, .display-options button.active { border-color: rgba(98,244,226,.62); background: rgba(98,244,226,.09); }
.display-options strong { display: block; color: var(--mint); font-size: var(--font-md); }
.display-options span { display: block; margin-top: 7px; color: var(--muted); font-size: var(--font-xs); }
.data-dialog, .summary-dialog { font-size: var(--font-sm); }
.core-traits-inline { margin-top: 9px; }
.core-traits-inline h3 { margin: 0 0 5px !important; }
.core-traits-inline .compact-traits { grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 0; }
.core-traits-inline .compact-traits div { min-height: 36px; padding: 5px 6px; }
.core-traits-inline .compact-traits span { font-size: 7px; line-height: 1.15; }
.core-traits-inline .compact-traits strong { margin-top: 2px; font-size: 10px; }
.analysis-cards span, .analysis-scale-info span, .series-toggle, .analysis-note, .dialog-toolbar label { font-size: var(--font-tiny); }
.analysis-cards strong, .chart-card > div, .summary-counts div, .summary-highlights p { font-size: var(--font-xs); }

@media (max-width: 1450px) {
  :root[data-ui-size] {
    --topbar-height: 76px; --panel-top: 96px; --tools-width: 220px; --inspector-width: 280px; --chronicle-height: 112px;
    --font-tiny: 9px; --font-xs: 10px; --font-sm: 11px; --font-md: 13px; --font-lg: 15px;
  }
  .topbar { padding: 0 14px; }
  .brand { min-width: 220px; }
  .world-stats {
    flex: 0 1 520px; display: grid; grid-template-columns: minmax(108px, 1.35fr) repeat(3, minmax(62px, 1fr));
    grid-template-rows: repeat(2, 32px); align-content: center; gap: 4px 12px; height: 68px; margin: 0 auto;
  }
  .stat-tile { min-width: 0; height: 32px; min-height: 0; overflow: hidden; padding: 2px 7px; }
  .stat-tile > span:first-child { font-size: 8px; line-height: 10px; }
  .stat-value-row { min-height: 15px; line-height: 15px; }
  .world-stats strong { margin-top: 0; font-size: 12px; line-height: 15px; }
  .trend-arrow { font-size: 16px; }
  .world-stats .sex-split { display: none; }

  .top-actions { gap: 5px; }
  .analysis-button { padding: 0 9px; }
  .climate-legend { width: 176px; padding: 8px; }
  .climate-card small { display: none; }
}

@media (max-width: 1000px) {
  .brand { min-width: 190px; }
  .world-stats { grid-template-columns: minmax(96px, 1.3fr) repeat(3, minmax(52px, 1fr)); }
  .world-stats div:nth-child(n + 5) { display: none; }
  .climate-legend { right: 18px; }
  .chronicle { right: auto; }
  .inspector { top: auto; bottom: 18px; width: min(var(--inspector-width), 42vw); max-height: calc(100vh - var(--panel-top) - 18px); overflow: auto; }
  .observation-tools { left: calc(26px + var(--tools-width)); }
}
@media (max-height: 700px) and (min-width: 1075px) {
  :root[data-ui-size] {
    --topbar-height: 70px; --panel-top: 88px; --tools-width: 220px; --inspector-width: 270px; --chronicle-height: 112px;
    --font-tiny: 9px; --font-xs: 10px; --font-sm: 11px; --font-md: 13px; --font-lg: 15px;
  }
  .topbar { left: 18px; right: 18px; }
  .left-dock-stack { top: var(--panel-top); bottom: 10px; max-height: none; }
  .god-tools { padding: 9px; }
  .god-tools .tool-heading { min-height: 24px; margin: 0 0 6px; }
  .god-tools .tool { width: 100%; min-height: 42px; margin: 4px 0 0; padding: 5px 7px; }
  .god-tools .tool small { display: none; }
  .god-tools .tool-icon { width: 28px; height: 28px; }
  .observation-tools { padding: 9px; }
  .inspector { padding: 13px; }
  .chronicle { bottom: 6px; }
}
@media (max-width: 1074px) {
  :root[data-ui-size] {
    --topbar-height: 64px;
    --panel-top: 80px;
    --tools-width: auto;
    --inspector-width: auto;
    --chronicle-height: auto;
    --font-tiny: 9px;
    --font-xs: 10px;
    --font-sm: 11px;
    --font-md: 13px;
    --font-lg: 16px;
  }

  .topbar {
    left: 6px; right: 6px; top: max(6px, env(safe-area-inset-top)); height: var(--topbar-height);
    gap: 7px; padding: 5px 7px; border-radius: 13px;
  }
  .brand { min-width: 76px; width: 76px; gap: 0; }
  .brand-mark { width: 34px; height: 34px; font-size: 17px; }
  .brand-mark::after { inset: 5px; }
  .brand-copy { display: none; }
  .home-button { margin-left: 4px; padding: 7px; }
  .home-button .home-label { display: none; }
  .world-stats {
    min-width: 0; flex: 1; display: grid; grid-template-columns: repeat(3, minmax(48px, 1fr));
    grid-template-rows: 1fr; gap: 4px; height: 48px; margin: 0;
  }
  .world-stats .stat-tile { height: 48px; min-height: 48px; padding: 5px 6px; border-radius: 8px; }
  .world-stats .stat-tile[data-stat-key="status"],
  .world-stats .stat-tile:nth-child(n + 5) { display: none; }
  .world-stats .stat-tile > span:first-child { font-size: 7px; line-height: 9px; letter-spacing: .08em; }
  .world-stats strong { font-size: 11px; line-height: 14px; }
  .world-stats .sex-split { display: none; }
  .trend-arrow { font-size: 14px; }
  .top-actions { flex-wrap: nowrap; gap: 4px; }
  .top-actions .icon-button { width: 36px; min-width: 36px; height: 36px; min-height: 36px; }
  #resetBtn, #pauseBtn { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; font-size: 17px; }
  #resetBtn span, #pauseBtn span { display: none; }
  #displayBtn {
    width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0;
    overflow: hidden; font-size: 0;
  }
  #displayBtn::before { content: '⚙'; font-size: 17px; }
  .parameters-button { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; }
  .parameters-button span { display: none; }
  .simulation-speed-controls button { min-width: 31px; height: 31px; }

  .left-dock-stack { display: contents; }
  .climate-legend { display: none; }
  .dock-panel,
  .dock-panel.collapsed {
    position: fixed !important; z-index: 22; left: 7px !important; right: 7px !important;
    top: auto !important; bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    width: auto !important; height: auto !important; min-height: 0 !important;
    max-height: min(68dvh, 620px) !important; margin: 0; padding: 14px !important;
    overflow: auto !important; border-radius: 18px 18px 12px 12px !important;
    transform: translateY(calc(100% + 96px)); opacity: 0; pointer-events: none;
    transition: transform .22s ease, opacity .18s ease;
    overscroll-behavior: contain;
  }
  .dock-panel.mobile-open {
    transform: translateY(0); opacity: 1; pointer-events: auto;
  }
  .god-tools, .observation-tools, .inspector, .chronicle { max-height: min(68dvh, 620px) !important; }
  .inspector.inspector-empty { display: none !important; }
  .chronicle { min-height: 150px !important; }
  .event-list { height: auto; min-height: 76px; padding-bottom: 3px; }
  .event-card { height: auto; min-height: 68px; }
  .camera-help { display: none; }
  .tool, .observation-action, .toggle-row, .overlay-select select { min-height: 48px; }
  .panel-toggle { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }

  .mobile-panel-scrim {
    position: fixed; z-index: 20; inset: 0; border: 0; background: rgba(0, 7, 8, .42);
    touch-action: manipulation;
  }
  .mobile-panel-scrim[hidden] { display: none; }
  .mobile-dock {
    position: fixed; z-index: 24; left: 7px; right: 7px; bottom: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px;
    min-height: 66px; padding: 6px 8px; padding-bottom: env(safe-area-inset-bottom);
    border-radius: 16px 16px 0 0;
  }
  .mobile-dock > button {
    min-width: 0; min-height: 58px; display: grid; place-items: center; align-content: center; gap: 3px;
    padding: 5px 2px; border: 0; border-radius: 10px; color: var(--muted); background: transparent;
  }
  .mobile-dock > button span { font-size: 20px; line-height: 1; }
  .mobile-dock > button strong { font-size: 9px; letter-spacing: .04em; }
  .mobile-dock > button.active { color: var(--lime); background: rgba(199,255,114,.1); }
  .mobile-dock > button:disabled { opacity: .34; }

  .welcome-card {
    width: calc(100vw - 20px); max-height: calc(100dvh - 20px); overflow: auto;
    padding: 24px 20px; border-radius: 17px;
  }
  .welcome-card h1 { font-size: clamp(27px, 9vw, 38px); }
  .welcome-card > p { font-size: 12px; }
  .welcome-rules { grid-template-columns: 1fr; gap: 6px; margin: 18px 0; }
  .welcome-rules div { padding: 10px 12px; }
  .touch-gesture-hint { font-size: 10px; }

  .data-dialog, .summary-dialog {
    width: 100vw; max-width: none; max-height: 100dvh; height: 100dvh;
    margin: 0; padding: max(48px, env(safe-area-inset-top)) 15px calc(18px + env(safe-area-inset-bottom));
    border-radius: 0;
  }
  .data-dialog h2, .summary-dialog h2 { margin-top: 2px; font-size: 25px; }
  .dialog-close { position: fixed; z-index: 2; top: max(8px, env(safe-area-inset-top)); right: 9px; width: 44px; height: 44px; }
  .dialog-toolbar { margin: 0 0 14px; justify-content: flex-start; }
  .dialog-toolbar label, .dialog-toolbar select { width: 100%; margin: 5px 0 0; }
  .analysis-cards, .analysis-series, .climate-zone-cards, .climate-comparison-table { grid-template-columns: 1fr; }
  .statistics-range-control { width: 100%; flex-wrap: wrap; overflow-x: visible; }
  .statistics-range-control button { flex: 1 1 58px; min-width: 58px; min-height: 42px; }
  .statistics-range-coverage { width: 100%; margin-left: 0; }
  .display-options, .graphics-options { grid-template-columns: 1fr; gap: 8px; }
  .display-options button { min-height: 72px; padding: 13px; }
  .climate-chart-toolbar, .chart-card > div { align-items: flex-start; flex-direction: column; }
  .climate-chart-toolbar select { width: 100%; margin: 6px 0 0; }
  .chart-card { width: 100%; min-width: 0; overflow-x: hidden; padding: 10px; }
  .chart-card canvas { width: 100%; min-width: 0; max-width: 100%; }

  .stat-details { left: 8px !important; right: 8px !important; top: 78px !important; width: auto !important; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); max-width: calc(100vw - 28px); text-align: center; }
  .tool-hint { top: 78px; width: calc(100vw - 28px); text-align: center; }
}

.tool.danger-tool:not(:disabled) { border-color: rgba(255, 99, 118, .35); }
.tool.danger-tool:not(:disabled):hover { background: rgba(112, 25, 38, .38); border-color: rgba(255, 99, 118, .72); }
.god-points-tile { border-color: rgba(255, 220, 123, .28); }
.death-analysis-section { margin: 18px 0; }
.death-analysis-section > h3 { margin: 0; font-size: .84rem; letter-spacing: .08em; text-transform: uppercase; color: #b9f9ed; }
.death-analysis-coverage { margin: -.25rem 0 .1rem; color: var(--muted); font-size: .72rem; }
.death-cause-cards > div { border-top: 2px solid var(--series-color); }
.death-chart-card { margin-top: 10px; }

.simulation-speed-controls {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid rgba(117, 242, 213, .22); border-radius: 10px;
  background: rgba(2, 16, 14, .72);
}
.simulation-speed-controls button {
  min-width: 34px; height: 34px; padding: 0 7px; border: 0; border-radius: 7px;
  color: var(--muted); background: transparent; font: 700 11px/1 inherit; cursor: pointer;
}
.simulation-speed-controls button:hover { color: var(--text); background: rgba(117, 242, 213, .08); }
.simulation-speed-controls button.active,
.simulation-speed-controls button[aria-pressed="true"] { color: #061b16; background: var(--mint); box-shadow: 0 0 16px rgba(117, 242, 213, .25); }
.parameters-dialog { width: min(1120px, calc(100vw - 34px)); max-height: min(92dvh, 980px); }
.parameters-dialog > p { max-width: 940px; color: var(--muted); line-height: 1.55; }
.parameter-scope-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 12px; }
.parameter-scope-legend span:first-child { color: var(--mint); }
.parameter-groups { display: grid; gap: 10px; margin: 18px 0; }
.parameter-group { border: 1px solid rgba(117, 242, 213, .16); border-radius: 12px; background: rgba(3, 18, 16, .56); overflow: clip; }
.parameter-group summary { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; color: #d8fff6; font-weight: 800; cursor: pointer; }
.parameter-group summary span { color: var(--muted); font-size: 11px; font-weight: 600; }
.parameter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 12px 14px; }
.parameter-field { display: grid; grid-template-columns: minmax(0, 1fr) 105px; gap: 5px 10px; align-items: center; padding: 11px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 9px; background: rgba(0, 8, 7, .42); }
.parameter-field > span { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; font-weight: 750; }
.parameter-field > span b { color: var(--mint); font-size: 8px; }
.parameter-field.new-world-only > span b { color: var(--muted); }
.parameter-field input { width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid rgba(117, 242, 213, .22); border-radius: 7px; color: var(--text); background: rgba(3, 18, 16, .96); font: 700 13px/1 inherit; }
.parameter-field input:focus { outline: 2px solid rgba(117, 242, 213, .45); border-color: var(--mint); }
.parameter-field small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; line-height: 1.35; }
.parameter-actions { position: sticky; bottom: -1px; display: flex; justify-content: flex-end; gap: 9px; padding: 14px 0 4px; background: linear-gradient(transparent, rgba(5, 20, 18, .98) 28%); }
.parameter-actions button { min-height: 44px; padding: 10px 15px; border-radius: 9px; font-weight: 800; cursor: pointer; }
.parameter-actions .secondary-action { border: 1px solid rgba(117, 242, 213, .28); color: var(--text); background: rgba(5, 31, 27, .94); }
.parameter-actions .primary-action { border: 1px solid var(--mint); color: #061b16; background: var(--mint); }
.form-status { min-height: 18px; margin: 7px 0 0; color: var(--muted); font-size: 11px; }

@media (max-width: 980px) {
  .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 700px) {
  .parameter-grid { grid-template-columns: 1fr; padding-inline: 8px; }
  .parameter-field { grid-template-columns: minmax(0, 1fr) 96px; }
  .parameter-actions { flex-direction: column; }
  .parameter-actions button { width: 100%; }
  .simulation-speed-controls button { min-width: 31px; height: 31px; }
  .parameters-button span { display: none; }
}

@media (max-width: 600px) {
  :root[data-ui-size] { --topbar-height: 112px; --panel-top: 126px; }
  .topbar {
    height: var(--topbar-height); display: grid; grid-template-columns: 76px minmax(0, 1fr);
    grid-template-rows: 48px 40px; align-content: center; gap: 4px 7px;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .world-stats { grid-column: 2; grid-row: 1; }
  .top-actions {
    grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: flex-start;
    flex-wrap: nowrap; gap: 3px; overflow-x: auto; scrollbar-width: none;
  }
  .top-actions::-webkit-scrollbar { display: none; }
  .top-actions .icon-button,
  #resetBtn, #pauseBtn, #displayBtn, .parameters-button {
    width: 32px; min-width: 32px; height: 32px; min-height: 32px;
  }
  .simulation-speed-controls { padding: 2px; }
  .simulation-speed-controls button { min-width: 27px; height: 27px; padding: 0 4px; }
  .stat-details, .tool-hint { top: 126px !important; }
}

@media (min-width: 1075px) {
  .mobile-dock, .mobile-panel-scrim { display: none !important; }
}

/* Cozy 2.5D diorama art direction. Presentation only; simulation authority remains server-side. */
body[data-art-direction="cozy-diorama"] {
  --bg: #d9d2ad;
  --panel: rgba(255, 249, 226, .91);
  --panel-strong: rgba(255, 250, 231, .98);
  --line: rgba(91, 99, 58, .24);
  --muted: #7a765d;
  --text: #39432e;
  --lime: #809b4c;
  --mint: #789b62;
  --amber: #ce8f3f;
  --danger: #b75745;
  --shadow: 0 18px 48px rgba(77, 59, 35, .22), 0 3px 9px rgba(77, 59, 35, .12);
  --hud-header: linear-gradient(90deg, rgba(108, 128, 65, .96), rgba(76, 105, 58, .96));
  color: var(--text);
  background: #d8d0aa;
  font-family: Nunito, "Avenir Next Rounded", "Segoe UI", system-ui, sans-serif;
}
body[data-art-direction="cozy-diorama"] #world {
  background: radial-gradient(circle at 52% 40%, #cfdca2, #9ca36f 58%, #606b4d);
}
body[data-art-direction="cozy-diorama"] .glass {
  background:
    linear-gradient(150deg, rgba(255, 252, 236, .95), rgba(240, 230, 194, .9)),
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.72), transparent 48%);
  border-color: rgba(89, 88, 54, .24);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.92);
}
body[data-art-direction="cozy-diorama"] .topbar {
  background: linear-gradient(180deg, rgba(255,251,231,.97), rgba(233,220,181,.94));
  border-bottom: 1px solid rgba(91, 81, 47, .28);
  box-shadow: 0 9px 26px rgba(76, 59, 30, .2), inset 0 -1px rgba(255,255,255,.66);
}
body[data-art-direction="cozy-diorama"] .brand-mark {
  color: #fff8df;
  background: radial-gradient(circle at 36% 28%, #a9c66c, #668640 62%, #45632f);
  border-color: rgba(73, 92, 47, .5);
  box-shadow: 0 5px 13px rgba(66, 83, 43, .25), inset 0 2px rgba(255,255,255,.38);
}
body[data-art-direction="cozy-diorama"] .brand-copy strong,
body[data-art-direction="cozy-diorama"] .inspector-title h2,
body[data-art-direction="cozy-diorama"] .empty-inspector h2,
body[data-art-direction="cozy-diorama"] .data-dialog h2 { color: #34442d; }
body[data-art-direction="cozy-diorama"] .brand-copy span,
body[data-art-direction="cozy-diorama"] .eyebrow,
body[data-art-direction="cozy-diorama"] .panel-title small,
body[data-art-direction="cozy-diorama"] .camera-help,
body[data-art-direction="cozy-diorama"] .analysis-note { color: #82765a; }
body[data-art-direction="cozy-diorama"] .stat-tile,
body[data-art-direction="cozy-diorama"] .analysis-button,
body[data-art-direction="cozy-diorama"] .icon-button,
body[data-art-direction="cozy-diorama"] .home-button {
  color: #465139;
  border-color: rgba(93, 92, 56, .2);
  background: rgba(255, 252, 234, .6);
  box-shadow: inset 0 1px rgba(255,255,255,.72);
}
body[data-art-direction="cozy-diorama"] .stat-tile:hover,
body[data-art-direction="cozy-diorama"] .analysis-button:hover,
body[data-art-direction="cozy-diorama"] .icon-button:hover,
body[data-art-direction="cozy-diorama"] .home-button:hover { background: rgba(255,255,246,.95); border-color: rgba(101,128,68,.45); }
body[data-art-direction="cozy-diorama"] .stat-tile > span:first-child,
body[data-art-direction="cozy-diorama"] .stat-tile small { color: #857a60; }
body[data-art-direction="cozy-diorama"] .stat-tile strong { color: #3d4c31; }
body[data-art-direction="cozy-diorama"] .tool-heading,
body[data-art-direction="cozy-diorama"] .panel-chrome {
  color: #fff9e6;
  background: var(--hud-header);
  border-color: rgba(64, 82, 45, .25);
  text-shadow: 0 1px rgba(44,58,31,.28);
}
body[data-art-direction="cozy-diorama"] .tool,
body[data-art-direction="cozy-diorama"] .observation-action,
body[data-art-direction="cozy-diorama"] .toggle-row,
body[data-art-direction="cozy-diorama"] .overlay-select,
body[data-art-direction="cozy-diorama"] .favorites-panel,
body[data-art-direction="cozy-diorama"] .inspector-section,
body[data-art-direction="cozy-diorama"] .event-card,
body[data-art-direction="cozy-diorama"] .chart-card,
body[data-art-direction="cozy-diorama"] .analysis-card,
body[data-art-direction="cozy-diorama"] .parameter-group,
body[data-art-direction="cozy-diorama"] .parameter-field {
  color: #414c35;
  border-color: rgba(94, 93, 57, .18);
  background: rgba(255, 252, 236, .58);
}
body[data-art-direction="cozy-diorama"] .tool:hover,
body[data-art-direction="cozy-diorama"] .observation-action:hover,
body[data-art-direction="cozy-diorama"] .event-card:hover { background: rgba(255,255,246,.94); border-color: rgba(105,133,68,.38); }
body[data-art-direction="cozy-diorama"] .tool.primary,
body[data-art-direction="cozy-diorama"] .primary-action,
body[data-art-direction="cozy-diorama"] .cta {
  color: #fffced;
  border-color: #617e40;
  background: linear-gradient(145deg, #89a758, #5d7b3d);
  box-shadow: 0 7px 16px rgba(76,101,48,.24), inset 0 1px rgba(255,255,255,.25);
}
body[data-art-direction="cozy-diorama"] .tool-icon { color: #708f48; background: rgba(126,153,82,.12); }
body[data-art-direction="cozy-diorama"] .tool-cost { color: #8a632d; background: rgba(217,164,79,.13); border-color: rgba(190,130,55,.2); }
body[data-art-direction="cozy-diorama"] .simulation-speed-controls {
  border-color: rgba(92,91,56,.23);
  background: rgba(248,241,213,.78);
}
body[data-art-direction="cozy-diorama"] .simulation-speed-controls button { color: #746e55; }
body[data-art-direction="cozy-diorama"] .simulation-speed-controls button[aria-pressed="true"] {
  color: #fffbea;
  background: #718f4a;
  box-shadow: 0 4px 10px rgba(70,91,45,.2);
}
body[data-art-direction="cozy-diorama"] input,
body[data-art-direction="cozy-diorama"] select,
body[data-art-direction="cozy-diorama"] textarea {
  color: #3f4934;
  border-color: rgba(91,91,55,.24);
  background: rgba(255,253,241,.94);
}
body[data-art-direction="cozy-diorama"] .tool-heading,
body[data-art-direction="cozy-diorama"] .panel-chrome {
  background: linear-gradient(135deg, #6e833f, #486d3b);
  border-bottom-color: rgba(72, 78, 43, .24);
  color: #fff8d9;
}
body[data-art-direction="cozy-diorama"] .tool-heading .panel-title,
body[data-art-direction="cozy-diorama"] .tool-heading .panel-title *,
body[data-art-direction="cozy-diorama"] .panel-chrome > :not(button),
body[data-art-direction="cozy-diorama"] .panel-chrome > :not(button) * {
  color: #fff8d9 !important;
  text-shadow: 0 1px 1px rgba(38, 56, 29, .44);
}
body[data-art-direction="cozy-diorama"] .tool-grid button:disabled {
  color: rgba(61, 69, 47, .62);
  opacity: .72;
}
body[data-art-direction="cozy-diorama"] .chronicle-title,
body[data-art-direction="cozy-diorama"] .chronicle-title > span,
body[data-art-direction="cozy-diorama"] .chronicle-title button {
  color: #fff8d9 !important;
  text-shadow: 0 1px 1px rgba(38, 56, 29, .44);
}
@media (min-width: 1100px) {
  body[data-art-direction="cozy-diorama"] { --inspector-width: 310px; }
}
body[data-art-direction="cozy-diorama"] dialog::backdrop { background: rgba(57, 55, 36, .5); backdrop-filter: blur(5px); }
body[data-art-direction="cozy-diorama"] .parameter-actions { background: linear-gradient(transparent, rgba(250,243,218,.98) 30%); }
body[data-art-direction="cozy-diorama"] .parameter-group summary,
body[data-art-direction="cozy-diorama"] .parameter-field > span { color: #435139; }
body[data-art-direction="cozy-diorama"] .need-bar,
body[data-art-direction="cozy-diorama"] .metric-bar { background: rgba(88,87,54,.13); }
body[data-art-direction="cozy-diorama"] .panel-toggle,
body[data-art-direction="cozy-diorama"] .dialog-close { color: #fff9e6; }

@media (max-width: 700px) {
  .cozy-zoom-controls { bottom: 74px; }
  .cozy-zoom-controls button { min-width: 42px; grid-template-columns: 1fr; padding: 6px 9px; }
  .cozy-zoom-controls strong { display: none; }
}
