
:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #101a2a;
  --panel-2: #172235;
  --line: #29364c;
  --text: #eef5ff;
  --muted: #9ba9bc;
  --accent: #5eead4;
  --accent-2: #f97316;
  --good: #a3e635;
  --bad: #fb7185;
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #eef3f8;
  --line: #d6dee9;
  --text: #111827;
  --muted: #5d6b7c;
  --accent: #0f766e;
  --accent-2: #c2410c;
  --good: #4d7c0f;
  --bad: #be123c;
  --shadow: 0 16px 44px rgba(40, 54, 76, .13);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  letter-spacing: 0;
}
button, input, select { font: inherit; }
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
button.primary { background: var(--accent); color: #06211e; border-color: transparent; font-weight: 800; }
button.warn { background: var(--accent-2); color: #fff; border-color: transparent; }
button:disabled { opacity: .55; cursor: not-allowed; }
.shell { min-height: 100vh; }
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), var(--panel) 34%);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 900; font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.score-pill, .status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.hero {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: clamp(32px, 7vw, 72px) 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: 28px;
  align-items: center;
}
.hero h1 { margin: 0; font-size: clamp(44px, 8vw, 86px); line-height: .96; letter-spacing: 0; }
.hero p { color: var(--muted); font-size: 20px; max-width: 520px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.path-panel, .card, .side, .modal-body {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.path-panel { padding: 18px; }
.path-title { color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: 12px; margin-bottom: 12px; }
.node { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.node:first-of-type { border-top: 0; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel-2); }
.node.done .dot { background: var(--good); border-color: var(--good); }
.node.current .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent), transparent 78%); }
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  width: min(1180px, calc(100vw - 32px));
  margin: 22px auto;
}
.side { padding: 16px; align-self: start; position: sticky; top: 84px; }
.main { min-width: 0; }
.card { padding: clamp(18px, 3vw, 28px); }
.card h2 { margin: 0 0 8px; font-size: 28px; }
.muted { color: var(--muted); }
.progress { width: 100%; height: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--good)); }
.challenge-space { margin-top: 18px; display: grid; gap: 16px; justify-items: start; }
.pulse-button, .reaction-button {
  width: min(100%, 360px);
  height: 160px;
  font-size: 22px;
  font-weight: 900;
}
.pulse-button.glow, .reaction-button.ready {
  background: var(--accent);
  color: #06211e;
  box-shadow: 0 0 36px color-mix(in srgb, var(--accent), transparent 35%);
}
.rotate-wrap { width: min(100%, 460px); display: grid; gap: 14px; }
.rotate-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  overflow: hidden;
}
.rotate-frame img { max-width: 82%; max-height: 82%; object-fit: contain; transition: transform .18s ease; }
.step-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
input[type="range"] { width: 100%; min-height: 44px; }
.target-board {
  width: min(100%, 680px);
  aspect-ratio: 640 / 380;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  overflow: hidden;
  touch-action: manipulation;
}
.target-board svg { width: 100%; height: 100%; display: block; }
.message { min-height: 28px; color: var(--muted); font-weight: 700; }
.grid { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.stat b { display: block; font-size: 24px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .62);
  z-index: 50;
}
.modal.open { display: grid; }
.modal-body { width: min(560px, 100%); padding: 22px; }
.mobile-menu { display: none; }
@media (max-width: 780px) {
  .topbar { height: auto; min-height: 64px; padding: 10px 14px; align-items: flex-start; }
  .top-actions { display: none; width: 100%; }
  .topbar.menu-open .top-actions { display: flex; }
  .mobile-menu { display: inline-flex; }
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero h1 { font-size: 48px; }
  .layout { grid-template-columns: 1fr; width: min(100vw - 24px, 720px); }
  .side { position: static; display: none; }
  .side.open { display: block; }
  .stats, .form-grid { grid-template-columns: 1fr; }
  .card h2 { font-size: 24px; }
  .step-grid { grid-template-columns: repeat(2, 1fr); }
  .pulse-button, .reaction-button { height: 132px; }
}
