:root {
  --ink: var(--tools-text);
  --muted: var(--tools-muted);
  --paper: var(--tools-bg);
  --surface: var(--tools-surface);
  --surface-soft: var(--tools-surface-soft);
  --line: var(--tools-line);
  --green: var(--tools-green);
  --green-dark: var(--tools-green-strong);
  --green-soft: var(--tools-green-soft);
  --red: var(--tools-red);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--tools-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 13% 12%, color-mix(in srgb, var(--green) 8%, transparent), transparent 27rem),
    var(--paper);
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[v-cloak] { display: none; }
.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 750;
  letter-spacing: -.02em;
  text-decoration: none;
}

main {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
}
.hero {
  max-width: 850px;
  margin: 42px auto 54px;
  text-align: center;
}
.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--green-dark);
  font: 700 .72rem/1.3 var(--tools-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0 auto;
  font-family: var(--tools-serif);
  font-size: clamp(2.75rem, 6vw, 5rem);
  font-weight: 500;
  line-height: .96;
  letter-spacing: -.058em;
}
.hero-copy {
  max-width: 680px;
  margin: 26px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.7;
}
.hero-proof {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px 20px;
  margin: 22px 0 0;
  padding: 0;
  color: var(--green-dark);
  font-size: .77rem;
  font-weight: 750;
  list-style: none;
}
.hero-proof li { display: inline-flex; align-items: center; gap: 6px; }
.hero-proof svg { width: 14px; height: 14px; }

.workspace {
  margin-bottom: 54px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--tools-shadow);
}
.workspace-heading {
  padding: 22px clamp(25px, 5vw, 46px) 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: center;
  gap: 20px;
}
.workspace-heading > div { min-width: 0; }
.converter-illustration { width: 190px; height: auto; justify-self: end; }
.workspace h2, .workspace h3 {
  margin: 0;
  font-family: var(--tools-serif);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.04em;
}
.workspace h2 { font-size: clamp(2rem, 4vw, 2.85rem); }
.workspace h3 { font-size: clamp(1.45rem, 3vw, 2rem); }
.workspace-heading > p:not(.step-label), .section-heading > p:not(.step-label) {
  max-width: 720px;
  margin: 11px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.input-panel { padding: 0 clamp(25px, 5vw, 46px) clamp(28px, 5vw, 42px); }
.input-panel > label { margin-bottom: 9px; display: block; font-size: .78rem; font-weight: 800; }
.color-entry {
  min-height: 68px;
  padding: 8px 10px 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.color-entry input {
  min-width: 0;
  width: 100%;
  height: 46px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: 700 clamp(.82rem, 2vw, 1rem)/1.3 var(--tools-mono);
}
.detected-format {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--surface);
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}
.input-panel.invalid .color-entry { border-color: var(--red); }
.field-error, .input-hint { margin: 8px 0 0; font-size: .72rem; line-height: 1.5; }
.field-error { color: var(--red); }
.input-hint { color: var(--muted); }
.visual-selector {
  margin-top: 14px;
  padding: 11px 12px 11px 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.visual-selector label { min-width: 0; }
.visual-selector strong, .visual-selector small { display: block; }
.visual-selector strong { font-size: .75rem; }
.visual-selector small { margin-top: 4px; color: var(--muted); font-size: .67rem; line-height: 1.45; }
.color-well {
  width: 92px;
  height: 50px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.color-well::-webkit-color-swatch-wrapper { padding: 0; }
.color-well::-webkit-color-swatch,
.color-well::-moz-color-swatch { border: 0; border-radius: 6px; }
.example-row { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.example-row > span { margin-right: 3px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.example-row button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--surface);
  font: 750 .68rem/1 var(--tools-mono);
}

.gamut-summary {
  padding: 22px clamp(25px, 5vw, 46px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-block: 1px solid var(--line);
  background: var(--surface-soft);
}
.gamut-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.gamut-icon svg { width: 20px; height: 20px; }
.all-clear .gamut-icon { color: var(--tools-green-text); background: var(--green-soft); }
.has-warning .gamut-icon { color: #76550d; background: #f5eac9; }
.gamut-summary h3 { font: 800 .86rem/1.2 var(--tools-sans); letter-spacing: 0; }
.gamut-summary p { max-width: 600px; margin: 5px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.gamut-summary ul { margin: 0; padding: 0; display: flex; gap: 8px; list-style: none; }
.gamut-summary li {
  min-width: 112px;
  padding: 9px 11px;
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.gamut-summary li strong { font-size: .7rem; }
.gamut-summary li span { font-size: .64rem; font-weight: 750; }
.gamut-summary .in-gamut span { color: var(--green-dark); }
.gamut-summary .mapped span { color: #76550d; }

.conversion-grid { display: grid; grid-template-columns: minmax(270px, .84fr) minmax(0, 1.16fr); }
.preview-section, .output-section { min-width: 0; padding: clamp(28px, 5vw, 46px); }
.preview-section { border-right: 1px solid var(--line); }
.section-heading { margin-bottom: 20px; }
.section-heading > p:not(.step-label) { font-size: .78rem; }
.output-actions { margin: -6px 0 12px; display: flex; justify-content: flex-end; }
.copy-all-button {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--green);
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: .72rem;
  font-weight: 800;
}
.copy-all-button svg { width: 17px; height: 17px; }
.preview-grid { display: grid; gap: 14px; }
.preview-grid.comparison { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.preview-grid article { min-width: 0; }
.color-preview {
  min-height: 210px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%);
}
.preview-grid strong, .preview-grid small { display: block; }
.preview-grid strong { margin-top: 11px; font-size: .76rem; }
.preview-grid small { margin-top: 4px; color: var(--muted); font-size: .67rem; line-height: 1.4; }

.output-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.output-list li {
  min-height: 70px;
  padding: 11px 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line);
}
.output-label strong, .output-label small { display: block; }
.output-label strong { font-size: .76rem; }
.output-label small { margin-top: 3px; color: var(--muted); font-size: .62rem; line-height: 1.3; }
.output-list code {
  min-width: 0;
  color: var(--ink);
  font: 700 .75rem/1.45 var(--tools-mono);
  overflow-wrap: anywhere;
}
.output-list button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--surface);
}
.output-list button svg { width: 18px; height: 18px; }

.mapping-note {
  padding: 18px clamp(25px, 5vw, 46px);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, #f5eac9 64%, var(--surface));
}
.mapping-note > svg { width: 19px; height: 19px; flex: 0 0 auto; color: #76550d; }
.mapping-note p { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.55; }
.mapping-note strong { margin-right: .42em; color: var(--ink); }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 32px);
  padding: 11px 15px;
  border-radius: 10px;
  color: white;
  background: #171a18;
  box-shadow: var(--tools-shadow);
  transform: translateX(-50%);
  font-size: .8rem;
  font-weight: 750;
}
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 65%, white); outline-offset: 3px; }

@media (max-width: 820px) {
  .gamut-summary { grid-template-columns: auto minmax(0, 1fr); }
  .gamut-summary ul { grid-column: 1 / -1; }
  .conversion-grid { grid-template-columns: 1fr; }
  .preview-section { border-right: 0; border-bottom: 1px solid var(--line); }
  .color-preview { min-height: 180px; }
}

@media (max-width: 620px) {
  main { width: min(100% - 28px, 1040px); }
  .brand { gap: 8px; font-size: .82rem; }
  .hero { margin: 34px auto 38px; }
  .hero h1 { font-size: clamp(2.3rem, 12vw, 3.4rem); }
  .hero-copy { font-size: .94rem; line-height: 1.55; }
  .workspace { border-radius: 18px; }
  .workspace-heading { padding: 24px 18px 18px; }
  .workspace-heading { grid-template-columns: 1fr; }
  .converter-illustration { width: min(210px, 80%); justify-self: center; order: -1; }
  .input-panel { padding: 0 18px 22px; }
  .color-entry { min-height: 82px; padding: 9px 11px; align-items: stretch; flex-direction: column; gap: 4px; }
  .color-entry input { height: 42px; font-size: .78rem; }
  .detected-format { align-self: flex-start; padding: 5px 8px; }
  .example-row { gap: 6px; }
  .example-row > span { width: 100%; margin: 0 0 2px; }
  .example-row button { min-height: 38px; flex: 1 1 auto; }
  .visual-selector { grid-template-columns: minmax(0, 1fr) 78px; padding: 11px; }
  .color-well { width: 78px; height: 50px; }
  .gamut-summary { padding: 18px; gap: 12px; }
  .gamut-summary ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gamut-summary li { min-width: 0; }
  .preview-section, .output-section { padding: 26px 18px; }
  .preview-grid.comparison { grid-template-columns: 1fr; }
  .color-preview { min-height: 150px; }
  .output-list li { grid-template-columns: 72px minmax(0, 1fr) 42px; gap: 8px; }
  .output-list code { font-size: .68rem; }
  .copy-all-button { width: 100%; }
  .mapping-note { padding: 17px 18px; }
}

@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(circle at 13% 12%, color-mix(in srgb, var(--green) 10%, transparent), transparent 27rem),
      var(--paper);
  }
  .has-warning .gamut-icon { color: #e9c66e; background: color-mix(in srgb, #76550d 38%, var(--surface)); }
  .gamut-summary .mapped span, .mapping-note > svg { color: #e9c66e; }
  .mapping-note { background: color-mix(in srgb, #76550d 20%, var(--surface)); }
  .toast { color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
