/* Shared layout and typography rules for Music Theory pages */
.action-btn { background: #fdfbf7; border: 1px solid var(--line); padding: 5px 12px; border-radius: 6px; font-size: 0.82rem; font-weight: 600; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: all 0.15s ease; }
.action-btn.active { background: var(--terra); color: #fff; border-color: var(--terra); }
.action-btn:hover { background: #f5ebe0; border-color: var(--terra); color: var(--terra); }
.apply-on { display: block; margin: 1rem 0 1.6rem; padding: 10px 14px; background: #f3e6cf; border-left: 3px solid var(--terra); font-size: 0.9rem; }
.apply-on a { color: var(--ink); font-weight: 600; }
.badge-flat { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.badge-pure { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-sharp { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.bench-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bench-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.bench-subtitle { font-size: 0.85rem; color: var(--muted); margin: 2px 0 0; }
.bench-title { margin: 0; font-size: 1.25rem; color: var(--terra); display: flex; align-items: center; gap: 8px; }
.canvas-hint { position: absolute; bottom: 6px; right: 10px; font-size: 0.72rem; color: rgba(255,255,255,0.45); pointer-events: none; }
.chain { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 20px 0; box-shadow: var(--shadow); }
.chain li { margin: 0.45em 0; line-height: 1.55; }
.chain ol { margin: 0; padding-left: 1.3em; }
.comma-badge { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.75rem; }
.cross-chip-badge { font-size: 0.68rem; font-weight: 600; padding: 2px 5px; border-radius: 3px; margin-top: 3px; display: inline-block; align-self: flex-start; line-height: 1.3; }
.cross-chip-cents { font-size: 0.72rem; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.cross-chip-play { font-size: 0.72rem; color: var(--terra); font-weight: 700; }
.cross-chip-ratio { font-size: 0.74rem; color: var(--ink); font-weight: 600; }
.cross-chip-system { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.cross-chip-top { display: flex; justify-content: space-between; align-items: center; }
.cross-chip.active-playing { background: #fef3c7 !important; border-color: #d97706 !important; box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.45); transform: translateY(-2px); }
.cross-chip.active-playing .cross-chip-system { color: #92400e; }
.cross-chip:hover { border-color: var(--terra); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(181, 69, 29, 0.12); }
.cross-seq-btn { background: #f5ebe0; border: 1px solid var(--terra); color: var(--terra); font-size: 0.78rem; padding: 5px 11px; border-radius: 5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: all 0.12s ease; }
.cross-seq-btn.running { background: #b45309; color: #fff; border-color: #78350f; }
.cross-seq-btn:hover { background: var(--terra); color: #fff; }
.cross-tuning-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cross-tuning-panel { margin-top: 14px; padding: 14px 16px; background: #fcf8f2; border: 1px solid var(--line); border-radius: 8px; border-left: 4px solid var(--terra); }
.cross-tuning-title { font-size: 0.92rem; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.from-theory { margin: 0 0 1.2rem; padding: 10px 14px; background: #f3e6cf; border-left: 3px solid var(--terra); font-size: 0.92rem; font-family: system-ui, sans-serif; }
.inspector-card { background: #fcf9f4; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 16px; }
.inspector-meta { font-size: 0.85rem; color: var(--muted); margin: 4px 0 10px; line-height: 1.45; }
.inspector-note-title { display: flex; align-items: baseline; gap: 10px; }
.inspector-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.inspector-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.lead { font-size: 1.12rem; color: #4a3c2e; max-width: 44rem; line-height: 1.6; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
.note { background: #f3ebe0; border-left: 3px solid var(--ochre); padding: 12px 16px; margin: 18px 0; border-radius: 0 8px 8px 0; font-size: 0.94rem; line-height: 1.6; }
.temper-bench { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin: 28px 0 36px; padding: 20px; }
.pill-btn { background: transparent; border: none; padding: 4px 11px; border-radius: 16px; font-size: 0.8rem; font-weight: 600; color: var(--ink); cursor: pointer; transition: all 0.15s ease; }
.pill-btn.active { background: var(--panel); color: var(--terra); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.pill-group { display: inline-flex; background: #eee3d3; padding: 3px; border-radius: 20px; border: 1px solid var(--line); }
.stage-head { margin: 2.6em 0 1.2em; padding: 1.1rem 1.25rem; background: linear-gradient(135deg, #f3ebe0 0%, #fffaf2 70%); border: 1px solid var(--line); border-left: 4px solid var(--terra); border-radius: 0 10px 10px 0; }
.stage-head h2 { margin: 0 0 0.3em; border: none; padding: 0; font-size: 1.38rem; color: var(--terra); }
.stage-head p { margin: 0; font-family: system-ui, sans-serif; font-size: 0.95rem; color: var(--muted); max-width: 46rem; line-height: 1.5; }
.stat-box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.stat-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 2px; }
.stat-sub { font-size: 0.72rem; color: var(--muted); }
.stat-val { font-size: 0.96rem; font-weight: 700; color: var(--ink); font-family: ui-monospace, Consolas, monospace; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.thaat-notes { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; white-space: nowrap; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin: 0 0 0.35em; color: var(--terra); letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; margin: 2.2em 0 0.5em; border-bottom: 1px solid var(--line); padding-bottom: 0.25em; }
h3 { font-size: 1.1rem; margin: 1.4em 0 0.4em; }
main h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin: 0 0 0.35em; color: var(--terra); letter-spacing: -0.02em; }
main h2 { font-size: 1.45rem; margin: 2.2em 0 0.5em; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 0.25em; }
main h3 { font-size: 1.15rem; margin: 1.5em 0 0.4em; }
main h4 { font-size: 1.02rem; margin: 1.2em 0 0.35em; color: var(--terra); }
main table { width: 100%; max-width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-family: system-ui, "Segoe UI", sans-serif; font-size: 0.88rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
main td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
main th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
main tr:hover td { background: rgba(181, 69, 29, 0.04); }
main tr:last-child td { border-bottom: none; }
table { border-collapse: collapse; width: max-content; max-width: 100%; margin: 0.8em 0 1.2em; font-size: 0.92rem; }
table.raag-sheet td { font-size: 0.96rem; }
td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
u.name-komal { text-underline-offset: 2px; }
@media (max-width: 820px) {
  .wrap { flex-direction: column; }
  h1 { font-size: 1.75rem; }
}

/* Shared Theory table header rule */
main th { background: #f3ebe0; color: var(--ink); font-weight: 700; font-size: 0.82rem; }

/* BEGIN DARK (generated by scripts/gen_dark.py; do not edit) */
html[data-theme="dark"] .action-btn {
  background: #251e11;
  border: 1px solid var(--line);
  color: var(--ink);
}
html[data-theme="dark"] .action-btn.active {
  background: #b5451d;
  color: #ffffff;
  border-color: var(--terra);
}
html[data-theme="dark"] .action-btn:hover {
  background: #292016;
  border-color: var(--terra);
  color: var(--terra);
}
html[data-theme="dark"] .apply-on {
  background: #2f2616;
  border-left: 3px solid var(--terra);
}
html[data-theme="dark"] .apply-on a {
  color: var(--ink);
}
html[data-theme="dark"] .badge-flat {
  background: #0d222f;
  color: #8dc6e5;
  border: 1px solid #1b4a63;
}
html[data-theme="dark"] .badge-pure {
  background: #0f2f1a;
  color: #a6ddbb;
  border: 1px solid #225e37;
}
html[data-theme="dark"] .badge-sharp {
  background: #362e0e;
  color: #dda481;
  border: 1px solid #6b5c1d;
}
html[data-theme="dark"] .bench-header {
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] .bench-subtitle {
  color: var(--muted);
}
html[data-theme="dark"] .bench-title {
  color: var(--terra);
}
html[data-theme="dark"] .canvas-hint {
  color: rgba(255, 255, 255, 0.45);
}
html[data-theme="dark"] .chain {
  background: var(--panel);
  border: 1px solid var(--line);
}
html[data-theme="dark"] .comma-badge {
  background: #2a0d0d;
  color: #d58585;
  border: 1px solid #611a1a;
}
html[data-theme="dark"] .cross-chip-cents {
  color: var(--muted);
}
html[data-theme="dark"] .cross-chip-play {
  color: var(--terra);
}
html[data-theme="dark"] .cross-chip-ratio {
  color: var(--ink);
}
html[data-theme="dark"] .cross-chip-system {
  color: var(--muted);
}
html[data-theme="dark"] .cross-chip.active-playing {
  background: #362e0e !important;
  border-color: #d97706 !important;
}
html[data-theme="dark"] .cross-chip.active-playing .cross-chip-system {
  color: #dda481;
}
html[data-theme="dark"] .cross-chip:hover {
  border-color: var(--terra);
}
html[data-theme="dark"] .cross-seq-btn {
  background: #292016;
  border: 1px solid var(--terra);
  color: var(--terra);
}
html[data-theme="dark"] .cross-seq-btn.running {
  background: #b45309;
  color: #ffffff;
  border-color: #d55e1b;
}
html[data-theme="dark"] .cross-seq-btn:hover {
  background: #b5451d;
  color: #ffffff;
}
html[data-theme="dark"] .cross-tuning-panel {
  background: #261e11;
  border: 1px solid var(--line);
  border-left: 4px solid var(--terra);
}
html[data-theme="dark"] .cross-tuning-title {
  color: var(--ink);
}
html[data-theme="dark"] .from-theory {
  background: #2f2616;
  border-left: 3px solid var(--terra);
}
html[data-theme="dark"] .inspector-card {
  background: #251e12;
  border: 1px solid var(--line);
}
html[data-theme="dark"] .inspector-meta {
  color: var(--muted);
}
html[data-theme="dark"] .lead {
  color: #cdc3b9;
}
html[data-theme="dark"] .note {
  background: #282117;
  border-left: 3px solid var(--ochre);
}
html[data-theme="dark"] .temper-bench {
  background: var(--panel);
  border: 1px solid var(--line);
}
html[data-theme="dark"] .pill-btn {
  background: transparent;
  border: none;
  color: var(--ink);
}
html[data-theme="dark"] .pill-btn.active {
  background: var(--panel);
  color: var(--terra);
}
html[data-theme="dark"] .pill-group {
  background: #2c2419;
  border: 1px solid var(--line);
}
html[data-theme="dark"] .stage-head {
  background: linear-gradient(135deg, #282117 0%, #2c1f0b 70%);
  border: 1px solid var(--line);
  border-left: 4px solid var(--terra);
}
html[data-theme="dark"] .stage-head h2 {
  border: none;
  color: var(--terra);
}
html[data-theme="dark"] .stage-head p {
  color: var(--muted);
}
html[data-theme="dark"] .stat-box {
  background: var(--panel);
  border: 1px solid var(--line);
}
html[data-theme="dark"] .stat-label {
  color: var(--muted);
}
html[data-theme="dark"] .stat-sub {
  color: var(--muted);
}
html[data-theme="dark"] .stat-val {
  color: var(--ink);
}
html[data-theme="dark"] h1 {
  color: var(--terra);
}
html[data-theme="dark"] h2 {
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] main h1 {
  color: var(--terra);
}
html[data-theme="dark"] main h2 {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] main h4 {
  color: var(--terra);
}
html[data-theme="dark"] main table {
  background: var(--panel);
  border: 1px solid var(--line);
}
html[data-theme="dark"] main td {
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] main th {
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] main tr:hover td {
  background: rgba(181, 69, 29, 0.04);
}
html[data-theme="dark"] main tr:last-child td {
  border-bottom: none;
}
html[data-theme="dark"] td {
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] th {
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] main th {
  background: #282117;
  color: var(--ink);
}
/* END DARK */
