:root {
  --bg: #14151a;
  --bg-soft: #1c1e26;
  --panel: #22242e;
  --border: #34374a;
  --text: #e8e9f0;
  --muted: #9a9db0;
  --accent: #7c6cf0;
  --accent-2: #e86c8f;
  --gold: #f5c451;
  --silver: #c7cbd6;
  --bronze: #d08a5f;
  --danger: #ef5b5b;
  --ok: #58c98d;
  --radius: 12px;
}

/* Barlow Condensed (SIL OFL, vendored — see assets/fonts/OFL.txt): a
   friendly geometric sans with a narrow set, self-hosted so the label font
   satisfies the site's font-src 'self' CSP. Used for the paint-tube names. */
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  /* ?v=1 matches the <link rel=preload> in view_knife so the browser
     dedupes the fetch (font requests are CORS-mode) */
  src: url('fonts/barlow-condensed-600.woff2?v=1') format('woff2');
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--accent); }

header.site, footer.site {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 20px;
}

header.site .brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: .02em;
}

.site-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.logout button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: .85em;
  font-weight: 500;
  text-decoration: underline;
}

.logout button:hover { color: var(--text); }

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 20px 40px;
}

footer.site {
  color: var(--muted);
  font-size: .85em;
}

footer.site p { margin: 0 0 8px; }

.attribution {
  color: var(--muted);
  font-size: .8em;
  margin-top: 28px;
}

.dev-note {
  color: var(--muted);
  font-size: .85em;
  margin: 0 0 18px;
}

.dev-note code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
}

/* ---------- hero ---------- */

.hero { margin: 24px 0 32px; }
.hero h1 { font-size: 2.4em; margin: 0 0 8px; }
.hero.small h1 { font-size: 1.9em; }
.lede { color: var(--muted); max-width: 560px; margin: 0; }

/* ---------- home game grid ---------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .12s ease, border-color .12s ease;
}

a.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.card-swatch {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-swatch svg {
  display: block;
  width: 100%;
  height: 100%;
  /* the paper reads as a sheet lying on the dark card */
  filter: drop-shadow(0 8px 12px rgb(0 0 0 / .35));
}

.card-swatch.rainbow {
  background: linear-gradient(120deg,
    #f43f5e 0%, #f97316 18%, #eab308 36%, #22c55e 54%, #06b6d4 72%, #6366f1 88%, #a855f7 100%);
}

.card-swatch.blank {
  background:
    repeating-linear-gradient(45deg, var(--bg-soft) 0 10px, var(--border) 10px 20px);
  opacity: .6;
}

.card-body { padding: 16px 18px 18px; }
.card-body h2 { margin: 0 0 6px; font-size: 1.25em; }
.card-body p { margin: 0 0 12px; color: var(--muted); font-size: .95em; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .8em;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.game-card.muted .badge { display: none; }

/* ---------- panels & forms ---------- */

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.panel h2 { margin: 0 0 4px; font-size: 1.15em; }
.panel p { margin: 0 0 16px; color: var(--muted); font-size: .92em; }

label {
  display: block;
  font-size: .85em;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
}

label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  /* 16px minimum: iOS Safari zooms into a focused field whose font is
     smaller than this. (1em here would resolve against the label's
     .85em, i.e. ~13.6px, which triggers the zoom.) */
  font-size: 16px;
}

label input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(124 108 240 / .25);
}

.code-input { text-transform: uppercase; font-weight: 700; letter-spacing: .15em; }

button {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: .95em;
  font-weight: 600;
  cursor: pointer;
}

button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.1); }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: rgb(239 91 91 / .12); }

/* ---------- room page ---------- */

.room-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

.room-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .2em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 10px;
  color: var(--accent-2);
}

.room-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.guess-panel { margin-bottom: 20px; }

.guess-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.guess-form label { flex: 1 1 200px; margin-bottom: 0; }

.guess-form button { margin-left: auto; }

.hint { margin: 10px 0 0; color: var(--muted); font-size: .82em; }

/* ---------- color-name suggestion bar ---------- */

.color-suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 12px;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  /* The bar is always present: reserve one row's height so the page doesn't
     jump when suggestions arrive. Full row ≈ chip (~31px) + padding (10px)
     + the thin scrollbar. */
  min-height: 42px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  font-size: .9em;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--panel);
}

.chip-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .2);
  flex: none;
}

.chip-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- leaderboard ---------- */

.board-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 820px) {
  .board-grid { grid-template-columns: 1fr; }
}

.board-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.board-head {
  display: grid;
  grid-template-columns: 2.2em auto 1fr 1.5fr 5em;
  gap: 12px;
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: .75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.row {
  display: grid;
  grid-template-columns: 2.2em auto 1fr 1.5fr 5em;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.row.gold   { border-color: var(--gold); }
.row.silver { border-color: var(--silver); }
.row.bronze { border-color: var(--bronze); }

.pos { font-weight: 700; color: var(--muted); text-align: center; }
.player { font-weight: 600; }
.color-name { color: var(--text); }

/* "N closer" badge in a guess cell: how many known colors beat this guess
   against the hidden color. Only appears for guesses near the top. */
.closer-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .72em;
  font-weight: 700;
  vertical-align: middle;
  white-space: nowrap;
}

/* "Top 25 colors" popup on the over-banner: a native dialog listing the
   closest known colors to the hidden color. */
.closest-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 18px;
  width: min(420px, calc(100vw - 40px));
}
.closest-dialog::backdrop {
  background: rgb(0 0 0 / .55);
}
.closest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.closest-head h2 {
  margin: 0;
  font-size: 1.1em;
}
.closest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}
.closest-list .row {
  grid-template-columns: 2.2em auto 1fr 5em;
  padding: 4px 10px;
  gap: 10px;
}
.closest-list .de {
  font-size: .9em;
}
.de {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 1.1em;
  font-weight: 700;
}

.swatch {
  display: inline-block;
  border-radius: 6px;
  border: 1px solid rgb(255 255 255 / .18);
  flex: none;
  vertical-align: middle;
}

.empty { color: var(--muted); text-align: center; padding: 18px 0 8px; }

/* ---------- palette knife game ---------- */

/* A link that looks like the site's buttons (for "Practice paper"). */
a.btn {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: .95em;
  font-weight: 600;
  text-decoration: none;
}

a.btn:hover { border-color: var(--muted); }

/* The live board fragment: countdown strip + ranked mixes (closest first). */
.knife-board { display: grid; gap: 12px; }

.round-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: .95em;
}

.round-timer .countdown {
  font-variant-numeric: tabular-nums;
  font-size: 1.25em;
  font-weight: 700;
}

.round-timer.over {
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
  justify-content: center;
}

/* The lobby: who has joined, the name/join box, and the start buttons. */
.lobby-panel { display: grid; gap: 14px; }
.lobby-panel h3 { margin: 0; }

/* The round-length buttons (start / next round): one form, several submit
   buttons, each carrying its own round_secs value. */
.duration-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.duration-picker span { margin-right: 2px; }

.lobby-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.lobby-player {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
}

/* The join screen: the whole room page stays visible behind a dimmed sheet
   until the visitor picks a name. The form is a native POST that redirects
   back, re-rendering the page without the veil — name typed once, used
   everywhere. */
.join-veil {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(10 11 14 / .62);
  backdrop-filter: blur(3px);
}

.join-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: 0 18px 50px rgb(0 0 0 / .45);
}

.join-panel h2 { margin: 0 0 4px; font-size: 1.25em; }
.join-panel p { margin: 0 0 18px; color: var(--muted); font-size: .92em; }
.join-panel button.primary { width: 100%; margin-top: 4px; }
.join-skip { margin: 26px 0 0; text-align: center; font-size: .85em; }
.join-skip a { color: var(--muted); }

/* The creator's name in the waiting line: a chip so it reads as the person
   everyone is waiting for, not just another word in the sentence. */
.join-waiting { font-size: .95em; }
.owner-chip {
  display: inline-block;
  margin: 0 2px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.15em;
  font-weight: 800;
  letter-spacing: .02em;
  vertical-align: middle;
}

/* The who's-here list inside the join veil; it polls every 3s. */
.join-players {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.join-players-title {
  margin: 0 0 10px;
  font-size: .85em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Knife board rows drop the "color name" column Shades has (the mix is a
   swatch, not a name), so the grid is four columns instead of five. */
.board-head-knife { grid-template-columns: 2.2em auto 1fr 5em; }
.row-knife { grid-template-columns: 2.2em auto 1fr 5em; }
.row-knife .de { font-size: .95em; }

/* After the buzzer, each knife row breaks the player's mix down into its
   pigments — the same chips the target recipe uses, a touch smaller. */
.row-mix {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.row-mix .chip {
  padding: 3px 10px 3px 5px;
  font-size: .82em;
  gap: 6px;
}
.row-mix .chip-swatch {
  width: 10px;
  height: 10px;
}
.row.you { border-color: var(--accent); }
.you-tag { color: var(--muted); font-size: .8em; font-weight: 400; }

/* The reveal form sits inside the round-timer strip (a flex row), so it
   needs no spacing of its own. */
.reveal-form { margin: 0; }

/* ---------- color cylinder ---------- */

.solid-wrap {
  /* Sized to fill the 340px panel column (minus padding + the axis bars):
     the cylinder body and the scatter both read these vars, and the JS
     geometry follows them, so scaling here scales the whole visualization. */
  --solid-r: 145px;  /* cylinder radius */
  --solid-h: 340px;  /* cylinder height (the lightness axis) */
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  overflow: hidden;
}

.solid-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.solid-tabs {
  display: flex;
  gap: 6px;
}

.solid-tab {
  font-size: .85em;
  padding: 5px 14px;
  border-radius: 999px;
}

.solid-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.solid-pane[hidden] {
  display: none;
}

.solid-toggle {
  font-size: .85em;
  padding: 5px 14px;
}

/* ---------- hue map (distance vs hue scatter) ---------- */

.scatter {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.scatter-axis {
  flex: none;
  width: 12px;
  height: var(--solid-h);
  border-radius: 6px;
  border: 1px solid var(--border);
  /* no-JS fallback until scatter.js sets the centered gradient */
  background: linear-gradient(to bottom, #f00, #ff0, #0f0, #0ff, #00f, #f0f);
}

.scatter-stage {
  position: relative;
  width: calc(2 * var(--solid-r));
  height: var(--solid-h);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.scatter-dots {
  position: absolute;
  inset: 0;
}

.scatter-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgb(0 0 0 / .5);
}

.scatter-target {
  position: absolute;
  top: 50%;
  left: calc(100% - 34px);
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  border: 2px solid var(--muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}

/* Hue ring reference: the cylinder's hues form a ring with a front and a
   back, which overlap in a straight-on projection. Two stacked rows show
   the whole ring — the front arc bright, the back arc dimmed — both
   rebuilt by solid.js every frame to track the rotation. */
.solid-hues {
  width: calc(2 * var(--solid-r));
  margin: 0 auto 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.solid-hue-row {
  height: 6px;
  /* Square ends and no border — see .solid-axis (same tip-pixel glitch). */
  /* no-JS fallback until solid.js sets the synced gradients */
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f);
}

.solid-hue-back {
  opacity: .55; /* the far side of the ring reads as behind */
}

/* The lightness axis bar sits left of the cylinder: black at the bottom,
   white at the top, matching the pins' L axis. */
.solid-body {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.solid-axis {
  flex: none;
  width: 10px;
  height: var(--solid-h);
  /* Square ends and no border: the rounded caps + translucent border
     rendered a bright off-color dot at the tips (white below the black
     here) in Firefox and Safari. */
  background: linear-gradient(to top, #000, #fff);
}

.solid-scene {
  display: flex;
}

/* Straight-on view: no tilt and no perspective, so the cylinder is an
   orthographic front projection — pins move side to side as the cylinder
   turns but keep their size. */
.solid-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}

.solid-spin {
  position: relative;
  transform-style: preserve-3d;
  width: calc(2 * var(--solid-r));
  height: var(--solid-h);
  animation: solid-spin 30s linear infinite;
}

@keyframes solid-spin {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(360deg); }
}

.solid-pins {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.pin-pos {
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
}

/* A pin is two crossed discs (built in solid.js): as the cylinder spins,
   one of them is always face-on to the camera, so pins never turn
   edge-on and vanish. */
.pin {
  display: block;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  box-shadow: 0 1px 2px rgb(0 0 0 / .5);
}

.pin-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.pin-disc-x {
  transform: rotateY(90deg);
}

.pin-target {
  width: 18px;
  height: 18px;
  box-shadow: 0 0 6px rgb(0 0 0 / .5);
  animation: pin-pulse 1.5s ease-in-out infinite;
}

.pin-target .pin-disc {
  background: transparent;
  border: 3px solid #fff;
}

@keyframes pin-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .85; }
  50%      { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

/* ---------- Palette Knife playground ---------- */

.dim { color: var(--muted); font-size: .85em; }

.knife-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

/* The mixing paper: a light gray sheet on a darker stack of sheets. The
   top-right corner is dog-eared — folded over onto the page. The corner
   triangle behind the fold is cut away (the paper that was there is folded
   over), so the gray/black page background shows through there. The flap
   itself is an SVG with a rounded tip, mirrored from the paper's corner
   radius. The frame carries the drop shadow for the sheet. */
.paper-frame {
  position: relative;
  flex: 1 1 460px;
  max-width: 620px;
  filter: drop-shadow(0 10px 24px rgb(0 0 0 / .4));
}

.paper {
  position: relative;
  background: #e9e9e5;
  border-radius: 6px;
  clip-path: polygon(0 0, calc(100% - 42px) 0, 100% 42px, 100% 100%, 0 100%);
}

/* The flap's shadow: the lifted fold casts a soft shadow on the paper
   around the flap (same shape, offset 4px down-left, blurred). */
.flap-shadow {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 42px;
  height: 42px;
  filter: blur(3px);
  z-index: 1;
  pointer-events: none;
}

/* The dog-eared flap: the corner folded over onto the page — the back of
   the paper, with the 45° fold line as its hypotenuse and a rounded tip. */
.flap {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  z-index: 2;
  pointer-events: none;
}

#well {
  display: block;
  width: 100%;
  aspect-ratio: 10 / 9;
}

/* The ten source paints live on the paper near its bottom edge as clickable
   skeuomorphic tubes. Clicking a tube squeezes a dollop; consecutive clicks
   of the same tube grow that dollop in place (one unit of paint each). */
.paint-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-evenly;
  gap: 2px 6px;
  padding: 0 10px;
}

.pigment {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* The paint tube: a trapezoid body, wide at the crimped bottom and tapering
   up to a small metal nozzle with screw threads (the unscrewed cap end).
   The body is wrapped at the top with the paint color, then with a white
   label carrying the full pigment name, and the flat crimped metal end. */
.tube {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2px;
  filter: drop-shadow(0 5px 4px rgb(0 0 0 / .35));
  transition: transform 80ms ease;
}

.pigment:hover .tube { transform: translateY(-3px); }
.pigment:active .tube { transform: translateY(0); }

/* The unscrewed nozzle: a small metal cylinder with thread ridges. */
.tube-nozzle {
  width: 22px;
  height: 13px;
  background:
    repeating-linear-gradient(180deg, rgb(0 0 0 / .18) 0 2px, transparent 2px 4px),
    linear-gradient(90deg, #9a9ca2 0%, #e8eaee 30%, #f8f9fa 50%, #d4d6dc 70%, #8f9197 100%);
  border-radius: 2px 2px 1px 1px;
}

.tube-body {
  position: relative;
  width: 36px;
  height: 147px;
  margin-top: -1px;
  /* the tube itself is metal; the color band and white label wrap around it */
  background: linear-gradient(90deg, #9a9ca2 0%, #e8eaee 30%, #f8f9fa 50%, #d4d6dc 70%, #8f9197 100%);
  clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%);
}

/* The flat metal end of the tube: the white label wrap stops short and a
   flat silver band runs down to the crimp. Flat on purpose — the tube is
   squashed down here, so it gets no cylindrical (90°) shading. */
.tube-body::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  background: linear-gradient(180deg, #c9cbd1 0%, #eceef1 45%, #d4d6db 100%);
}

/* The paint-color wrap at the top of the tube: a thick horizontal band
   (its background — color + cylinder shading — comes from the view). */
.tube-colorband {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
}

/* The white label wrap below the color band. A sliver of the metal tube
   shows as the seam between the two wraps. A double black stripe (matching
   the label text) sits above and below the text zone at fixed positions —
   the same on every tube, never adjusted per tube. */
.tube-label-area {
  position: absolute;
  top: 13px;
  left: 0;
  right: 0;
  bottom: 12px;
  background:
    linear-gradient(#3a3b41, #3a3b41) 0 1px / 100% 2px no-repeat,
    linear-gradient(#3a3b41, #3a3b41) 0 5px / 100% 2px no-repeat,
    linear-gradient(#3a3b41, #3a3b41) 0 calc(100% - 7px) / 100% 2px no-repeat,
    linear-gradient(#3a3b41, #3a3b41) 0 calc(100% - 2px) / 100% 2px no-repeat,
    linear-gradient(90deg, #efefe9 0%, #ffffff 35%, #fafaf5 65%, #e9e9e3 100%);
}

/* The full paint name, written down the tube. Vertical text (`vertical-rl`
   + `direction: ltr` = reads top-to-bottom). `max-height` caps the wrap
   zone between the stripe pairs: short names fit one line, the long ones
   break at a space into two tidy columns ("cadmium yellow / light",
   "quinacridone / magenta") — never mid-word. `text-align: center` keeps
   shorter text vertically centered within the zone. */
.tube-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  writing-mode: vertical-rl;
  direction: ltr;
  max-height: 108px;
  text-align: center;
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: #3a3b41;
}

/* The flat, crimped metal end: a rectangle slightly wider than the tube,
   with vertical crimp lines running top to bottom. */
.tube-crimp {
  width: 38px;
  height: 10px;
  margin-top: -1px;
  background:
    repeating-linear-gradient(90deg, rgb(0 0 0 / .16) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #c9cbd1 0%, #eceef1 45%, #d4d6db 100%);
  border-radius: 1px;
}

.knife-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 240px;
  flex: 1 1 240px;
}

/* Target / your-mix / ΔE readout: one grid so the swatches and values line
   up vertically across all three rows. */
.readout-grid {
  display: grid;
  grid-template-columns: max-content 44px 1fr;
  align-items: center;
  gap: 6px 10px;
}

.readout-grid .swatch { width: 44px; height: 44px; }
.readout-grid code, .readout-grid .value {
  font-variant-numeric: tabular-nums;
}

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- messages ---------- */

.error {
  background: rgb(239 91 91 / .12);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-weight: 600;
}

.reveal-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(120deg, rgb(124 108 240 / .18), rgb(232 108 143 / .18));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
}

.reveal-banner p { margin: 0; }
