@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Literata:opsz,wght@7..72,600;7..72,700&display=swap");

:root {
  --bg-0: #07131f;
  --bg-1: #11273a;
  --bg-2: #1b4055;
  --panel: #f4efe6;
  --panel-line: rgba(16, 32, 49, 0.09);
  --ink: #11212f;
  --muted: #607182;
  --red: #ef6461;
  --blue: #5b8cff;
  --green: #8fd49a;
  --gold: #f3c969;
  --shadow: rgba(4, 12, 20, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 12% 12%, rgba(243, 201, 105, 0.16), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(91, 140, 255, 0.12), transparent 26%),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 42%, var(--bg-2) 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-columns: minmax(360px, 38vw) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
}

.panel {
  position: relative;
  z-index: 2;
  height: 100vh;
  overflow: auto;
  padding: 26px 24px 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.08)),
    var(--panel);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 18px 0 50px var(--shadow);
}

.viewer {
  position: relative;
  min-width: 0;
}

#viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.viewer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(transparent 0 96.5%, rgba(255, 255, 255, 0.03) 96.5% 100%),
    linear-gradient(90deg, transparent 0 96.5%, rgba(255, 255, 255, 0.03) 96.5% 100%);
  background-size: 48px 48px;
  opacity: 0.22;
  pointer-events: none;
}

.viewer-overlay {
  position: absolute;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(9, 20, 31, 0.62);
  color: #f7fbff;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.viewer-kicker {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.viewer-stage {
  margin-top: 6px;
  font-family: "Literata", Georgia, serif;
  font-size: 1.22rem;
  letter-spacing: -0.03em;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Literata", Georgia, serif;
  letter-spacing: -0.03em;
}

h1 {
  margin-top: 8px;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 0.98;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.48;
}

.status {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.status.is-loading {
  color: #745f2b;
  background: rgba(243, 201, 105, 0.18);
}

.status.is-error {
  color: #8d2935;
  background: rgba(239, 100, 97, 0.18);
}

.status.is-ready {
  color: #21533d;
  background: rgba(143, 212, 154, 0.18);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.metric,
.stage-card,
.path-block {
  border: 1px solid var(--panel-line);
}

.metric {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.transport {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

button {
  appearance: none;
  border: 1px solid rgba(16, 32, 49, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  transition: transform 150ms ease, background 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
}

button.primary {
  color: #f8fbff;
  background: linear-gradient(135deg, #173c52, #316989);
}

.scrub-label {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.scrubber {
  width: 100%;
  margin-top: 8px;
}

.stage-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stage-buttons button {
  padding: 9px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
}

.stage-buttons button.is-active {
  background: rgba(17, 39, 58, 0.1);
}

.stage-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(17, 39, 58, 0.07), rgba(255, 255, 255, 0.44));
}

.stage-index {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stage-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.52;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.toggle-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.path-block {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
}

.path-block.red {
  background: linear-gradient(180deg, rgba(239, 100, 97, 0.12), rgba(255, 255, 255, 0.48));
}

.path-block.blue {
  background: linear-gradient(180deg, rgba(91, 140, 255, 0.12), rgba(255, 255, 255, 0.48));
}

.path-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  font-weight: 700;
}

.path-heading small {
  color: var(--muted);
  font-size: 0.78rem;
}

.path-block code {
  display: block;
  margin-top: 8px;
  color: #21374d;
  font-size: 0.89rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
  word-break: break-all;
}

.footnote {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.52;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #214f6a;
}

input[type="range"] {
  accent-color: #214f6a;
}

@media (max-width: 980px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 48vh) minmax(0, 1fr);
  }

  .panel {
    height: auto;
    max-height: 48vh;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

@media (max-width: 640px) {
  .panel {
    padding: 20px 18px 22px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:last-child {
    grid-column: 1 / -1;
  }

  .stage-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-overlay {
    right: 12px;
    bottom: 12px;
    min-width: 180px;
  }
}
