:root {
  color-scheme: dark;
  --bg: #101317;
  --panel: #151a1f;
  --panel-2: #1c2329;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f1ea;
  --muted: #aeb9bd;
  --accent: #47c3bb;
  --accent-2: #f1b35d;
  --ok: #8bd28f;
  --warn: #e3c36f;
  --shadow: rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  min-height: 680px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 26px;
  background: linear-gradient(180deg, #171d22 0%, #11161a 100%);
  border-right: 1px solid var(--line);
  box-shadow: 14px 0 40px var(--shadow);
  overflow-y: auto;
}

.brand-block h1 {
  margin: 8px 0 12px;
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(71, 195, 187, 0.5);
  border-radius: 999px;
  color: #adf1eb;
  background: rgba(71, 195, 187, 0.08);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metrics div,
.story,
.status {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
}

.metrics div {
  min-height: 74px;
  padding: 13px 12px;
}

.metrics span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metrics strong {
  display: block;
  font-size: 16px;
  line-height: 1.15;
}

.story,
.status {
  padding: 18px 18px;
}

.story h2,
.status h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0;
}

.story ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.status p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.status p:last-child {
  margin-bottom: 0;
}

.status strong {
  color: var(--text);
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0) 28%),
    radial-gradient(circle at 50% 100%, rgba(71, 195, 187, 0.15), transparent 36%),
    #0e1114;
}

.topbar,
.timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 24, 0.78);
  backdrop-filter: blur(12px);
}

.timeline {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.mode-buttons,
.view-toggles,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-buttons button,
.quick-actions button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.mode-buttons button span {
  color: var(--accent-2);
  font-weight: 800;
  margin-right: 6px;
}

.mode-buttons button:hover,
.quick-actions button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.1);
}

.mode-buttons button.active {
  border-color: rgba(71, 195, 187, 0.85);
  background: rgba(71, 195, 187, 0.16);
}

.view-toggles {
  color: var(--muted);
  font-size: 13px;
}

.view-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.view-toggles input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.model-label {
  position: absolute;
  max-width: 190px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: rgba(15, 19, 22, 0.76);
  color: #f7f4ed;
  font-size: 12px;
  line-height: 1.25;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(10px);
}

.scene-caption {
  position: absolute;
  left: 22px;
  bottom: 22px;
  width: min(520px, calc(100% - 44px));
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 19, 22, 0.7);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
}

.scene-caption span {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scene-caption strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.range-wrap {
  display: grid;
  grid-template-columns: auto minmax(180px, 420px) 74px;
  align-items: center;
  gap: 12px;
  min-width: 420px;
}

.range-wrap label,
.range-wrap output {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.range-wrap input {
  width: 100%;
  accent-color: var(--accent);
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .topbar,
  .timeline {
    align-items: flex-start;
    flex-direction: column;
  }

  .range-wrap {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .quick-actions {
    width: 100%;
  }

  .quick-actions button {
    flex: 1 1 150px;
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow: hidden;
    height: 100%;
  }

  .app {
    display: block;
    height: 100svh;
    min-height: 0;
  }

  .stage {
    display: block;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .viewport {
    position: absolute;
    inset: 0;
    min-height: 0;
  }

  .topbar {
    position: absolute;
    z-index: 5;
    top: 0;
    left: 0;
    right: 0;
    display: block;
    min-height: 0;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(15, 20, 24, 0.76);
  }

  .mode-buttons {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
  }

  .mode-buttons::-webkit-scrollbar {
    display: none;
  }

  .mode-buttons button {
    flex: 0 0 auto;
    min-width: 118px;
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  .view-toggles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    margin-top: 6px;
    font-size: 11px;
  }

  .view-toggles label {
    justify-content: center;
    min-height: 30px;
    padding: 0 4px;
    background: rgba(255, 255, 255, 0.04);
  }

  .timeline {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    min-height: 0;
    padding: 10px;
    border-top: 1px solid var(--line);
    background: rgba(15, 20, 24, 0.8);
  }

  .range-wrap {
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 8px;
    width: 100%;
  }

  .range-wrap label {
    grid-column: 1 / -1;
    font-size: 12px;
  }

  .range-wrap output {
    text-align: right;
    font-size: 12px;
  }

  .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 8px;
  }

  .quick-actions button {
    width: 100%;
    min-height: 39px;
    padding: 0 8px;
    font-size: 14px;
  }

  .scene-caption {
    z-index: 4;
    bottom: 146px;
    left: 10px;
    width: calc(100% - 20px);
    padding: 11px 12px;
  }

  .scene-caption strong {
    font-size: 15px;
  }

  .model-label {
    display: none !important;
  }
}
