/* TYPE/SHIFT. The axis lab and the poster editor each fill one screen: a stage in the middle,
   an inspector on the right, and every control on the same row grid (label, control, value). */
:root {
  color-scheme: dark;
  --bg: #0e0e0f;
  --panel: #161618;
  --panel-2: #1e1e21;
  --panel-3: #2a2a2f;
  --pop: #1c1c20;
  --line: #29292e;
  --line-2: #3b3b42;
  --text: #f3f3ef;
  --muted: #a2a2a8;
  --faint: #6f6f78;
  --accent: #c6ff34;
  --accent-ink: #0e0e0f;
  --ui: Inter, system-ui, sans-serif;
  --display: "TS Encode Sans", Inter, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gut: clamp(16px, 3vw, 40px);
  --head: 52px;
  --ctl: 32px;
  --label-w: 96px;
  --r-s: 6px;
  --r: 8px;
  --r-l: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
html { scroll-behavior: smooth; scroll-padding-top: var(--head); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The side gutter, on every full-width band. */
.top, .hero, section, .foot {
  padding-left: max(var(--gut), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gut), env(safe-area-inset-right, 0px));
}

/* ---------- Header ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; height: var(--head);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(14, 14, 15, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.mark { font-family: var(--display); font-size: 22px; text-decoration: none; letter-spacing: -.01em; line-height: 1; white-space: nowrap; }
.mark-a { font-variation-settings: "wght" 380, "wdth" 75; }
.mark-s { color: var(--accent); font-variation-settings: "wght" 600, "wdth" 100; margin: 0 .04em; }
.mark-b { font-variation-settings: "wght" 900, "wdth" 125; }
.nav { display: flex; gap: clamp(16px, 3vw, 32px); }
.nav a { text-decoration: none; color: var(--muted); font-size: 14px; }
.nav a:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--r);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn { background: var(--accent); color: var(--accent-ink); border: 0; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled, .btn-ghost:disabled { opacity: .5; cursor: progress; }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-ghost[aria-pressed="true"], .btn-ghost[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.btn.sm, .btn-ghost.sm { height: 30px; padding: 0 12px; font-size: 13px; font-weight: 500; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 15px; }
.count { color: var(--faint); font-variant-numeric: tabular-nums; }
.count:empty { display: none; }
.link-btn {
  align-self: flex-start; border: 0; background: none; padding: 0; color: var(--muted);
  font: 13px var(--ui); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-btn:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { container-type: inline-size; padding-block: clamp(24px, 5vh, 56px) clamp(40px, 8vh, 80px); border-bottom: 1px solid var(--line); }
.hero-word {
  font-family: "TS Anybody", var(--display); line-height: .9; white-space: nowrap; overflow: hidden;
  font-size: 120px; font-size: max(40px, calc(95.5cqw / 5.5256)); min-height: 1.015em; padding: .04em 0 .08em; user-select: none; text-align: left;
}
.hero-word .slash { color: var(--accent); }
.hero-copy {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px 56px;
  align-items: end; margin-top: clamp(20px, 4vh, 44px);
}
h1, h2 { font-family: var(--display); font-weight: normal; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(34px, 3.9vw, 60px); line-height: 1; font-variation-settings: "wght" 780, "wdth" 112; }
h2 { font-size: clamp(22px, 2.3vw, 32px); line-height: 1.1; font-variation-settings: "wght" 760, "wdth" 108; }
.hero-side p { margin: 0 0 20px; color: var(--muted); font-size: 17px; max-width: 34em; }

/* ---------- Sections: the lab and the editor are one screen each ---------- */
section { border-bottom: 1px solid var(--line); padding-block: 20px 24px; }
.lab { overflow-anchor: none; }
.ws-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.ws { display: flex; flex-direction: column; height: calc(100svh - var(--head)); min-height: 540px; max-height: 1080px; }
.ws-body { flex: 1; min-height: 0; display: grid; gap: 12px; }
.lab-body { grid-template-columns: 220px minmax(0, 1fr) 340px; }
.ed-body { grid-template-columns: minmax(0, 1fr) 380px; }
.ws-body > * { min-width: 0; }

.panel { background: var(--panel); border-radius: var(--r-l); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel-head { margin: 0; padding: 14px 16px 10px; font-size: 13px; color: var(--muted); }
.stage-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bar-actions { display: flex; gap: 8px; margin-left: auto; }

/* Inspector: tabs on top, settings scroll, the main action stays at the bottom. */
.insp-tabs { margin: 12px 16px 0; }
.insp-scroll {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.insp-foot { display: grid; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.insp-foot > .btn { width: 100%; }
.foot-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tab-pane { display: flex; flex-direction: column; gap: 12px; }
.group { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Rows: label, then the control ---------- */
.row { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); align-items: center; gap: 10px; min-height: var(--ctl); }
.row-l, .field-l, .sl-l, .tog > span { font-size: 13px; line-height: 1.3; color: var(--muted); }
.field { display: grid; gap: 6px; }
.field-top { display: flex; justify-content: space-between; gap: 12px; }
.field-v { font-size: 13px; color: var(--text); }
textarea {
  width: 100%; resize: none; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 10px; font: 14px/1.4 var(--ui); overflow-y: auto; min-height: 58px;
}
textarea:focus { border-color: var(--accent); outline: none; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt-note { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* Sliders: label, track, value on one row; a long label goes above the track. */
.sliders { display: grid; gap: 2px; }
.sl { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr) 46px; align-items: center; column-gap: 10px; min-height: 30px; cursor: pointer; }
.sl-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl output { font-size: 13px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sl.long { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l o" "t t"; padding-top: 4px; }
.sl.long .sl-l { grid-area: l; } .sl.long output { grid-area: o; } .sl.long .sl-t { grid-area: t; }
.sl-t { position: relative; display: block; }
.sl input[type=range] {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 22px; margin: 0;
  background: transparent; cursor: pointer; --p: 50%;
}
.sl input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line-2) var(--p));
}
.sl input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-2); }
.sl input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.sl input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border: 0; border-radius: 50%;
  background: var(--text); box-shadow: 0 0 0 3px var(--panel);
}
.sl input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--panel); }
.sl input[type=range]:hover::-webkit-slider-thumb { background: #fff; box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px rgba(198, 255, 52, .35); }
.sl input[type=range]:focus-visible { outline: none; }
.sl input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent); }
.sl input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent); }
.sl.off { opacity: .38; cursor: default; }
.sl.off input { cursor: default; }
.sl .target-mark { position: absolute; top: 2px; width: 2px; height: 18px; margin-left: -1px; background: var(--text); pointer-events: none; }
.sl .target-mark::after { content: "target"; position: absolute; top: 19px; left: -14px; font: 600 10px/1 var(--ui); color: var(--text); letter-spacing: .02em; }

/* On/off rows. */
.tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--ctl); cursor: pointer; }
.tog.off { opacity: .38; cursor: default; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 34px; height: 20px; margin: 0; border-radius: 999px;
  background: var(--line-2); position: relative; cursor: pointer; transition: background .15s;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); background: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* Segmented control: equal parts on one line. */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); min-height: var(--ctl);
}
.seg button {
  height: 26px; border: 0; background: transparent; border-radius: var(--r-s); padding: 0 8px;
  font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--panel-3); color: var(--text); }
.stage-bar .seg { grid-auto-columns: auto; }

/* Dropdown menus and other popovers. */
.menu { min-width: 0; }
.menu-btn {
  width: 100%; height: var(--ctl); display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r);
  font-size: 13px; line-height: 1; text-align: left; cursor: pointer;
}
.menu-btn:hover, .menu-btn[aria-expanded="true"] { border-color: var(--line-2); }
.menu-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 0; }
.menu-chev { flex: none; width: 7px; height: 7px; margin-top: -4px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.stage-bar .menu-btn { height: 30px; background: transparent; border-color: var(--line-2); font-weight: 500; }
.pop {
  position: fixed; z-index: 60; overflow-y: auto; overscroll-behavior: contain;
  background: var(--pop); border: 1px solid var(--line-2); border-radius: 10px; padding: 4px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.menu-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; width: 100%;
  padding: 8px 10px; border: 0; background: none; border-radius: var(--r-s);
  font-size: 13px; line-height: 1.3; color: var(--text); text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-3); outline: none; }
.menu-item[aria-selected="true"] .mi-name { color: var(--accent); }
.mi-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-hint { flex: none; color: var(--faint); font-size: 12px; }
.menu-list.stack .menu-item { flex-direction: column; align-items: flex-start; gap: 2px; }
.menu-list.stack .mi-hint { flex: 1; line-height: 1.4; white-space: normal; }
.menu-list.fonts .menu-item { align-items: center; padding: 6px 10px; min-height: 38px; }
.menu-list.fonts .mi-name, .menu-list.starters .mi-name { font-size: 18px; line-height: 1.2; padding: 2px 0; }
.menu-list.starters .menu-item { flex-direction: row; align-items: center; min-height: 40px; }
.menu-list.starters .mi-hint { flex: none; white-space: nowrap; }

/* ---------- Axis lab ---------- */
.fl-panel .panel-head { border-bottom: 1px solid var(--line); }
.font-list {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.fl-item { flex: none; display: grid; gap: 2px; padding: 7px 10px 8px; border: 0; background: none; border-radius: var(--r); text-align: left; cursor: pointer; }
.fl-item:hover { background: var(--panel-2); }
.fl-item[aria-checked="true"] { background: var(--panel-3); box-shadow: inset 2px 0 0 var(--accent); }
.fl-name { font-size: 18px; line-height: 1.2; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 1px 0; }
.fl-kind { font-size: 11.5px; line-height: 1.2; color: var(--faint); }

.lab-stage { container-type: inline-size; }
.specimen {
  flex: 1; min-height: 0; display: flex; align-items: center; overflow: auto;
  padding: 16px clamp(18px, 3cqw, 36px); outline: none;
  font-size: calc(var(--spec, 1) * clamp(40px, 9cqw, 112px)); line-height: 1.08; overflow-wrap: anywhere; letter-spacing: -.01em;
}
.specimen:focus-visible { box-shadow: inset 0 0 0 1px var(--line-2); }
.lab-note { margin: 0; padding: 0 clamp(18px, 3cqw, 36px) 18px; color: var(--muted); font-size: 14px; max-width: 46em; }
.lab-insp .insp-scroll { gap: 14px; }
.pad {
  position: relative; aspect-ratio: 16 / 10; max-width: 100%; border-radius: var(--r); cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none;
  background: var(--panel-2); overflow: hidden;
}
.pad-grid {
  position: absolute; inset: 12px;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 12.5% 25%; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.pad.one .pad-grid { background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px); border-bottom: 0; }
.pad-dot {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 5px rgba(198, 255, 52, .18);
}
.pad.one .pad-dot { top: 50% !important; }
.pad-dot, .pad-grid, .pad-x, .pad-y { pointer-events: none; }
.pad.dragging { cursor: grabbing; }
.pad-x, .pad-y { position: absolute; font-size: 11.5px; color: var(--muted); background: var(--panel-2); padding: 0 4px; }
.pad-x { right: 10px; bottom: 4px; }
.pad-y { left: 10px; top: 4px; }
.code-box code {
  display: block; font: 12px/1.55 var(--mono); color: var(--muted); background: var(--bg);
  border-radius: var(--r); padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.code-box { position: relative; }
.code-box code { padding-right: 84px; }
.code-box .btn-ghost { position: absolute; top: 20px; right: 6px; height: 26px; padding: 0 10px; font-size: 12px; background: var(--bg); }

/* Coastline: the specimen word as land on a sea chart, measured with a ruler. */
.coast { flex: 1; position: relative; min-height: 0; margin: 12px 12px 0; border-radius: 10px; overflow: hidden; background: #eef6f9; }
.coast canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.coast-read {
  position: absolute; left: 12px; bottom: 12px; display: grid; gap: 2px; padding: 9px 12px 10px; border-radius: 6px;
  background: rgba(244, 249, 251, .94); color: #1e2b33; font-size: 13px; line-height: 1.35; max-width: calc(100% - 24px);
}
.coast-read b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.coast-read span { color: #4a5b66; font-variant-numeric: tabular-nums; }
.coast-read i { display: block; height: 3px; margin-top: 5px; background: #c4007a; border-radius: 2px; min-width: 2px; }
.coast-ctl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 28px; align-items: center; padding: 10px clamp(18px, 3cqw, 36px) 6px; }

/* ---------- Poster editor ---------- */
.ed-stage .stage-bar { position: relative; z-index: 2; }
.layer-tabs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.layer-tabs button {
  flex: none; height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-s); background: transparent;
  color: var(--muted); font-size: 13px; cursor: pointer;
}
.layer-tabs button:hover { color: var(--text); }
.layer-tabs button[aria-selected="true"] { background: var(--panel-3); color: var(--text); }
.layer-tabs .tab-add { color: var(--accent); }
.layer-tabs .tab-add:disabled { color: var(--faint); cursor: default; }
.ed-stage .menu { flex: none; }
.ed-canvas { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 20px; }
.ed-frame { position: relative; border-radius: 3px; overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, .5); }
.poster { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; touch-action: none; contain: layout paint; }
.poster .p-layer { cursor: grab; }
.poster .p-layer.is-sel { outline: 3px dashed rgba(128, 128, 128, .8); outline-offset: 10px; }
/* How to play a motion that answers the pointer; it fades once the pointer has been over the poster. */
.stage-hint {
  position: absolute; left: 50%; bottom: 8px; z-index: 3; transform: translateX(-50%); margin: 0; max-width: calc(100% - 24px);
  padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(14, 14, 15, .88);
  color: var(--text); font-size: 12.5px; line-height: 1.3; text-align: center; pointer-events: none; transition: opacity .5s;
}
.stage-hint.is-gone { opacity: 0; }
.opt-btns { display: flex; flex-wrap: wrap; gap: 6px 18px; }

.swatches { display: grid; grid-template-columns: repeat(6, 34px); justify-content: space-between; gap: 10px 8px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw:hover { border-color: var(--line-2); }
.sw[aria-checked="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel) inset; }
.status { margin: 0; min-height: 1.4em; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.status:empty { display: none; }

.kept-pop { display: grid; gap: 10px; padding: 12px; }
.pop-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.kept { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 8px 8px 4px 0; }
.kept-cell { position: relative; }
.kept-item { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: none; cursor: pointer; }
.kept-item:hover { border-color: var(--muted); }
.kept-item img { display: block; width: 100%; height: auto; }
.kept-x {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--pop); font-size: 14px; line-height: 1; cursor: pointer; padding: 0;
}

/* ---------- Game ---------- */
.game-box { background: var(--panel); border-radius: var(--r-l); padding: clamp(16px, 2.4vw, 32px); scroll-margin-top: var(--head); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode {
  text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: clamp(18px, 2.2vw, 28px); cursor: pointer; display: grid; gap: 8px; align-content: start;
}
.mode:hover { border-color: var(--accent); }
.mode strong { font-family: var(--display); font-weight: normal; font-size: clamp(24px, 2.6vw, 36px); line-height: 1; font-variation-settings: "wght" 760, "wdth" 120; }
.mode span { color: var(--muted); font-size: 15px; }
.game-meta { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.game-bar { display: grid; grid-template-columns: auto 1fr auto auto; gap: 16px; align-items: center; margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.clock { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.clock-fill { height: 100%; background: var(--accent); transform-origin: 0 50%; }
.clock-fill.low { background: #ff5a3c; }
.g-time { font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.g-score { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-card { position: relative; background: var(--panel-2); border-radius: var(--r-l); padding: 14px 18px; min-height: 200px; display: flex; flex-direction: column; overflow: hidden; }
.m-card.yours { box-shadow: inset 0 0 0 1px var(--accent); }
.m-label { font-size: 13px; color: var(--muted); }
.m-word { flex: 1; display: flex; align-items: center; font-size: clamp(44px, 6vw, 96px); line-height: 1; white-space: nowrap; }
.m-ghost {
  position: absolute; left: 18px; right: 18px; top: 14px; bottom: 14px; padding-top: 20px;
  color: transparent; -webkit-text-stroke: 1.5px var(--accent); pointer-events: none;
}
.m-sliders { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 32px; margin-top: 10px; }
.kern .k-stage { position: relative; background: var(--panel-2); border-radius: var(--r-l); overflow: hidden; }
.k-probe { position: absolute; visibility: hidden; white-space: pre; font-kerning: normal; }
.k-ch {
  position: absolute; left: 0; top: 50%; margin-top: -.62em; line-height: 1.2; cursor: ew-resize; touch-action: none; user-select: none;
  border-bottom: 2px solid var(--line);
}
.k-ch.fixed { cursor: default; color: var(--muted); border-bottom-color: transparent; }
.k-ch.grab { color: var(--accent); }
.k-ghost { color: transparent; -webkit-text-stroke: 1.5px var(--accent); border: 0; pointer-events: none; }
.k-hint { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.game-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.g-result { margin: 0; flex: 1; min-width: 220px; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.end-score { font-family: var(--display); font-size: clamp(56px, 9vw, 128px); line-height: .95; margin: 0; font-variation-settings: "wght" 880, "wdth" 125; }
.end-line { font-size: 20px; margin: 12px 0 18px; }
.end-rounds { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.end-chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Footer ---------- */
.foot { padding-block: 28px 44px; color: var(--muted); font-size: 13px; }
.foot p { margin: 0 0 6px; max-width: 62em; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1180px) {
  :root { --label-w: 84px; }
  .lab-body { grid-template-columns: 196px minmax(0, 1fr) 300px; }
  .ed-body { grid-template-columns: minmax(0, 1fr) 340px; }
}
/* Tablets and phones: sections flow down the page; the poster stays in view above its settings. */
@media (max-width: 900px) {
  .hero-copy, .modes, .match { grid-template-columns: 1fr; }
  .ws { height: auto; min-height: 0; max-height: none; }
  .lab-body, .ed-body { grid-template-columns: minmax(0, 1fr); }
  .fl-panel .font-list { max-height: 196px; }
  .lab-stage { min-height: 300px; }
  .specimen { font-size: calc(var(--spec, 1) * clamp(36px, 12cqw, 80px)); }
  .coast { min-height: 340px; }
  .insp-scroll, .ed-insp { overflow: visible; }
  /* Only the poster stays pinned: its toolbar slides up under the page header. */
  .ed-stage { position: sticky; top: calc(var(--head) + env(safe-area-inset-top, 0px) - var(--bar, 0px)); z-index: 6; box-shadow: 0 10px 24px rgba(0, 0, 0, .4); }
  .ed-canvas { flex: none; height: 40svh; padding: 12px; }
  .ed-insp .insp-foot { position: sticky; bottom: 0; z-index: 4; }
  .stage-bar { padding: 8px 10px; }
  .ed-stage .stage-bar .layer-tabs { order: 3; flex: 1 1 100%; }
}
@media (max-width: 560px) {
  .mark { font-size: 19px; }
  .nav { gap: 14px; }
  .hero-side p { font-size: 16px; }
  /* Starters, Showpieces, Shuffle and My posters share one row. */
  .ed-stage .stage-bar { gap: 6px; }
  .ed-stage .bar-actions .btn-ghost { padding: 0 8px; }
  .ed-stage .stage-bar .menu-btn { padding: 0 8px; }
  .ed-stage .stage-bar .menu-chev { display: none; }
  .game-bar { grid-template-columns: auto 1fr auto; }
  .g-score { grid-column: 1 / -1; }
  .m-card { min-height: 112px; padding: 12px 14px; }
  .m-word { font-size: 12vw; }
  .m-ghost { left: 14px; right: 14px; top: 12px; bottom: 12px; }
}
.hero-copy > *, .match > * { min-width: 0; }
