:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --surface: #11161d;
  --surface-2: #171d26;
  --surface-3: #202835;
  --text: #f1f3f5;
  --muted: #9ca6b5;
  --line: #2a3442;
  --line-strong: #465267;
  --accent: #e0a955;
  --accent-bright: #f4c875;
  --accent-soft: rgba(224, 169, 85, 0.12);
  --blue: #80b7d9;
  --danger: #ff8b8b;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(67, 101, 135, 0.2), transparent 30rem),
    linear-gradient(180deg, #0d1117 0%, var(--bg) 46rem);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  padding: 10px 14px;
  color: #111;
  background: var(--accent-bright);
  border-radius: 8px;
}
.skip-link:focus { transform: none; }

.site-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 28px;
  align-items: end;
  max-width: 1480px;
  margin: 0 auto;
  padding: 30px 36px 20px;
}

.brand-block { display: flex; align-items: center; gap: 17px; min-width: 0; }
.brand-mark {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 3px);
  gap: 4px;
  align-items: stretch;
  width: 44px;
  height: 48px;
  padding: 2px 5px;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line-strong);
}
.brand-mark span { background: linear-gradient(var(--accent), var(--line-strong)); border-radius: 2px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.16em; }
h1 { margin: 0; font-size: clamp(1.35rem, 2.1vw, 2rem); line-height: 1.15; letter-spacing: -0.035em; }

.search-wrap {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 0 13px;
  background: rgba(22, 28, 37, 0.88);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 9px 30px rgba(0, 0, 0, 0.18);
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap svg { width: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-wrap input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 1rem; }
.search-wrap input::placeholder { color: #788393; }
kbd { padding: 2px 7px; color: var(--muted); background: #0b0e13; border: 1px solid var(--line); border-radius: 6px; font-size: 0.75rem; }

.primary-nav {
  position: sticky;
  z-index: 15;
  top: 0;
  display: flex;
  gap: 5px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 8px 36px;
  overflow-x: auto;
  background: rgba(11, 14, 19, 0.9);
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.nav-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 720;
}
.nav-tab:hover { color: var(--text); background: var(--surface-2); }
.nav-tab.is-active { color: #17120a; background: var(--accent); }

main { max-width: 1480px; min-height: 65vh; margin: 0 auto; padding: 30px 36px 70px; }

.page-intro {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  margin-bottom: 26px;
}
.page-kicker { margin: 0 0 7px; color: var(--accent); font-size: 0.77rem; font-weight: 850; letter-spacing: 0.13em; text-transform: uppercase; }
.page-title { margin: 0; font-size: clamp(1.7rem, 3vw, 2.8rem); letter-spacing: -0.045em; }
.page-description { max-width: 650px; margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.stat-line { flex: 0 0 auto; color: var(--muted); font-size: 0.88rem; }
.stat-line strong { color: var(--text); font-size: 1.25rem; }

.section { margin-top: 42px; }
.section:first-of-type { margin-top: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 1.22rem; letter-spacing: -0.02em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.priority-stars { color: var(--accent-bright); letter-spacing: 0.04em; }

.chord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(226px, 1fr));
  gap: 13px;
}

.chord-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 14px;
  min-height: 152px;
  padding: 17px;
  text-align: left;
  background: linear-gradient(145deg, rgba(25, 32, 42, 0.96), rgba(17, 22, 29, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.chord-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 160ms ease;
}
.chord-card:hover { transform: translateY(-2px); border-color: #59667a; background: linear-gradient(145deg, #202936, #151b23); }
.chord-card:hover::before { opacity: 1; }
.chord-card:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(224, 169, 85, 0.55); outline-offset: 2px; }
.chord-symbol { display: block; margin-bottom: 2px; font-size: 1.75rem; font-weight: 840; letter-spacing: -0.04em; }
.chord-quality { color: var(--muted); font-size: 0.82rem; }
.note-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 13px; }
.note-pill { padding: 3px 7px; color: #c9d3df; background: #0e1319; border: 1px solid #303a48; border-radius: 99px; font-size: 0.74rem; font-weight: 750; }
.card-meta { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; color: var(--muted); font-size: 0.75rem; }
.mini-diagram { align-self: center; justify-self: end; width: 72px; height: auto; }

.chip-row, .root-picker, .type-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 24px; }
.filter-chip {
  min-height: 39px;
  padding: 7px 12px;
  color: #cbd3de;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.filter-chip:hover, .filter-chip.is-active { color: #16120a; background: var(--accent); border-color: var(--accent); }

.empty-state { padding: 54px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-state h2 { margin: 0 0 7px; }
.empty-state p { margin: 0; color: var(--muted); }

.drawer-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}
.chord-drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  width: min(840px, 94vw);
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px;
  background: #10151c;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}
.chord-drawer.is-open { transform: none; }
.drawer-top { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.drawer-close { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); cursor: pointer; font-size: 1.4rem; }
.detail-symbol { margin: 4px 0 0; font-size: clamp(2.5rem, 7vw, 5rem); line-height: 0.95; letter-spacing: -0.06em; }
.detail-name { margin: 10px 0 0; color: var(--muted); }
.theory-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 24px 0 22px; }
.theory-cell { padding: 13px 15px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.theory-cell small { display: block; margin-bottom: 4px; color: var(--muted); }
.theory-cell strong { font-size: 1rem; }
.voicing-list { display: grid; gap: 14px; }
.voicing-card { display: grid; grid-template-columns: 214px minmax(0, 1fr); gap: 24px; padding: 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 15px; }
.diagram-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; background: #f1ede4; border-radius: 10px; }
.full-diagram { width: 180px; max-width: 100%; height: auto; }
.fingering-code { margin-top: 6px; color: #131820; font-family: "SFMono-Regular", Consolas, monospace; font-size: 1.05rem; font-weight: 800; letter-spacing: 0.07em; }
.voicing-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.voicing-heading h3 { margin: 0; font-size: 1.12rem; }
.rating { color: var(--accent-bright); font-size: 0.83rem; letter-spacing: 0.02em; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tag { padding: 5px 8px; color: #c9d3df; background: #0f141b; border: 1px solid #34404f; border-radius: 7px; font-size: 0.75rem; }
.tag.accent { color: #241a0c; background: var(--accent-bright); border-color: var(--accent-bright); font-weight: 800; }
.voicing-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 15px; margin: 14px 0 0; }
.fact { color: var(--muted); font-size: 0.82rem; }
.fact strong { display: block; color: var(--text); font-size: 0.9rem; font-weight: 680; }
.connection-note { margin: 14px 0 0; padding: 11px 12px; color: #dce5ef; background: rgba(128, 183, 217, 0.09); border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; font-size: 0.82rem; line-height: 1.55; }
.slash-explainer { margin: 0 0 24px; padding: 13px 15px; color: #dce5ef; background: rgba(128, 183, 217, 0.08); border: 1px solid rgba(128, 183, 217, 0.2); border-radius: 10px; line-height: 1.65; }

.degree-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.key-card { padding: 19px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.key-card h2 { margin: 0 0 14px; font-size: 1.15rem; }
.degree-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; min-height: 42px; border-top: 1px solid var(--line); }
.degree-label { color: var(--accent); font-family: Georgia, serif; font-weight: 800; }
.degree-chord { justify-self: start; padding: 4px 8px; color: var(--text); background: transparent; border: 0; border-radius: 6px; cursor: pointer; font-weight: 760; }
.degree-chord:hover { background: var(--accent-soft); color: var(--accent-bright); }

.progression-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 30px; }
.progression { padding: 18px; background: linear-gradient(145deg, #18212c, #10151c); border: 1px solid var(--line); border-radius: var(--radius); }
.progression h3 { margin: 0 0 12px; font-size: 1rem; }
.progression-chords, .bass-line { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.progression-chords button { padding: 7px 10px; color: var(--text); background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.arrow { color: var(--muted); }
.bass-line { margin-top: 10px; color: var(--accent-bright); font-family: Georgia, serif; font-size: 0.9rem; }

.legend-grid { display: grid; grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr); gap: 18px; }
.legend-panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.legend-panel h2 { margin: 0 0 16px; }
.legend-list { display: grid; gap: 11px; margin: 0; }
.legend-list div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.legend-list dt { color: var(--accent-bright); font-weight: 800; }
.legend-list dd { margin: 0; color: var(--muted); line-height: 1.55; }
.learning-chain { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chain-node { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; font-weight: 750; }

.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 28px;
  align-items: center;
  padding: 26px;
  background: linear-gradient(135deg, rgba(224, 169, 85, 0.14), rgba(23, 29, 38, 0.96) 52%);
  border: 1px solid rgba(224, 169, 85, 0.3);
  border-radius: var(--radius);
}
.guide-label { margin: 0 0 8px; color: var(--accent-bright); font-size: 0.78rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.guide-hero h2, .guide-panel h2 { margin: 0; letter-spacing: -0.025em; }
.guide-hero p:not(.guide-label), .guide-panel p, .guide-panel li { color: var(--muted); line-height: 1.7; }
.guide-chords { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.guide-chords button { min-height: 54px; color: var(--text); background: #0d1218; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; font-size: 1.05rem; font-weight: 820; }
.guide-chords button:hover { color: #17120a; background: var(--accent); border-color: var(--accent); }

.guide-step-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.guide-step { padding: 19px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.guide-step > span { display: block; color: var(--accent); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 800; }
.guide-step h3 { margin: 20px 0 7px; font-size: 1rem; }
.guide-step p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.65; }
.guide-step code { color: var(--accent-bright); font-size: 0.86rem; }

.path-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0; list-style: none; counter-reset: path; }
.path-list li { position: relative; min-height: 114px; padding: 18px 18px 18px 57px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; counter-increment: path; }
.path-list li::before { content: counter(path); position: absolute; top: 18px; left: 17px; display: grid; place-items: center; width: 27px; height: 27px; color: #17120a; background: var(--accent); border-radius: 50%; font-weight: 850; }
.path-list strong, .path-list span { display: block; }
.path-list span { margin-top: 7px; color: var(--muted); font-size: 0.85rem; line-height: 1.55; }

.guide-two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.guide-panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.guide-panel ul { margin: 16px 0 0; padding-left: 20px; }
.guide-panel li + li { margin-top: 7px; }

.site-footer { display: flex; justify-content: space-between; gap: 24px; max-width: 1480px; margin: 0 auto; padding: 22px 36px 38px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.82rem; }
.site-footer p { margin: 0; }

body.drawer-open { overflow: hidden; }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr; gap: 18px; padding: 23px 20px 16px; }
  .primary-nav { padding: 8px 20px; }
  main { padding: 25px 20px 58px; }
  .progression-board { grid-template-columns: 1fr; }
  .legend-grid { grid-template-columns: 1fr; }
  .guide-hero { grid-template-columns: 1fr; }
  .guide-step-grid { grid-template-columns: repeat(2, 1fr); }
  .path-list { grid-template-columns: repeat(2, 1fr); }
  .site-footer { padding-inline: 20px; }
}

@media (max-width: 640px) {
  .brand-mark { display: none; }
  .eyebrow { font-size: 0.68rem; }
  .page-intro { align-items: start; flex-direction: column; gap: 10px; }
  .chord-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .chord-card { grid-template-columns: minmax(0, 1fr) 60px; gap: 6px; min-height: 138px; padding: 13px; }
  .mini-diagram { width: 58px; }
  .chord-symbol { font-size: 1.48rem; }
  .note-row { display: none; }
  .chord-drawer { width: 100%; padding: 19px 15px 35px; }
  .theory-strip { grid-template-columns: 1fr; }
  .voicing-card { grid-template-columns: 1fr; padding: 14px; }
  .guide-chords { grid-template-columns: repeat(3, 1fr); }
  .guide-step-grid, .path-list, .guide-two-column { grid-template-columns: 1fr; }
  .diagram-wrap { max-width: 260px; width: 100%; margin: 0 auto; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
