:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --text: #171717;
  --muted: #737373;
  --line: #deded9;
  --accent: #171717;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.page-shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; }
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 0 24px;
}
.brand { font-size: 24px; line-height: 1; font-weight: 800; letter-spacing: .06em; text-decoration: none; }
.site-header p { margin: 8px 0 0; color: var(--muted); }
.language-switch { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.language-switch button { border: 0; border-radius: 7px; padding: 6px 10px; background: transparent; color: var(--muted); cursor: pointer; }
.language-switch button.active { background: var(--text); color: white; }
.matcher { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.color-panel, .results-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.color-panel { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 18px; padding: 20px; }
.color-panel h1, .results-heading h2 { margin: 0; font-size: 18px; font-weight: 650; }
.color-panel h2 { margin: 0 0 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.color-preview { height: 120px; border: 1px solid var(--line); border-radius: 12px; background: #808080; position: relative; }
.color-preview span { position: absolute; right: 10px; bottom: 9px; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.64); color: #fff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.color-input-row { display: flex; gap: 10px; }
input[type="color"] { width: 50px; height: 42px; padding: 0; border: 0; border-radius: 9px; background: none; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 9px; }
#hexInput { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.sliders { display: grid; gap: 9px; }
.sliders label { display: grid; grid-template-columns: 18px minmax(0,1fr) 34px; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.sliders input { accent-color: var(--text); }
.sliders output { text-align: right; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.quick-colors { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.quick-color { aspect-ratio: 1; min-width: 0; border: 1px solid rgba(0,0,0,.14); border-radius: 7px; cursor: pointer; transition: transform .12s ease; }
.quick-color:hover, .quick-color:focus-visible { transform: scale(1.12); outline: 2px solid var(--text); outline-offset: 2px; }
.results-panel { min-height: 560px; padding: 20px; }
.results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.results-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.filter-chip { border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; background: var(--surface); color: var(--muted); cursor: pointer; }
.filter-chip.active { border-color: var(--text); background: var(--text); color: white; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.paint-card { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: white; transition: transform .12s ease, box-shadow .12s ease; }
.paint-card:hover { transform: translateY(-2px); box-shadow: 0 7px 22px rgba(0,0,0,.07); }
.paint-swatch { height: 88px; position: relative; cursor: pointer; }
.match-badge { position: absolute; top: 7px; right: 7px; padding: 3px 7px; border-radius: 6px; background: rgba(0,0,0,.66); color: white; font-size: 11px; }
.copy-btn { position: absolute; top: 7px; left: 7px; opacity: 0; border: 0; border-radius: 6px; padding: 4px 7px; background: rgba(255,255,255,.92); color: var(--text); font-size: 11px; cursor: pointer; }
.paint-card:hover .copy-btn, .copy-btn:focus { opacity: 1; }
.paint-info { padding: 10px 11px 11px; }
.paint-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.paint-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.paint-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paint-code { flex-shrink: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.site-footer { display: flex; justify-content: space-between; gap: 32px; margin: 24px 0 100px; padding: 22px 2px; color: var(--muted); font-size: 12px; }
.site-footer > div { display: grid; gap: 3px; }
.site-footer strong { color: var(--text); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; gap: 8px 16px; }
.site-footer button { border: 0; padding: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; }
.toast { position: fixed; bottom: 26px; left: 50%; z-index: 30; transform: translate(-50%, 80px); opacity: 0; border-radius: 9px; padding: 10px 16px; background: var(--text); color: white; transition: .2s ease; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.cookie-banner { position: fixed; right: 18px; bottom: 18px; left: 18px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 900px; margin: auto; padding: 17px 18px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 16px 50px rgba(0,0,0,.14); }
.cookie-banner h2 { margin: 0 0 4px; font-size: 15px; }
.cookie-banner p { margin: 0; color: var(--muted); font-size: 13px; }
.cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-actions button { border-radius: 9px; padding: 8px 13px; cursor: pointer; }
.cookie-actions .secondary { border: 1px solid var(--line); background: white; }
.cookie-actions .primary { border: 1px solid var(--accent); background: var(--accent); color: white; }
.error-box { padding: 18px; border-radius: 10px; background: #fff0f0; color: #8f2424; }
.legal-page { width:min(860px,calc(100% - 28px)); margin:0 auto; }
.legal-header { display:flex; justify-content:space-between; gap:20px; align-items:center; padding:28px 0 18px; }
.legal-header nav { display:flex; gap:8px; }
.legal-header nav a { border:1px solid var(--line); border-radius:8px; padding:5px 9px; text-decoration:none; background:white; }
.legal-content { margin-bottom:32px; border:1px solid var(--line); border-radius:14px; padding:clamp(20px,4vw,42px); background:white; }
.legal-content h1 { margin:0 0 8px; font-size:clamp(24px,4vw,36px); line-height:1.1; }
.legal-content h2 { margin:28px 0 8px; font-size:18px; }
.legal-content p,.legal-content li { color:#4e4e4e; }
.legal-content ul { padding-left:20px; }
.legal-meta { color:var(--muted); font-size:13px; }

@media (max-width: 800px) {
  .page-shell { width: min(100% - 24px, 680px); }
  .site-header { padding-top: 22px; }
  .brand { font-size: 20px; }
  .matcher { grid-template-columns: 1fr; }
  .color-panel { position: static; }
  .quick-colors { grid-template-columns: repeat(10, 1fr); }
  .copy-btn { opacity: 1; }
  .site-footer { flex-direction: column; }
  .site-footer nav { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .site-header p { font-size: 13px; }
  .results-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .paint-swatch { height: 76px; }
  .paint-meta { display: grid; }
  .quick-colors { grid-template-columns: repeat(8, 1fr); }
  .cookie-banner { align-items: stretch; flex-direction: column; }
  .cookie-actions { justify-content: flex-end; }
  .legal-header { align-items:flex-start; flex-direction:column; }
}
