:root {
  --ink: #1a1a2e;
  --muted: #5b5b72;
  --bg: #f7f7fb;
  --card: #ffffff;
  --line: #e6e6f0;
  --accent: #4f46e5;
  --pass: #15803d;
  --passbg: #dcfce7;
  --fail: #b91c1c;
  --failbg: #fee2e2;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.6;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.site-header { background: var(--ink); color: #fff; padding: 28px 0 22px; }
.brand { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.tagline { margin: 4px 0 0; color: #c7c7d9; font-size: 15px; }
main .tool, main .pairs, main .guide, main .faq {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px; margin: 22px 0;
}
.colors { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.color-card { flex: 1 1 220px; }
.color-card label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.picker-row { display: flex; gap: 10px; }
.picker-row input[type="color"] {
  width: 52px; height: 46px; border: 1px solid var(--line); border-radius: 8px;
  padding: 3px; background: #fff; cursor: pointer;
}
.picker-row input[type="text"] {
  flex: 1; font-size: 17px; font-family: ui-monospace, monospace; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 8px; padding: 0 12px;
}
.mid-actions { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.mid-actions button {
  font-size: 20px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  width: 46px; height: 46px; cursor: pointer;
}
.mid-actions button:hover { border-color: var(--accent); }
.result-grid { display: flex; gap: 18px; margin-top: 20px; flex-wrap: wrap; }
.ratio-box {
  min-width: 190px; text-align: center; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 12px; background: var(--bg);
}
.ratio-num { font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.ratio-label { color: var(--muted); font-size: 13px; }
.grades { flex: 1 1 300px; display: grid; gap: 8px; }
.grade {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; font-size: 14px;
}
.g-name { font-weight: 700; }
.g-need { color: var(--muted); margin-left: auto; font-family: ui-monospace, monospace; font-size: 13px; }
.g-badge {
  font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 20px;
  background: #eee; color: var(--muted); min-width: 58px; text-align: center;
}
.g-badge.pass { background: var(--passbg); color: var(--pass); }
.g-badge.fail { background: var(--failbg); color: var(--fail); }
.preview {
  margin-top: 20px; border: 1px solid var(--line); border-radius: 12px; padding: 26px;
  transition: background 0.15s, color 0.15s;
}
.preview h2 { margin: 0 0 10px; font-size: 26px; }
.preview p { margin: 0 0 16px; }
.preview button {
  border: none; border-radius: 8px; padding: 10px 22px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.actions button {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.actions button:hover { filter: brightness(0.96); }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.pairs h2, .guide h2, .faq h2 { margin-top: 0; font-size: 21px; letter-spacing: -0.3px; }
.pair-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pair {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: #fff;
}
.pair:hover { border-color: var(--accent); }
.pair .swatches { display: flex; height: 56px; }
.pair .swatches div { flex: 1; }
.pair .meta { padding: 8px 10px; font-size: 12px; font-family: ui-monospace, monospace; color: var(--muted); }
.pair .meta b { color: var(--pass); }
.guide table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; }
.guide th, .guide td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.guide th { background: var(--bg); }
.formula { font-family: ui-monospace, monospace; background: var(--bg); padding: 10px 14px; border-radius: 8px; display: inline-block; }
.note { color: var(--muted); font-size: 14px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 700; cursor: pointer; }
.site-footer { padding: 26px 0 40px; color: var(--muted); font-size: 13px; text-align: center; }
@media (max-width: 560px) {
  .mid-actions { flex-direction: row; }
  .ratio-num { font-size: 36px; }
}
