@font-face { font-family: Alice; src: url('fonts/custom/Alice-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: Handwriting; src: url('fonts/custom/My handwriting.ttf') format('truetype'); font-display: swap; }
:root { color-scheme: light; --ink: #1c2c52; --accent: #374d90; --muted: #4c586e; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #fff; font: 16px/1.5 system-ui, sans-serif; }
main { padding: 24px clamp(18px, 3vw, 56px) 56px; }
header { margin-bottom: 26px; }
nav { display: flex; gap: 24px; margin-bottom: 15px; }
a { color: inherit; text-underline-offset: .2em; }
h1 { margin: 0; font: 400 clamp(34px, 4vw, 52px)/1.15 Alice, Georgia, serif; }
header p { margin: 10px 0 0; max-width: 65em; color: var(--muted); }
button, input { font: inherit; }
button { color: inherit; background: #fff; border: 1px solid #68758c; padding: 8px 13px; min-height: 44px; cursor: pointer; }
button, [role="button"], nav a, .hint, output { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
button:hover { background: #edf0f7; }
button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
button:disabled { cursor: wait; }
:focus-visible { outline: 3px solid #4e72bd; outline-offset: 3px; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 245px; gap: 32px; align-items: start; }
.viewer { min-width: 0; }
.view-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stage { position: relative; background: #000; height: clamp(420px, 62vh, 760px); overflow: hidden; }
#grow-preview { position: relative; z-index: 1; width: 100%; height: 100%; display: block; background: transparent; touch-action: none; user-select: none; cursor: grab; }
#grow-stage.shoggoth-rig-active :is(.shoggoth-static, .shoggoth-static-front) { visibility: hidden; }
#grow-stage.branches-only :is(.crown, .crown-label, .branch-label, [data-character-id], [data-ground], .shoggoth-layer, .shoggoth-rear-layer) { display: none; }
.viewer:has(#grow-stage.branches-only) #grow-motion { display: none; }
#grow-preview:active { cursor: grabbing; }
#grow-preview .crown { cursor: zoom-in; }
#grow-preview .crown.is-grouped:focus { outline: none; }
#grow-preview .crown.is-grouped.is-hit-inactive,
#grow-preview .crown.is-grouped.is-hit-inactive * { pointer-events: none; }
#grow-preview .crown-label.is-grouped:is(.is-hovered, .is-focus-visible, .is-selected) text {
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .13em;
}
#grow-preview text { pointer-events: none; fill: #ECE9DD; font-family: Alice, Georgia, serif; text-anchor: middle; }
#grow-preview .branch-label { font-family: Handwriting, Georgia, serif; letter-spacing: .06em; }
#grow-preview .crown-label[data-family="cooperative"] text { fill: #000; }
#grow-preview .bone { stroke: #ffeb4a; stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
#grow-preview .joint { fill: #ffeb4a; }
#grow-preview .guide-layer { pointer-events: none; }
#grow-status { position: absolute; inset: auto 20px 12px; color: #fff; margin: 0; pointer-events: none; }
.below { justify-content: space-between; margin-top: 12px; margin-bottom: 0; }
.below > div { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.topic-navigation { display: none; }
[hidden] { display: none !important; }
form { padding-top: 2px; }
form > label { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
output { color: var(--muted); }
input[type="range"] { display: block; width: 100%; height: 28px; margin: 8px 0 24px; accent-color: var(--accent); cursor: pointer; }
.seed-row { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.seed-row input { width: 100px; border: 1px solid #68758c; padding: 6px 8px; color: var(--ink); }
form > button { width: 100%; margin: 0 0 10px; }
.control-note { font-size: 14px; color: var(--muted); margin: 10px 0 24px; }
#export-status { font-size: 14px; margin: 0; }
footer { max-width: 76em; margin-top: 32px; color: var(--muted); font-size: 14px; }
footer p { margin: 0 0 8px; }
@media (min-width: 2100px) { .stage { height: 72vh; } }
@media (max-width: 820px) {
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .stage { height: clamp(280px, 82vw, 400px); }
  .topic-navigation { display: block; margin: 16px 0 0; }
  .topic-navigation p { font-size: 14px; margin: 0 0 4px; color: var(--muted); }
  #topic-links { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; }
  #topic-links button { border: 0; padding: 4px 0; text-align: left; font-size: 15px; line-height: 1.35; text-decoration: underline; text-underline-offset: .2em; }
  form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 22px; }
  form > label, form > input, .seed-row, .control-note, #export-status { grid-column: 1 / -1; }
  form > button { font-size: 14px; }
  footer { margin-top: 24px; }
}
@media (max-width: 440px) { .view-tools { gap: 6px; } .view-tools button { padding-inline: 10px; font-size: 14px; } .hint { font-size: 13px; } }
