* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6f9; --card: #fff; --primary: #4a90e2; --primary-soft: #e8f1fc;
  --text: #2c3e50; --text-sub: #7b8a99; --text-muted: #aab6c2;
  --border: #eef1f5; --shadow: 0 2px 12px rgba(0,0,0,.06); --radius: 16px;
  --red: #e74c3c; --green: #27ae60;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; padding: 24px;
}
.app { max-width: 1440px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.header h1 { font-size: 22px; font-weight: 600; }
.back { font-size: 13px; color: var(--text-sub); text-decoration: none; padding: 6px 12px; background: var(--bg); border-radius: 8px; }
.back:hover { background: var(--primary-soft); color: var(--primary); }

/* 主布局 */
.layout { display: grid; grid-template-columns: 320px 1fr 300px; gap: 20px; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

.section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.section-title .sub { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 8px; }

/* 颜色选择区 */
.picker-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.picker-wrap input[type="color"] {
  width: 64px; height: 64px; border: 2px solid var(--border); border-radius: 14px;
  cursor: pointer; background: none; padding: 0;
}
.picker-preview {
  flex: 1; height: 64px; border-radius: 14px; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: "Consolas", monospace; font-size: 15px; font-weight: 600;
}
.color-inputs { display: flex; flex-direction: column; gap: 10px; }
.color-input-row { display: flex; align-items: center; gap: 8px; }
.color-input-row label { width: 42px; font-size: 13px; color: var(--text-sub); }
.color-input-row input {
  flex: 1; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 14px; font-family: "Consolas", monospace; outline: none; background: #fafbfc;
}
.color-input-row input:focus { border-color: var(--primary); background: #fff; }
.color-input-row button {
  padding: 9px 14px; border: none; border-radius: 9px; background: var(--primary-soft);
  color: var(--primary); font-size: 12px; cursor: pointer; white-space: nowrap;
}
.color-input-row button:hover { opacity: .8; }

/* 色阶 */
.shades { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin-top: 12px; border-radius: 10px; overflow: hidden; }
.shade-cell { height: 44px; cursor: pointer; position: relative; transition: transform .15s; }
.shade-cell:hover { transform: scaleY(1.15); z-index: 1; }
.shade-cell .label {
  position: absolute; bottom: 4px; left: 0; right: 0; text-align: center;
  font-size: 9px; font-family: "Consolas", monospace; opacity: 0; transition: opacity .2s;
  text-shadow: 0 1px 2px rgba(0,0,0,.4); color: #fff; pointer-events: none;
}
.shade-cell:hover .label { opacity: 1; }

/* 配色方案 */
.scheme-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.scheme-tab {
  padding: 7px 14px; border-radius: 9px; font-size: 13px; cursor: pointer;
  background: var(--bg); color: var(--text-sub); transition: all .2s;
}
.scheme-tab:hover { background: var(--primary-soft); color: var(--primary); }
.scheme-tab.active { background: var(--primary); color: #fff; }
.scheme-colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 600px) { .scheme-colors { grid-template-columns: repeat(3, 1fr); } }
.scheme-color {
  border-radius: 12px; overflow: hidden; cursor: pointer; transition: transform .15s;
  border: 1px solid var(--border);
}
.scheme-color:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.scheme-swatch { height: 80px; }
.scheme-info { padding: 8px 10px; background: #fff; }
.scheme-info .hex { font-family: "Consolas", monospace; font-size: 12px; font-weight: 600; }
.scheme-info .name { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* 预设调色板 */
.preset-list { display: flex; flex-direction: column; gap: 10px; }
.preset-item {
  border-radius: 10px; overflow: hidden; cursor: pointer; border: 1px solid var(--border);
  transition: transform .15s;
}
.preset-item:hover { transform: translateX(4px); }
.preset-name { font-size: 12px; padding: 6px 10px; background: #fafbfc; color: var(--text-sub); }
.preset-colors { display: flex; height: 36px; }
.preset-colors span { flex: 1; }

/* 对比度 */
.contrast-row { display: flex; gap: 10px; margin-bottom: 12px; }
.contrast-swatch {
  flex: 1; height: 60px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 2px solid var(--border);
}
.ratio { font-size: 28px; font-weight: 700; text-align: center; color: var(--primary); margin: 8px 0; }
.wcag-badges { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.wcag { font-size: 11px; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.wcag.pass { background: #d4edda; color: #155724; }
.wcag.fail { background: #f8d7da; color: #721c24; }

/* 收藏 */
.fav-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fav-clear { font-size: 12px; color: var(--text-sub); cursor: pointer; background: none; border: none; }
.fav-clear:hover { color: var(--red); }
.fav-list { display: flex; flex-wrap: wrap; gap: 6px; }
.fav-color {
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer; position: relative;
  border: 1px solid var(--border); transition: transform .15s;
}
.fav-color:hover { transform: scale(1.15); }
.fav-empty { font-size: 12px; color: var(--text-muted); padding: 16px; text-align: center; }

/* Toast */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13px; opacity: 0; transition: all .3s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
