:root {
  --paper: #f3f0e6;
  --surface: #fffdf7;
  --ink: #18201c;
  --muted: #68736d;
  --line: rgb(24 32 28 / 13%);
  --green: #0f9f73;
  --green-dark: #0b4133;
  --green-soft: #dff3ea;
  --orange: #ef9744;
  --orange-soft: #fff0dc;
  --demo-color: oklch(88% 0.16 125);
  --fallback-contrast: black;
  --shadow: 0 26px 72px rgb(40 54 47 / 13%);
  color-scheme: light;
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgb(15 159 115 / 18%), transparent 30rem),
    radial-gradient(circle at 92% 8%, rgb(239 151 68 / 18%), transparent 32rem),
    linear-gradient(135deg, #eef4ee 0%, var(--paper) 50%, #eee7d9 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

h1,
h2,
h3,
p,
pre {
  margin: 0;
}

.page {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.page > *,
.demo-shell,
.control-bar,
.compare-section,
.compare-grid > *,
.bottom-grid > *,
.code-panel {
  min-width: 0;
  max-width: 100%;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 2px 2px 0 var(--orange);
  content: "";
}

h1 {
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

h1 code {
  font-size: 0.88em;
  letter-spacing: -0.055em;
}

.lead {
  margin-top: 12px;
  color: var(--muted);
  font-size: clamp(16px, 1.65vw, 19px);
  font-weight: 800;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.support-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgb(15 159 115 / 24%);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 900;
}

.support-chip.is-unsupported {
  border-color: rgb(239 151 68 / 38%);
  color: #8b4d15;
  background: var(--orange-soft);
}

.demo-shell {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 253 247 / 82%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.contrast-probe {
  position: absolute;
  visibility: hidden;
  color: var(--fallback-contrast);
  pointer-events: none;
}

@supports (color: contrast-color(red)) {
  .contrast-probe {
    color: contrast-color(var(--demo-color));
  }
}

.control-bar {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(360px, 1.05fr) minmax(340px, 1fr);
  gap: 20px;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.control-heading,
.control-heading > div,
.preset-buttons,
.range-field > span,
.compare-head,
.color-chip,
.preview-meta,
.code-head {
  display: flex;
  align-items: center;
}

.control-heading {
  gap: 12px;
}

.control-heading > div {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.control-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.control-heading p,
.compare-head p,
.code-head > span,
.point-card > span {
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.control-heading h2,
.compare-head h2 {
  font-size: 19px;
  letter-spacing: -0.04em;
}

.preset-buttons {
  gap: 7px;
}

.preset-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: white;
  font-size: 11px;
  font-weight: 900;
}

.preset-buttons button[aria-pressed="true"] {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
}

.preset-buttons button span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--preset);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--preset) 18%, transparent);
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.range-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.range-field > span {
  justify-content: space-between;
  gap: 10px;
}

.range-field output {
  color: var(--green-dark);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.compare-section {
  padding: 22px;
  background:
    linear-gradient(rgb(24 32 28 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(24 32 28 / 4%) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
}

.compare-head,
.code-head {
  justify-content: space-between;
  gap: 14px;
}

.compare-head {
  margin-bottom: 16px;
}

.compare-head > div {
  min-width: 0;
}

.compare-head h2 {
  margin-top: 3px;
  font-size: 22px;
}

.color-chip {
  gap: 8px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / 78%);
}

.color-chip i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--demo-color);
}

.color-chip code {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.preview-card {
  position: relative;
  min-height: 360px;
  padding: 20px;
  border-radius: 20px;
  background: var(--demo-color);
  box-shadow: 0 20px 54px rgb(24 32 28 / 13%);
  overflow: hidden;
  transition: color 160ms ease, background 160ms ease;
}

.preview-card::after {
  position: absolute;
  right: -55px;
  bottom: -86px;
  width: 250px;
  height: 250px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.15;
  content: "";
}

.preview-card--fixed {
  color: white;
}

.preview-card--auto {
  color: var(--fallback-contrast);
}

@supports (color: contrast-color(red)) {
  .preview-card--auto {
    color: contrast-color(var(--demo-color));
  }
}

.preview-meta {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  gap: 12px;
}

.preview-meta > span,
.color-result {
  padding: 6px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.preview-meta code {
  font-size: 11px;
  font-weight: 800;
}

.preview-content {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  min-height: 250px;
  padding: 18px 20px;
}

.preview-kicker {
  margin-bottom: 11px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.preview-content h3 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.preview-content p {
  margin-top: 15px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.65;
}

.preview-content button {
  justify-self: start;
  min-height: 42px;
  margin-top: 18px;
  padding: 0 14px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: inherit;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.color-result {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 1;
}

.fallback-notice {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgb(239 151 68 / 34%);
  border-radius: 12px;
  color: #7b481c;
  background: var(--orange-soft);
  font-size: 13px;
  font-weight: 800;
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 16px;
  margin-top: 16px;
}

.code-panel {
  border-radius: 18px;
  color: #e9fff6;
  background: var(--green-dark);
  overflow: hidden;
}

.code-head {
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid rgb(255 255 255 / 12%);
}

.code-head > span {
  color: #8fe0bf;
}

.code-head button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 9px;
  color: white;
  background: rgb(255 255 255 / 10%);
  font-size: 10px;
  font-weight: 900;
}

.code-panel pre {
  padding: 14px 16px;
  overflow-x: auto;
}

.code-panel code {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.copy-status {
  padding: 0 16px;
  color: #8fe0bf;
  font-size: 11px;
  font-weight: 800;
}

.copy-status:not(:empty) {
  min-height: 30px;
  padding-bottom: 10px;
}

.point-card {
  display: grid;
  align-content: center;
  padding: 18px;
  border: 1px solid rgb(239 151 68 / 28%);
  border-radius: 18px;
  background: var(--orange-soft);
}

.point-card > span {
  margin-bottom: 7px;
  color: #a85d1e;
}

.point-card p {
  color: #69401f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.65;
}

@media (max-width: 1040px) {
  .control-bar {
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  }

  .range-grid {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 620px);
    padding: 22px 0 30px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  h1 {
    font-size: clamp(31px, 10.5vw, 44px);
  }

  .demo-shell {
    border-radius: 20px;
  }

  .control-bar {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .range-grid {
    grid-column: auto;
  }

  .preset-buttons {
    flex-wrap: wrap;
  }

  .preset-buttons button {
    flex-basis: calc(50% - 4px);
  }

  .compare-section {
    padding: 14px;
  }

  .compare-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .compare-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .preview-card {
    min-height: 330px;
    border-radius: 16px;
  }

  .preview-content {
    min-height: 230px;
    padding-inline: 8px;
  }
}

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

  .color-chip {
    max-width: 100%;
  }

  .color-chip code {
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
