:root {
  --bg: #dbeafe;
  --card: rgba(255, 255, 255, 0.93);
  --ink: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --accent-hi: #3b82f6;
  --border: rgba(15, 23, 42, 0.14);
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink); background: var(--bg); user-select: none;
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.hud.top {
  position: fixed; top: 10px; left: 12px; right: 320px; z-index: 10;
  display: flex; align-items: center; justify-content: flex-start; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 {
  margin: 0; font-size: 16px; font-weight: 800;
  background: var(--card); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.chip {
  font-size: 12px; font-weight: 700; color: #fff; background: var(--accent);
  padding: 5px 10px; border-radius: 999px;
}
.right { display: flex; align-items: center; gap: 8px; }
.steps { display: flex; gap: 5px; }
.step-btn {
  width: 28px; height: 28px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--ink); font-weight: 700; font-size: 12px; cursor: pointer;
}
.step-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-btn.done { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.goal-card {
  position: fixed; top: 54px; left: 12px; width: 345px; z-index: 9; padding: 10px 12px;
}
.goal-card p { margin: 0; font-size: 13px; line-height: 1.35; }
.goal-card .formula {
  margin-top: 5px; font-size: 11.5px; font-weight: 700; color: var(--accent);
  background: #eff6ff; padding: 4px 8px; border-radius: 8px; display: inline-block;
}
.readout {
  position: fixed; top: 108px; right: 12px; width: 248px; z-index: 9; padding: 10px 12px;
}
.readout .row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; margin-bottom: 6px;
}
.meter-row {
  display: grid; grid-template-columns: 64px 1fr 44px; align-items: center;
  gap: 6px; font-size: 12px;
}
.meter { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.fill { display: block; height: 100%; width: 0%; transition: width 0.35s ease; border-radius: 999px; }
.fill.blue { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.fill.warn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.fill.bad { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.legend { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; color: var(--muted); }
.legend span { background: #f1f5f9; padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.status {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 118px; z-index: 10;
  margin: 0; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(15, 23, 42, 0.92); color: #fff; max-width: 780px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.status.show { opacity: 1; }
.status.ok { background: rgba(21, 128, 61, 0.95); }
.status.bad { background: rgba(185, 28, 28, 0.95); }
.dock {
  position: fixed; left: 12px; right: 12px; bottom: 10px; z-index: 10;
  padding: 9px 12px; display: grid; grid-template-columns: 1fr auto;
  grid-template-areas: "ctrl act" "how how"; gap: 6px 12px; align-items: center;
}
.controls-area { grid-area: ctrl; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions { grid-area: act; display: flex; gap: 8px; }
.howto { grid-area: how; margin: 0; font-size: 11.5px; color: var(--muted); }
.choice-btn, .mail-card, .shift-box {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 12.5px;
}
.choice-btn { cursor: pointer; font-weight: 700; }
.choice-btn:hover { border-color: var(--accent); background: #eff6ff; }
.choice-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.shift-box button {
  width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border);
  background: #f8fafc; font-weight: 800; cursor: pointer;
}
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hi); }
.btn.ghost { background: var(--card); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(15, 23, 42, 0.56);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.overlay[hidden] { display: none; }
.modal { max-width: 520px; width: 100%; padding: 20px 22px; text-align: center; }
.modal h2 { margin: 0 0 8px; font-size: 21px; }
.modal p { margin: 0 0 14px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.modal .fact {
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a;
  padding: 9px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
}
.loading {
  position: fixed; inset: 0; z-index: 30; background: #dbeafe;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.loading[hidden] { display: none; }
.load-bar { width: 240px; height: 10px; background: rgba(15,23,42,0.14); border-radius: 999px; overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }
@media (prefers-reduced-motion: reduce) {
  .fill, .status, .load-bar i { transition: none; }
}
