:root {
  --paper: #f1ede4;
  --stage: #e9e3d7;
  --ink: #181512;
  --muted: #696154;
  --line: rgba(24, 21, 18, 0.15);
  --line-soft: rgba(24, 21, 18, 0.08);
  --red: #f0442f;
  --yellow: #f5c400;
  --blue: #2450d8;
  --orange: #f47b20;
  --green: #149e69;
  --violet: #7a42c8;
  --umber: #2f241d;

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC",
    "STSong", serif;
  --font-mono: "SFMono-Regular", "SF Mono", "Roboto Mono", Menlo, Consolas,
    monospace;

  --page-x: clamp(20px, 3.6vw, 56px);
  --page-y: clamp(16px, 2.4vw, 32px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(circle at 78% 8%, rgba(255, 255, 255, 0.52), transparent 37%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.12), transparent 42%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--blue);
  color: #fffaf0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.72'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.site {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--page-y) var(--page-x);
}

/* ---------------------------------------------------------------- header */

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding-bottom: clamp(14px, 2.2vh, 24px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: flex;
  align-items: center;
  width: 35px;
  height: 15px;
  flex: none;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 0 0 1.5px var(--paper);
}

.brand-dot + .brand-dot {
  margin-left: -4px;
}

.brand-dot--red {
  background: var(--red);
}

.brand-dot--yellow {
  background: var(--yellow);
}

.brand-dot--blue {
  background: var(--blue);
}

.brand-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  line-height: 1.25;
}

.brand-name small {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.header-center {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}

.header-center span {
  color: var(--ink);
}

.reset-button {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition:
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.reset-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reset-button:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.reset-button:hover svg {
  transform: rotate(-180deg);
}

.reset-button:active {
  transform: translateY(1px);
}

/* ------------------------------------------------------------- workspace */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(292px, 0.78fr) minmax(0, 1.9fr);
  gap: clamp(34px, 4.6vw, 82px);
  padding-top: clamp(28px, 4.5vh, 52px);
}

.rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rail-intro {
  max-width: 430px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(22px, 4vh, 42px);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}

.eyebrow-line {
  display: block;
  width: 28px;
  height: 1px;
  flex: none;
  background: var(--ink);
  opacity: 0.4;
}

h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(74px, 7.1vw, 116px);
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 0.9;
  white-space: nowrap;
}

.title-dot {
  display: inline-block;
  margin-left: 0.045em;
  color: var(--red);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0;
  transform: translateY(-0.02em);
}

.lede {
  margin: clamp(24px, 4vh, 40px) 0 0;
  font-family: var(--font-serif);
  font-size: clamp(20px, 1.7vw, 26px);
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.55;
}

.body-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.055em;
  line-height: 1.95;
}

/* ------------------------------------------------------------ reactions */

.reaction-panel {
  width: 100%;
  max-width: 402px;
  margin-top: clamp(32px, 6.8vh, 76px);
  padding-top: 13px;
  border-top: 1px solid var(--ink);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 4px;
}

.panel-head h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.panel-head h2 small {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.11em;
  color: var(--muted);
}

.panel-count {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.panel-count strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.mix-list {
  position: relative;
  display: flex;
  flex-direction: column;
}

.mix-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 13px;
  min-height: 42px;
  padding: 9px 6px 9px 0;
  border-bottom: 1px solid var(--line-soft);
  transition:
    background-color 220ms ease,
    padding 220ms ease;
}

.mix-row::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: var(--mix-colour);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mix-row.is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.mix-row--all {
  margin-top: 2px;
}

.mix-formula {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.07em;
  white-space: nowrap;
  transition: color 220ms ease;
}

.swatches {
  display: flex;
  align-items: center;
  width: 21px;
  flex: none;
}

.swatch {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--paper);
  box-shadow: 0 0 0 0.5px rgba(24, 21, 18, 0.14);
  flex: none;
}

.swatch + .swatch {
  margin-left: -4px;
}

.swatch + .swatch + .swatch {
  margin-left: -4px;
}

.swatch--red {
  background: var(--red);
}

.swatch--yellow {
  background: var(--yellow);
}

.swatch--blue {
  background: var(--blue);
}

.mix-arrow {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.68;
  transition:
    color 220ms ease,
    opacity 220ms ease,
    transform 220ms ease;
}

.mix-result {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 46px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: color 220ms ease;
}

.result-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mix-colour);
  opacity: 0.3;
  transform: scale(0.8);
  transition:
    transform 300ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease,
    width 300ms cubic-bezier(0.22, 1, 0.36, 1),
    height 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mix-row.is-active {
  background: rgba(255, 255, 255, 0.24);
  padding-left: 6px;
}

.mix-row.is-active .mix-formula,
.mix-row.is-active .mix-result,
.mix-row.is-active .mix-arrow {
  color: var(--ink);
}

.mix-row.is-active .mix-arrow {
  opacity: 1;
  transform: translateX(1px);
}

.mix-row.is-active .result-dot {
  width: 13px;
  height: 13px;
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--mix-colour) 30%, transparent);
}

/* ---------------------------------------------------------------- rail foot */

.rail-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: auto;
  padding-top: clamp(28px, 5vh, 52px);
}

.rail-note {
  display: flex;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.07em;
  line-height: 1.9;
}

.rail-note > span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.rail-note small {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--muted) 76%, transparent);
}

.rail-index {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  line-height: 1.8;
  text-align: right;
  color: var(--muted);
}

/* ------------------------------------------------------------- stage shell */

.stage-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding-top: 2px;
}

.stage-head,
.stage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.stage-head {
  padding: 0 2px 10px;
}

.stage-foot {
  padding: 11px 2px 0;
}

.stage-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.11em;
}

.stage-title small {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.stage-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.4;
  transition:
    background-color 200ms ease,
    opacity 200ms ease,
    box-shadow 200ms ease;
}

.stage-status.is-active .status-dot {
  background: var(--orange);
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.13);
}

.stage-status.is-moving .status-dot {
  animation: status-pulse 1.1s ease-in-out infinite;
}

@keyframes status-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 2px rgba(244, 123, 32, 0.12);
  }
  50% {
    transform: scale(0.72);
    box-shadow: 0 0 0 5px rgba(244, 123, 32, 0.06);
  }
}

.stage {
  position: relative;
  flex: 1;
  min-height: 470px;
  overflow: hidden;
  border: 1px solid rgba(24, 21, 18, 0.18);
  border-radius: 2px;
  background-color: var(--stage);
  background-image:
    linear-gradient(rgba(24, 21, 18, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 21, 18, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.38), transparent 60%);
  background-size:
    52px 52px,
    52px 52px,
    100% 100%;
  isolation: isolate;
  touch-action: none;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 0 80px rgba(86, 70, 45, 0.045);
}

.stage-watermark {
  position: absolute;
  right: 3.5%;
  bottom: -0.16em;
  z-index: 0;
  color: transparent;
  font-family: var(--font-serif);
  font-size: clamp(120px, 14vw, 250px);
  font-style: italic;
  font-weight: 700;
  letter-spacing: -0.11em;
  line-height: 0.7;
  opacity: 0.42;
  -webkit-text-stroke: 1px rgba(24, 21, 18, 0.09);
  user-select: none;
  pointer-events: none;
}

.stage-side-note {
  position: absolute;
  top: 50%;
  right: 12px;
  z-index: 3;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.24em;
  opacity: 0.65;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: center;
  pointer-events: none;
  white-space: nowrap;
}

.stage-corner {
  position: absolute;
  z-index: 3;
  color: rgba(24, 21, 18, 0.35);
  font-family: var(--font-mono);
  font-size: 12px;
  pointer-events: none;
}

.stage-corner--tl {
  top: 12px;
  left: 14px;
}

.stage-corner--br {
  right: 14px;
  bottom: 9px;
}

.drag-cue {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(24, 21, 18, 0.13);
  border-radius: 999px;
  background: rgba(241, 237, 228, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  pointer-events: none;
  transition:
    opacity 400ms ease,
    transform 400ms ease;
}

.drag-cue__icon {
  display: inline-block;
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
  animation: cue-nudge 2.8s ease-in-out infinite;
}

.drag-cue em {
  font-family: var(--font-mono);
  font-size: 7px;
  font-style: normal;
  letter-spacing: 0.12em;
  opacity: 0.68;
}

.stage.has-interacted .drag-cue {
  opacity: 0;
  transform: translateY(-5px);
}

@keyframes cue-nudge {
  0%,
  70%,
  100% {
    transform: translateX(0);
  }
  78% {
    transform: translateX(3px);
  }
  86% {
    transform: translateX(-2px);
  }
  94% {
    transform: translateX(1px);
  }
}

/* ------------------------------------------------------------------- art */

.art {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.primary {
  cursor: grab;
  outline: none;
  transition: filter 220ms ease;
}

.primary--red {
  fill: var(--red);
}

.primary--yellow {
  fill: var(--yellow);
}

.primary--blue {
  fill: var(--blue);
}

.primary:active {
  cursor: grabbing;
}

.art.is-dragging .primary {
  cursor: grabbing;
}

.mix-layer,
.label-layer,
.ring-layer,
.focus-layer {
  pointer-events: none;
}

.ring {
  fill: none;
  stroke: rgba(24, 21, 18, 0.34);
  stroke-width: var(--ring-width, 1.3);
  pointer-events: none;
  transition:
    stroke 180ms ease,
    stroke-width 180ms ease;
}

.custom-circle {
  cursor: grab;
  mix-blend-mode: multiply;
  outline: none;
  pointer-events: auto;
  animation: custom-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.custom-circle:active,
.art.is-dragging .custom-circle {
  cursor: grabbing;
}

.custom-ring {
  stroke: var(--custom-ring, rgba(24, 21, 18, 0.34));
}

.custom-ring.is-highlighted {
  stroke: var(--custom-ring-hover, rgba(24, 21, 18, 0.9));
  stroke-width: var(--ring-hover-width, 1.8);
}

.custom-focus-ring.is-visible {
  opacity: 0.82;
}

.focus-ring {
  fill: none;
  stroke: var(--ink);
  stroke-width: var(--focus-width, 2);
  stroke-dasharray: var(--focus-dash, 3 7);
  stroke-linecap: round;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.art.is-focus-red #focus-red,
.art.is-focus-yellow #focus-yellow,
.art.is-focus-blue #focus-blue {
  opacity: 0.82;
}

.art.is-focus-red #ring-red,
.art.is-focus-yellow #ring-yellow,
.art.is-focus-blue #ring-blue,
.art.is-hover-red #ring-red,
.art.is-hover-yellow #ring-yellow,
.art.is-hover-blue #ring-blue {
  stroke: rgba(24, 21, 18, 0.9);
  stroke-width: var(--ring-hover-width, 1.8);
}

.circle-label {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.circle-code {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.17em;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.circle-label--light {
  fill: rgba(255, 250, 240, 0.88);
}

.circle-label--dark {
  fill: rgba(24, 21, 18, 0.74);
}

.lens {
  shape-rendering: geometricPrecision;
}

/* --------------------------------------------------------------- stage foot */

.stage-legend {
  display: flex;
  align-items: center;
  gap: 17px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.stage-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.stage-legend b {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  opacity: 0.6;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.legend-dot--red {
  background: var(--red);
}

.legend-dot--yellow {
  background: var(--yellow);
}

.legend-dot--blue {
  background: var(--blue);
}

.stage-tip {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------------------------------------ accessibility */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ----------------------------------------------------------- custom bar */

.custom-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  min-height: 48px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.custom-bar__head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  white-space: nowrap;
}

.custom-bar__title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  line-height: 1.25;
}

.custom-bar__title small {
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.custom-bar__count {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.custom-bar__count span:first-child {
  color: var(--ink);
  font-size: 10px;
}

.custom-clear {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.custom-clear:hover {
  color: var(--ink);
}

.custom-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.custom-list::-webkit-scrollbar {
  display: none;
}

.custom-empty {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.custom-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 4px 4px 4px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  animation: chip-in 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.custom-chip__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--chip-colour);
  box-shadow: 0 0 0 1px rgba(24, 21, 18, 0.12);
}

.custom-chip__hex {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.custom-chip__remove {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.custom-chip__remove:hover {
  background: var(--ink);
  color: var(--paper);
}

.custom-chip__remove:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 1px;
}

.custom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.colour-field {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.colour-field:hover {
  border-color: var(--ink);
}

.colour-field:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.colour-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.colour-field__swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--chosen-colour, #00a88f);
  box-shadow: inset 0 0 0 1px rgba(24, 21, 18, 0.12);
  pointer-events: none;
  transition: transform 160ms ease;
}

.colour-field:hover .colour-field__swatch {
  transform: scale(1.08);
}

.add-circle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.add-circle__plus {
  font-size: 14px;
  line-height: 1;
  transform: translateY(-1px);
}

.add-circle:hover:not(:disabled) {
  background: transparent;
  color: var(--ink);
}

.add-circle:active:not(:disabled) {
  transform: translateY(1px);
}

.add-circle:disabled {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes custom-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes chip-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .header-center {
    display: none;
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .workspace {
    grid-template-columns: minmax(265px, 0.7fr) minmax(0, 1.85fr);
    gap: clamp(26px, 3.4vw, 46px);
  }

  .rail-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
  }

  .rail-index {
    display: none;
  }
}

@media (max-width: 980px) {
  .site {
    min-height: 100svh;
    height: auto;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding-top: 28px;
  }

  .rail {
    display: contents;
  }

  .rail-intro {
    order: 1;
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
    align-items: end;
    column-gap: 34px;
  }

  .eyebrow {
    grid-column: 1 / -1;
    margin-bottom: 20px;
  }

  h1 {
    font-size: clamp(64px, 11vw, 104px);
  }

  .lede {
    grid-column: 1;
    margin-top: 22px;
    font-size: clamp(18px, 2.4vw, 23px);
  }

  .body-copy {
    grid-column: 2;
    align-self: end;
    margin-top: 0;
    padding-bottom: 4px;
  }

  .stage-shell {
    order: 2;
    min-height: 0;
    padding-top: 0;
  }

  .stage {
    flex: none;
    height: min(64vw, 560px);
    min-height: 370px;
  }

  .reaction-panel {
    order: 3;
    max-width: none;
    margin-top: 4px;
  }

  .mix-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 28px;
  }

  .mix-row--all {
    margin-top: 0;
  }

  .rail-foot {
    order: 4;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: 0;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
  }

  .rail-index {
    display: block;
  }
}

@media (max-width: 640px) {
  :root {
    --page-y: 15px;
    --page-x: 16px;
  }

  .site {
    padding-bottom: 22px;
  }

  .site-header {
    gap: 14px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 32px;
  }

  .brand-dot {
    width: 13px;
    height: 13px;
  }

  .brand-name {
    font-size: 11px;
    letter-spacing: 0.09em;
  }

  .brand-name small {
    font-size: 7px;
  }

  .reset-button {
    padding: 7px 11px 7px 9px;
    font-size: 10px;
  }

  .reset-button svg {
    width: 12px;
    height: 12px;
  }

  .workspace {
    gap: 22px;
    padding-top: 24px;
  }

  .rail-intro {
    display: block;
  }

  .eyebrow {
    margin-bottom: 18px;
    font-size: 8px;
  }

  h1 {
    font-size: clamp(64px, 22vw, 88px);
  }

  .lede {
    margin-top: 20px;
    font-size: 19px;
  }

  .body-copy {
    margin-top: 11px;
    font-size: 11px;
    line-height: 1.8;
  }

  .stage {
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
  }

  .stage-head {
    padding-bottom: 8px;
  }

  .stage-title {
    font-size: 10px;
  }

  .stage-status {
    font-size: 8px;
  }

  .stage-watermark {
    font-size: 28vw;
  }

  .stage-side-note {
    display: none;
  }

  .drag-cue {
    top: 10px;
    left: 10px;
    padding: 5px 8px;
    font-size: 8px;
  }

  .drag-cue em {
    display: none;
  }

  .mix-list {
    display: flex;
  }

  .mix-row {
    min-height: 43px;
  }

  .reaction-panel {
    margin-top: 0;
  }

  .panel-head h2 small {
    display: none;
  }

  .rail-foot {
    align-items: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
  }

  .rail-index {
    display: none;
  }

  .stage-foot {
    gap: 10px;
    padding-top: 9px;
  }

  .stage-legend {
    gap: 12px;
    font-size: 8px;
  }

  .stage-tip {
    font-size: 7px;
  }

  .custom-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
    min-height: 0;
    margin-top: 8px;
    padding-top: 9px;
  }

  .custom-bar__head {
    grid-column: 1;
    grid-row: 1;
  }

  .custom-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .custom-list {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 18px;
    padding: 0 0 2px;
  }

  .custom-empty {
    font-size: 8px;
  }

  .add-circle {
    height: 30px;
    padding: 0 11px;
    font-size: 9px;
  }

  .colour-field {
    width: 30px;
    height: 30px;
  }

  .colour-field__swatch {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 420px) {
  .custom-chip__hex {
    display: none;
  }

  .custom-chip {
    gap: 4px;
    padding: 4px 4px 4px 6px;
  }

  .custom-bar__title small {
    display: none;
  }
}

@media (max-width: 390px) {
  .brand-name small {
    display: none;
  }

  .stage-tip {
    display: none;
  }
}


/* ------------------------------------------------------------- entrance */
@media (prefers-reduced-motion: no-preference) {
  .rail-intro > * {
    animation: rise-in 760ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .rail-intro > :nth-child(2) {
    animation-delay: 50ms;
  }

  .rail-intro > :nth-child(3) {
    animation-delay: 110ms;
  }

  .rail-intro > :nth-child(4) {
    animation-delay: 160ms;
  }

  .reaction-panel {
    animation: rise-in 760ms 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .stage-head,
  .stage-foot {
    animation: fade-in 700ms 140ms ease both;
  }

  .stage {
    animation: stage-in 900ms 80ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .rail-foot {
    animation: fade-in 800ms 420ms ease both;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes stage-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
