:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #202a27;
  --muted: #78827e;
  --line: #e5ebe7;
  --green: #39866a;
  --green-soft: #e4f1eb;
  --blue: #668da8;
  --shadow: 0 8px 28px rgba(32, 50, 42, .055);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, select { font: inherit; }
.app-shell { max-width: 760px; margin: 0 auto; min-height: 100vh; padding: 20px 16px 100px; }
.topbar { display:flex; justify-content:space-between; align-items:center; margin: 8px 2px 20px; }
h1 { font-size: 29px; margin: 3px 0 0; letter-spacing:-1px; }
h2 { font-size: 17px; margin: 4px 0 0; }
.eyebrow { color:var(--muted); font-size:9px; font-weight:800; letter-spacing:1.35px; }
.world-state { font-size:11px; color:var(--muted); display:flex; align-items:center; gap:7px; background:#fff; border:1px solid var(--line); border-radius:30px; padding:8px 11px; }
.live-dot { width:7px; height:7px; border-radius:50%; background:#55a77c; }
.live-dot.paused { background:#d4a14f; }
.overview { display:grid; grid-template-columns:repeat(3,1fr); gap:9px; margin-bottom:12px; }
.metric { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:13px 12px; box-shadow:var(--shadow); }
.metric span { display:block; font-size:10px; color:var(--muted); margin-bottom:7px; }
.metric strong { font-size:22px; font-weight:750; letter-spacing:-.7px; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:17px; padding:15px; margin-bottom:12px; box-shadow:var(--shadow); }
.section-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:13px; }
.icon-button { border:1px solid var(--line); background:#fff; color:var(--ink); width:34px; height:34px; border-radius:10px; font-size:20px; }
.map-wrap { width:100%; background:#f8faf8; border:1px solid #e7ede9; border-radius:11px; padding:5px; }
canvas { display:block; width:100%; height:auto; aspect-ratio:1; image-rendering:pixelated; touch-action:manipulation; }
.legend { display:flex; gap:16px; flex-wrap:wrap; padding:12px 2px 0; color:var(--muted); font-size:10px; }
.legend span { display:flex; align-items:center; gap:6px; }
.legend-dot { display:inline-block; width:8px; height:8px; border-radius:3px; }
.creature-dot { background:#43866b; border-radius:50%; }
.plant-dot { background:#a5bf78; }
.empty-dot { background:#e7ece8; border:1px solid #d9e1dc; }
.control-row { display:flex; align-items:center; gap:10px; }
.primary-button { border:0; background:var(--green); color:white; padding:11px 18px; border-radius:10px; font-weight:700; flex:1; }
.speed-control { display:flex; align-items:center; gap:8px; font-size:11px; color:var(--muted); }
select { border:1px solid var(--line); background:#fff; border-radius:9px; padding:9px; color:var(--ink); }
.hint { color:var(--muted); font-size:10px; line-height:1.5; margin:11px 0 0; }
.tag { background:var(--green-soft); color:var(--green); padding:5px 8px; border-radius:7px; font-size:10px; font-weight:700; }
.empty-state { color:var(--muted); font-size:11px; line-height:1.55; padding:6px 0; }
.detail-content { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; }
.stat-cell { background:#f7f9f7; border:1px solid #edf1ee; padding:10px; border-radius:10px; }
.stat-cell span { display:block; color:var(--muted); font-size:9px; margin-bottom:5px; }
.stat-cell strong { font-size:15px; }
.hidden { display:none !important; }
.log-list { display:flex; flex-direction:column; gap:0; }
.log-entry { padding:10px 0; border-bottom:1px solid #edf1ee; font-size:11px; line-height:1.45; }
.log-entry:last-child { border-bottom:0; }
.log-meta { color:var(--muted); font-size:9px; margin-bottom:3px; }
.text-button { background:none; border:0; color:var(--green); font-size:10px; font-weight:700; }
.bottom-nav { position:fixed; z-index:5; bottom:0; left:0; right:0; display:flex; justify-content:center; gap:0; padding:9px max(10px, calc((100vw - 760px)/2)) calc(9px + env(safe-area-inset-bottom)); background:rgba(255,255,255,.94); border-top:1px solid var(--line); backdrop-filter:blur(12px); }
.nav-item { flex:1; max-width:150px; border:0; background:none; color:#98a19c; font-size:9px; display:flex; flex-direction:column; align-items:center; gap:3px; padding:4px; }
.nav-item span { font-size:18px; line-height:1; }
.nav-item.active { color:var(--green); font-weight:800; }
.toast { position:fixed; left:50%; bottom:82px; transform:translate(-50%,10px); opacity:0; pointer-events:none; background:#26332d; color:white; padding:9px 13px; border-radius:9px; font-size:11px; transition:.2s; z-index:10; }
.toast.show { opacity:1; transform:translate(-50%,0); }
@media (min-width:650px) { .app-shell { padding-top:30px; } .overview { gap:12px; } .metric { padding:16px; } }

.predator-dot { background:#b5523f; border-radius:50%; }
.history { width:100%; height:auto; aspect-ratio:700/160; background:#f8faf8; border:1px solid #e7ede9; border-radius:10px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.chip { border:1px solid var(--line); background:#fff; color:var(--muted); border-radius:20px; padding:5px 10px; font-size:10px; }
.chip.active { background:var(--green-soft); color:var(--green); border-color:var(--green-soft); font-weight:700; }
.primary-button:disabled, select:disabled { opacity:.5; }
