:root {
  --bg: #0b1120;
  --surface: #131c31;
  --surface-2: #1b2640;
  --line: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #5eead4;
  --warn: #fbbf24;
  --danger: #fb7185;
  --violet: #a78bfa;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px calc(96px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

h1 { font-size: 1.1rem; margin: 0; letter-spacing: 0.02em; }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 0 12px;
  background: linear-gradient(var(--bg) 70%, transparent);
}

.status {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.status[data-tone="good"] { color: var(--accent); border-color: rgba(94, 234, 212, 0.35); }
.status[data-tone="warn"] { color: var(--warn); border-color: rgba(251, 191, 36, 0.35); }
.status[data-tone="busy"] { color: var(--violet); border-color: rgba(167, 139, 250, 0.35); }

.panes { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .panes { grid-template-columns: 1fr 1fr; } }

.pane {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.pane video, .pane canvas { width: 100%; height: 100%; display: block; object-fit: cover; }

.pane-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(11, 17, 32, 0.72);
  padding: 3px 8px;
  border-radius: 999px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.72rem;
  color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 16px; height: 0; border-top: 3px solid; }
.key-fork { width: 10px; height: 10px; border: none; background: var(--warn); transform: rotate(45deg); }
.key-chosen { border-color: #f472b6; }
.key-walked { border-color: var(--accent); }
.key-untried { border-top-style: dashed; border-color: var(--warn); }
.key-failed { border-top-style: dashed; border-color: var(--danger); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.stats div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.stats dt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 1.3rem; font-variant-numeric: tabular-nums; }

.target {
  display: block;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.target-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 5px;
}
.target input {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
}
.target input:focus { outline: none; }
.target input::placeholder { color: var(--muted); font-weight: 400; }
.target:focus-within { border-color: rgba(94, 234, 212, 0.5); }

.arrived {
  margin: 0 0 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(94, 234, 212, 0.22), var(--surface));
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

/* Anchored to a compass bearing, so it slides across as the phone turns. */
.marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transition: left 0.12s linear;
}
.marker-ring {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid var(--warn);
  background: rgba(11, 17, 32, 0.45);
  color: var(--warn);
  font-size: 1.7rem;
  line-height: 1;
}
.marker-label {
  max-width: 42vw;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(11, 17, 32, 0.82);
  color: var(--warn);
  font-size: 0.7rem;
  text-align: center;
}
.marker[data-state="aligned"] .marker-ring {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 18px rgba(94, 234, 212, 0.55);
}
.marker[data-state="aligned"] .marker-label { color: var(--accent); }

.survey-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge[data-tone="good"] { color: var(--accent); border-color: rgba(94, 234, 212, 0.4); }
.badge[data-tone="warn"] { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }

.survey {
  background: linear-gradient(160deg, rgba(94, 234, 212, 0.12), var(--surface));
  border: 1px solid rgba(94, 234, 212, 0.3);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.survey h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 14px 0 8px;
}
.survey-spoken { margin: 10px 0 0; font-size: 1.02rem; }
.survey-here { margin: 8px 0 0; font-size: 0.88rem; color: var(--muted); }

.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}
.option.is-pick { border-left-color: var(--danger); background: var(--surface-2); }
.option-direction { font-weight: 600; font-size: 0.82rem; }
.option-promise { font-size: 0.72rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.option p { grid-column: 1 / -1; margin: 0; font-size: 0.88rem; color: var(--muted); }
.option.is-pick p { color: var(--text); }
.option.is-pick .option-direction { color: #f472b6; }
.option[data-state="dead-end"], .option[data-state="loops-back"], .option[data-state="exhausted"] {
  border-left-color: var(--danger);
  opacity: 0.7;
}
.option[data-state="way-back"] { opacity: 0.6; }
.option-direction { text-transform: capitalize; }

.survey-actions { display: flex; gap: 8px; margin-top: 14px; }
.survey-actions button { padding: 10px; }
.ghost.danger-ghost { color: var(--danger); border-color: rgba(251, 113, 133, 0.45); }
.veto {
  grid-column: 1 / -1;
  justify-self: start;
  flex: none;
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
}
.option[data-state="ruled-out"] { border-left-color: var(--danger); opacity: 0.7; }

.dev { margin: 16px 0; color: var(--muted); font-size: 0.85rem; }
.dev summary { cursor: pointer; }
.dev p { margin: 8px 0; }
.dev label { display: block; margin-bottom: 4px; }
.dev input { width: 100%; margin-bottom: 10px; }

.actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(11, 17, 32, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

button {
  flex: 1;
  padding: 13px 10px;
  border-radius: 11px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
button:disabled { opacity: 0.45; cursor: progress; }
.primary { background: var(--accent); color: #042f2e; }
.danger { background: var(--danger); color: #4c0519; }
.ghost { background: transparent; color: var(--text); border-color: var(--line); }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  margin: 0;
  padding: 11px 14px;
  border-radius: 11px;
  background: #451a24;
  border: 1px solid var(--danger);
  color: #fecdd3;
  font-size: 0.88rem;
}

/* ---- Low vision ------------------------------------------------------------
   Kept as overrides so the base design is unchanged: everything a little
   larger, grey text a little brighter, nothing smaller than about 13px, clear
   focus rings, and tap targets big enough to hit without looking closely. */
:root { --muted: #b8c4d6; }
html { font-size: 115%; }

.stats dt, .target-label, .pane-label, .legend, .badge, .status,
.option-promise, .marker-label, .veto { font-size: max(0.8rem, 13px); }
.option-direction { font-size: 0.95rem; }
.option p, .survey-here { font-size: 0.95rem; }

.marker-ring { width: 76px; height: 76px; font-size: 2.3rem; border-width: 4px; }
.marker-label { font-size: 0.95rem; font-weight: 700; max-width: 60vw; padding: 6px 12px; }

button { min-height: 48px; }
.veto { min-height: 44px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.target:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .marker { transition: none; }
}
