:root {
  --bg: #f6f1e8;
  --bg-elev: #fffdf8;
  --ink: #1c1915;
  --muted: #6b645a;
  --line: #e4dccf;
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.12);
  --shadow: 0 10px 30px rgba(28, 25, 21, 0.06);
  --radius: 14px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --max: 1080px;
}
html[data-theme="dark"] {
  --bg: #12100e;
  --bg-elev: #1c1915;
  --ink: #f3ebe1;
  --muted: #a89f92;
  --line: #2e2923;
  --accent: #f0a35e;
  --accent-soft: rgba(240, 163, 94, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--sans); color: var(--ink);
  background: radial-gradient(1200px 500px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg);
  line-height: 1.55;
}
a { color: var(--accent); text-underline-offset: 3px; }
.wrap { width: min(var(--max), calc(100% - 2rem)); margin-inline: auto; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }

.site-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .9rem 0; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.brand-mark {
  width: 2.2rem; height: 2.2rem; display: grid; place-items: center;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; align-items: center; gap: 1rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--accent); }
.theme-toggle {
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink);
  border-radius: 999px; width: 2.2rem; height: 2.2rem; cursor: pointer;
}

.app { padding: 2rem 0 3.5rem; }
.loading, .empty { color: var(--muted); }

.hero {
  display: grid; gap: 1rem; margin-bottom: 2.25rem; padding: 1.75rem 1.5rem;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow);
}
.hero h1 {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.15;
}
.hero p { margin: 0; max-width: 42rem; color: var(--muted); font-size: 1.05rem; }
.stats { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip {
  display: inline-flex; padding: .35rem .7rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .82rem; font-weight: 600;
}

.subject-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.subject-card {
  display: flex; flex-direction: column; gap: .55rem; min-height: 9.5rem;
  padding: 1.2rem 1.15rem; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.subject-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 45%, var(--line));
}
.swatch { width: 2rem; height: .35rem; border-radius: 99px; background: var(--card-accent, var(--accent)); }
.subject-card h2 { margin: 0; font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.subject-card p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.subject-card .meta { font-size: .82rem; font-weight: 600; color: var(--card-accent, var(--accent)); }

.page-head { margin-bottom: 1.5rem; }
.crumbs { color: var(--muted); font-size: .9rem; margin-bottom: .6rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.page-head h1 {
  margin: 0 0 .4rem; font-family: var(--serif);
  font-size: clamp(1.8rem, 3.5vw, 2.4rem); font-weight: 600;
}
.lede { margin: 0; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.search {
  flex: 1; min-width: 200px; border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--ink); border-radius: 10px; padding: .65rem .85rem; font: inherit;
}
.search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.book-list { display: grid; gap: .55rem; }
.book-row {
  display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: center;
  padding: .85rem 1rem; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; text-decoration: none; color: inherit;
}
.book-row:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.book-row h3 { margin: 0; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.book-row .sub { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.badge {
  font-size: .72rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  padding: .25rem .5rem; border-radius: 999px; background: var(--line); color: var(--muted);
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.soon { opacity: .75; }

.book-layout { display: grid; gap: 1.25rem; }
@media (min-width: 860px) {
  .book-layout { grid-template-columns: 1.4fr .9fr; align-items: start; }
}
.panel {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.25rem; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 .75rem; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.panel h3 {
  margin: 1.1rem 0 .45rem; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.typed-box {
  white-space: pre-wrap; font-family: var(--serif); font-size: 1.08rem; line-height: 1.65;
  max-height: 28rem; overflow: auto; padding: 1rem; border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 70%, var(--bg-elev)); border: 1px solid var(--line);
}
.placeholder {
  border: 1px dashed var(--line); border-radius: 12px; padding: 1.25rem;
  color: var(--muted); background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.player-fake {
  width: 100%; height: 3rem; border-radius: 999px; margin-bottom: .65rem;
  background: repeating-linear-gradient(-45deg, var(--line), var(--line) 8px, transparent 8px, transparent 16px);
  opacity: .55;
}
.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem .9rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .btn.primary { color: #1c1915; }
.about-card { max-width: 40rem; }
.about-card ul { padding-left: 1.1rem; }
.muted { color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; color: var(--muted); font-size: .9rem; }
.footer-inner p { margin: .2rem 0; }

.empty { color: var(--muted); padding: 1rem 0; }
.sub { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.meta { font-size: .82rem; font-weight: 600; color: var(--card-accent, var(--accent)); }
