:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #141416;
  --raised: #1c1c20;
  --line: #303037;
  --text: #f4f1ea;
  --muted: #a9a6ae;
  --accent: #d6ff6b;
  --blue: #8fd7ff;
  --danger: #ffaaaa;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
.review-panel { margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--line); }
.review-panel canvas { width: 100%; height: auto; margin: 14px 0 6px; border-radius: 10px; cursor: crosshair; }
.audio-offset { display: flex; gap: 12px; align-items: center; margin: 14px 0 6px; font-size: 0.875rem; }
.audio-offset input { width: 90px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--raised); color: var(--text); }
.review-events { display: grid; gap: 8px; margin-top: 16px; font-size: 0.875rem; }
.review-event { display: grid; gap: 4px; padding: 12px; text-align: left; color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: 10px; }
.review-event span { color: var(--muted); font-size: 0.8rem; }
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
a {
  color: var(--accent);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2 {
  font-size: 1.25rem;
  line-height: 1.4;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 1rem;
  line-height: 1.5;
}
p {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.muted,
.help {
  color: var(--muted);
  font-size: 0.875rem;
}
.topbar {
  min-height: 76px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  letter-spacing: -0.035em;
  font-weight: 750;
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #171810;
  border-radius: 7px;
  width: 32px;
  height: 32px;
  font-size: 1.7rem;
  line-height: 1;
}
.tag {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.07em;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.local-label {
  font-size: 0.875rem;
  color: var(--muted);
}
.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 320px;
  min-height: calc(100vh - 77px);
  max-width: 1700px;
  margin: auto;
}
.library-panel,
.practice-panel,
.results-panel {
  min-width: 0;
  padding: 26px 22px;
}
.library-panel {
  border-right: 1px solid var(--line);
}
.results-panel {
  border-left: 1px solid var(--line);
  background: var(--panel);
}
.practice-panel {
  padding: 26px 28px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.count {
  color: var(--muted);
  font-size: 0.875rem;
  border: 1px solid var(--line);
  padding: 1px 8px;
  border-radius: 6px;
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.9375rem;
  font-weight: 600;
  background: var(--raised);
  color: var(--text);
  text-decoration: none;
}
.button:hover:not(:disabled) {
  border-color: var(--muted);
}
.primary {
  background: var(--accent);
  color: #171a10;
  border-color: var(--accent);
}
.secondary {
  background: transparent;
}
.file-button {
  position: relative;
  cursor: pointer;
}
.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-button:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.library-panel > .button {
  width: 100%;
  margin-bottom: 10px;
}
.library-panel > .help {
  margin: 8px 0 25px;
}
.text-button {
  border: 0;
  padding: 10px 0;
  background: none;
  color: var(--accent);
  font-size: 0.875rem;
  text-align: left;
}
.text-button:hover {
  text-decoration: underline;
}
.storage-note {
  color: var(--muted);
  font-size: 0.8125rem;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}
.session-list {
  display: grid;
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
}
.session-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  width: 100%;
}
.session-item.active {
  border-color: var(--accent);
  background: #d6ff6b0a;
}
.session-item img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 5px;
}
.session-item b {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
  font-weight: 500;
}
.session-item span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.12em;
  margin-bottom: 7px;
}
.session-header h2 {
  font-size: 1.5rem;
  overflow-wrap: anywhere;
  margin-bottom: 5px;
}
.badge {
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 4px 8px;
  background: var(--raised);
  border-radius: 5px;
  color: var(--muted);
}
.empty-state {
  min-height: 410px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  gap: 16px;
  padding: 35px 20px;
  background: linear-gradient(145deg, #161618, #0e0e10);
}
.empty-state h3 {
  font-size: 1.3rem;
}
.empty-state p {
  color: var(--muted);
  font-size: 0.9375rem;
}
.empty-lines {
  width: 66px;
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  transform: rotate(-35deg);
}
.empty-lines span {
  height: 3px;
  background: var(--accent);
}
.empty-lines span:nth-child(2) {
  opacity: 0.6;
}
.empty-lines span:nth-child(3) {
  opacity: 0.25;
}
.stage {
  position: relative;
  width: 100%;
  background: #060607;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.stage video {
  width: 100%;
  height: auto;
  display: block;
  max-height: 480px;
  object-fit: contain;
}
.stage canvas {
  position: absolute;
  pointer-events: none;
  touch-action: none;
}
.stage.seeding canvas {
  pointer-events: auto;
  cursor: crosshair;
}
.stage-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  background: #141416d9;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  pointer-events: none;
}
.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 24px;
}
.icon-button {
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.875rem;
  min-width: 52px;
  min-height: 40px;
}
.time {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
input[type="range"] {
  min-width: 0;
  flex: 1;
  accent-color: var(--accent);
}
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.7fr 0.7fr;
  gap: 12px;
  margin-bottom: 22px;
}
.setup-grid label {
  font-size: 0.875rem;
  color: var(--muted);
}
select,
input[type="number"] {
  width: 100%;
  min-height: 42px;
  display: block;
  padding: 8px 10px;
  margin-top: 5px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
}
.seed-panel {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 16px;
  margin-bottom: 20px;
}
.seed-panel .section-title {
  margin-bottom: 8px;
}
.seed-panel .text-button {
  padding: 0;
}
.seed-panel > p:not(.help) {
  font-size: 0.875rem;
  min-height: 42px;
  margin-bottom: 12px;
}
.seed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.small {
  font-size: 0.875rem;
  min-height: 40px;
  padding: 7px 10px;
}
.small span {
  font-family: ui-monospace, monospace;
  color: var(--muted);
  font-size: 0.75rem;
}
.small[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.analysis-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.check {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.875rem;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
}
.progress-wrap {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--muted);
}
progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}
.advanced {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 0.875rem;
}
.advanced summary {
  cursor: pointer;
  color: var(--muted);
  padding: 6px 0;
}
.advanced p {
  margin-top: 12px;
  color: var(--muted);
}
.advanced ol {
  padding-left: 20px;
}
.advanced li {
  margin: 10px 0;
}
.inline {
  display: inline;
  padding: 0;
}
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
}
.danger {
  color: var(--danger);
}
.result-summary {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-bottom: 20px;
}
.metric-list {
  display: grid;
  gap: 12px;
}
.metric {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.metric > span {
  font-size: 0.875rem;
  color: var(--muted);
}
.metric strong {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 1.75rem;
  font-weight: 500;
  margin: 8px 0 3px;
  line-height: 1.3;
}
.metric p {
  font-size: 0.8125rem;
  color: var(--muted);
}
.metric .status {
  display: inline-block;
  color: var(--accent);
  font-size: 0.75rem;
  margin-left: 8px;
}
.metric.unknown .status {
  color: var(--muted);
}
#traceSection,
#momentsSection {
  margin-top: 25px;
}
#traceCanvas {
  width: 100%;
  height: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.chart-note {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}
#moments {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}
.moment {
  padding: 12px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.875rem;
  text-align: left;
}
.moment b {
  color: var(--accent);
  font-family: ui-monospace, monospace;
  margin-right: 8px;
}
.truth-note {
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  margin-top: 25px;
  padding-top: 18px;
}
.compare {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.compare p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 10px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #24242c;
  border: 1px solid #55555f;
  border-radius: 9px;
  max-width: min(90vw, 540px);
  padding: 12px 18px;
  box-shadow: 0 8px 35px #0007;
  z-index: 100;
  font-size: 0.875rem;
}
@media (min-width: 1600px) {
  .workspace {
    grid-template-columns: 270px minmax(0, 1fr) 360px;
  }
}
@media (max-width: 1150px) {
  .workspace {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .results-panel {
    grid-column: 2;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .metric-list {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .library-panel {
    grid-row: 1/3;
  }
  .practice-panel,
  .results-panel {
    padding: 24px;
  }
  #traceSection {
    max-width: 650px;
  }
}
@media (max-width: 720px) {
  .topbar {
    min-height: 64px;
    padding: 14px 16px;
  }
  .brand {
    font-size: 1.25rem;
    gap: 8px;
  }
  .brand > .tag {
    display: none;
  }
  .local-label {
    font-size: 0.75rem;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .library-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 16px;
  }
  .library-panel .section-title {
    margin-bottom: 13px;
  }
  .library-panel > .button {
    width: calc(50% - 5px);
    margin-bottom: 0;
  }
  .library-panel > .secondary {
    margin-left: 6px;
  }
  .library-panel > .help {
    margin: 12px 0;
  }
  .storage-note {
    font-size: 0.75rem;
    margin-top: 10px;
    padding-top: 10px;
  }
  .session-list {
    display: flex;
    overflow-x: auto;
    max-height: none;
    margin-top: 15px;
  }
  .session-item {
    min-width: 200px;
    max-width: 240px;
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .session-item img {
    width: 40px;
    height: 40px;
  }
  .library-panel > .text-button {
    padding: 8px 0;
  }
  .practice-panel {
    padding: 22px 16px;
  }
  .session-header {
    margin-bottom: 16px;
  }
  .session-header h2 {
    font-size: 1.2rem;
  }
  .empty-state {
    min-height: 280px;
  }
  .stage video {
    max-height: 420px;
  }
  .setup-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .results-panel {
    padding: 22px 16px;
    border-top: 1px solid var(--line);
  }
  .metric-list {
    grid-template-columns: 1fr 1fr;
  }
  .metric strong {
    font-size: 1.5rem;
  }
  .seed-panel {
    padding: 14px;
  }
  .transport {
    gap: 8px;
  }
  .analysis-actions {
    gap: 10px;
  }
  .analysis-actions > .primary {
    flex: 1;
  }
  .file-actions {
    gap: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

.guide {
  width: min(850px, calc(100% - 32px));
  margin: 40px auto 80px;
  line-height: 1.75;
}
.guide h1 {
  font-size: 2rem;
  margin: 12px 0 20px;
}
.guide h2 {
  margin: 32px 0 12px;
}
.guide p {
  margin: 12px 0;
  color: var(--muted);
}
.guide pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  overflow-x: auto;
  font-size: 0.875rem;
}
.guide code {
  font-family: ui-monospace, monospace;
  color: var(--text);
}
.axis-server-controls { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #394344; }
.axis-server-controls label { display: block; margin: .75rem 0; }
.axis-server-controls input { display: block; width: 100%; max-width: 100%; margin-top: .4rem; }
