:root {
  color-scheme: dark;
  --ink: #1b1916;
  --paper: #ebe4d6;
  --paper-2: #f7f3ea;
  --muted: #6f685e;
  --line: #d9d0c2;
  --copper: #c4622d;
  --copper-2: #e7a06a;
  --night: #12110e;
  --stage: #100e0c;
  --rail: #1b1916;
  --cream: #f4efe6;
  --danger: #6a3d12;
  font-family: Outfit, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100%;
  background: var(--night);
  color: var(--cream);
  display: flex;
  flex-direction: column;
}

button, input, select { font: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--copper-2);
  outline-offset: 2px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--copper-2);
  border-radius: 8px;
  position: relative;
  flex: none;
}

.mark::before {
  content: "";
  position: absolute;
  inset: 6px 6px 5px;
  background: var(--copper);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.brand strong {
  display: block;
  font-family: Fraunces, Palatino, serif;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand em {
  display: block;
  margin-top: 3px;
  color: #b7aa9a;
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.privacy {
  margin: 0;
  color: #b7aa9a;
  font-size: 13px;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) minmax(230px, 292px);
  gap: 14px;
  padding: 0 16px 16px;
}

.sheet, .rail, .stage {
  min-height: 0;
  border-radius: 18px;
}

.sheet {
  color-scheme: light;
  background: var(--paper);
  color: var(--ink);
  padding: 16px;
  overflow: auto;
}

.lead {
  margin: 0 0 14px;
  font-family: Fraunces, Palatino, serif;
  font-size: 28px;
  font-weight: 520;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.help {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.drop {
  position: relative;
  display: grid;
  min-height: 168px;
  place-items: center;
  padding: 12px;
  border: 1.5px dashed #b7ad9e;
  border-radius: 14px;
  background: var(--paper-2);
  text-align: center;
  cursor: pointer;
}

.drop.is-over { border-color: var(--copper); background: #fff8ee; }

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop strong { display: block; font-size: 16px; }
.drop span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }

.drop img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  border-radius: 8px;
  background: #ddd6c8;
}

.drop.has-image .drop-copy { display: none; }

.tips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.tips li {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e3d9c8;
  color: #4d463d;
  font-size: 12px;
}

.fields { display: grid; gap: 10px; }

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.field > span, .check span {
  display: flex;
  justify-content: space-between;
  color: #3f3a33;
}

.field output { color: var(--copper); font-variant-numeric: tabular-nums; }

body[data-mode="relieve"] .only-object { display: none; }
body[data-motor="neuronal"] .only-local { display: none; }

select, input[type="range"] { width: 100%; accent-color: var(--copper); }

select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--ink);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.check input { accent-color: var(--copper); }

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 14px;
}

.primary, .ghost, .tools button, .downloads a {
  border-radius: 999px;
  padding: 11px 14px;
}

.primary {
  border: 0;
  background: var(--ink);
  color: var(--cream);
}

.primary:disabled, .ghost:disabled, .tools button:disabled, .downloads a[aria-disabled="true"] {
  opacity: 0.45;
  cursor: progress;
  pointer-events: none;
}

.ghost {
  border: 1px solid #c9bfb0;
  background: transparent;
  color: var(--ink);
}

.hint {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3e2c4;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

.status {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.steps {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 0;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8a8175;
  font-size: 13.5px;
}

.steps li span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid #d5cec2;
  border-radius: 50%;
  font-size: 11px;
}

.steps li[data-state="active"] { color: var(--ink); }
.steps li[data-state="active"] span {
  background: var(--copper);
  border-color: var(--copper);
  color: white;
}

.steps li[data-state="done"] { color: var(--ink); }
.steps li[data-state="done"] span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.about {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.about summary {
  cursor: pointer;
  color: #4e473e;
  font-size: 13px;
}

.about p, .about ol {
  color: #4e473e;
  font-size: 13px;
  line-height: 1.45;
}

.about ol { padding-left: 18px; }

.stage {
  position: relative;
  background: var(--stage);
  display: flex;
  min-width: 0;
}

.viewport {
  position: relative;
  flex: 1;
  min-height: 520px;
}

.viewport canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.corners::before, .corners::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(231, 160, 106, 0.8);
  pointer-events: none;
}

.corners::before { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.corners::after { right: 12px; bottom: 52px; border-left: 0; border-top: 0; }

.empty, .gesture, .overlay {
  position: absolute;
  pointer-events: none;
}

.empty {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.empty p {
  max-width: 280px;
  margin: 0;
  color: #d9cbb8;
  font-family: Fraunces, Palatino, serif;
  font-size: 28px;
  line-height: 1.15;
}

.gesture {
  left: 16px;
  bottom: 14px;
  margin: 0;
  color: #b3a694;
  font-size: 12px;
}

.overlay {
  inset: 0;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 18px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

.overlay[hidden], .hint[hidden], .empty[hidden], .gesture[hidden], .preview[hidden] {
  display: none;
}

.overlay p { margin: 0; font-size: 14px; }

.bar {
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--copper-2);
}

.bar.indeterminate span {
  animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.tools {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}

.tools button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(16, 14, 12, 0.72);
  color: var(--cream);
  padding: 7px 10px;
  font-size: 12px;
}

.tools button.is-on {
  background: var(--copper);
  border-color: var(--copper);
  color: #1b120c;
}

.rail {
  background: var(--rail);
  padding: 16px;
  overflow: auto;
}

.kicker {
  margin: 0 0 8px;
  color: #9a9084;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#depth-preview {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #0e0d0b;
}

.caption {
  margin: 8px 0 16px;
  color: #b3a694;
  font-size: 12px;
}

.stats {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.stats li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2e2a26;
  color: #b3a694;
  font-size: 13px;
}

.stats strong {
  color: var(--cream);
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.downloads { display: grid; gap: 8px; }

.downloads a {
  display: block;
  border: 1px solid #3c3832;
  background: transparent;
  color: var(--cream);
  text-align: center;
  text-decoration: none;
}

.downloads .solid {
  border-color: var(--copper);
  background: var(--copper);
  color: #1b120c;
}

.note {
  margin: 14px 0 0;
  color: #8f867b;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  body { height: auto; overflow: auto; }
  .top { align-items: flex-start; flex-direction: column; }
  .workspace {
    height: auto;
    display: flex;
    flex-direction: column;
  }
  .sheet, .rail { max-height: none; overflow: visible; }
  .viewport { height: 68vh; min-height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar.indeterminate span { animation: none; }
}
