/* Polar Void — cold, austere, near-neutral */

:root {
  --bg: #1A1D23;
  --surface: #22262E;
  --surface-raised: #2A2F3A;
  --fg: #D8DEE9;
  --muted: #6B7894;
  --accent: #7BA4C7;
  --terracotta: #D97757;
  --success: #8FBCA3;
  --error: #BF616A;
  --ground: #3B4048;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--surface-raised);
}

header h1 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}

header .subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
  font-weight: 300;
}

/* ── Main layout ── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 2rem 2rem;
  gap: 1rem;
}

#viewer {
  flex: 1;
  display: flex;
  gap: 1rem;
  min-height: 400px;
}

/* ── Structure panel ── */
#structure-panel {
  flex: 7;
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

#status-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  background: rgba(26, 29, 35, 0.85);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Info panel ── */
#info-panel {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-section {
  background: var(--surface);
  border-radius: 6px;
  padding: 1rem;
}

.panel-section h2 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.panel-section h3 {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

#sequence-display {
  color: var(--fg);
  word-break: break-all;
}

#constraints-list {
  color: var(--fg);
  line-height: 1.8;
}

.constraint-item {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0;
}

.constraint-new {
  color: var(--terracotta);
}

#result-display {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.result-feasible { color: var(--success); }
.result-infeasible { color: var(--error); }

/* ── Timeline ── */
#timeline {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

#timeline-bar {
  flex: 1;
  height: 4px;
  background: var(--surface-raised);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

#timeline-progress {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.15s ease;
}

#timeline-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#timeline-controls button {
  background: var(--surface);
  border: 1px solid var(--surface-raised);
  color: var(--fg);
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#timeline-controls button:hover {
  background: var(--surface-raised);
}

#frame-counter {
  font-size: 0.7rem;
  color: var(--muted);
  min-width: 5rem;
}

/* ── Trace selector ── */
#trace-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

#trace-selector label {
  font-size: 0.8rem;
  color: var(--muted);
}

#trace-select {
  background: var(--surface);
  border: 1px solid var(--surface-raised);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
}

#trace-select:focus {
  outline: 1px solid var(--accent);
}

/* ── About modal ── */
.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.btn-about {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--surface-raised);
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 3px;
  margin-top: 0.2rem;
}
.btn-about:hover { color: var(--fg); border-color: var(--accent); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 2rem;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: 8px;
  max-width: 780px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  position: relative;
  padding: 2rem 2.4rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  font-size: 1.4rem;
  background: transparent;
  color: var(--muted);
  padding: 0 0.4rem;
  line-height: 1;
}
.modal-close:hover { color: var(--fg); background: transparent; }
.prose { color: var(--fg); font-size: 0.9rem; line-height: 1.65; }
.prose h1, .prose h2, .prose h3 { font-weight: 500; margin-top: 1.6em; margin-bottom: 0.5em; color: var(--fg); }
.prose h1 { font-size: 1.3rem; }
.prose h2 { font-size: 1.05rem; color: var(--accent); }
.prose h3 { font-size: 0.92rem; color: var(--terracotta); }
.prose hr { border: none; border-top: 1px solid var(--surface-raised); margin: 1.6em 0; }
.prose code { background: var(--surface-raised); color: var(--fg); padding: 0.08em 0.35em; border-radius: 3px; font-size: 0.85em; }
.prose pre { background: var(--surface-raised); padding: 0.9rem 1rem; border-radius: 4px; overflow-x: auto; font-size: 0.78rem; line-height: 1.5; }
.prose pre code { background: transparent; padding: 0; }
.prose table { border-collapse: collapse; margin: 0.8em 0; font-size: 0.82rem; }
.prose th, .prose td { border: 1px solid var(--surface-raised); padding: 0.3rem 0.6rem; text-align: left; }
.prose th { background: var(--surface-raised); }
.prose blockquote { border-left: 2px solid var(--accent); padding-left: 0.8rem; color: var(--muted); margin: 0.8em 0; font-style: italic; }
.prose a { color: var(--accent); }

/* ── 3D viewer ── */
#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 520px;
}
#three-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#status-bar { z-index: 2; }

.swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: -1px;
}
.swatch-kinematic { background: #E0B888; }
.swatch-stability { background: #E8967A; }
.swatch-landing   { background: #B0B8C8; }

#verifier-list {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* ── Structure preview (right panel, small Three.js canvas) ── */
#preview-canvas {
  width: 100%;
  height: 180px;
  display: block;
  background: #1C2030;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
#preview-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
