:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #eef4f8;
  --muted: #8da0ad;
  --panel: rgba(12, 18, 23, 0.94);
  --line: rgba(177, 207, 224, 0.15);
  --accent: #48b7eb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  min-width: 1040px;
  height: 100%;
  overflow: hidden;
  background: #091015;
  color: var(--ink);
}

button, input { font: inherit; }

#app {
  display: grid;
  grid-template-columns: minmax(680px, 1fr) 344px;
  grid-template-rows: 76px minmax(0, 1fr) 34px;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 36% 44%, rgba(67, 98, 116, 0.18), transparent 42%),
    #091015;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 20, 0.9);
  z-index: 3;
}

.eyebrow, .section-label {
  margin: 0 0 4px;
  color: #6f8491;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 610;
  letter-spacing: 0.01em;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(105, 206, 153, 0.24);
  border-radius: 999px;
  color: #9ad8b8;
  background: rgba(39, 107, 73, 0.12);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-pill span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #65d397;
  box-shadow: 0 0 12px #65d397;
}

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

#scene {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene:active { cursor: grabbing; }

.panel {
  overflow-y: auto;
  padding: 22px 20px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.panel section {
  padding: 0 0 21px;
  margin: 0 0 21px;
  border-bottom: 1px solid var(--line);
}

.panel section:last-child { border: 0; }

label {
  display: flex;
  justify-content: space-between;
  margin: 15px 0 8px;
  color: #c6d1d8;
  font-size: 12px;
}

output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 3px;
  appearance: none;
  border-radius: 3px;
  outline: 0;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), #29353d var(--fill, 50%));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  border: 2px solid #caefff;
  border-radius: 50%;
  background: #2faee8;
  box-shadow: 0 0 0 4px rgba(47, 174, 232, 0.12);
  cursor: ew-resize;
}

.wide-button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 38px;
  margin-top: 9px;
  padding: 0 12px;
  color: #b8c6ce;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.wide-button:hover, .wide-button.active {
  color: #eaf8ff;
  border-color: rgba(72, 183, 235, 0.42);
  background: rgba(72, 183, 235, 0.08);
}

.wide-button.primary {
  justify-content: center;
  margin-top: 16px;
  color: #dff6ff;
  border-color: rgba(72, 183, 235, 0.35);
  background: linear-gradient(180deg, rgba(72, 183, 235, 0.15), rgba(72, 183, 235, 0.06));
}

.wide-button.primary:hover,
.wide-button.primary.active {
  border-color: rgba(72, 183, 235, 0.62);
  background: linear-gradient(180deg, rgba(72, 183, 235, 0.24), rgba(72, 183, 235, 0.1));
}

.process-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 13px 0 6px;
}

.process-heading h2 {
  margin: 0;
  color: #e9f6fb;
  font-size: 15px;
  font-weight: 620;
}

.process-card > p:not(.section-label) {
  min-height: 42px;
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.58;
}

.stage-scale {
  position: relative;
  height: 9px;
  margin: 1px 6px 0;
}

.stage-scale i {
  position: absolute;
  top: 0;
  width: 1px;
  height: 6px;
  background: rgba(161, 195, 212, 0.33);
}

.icon {
  width: 24px;
  color: var(--accent);
  font-size: 16px;
}

.part-card h2 {
  margin: 13px 0 8px;
  font-size: 17px;
  font-weight: 590;
}

.part-card p:not(.section-label) {
  min-height: 48px;
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.62;
}

.material-tag {
  display: inline-flex;
  padding: 5px 7px;
  color: #90cde8;
  border: 1px solid rgba(72, 183, 235, 0.2);
  border-radius: 4px;
  background: rgba(72, 183, 235, 0.055);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.1em;
}



.view-buttons {
  position: absolute;
  top: 18px;
  left: 20px;
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 14, 18, 0.76);
  backdrop-filter: blur(14px);
}

.view-buttons button {
  padding: 7px 9px;
  color: #8699a5;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.view-buttons button:hover, .view-buttons button.active {
  color: #e8f7fd;
  background: rgba(72, 183, 235, 0.13);
}

.hint {
  position: absolute;
  left: 20px;
  bottom: 18px;
  padding: 7px 10px;
  color: #71838e;
  border-radius: 4px;
  background: rgba(8, 14, 18, 0.65);
  font-size: 10px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 13px;
  text-align: center;
  background: #0b1217;
  z-index: 4;
  transition: opacity 500ms ease, visibility 500ms ease;
}

.loading.done {
  opacity: 0;
  visibility: hidden;
}

.loading span {
  justify-self: center;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(72, 183, 235, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.loading b {
  color: #77919e;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 28px;
  color: #556771;
  border-top: 1px solid var(--line);
  background: #080e12;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#passLabel { color: #709db2; }

body.capture-mode {
  display: grid;
  min-width: 0;
  place-items: center;
  overflow: auto;
  background: #0d161c;
}

body.capture-mode #app {
  display: block;
  width: var(--capture-width);
  height: var(--capture-height);
}

body.capture-mode .topbar,
body.capture-mode .panel,
body.capture-mode footer,
body.capture-mode .view-buttons,
body.capture-mode .hint {
  display: none;
}

body.capture-mode .viewport {
  width: 100%;
  height: 100%;
}

@keyframes spin { to { transform: rotate(360deg); } }
