:root {
  color-scheme: light;
  --ink: #151515;
  --paper: #f2f0e9;
  --line: #c9c6bc;
  --accent: #5d5fef;
  font-family: "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 49.85%, rgba(20,20,20,.035) 50%, transparent 50.15%),
    var(--paper);
}
button, input { font: inherit; }
button { color: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 64px; }
.masthead { display: flex; justify-content: space-between; align-items: end; border-top: 8px solid var(--ink); padding: 22px 0 28px; }
.eyebrow { margin: 0 0 8px; font-size: 11px; letter-spacing: .2em; font-weight: 700; }
h1 { margin: 0; font-size: clamp(42px, 6vw, 76px); line-height: .9; letter-spacing: -.07em; }
h1 span { color: var(--accent); }
.intro { margin: 0; max-width: 410px; font-size: 15px; line-height: 1.75; text-align: right; }
.workbench { display: grid; grid-template-columns: 1fr 1.04fr; border: 1px solid var(--ink); background: #faf9f5; }
.controls { padding: 34px; border-right: 1px solid var(--ink); }
.section-label { font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.section-label span { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 8px; color: #fff; background: var(--ink); border-radius: 50%; font-size: 10px; letter-spacing: 0; }
.field-grid { display: grid; gap: 12px; margin-top: 25px; }
.color-field { display: grid; grid-template-columns: 122px 1fr; align-items: center; border-bottom: 1px solid var(--line); }
.color-field > span { font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.color-field small { display: block; margin-top: 3px; color: #77746d; font-size: 9px; font-weight: 500; letter-spacing: .04em; }
.color-field input { width: 100%; padding: 13px 4px; border: 0; outline: 0; background: transparent; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; }
.color-field:focus-within { border-bottom-color: var(--accent); box-shadow: 0 2px 0 var(--accent); }
.color-field.invalid { background: #fff1ed; border-color: #bd361f; }
.hint, .error { min-height: 18px; margin: 10px 0 0 122px; color: #77746d; font-size: 10px; line-height: 1.5; }
.error { display: none; color: #a12a18; font-weight: 700; }
.alpha-block { margin-top: 31px; padding-top: 25px; border-top: 1px solid var(--line); }
.alpha-head { display: flex; justify-content: space-between; align-items: center; }
.alpha-number { display: flex; align-items: center; border-bottom: 1px solid var(--ink); }
.alpha-number input { width: 42px; border: 0; outline: 0; background: transparent; text-align: right; font-family: ui-monospace, monospace; }
.alpha-range { width: 100%; height: 22px; margin: 18px 0 5px; appearance: none; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0/12px 12px; border: 1px solid #b9b6ad; }
.alpha-range::-webkit-slider-thumb { appearance: none; width: 18px; height: 32px; border: 3px solid #fff; outline: 1px solid #111; background: var(--accent); cursor: grab; }
.alpha-range::-moz-range-thumb { width: 14px; height: 28px; border: 3px solid #fff; border-radius: 0; outline: 1px solid #111; background: var(--accent); cursor: grab; }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.native-picker, .secondary { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--ink); background: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.native-picker input { position: absolute; opacity: 0; pointer-events: none; }
.picker-icon { width: 17px; height: 17px; border: 1px solid var(--ink); background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
.secondary { background: var(--ink); color: #fff; }
.secondary:disabled { opacity: .45; cursor: not-allowed; }
.preview-column { min-width: 0; }
.preview { position: relative; min-height: 386px; padding: 27px 30px; overflow: hidden; color: #fff; background-color: var(--accent); background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px); background-size: 28px 28px; }
.preview-top { position: relative; z-index: 1; display: flex; justify-content: space-between; font: 700 10px/1 ui-monospace, monospace; letter-spacing: .14em; }
.preview-center { position: absolute; z-index: 2; left: 30px; bottom: 30px; }
.preview-center p { margin: 0 0 12px; font: 700 14px/1 ui-monospace, monospace; }
.copy-button { padding: 10px 16px; border: 1px solid currentColor; background: transparent; color: inherit; font-size: 10px; letter-spacing: .1em; font-weight: 800; cursor: pointer; }
.preview-mark { position: absolute; right: -4px; bottom: -54px; color: rgba(255,255,255,.17); font: 900 260px/1 serif; }
.contrast-panel { padding: 26px 30px 24px; border-top: 1px solid var(--ink); }
.contrast-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 17px; }
.contrast-card { min-height: 94px; padding: 15px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-content: center; border: 1px solid rgba(0,0,0,.2); background: var(--accent); }
.contrast-card strong { grid-column: 1 / -1; font-size: 22px; }
.contrast-card span { font: 700 11px ui-monospace, monospace; }
.contrast-card em { justify-self: end; padding: 2px 5px; background: rgba(255,255,255,.65); color: #111; font-size: 9px; font-style: normal; font-weight: 800; }
.contrast-note { margin: 12px 0 0; color: #6f6c65; font-size: 10px; line-height: 1.5; }
.neighbors { margin-top: 38px; }
.neighbor-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.neighbor-head h2 { margin: 14px 0 0; font: 500 clamp(27px, 4vw, 44px)/1.1 serif; letter-spacing: -.03em; }
.neighbor-head p { max-width: 410px; margin: 0; color: #65625c; font-size: 12px; line-height: 1.7; }
.palette { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 25px; border: 1px solid var(--ink); }
.swatch { min-width: 0; padding: 0; border: 0; border-right: 1px solid var(--ink); background: transparent; text-align: left; cursor: pointer; }
.swatch:last-child { border-right: 0; }
.swatch-color { display: block; height: 108px; transition: transform .18s; transform-origin: bottom; }
.swatch:hover .swatch-color, .swatch:focus-visible .swatch-color { transform: scaleY(1.07); }
.swatch-meta { display: block; padding: 11px 9px; background: #faf9f5; font: 700 10px/1 ui-monospace, monospace; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 9; padding: 10px 17px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: #111; color: #fff; font-size: 12px; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 800px) {
  .shell { width: min(100% - 24px, 620px); padding-top: 20px; }
  .masthead { align-items: start; }
  .intro { max-width: 210px; font-size: 12px; }
  .workbench { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--ink); }
  .palette { grid-template-columns: repeat(4, 1fr); }
  .swatch { border-bottom: 1px solid var(--ink); }
  .swatch:nth-child(4) { border-right: 0; }
}
@media (max-width: 520px) {
  .shell { width: calc(100% - 20px); }
  .masthead { display: block; }
  .intro { margin-top: 16px; text-align: left; }
  .controls { padding: 24px 18px; }
  .color-field { grid-template-columns: 82px 1fr; }
  .hint, .error { margin-left: 0; }
  .quick-row { grid-template-columns: 1fr; }
  .preview { min-height: 315px; padding: 22px; }
  .preview-center { left: 22px; bottom: 24px; }
  .contrast-panel { padding: 22px 18px; }
  .contrast-grid { grid-template-columns: 1fr; }
  .neighbor-head { display: block; }
  .neighbor-head p { margin-top: 16px; }
  .palette { grid-template-columns: repeat(2, 1fr); }
  .swatch:nth-child(2n) { border-right: 0; }
  .swatch:nth-child(4) { border-right: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
