@font-face {
  font-family: 'Averia Serif Libre';
  src: url('./fonts/averia-serif-libre-400.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Averia Serif Libre';
  src: url('./fonts/averia-serif-libre-300-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito Sans';
  src: url('./fonts/nunito-sans-latin-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}
* {
  box-sizing: border-box;
}
:root {
  color-scheme: light;
  --ink: #262626;
  --muted: #666666;
  --line: #dadada;
  --paper: #f7f7f7;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --body-font: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --heading-font: 'Averia Serif Libre', Georgia, serif;
  font-family: var(--body-font);
  color: var(--ink);
  background: var(--paper);
}
::selection {
  background-color: var(--selection-background, #bdb6af);
  color: var(--selection-text, #171717);
}
body {
  margin: 0;
}
h1, h2 {
  font-family: var(--heading-font);
  font-weight: 400;
}
button,
select,
input {
  font: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  color: inherit;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 3px solid #818181;
  outline-offset: 3px;
}
.top {
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 max(5vw, calc((100vw - 1416px) / 2));
  height: 72px;
}
.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 21px;
  letter-spacing: -1px;
  font-weight: 730;
}
.mark {
  display: block;
  width: 34px;
  height: 34px;
  flex: none;
  fill: currentColor;
}
.history {
  display: flex;
  gap: 6px;
}
.soft,
.view-tools button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
}
.soft {
  padding: 7px 11px;
  font-size: 13px;
}
.soft:disabled {
  opacity: 0.43;
}
.soft:enabled:hover,
select:hover {
  background: #ececec;
}
main {
  width: 90%;
  max-width: 1416px;
  margin: 0 auto;
  padding: 34px 0 46px;
}
.intro,
.section-head,
.stage-head,
.mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.intro {
  margin-bottom: 24px;
  flex-wrap: wrap;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: clamp(36px, 3.7vw, 57px);
  line-height: 1.06;
  font-weight: 650;
  letter-spacing: -0.065em;
}
h1 span {
  color: #717171;
}
.intro p {
  font-size: 15px;
  color: var(--muted);
  margin-top: 10px;
}
.palette-settings {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
}
.draw-space {
  margin: 0;
  padding: 0;
  border: 0;
}
.draw-space legend {
  margin-bottom: 6px;
  padding: 0;
}
#draw-options {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
  background: #ececec;
}
#draw-options label {
  position: relative;
  cursor: pointer;
}
#draw-options span {
  display: block;
  padding: 6px 10px;
  border-radius: 4px;
  font: 600 13px/16px var(--mono);
  color: var(--muted);
}
#draw-options input:checked + span {
  background: var(--ink);
  color: white;
}
#draw-options input:focus-visible + span {
  outline: 2px solid #818181;
  outline-offset: 1px;
}
#curve-gamut:not(:empty) {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
select {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 32px 9px 11px;
  color: var(--ink);
  font: 500 14px var(--body-font);
}
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(210px, 1fr);
  gap: 14px;
  height: clamp(385px, 48vh, 590px);
}
.stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
  border-radius: 14px;
  background: #161616;
  color: white;
}
.plot-area {
  position: relative;
  flex: 1;
  min-height: 0;
}
.stage-head {
  position: absolute;
  inset: 20px 22px auto;
  z-index: 1;
  align-items: flex-start;
  pointer-events: none;
}
.view-tools {
  pointer-events: auto;
  display: flex;
  gap: 5px;
}
.view-tools button {
  background: #2b2b2b;
  color: #ececec;
  border-color: #4e4e4e;
  width: 31px;
  height: 30px;
  font: 18px/1 var(--mono);
}
.view-tools button:hover {
  background: #454545;
}
.layer-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px clamp(8px, 2vw, 22px);
  border-top: 1px solid #ffffff19;
  background: #161616;
}
.layer-bar button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  color: #d5d5d5;
  background: transparent;
  border: 1px solid #ffffff26;
  border-radius: 6px;
  font: 11px var(--mono);
}
.layer-bar select {
  min-height: 28px;
  padding: 3px 7px;
  font: 11px var(--mono);
}
.layer-bar button::before {
  content: '';
  width: 6px;
  height: 6px;
  border: 1px solid #a1a1a1;
  border-radius: 50%;
}
.layer-bar button:hover {
  background: #353535;
}
.layer-bar button[aria-pressed='true'] {
  border-color: #b7b7b7;
  background: #3e3e3e;
  color: white;
}
.layer-bar button[aria-pressed='true']::before {
  background: #cdcdcd;
  border-color: #cdcdcd;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.eyebrow,
.mini-dimensions,
.section-head span,
.stage-foot {
  font: 10px var(--mono);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #c9c9c9;
}
.eyebrow i {
  width: 6px;
  height: 6px;
  background: #b7b7b7;
  border-radius: 50%;
}
.stage h2 {
  font-size: 33px;
  line-height: 1.15;
  letter-spacing: -0.05em;
  margin-top: 6px;
  font-weight: 400;
}
#plot {
  position: relative;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.stage-foot {
  position: absolute;
  bottom: 17px;
  left: 22px;
  right: 15px;
  display: flex;
  gap: 20px;
  color: #d0d0d0;
  pointer-events: none;
}
.stage-foot span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stage-foot span[hidden] {
  display: none;
}
.point-symbol {
  width: 9px;
  height: 9px;
  border: 1.3px solid #e4e4e4;
  border-radius: 50%;
}
.orbit-symbol {
  width: 13px;
  height: 8px;
  border: 1px solid #e4e4e4;
  border-radius: 50%;
  transform: rotate(-26deg);
}
.linked {
  display: grid;
  gap: 14px;
  grid-auto-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: auto;
}
.mini {
  position: relative;
  text-align: left;
  display: block;
  padding: 0;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface, #eeeeee);
  overflow: hidden;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.mini:hover {
  border-color: #8d8d8d;
  box-shadow: inset 0 0 0 1px #99999970;
}
.mini-head {
  position: absolute;
  left: 16px;
  top: 13px;
  right: 15px;
  align-items: flex-start;
  z-index: 1;
}
.mini-head strong {
  font-size: 20px;
  letter-spacing: -0.06em;
  font-weight: 630;
}
.mini-head span:last-child {
  font-size: 17px;
  color: #666666;
}
.mini canvas {
  position: absolute;
  inset: 30px 7px 25px;
  width: calc(100% - 14px);
  height: calc(100% - 55px);
}
.mini-dimensions {
  position: absolute;
  bottom: 11px;
  left: 15px;
  right: 10px;
  color: #5d5d5d;
  letter-spacing: 0.02em;
}
.palette {
  margin-top: 24px;
}
.section-head {
  margin-bottom: 12px;
}
.section-head h2 {
  font-size: 20px;
  font-weight: 630;
  letter-spacing: -0.045em;
}
.section-head span {
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--muted);
}
#swatches {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  --swatch-radius: 10px;
  border-radius: var(--swatch-radius);
  border: 1px solid #29292918;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
  text-align: left;
  border: 0;
  background: var(--swatch);
  color: var(--text);
  padding: 12px 14px;
  position: relative;
  transition: box-shadow 0.14s;
}
button.swatch:hover,
button.swatch:focus-visible {
  box-shadow: inset 0 0 0 3px currentColor;
  z-index: 1;
  outline-offset: -4px;
}
.swatch .num {
  font: 11px var(--mono);
  opacity: 0.8;
}
.swatch .value {
  font: 600 clamp(11px, 1.18vw, 17px) var(--mono);
}
input[type='range'] {
  grid-column: 1/-1;
  width: 100%;
  margin: 6px 0;
  accent-color: #616161;
  height: 12px;
  cursor: pointer;
}
#notice {
  min-height: 16px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
}
@media (min-width: 1500px) {
  main {
    padding-top: 48px;
  }
  .workbench {
    height: clamp(500px, 52vh, 620px);
  }
}
@media (max-width: 760px) {
  .top {
    height: 58px;
  }
  .intro {
    align-items: end;
  }
  .intro p {
    font-size: 13px;
  }
  .workbench {
    grid-template-columns: 1fr;
    height: auto;
  }
  .stage {
    height: clamp(330px, 58vw, 420px);
  }
  .linked {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    height: 150px;
    overflow: visible;
  }
  .stage-head {
    inset: 15px 16px auto;
  }
  .stage-foot {
    left: 16px;
    gap: 12px;
  }
  main {
    width: 92%;
    padding-top: 23px;
  }
  .swatch {
    padding: 10px 6px;
  }
  .mini-head {
    top: 8px;
    left: 10px;
    right: 10px;
  }
  .mini-dimensions {
    left: 10px;
    bottom: 8px;
  }
  .intro {
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .intro {
    display: block;
    position: relative;
  }
  .intro p {
    max-width: 240px;
    margin: 7px 0 14px;
  }
  .linked {
    height: 135px;
    gap: 8px;
  }
  .workbench {
    gap: 8px;
  }
  .mini-head strong {
    font-size: 16px;
  }
  .mini-dimensions {
    font-size: 9px;
  }
  .stage-foot {
    font-size: 9px;
  }
  .section-head h2 {
    font-size: 18px;
  }
  .swatch .value {
    font-size: 10px;
  }
  .top {
    padding: 0 4vw;
  }
  .section-head span {
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  .stage-foot {
    gap: 7px;
    font-size: 8px;
  }
  .hold-hint {
    max-width: 80px;
  }
}

/* Full-page workspace */
:root {
  color-scheme: dark;
  --ink: #efefef;
  --muted: #a8a8a8;
  --line: #484848;
  background: #161616;
}
body {
  min-width: 320px;
  background: #161616;
}
.top {
  position: absolute;
  inset: 0 0 auto;
  height: 72px;
  padding: 0 28px;
  z-index: 4;
  border-color: #ffffff16;
}
.brand {
  font-size: 20px;
  color: #f8f8f8;
}
.history {
  position: absolute;
  right: 28px;
}
.soft {
  color: #e2e2e2;
  border-color: #555555;
  background: #2b2b2b;
}
.soft:enabled:hover,
select:hover {
  background: #424242;
}
main {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
}
.intro {
  position: absolute;
  z-index: 4;
  top: 87px;
  left: 28px;
  margin: 0;
}
.palette-settings {
  align-items: end;
  gap: 14px;
}
.draw-space legend { color: #bbb; }
#draw-options {
  background: #2e2e2e;
  border-color: #555555;
}
#draw-options span {
  color: #c3c3c3;
}
#draw-options input:checked + span {
  background: #e2e2e2;
  color: #252525;
}
select {
  color: #efefef;
  background: #2e2e2e;
  border-color: #555555;
}
.workbench {
  display: block;
  height: auto;
}
.stage {
  position: absolute;
  inset: 0;
  border-radius: 0;
  background: #161616;
}
.stage::before {
  display: none;
}
.plot-area {
  position: absolute;
  inset: 0;
  isolation: isolate;
  background: #1c1c1c;
}
.layer-bar[hidden] {
  display: none;
}
.plot-area::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('./grain.svg?v=contrast-more') repeat;
  background-size: 192px 192px;
  opacity: 0.9;
  mix-blend-mode: overlay;
}
#plot {
  z-index: 1;
}
.stage-head {
  inset: 176px 28px auto;
  z-index: 2;
}
.stage-foot {
  bottom: 213px;
  left: 28px;
  z-index: 2;
}
.layer-bar {
  position: absolute;
  bottom: 165px;
  left: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}
.linked {
  position: absolute;
  z-index: 3;
  top: 105px;
  right: 28px;
  width: 208px;
  height: 360px;
  gap: 10px;
  overflow: visible;
}
.mini {
  border-color: transparent;
  background: transparent;
  color: #ffffff;
}
.mini:hover {
  border-color: #c9c9c9;
  background: #ffffff0a;
}
.mini-head span:last-child,
.mini-dimensions {
  color: #cdcdcd;
}
.palette {
  position: absolute;
  z-index: 3;
  left: 28px;
  bottom: 85px;
  width: min(530px, calc(100% - 56px));
  margin: 0;
}
.palette .section-head {
  margin-bottom: 8px;
}
.palette .section-head h2 {
  font-size: 14px;
}
.section-head span,
#curve-gamut:not(:empty),
#notice {
  color: #bfbfbf;
}
.swatch {
  gap: 10px;
  padding: 9px 12px;
  min-height: 54px;
}
.swatch .value {
  font-size: 12px;
}
#notice {
  min-height: 0;
  margin-top: 0;
}
#notice:not(:empty) {
  margin-top: 8px;
}
.space-transition {
  position: fixed;
  z-index: 5;
  pointer-events: none;
}
@media (max-width: 1000px) {
  .palette {
    bottom: 164px;
    width: min(480px, calc(100% - 56px));
  }
  .layer-bar {
    bottom: 250px;
  }
  .stage-foot {
    bottom: 292px;
  }
}
@media (max-width: 760px) {
  .top {
    height: 60px;
    padding: 0 16px;
  }
  .history {
    right: 16px;
  }
  main {
    width: 100%;
    padding: 0;
  }
  .intro {
    top: 74px;
    left: 16px;
  }
  .stage {
    height: 100%;
  }
  .stage-head {
    inset: 160px 16px auto;
  }
  .stage-foot {
    left: 16px;
    bottom: 316px;
    font-size: 9px;
  }
  .layer-bar {
    bottom: 277px;
    left: 16px;
  }
  .linked {
    top: 185px;
    right: 16px;
    width: 140px;
    height: 244px;
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 8px;
  }
  .mini-dimensions {
    font-size: 8px;
  }
  .palette {
    left: 16px;
    bottom: 187px;
    width: calc(100% - 32px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mini {
    transition: none;
  }
}
@media (min-width: 1001px) {
  .palette {
    width: min(480px, calc(50% - 42px));
  }
  .stage-head {
    right: 255px;
  }
}
@media (max-width: 760px) {
  .stage-head {
    right: 16px;
  }
  .stage-head .view-tools {
    position: absolute;
    top: 74px;
    left: 0;
  }
  .linked {
    top: 155px;
    right: 16px;
    width: 220px;
    height: 105px;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }
  .mini-dimensions {
    display: none;
  }
  .mini canvas {
    inset: 25px 4px 4px;
    width: calc(100% - 8px);
    height: calc(100% - 29px);
  }
}

/* Palette controls */
.palette {
  left: 50%;
  right: auto;
  bottom: 22px;
  width: min(530px, calc(100% - 180px));
  transform: translateX(-50%);
}
#swatches {
  overflow-x: auto;
}
.palette-controls {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  column-gap: 24px;
  row-gap: 2px;
  align-items: center;
  margin-top: 12px;
  font: 11px var(--mono);
  color: #c8c8c8;
}
.count-control {
  grid-row: span 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count-control input {
  width: 52px;
  padding: 6px 4px 6px 8px;
  border: 1px solid #555;
  border-radius: 5px;
  background: #292929;
  color: #fff;
}
.shift-control {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.shift-input {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9e9e9e;
}
.shift-input input {
  flex: 1;
  margin: 4px 0;
}
.layer-bar {
  bottom: 170px;
}
.stage-foot {
  bottom: 210px;
}
@media (max-width: 760px) {
  .palette {
    left: 50%;
    bottom: 20px;
    width: calc(100% - 32px);
  }
  .stage-foot {
    bottom: 226px;
  }
  .layer-bar {
    bottom: 188px;
  }
}



.weight-control {
  position: relative;
  height: 24px;
  margin: 10px 0 16px;
  opacity: 0.5;
  transition: opacity 180ms ease;
}
.weight-control:hover,
.weight-control:has(#palette-shift:focus-visible) {
  opacity: 1;
}
.weight-track {
  position: absolute;
  inset: auto 0 2px;
  height: 3px;
}
.weight-gradient { width: 100%; height: 100%; border-radius: 2px; }
.weight-point {
  position: absolute;
  bottom: -1px;
  width: 5px;
  height: 5px;
  border: 1px solid #e8e8e8;
  border-radius: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
}
#palette-shift {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  left: calc(5% - 6px);
  width: calc(90% + 12px);
  top: 0;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
}
#palette-shift::-webkit-slider-runnable-track { height: 24px; background: transparent; }
#palette-shift::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 15px;
  background: #f4f4f4;
  clip-path: polygon(6% 0, 94% 0, 94% 65%, 50% 100%, 6% 65%);
}
#palette-shift::-moz-range-track { height: 24px; background: transparent; }
#palette-shift::-moz-range-thumb {
  width: 12px;
  height: 15px;
  border: 0;
  border-radius: 0;
  background: #f4f4f4;
  clip-path: polygon(6% 0, 94% 0, 94% 65%, 50% 100%, 6% 65%);
}
#palette-shift:focus-visible { outline: 1px solid white; outline-offset: 3px; }
.palette-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  color: #a5a5a5;
}
.palette-controls button {
  border: 0;
  background: transparent;
  color: #999;
  font-size: 17px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.palette-controls button:hover,
.palette-controls button:focus-visible { color: #fff; }
.palette-controls button:disabled { opacity: .3; cursor: default; }

/* Keep the palette compact until the swatches need more room. */
.palette {
  width: min(max(530px, var(--palette-min, 350px)), calc(100% - 56px));
}
#swatches { overflow: hidden; }
.swatch { padding-inline: clamp(3px, 1vw, 12px); }
.swatch .value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
#swatch-detail {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 5px 8px;
  border: 1px solid #555;
  border-radius: 5px;
  background: #292929;
  color: #fff;
  font: 11px var(--mono);
  pointer-events: none;
}
#swatch-detail[hidden] { display: none; }
@media (max-width: 760px) {
  .palette { width: min(max(530px, var(--palette-min, 350px)), calc(100% - 32px)); }
}

#curve-gamut:not(:empty) {
  position: absolute;
  z-index: 3;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: max-content;
  max-width: min(420px, calc(100% - 32px));
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #ffffff1c;
  border-radius: 7px;
  background: #303030ed;
  color: #c9c9c9;
  font: 11px/1.45 var(--mono);
  pointer-events: none;
}
@media (max-width: 760px) {
  #curve-gamut:not(:empty) { top: 245px; max-width: min(230px, calc(100% - 120px)); }
}

#weight-reset {
  position: absolute;
  z-index: 2;
  top: 2px;
  left: 50%;
  width: 11px;
  height: 11px;
  padding: 0;
  border: 1px solid #bdbdbd;
  border-radius: 50%;
  transform: translateX(-50%);
  background: transparent;
  opacity: 0.35;
  transition: opacity 180ms ease;
  cursor: pointer;
}
#weight-reset:hover,
#weight-reset:focus-visible { opacity: 0.6; }
#weight-reset:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#weight-reset[hidden] { display: none; }
.weight-control:has(#weight-reset:focus-visible) { opacity: 1; }

/* The two bookends open the manual color editor. */
button.swatch:first-child { border-radius: calc(var(--swatch-radius) - 1px) 0 0 calc(var(--swatch-radius) - 1px); }
button.swatch:last-child { border-radius: 0 calc(var(--swatch-radius) - 1px) calc(var(--swatch-radius) - 1px) 0; }
button.swatch::after {
  content: '✎';
  position: absolute;
  top: 6px;
  right: 7px;
  color: var(--text);
  font: 14px/1 sans-serif;
  opacity: .65;
}
button.swatch:is(:hover, :focus-visible, [aria-expanded='true']) {
  box-shadow: inset 0 0 0 2px currentColor;
}
button.swatch:is(:hover, :focus-visible)::after { opacity: 1; }
.palette:has(#endpoint-editor:not([hidden])) #swatch-detail { visibility: hidden; }
#endpoint-editor {
  position: absolute;
  bottom: calc(100% + 10px);
  width: 100%;
  left: 0;
  max-height: 55dvh;
  overflow: hidden auto;
  scrollbar-width: none;
  padding: 9px 12px;
  border: 1px solid #494949;
  border-radius: 12px;
  background: #252525;
  box-shadow: 0 6px 24px #0005;
  color: #ededed;
  color-scheme: dark;
}
#endpoint-editor:not([hidden]) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 8px;
}
.color-comparison, #editor-spaces { display: flex; align-items: center; }
.color-comparison { margin-left: auto; gap: 7px; font: 10px var(--mono); color: #aaa; }
.color-comparison span { display: grid; gap: 3px; justify-items: center; }
.original-preview, .color-preview { display: block; }
#endpoint-editor #revert-color { padding: 5px; font: 10px var(--mono); }
#endpoint-editor #revert-color:hover { color: white; }
.original-preview, .color-preview {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #ffffff40;
}
#endpoint-editor button { border: 0; color: #ccc; background: transparent; }

#editor-spaces {
  padding: 2px;
  margin: 0;
  border-radius: 6px;
  background: #191919;
}
#editor-spaces button { padding: 5px 7px; border-radius: 4px; font: 11px var(--mono); }
#editor-spaces button[aria-pressed='true'] { background: #404040; color: white; }
.channel-fields { display: flex; gap: 8px; }
#endpoint-editor label { display: flex; align-items: center; gap: 3px; font: 10px var(--mono); color: #b9b9b9; }
#endpoint-editor [hidden] { display: none; }
.scrub-label {
  padding: 6px 2px;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.scrub-label:hover, .scrub-label[data-held] { color: white; }
#endpoint-editor input {
  width: 100%;
  min-width: 0;
  border: 1px solid #505050;
  border-radius: 5px;
  padding: 4px;
  background: #202020;
  color: #f0f0f0;
  font: 12px var(--mono);
}
#endpoint-editor input:focus-visible { outline: 1px solid #aaa; outline-offset: 0; }
#endpoint-editor .channel-fields input {
  box-sizing: content-box;
  width: 3ch;
  padding-inline: 6px;
  font-variant-numeric: tabular-nums;
}
#endpoint-editor:has([value='lab'][aria-pressed='true']) .channel-fields input { width: 6ch; }
#endpoint-editor .hex-field input { width: 9ch; }
#endpoint-editor .hex-field { font-size: 12px; }
#endpoint-editor input[type='number'] { appearance: textfield; }
#endpoint-editor::-webkit-scrollbar { display: none; }
#endpoint-editor input::-webkit-inner-spin-button { -webkit-appearance: none; }
.editor-status { flex-basis: 100%; margin: 0; font-size: 11px; color: #ccc; }
@media (max-width: 510px) {
  #endpoint-editor:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
  }
  #editor-spaces { grid-column: 1 / 3; justify-self: start; }
  .color-comparison { grid-column: 3; grid-row: 1; }
  .channel-fields, .hex-field { grid-column: 1 / -1; }
  .editor-status { grid-column: 1 / -1; }
}
.editor-status:empty { display: none; }
@media (max-width: 480px) {
  button.swatch::after { position: static; align-self: flex-start; order: -1; }
  button.swatch .num { display: none; }
}

/* Endpoint editor */
#endpoint-editor {
  width: min(700px, calc(100vw - 32px));
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
}
#endpoint-editor:not([hidden]) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
}
#editor-spaces { grid-column: 1; justify-self: start; white-space: nowrap; }
.channel-fields, .hex-field { grid-column: 2; grid-row: 1; justify-self: start; }
.channel-fields { gap: 10px; }
.color-comparison {
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  padding-left: 16px;
  border-left: 1px solid #ffffff20;
  gap: 12px;
}
.comparison-colors {
  display: flex;
  align-items: center;
  gap: 2px;
}
.color-comparison span { gap: 4px; font-size: 9px; color: #aaa; }
.color-comparison span i { width: 27px; height: 22px; border-radius: 3px; }
#endpoint-editor #revert-color {
  padding: 6px 8px;
  border: 1px solid #ffffff25;
  border-radius: 5px;
  color: #c9c9c9;
}
#endpoint-editor #revert-color:hover { border-color: #ffffff55; background: #ffffff0a; }
.editor-status { grid-column: 1 / -1; }
@media (max-width: 620px) {
  #endpoint-editor:not([hidden]) {
    grid-template-columns: 1fr auto;
    gap: 14px;
  }
  #editor-spaces { grid-column: 1; grid-row: 1; }
  .color-comparison { grid-column: 2; grid-row: 1 / 3; align-self: stretch; }
  .channel-fields, .hex-field { grid-column: 1; grid-row: 2; }
  .editor-status { grid-column: 1 / -1; }
}
@media (max-width: 390px) {
  .color-comparison { padding-left: 10px; gap: 6px; }
  #endpoint-editor:not([hidden]) { column-gap: 8px; }
  .channel-fields { gap: 3px; }
}
@media (max-width: 620px) {
  #endpoint-editor:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
  #editor-spaces { grid-column: 1; grid-row: 1; }
  .channel-fields, .hex-field { grid-column: 1; grid-row: 2; }
  .color-comparison {
    grid-column: 1;
    grid-row: 3;
    justify-self: end;
    border-left: 0;
    padding-left: 0;
  }
}

.comparison-colors { gap: 7px; }
.color-comparison .comparison-circle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
}
.color-comparison .comparison-circle i {
  display: block;
  flex: none;
  box-shadow: inset 0 0 0 1px #ffffff40;
}
.color-comparison .comparison-circle .original-preview {
  width: 12px;
  height: 24px;
  border-radius: 24px 0 0 24px;
}
.color-comparison .comparison-circle .color-preview {
  width: 14px;
  height: 28px;
  border-radius: 0 28px 28px 0;
}

/* Reveal the comparison beside the active fields. */
#endpoint-editor:not([hidden]) {
  grid-template-columns: auto auto auto;
  justify-content: start;
  column-gap: 14px;
}
.color-comparison {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 220ms;
}
.color-comparison.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition-delay: 0s;
}
.color-comparison .comparison-circle i { box-shadow: none; }
.color-comparison .comparison-circle .original-preview {
  width: 10px;
  height: 20px;
  border-radius: 20px 0 0 20px;
}
.color-comparison .comparison-circle .color-preview {
  width: 16px;
  height: 32px;
  border-radius: 0 32px 32px 0;
}
@media (max-width: 620px) {
  #endpoint-editor:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
  .color-comparison { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .color-comparison { transition: none; }
}

/* The editor grows with its visible controls. */
#endpoint-editor {
  width: max-content;
  max-width: calc(100vw - 32px);
}
.color-comparison {
  max-width: 0;
  min-width: 0;
  overflow: hidden;
  padding-left: 0;
  border-left: 1px solid transparent;
  white-space: nowrap;
  transition: max-width 240ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease,
    transform 220ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 240ms;
}
.color-comparison.is-visible {
  max-width: 220px;
  padding-left: 12px;
  border-left-color: #ffffff20;
  transition-delay: 0s;
}
.comparison-colors { gap: 7px; }
.color-comparison .comparison-circle {
  width: 24px;
  height: 24px;
  position: relative;
  display: block;
}
.color-comparison .comparison-circle .original-preview,
.color-comparison .comparison-circle .color-preview {
  position: absolute;
  inset: 0;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  box-shadow: none;
  filter: drop-shadow(0 0 1px #ffffffb3);
}
.color-comparison .comparison-circle .original-preview {
  clip-path: polygon(0 0, 91% 0, 0 91%);
}
.color-comparison .comparison-circle .color-preview {
  clip-path: polygon(100% 9%, 100% 100%, 9% 100%);
}
@media (max-width: 620px) {
  #endpoint-editor:not([hidden]) { width: max-content; }
  .color-comparison { grid-column: 1; grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .color-comparison { transition: none; }
}

/* Fixed space names, with previews moving to the centered main view. */
.history[hidden] { display: none; }
.stage-head { display: none; }
.linked {
  top: clamp(80px, calc(100dvh - 388px), 132px);
  left: 28px;
  right: auto;
  width: 220px;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.space-row { display: flex; align-items: center; gap: 8px; height: clamp(44px, calc((100dvh - 108px) / 3), 120px); }
.draw-choice { position: relative; flex: none; display: grid; place-items: center; width: 30px; height: 40px; cursor: pointer; }
.curve-icon {
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 5px; color: #bdbdbd; opacity: 0; transition: opacity 160ms ease, background 160ms ease;
}
.curve-icon svg { width: 20px; height: 20px; }
.linked:is(:hover, :focus-within) .curve-icon { opacity: .62; }
.draw-choice :checked + .curve-icon, .draw-choice:is(:hover, :focus-within) .curve-icon { opacity: 1; color: white; }
.draw-choice :checked + .curve-icon { background: #353535; }
.draw-choice :focus-visible + .curve-icon { outline: 2px solid white; }
.draw-tip {
  position: absolute; left: calc(100% + 5px); top: 50%; transform: translateY(-50%);
  width: 19ch; padding: 7px 10px; border-radius: 5px; background: #292929; color: #eee;
  font: 12px/1.4 var(--body-font); opacity: 0; visibility: hidden; pointer-events: none;
}
.draw-choice:hover .draw-tip, .draw-choice:has(:focus-visible) .draw-tip { opacity: 1; visibility: visible; }
@media (hover: none) { .draw-choice .curve-icon { opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .curve-icon { transition: none; } }
.mini {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  transition: background 200ms ease;
}
.mini:hover { background: #0000002b; border: 0; box-shadow: none; border-radius: 8px; }
.mini-head { position: static; display: block; }
.mini-head strong {
  display: inline-block;
  min-width: 54px;
  font-size: 16px;
  text-align: center;
  padding: 8px 6px;
  color: white;
  opacity: .58;
  border-radius: 6px;
  transition: opacity 200ms, font-size 200ms;
}
.space-row.is-active .mini-head strong { opacity: 1; font-size: 24px; font-weight: 750; }
.mini canvas {
  position: absolute;
  inset: auto 0 auto auto;
  right: 0;
  width: 130px;
  height: 110px;
  max-height: 100%;
}
.mini-dimensions { display: none; }
.space-row.is-active .mini-dimensions {
  display: block;
  position: static;
  width: 165px;
  padding: 2px 6px 0;
  color: #aaa;
  font: 11px/1.4 var(--body-font);
  text-align: left;
}
@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-width: 1024px) and (max-height: 540px) {
  .linked {
    top: 102px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 2px;
    width: min(236px, calc(100% - 32px));
    height: auto;
    padding: 2px 4px;
  }
  .space-row { flex: 1; min-width: 0; height: 44px; }
  .space-row .mini { justify-content: center; border-radius: 6px; background: transparent; }
  .space-row .mini-head { position: relative; inset: auto; }
  .space-row .mini-head strong,
  .space-row.is-active .mini-head strong { min-width: 0; padding: 0; font-size: 14px; }
  .space-row .mini canvas, .space-row .draw-choice,
  .space-row.is-active .mini-dimensions { display: none; }
}

/* Interaction hints sit just above the main visualization. */
.stage-foot {
  top: 90px;
  bottom: auto;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
}
@media (max-width: 760px) {
  .stage-foot { top: 80px; }
}

@media (prefers-reduced-motion: reduce) { .mini { transition: none; } }

/* All transient and persistent notices share one location. */
#notifications {
  position: absolute;
  z-index: 3;
  --notice-offset: 120px;
  --notice-max-width: 420px;
  top: var(--notice-offset);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(var(--notice-max-width), calc(100% - 32px));
  padding: 10px 14px 10px 39px;
  border: 1px solid #ffffff1c;
  border-radius: 7px;
  background: #303030ed;
  color: #c9c9c9;
  font: 11px/1.45 var(--mono);
  pointer-events: none;
}
#notifications:popover-open {
  position: fixed;
  inset: calc(var(--notice-plot-top) + var(--notice-offset)) auto auto var(--notice-plot-center);
  max-width: min(var(--notice-max-width), calc(var(--notice-plot-width) - 32px));
  margin: 0;
}
#notifications:not(:has(> p:not(:empty), #drawing-note:not([hidden]))) { display: none; }
.notice-hand {
  position: absolute;
  left: 12px;
  top: 10px;
  font: 17px/1 "Apple Color Emoji", "Segoe UI Emoji", emoji;
  transform-origin: 75% 87%;
}
@media (prefers-reduced-motion: no-preference) {
  .notice-hand { animation: notice-wave 3620ms cubic-bezier(.45, 0, .55, 1) infinite; }
}
/* The wrist settles at 1120ms, then rests for 2500ms. */
@keyframes notice-wave {
  0%, 30.94%, 100% { transform: rotate(0deg); }
  4.95% { transform: rotate(-19deg); }
  11.14% { transform: rotate(22deg); }
  17.33% { transform: rotate(-12deg); }
  22.9% { transform: rotate(6deg); }
  27.54% { transform: rotate(-2deg); }
}
#notifications #curve-gamut:not(:empty),
#notifications #notice,
#notifications #editor-status {
  all: unset;
  display: block;
}
#notifications > p:empty { display: none !important; }
#notifications > p:not(:empty) ~ p:not(:empty) { margin-top: 6px; }
@media (max-width: 760px) {
  #notifications { --notice-offset: 162px; --notice-max-width: 360px; }
}

.stage-foot { gap: 84px; }
.stage-foot[hidden] { display: none; }
@media (max-width: 760px) { .stage-foot { gap: 28px; } }

.top { justify-content: flex-start; gap: 12px; }
.palette-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
:is(.palette-actions, .palette-copy) :is(button, summary, a) {
  display: block; padding: 8px 10px; border: 0; border-radius: 5px;
  background: transparent; color: #dadada; font: 600 12px/1.4 var(--body-font);
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
:is(.palette-actions, .palette-copy) :is(button, summary, a):hover { color: white; background: #353535; }
.palette-actions details { position: relative; }
.palette-actions .share-toggle {
  display: flex;
  align-items: center;
  padding-inline: 10px;
  border-radius: 6px;
  background: transparent;
  color: #f1eeea;
  transition: background-color 220ms ease;
  -webkit-tap-highlight-color: transparent;
}
.palette-actions .share-toggle:hover { background: transparent; color: #f1eeea; }
.palette-actions[data-palette-edited] .share-toggle { background: rgb(255 255 255 / 11%); }
.palette-actions[data-palette-edited] .share-toggle:hover { background: rgb(255 255 255 / 16%); }
.palette-actions[data-palette-edited] details[open] .share-toggle { background: rgb(255 255 255 / 21%); }
.share-toggle:focus-visible { outline: 2px solid #faf7f4; outline-offset: 4px; }
.share-toggle svg { flex: none; }
:is(.palette-actions, .palette-copy) summary { list-style: none; }
:is(.palette-actions, .palette-copy) summary::-webkit-details-marker { display: none; }
.export-menu { position: absolute; right: 0; top: calc(100% + 6px); padding: 4px; background: #252525; border: 1px solid #505050; border-radius: 6px; box-shadow: 0 5px 16px #0005; }
.export-menu button { width: 100%; text-align: left; }
.save-share-menu {
  width: min(254px, calc(100vw - 32px));
  max-height: calc(100dvh - 82px);
  overflow-y: auto;
}
.share-dialog {
  position: fixed;
  inset: calc(var(--visible-top, 0px) + var(--visible-height, 100dvh) / 2) 0 auto;
  width: min(400px, calc(100% - 32px));
  --share-dialog-max-height: calc(var(--visible-height, 100dvh) - 24px);
  max-height: var(--share-dialog-max-height);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #ffffff20;
  border-radius: 16px;
  background: #2a2a2c;
  color: #f1eeea;
  color-scheme: dark;
  box-shadow: 0 16px 58px #0009;
  opacity: 0;
  transform: translateY(calc(-50% + 6px)) scale(.98);
}
.share-dialog[open] { opacity: 1; transform: translateY(-50%); }
.share-dialog::backdrop { background: #000a; }
@media (prefers-reduced-motion: no-preference) {
  .share-dialog {
    transition: opacity 180ms ease, transform 180ms ease, display 180ms allow-discrete, overlay 180ms allow-discrete;
  }
  @starting-style {
    .share-dialog[open] { opacity: 0; transform: translateY(calc(-50% + 6px)) scale(.98); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .palette-actions .share-toggle { transition: none; }
}
.share-dialog-content {
  display: grid;
  gap: clamp(10px, calc(var(--visible-height, 100dvh) * .04), 16px);
  margin: 0;
  padding: clamp(16px, calc(var(--visible-height, 100dvh) * .05), 24px);
  max-height: calc(var(--share-dialog-max-height) - 2px);
  overflow: auto;
  scrollbar-width: none;
}
.share-dialog-content::-webkit-scrollbar { display: none; }
.share-dialog h2 {
  margin: 0 36px 0 0;
  font: 400 25px/1.18 var(--heading-font);
}
.share-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e5e0db;
  cursor: pointer;
}
.share-dialog-close:hover { background: #ffffff16; }
#palette-other-dialog .palette-copy-formats { display: contents; }
#palette-other-dialog [data-export] {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #ffffff36;
  border-radius: 8px;
  background: #1c1c1c;
  color: inherit;
  font: 600 15px/1.4 var(--body-font);
  text-align: left;
  cursor: pointer;
}
#palette-other-dialog [data-export]:hover { border-color: #ffffff70; }
#palette-image-name,
.palette-image-name-edit {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid #ffffff36;
  border-radius: 8px;
  background: #1c1c1c;
  color: inherit;
  font: 600 18px/1.3 var(--body-font);
}
.palette-image-name-edit:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}
.palette-image-name-edit:hover { border-color: #ffffff70; }
#palette-image-current-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-image-name-edit svg { flex: none; }
.palette-image-name-swatches {
  display: flex;
  height: 20px;
  overflow: hidden;
  border-radius: 5px;
}
.palette-image-name-swatches span { flex: 1; }
.palette-image-name-status { margin: 0; font-size: 13px; }
.palette-image-name-status:empty { display: none; }
.palette-image-name-submit {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #f1eeea;
  color: #1c1c1c;
  font: 750 15px/1.4 var(--body-font);
  cursor: pointer;
}
.palette-image-name-submit:hover:enabled { background: #fff; }
.palette-image-name-submit:disabled { opacity: .56; cursor: default; }
.share-dialog :is(button, input):focus-visible {
  outline: 2px solid #f1eeea;
  outline-offset: 2px;
}
@media (max-width: 620px) {
  html:not([data-guided]) .top { height: auto; min-height: 72px; padding-block: 6px; flex-wrap: wrap; gap: 0 6px; }
  .palette-actions { gap: 2px; }
  .palette-actions :is(button, a, summary) { padding: 6px 8px; }
}

#drawing-note { pointer-events: auto; }
#drawing-note:not([hidden]):has(#drawing-confirmation[hidden]) {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 12px;
}
#drawing-message strong { color: #eee; }
#drawing-message:not([hidden]) ~ .notice-actions { margin: 0 0 0 auto; gap: 10px; align-items: baseline; }
.notice-actions #drawing-dismiss { color: #aaa; text-decoration: none; }
#notifications:not(:has(> p:not(:empty))):has(#drawing-note:not([hidden]) #drawing-message:not([hidden])) {
  max-width: min(420px, calc(100% - 32px));
  padding: 5px 12px;
}
#notifications:not(:has(> p:not(:empty))):has(#drawing-note:not([hidden]) #drawing-message:not([hidden])) .notice-hand { display: none; }
#notifications > p:not(:empty) ~ #drawing-note { margin-top: 7px; }
.notice-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 14px; margin-top: 4px; }
.notice-actions button { padding: 3px 0; border: 0; background: none; color: #ddd; text-decoration: underline; text-underline-offset: 3px; font: inherit; cursor: pointer; }
.notice-actions button:hover { color: white; }
.notice-actions button[hidden] { display: none; }

#notifications {
  overflow: hidden;
  border: 0;
  box-shadow: inset 0 0 0 1px #ffffff1c;
}
@media (prefers-reduced-motion: no-preference) {
  #notifications {
    transition: opacity 200ms ease-out, translate 200ms ease-out;
  }
  @starting-style {
    #notifications { opacity: 0; translate: 0 4px; }
  }
  #notifications[data-closing] {
    opacity: 0;
    translate: 0 4px;
    transition-duration: 150ms;
    transition-timing-function: ease-in;
  }
}
.notice-countdown {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 2px;
  background: #a9a9a6; opacity: .72; transform-origin: left; pointer-events: none;
}
#notifications:has(#notice .notice-countdown):has(#drawing-note .notice-countdown) .notice-countdown { width: 50%; }
#notifications:has(#notice .notice-countdown) #drawing-note .notice-countdown { left: 50%; }
.palette-actions button[hidden] { display: none; }
#notifications #notice:has(.notice-countdown) { pointer-events: auto; }

.palette-copy { position: relative; margin-left: auto; opacity: 0; transition: opacity 160ms ease; }
.palette-copy summary { display: flex; align-items: center; gap: 5px; padding: 3px 0 3px 8px; color: #c3c3c3; }
.palette-copy summary:hover { color: white; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.palette-copy .export-menu { top: auto; bottom: calc(100% + 5px); }
.palette:is(:hover, :focus-within) .palette-copy, .palette-copy[open] { opacity: 1; }
@media (hover: none) { .palette-copy { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .palette-copy { transition: none; } }

/* Keep the mobile header, space selection and palette in distinct bands. */
@media (max-width: 620px) {
  html:not([data-guided]) .top {
    display: flex;
    min-height: 60px;
    height: 60px;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 0 16px;
  }
  html:not([data-guided]) .brand { font-size: clamp(14px, 4.6vw, 18px); gap: 8px; letter-spacing: -.7px; white-space: nowrap; }
  html:not([data-guided]) .mark { width: 28px; height: 28px; }
  html:not([data-guided]) .palette-actions { margin-left: auto; }
  html:not([data-guided]) .palette-controls button {
    min-width: 44px;
    min-height: 44px;
    margin-block: -9px;
  }
  html:not([data-guided]) #palette-shift { top: -10px; height: 44px; }
  .palette-actions .share-toggle { min-width: 44px; justify-content: center; }
  html:not([data-guided]) .palette-actions .share-toggle { min-height: 44px; }
  html:is(:not([data-guided]), [data-story-exit]) .stage-foot { top: 75px; font-size: 10px; gap: 18px; }
  html:is(:not([data-guided]), [data-story-exit]) .linked { top: 101px; }
  html:not([data-guided]) #notifications { --notice-offset: 161px; }
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-width: 1024px) and (max-height: 540px) {
  #endpoint-editor { display: none !important; }
}

.about-menu { position: relative; flex: none; margin-left: 8px; }
.about-menu summary {
  display: grid; place-items: center; width: 36px; height: 36px;
  list-style: none; cursor: pointer; color: #d2d2d2; border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}
.about-menu summary::-webkit-details-marker { display: none; }
.about-menu summary:hover, .about-menu[open] summary { background: #ffffff0c; color: white; }
.about-menu summary:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.about-card {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 10;
  width: min(390px, calc(100vw - 32px)); max-height: calc(100dvh - 88px); overflow-y: auto; overscroll-behavior: contain; padding: 20px;
  border: 1px solid #ffffff25; border-radius: 10px; background: #292929;
  box-shadow: 0 8px 28px #0006; color: #c6c6c6;
  font: 13px/1.55 var(--body-font);
}
html:not([data-guided]) .top:has(.about-menu + .palette-actions) .about-menu { margin-left: auto; }
html:not([data-guided]) .about-menu + .palette-actions { margin-left: 0; }
html:not([data-guided]) .about-menu:has(+ .palette-actions) .about-card { right: -48px; }
.about-card h2 { margin: 0; color: #f1efed; font: 400 22px/1.2 var(--heading-font); }
.about-card p { margin: 10px 0 0; }
.about-credit { margin-top: 16px; padding-top: 12px; border-top: 1px solid #ffffff20; }
.about-card a { color: #f1f1f1; text-underline-offset: 3px; }
html[data-guided]:has(.about-menu[open]) .essay-interaction-layer { z-index: 8; }
html[data-guided]:has(.about-menu[open]) .top { z-index: 9; }
html[data-guided]:not([data-welcome]) .about-menu { opacity: 0; visibility: hidden; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .about-menu { transition: opacity 180ms ease, visibility 0s linear 180ms; }
  .about-menu[open] .about-card { animation: about-arrive 180ms ease-out; }
  @keyframes about-arrive { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
}
html[data-guided] .about-menu { margin-left: auto; }
@media (max-width: 620px) {
  .about-menu { margin-left: 0; }
  .about-menu summary { width: 44px; height: 44px; }
}

#story-silhouette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  display: none;
}
html[data-guided] #story-silhouette { display: block; }
html[data-guided] #plot { z-index: 2; }


html[data-welcome] .top { z-index: 9; }
@media (prefers-reduced-motion: no-preference) {
  .about-menu[data-closing] .about-card {
    animation: about-leave 160ms ease-in both;
    pointer-events: none;
  }
  @keyframes about-leave {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-5px); }
  }
}

/* In landscape keep the cube on the same side as the last demonstration. */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 540px) and (max-width: 1024px) {
  html:not([data-guided]) .top { height: 48px; min-height: 48px; padding-block: 0; }
  html:not([data-guided]) #plot { left: 47%; top: 48px; width: 52%; height: calc(100% - 48px); }
  html:is(:not([data-guided]), [data-story-exit]) .linked { left: 24%; top: max(52px, calc(50% - 118px)); }
  html:not([data-guided]) .palette { left: 24%; width: 43%; bottom: max(2px, calc(50% - 145px)); }
  html:is(:not([data-guided]), [data-story-exit]) .stage-foot { display: none; }
  html:not([data-guided]) .swatch .value { font-size: 10px; }
}

.share-format-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid #ffffff25;
  border-radius: 8px;
  background: #1c1c1c;
}
.share-format-options span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 4px 8px;
  border-radius: 5px;
  color: #c2bfbd;
  font: 600 14px/1.3 var(--body-font);
  cursor: pointer;
}
.share-format-options label:hover span { color: #fff; }
.share-format-options input:checked + span { background: #ffffff1a; color: #f1eeea; }
.share-format-options input:focus-visible + span { outline: 2px solid #f1eeea; }
.share-link-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #ffffff36;
  border-radius: 8px;
  background: #1c1c1c;
  color: inherit;
  font: 14px/1.3 var(--body-font);
}
