/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F8F9FF;
  color: #1E1E2E;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ===== LAYOUT ===== */
.container {  margin: 0 auto; padding: 0 24px; }

/* ===== HEADER ===== */
.site-header {
  background: #fff;
  border-bottom: 1px solid #E8EAFF;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 16px rgba(99,102,241,0.07);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: #1E1E2E; }
.logo-icon {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  width: 28px; height: 28px;
}
.logo-icon span { border-radius: 3px; display: block; }
.logo-icon.sm { width: 22px; height: 22px; gap: 2px; }
.logo-icon.sm span { border-radius: 2px; }
.header-nav { display: flex; gap: 32px; }
.header-nav a { font-size: 14px; font-weight: 500; color: #6B7280; transition: color 0.2s; }
.header-nav a:hover { color: #6366F1; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #EEF2FF 0%, #F0FDFB 50%, #FFF7ED 100%);
  padding: 64px 0 48px;
  text-align: center;
  border-bottom: 1px solid #E8EAFF;
}
.hero-badge {
  display: inline-block;
  background: linear-gradient(90deg,#EEF2FF,#F0FDFB);
  color: #6366F1; font-size: 12px; font-weight: 600;
  padding: 5px 14px; border-radius: 100px;
  border: 1px solid #C7D2FE; margin-bottom: 20px;
  letter-spacing: .02em;
}
.hero-title {
  font-size: clamp(30px, 5vw, 52px); font-weight: 800;
  letter-spacing: -.02em; margin-bottom: 16px;
  background: linear-gradient(135deg,#6366F1,#EC4899 50%,#F59E0B);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-desc { font-size: 17px; color: #6B7280; max-width: 620px; margin: 0 auto; line-height: 1.75; }

/* ===== MAIN TOOL ===== */
.main-tool { padding: 40px 24px 80px; display: flex; flex-direction: column; gap: 24px; }

/* ===== CARDS ===== */
.card {
  background: #fff; border-radius: 20px; padding: 32px 36px;
  box-shadow: 0 2px 20px rgba(99,102,241,0.06), 0 0 0 1px rgba(99,102,241,0.04);
}

/* ===== INPUT CARD ===== */
.input-card { padding: 28px 32px; }
.input-row { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.hex-input-group { flex: 1; min-width: 240px; }
.input-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.hex-field-wrap {
  display: flex; align-items: center; gap: 0;
  border: 2px solid #E5E7EB; border-radius: 12px;
  overflow: hidden; background: #F9FAFB;
  transition: border-color 0.2s;
}
.hex-field-wrap:focus-within { border-color: #6366F1; background: #fff; }
.color-swatch-input {
  width: 44px; height: 44px; flex-shrink: 0;
  border-right: 2px solid #E5E7EB;
  cursor: pointer; transition: opacity 0.2s;
}
.color-swatch-input:hover { opacity: 0.85; }
.hex-hash { padding: 0 4px 0 12px; font-size: 16px; font-weight: 600; color: #9CA3AF; font-family: 'JetBrains Mono', monospace; }
.hex-input {
  flex: 1; border: none; background: transparent;
  font-size: 18px; font-weight: 700; color: #1E1E2E;
  padding: 0 12px 0 0; height: 44px; outline: none;
  font-family: 'JetBrains Mono', monospace; letter-spacing: .05em;
  text-transform: uppercase;
}
.color-picker-native {
  width: 44px; height: 44px; border: none; background: none;
  padding: 4px; cursor: pointer; opacity: 0;
  position: absolute;
}
.input-hint { font-size: 12px; color: #9CA3AF; margin-top: 6px; }
.input-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ===== PRESETS ===== */
.presets-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.presets-label { font-size: 13px; font-weight: 500; color: #6B7280; white-space: nowrap; }
.presets-list { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-chip {
  width: 28px; height: 28px; border-radius: 8px;
  cursor: pointer; border: 2px solid transparent;
  transition: all 0.15s; position: relative;
}
.preset-chip:hover { transform: scale(1.2); border-color: rgba(255,255,255,0.5); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.preset-chip.active { border-color: #1E1E2E; transform: scale(1.15); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 11px;
  font-size: 14px; font-weight: 600; transition: all 0.2s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg,#6366F1,#8B5CF6); color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.btn-ghost { background: #F3F4F6; color: #374151; border: 1px solid #E5E7EB; }
.btn-ghost:hover { background: #E5E7EB; }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 9px; }

/* ===== SECTION CARD ===== */
.section-card { animation: fadeSlideUp 0.4s ease both; }
@keyframes fadeSlideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }

.section-header { margin-bottom: 24px; }
.section-header.between { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.css-actions { display: flex; gap: 8px; flex-shrink: 0; }
.section-header h2 { font-size: 19px; font-weight: 700; color: #1E1E2E; margin-bottom: 4px; }
.section-header p { font-size: 13px; color: #9CA3AF; }

/* ===== PALETTE OUTPUT hidden until generated ===== */
.palette-output { display: flex; flex-direction: column; gap: 24px; }

/* ===== OVERVIEW ===== */
.overview-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.base-swatch-card {
  border-radius: 14px; overflow: hidden;
  border: 1px solid #E5E7EB;
}
.base-swatch { height: 130px; width: 100%; }
.base-swatch-info { padding: 14px 16px; }
.swatch-hex-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.swatch-hex-value { font-size: 17px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: #1E1E2E; }
.btn-copy-small {
  width: 28px; height: 28px; border-radius: 7px;
  background: #F3F4F6; color: #6B7280;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.btn-copy-small:hover { background: #EEF2FF; color: #6366F1; }
.hsl-info { font-size: 11px; color: #9CA3AF; margin-bottom: 8px; font-family: 'JetBrains Mono', monospace; }
.swatch-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 100px;
  background: #F3F4F6; color: #6B7280; letter-spacing: .05em; text-transform: uppercase;
}

/* Harmony Grid */
.harmony-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.harmony-card {
  border-radius: 14px; overflow: hidden;
  border: 1px solid #E5E7EB; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.harmony-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.harmony-swatch { height: 80px; width: 100%; }
.harmony-info { padding: 10px 12px; }
.harmony-name { font-size: 11px; font-weight: 700; color: #6B7280; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.harmony-hex { font-size: 13px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: #1E1E2E; }

/* ===== TONAL SCALE ===== */
.tonal-scale { display: flex; flex-direction: column; gap: 6px; }
.tonal-row {
  display: flex; align-items: center; gap: 0;
  border-radius: 10px; overflow: hidden; height: 52px;
  cursor: pointer; transition: transform 0.15s;
  border: 1px solid rgba(0,0,0,0.04);
}
.tonal-row:hover { transform: scaleX(1.005); }
.tonal-swatch { width: 52px; height: 100%; flex-shrink: 0; }
.tonal-meta { flex: 1; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.tonal-step { font-size: 13px; font-weight: 700; color: #374151; font-family: 'JetBrains Mono', monospace; }
.tonal-hex { font-size: 14px; font-weight: 600; font-family: 'JetBrains Mono', monospace; color: #1E1E2E; }
.tonal-usage { font-size: 11px; color: #9CA3AF; }
.tonal-copy { font-size: 11px; color: #9CA3AF; padding: 0 16px; white-space: nowrap; opacity: 0; transition: opacity 0.15s; }
.tonal-row:hover .tonal-copy { opacity: 1; }

/* ===== SEMANTIC TOKENS ===== */
.semantic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.semantic-card {
  border-radius: 14px; overflow: hidden; border: 1px solid #E5E7EB;
  transition: transform 0.15s, box-shadow 0.15s; cursor: pointer;
}
.semantic-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
.semantic-swatch { height: 64px; }
.semantic-info { padding: 12px 14px; }
.semantic-role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #9CA3AF; margin-bottom: 4px; }
.semantic-desc { font-size: 12px; color: #6B7280; margin-bottom: 8px; line-height: 1.4; }
.semantic-hex {
  font-size: 12px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  background: #F3F4F6; padding: 4px 8px; border-radius: 6px;
  display: inline-block; color: #374151;
}

/* ===== CSS CODE BLOCK ===== */
.code-wrap {
  background: #1E1E2E; border-radius: 12px; overflow: hidden;
}
.code-block {
  padding: 24px; font-size: 13px; line-height: 1.75;
  color: #A5B4FC; overflow-x: auto; white-space: pre;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  max-height: 420px;
}
.code-block .var-name { color: #67E8F9; }
.code-block .var-val  { color: #86EFAC; }

/* ===== CONTRAST GRID ===== */
.contrast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.contrast-card {
  border-radius: 14px; overflow: hidden; border: 1px solid #E5E7EB;
}
.contrast-preview {
  height: 72px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}
.contrast-info { padding: 12px 14px; }
.contrast-pair { font-size: 12px; color: #6B7280; margin-bottom: 6px; }
.contrast-ratio { font-size: 18px; font-weight: 800; font-family: 'JetBrains Mono', monospace; margin-bottom: 4px; }
.contrast-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
}
.badge-pass { background: #DCFCE7; color: #15803D; }
.badge-fail { background: #FEE2E2; color: #B91C1C; }
.badge-aa   { background: #DBEAFE; color: #1D4ED8; }
.badge-aaa  { background: #EDE9FE; color: #6D28D9; }

/* ===== HOW SECTION ===== */
.how-section { background: #fff; padding: 80px 0; border-top: 1px solid #E8EAFF; }
.section-title { font-size: 32px; font-weight: 800; color: #1E1E2E; text-align: center; margin-bottom: 48px; letter-spacing: -.02em; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.how-card { text-align: center; padding: 32px 24px; border-radius: 16px; background: #FAFBFF; border: 1px solid #E8EAFF; transition: all 0.2s; }
.how-card:hover { border-color: #C7D2FE; transform: translateY(-3px); box-shadow: 0 6px 24px rgba(99,102,241,0.1); }
.how-num {
  width: 48px; height: 48px;
  background: linear-gradient(135deg,#6366F1,#EC4899);
  color: #fff; font-size: 20px; font-weight: 800;
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.how-card h3 { font-size: 15px; font-weight: 700; color: #1E1E2E; margin-bottom: 8px; }
.how-card p  { font-size: 13px; color: #6B7280; line-height: 1.65; }

/* ===== FAQ ===== */
.faq-section { padding: 80px 0; background: linear-gradient(135deg,#F8F9FF,#FFF7ED); border-top: 1px solid #E8EAFF; }
.faq-list { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: #fff; border: 1px solid #E8EAFF; border-radius: 12px; overflow: hidden; transition: border-color 0.2s; }
.faq-item[open] { border-color: #C7D2FE; }
.faq-item summary {
  padding: 16px 20px; font-size: 15px; font-weight: 600; color: #1E1E2E;
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; user-select: none;
}
.faq-item summary::after { content: '＋'; font-size: 18px; color: #6366F1; transition: transform 0.2s; }
.faq-item[open] summary::after { content: '－'; }
.faq-item p { padding: 0 20px 16px; font-size: 14px; color: #6B7280; line-height: 1.7; }

/* ===== FOOTER ===== */
.site-footer { background: #1E1E2E; padding: 28px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-logo { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: #fff; }
.footer-copy { font-size: 13px; color: #6B7280; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1E1E2E; color: #fff;
  padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  opacity: 0; transition: all 0.3s; pointer-events: none; z-index: 9999;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .card { padding: 22px 18px; }
  .header-nav { display: none; }
  .overview-grid { grid-template-columns: 1fr; }
  .input-row { flex-direction: column; }
  .input-actions { flex-direction: row; width: 100%; }
  .btn { flex: 1; justify-content: center; }
  .section-header.between { flex-direction: column; }
  .css-actions { width: 100%; }
  .css-actions .btn { flex: 1; justify-content: center; }
}
