/* Brushograph WebUI
 *
 * One rule governs colour here: colour means pigment. Cyan, magenta, yellow and
 * water identify trays and nothing else in the interface is saturated, so a
 * coloured mark on screen always stands for paint in a cup. Black is a pigment
 * too, which is why the button that commits a job is simply black.
 *
 * Type is a system stack on purpose: this runs on a workshop machine that may
 * have no route to a font CDN, and a control panel that waits on the network to
 * become legible is a worse panel. Numerals are tabular throughout — nearly
 * every input here is a coordinate or a millimetre.
 */
@font-face {
  font-family: 'UnifrakturMaguntia';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('UnifrakturMaguntia.ttf') format('truetype'),
       url('https://fonts.gstatic.com/s/unifrakturmaguntia/v22/WWXPlieVYwiGNomYU-ciRLRvEmK7oaVunw.ttf') format('truetype');
}

@font-face {
  font-family: 'UnifrakturCook';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('UnifrakturCook.ttf') format('truetype'),
       url('https://fonts.gstatic.com/s/unifrakturcook/v25/IurA6Yli8YOdcoky-0PTTdkm56n05Uw1.ttf') format('truetype');
}

:root {
  --ground: #eceeed;         /* the bench the paper sits on */
  --sheet: #ffffff;
  --sunk: #f4f6f5;
  --line: #d5d9d8;
  --line-soft: #e6e9e8;
  --ink: #222625;
  --ink-dim: #5d6564;
  --ink-faint: #6f7675;
  --black: #101211;          /* the K tray: the one non-pigment darkness */
  --bad: #a8321f;
  --good: #1c7a4e;
  --warn: #8a5a12;
  --c: #00aeef; --m: #ec008c; --y: #ffd400; --k: #23282f; --water: #96c8eb;
  --preview-cup: #8b3e2f;    /* trips into the cups: present, never louder than paint */
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --step: 34px;
}
/* The default theme follows the machine it is being read on. Every other theme
 * is a decision, so it holds whatever the light in the room is doing. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="default"] { color-scheme: dark; }
  :root:not([data-theme]), :root[data-theme="default"] {
    --ground: #161918; --sheet: #1d2120; --sunk: #232726;
    --line: #313736; --line-soft: #272c2b;
    --ink: #e6e9e8; --ink-dim: #9aa3a1; --ink-faint: #868f8d;
    --black: #f2f4f3;
    --bad: #e08a7a; --good: #6cc094; --warn: #d4a256;
    --preview-cup: #b8735c;
    --k: #dfe4e2;  /* black paint on a dark paper has to be light */
  }
}

/* --------------------------------------------------------------- dark mode */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #161918; --sheet: #1d2120; --sunk: #232726;
  --line: #313736; --line-soft: #272c2b;
  --ink: #e6e9e8; --ink-dim: #9aa3a1; --ink-faint: #868f8d;
  --black: #f2f4f3;
  --bad: #e08a7a; --good: #6cc094; --warn: #d4a256;
  --preview-cup: #b8735c;
  --k: #dfe4e2;  /* black paint on a dark paper has to be light */
}

/* ----------------------------------------------------------- coconut mode */
/* Husk, flesh and a palm lit from behind. The green is the one bright thing;
 * the panels are the pale inside of the nut and the rules are its shell. */
:root[data-theme="coconut"] {
  /* Light, not dark: the ground is a dark palm but every panel is the pale
   * inside of the nut, and the form controls sit on those. Under a dark scheme
   * the browser drew unchecked boxes as filled dark squares on cream, which
   * read as ticked. */
  color-scheme: light;
  --ground: #1b2a1c;
  --sheet: #fdf6e8;
  --sunk: #f4e8d2;
  --line: #b98a52;
  --line-soft: #e0cba7;
  --ink: #37220f;
  --ink-dim: #6b4a2a;
  --ink-faint: #7d5c39;
  --black: #2f7d32;
  --bad: #9c2b16;
  --good: #2f7d32;
  --warn: #8a5a12;
  --neon: #6bff3d;
  --husk: #4a2c18;
  --preview-cup: #6b4a2a;
}
:root[data-theme="coconut"] body {
  background:
    repeating-linear-gradient(103deg, rgba(0,0,0,.13) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(77deg, rgba(0,0,0,.09) 0 1px, transparent 1px 9px),
    var(--ground);
}
:root[data-theme="coconut"] .topbar,
:root[data-theme="coconut"] footer { border-color: var(--husk); }
:root[data-theme="coconut"] .brand h1 { color: var(--neon); text-shadow: 0 0 14px rgba(107,255,61,.5); }
:root[data-theme="coconut"] .brand p,
:root[data-theme="coconut"] footer a { color: #cfe8bd; }
:root[data-theme="coconut"] .topbar, :root[data-theme="coconut"] footer { background: var(--husk); }
:root[data-theme="coconut"] .topbar .field-label { color: #cfe8bd; }
:root[data-theme="coconut"] .step-head { border-bottom-color: var(--neon); }
:root[data-theme="coconut"] .step-head h2 { color: var(--neon); }
:root[data-theme="coconut"] .step-head p { color: #cfe8bd; }
:root[data-theme="coconut"] .step-head h2::after { content: " 🥥"; font-size: .85em; }
:root[data-theme="coconut"] .card, :root[data-theme="coconut"] .tray,
:root[data-theme="coconut"] .plan, :root[data-theme="coconut"] .setup,
:root[data-theme="coconut"] .canvas-wrap, :root[data-theme="coconut"] .sim-stat {
  border-width: 2px; border-radius: 16px;
}
:root[data-theme="coconut"] .mark {
  /* Opts all the way out of the logo mask, not just its background: a mask
     left active here would clip the coconut emoji below to the brush-and-gear
     silhouette instead of leaving it whole. */
  background: none; box-shadow: none; border-radius: 0;
  -webkit-mask: none; mask: none;
  display: grid; place-items: center; font-size: 46px; line-height: 1;
}
:root[data-theme="coconut"] .mark::before { content: "🥥"; }
:root[data-theme="coconut"] .primary { background: var(--neon); color: #10240c; border-color: var(--neon); }
:root[data-theme="coconut"] .placeholder p { color: #cfe8bd; }

/* ------------------------------------------------------------- pinkograph */
/* A port of the machine's own theme, not an impression of it. The values below
 * are taken from theme-Pinkograph.gz as it sits on the controller's flash, so
 * the two interfaces are the same interface wearing the same colours.
 *
 *   ground #0B0014   panel #16032A   strip  #22064A   control #2C0857
 *   pink   #FF6BB5   text  #FFEAF4   dim    #E3A0C0   cyan    #00F5FF
 *
 * The one thing that moves there is the navbar's glow, swelling and settling
 * on a 2.6s ease-in-out — `pinkograph-hum`. That is what makes the sign look
 * as though it is breathing; the logo itself is only recoloured. The same hum
 * runs under the separators here.
 */
:root[data-theme="pinkograph"] {
  color-scheme: dark;
  --ground: #0B0014;
  --sheet: #16032A;
  --sunk: #2C0857;
  --line: #FF6BB5;
  --line-soft: #3C0A66;
  --ink: #FFEAF4;
  --ink-dim: #E3A0C0;
  --ink-faint: #C98BAE;
  --black: #FF6BB5;
  --bad: #FF3860;
  --good: #39FF14;
  --warn: #FFD400;
  --neon: #FF6BB5;
  --neon-cold: #00F5FF;
  --strip: #22064A;
  --preview-cup: #39FF14;   /* the theme's own green; no tray holds green */
  --k: #e8d6f5;  /* black paint on a dark paper has to be light */
}
:root[data-theme="pinkograph"] body {
  background-color: var(--ground);
  background-image:
    radial-gradient(circle at 12% -5%, rgba(255,107,181,.20), transparent 45%),
    radial-gradient(circle at 88% 105%, rgba(0,245,255,.14), transparent 45%);
  background-attachment: fixed;
}

/* The sign across the top, humming. */
:root[data-theme="pinkograph"] .topbar {
  background: linear-gradient(90deg, #16032A 0%, #2C0857 50%, #16032A 100%);
  border-bottom: 2px solid rgba(255,107,181,.9);
  animation: pk-hum 2.6s ease-in-out infinite;
}
:root[data-theme="pinkograph"] footer {
  background: linear-gradient(90deg, #16032A 0%, #2C0857 50%, #16032A 100%);
  border-top: 2px solid rgba(255,107,181,.9);
  animation: pk-hum-up 2.6s ease-in-out infinite;
}
:root[data-theme="pinkograph"] .brand h1 {
  color: var(--neon);
  text-shadow: 0 0 6px rgba(255,107,181,.95), 0 0 18px rgba(255,107,181,.55);
}
:root[data-theme="pinkograph"] .brand p { color: var(--ink-dim); }
:root[data-theme="pinkograph"] .mark {
  background: conic-gradient(from 210deg, var(--neon), var(--neon-cold), var(--neon));
  box-shadow: 0 0 10px rgba(255,107,181,.7);
}

/* Every surface is a lit tube. */
:root[data-theme="pinkograph"] .card, :root[data-theme="pinkograph"] .tray,
:root[data-theme="pinkograph"] .plan, :root[data-theme="pinkograph"] .setup,
:root[data-theme="pinkograph"] .canvas-wrap, :root[data-theme="pinkograph"] .step > .group,
:root[data-theme="pinkograph"] .step > .panel, :root[data-theme="pinkograph"] .sim-stat {
  background-color: var(--sheet);
  border: 1px solid rgba(255,107,181,.75);
  box-shadow: 0 0 10px rgba(255,107,181,.48), 0 0 26px rgba(255,107,181,.26),
              inset 0 0 16px rgba(255,107,181,.10);
}

/* The separators glow the way the navbar does — but the glow belongs to the
   line, not to the block above it. Animating the heading's own box-shadow lit a
   rectangle behind the words and read as a panel; a one-pixel strip under the
   border glows as a line, which is what the dashboard does. */
:root[data-theme="pinkograph"] .step-head {
  position: relative; border-bottom: 1px solid var(--neon);
}
:root[data-theme="pinkograph"] .step-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--neon);
  animation: pk-hum 2.6s ease-in-out infinite;
}
:root[data-theme="pinkograph"] .step-head h2 {
  color: var(--neon);
  text-shadow: 0 0 6px rgba(255,107,181,.95), 0 0 18px rgba(255,107,181,.55);
}
:root[data-theme="pinkograph"] .step-head p { color: var(--ink-dim); }

/* A group's name on a rule to the edge, as "Modes" has on the dashboard. */
:root[data-theme="pinkograph"] .group > h3 {
  color: var(--neon); display: flex; align-items: center; gap: 12px;
  text-shadow: 0 0 6px rgba(255,107,181,.7);
}
:root[data-theme="pinkograph"] .group > h3::after {
  content: ""; flex: 1; height: 1px; background: var(--neon); opacity: .55;
}

/* Panel headers are a strip, as the FILES and MACROS panels are. */
:root[data-theme="pinkograph"] .tray header {
  background: linear-gradient(90deg, #2A0654 0%, #3C0A66 50%, #2A0654 100%);
  margin: -13px -15px 11px; padding: 9px 15px;
  border-bottom: 1px solid rgba(255,107,181,.6);
}
:root[data-theme="pinkograph"] .tray header b {
  color: var(--neon); text-shadow: 0 0 6px rgba(255,107,181,.7);
}
:root[data-theme="pinkograph"] .setup > summary span {
  color: var(--neon); text-shadow: 0 0 6px rgba(255,107,181,.7);
}
:root[data-theme="pinkograph"] .tag { border-color: rgba(0,245,255,.45); color: var(--neon-cold); }

/* Controls, exactly as the dashboard styles its buttons. */
/* Buttons are tubes too. They breathe on the same 2.6s the sign does, so the
   whole thing pulses as one rather than to two different clocks — a filled one
   throwing light around it, an outlined one lit from within. A button that
   cannot be pressed does neither. */
:root[data-theme="pinkograph"] .ghost, :root[data-theme="pinkograph"] .icon {
  background: #2C0857; border-color: var(--neon); color: var(--ink);
  text-shadow: 0 0 7px rgba(255,107,181,.45);
}
:root[data-theme="pinkograph"] .ghost:not(:disabled),
:root[data-theme="pinkograph"] .icon:not(:disabled) {
  animation: pk-tube-hum 2.6s ease-in-out infinite;
}
:root[data-theme="pinkograph"] .ghost:hover, :root[data-theme="pinkograph"] .icon:hover {
  background: #3C0A66; border-color: var(--neon); color: var(--neon);
}
:root[data-theme="pinkograph"] .primary {
  background: var(--neon); border-color: var(--neon); color: #14001F; font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 0 12px rgba(255,107,181,.6), 0 0 30px rgba(255,107,181,.3);
}
:root[data-theme="pinkograph"] .primary:not(:disabled) {
  animation: pk-sign-hum 2.6s ease-in-out infinite;
}
:root[data-theme="pinkograph"] .primary:hover {
  background: #FFA6D4; border-color: #FFA6D4;
}
:root[data-theme="pinkograph"] button:disabled { box-shadow: none; opacity: .38; }

/* The swing is wide on purpose: a glow that only varies by a tenth reads as a
   rendering artefact rather than as a sign breathing. The fill brightens with
   the halo, so the button itself pulses and not just the air around it. */
/* The fill is animated directly rather than through filter: brightness, which
   is applied to the element's shadow as well and made the halo shrink as the
   face brightened — the two halves of the pulse fighting each other. */
@keyframes pk-sign-hum {
  0%, 100% {
    background-color: #E05398;
    box-shadow: 0 0 6px rgba(255,107,181,.40), 0 0 14px rgba(255,107,181,.16);
  }
  50% {
    background-color: #FFA6D4;
    box-shadow: 0 0 26px rgba(255,107,181,1), 0 0 62px rgba(255,107,181,.75),
                0 0 110px rgba(255,107,181,.4);
  }
}
@keyframes pk-tube-hum {
  0%, 100% {
    box-shadow: inset 0 0 8px rgba(255,107,181,.08), 0 0 5px rgba(255,107,181,.18);
    border-color: rgba(255,107,181,.55);
  }
  50% {
    box-shadow: inset 0 0 18px rgba(255,107,181,.30), 0 0 26px rgba(255,107,181,.75);
    border-color: #FFA6D4;
  }
}
:root[data-theme="pinkograph"] input[type="text"],
:root[data-theme="pinkograph"] input[type="number"],
:root[data-theme="pinkograph"] select, :root[data-theme="pinkograph"] input[type="file"] {
  background-color: var(--sheet); border-color: var(--neon); color: var(--ink);
}
:root[data-theme="pinkograph"] input[type="range"] { accent-color: var(--neon); }
:root[data-theme="pinkograph"] input[type="checkbox"] { accent-color: var(--neon); }
:root[data-theme="pinkograph"] .switch { background: #14001F; border-color: var(--line-soft); }
:root[data-theme="pinkograph"] .switch b { color: var(--neon); }
:root[data-theme="pinkograph"] .coord { background: #14001F; border-color: var(--line-soft); }
:root[data-theme="pinkograph"] .sim-stat b { color: var(--neon); }
:root[data-theme="pinkograph"] .inline-file, :root[data-theme="pinkograph"] footer a { color: var(--ink); }

@keyframes pk-hum {
  0%, 100% { box-shadow: 0 2px 10px rgba(255,107,181,.45), 0 2px 26px rgba(255,107,181,.20); }
  50%      { box-shadow: 0 2px 18px rgba(255,107,181,.85), 0 2px 44px rgba(255,107,181,.40); }
}
@keyframes pk-hum-up {
  0%, 100% { box-shadow: 0 -2px 10px rgba(255,107,181,.45), 0 -2px 26px rgba(255,107,181,.20); }
  50%      { box-shadow: 0 -2px 18px rgba(255,107,181,.85), 0 -2px 44px rgba(255,107,181,.40); }
}
/* Flashing signs are a migraine risk; the machine's own theme says so too. */
@media (prefers-reduced-motion: reduce) {
  :root[data-theme="pinkograph"] .topbar,
  :root[data-theme="pinkograph"] footer,
  :root[data-theme="pinkograph"] .step-head::after {
    animation: none; box-shadow: 0 2px 14px rgba(255,107,181,.55);
  }
  :root[data-theme="pinkograph"] .primary,
  :root[data-theme="pinkograph"] .ghost,
  :root[data-theme="pinkograph"] .icon {
    animation: none;
  }
}

/* -------------------------------------------------------------------- uwu */
/* A pink sign with the lights up. The ground is not black but the darkest pink
 * that still reads as dark, every edge is lit, and the chrome carries the
 * rainbow. Everything that moves stops under prefers-reduced-motion. */
:root[data-theme="uwu"] {
  color-scheme: dark;
  --ground: #1a0416;
  --sheet: #2b0824;
  --sunk: #3a0c2f;
  --line: #ff2d95;
  --line-soft: #7d1f57;
  --ink: #ffe8f6;
  --ink-dim: #ffb3de;
  --ink-faint: #e58cc0;
  --black: #ff2d95;
  --bad: #ff6b6b;
  --good: #4ade80;
  --warn: #fbbf24;
  --neon: #ff2d95;
  --neon-2: #ff8ad4;
  --glow: 0 0 6px rgba(255,45,149,.95), 0 0 20px rgba(255,45,149,.7);
  --pride: linear-gradient(90deg, #ff2d95, #ff6b3d, #ffd400, #4ade80, #22d3ee, #a855f7, #ff2d95);
  --preview-cup: #a855f7;   /* violet: nothing in the trays is violet */
  --k: #ffdcf0;  /* black paint on a dark paper has to be light */
}
:root[data-theme="uwu"] body {
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255,45,149,.30), transparent 65%),
    radial-gradient(90% 60% at 15% 110%, rgba(168,85,247,.26), transparent 60%),
    var(--ground);
  background-attachment: fixed;
}
:root[data-theme="uwu"] .topbar,
:root[data-theme="uwu"] footer {
  background: rgba(43,8,36,.92);
  border-color: var(--neon);
  box-shadow: 0 0 24px -6px var(--neon);
}
:root[data-theme="uwu"] .brand h1 {
  background: var(--pride); background-size: 320% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 9px rgba(255,45,149,.85));
  animation: pride-run 9s linear infinite, neon-flicker 6s infinite steps(1);
}
:root[data-theme="uwu"] .mark {
  background: conic-gradient(#ff2d95, #ff6b3d, #ffd400, #4ade80, #22d3ee, #a855f7, #ff2d95);
  box-shadow: 0 0 16px 3px rgba(255,45,149,.85);
  animation: mark-spin 14s linear infinite;
}
:root[data-theme="uwu"] .step-head {
  border-bottom: 2px solid transparent;
  border-image: var(--pride) 1;
  box-shadow: 0 3px 18px -8px var(--neon);
}
:root[data-theme="uwu"] .step-head h2 { color: #fff; text-shadow: var(--glow); }
:root[data-theme="uwu"] .step-head p { color: var(--ink-dim); }
:root[data-theme="uwu"] .card, :root[data-theme="uwu"] .tray,
:root[data-theme="uwu"] .plan, :root[data-theme="uwu"] .setup,
:root[data-theme="uwu"] .canvas-wrap, :root[data-theme="uwu"] .step > .group,
:root[data-theme="uwu"] .step > .panel,
:root[data-theme="uwu"] .sim-stat {
  box-shadow: 0 0 0 1px rgba(255,45,149,.5), 0 0 26px -10px var(--neon),
              inset 0 0 30px -22px var(--neon-2);
}
:root[data-theme="uwu"] .group > h3 { color: var(--neon-2); text-shadow: 0 0 8px rgba(255,138,212,.55); }
:root[data-theme="uwu"] .tray header b,
:root[data-theme="uwu"] .coord b { color: #fff; text-shadow: 0 0 7px rgba(255,45,149,.6); }
:root[data-theme="uwu"] .primary {
  background: var(--pride); background-size: 320% 100%;
  color: #2b0016; border: 0; font-weight: 700;
  box-shadow: 0 0 18px -2px var(--neon), 0 0 40px -10px #a855f7;
  animation: pride-run 6s linear infinite, primary-pulse 2.6s ease-in-out infinite;
}
:root[data-theme="uwu"] .ghost { border-color: var(--neon); }
:root[data-theme="uwu"] .switch { border-color: var(--line-soft); background: var(--sunk); }
:root[data-theme="uwu"] .switch b { color: var(--neon-2); }
:root[data-theme="uwu"] .tag { border-color: var(--line-soft); color: var(--ink-dim); }
:root[data-theme="uwu"] .inline-file,
:root[data-theme="uwu"] footer a { color: var(--ink); }
:root[data-theme="uwu"] input[type="text"],
:root[data-theme="uwu"] input[type="number"],
:root[data-theme="uwu"] select, :root[data-theme="uwu"] input[type="file"] {
  background: var(--sunk); border-color: var(--line-soft);
}
:root[data-theme="uwu"] input[type="range"] { accent-color: var(--neon); }
:root[data-theme="uwu"] input[type="checkbox"] { accent-color: var(--neon); }

@keyframes pride-run { to { background-position: 320% 0; } }
@keyframes mark-spin { to { transform: rotate(360deg); } }
@keyframes primary-pulse {
  0%, 100% { box-shadow: 0 0 18px -2px var(--neon), 0 0 40px -10px #a855f7; }
  50% { box-shadow: 0 0 26px 1px var(--neon), 0 0 60px -6px #a855f7; }
}
@keyframes neon-flicker {
  0%, 3%, 6%, 41%, 44%, 100% { opacity: 1; }
  2%, 5%, 42% { opacity: .45; }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-theme="uwu"] .brand h1,
  :root[data-theme="uwu"] .mark,
  :root[data-theme="uwu"] .primary { animation: none; }
}

/* ------------------------------------------- bruschologischer kongress */
/* Stark monochrome print and monumentality: high-contrast black on aged paper,
 * sharp rectilinear geometries, and UniFraktur typography throughout. */
:root[data-theme="kongress"] {
  color-scheme: light;
  --ground: #dedcd5;
  --sheet: #f7f6f1;
  --sunk: #ebe9e1;
  --line: #000000;
  --line-soft: #555555;
  --ink: #000000;
  --ink-dim: #2b2b2b;
  --ink-faint: #555555;
  --black: #000000;
  --bad: #8b0000;
  --good: #1b4d24;
  --warn: #6e4600;
  --k: #000000;
  --preview-cup: #8b0000;
}

:root[data-theme="kongress"],
:root[data-theme="kongress"] body,
:root[data-theme="kongress"] button,
:root[data-theme="kongress"] input,
:root[data-theme="kongress"] select,
:root[data-theme="kongress"] textarea,
:root[data-theme="kongress"] label,
:root[data-theme="kongress"] p,
:root[data-theme="kongress"] a,
:root[data-theme="kongress"] span,
:root[data-theme="kongress"] h1,
:root[data-theme="kongress"] h2,
:root[data-theme="kongress"] h3,
:root[data-theme="kongress"] h4,
:root[data-theme="kongress"] legend,
:root[data-theme="kongress"] summary,
:root[data-theme="kongress"] output,
:root[data-theme="kongress"] code,
:root[data-theme="kongress"] dialog,
:root[data-theme="kongress"] .field-label,
:root[data-theme="kongress"] .tag,
:root[data-theme="kongress"] .switch b,
:root[data-theme="kongress"] .switch i,
:root[data-theme="kongress"] .coord b,
:root[data-theme="kongress"] .sim-stat b,
:root[data-theme="kongress"] .sim-stat span,
:root[data-theme="kongress"] .macro-list li {
  font-family: 'UnifrakturMaguntia', 'UnifrakturCook', 'Fraktur', serif !important;
}

:root[data-theme="kongress"] h1,
:root[data-theme="kongress"] h2,
:root[data-theme="kongress"] h3,
:root[data-theme="kongress"] legend,
:root[data-theme="kongress"] .primary {
  font-family: 'UnifrakturCook', 'UnifrakturMaguntia', 'Fraktur', serif !important;
  letter-spacing: 0.04em;
}

:root[data-theme="kongress"] body {
  background: var(--ground);
  font-size: 16px;
  line-height: 1.6;
}

:root[data-theme="kongress"] .card,
:root[data-theme="kongress"] .step > .group,
:root[data-theme="kongress"] .step > .panel,
:root[data-theme="kongress"] .tray,
:root[data-theme="kongress"] .plan,
:root[data-theme="kongress"] .setup,
:root[data-theme="kongress"] .canvas-wrap,
:root[data-theme="kongress"] .sim-stat,
:root[data-theme="kongress"] button,
:root[data-theme="kongress"] input,
:root[data-theme="kongress"] select,
:root[data-theme="kongress"] .tag,
:root[data-theme="kongress"] .switch,
:root[data-theme="kongress"] .coord,
:root[data-theme="kongress"] .macro-list li,
:root[data-theme="kongress"] dialog {
  border-radius: 0 !important;
}

:root[data-theme="kongress"] .topbar {
  background: var(--sheet);
  border-bottom: 3px double #000000;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

:root[data-theme="kongress"] .brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

:root[data-theme="kongress"] footer {
  background: var(--sheet);
  border-top: 3px double #000000;
  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.08);
}

:root[data-theme="kongress"] .card,
:root[data-theme="kongress"] .step > .group,
:root[data-theme="kongress"] .step > .panel,
:root[data-theme="kongress"] .plan,
:root[data-theme="kongress"] .setup,
:root[data-theme="kongress"] .canvas-wrap {
  border: 2px solid #000000;
  box-shadow: 3px 3px 0 #000000;
}

:root[data-theme="kongress"] .step-head {
  border-bottom: 2px solid #000000;
  padding-bottom: 10px;
}

:root[data-theme="kongress"] .step-head h2 {
  font-size: 22px;
  color: #000000;
}

:root[data-theme="kongress"] .tray {
  border: 2px solid #000000;
  border-left: 6px solid var(--tray, #000000);
  box-shadow: 2px 2px 0 #000000;
}

:root[data-theme="kongress"] .sim-stat {
  border: 1.5px solid #000000;
  box-shadow: 2px 2px 0 #000000;
}

:root[data-theme="kongress"] .mark {
  background: #000000;
  filter: contrast(1.5);
}

:root[data-theme="kongress"] input[type="text"],
:root[data-theme="kongress"] input[type="number"],
:root[data-theme="kongress"] select,
:root[data-theme="kongress"] input[type="file"] {
  background: #ffffff;
  border: 1.5px solid #000000;
  color: #000000;
  font-size: 15px;
}

:root[data-theme="kongress"] input[type="text"]:focus,
:root[data-theme="kongress"] input[type="number"]:focus,
:root[data-theme="kongress"] select:focus,
:root[data-theme="kongress"] input[type="file"]:focus {
  outline: 2px solid #000000;
  outline-offset: 1px;
}

:root[data-theme="kongress"] .primary {
  background: #000000;
  color: #ffffff;
  border: 2px solid #000000;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 2px 2px 0 #000000;
  transition: background 0.1s ease, color 0.1s ease;
}

:root[data-theme="kongress"] .primary:hover:not(:disabled) {
  background: #ffffff;
  color: #000000;
  opacity: 1;
}

:root[data-theme="kongress"] .ghost,
:root[data-theme="kongress"] .icon {
  background: var(--sheet);
  color: #000000;
  border: 1.5px solid #000000;
  box-shadow: 1px 1px 0 #000000;
}

:root[data-theme="kongress"] .ghost:hover:not(:disabled),
:root[data-theme="kongress"] .icon:hover:not(:disabled) {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

:root[data-theme="kongress"] .tag {
  border: 1px solid #000000;
  background: #ffffff;
  color: #000000;
  font-weight: 600;
}

:root[data-theme="kongress"] .switch {
  background: var(--sunk);
  border: 1.5px solid #000000;
}

:root[data-theme="kongress"] .coord {
  background: var(--sunk);
  border: 1.5px solid #000000;
}

:root[data-theme="kongress"] .macro-list li {
  border: 1.5px solid #000000;
  background: #ffffff;
  color: #000000;
}

* { box-sizing: border-box; }
/* Several things here are shown and hidden by the `hidden` attribute, and a
 * display rule in this sheet would otherwise beat it — the woodcut options and
 * the cut preview appeared before there was anything to show. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ground); color: var(--ink);
  font: 15px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
h1, h2, h3, h4 { letter-spacing: -.015em; }

/* ----------------------------------------------------------------- chrome */
.topbar { background: var(--sheet); border-bottom: 1px solid var(--line); }
.brand {
  display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap;
  max-width: 1000px; margin: 0 auto; padding: 15px 28px;
}
.brand h1 { margin: 0; font-size: 18px; font-weight: 620; }
.brand p { margin: 2px 0 0; font-size: 13px; color: var(--ink-dim); }
/* The slogan's links take the text's colour rather than the browser's blue:
   in this interface a colour means paint, and neither of these is paint. */
.brand p a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.brand p a:hover { color: var(--ink); }
/* The edition's name breaks as a unit: wrapping between its words split the
   congress across two lines mid-title. */
.brand p a.edition { white-space: nowrap; }
/* The crossed brushes and gear are one navy shape on transparent, used as a
   mask rather than an <img>: `background` is what actually paints it, so
   every theme below recolours the same silhouette instead of swapping images.
   `--ink` here, not a fixed brand navy — the badge is drawn in whatever this
   theme already calls its ink, the same rule the rest of the page follows. */
.mark {
  width: 56px; height: 56px; flex: none;
  background: var(--ink);
  -webkit-mask: url("logo-mark.png") center / contain no-repeat;
          mask: url("logo-mark.png") center / contain no-repeat;
}
.wrap { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 26px 28px 72px; }
footer { border-top: 1px solid var(--line); padding: 16px; text-align: center; background: var(--sheet); }
footer a { color: var(--ink-dim); font-size: 13px; }

/* ------------------------------------------------------------ config picker */
.card {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 20px 16px; margin: 0 0 var(--step);
}
.card > legend { font-size: 15px; font-weight: 620; padding: 0 6px; margin-left: -6px; }
.card .sub { margin: 2px 0 14px; font-size: 13.5px; color: var(--ink-dim); max-width: 62ch; }
.cfg-row { display: grid; gap: 16px 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ------------------------------------------------------------------- steps */
.step { margin: 0 0 var(--step); }
.step-head { border-bottom: 1px solid var(--line); padding-bottom: 9px; margin-bottom: 18px; }
.step-head h2 { margin: 0; font-size: 21px; font-weight: 620; }
.step-head p { margin: 3px 0 0; font-size: 13.5px; color: var(--ink-dim); max-width: 66ch; }

/* the machine plan: the one element given room to be looked at */
.plan { margin: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.plan img { display: block; width: 100%; height: auto; max-height: 380px; object-fit: contain; }
.plan figcaption { margin-top: 10px; font-size: 12.5px; color: var(--ink-faint); }

/* ------------------------------------------------------------------- trays */
/* 210px so the four colours of a CMYK job sit on one line: the wrap is 1000px
   less 28px of padding either side, which leaves 225 per card once three
   14px gaps are taken out. Narrower viewports still wrap on their own. */
.tray-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tray {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 6px;
  border-left: 3px solid var(--tray, var(--line)); padding: 13px 15px 15px;
}
.tray header { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.tray header b { font-size: 14.5px; font-weight: 620; }
.tray-fields { display: grid; gap: 12px; }
.dot {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  background: var(--tray, var(--ink-faint)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.22);
}
.tag {
  font: 11.5px/1 var(--mono); color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 3px; padding: 3px 5px;
}
[data-tray="water"] { --tray: var(--water); }
[data-tray="cyan"] { --tray: var(--c); }
[data-tray="magenta"] { --tray: var(--m); }
[data-tray="yellow"] { --tray: var(--y); }
[data-tray="kroma"], [data-tray="black"], [data-tray="key"] { --tray: var(--k); }

/* ------------------------------------------------------------------ groups */
.group { margin: 22px 0 0; }
/* A group sitting straight on the ground gets a panel of its own. Text colour
 * is chosen against the panel, and in a theme whose ground is dark and whose
 * panels are pale — coconut — it is unreadable anywhere else. */
.step > .group, .step > .panel {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 15px 17px;
}
.group:first-child { margin-top: 0; }
.group > h3 {
  margin: 0 0 12px; font-size: 14px; font-weight: 620; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.group.nested { margin-left: 0; padding-left: 15px; border-left: 2px solid var(--line-soft); }
.group.nested > h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-dim); }
.grid { display: grid; gap: 14px 20px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.sliders { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* ------------------------------------------------------------------ fields */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; color: var(--ink-dim); display: flex; align-items: center; gap: 5px; }
input[type="text"], input[type="number"], select, input[type="file"] {
  font: 14px var(--sans); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--sheet);
  border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; width: 100%;
  min-width: 0;
}
input[type="file"] { padding: 6px 8px; font-size: 13px; }
input[type="text"]:focus, input[type="number"]:focus, select:focus, input[type="file"]:focus {
  outline: 2px solid var(--ink); outline-offset: 1px; border-color: transparent;
}
input[type="range"] { width: 100%; accent-color: var(--ink); }
output { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.with-btn { display: flex; gap: 8px; align-items: stretch; }
.with-btn input { flex: 1; }

/* checkboxes read as sentences, not as a grid cell with a stray box */
.field.is-check { flex-direction: row; align-items: center; gap: 9px; }
.field.is-check .field-label { order: 2; font-size: 13.5px; color: var(--ink); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--black); margin: 0; flex: none; }
.switches { display: grid; gap: 10px; margin: 16px 0 0; }
.switch {
  display: grid; grid-template-columns: 16px 1fr; gap: 11px; align-items: start;
  background: var(--sunk); border: 1px solid var(--line-soft); border-radius: 5px; padding: 11px 13px;
  cursor: pointer;
}
.switch input[type="hidden"] { display: none; }
.switch input[type="checkbox"] { margin-top: 2px; }
.switch b { display: block; font-size: 13.5px; font-weight: 600; }
.switch i { display: block; font-style: normal; font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }

.info-btn {
  border: 0; background: none; color: var(--ink-faint); cursor: pointer;
  font-size: 13px; padding: 0; line-height: 1;
}
.info-btn:hover { color: var(--ink); }

/* ----------------------------------------------------------------- buttons */
button { font: 14px var(--sans); border-radius: 5px; cursor: pointer; }
.primary {
  background: var(--black); color: var(--sheet); border: 1px solid var(--black);
  padding: 9px 18px; font-weight: 560;
}
.primary:hover { opacity: .88; }
.ghost {
  background: var(--sheet); color: var(--ink); border: 1px solid var(--line);
  padding: 9px 15px;
}
.ghost:hover { border-color: var(--ink-faint); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, summary:focus-visible, .inline-file:focus-within {
  outline: 2px solid var(--ink); outline-offset: 2px;
}
.icon {
  background: var(--sheet); border: 1px solid var(--line); color: var(--ink-dim);
  padding: 0 11px; flex: none;
}
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.row input[type="range"] { flex: 1; min-width: 140px; }

/* -------------------------------------------------------------- run output */
.canvas-wrap {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px; margin-top: 18px;
}
#gcode-canvas { display: block; width: 100%; height: auto; }
.sim-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.sim-stat {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 5px;
  padding: 8px 12px; min-width: 92px;
}
.sim-stat b { display: block; font-size: 16px; font-weight: 620; }
.sim-stat span { font-size: 12px; color: var(--ink-dim); }
.sim-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink-dim); }
.sim-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
#wc-image, #cmyk-image {
  display: block; max-width: 100%; margin-top: 16px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--sheet);
}
#cmyk-panel .field { max-width: 420px; }
#cmyk-controls { margin-top: 14px; display: grid; gap: 10px; }
#cmyk-controls[hidden] { display: none !important; }
.inline-file { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ------------------------------------------------------------------- setup */
.setup {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 6px;
  padding: 0 20px; margin-top: 18px;
}
.setup > summary {
  cursor: pointer; padding: 15px 0; list-style: none;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.setup > summary::-webkit-details-marker { display: none; }
.setup > summary span { font-size: 15px; font-weight: 620; }
.setup > summary span::before { content: "▸ "; color: var(--ink-faint); }
.setup[open] > summary span::before { content: "▾ "; }
.setup > summary i { font-style: normal; font-size: 13px; color: var(--ink-dim); }
.setup-body { padding: 4px 0 22px; border-top: 1px solid var(--line-soft); }
.setup-body > .group { margin-top: 24px; }
.tray-coords { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.coord {
  display: grid; grid-template-columns: 12px auto 1fr 1fr; gap: 10px; align-items: center;
  background: var(--sunk); border: 1px solid var(--line-soft); border-radius: 5px; padding: 9px 12px;
}
.coord b { font-size: 13.5px; font-weight: 600; }
.coord .field { flex-direction: row; align-items: center; gap: 7px; }
.coord .field-label { font-size: 12px; }

/* ------------------------------------------------------------------ macros */
.macro-list {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.macro-list li {
  font: 12.5px/1 var(--mono); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px;
  background: var(--sunk);
}

/* ------------------------------------------------------------------ status */
.note { font-size: 12.5px; color: var(--ink-dim); }
.note.warn, .warn { color: var(--warn); }
.error { color: var(--bad); font-size: 13.5px; margin: 12px 0 0; }
.status { font-size: 13.5px; color: var(--ink-dim); }
.greyed { opacity: .5; }

.placeholder { text-align: center; color: var(--ink-faint); padding: 46px 20px; }
.placeholder svg { width: 210px; height: 130px; }
.placeholder p { font-size: 14px; }
.pl-bed, .pl-canvas { fill: none; stroke: var(--line); stroke-width: 2; }
.pl-canvas { stroke-dasharray: 4 3; }
.pl-t1 { fill: var(--c); } .pl-t2 { fill: var(--m); } .pl-t3 { fill: var(--y); }
.pl-arm { stroke: var(--line); stroke-width: 2; } .pl-arm-d { fill: var(--ink-faint); }

/* ------------------------------------------------------------------- prose */
.prose { max-width: 74ch; }
.prose h2 { margin: 30px 0 10px; font-size: 17px; }
.prose li { margin-bottom: 9px; }
.prose code { font: 12.5px var(--mono); background: var(--sunk); padding: 2px 5px; border-radius: 3px; }
.prose a { color: var(--ink); }

dialog { border: 1px solid var(--line); border-radius: 6px; max-width: 46ch; padding: 18px 20px; color: var(--ink); background: var(--sheet); }
dialog::backdrop { background: rgba(0,0,0,.3); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 640px) {
  .brand, .wrap { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------- machine picker in the chrome */
.brand-name { flex: 1; min-width: 160px; }
.picker { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.picker .field { min-width: 190px; }
.topbar-error { max-width: 1000px; margin: 0 auto 12px; padding: 0 28px; }

/* number fields are three digits, not half a page */
.group.tight .grid { grid-template-columns: repeat(auto-fit, minmax(150px, 200px)); }
.group.tight .note { margin: 10px 0 0; max-width: 60ch; }
.with-btn .ghost { white-space: nowrap; }
@media (max-width: 760px) { .picker { width: 100%; } }

/* ------------------------------------------------------------ theme picker */
footer { display: flex; gap: 18px; align-items: center; justify-content: center; flex-wrap: wrap; }
.theme-picker { display: flex; gap: 7px; align-items: center; font-size: 13px; color: var(--ink-dim); }
.theme-picker select { width: auto; padding: 4px 7px; font-size: 13px; }

/* The fill settings sit inside the run panel, above the button that uses them,
   so they need the separation a panel edge would otherwise give them. */
#fill-options { margin: 0 0 18px; padding: 0 0 16px; border-bottom: 1px solid var(--line-soft); }
#fill-options .note { margin: -4px 0 12px; max-width: 68ch; }
