:root {
  color-scheme: dark;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "Fira Code", monospace;
  line-height: 1.4;
  --bg: #050810;
  --fg: #e0e6f0;
  --accent: #4ac8f0;
  --accent-glow: rgba(74, 200, 240, 0.3);
  --error: #ff6e84;
  --panel: rgba(255,255,255,0.03);
  --surface: #0a0e1a;
  --border: rgba(255,255,255,0.08);
  --muted: #6b7280;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at top, #0a0d18, #050810 50%, #030406);
  color: var(--fg);
}

.app {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

.app__header h1 {
  margin: 0;
}

.controls,
.viewport {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 1rem;
}

form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.timeline-controls {
  margin-top: 1rem;
  display: grid;
  gap: 0.6rem;
}

.timeline-controls__buttons {
  display: flex;
  gap: 0.5rem;
}

.timeline-controls__meta {
  margin: 0;
  min-height: 1.25rem;
}

.timeline-controls--disabled {
  opacity: 0.6;
}

label {
  font-weight: 600;
}

input,
button {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  border-radius: 2px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: border-color 0.15s, box-shadow 0.15s;
}

button:hover {
  border-color: #6dd8ff;
  box-shadow: 0 0 8px var(--accent-glow);
}

button:active {
  background: rgba(74, 200, 240, 0.1);
}

.viewport {
  position: relative;
  min-height: 360px;
  background: transparent;
  border: none;
  padding: 0;
}

.hud {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(5, 8, 16, 0.75);
  border: 1px solid var(--border);
  padding: 0.4rem 0.65rem;
  pointer-events: none;
}

.hud--hidden {
  display: none;
}

.hud__item {
  color: var(--accent);
}

canvas {
  width: 100%;
  height: 440px;
  display: block;
  border-radius: 0;
  border: none;
}

.message {
  margin: 0.6rem 0 0;
  min-height: 1.25rem;
  color: var(--error);
}

.message--info {
  color: var(--accent);
}

.message--hidden {
  display: none;
}

.timeline {
  margin: 1rem 0 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.75rem;
}

.timeline[disabled] {
  opacity: 0.65;
}

.timeline legend {
  font-weight: 600;
  padding: 0 0.25rem;
}

.timeline__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.timeline__row + .timeline__row {
  margin-top: 0.75rem;
}

.timeline__row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

input[type="date"],
select {
  font: inherit;
  font-family: var(--mono);
  background: rgba(255,255,255,0.05);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.45rem 0.5rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
  border: none;
  margin-top: -5px;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
  border: none;
}

.ramp-toggle--active {
  background: #1a4d66;
  border-color: #133a4f;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

#ramp-toggle[aria-pressed="true"] {
  background: #1a4d66;
  border-color: #133a4f;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

#date-scrubber {
  width: 100%;
}

#timeline-date {
  font-family: var(--mono);
  font-weight: 600;
}

#timeline-status {
  font-family: var(--mono);
}

#playback-speed {
  font-family: var(--mono);
}

@media (max-width: 640px) {
  .app {
    padding: 1rem;
  }

  canvas {
    height: 320px;
  }

  .timeline__row {
    gap: 0.5rem;
  }

  .hud {
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.65rem;
  }
}
