:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6c6a66;
  --line: #d8d5ce;
  --paper: #fbfaf7;
  --accent: #171717;
  --preview: #f2f1ed;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
}

button, input { font: inherit; }
button { color: inherit; }

.site-header,
.app-shell,
footer {
  width: min(1440px, calc(100% - 64px));
  margin-inline: auto;
}

.site-header {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 3vw, 42px); line-height: 1; letter-spacing: -.035em; }

.local-badge {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.local-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1f9b5f;
  box-shadow: 0 0 0 4px #1f9b5f1a;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, .75fr);
  gap: 28px;
  padding-block: 28px 36px;
}

.preview-column,
.controls-column { min-width: 0; }

.preview-stage {
  height: min(70vh, 790px);
  min-height: 540px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--preview);
  transition: background-color 180ms ease;
}

#logo {
  display: block;
  width: min(74%, 560px);
  height: min(86%, 690px);
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .06));
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 15px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.preview-toolbar p { margin: 0 0 3px; }
.toolbar-label { display: block; margin-bottom: 8px; font-weight: 650; color: var(--ink); }
.background-controls { display: flex; align-items: center; gap: 8px; }

.background-preset {
  width: 34px;
  height: 34px;
  border: 1px solid #c7c4bd;
  border-radius: 50%;
  padding: 0;
  background: #f2f1ed;
  cursor: pointer;
}

.background-color-picker {
  position: relative;
  min-width: 150px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 6px;
  border: 1px solid #c7c4bd;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}
.background-color-picker:hover { background: #f5f3ee; }
.background-color-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.background-swatch { width: 29px; height: 29px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.16); border-radius: 8px; background: #f2f1ed; }
.background-picker-copy { display: block; line-height: 1.05; }
.background-picker-copy strong { display: block; margin-bottom: 4px; font-size: 11px; }
.background-picker-copy code { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.background-preset.white { background: #fff; }
.background-preset.dark { background: #171717; }
.background-preset.active { outline: 2px solid var(--ink); outline-offset: 2px; }

.controls-column { display: flex; flex-direction: column; gap: 14px; }

.color-card,
.export-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 21px;
}

.card-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; }
.card-heading h2 { margin-bottom: 2px; font-size: 17px; letter-spacing: -.01em; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.number-badge {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.library-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 17px;
  padding: 4px;
  border: 0;
  border-radius: 11px;
  background: #efede8;
}

.library-switch label { position: relative; }
.library-switch input { position: absolute; opacity: 0; pointer-events: none; }
.library-switch span { display: block; padding: 8px 10px; border-radius: 8px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.library-switch input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.library-switch input:focus-visible + span { outline: 2px solid #2574db; }

.search-label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.color-search {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #c9c6bf;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.color-search:focus { border-color: #68645e; box-shadow: 0 0 0 3px rgba(23,23,23,.07); }

.suggestions {
  display: none;
  position: absolute;
  z-index: 5;
  left: 21px;
  right: 21px;
  max-height: 244px;
  overflow-y: auto;
  margin-top: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(0,0,0,.14);
}
.suggestions.open { display: block; }
.suggestion {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.suggestion:hover,
.suggestion:focus-visible { background: #f1efea; outline: none; }
.suggestion-swatch { width: 22px; height: 22px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.12); border-radius: 5px; }
.suggestion-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.selected-color { display: flex; align-items: center; gap: 11px; margin-top: 15px; }
.selected-swatch { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.13); border-radius: 10px; }
.selected-name { display: block; margin-bottom: 3px; font-size: 14px; }
.selected-meta { display: block; color: var(--muted); font-size: 11px; }

.open-color-picker {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f6f2;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.open-color-picker:hover { background: #efede8; }
.picker-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(#f04 0 16%, #ffb000 0 33%, #cbd500 0 49%, #00a97a 0 66%, #1688dc 0 82%, #8d45ce 0);
}

.color-picker-dialog {
  width: min(980px, calc(100% - 32px));
  height: min(820px, calc(100% - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #c9c6bf;
  border-radius: 20px;
  background: #fbfaf7;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
}
.color-picker-dialog::backdrop { background: rgba(20,19,18,.56); backdrop-filter: blur(3px); }
.picker-shell { height: 100%; display: grid; grid-template-rows: auto auto 1fr; min-height: 0; }
.picker-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); }
.picker-header h2 { margin: 0; font-size: 23px; }
.picker-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 25px; line-height: 1; cursor: pointer; }
.picker-close:hover { background: #efede8; }
.picker-tools { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.picker-search-label { flex: 1; }
#picker-search { width: 100%; height: 44px; padding: 0 14px; border: 1px solid #c9c6bf; border-radius: 10px; background: #fff; outline: none; }
#picker-search:focus { border-color: #68645e; box-shadow: 0 0 0 3px rgba(23,23,23,.07); }
#picker-count { margin: 0; min-width: 125px; color: var(--muted); font-size: 11px; text-align: right; }
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px 28px;
}
.picker-swatch {
  min-width: 0;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.picker-swatch:hover,
.picker-swatch:focus-visible { border-color: #8e8a83; background: #fff; outline: none; }
.picker-swatch[aria-selected="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: #fff; }
.picker-color { display: block; height: 48px; border: 1px solid rgba(0,0,0,.12); border-radius: 6px; }
.picker-name { display: block; margin-top: 5px; overflow: hidden; font-size: 9px; font-weight: 650; line-height: 1.15; text-align: left; text-overflow: ellipsis; white-space: nowrap; }

.secondary-button,
.primary-button {
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
}
.secondary-button { width: 100%; padding: 12px 16px; border: 1px solid var(--line); background: transparent; }
.secondary-button:hover { background: #efede8; }
.secondary-button span { margin-right: 6px; font-size: 18px; }

.export-panel { margin-top: 4px; }
.export-panel h2 { margin-bottom: 5px; font-size: 17px; }
.export-panel p { margin-bottom: 17px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.primary-button { width: 100%; padding: 14px 18px; border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.primary-button:hover { background: #343434; }
.export-status { min-height: 17px; margin: 10px 0 0 !important; color: #23734a !important; }

footer { padding: 17px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
footer p { margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .site-header, .app-shell, footer { width: min(100% - 32px, 720px); }
  .site-header { min-height: 100px; }
  .app-shell { grid-template-columns: 1fr; }
  .preview-stage { height: 58vh; min-height: 440px; }
  #logo { width: min(70%, 430px); height: 86%; }
}

@media (max-width: 540px) {
  .site-header { align-items: flex-start; padding-block: 24px; }
  .local-badge { font-size: 0; padding-top: 6px; }
  .preview-stage { min-height: 390px; height: 52vh; }
  #logo { width: 78%; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .preview-toolbar p { max-width: 260px; }
  .color-card, .export-panel { padding: 18px; }
  .suggestions { left: 18px; right: 18px; }
  .color-picker-dialog { width: calc(100% - 16px); height: calc(100% - 16px); border-radius: 15px; }
  .picker-header { padding: 17px 16px 13px; }
  .picker-header h2 { font-size: 19px; }
  .picker-tools { align-items: stretch; flex-direction: column; gap: 7px; padding: 11px 16px; }
  #picker-count { min-width: 0; text-align: left; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; padding: 12px 16px 20px; }
  .picker-color { height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
