@font-face { font-family: "Fredoka"; src: url("vendor/fredoka-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("vendor/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("vendor/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #eef1ec;      /* lichen */
  --panel: #f8faf6;
  --ink: #1f2a24;        /* peat */
  --muted: #5a675e;
  --contour: #c9d3c5;
  --line: #d5ddd1;
  --route: #d8322a;
  --route-ink: #ffffff;
  --water: #2f8fdc;
  --focus: #2f8fdc;
  --stage: #e3e9e0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #18201b;
    --panel: #1d2621;
    --ink: #e6ece6;
    --muted: #a3b0a6;
    --contour: #2c3830;
    --line: #2f3b33;
    --stage: #141b17;
    --focus: #6fb5ef;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 "Atkinson", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.masthead {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 14px 20px 10px;
}
.masthead h1 {
  font: 600 28px/1 "Fredoka", sans-serif; margin: 0; letter-spacing: -0.01em;
}
.masthead p { margin: 0; color: var(--muted); }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0;
  min-height: 0;
}

/* The stage: contour lines drawn as a repeating SVG so the empty state already looks like a map. */
.stage {
  position: relative;
  min-height: 70vh;
  background-color: var(--stage);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='none' stroke='%2393a593' stroke-opacity='.35' stroke-width='1.2'%3E%3Cpath d='M-20 80 C60 40 120 120 210 90 S350 30 440 70'/%3E%3Cpath d='M-20 120 C70 80 130 160 215 130 S355 75 440 112'/%3E%3Cpath d='M-20 165 C80 125 140 205 220 175 S360 120 440 158'/%3E%3Cpath d='M-20 300 C40 270 110 330 190 310 S330 250 440 290'/%3E%3Cpath d='M-20 345 C50 315 120 375 200 352 S335 300 440 335'/%3E%3Cellipse cx='300' cy='230' rx='38' ry='20'/%3E%3Cellipse cx='300' cy='230' rx='64' ry='36'/%3E%3C/g%3E%3C/svg%3E");
  overflow: hidden;
}
.viewer { position: absolute; inset: 0; }
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.dropzone {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 20px;
}
.dropzone.dragging .drop-card { outline: 3px dashed var(--route); outline-offset: 6px; }
.layout.has-run .dropzone { display: none; }
.drop-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 28px 28px 22px;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(31, 42, 36, .45);
}
.drop-title { font: 600 26px/1.15 "Fredoka", sans-serif; margin: 0 0 18px; }
.hint { color: var(--muted); font-size: 14px; margin: 14px 0 0; }

.status {
  position: absolute; left: 16px; bottom: 16px;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border-radius: 999px; padding: 8px 14px 8px 10px;
  font-size: 14px; box-shadow: 0 6px 20px -12px rgba(0,0,0,.5);
}
.status.error { color: #fff; background: #a3271f; }
.status.error .spinner, .status.info .spinner { display: none; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--route);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.view-buttons {
  position: absolute; right: 12px; top: 12px; display: flex; gap: 4px;
  background: var(--panel); border-radius: 10px; padding: 4px;
}
.view-buttons button {
  font: inherit; font-size: 14px; border: 0; background: none; color: var(--ink);
  padding: 6px 10px; border-radius: 7px; cursor: pointer;
}
.view-buttons button:hover { background: var(--paper); }

.panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 8px 20px 28px;
  overflow-y: auto;
  max-height: calc(100vh - 56px);
}
.run-summary { padding: 12px 0 14px; border-bottom: 1px solid var(--line); }
.run-name { font: 600 20px/1.2 "Fredoka", sans-serif; margin: 0; }
.run-meta { margin: 2px 0 6px; color: var(--muted); font-size: 14px; }
.run-summary .link + .link { margin-left: 14px; }
.link { font: inherit; font-size: 14px; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

.group { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.group legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.note { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.note.warn { color: #9c3a12; }
@media (prefers-color-scheme: dark) { .note.warn { color: #f0a070; } }

.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented.stack { flex-direction: column; }
.segmented label { flex: 1 1 auto; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line);
  font-size: 15px; white-space: nowrap; cursor: pointer;
}
.segmented.stack span { justify-content: flex-start; }
.segmented svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.segmented input:checked + span { border-color: var(--ink); background: var(--paper); font-weight: 700; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.sw { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); display: inline-block; }
.sw + .sw { margin-left: -9px; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--route); }
.range-row output { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; margin-top: 4px; }
.check input { accent-color: var(--route); }

.field { display: block; font-size: 14px; color: var(--muted); margin-top: 8px; }
.field input {
  display: block; width: 100%; margin-top: 3px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 10px;
}

.downloads { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; }
.downloads .note { flex-basis: 100%; }
.button {
  font: 700 16px/1 "Atkinson", sans-serif; color: var(--ink);
  background: transparent; border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 12px 18px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.button.primary { background: var(--route); border-color: var(--route); color: var(--route-ink); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-button:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.model-info { margin-top: 14px; font-size: 14px; color: var(--muted); }
.model-info dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.model-info dt { color: var(--muted); }
.model-info dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.warnings { margin: 12px 0 0; padding-left: 18px; color: #9c3a12; font-size: 14px; }

.tips { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.tips summary { font-weight: 700; cursor: pointer; }
.tips ul, .tips ol { padding-left: 20px; font-size: 14px; }
.tips li { margin: 4px 0; }
.slot-list li::marker { font-weight: 700; }
.slot-list .sw { vertical-align: -2px; margin-right: 6px; }

.credits { font-size: 12px; color: var(--muted); margin-top: 22px; }

.layout:not(.has-run) .panel .group,
.layout:not(.has-run) .panel .downloads { opacity: .5; pointer-events: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .stage { min-height: 62vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); max-height: none; padding: 8px 16px 32px; }
  .masthead { padding: 12px 16px 8px; }
}
