:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #f2f1ed;
  color-scheme: dark;
  background: #17191a;
  --surface: #222526;
  --raised: #272a2c;
  --inset: #191b1c;
  --line: #3c4142;
  --muted: #bec4c2;
  --teal: #91e3ce;
  --amber: #ffd18b;
  --error: #ffb5ab;
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.header { border-bottom: 1px solid var(--line); background: var(--inset); }
.header-inner, main { max-width: 1336px; margin: auto; padding-inline: clamp(16px, 4vw, 56px); }
.header-inner { min-height: 71px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 750; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; display: flex; gap: 3px; align-items: end; justify-content: center; padding-bottom: 8px; border: 1px solid #455452; border-radius: 9px; background: #273433; }
.brand-mark i { width: 5px; height: 8px; border-radius: 2px; background: #b7a4f1; }
.brand-mark i:nth-child(2) { height: 12px; background: var(--teal); }
.brand-mark i:nth-child(3) { height: 17px; background: var(--amber); }
.button { min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--line); background: var(--inset); border-radius: 9px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.button:not(:disabled):hover, .preset:hover { border-color: var(--teal); }
.button-primary { background: var(--teal); color: #142825; border-color: transparent; padding-inline: 15px; }
.button-primary:not(:disabled):hover { background: #b3f5e3; }
.download-symbol, .upload-symbol { display: inline-block; width: 14px; height: 15px; position: relative; border-bottom: 1.5px solid; flex: none; }
.download-symbol::before, .upload-symbol::before { content: ""; position: absolute; width: 1.5px; height: 9px; top: 0; left: 6px; background: currentColor; }
.download-symbol::after, .upload-symbol::after { content: ""; position: absolute; width: 6px; height: 6px; top: 3px; left: 3.5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.upload-symbol::before { top: 1px; }
.upload-symbol::after { top: 1px; transform: rotate(225deg); }

main { padding-block: 40px 48px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.intro h1 { font-size: clamp(43px, 6vw, 82px); line-height: .98; letter-spacing: -.068em; font-weight: 780; }
.intro em { color: var(--teal); font-style: normal; }
.intro p { max-width: 335px; color: var(--muted); font-size: 15px; line-height: 1.65; padding-bottom: 3px; }
.workbench { display: grid; grid-template-columns: 282px minmax(0, 1fr); gap: 26px; align-items: start; }
.panel, .icon-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 18px #0002; }
.panel { padding: 16px; }
.panel-heading, .gallery-heading, .card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-heading { margin-bottom: 9px; }
h2 { font-size: 21px; letter-spacing: -.036em; line-height: 1.2; }
.reset { min-height: 44px; padding-inline: 7px; background: transparent; border: 0; border-radius: 7px; color: var(--amber); font-size: 13px; font-weight: 700; }
.reset:hover { background: #332d25; }
.color-row { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 8px; }
.swatch, .color-meta { min-height: 46px; background: var(--inset); border: 1px solid var(--line); border-radius: 9px; }
.swatch { width: 46px; height: 46px; padding: 3px; cursor: pointer; }
.swatch::-webkit-color-swatch-wrapper { padding: 0; }
.swatch::-webkit-color-swatch { border: 0; border-radius: 5px; }
.swatch::-moz-color-swatch { border: 0; border-radius: 5px; }
.color-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 10px; }
.color-meta label { font-size: 13px; }
.hex { width: 8ch; min-height: 44px; padding: 0; background: transparent; color: var(--muted); border: 0; text-align: end; font: 13px ui-monospace, monospace; text-transform: uppercase; }
.hex[aria-invalid="true"], .field-error { color: var(--error); }
.field-error { grid-column: 2; font-size: 12px; }
.presets { border: 0; padding: 0; margin: 20px 0 16px; min-width: 0; }
.presets legend { color: var(--muted); font-size: 13px; padding: 0 0 8px; }
.palette-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.presets.image-palettes { margin-block: 14px 0; }
.preset { background: var(--inset); border: 1px solid var(--line); border-radius: 8px; min-height: 53px; font-size: 12px; padding: 4px 2px; }
.preset[aria-pressed="true"] { border-color: #64988e; background: #263534; }
.preset-pips { display: flex; justify-content: center; gap: 3px; margin: 0 0 5px; }
.preset-pips i { width: 10px; height: 10px; border-radius: 50%; }
.logo { border-top: 1px solid var(--line); padding-top: 15px; }
.upload { width: 100%; background: var(--raised); color: var(--amber); cursor: pointer; }
.upload:hover { border-color: var(--amber); }
.logo:focus-within .upload { outline: 2px solid var(--teal); outline-offset: 3px; }
.logo p, .status, .gallery-meta, .category { color: var(--muted); font-size: 12px; line-height: 1.5; }
.logo p { margin-top: 8px; }
.status:not(:empty) { margin-top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

.gallery-heading { margin-bottom: 14px; flex-wrap: wrap; }
.gallery-meta { margin-top: 4px; }
.gallery-filters { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 14px; }
.gallery-filters label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.gallery-filters :is(input, select) { width: 100%; min-width: 0; min-height: 44px; padding-inline: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--inset); color: inherit; font-size: 14px; }
.gallery-filters input::placeholder { color: var(--muted); }
.gallery-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.gallery-pages[hidden], .button[hidden] { display: none; }
#export-status:not(:empty), #reference-note:not([hidden]) { margin: 0 0 10px; }
.preview-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented { background: var(--inset); border: 1px solid var(--line); border-radius: 10px; display: flex; padding: 2px; gap: 2px; }
.segmented button { min-height: 44px; min-width: 48px; padding-inline: 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; }
.segmented button:hover { color: var(--teal); }
.segmented button[aria-pressed="true"] { color: var(--teal); background: #2a3a37; border-color: #486661; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(238px, 100%), 1fr)); gap: 13px; }
.icon-card { min-width: 0; padding: 8px; }
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border-radius: 10px; background: #424849; }
.sample { min-width: 0; display: grid; place-items: center; padding: 10px 4px 9px; gap: 3px; background: #303435; color: #d3d7d5; font-size: 11px; }
.cards[data-background="light"] .comparison { background: #c8cdca; }
.cards[data-background="light"] .sample { background: #eef1ee; color: #424947; }
.art { display: grid; place-items: center; width: 100%; height: 100px; }
.sample img, .sample canvas { display: block; width: 100%; max-width: 100px; height: 100%; max-height: 100px; object-fit: contain; }
.cards[data-size="small"] .sample :is(img, canvas) { width: 32px; height: 32px; }
.card-footer { padding: 8px 3px 1px 5px; }
.card-footer h3 { font-size: 15px; line-height: 1.2; }
.category { margin-top: 3px; }
.icon-download { color: var(--teal); padding-inline: 9px; }

@media (max-width: 760px) {
  .header-inner { min-height: 64px; }
  main { padding-block: 22px 35px; }
  .intro { align-items: start; flex-direction: column; gap: 8px; margin-bottom: 17px; }
  .workbench { grid-template-columns: 1fr; gap: 18px; }
  .panel { padding: 12px; }
  .panel-heading { margin-bottom: 6px; }
  #colors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .color-row { display: flex; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
  .swatch { width: 100%; }
  .color-meta { flex-direction: column; padding: 5px 2px 0; }
  .hex { text-align: center; }
  .field-error { padding-inline: 3px; }
  .presets { margin-block: 13px 11px; }
  .preset { min-height: 47px; }
  .logo { padding-top: 11px; }
  .gallery-heading { gap: 7px; }
  .gallery-meta { font-size: 11px; }
  .gallery-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-search { grid-column: 1 / -1; }
  .preview-controls { gap: 6px; }
  .segmented button { min-width: 44px; padding-inline: 4px; }
}

@media (max-width: 380px) {
  .brand { font-size: 15px; gap: 7px; }
  .button-primary { padding-inline: 9px; }
}
