:root {
  color-scheme: dark;
  --night: #05060d;
  --panel: rgba(13, 16, 30, 0.88);
  --panel-strong: rgba(19, 22, 39, 0.96);
  --line: rgba(225, 199, 116, 0.22);
  --line-bright: rgba(243, 210, 113, 0.48);
  --gold: #f2d172;
  --gold-soft: #b99c4d;
  --ink: #f8f4e8;
  --muted: #aeb3c6;
  --cyan: #75e8ff;
  --violet: #ad82ff;
  --magenta: #ff76c8;
  --green: #8ef5bd;
  --danger: #ff9eaa;
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 48% -10%, rgba(125, 77, 206, 0.22), transparent 36rem),
    repeating-radial-gradient(circle at 8% 32%, transparent 0 22px, rgba(242, 209, 114, 0.025) 23px 24px),
    var(--night);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button, .button-like { cursor: pointer; }

.aurora {
  position: fixed;
  width: 36rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  pointer-events: none;
}
.aurora-a { background: var(--cyan); top: 18%; left: -18rem; }
.aurora-b { background: var(--magenta); right: -20rem; bottom: -10rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 26px clamp(20px, 4vw, 64px) 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 6, 13, 0.8);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.4rem, 3vw, 2.3rem); font-weight: 650; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 4vw, 3rem); line-height: 1.06; margin-bottom: 10px; max-width: 22ch; }
h3 { margin-bottom: 0; font-size: 1.25rem; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.7rem; font-weight: 750; margin-bottom: 8px; }

.boundary, .variant, .save-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(242, 209, 114, 0.06);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }

.disclosure {
  margin: 18px clamp(20px, 4vw, 64px) 0;
  padding: 12px 16px;
  border: 1px solid rgba(117, 232, 255, 0.24);
  border-radius: 14px;
  color: #d9edf2;
  background: rgba(29, 60, 75, 0.18);
  font-size: 0.9rem;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 26px;
  padding: 24px clamp(20px, 4vw, 64px) 64px;
  max-width: 1600px;
  margin: 0 auto;
}

.rail {
  position: sticky;
  top: 112px;
  align-self: start;
  max-height: calc(100vh - 136px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress-card, .hero-card, .score-card, .detail-card, .export-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(20, 24, 42, 0.92), rgba(8, 10, 20, 0.94));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.025);
}

.progress-card { padding: 14px; border-radius: 14px; }
.progress-copy { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.84rem; }
.progress-copy strong { color: var(--ink); }
.progress-track { height: 5px; background: rgba(255,255,255,0.08); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--gold), var(--cyan), var(--violet)); transition: width 180ms ease; }

.field { display: grid; gap: 7px; color: var(--muted); font-size: 0.82rem; }
.field.compact input { background: rgba(255,255,255,0.045); }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 11px;
  background: rgba(5, 7, 15, 0.82);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus, button:focus-visible, .button-like:focus-visible { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(117,232,255,0.12); outline: none; }
textarea { resize: vertical; min-height: 116px; }

.filters { display: flex; flex-wrap: wrap; gap: 7px; }
button, .button-like {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--ink);
  padding: 9px 12px;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
button:hover, .button-like:hover { transform: translateY(-1px); border-color: var(--line-bright); background: rgba(242,209,114,0.09); }
button.gold { border-color: var(--line-bright); color: var(--gold); }
button.quiet { color: var(--muted); }
.chip { border-radius: 999px; padding: 6px 10px; font-size: 0.74rem; }
.chip.active { color: #11131c; background: var(--gold); border-color: var(--gold); }

.track-list { list-style: none; padding: 0 4px 18px 0; margin: 0; overflow: auto; display: grid; gap: 8px; }
.track-list button { width: 100%; text-align: left; padding: 11px 12px; background: rgba(255,255,255,0.025); border-color: transparent; display: grid; gap: 5px; }
.track-list button.active { border-color: var(--gold-soft); background: linear-gradient(100deg, rgba(242,209,114,0.12), rgba(117,232,255,0.045)); }
.track-list button.completed .queue-order::after { content: "✓"; color: var(--green); margin-left: 6px; }
.queue-order { color: var(--gold); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.queue-title { font-weight: 680; line-height: 1.2; }
.queue-meta { color: var(--muted); font-size: 0.75rem; }

.workspace { display: grid; gap: 18px; min-width: 0; }
.hero-card, .score-card, .detail-card, .export-card { border-radius: var(--radius); padding: clamp(18px, 3vw, 30px); }
.hero-card { position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; inset: auto -15% -75% 30%; height: 20rem; background: conic-gradient(from 90deg, transparent, rgba(117,232,255,0.13), rgba(173,130,255,0.15), rgba(242,209,114,0.13), transparent); filter: blur(30px); pointer-events: none; }
.track-kicker { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; color: var(--muted); font-size: 0.82rem; }
.section-title { color: var(--gold); font-weight: 680; }
.focus { color: var(--muted); line-height: 1.55; max-width: 74ch; }
.medical-boundary { padding: 12px 14px; margin: 16px 0; border: 1px solid rgba(255,158,170,0.32); border-radius: 12px; color: #ffd9de; background: rgba(116,28,48,0.17); font-size: 0.86rem; }
audio { width: 100%; margin: 16px 0 14px; position: relative; z-index: 1; }
.transport { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.shortcut-note { color: #777e94; font-size: 0.72rem; margin: 12px 0 0; }

.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.save-state.complete { color: var(--green); border-color: rgba(142,245,189,0.35); }
.rating-grid { display: grid; gap: 16px; }
.rating-row { display: grid; grid-template-columns: minmax(150px, 1fr) repeat(5, 42px); gap: 8px; align-items: center; }
.rating-label { color: #d9dcec; font-weight: 640; }
.rating-button { width: 42px; height: 38px; padding: 0; }
.rating-button.selected { color: #11131c; background: var(--gold); border-color: var(--gold); font-weight: 800; }
.rating-row.muted { opacity: 0.42; }

.decision-grid { display: grid; grid-template-columns: minmax(220px, 1fr) 1fr 1fr; gap: 14px; margin: 22px 0; align-items: end; }
.check { display: flex; gap: 9px; align-items: center; min-height: 44px; color: var(--muted); font-size: 0.83rem; }
.check input { width: 17px; height: 17px; accent-color: var(--gold); }
.score-actions { display: flex; justify-content: space-between; gap: 14px; align-items: center; color: var(--muted); font-size: 0.75rem; margin-top: 12px; }

.detail-card summary { cursor: pointer; color: var(--gold); font-weight: 700; }
pre { white-space: pre-wrap; word-break: break-word; line-height: 1.6; color: #d9dcec; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.82rem; }
.query-entry + .query-entry { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }
.query-entry h4 { color: var(--gold); margin: 0 0 10px; }

.export-card { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.export-card p { color: var(--muted); margin-bottom: 0; }
.export-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.export-status { min-height: 1.2em; color: var(--green) !important; font-size: 0.78rem; }

@media (max-width: 900px) {
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; }
  .track-list { max-height: 340px; }
  .decision-grid { grid-template-columns: 1fr; }
  .export-card { align-items: flex-start; flex-direction: column; }
  .export-actions { justify-content: flex-start; }
}

@media (max-width: 580px) {
  .boundary { white-space: normal; }
  .rating-row { grid-template-columns: repeat(5, 1fr); }
  .rating-label { grid-column: 1 / -1; }
  .card-heading { flex-direction: column; }
  .transport button { flex: 1 1 42%; }
}
