/* Self-hosted fonts — drop the files into public/fonts/ */
@font-face {
  font-family: "General Sans";
  src: url("fonts/GeneralSans-Variable.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Paper Mono";
  src: url("fonts/PaperMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Paper Mono";
  src: url("fonts/PaperMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0e0e10;
  --panel: #141417;
  --raised: #1c1c20;
  --hover: #26262c;
  --line: #24242a;
  --line-2: #33333b;
  --text: #ececf1;
  --muted: #8d8d98;
  --faint: #5d5d68;
  --accent: #c8ff3d;
  --accent-ink: #0e0e10;
  --sans: "General Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Paper Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
kbd {
  font: 500 10px/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 2px 4px;
}
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 10;
}
.brand { display: flex; align-items: center; color: var(--text); text-decoration: none; }
.brand svg { display: block; width: auto; }
.brand-iso { display: none !important; }
.file {
  flex: 1; min-width: 0;
  font: 12px var(--mono); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.actions { display: flex; align-items: center; gap: 8px; }

.btn {
  appearance: none;
  height: 32px;
  padding: 0 12px;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  list-style: none;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); border-color: #45454f; }
.btn:focus-visible, .seg button:focus-visible, .preset:focus-visible, .menu-pop button:focus-visible, .zoom button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #d8ff70; border-color: #d8ff70; }
.btn-ghost { background: transparent; }
summary::-webkit-details-marker { display: none; }

.menu { position: relative; }
.menu[open] > summary { background: var(--hover); }
.menu[open] > summary.btn-primary { background: #d8ff70; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 200px;
  padding: 6px;
  display: flex; flex-direction: column;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .55);
  z-index: 50;
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu-pop button {
  all: unset;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.menu-pop button:hover { background: var(--hover); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 2px; }
.samples { min-width: 260px; }
.samples button { justify-content: flex-start; gap: 12px; }
.sample-thumb {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: #f3f1ec; border-radius: 8px; padding: 6px;
}
.sample-thumb svg { width: 100%; height: 100%; }
.sample-name { display: block; font-weight: 500; }
.sample-note { display: block; font-size: 11px; color: var(--muted); }

/* ---------- layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

.stage {
  flex: 1; min-width: 0;
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background-color: #0b0b0d;
  background-image: radial-gradient(circle at 1px 1px, #1f1f25 1px, transparent 0);
  background-size: 22px 22px;
}
.stage.panning { cursor: grabbing; }
.scene {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 30px 90px rgba(0, 0, 0, .55);
}
.scene svg { display: block; width: 100%; height: 100%; }

.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: var(--muted);
  cursor: default;
}

.hud {
  position: absolute; left: 16px; right: 16px; bottom: 16px;
  display: flex; align-items: flex-end; justify-content: center; gap: 12px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.stats, .zoom {
  background: rgba(20, 20, 23, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  border-radius: 9px;
}
.stats {
  display: flex; gap: 14px; white-space: nowrap;
  position: absolute; top: 16px; left: 16px;
  padding: 7px 12px;
  font: 11px var(--mono); color: var(--muted);
}
.stats b { color: var(--text); font-weight: 500; }
.stats:empty { display: none; }
.zoom { display: flex; overflow: hidden; flex: none; }
.zoom button {
  all: unset;
  height: 30px; min-width: 30px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  font: 12px var(--mono);
  cursor: pointer;
}
.zoom button:hover { background: var(--hover); }
#zoomLabel { min-width: 52px; color: var(--muted); border-inline: 1px solid var(--line-2); }
#zoomFit { border-left: 1px solid var(--line-2); }

/* drop area: the whole stage. No overlay prompt, just a quiet edge highlight. */
.stage::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow .15s;
}
.stage.drop-active::after { box-shadow: inset 0 0 0 1.5px var(--accent); }
.stage.drop-active { cursor: copy; }

/* ---------- panel ---------- */
.panel {
  width: 312px; flex: none;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.sec { padding: 14px 16px 16px; border-bottom: 1px solid var(--line); }
.sec-head { display: flex; align-items: center; justify-content: space-between; min-height: 22px; }
.sec-toggle {
  all: unset; box-sizing: border-box;
  flex: 1; display: flex; align-items: center; justify-content: space-between;
  min-height: 22px; cursor: pointer; border-radius: 4px;
}
.sec-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.sec-toggle h3 {
  margin: 0;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
  transition: color .12s;
}
.sec-toggle:hover h3 { color: var(--text); }
.sec-toggle svg { color: var(--faint); transition: transform .15s; }
.sec.collapsed .sec-toggle svg { transform: rotate(-90deg); }
.sec.collapsed { padding-bottom: 14px; }
.sec-body { display: grid; gap: 14px; margin-top: 14px; }

/* sub-groups inside a section (Outline, Anchor points, Handles, Caption) */
.sub { display: grid; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.sec-body > .sub:first-child { padding-top: 0; border-top: 0; }
.sub-head { display: flex; align-items: center; justify-content: space-between; min-height: 18px; }
.sub-head h4 { margin: 0; font-size: 12px; font-weight: 600; color: var(--text); transition: color .15s; }
.sub-body { display: grid; gap: 12px; transition: opacity .15s; }
.sub.off .sub-body { opacity: .35; }
.sub.off .sub-head h4 { color: var(--faint); }

.field { display: grid; gap: 7px; }
.field-color, .field-text { grid-template-columns: 1fr auto; align-items: center; }
.field-text { grid-template-columns: 88px 1fr; }
.field-label { color: #c4c4cc; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.range-out { font: 11px var(--mono); color: var(--muted); }
.hint { margin: -2px 0 0; font-size: 11px; color: var(--faint); }

/* colour */
.color {
  display: flex; align-items: center;
  height: 30px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 3px;
}
.color:focus-within { border-color: #55555f; }
.color input[type=color] {
  appearance: none; -webkit-appearance: none;
  width: 22px; height: 22px;
  border: 0; padding: 0; border-radius: 5px;
  background: none; cursor: pointer;
}
.color input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.color input[type=color]::-moz-color-swatch { border: 0; border-radius: 5px; }
.hex {
  width: 74px;
  background: none; border: 0; outline: none;
  color: var(--text);
  font: 12px var(--mono);
  padding: 0 6px 0 8px;
  text-transform: uppercase;
}

/* text */
.text {
  width: 100%; height: 30px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  padding: 0 9px;
  outline: none;
}
.text:focus { border-color: #55555f; }

/* range */
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px; margin: 0;
  background: transparent; cursor: pointer;
  --p: 50%;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--text) var(--p), var(--line-2) var(--p));
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--panel);
  box-shadow: 0 0 0 1px var(--text);
}
input[type=range]::-moz-range-thumb {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--text);
}
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--accent); }

/* segmented */
.seg {
  display: flex;
  padding: 3px; gap: 2px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 8px;
}
.seg button {
  flex: 1;
  height: 24px;
  border: 0; border-radius: 5px;
  background: none;
  color: var(--muted);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--hover); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4), inset 0 0 0 1px var(--line-2); }

/* switch */
.switch { position: relative; width: 30px; height: 18px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0;
  background: var(--line-2); border-radius: 18px;
  transition: background .15s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text);
  transition: transform .15s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(12px); background: var(--accent-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* checkbox */
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; color: #c4c4cc; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box {
  width: 16px; height: 16px; flex: none;
  border: 1px solid var(--line-2); border-radius: 4px;
  background: var(--raised);
  display: grid; place-items: center;
}
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check-box::after {
  content: ""; width: 8px; height: 4px;
  border: 2px solid var(--accent-ink); border-top: 0; border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}
.check input:focus-visible + .check-box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* presets */
.preset-group { gap: 8px; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preset-colour .presets { grid-template-columns: repeat(3, 1fr); }
.preset {
  display: grid; gap: 5px;
  padding: 0; border: 0; background: none;
  cursor: pointer; text-align: left; color: inherit; font: inherit;
}
.preset-swatch {
  height: 40px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: box-shadow .12s;
  overflow: hidden;
}
.preset-colour .preset-swatch { height: 44px; }
.preset-swatch svg { display: block; width: 100%; height: 100%; }
.preset-swatch i { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(127,127,127,.25); }
.preset-swatch i:first-child { border-radius: 3px; }
.preset-name { font-size: 11px; color: var(--muted); padding-left: 2px; }
.preset:hover .preset-swatch { box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.preset.on .preset-swatch { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--accent); }
.preset.on .preset-name { color: var(--text); }
.preset:focus-visible { outline: none; }
.preset:focus-visible .preset-swatch, .preset:focus-visible .size-chip { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--accent); }
.size-chip {
  display: grid; place-items: center; height: 30px;
  border-radius: 7px; background: var(--field, rgba(255,255,255,.04));
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  transition: box-shadow .12s, color .12s, background .12s;
}
.preset:hover .size-chip { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.preset.on .size-chip { background: var(--accent); color: var(--accent-ink); box-shadow: none; }

.panel-foot { padding: 16px; display: grid; gap: 12px; }
.panel-foot .btn { justify-content: center; }
.tip { margin: 0; font-size: 11px; color: var(--faint); line-height: 1.7; }

/* ---------- dialog ---------- */
dialog {
  width: min(640px, calc(100vw - 32px));
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
dialog form { padding: 18px; display: grid; gap: 14px; }
dialog h2 { margin: 0; font-size: 15px; font-weight: 600; }
dialog textarea {
  width: 100%; height: 280px; resize: vertical;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  color: var(--text);
  font: 12px/1.55 var(--mono);
  padding: 12px;
  outline: none;
}
dialog textarea:focus { border-color: #55555f; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .grow { flex: 1; }

dialog.confirm { width: min(440px, calc(100vw - 32px)); }
dialog.confirm form { gap: 12px; padding: 20px; }
dialog.confirm h2 { font-size: 16px; letter-spacing: -0.01em; }
dialog.confirm p { margin: 0; color: var(--muted); line-height: 1.55; }
dialog.confirm p b { color: var(--text); font-weight: 500; font-family: var(--mono); font-size: 12px; word-break: break-all; }
.save-format { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 6px; color: #c4c4cc; }
.save-format .seg { width: 170px; }
dialog.confirm .dialog-actions { margin-top: 6px; }
@media (max-width: 420px) {
  dialog.confirm .dialog-actions { flex-wrap: wrap; }
  dialog.confirm .dialog-actions .grow { display: none; }
  dialog.confirm .dialog-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center;
  z-index: 100; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  padding: 9px 14px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(-6px);
  transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: none; }
.toast-error { border-color: #7a2a2a; color: #ffb4b4; }
.toast-warn { border-color: #6b5a1f; color: #ffe08a; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  body { overflow: auto; height: auto; min-height: 100%; }
  .layout { flex-direction: column; }
  .stage { flex: none; height: 62vh; min-height: 340px; }
  .panel { width: auto; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .file { display: none; }
  .brand { flex: 1; }
}
@media (max-width: 520px) {
  .topbar { gap: 8px; padding: 0 8px 0 12px; }
  .hide-sm, #openBtn span { display: none; }
  .brand-lockup { display: none !important; }
  .brand-iso { display: block !important; }
  .btn { padding: 0 10px; }
  .hud { left: 8px; right: 8px; bottom: 8px; }
  .stats { gap: 10px; }
  .stats span:nth-child(n+3) { display: none; }
  #zoomIn, #zoomOut { display: none; }
  #zoomLabel { border-left: 0; }
  .hud-play { padding: 0 11px; }
  .hud-play .play-label { display: none; }
}

/* ---------- animation ---------- */
.hud-right { display: flex; gap: 8px; align-items: flex-end; flex: none; }
.hud-right .zoom { margin-left: 8px; }
.hud-play {
  all: unset;
  height: 32px; padding: 0 12px 0 11px;
  display: flex; align-items: center; gap: 7px;
  background: rgba(20, 20, 23, .82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 9px;
  font-weight: 500; cursor: pointer;
}
.hud-play:hover { background: var(--hover); }
.hud-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hud-play .i-play { color: var(--accent); }
.i-stop, .playing .i-play { display: none; }
.playing .i-stop { display: block; }
.btn-play { justify-content: center; width: 100%; height: 34px; }
.btn-play .i-play { color: var(--accent); }
.btn-play.playing, .hud-play.playing { border-color: var(--accent); }
.menu-label {
  padding: 4px 10px 2px;
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
}
body.recording .actions, body.recording .panel, body.recording .hud-play, body.recording .hud-window { pointer-events: none; opacity: .45; }
body.recording .stage { cursor: progress; }

/* ---------- linked sizing ---------- */
.link-toggle {
  all: unset; box-sizing: border-box;
  width: 100%; margin-top: 12px;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: var(--raised);
  border: 1px solid var(--line-2); border-radius: 9px;
  cursor: pointer;
}
.link-toggle:hover { border-color: #45454f; }
.link-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link-toggle svg { flex: none; margin-top: 1px; color: var(--muted); }
.link-toggle .i-linked, .link-toggle.on .i-unlinked { display: none; }
.link-toggle.on .i-linked { display: block; color: var(--accent); }
.link-toggle.on { border-color: rgba(200, 255, 61, .45); }
.link-title { display: block; font-weight: 500; }
.link-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.field.is-linked .field-label::after {
  content: "";
  display: inline-block; width: 11px; height: 11px; margin-left: 6px; vertical-align: -1px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 9.5l3-3M7 4.5l1.2-1.2a2.8 2.8 0 014 4L11 8.5M9 11.5l-1.2 1.2a2.8 2.8 0 01-4-4L5 7.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 9.5l3-3M7 4.5l1.2-1.2a2.8 2.8 0 014 4L11 8.5M9 11.5l-1.2 1.2a2.8 2.8 0 01-4-4L5 7.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .8;
}

/* ---------- window view ---------- */
.hud-window { display: flex; gap: 4px; }
.hud-btn {
  all: unset;
  height: 32px; padding: 0 12px 0 11px;
  display: flex; align-items: center; gap: 7px;
  background: rgba(20, 20, 23, .82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 9px;
  font-weight: 500; cursor: pointer; white-space: nowrap;
}
.hud-btn:hover { background: var(--hover); }
.hud-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hud-btn.on { border-color: var(--accent); }
.hud-btn.on svg { color: var(--accent); }
.hud-clear { padding: 0; width: 32px; justify-content: center; }
.stage.selecting, .stage.selecting.panning { cursor: crosshair; }
.win-rect {
  position: absolute;
  border: 1.5px solid var(--accent);
  background: rgba(200, 255, 61, .08);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35);
  border-radius: 2px;
  pointer-events: none;
}
.win-rect[data-ratio]:not([data-ratio=""])::after {
  content: attr(data-ratio);
  position: absolute; left: 6px; top: 6px;
  padding: 2px 6px; border-radius: 4px;
  font: 500 10px/1.4 var(--mono);
  color: var(--accent-ink); background: var(--accent);
}
.win-tag {
  color: var(--accent-ink); background: var(--accent);
  border-radius: 4px; padding: 0 5px; margin: -1px 0;
  font-weight: 500;
}
@media (max-width: 520px) {
  .stats { top: 8px; left: 8px; }
  .hud-btn .win-label { display: none; }
  .hud-window .hud-btn { padding: 0 10px; }
}
