:root {
  --bg: #e7e9ee;
  --panel: #f8f9fb;
  --panel2: #ffffff;
  --line: #d6dae2;
  --text: #1d2129;
  --dim: #6b7280;
  --accent: #2f7cf6;
  --accent2: #e8f0fe;
  --danger: #c2413b;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
a { color: var(--accent); }

/* header + tabs */
.top {
  display: flex; align-items: center; gap: 16px; padding: 8px 16px; flex-wrap: wrap;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.home { font-size: 12px; color: var(--dim); text-decoration: none; white-space: nowrap; }
.home:hover { color: var(--accent); }
.home.sheet { margin-left: auto; }
.brand { font-family: Georgia, 'Times New Roman', serif; font-size: 21px; font-weight: 600; }
.grp { display: flex; align-items: center; gap: 6px; }
.grp.end { margin-left: auto; }
.tabs { display: flex; gap: 2px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 9px 12px 7px; cursor: pointer;
  color: var(--dim); white-space: nowrap; font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.btn, select, input, textarea { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; }
.btn { cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: #b8bfcc; background: #f1f3f7; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.icon { min-width: 30px; padding-left: 6px; padding-right: 6px; text-align: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px #2f7cf622; }
kbd {
  display: inline-block; min-width: 18px; padding: 0 4px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; background: var(--panel2); font: 11px/16px ui-monospace, Menlo, monospace; text-align: center;
}

/* tab panels */
.main { flex: 1; padding: 20px 16px 40px; }
.tool { display: none; max-width: 1180px; margin: 0 auto; }
.tool.on { display: block; }

/* clock tool */
.clock-tool { display: grid; grid-template-columns: minmax(300px, 440px) 1fr; gap: 24px; align-items: start; }
.clock-col { display: flex; flex-direction: column; gap: 12px; }
.clock-wrap { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.clock-wrap svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.clock-wrap .node { cursor: pointer; }
.clock-wrap .node circle { fill: #fff; stroke: #9aa3b2; stroke-width: 1.5; transition: fill .12s, stroke .12s; }
.clock-wrap .node:hover circle { stroke: var(--accent); fill: var(--accent2); }
.clock-wrap .node:focus { outline: none; }
.clock-wrap .node:focus-visible circle { stroke: var(--accent); stroke-width: 3; }
.clock-wrap .node text { font-size: 20px; font-weight: 600; fill: var(--text); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.clock-wrap .node.on circle { fill: var(--accent); stroke: #1f6ae0; }
.clock-wrap .node.on text { fill: #fff; }
.clock-wrap .ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
.clock-wrap .poly { fill: #2f7cf61a; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.clock-wrap .poly.dyad { fill: none; }
.clock-wrap .axis { stroke: #c2413b; stroke-width: 1.5; stroke-dasharray: 6 5; opacity: .75; }
.clock-wrap .axis-dot { fill: #c2413b; }
.clock-wrap .pcname { font-size: 11.5px; fill: var(--dim); text-anchor: middle; dominant-baseline: central; pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.clock-wrap .center { font-size: 13px; fill: var(--dim); text-anchor: middle; dominant-baseline: central; }
.ctrl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ctrl .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.ctrl label { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; }
.setin { display: flex; gap: 6px; }
.setin input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; }
.hint { font-size: 12px; color: var(--dim); margin: 0; }

.results { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px 16px; min-height: 200px; }
.results h2 { margin: 0 0 2px; font-family: Georgia, serif; font-weight: 600; font-size: 26px; line-height: 1.2; }
.results .sub { color: var(--dim); margin: 0 0 14px; font-size: 14px; }
.results .empty { color: var(--dim); padding: 30px 0; text-align: center; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; align-items: baseline; }
dl.facts dt { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding-top: 2px; }
dl.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
dl.facts dd .mono, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; }
dl.facts dd a.why { font-size: 12.5px; margin-left: 8px; }
dl.facts dd .tzero { color: var(--dim); font-size: 12.5px; margin-left: 10px; white-space: nowrap; }
dl.facts dd .tzero .mono { color: var(--text); font-size: 13px; }
dl.facts dd .note { color: var(--dim); font-size: 12.5px; margin-left: 6px; }
dl.facts dd .pill { display: inline-block; background: var(--accent2); color: #1f4f9f; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; margin: 0 4px 3px 0; }
dl.facts dd a.setlink { color: inherit; text-decoration: none; border-bottom: 1px dotted #9aa3b2; cursor: pointer; }
dl.facts dd a.setlink:hover { color: var(--accent); border-bottom-color: var(--accent); }
.icv { display: inline-grid; grid-template-columns: repeat(6, 26px); text-align: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; vertical-align: middle; }
.icv span { padding: 2px 0; border-right: 1px solid var(--line); }
.icv span:last-child { border-right: none; }
.icv .h { font-size: 10px; color: var(--dim); background: var(--panel); }

details.ops { margin-top: 16px; }
details.ops summary { cursor: pointer; color: var(--dim); font-size: 13px; }
table.ops { border-collapse: collapse; margin-top: 8px; font-size: 13px; width: 100%; }
table.ops th { text-align: left; font-weight: 600; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; }
table.ops td { padding: 2px 8px; border-top: 1px solid #eef0f4; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; cursor: pointer; }
table.ops tr:hover td { background: var(--accent2); }
table.ops tr.same td { color: var(--accent); font-weight: 600; }
.ops-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

.byline { text-align: center; color: var(--dim); font-size: 12.5px; padding: 14px; font-family: Georgia, serif; }
.byline a { color: inherit; text-decoration: none; }
.byline a:hover { color: var(--accent); }

@media (max-width: 780px) {
  .clock-tool { grid-template-columns: 1fr; }
  .ops-grid { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 1fr; gap: 2px; }
  dl.facts dd { margin-bottom: 8px; }
}

/* prose pages (Interval Classes) */
.prose { max-width: 760px; margin: 0 auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 28px 40px 36px; font-size: 15.5px; line-height: 1.6; }
.prose h1 { font-family: Georgia, serif; font-weight: 600; font-size: 32px; line-height: 1.15; margin: 0 0 10px; }
.prose h2 { font-family: Georgia, serif; font-weight: 600; font-size: 22px; margin: 30px 0 8px; }
.prose p { margin: 0 0 12px; }
.prose .lede { font-size: 17px; color: #3b4150; }
.prose .formula { font-family: ui-monospace, Menlo, monospace; font-size: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; text-align: center; }
.prose .aside { font-size: 14px; color: var(--dim); border-left: 3px solid var(--line); padding-left: 12px; }
.prose figure.demo { margin: 18px 0 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; grid-template-columns: 300px 1fr; gap: 14px 20px; align-items: center; }
.prose figure.demo figcaption { grid-column: 1 / -1; font-size: 13px; color: var(--dim); }
.prose figure.demo.calc, .prose figure.demo.drill { grid-template-columns: 1fr; }
.demo-clock svg { display: block; width: 100%; height: auto; user-select: none; }
.demo-clock .ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
.demo-clock .node { cursor: pointer; }
.demo-clock .node circle { fill: #fff; stroke: #9aa3b2; stroke-width: 1.5; }
.demo-clock .node:hover circle { stroke: var(--accent); }
.demo-clock .node text { font-size: 17px; font-weight: 600; fill: var(--text); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.demo-clock .node.on-a circle { fill: var(--accent); stroke: #1f6ae0; }
.demo-clock .node.on-b circle { fill: #1d2129; stroke: #000; }
.demo-clock .node.on-a text, .demo-clock .node.on-b text { fill: #fff; }
.demo-clock .tag { font-size: 14px; font-style: italic; fill: var(--dim); text-anchor: middle; dominant-baseline: central; font-family: Georgia, serif; }
.demo-clock .arc-fwd { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; }
.demo-clock .arc-back { fill: none; stroke: #b8bfcc; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 7; }
.demo-clock .center { font-size: 13px; fill: var(--dim); text-anchor: middle; dominant-baseline: central; }
.demo-clock .center.big { font-size: 26px; font-weight: 700; fill: var(--text); }
.demo-side .pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); margin-bottom: 12px; }
.pickbtn { font-style: italic; font-family: Georgia, serif; min-width: 32px; }
.pickbtn.on { background: var(--accent2); border-color: var(--accent); color: #1f4f9f; }
.demo-side .facts { font-size: 14px; }
.fwd { color: var(--accent); } .back { color: #6b7280; }
.calc-in { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.calc-in label { display: flex; align-items: center; gap: 6px; }
.calc-in input { width: 64px; font-family: ui-monospace, Menlo, monospace; }
table.steps { border-collapse: collapse; width: 100%; font-size: 14px; }
table.steps th { text-align: left; font-weight: 600; padding: 5px 10px 5px 0; white-space: nowrap; border-top: 1px solid var(--line); }
table.steps td { padding: 5px 10px 5px 0; border-top: 1px solid var(--line); }
table.steps tr:first-child th, table.steps tr:first-child td { border-top: none; }
table.ictable { border-collapse: collapse; width: 100%; font-size: 14px; margin: 6px 0 12px; }
table.ictable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 4px 8px; border-bottom: 1px solid var(--line); }
table.ictable td { padding: 6px 8px; border-bottom: 1px solid #eef0f4; vertical-align: middle; }
.drill-q { font-size: 17px; }
.drill-btns { display: flex; gap: 8px; }
.drill-btns .btn { min-width: 44px; font-size: 16px; font-weight: 600; }
.drill-btns .btn.right { background: #d9f2e3; border-color: #3aa36a; color: #1d6b40; }
.drill-btns .btn.wrong { background: #fbe1df; border-color: var(--danger); color: var(--danger); }
.drill-msg { min-height: 1.4em; font-size: 14px; }
.drill-foot { display: flex; align-items: center; gap: 12px; font-size: 13px; }
@media (max-width: 780px) {
  .prose { padding: 20px 18px 28px; }
  .prose figure.demo { grid-template-columns: 1fr; }
}
/* interval-class vector page */
.icdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }
.demo-clock .node.on circle { fill: var(--accent); stroke: #1f6ae0; }
.demo-clock .node.on text { fill: #fff; }
.demo-clock .chord { stroke-width: 3.5; stroke-linecap: round; opacity: .85; transition: stroke-width .1s, opacity .1s; }
.demo-clock .chord.hot { stroke-width: 8; opacity: 1; }
table.tallyt { border-collapse: collapse; margin-bottom: 8px; }
table.tallyt th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 10px; border-bottom: 1px solid var(--line); }
table.tallyt td { text-align: center; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 4px 10px; }
.vecline { font-size: 14px; margin-bottom: 10px; }
.pairs { display: flex; flex-wrap: wrap; gap: 5px; }
.pair { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 1px 9px; cursor: default; }
.pair.next { border-style: dashed; color: var(--dim); }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; margin: -8px 0 16px; }
.examples .btn { font-size: 12.5px; padding: 3px 8px; }
.drill-in { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.drill-in label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; }
.drill-in input { width: 58px; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.drill-in input.right { background: #d9f2e3; border-color: #3aa36a; }
.drill-in input.wrong { background: #fbe1df; border-color: var(--danger); }
/* inclusion tree */
.tool#tool-tree { max-width: none; }
.tree-tool { display: flex; flex-direction: column; gap: 12px; }
.tree-head { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 6px; display: flex; flex-direction: column; gap: 8px; }
.tree-head .examples { margin: 0; }
.tree-head .setin.check { flex: 0 1 320px; }
.tree-head .setin.check input { font-family: inherit; }
.tree-head .hint { margin: 2px 0 4px; }
.tree-body { display: grid; grid-template-columns: 1fr 300px; gap: 12px; align-items: start; }
.tree-scroll { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; overflow: auto; height: calc(100vh - 290px); min-height: 360px; cursor: grab; overscroll-behavior: contain; }
.tree-scroll.grabbing { cursor: grabbing; user-select: none; }
.zoomctl { display: inline-flex; gap: 4px; align-items: center; }
.zoomctl #zoomLbl { min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; }
.tree-scroll svg { display: block; margin: 0 auto; max-width: none; }
.tree-scroll .rowlbl { font-size: 11px; fill: var(--dim); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round; }

.tree-scroll .tedge { fill: none; stroke: #c3c9d4; stroke-width: 1.2; transition: stroke .12s, opacity .12s; }
.tree-scroll .tedge.hi { stroke: var(--accent); stroke-width: 2.2; }
.tree-scroll .tedge.dim { opacity: .25; }
.tree-scroll .tnode { cursor: pointer; transition: opacity .12s; }
.tree-scroll .tnode:focus { outline: none; }
.tree-scroll .tnode rect { fill: #fff; stroke: #9aa3b2; stroke-width: 1.3; }
.tree-scroll .tnode:hover rect, .tree-scroll .tnode:focus-visible rect { stroke: var(--accent); stroke-width: 2; }
.tree-scroll .tnode.top rect { fill: #f3f6fb; stroke-width: 2; }
.tree-scroll .tnode.hi rect { fill: var(--accent2); stroke: var(--accent); stroke-width: 1.8; }
.tree-scroll .tnode.sel rect { fill: var(--accent); stroke: #1f6ae0; stroke-width: 2; }
.tree-scroll .tnode.sel text { fill: #fff; }
.tree-scroll .tnode.dim { opacity: .3; }
.tree-scroll .tnode text { text-anchor: middle; dominant-baseline: central; pointer-events: none; fill: var(--text); }
.tree-scroll .tnode .fn { font-size: 13px; font-weight: 700; }
.tree-scroll .tnode .pf { font-size: 10.5px; font-family: ui-monospace, Menlo, monospace; fill: #4b5261; }
.tree-scroll .tnode.sel .pf { fill: #e6eeff; }
.tree-scroll .tnode .cnt { font-size: 9px; text-anchor: end; fill: var(--dim); }
.tree-scroll .tnode.sel .cnt { fill: #e6eeff; }
.tree-side { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 14px; position: sticky; top: 12px; }
.tree-side h3 { margin: 0 0 4px; font-family: Georgia, serif; font-weight: 600; font-size: 20px; }
.tree-side h4 { margin: 14px 0 4px; font-size: 15px; }
.tree-side p { margin: 0 0 8px; }
.tree-side .members { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.tree-side .members a { font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; cursor: pointer; text-decoration: none; color: inherit; }
.tree-side .members a:hover, .tree-side a.setlink:hover { border-color: var(--accent); color: var(--accent); }
.tree-side a.setlink, .tree-side a.nodelink { cursor: pointer; color: var(--accent); }
.tree-side a.nodelink:hover { text-decoration: underline; }
.tree-msg { font-size: 13.5px; line-height: 1.5; }
.tree-msg:not(:empty) { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .tree-body { grid-template-columns: 1fr; } .tree-side { position: static; } }
/* normal & prime form page */
.prose ol.stepsl { margin: 0 0 12px; padding-left: 22px; }
.prose ol.stepsl li { margin-bottom: 6px; }
.prose figure.demo.nf-demo { align-items: start; grid-template-columns: 260px 1fr; }
.prose figure.demo.pf-demo { grid-template-columns: 1fr; }
.demo-side .setin { margin-bottom: 10px; }
.nf-say { grid-column: 1 / -1; font-size: 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.nf-say:empty { display: none; }
.sorted { font-size: 13px; color: var(--dim); margin-bottom: 6px; }
table.rot { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; }
table.rot th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); padding: 5px 8px; border-bottom: 1px solid var(--line); font-weight: 600; }
table.rot td { padding: 4px 8px; border-top: 1px solid #eef0f4; font-variant-numeric: tabular-nums; vertical-align: top; }
table.rot td:not(:first-child) { text-align: center; font-weight: 600; }
table.rot th:not(:first-child) { text-align: center; }
table.rot .run { display: block; font-size: 11.5px; color: var(--dim); font-weight: 400; }
table.rot .run b { color: var(--accent); }
table.rot tr[data-i] { cursor: default; }
table.rot tr.hot td { background: #f1f5fd; }
table.rot tr.out td:first-child { color: var(--dim); }
table.rot tr.out .lab { text-decoration: line-through; text-decoration-color: #b8bfcc; }
table.rot .lab { white-space: nowrap; }
table.rot td.lost { color: var(--danger); opacity: .7; }
table.rot td.won { color: #1d6b40; }
table.rot tr.win td { background: var(--accent2); }
table.rot tr.win td:first-child { font-weight: 700; color: #1f4f9f; }
.demo-clock .ordtag { font-size: 13px; font-style: normal; font-weight: 700; fill: var(--accent); font-family: inherit; }
.demo-clock .axis { stroke: #c2413b; stroke-width: 1.5; stroke-dasharray: 6 5; opacity: .6; }
.pf-clocks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pf-cap { text-align: center; font-size: 13px; color: var(--dim); font-weight: 600; }
.forms-in input { width: 150px; font-family: ui-monospace, Menlo, monospace; text-align: left; font-size: 15px; }
@media (max-width: 780px) { .prose figure.demo.nf-demo { grid-template-columns: 1fr; } .pf-clocks { gap: 6px; } table.rot { font-size: 12.5px; } table.rot th, table.rot td { padding: 4px 5px; } }
#nfTable, #pfTable { overflow-x: auto; min-width: 0; }
/* staff figure */
.prose figure.demo.staff-demo { grid-template-columns: 1fr; }
.staff-demo .pick { margin-bottom: 0; }
.staffrow { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px 4px; }
.staff-cap { font-size: 12px; color: var(--dim); font-weight: 600; }
.staffrow svg { display: block; width: 100%; height: auto; }
.staffrow .sline, .staffrow .ledger { stroke: #4b5261; stroke-width: 1; }
.staffrow .clef { font-family: "Bravura Text", "Apple Symbols", "Noto Music", "Segoe UI Symbol", serif; font-size: 68px; fill: var(--text); }
.staffrow .head { fill: var(--text); }
.staffrow .acc { font-size: 17px; fill: var(--text); text-anchor: middle; dominant-baseline: central; font-family: "Apple Symbols", "Noto Music", "Segoe UI Symbol", serif; }
.staffrow .nname { font-size: 12px; fill: var(--dim); text-anchor: middle; font-weight: 600; }
.staffrow .moved { fill: var(--accent); }
.staffrow .ghost { fill: #b8bfcc; }
.staffrow .head.ghost { fill: none; stroke: #6b7280; stroke-width: 1.5; stroke-dasharray: 2.5 2; }
.staffrow .gapbr { fill: none; stroke: #b8bfcc; stroke-width: 1.2; }
.staffrow .gapbr.big { stroke: var(--danger); stroke-width: 2; }
.staffrow .gapn { font-size: 12px; fill: var(--dim); text-anchor: middle; font-weight: 600; }
.staffrow .gapn.big { fill: var(--danger); font-size: 13px; }
.staff-ex { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.staff-ex .btn { font-size: 12.5px; padding: 3px 8px; }
.staff-ex .btn.on { background: var(--accent2); border-color: var(--accent); color: #1f4f9f; }
.staff-lesson { margin: 0; font-size: 14.5px; background: var(--panel2); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 8px 12px; }
.sxnext { font-size: 12.5px; padding: 2px 8px; margin-left: 4px; }
/* Tn and TnI page */
.staffrow .head.orig, .staffrow .acc.orig { fill: var(--accent); }
.staffrow .head.img, .staffrow .acc.img { fill: #e07a1f; }
.staffrow .nname.orig { fill: #1f6ae0; }
.staffrow .nname.img { fill: #b85f12; }
.staffrow .slabel { font-size: 13px; font-weight: 700; fill: var(--dim); }
.staffrow .slabel.orig { fill: #1f6ae0; } .staffrow .slabel.img { fill: #b85f12; }
.staffrow.wide { grid-column: 1 / -1; }
.prose figure.demo.ops-demo { align-items: start; grid-template-columns: 250px 1fr; }
table.maptable td.mono, table.maptable th { white-space: nowrap; }
@media (max-width: 780px) { .prose figure.demo.ops-demo { grid-template-columns: 1fr; } }
.playrow { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.nrow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 10px; }
.nrow .nbtn { padding: 3px 0; font-size: 13px; }
.nrow .nbtn.on, .opchip.on { background: #fdf0e3; border-color: #e07a1f; color: #9a4f0e; font-weight: 600; }
.demo-clock .node.img circle { fill: #e07a1f; stroke: #b85f12; }
.demo-clock .node.img text, .demo-clock .node.both text { fill: #fff; }
.demo-clock .node.both circle { fill: var(--accent); stroke: #e07a1f; stroke-width: 4; }
.demo-clock .opoly { fill: #2f7cf614; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.demo-clock .ipoly { fill: #e07a1f14; stroke: #e07a1f; stroke-width: 2; stroke-dasharray: 5 3; stroke-linejoin: round; }
.demo-clock .maparrow { fill: none; stroke: #e07a1f; stroke-width: 2; opacity: .8; }
.demo-clock .arrowhead { fill: #e07a1f; }
.demo-clock .pairline { stroke: #9aa3b2; stroke-width: 1.5; stroke-dasharray: 3 3; }
.demo-clock .axis { stroke: #c2413b; stroke-width: 1.5; stroke-dasharray: 6 5; opacity: .75; }
table.maptable { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; }
table.maptable th { text-align: left; font-size: 12px; color: var(--dim); padding: 5px 8px; border-bottom: 1px solid var(--line); font-weight: 600; }
table.maptable td { padding: 4px 8px; border-top: 1px solid #eef0f4; font-variant-numeric: tabular-nums; }
b.o, th.o { color: #1f6ae0; } b.i, th.i { color: #b85f12; }
.mapnote { font-size: 13.5px; margin: 8px 0 0 !important; }
.music { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 6px 0 18px; }
.mcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mcard p { font-size: 14px; margin: 0 !important; flex: 1; }
.mhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.opbadge { font-family: Georgia, serif; font-weight: 600; background: #fdf0e3; color: #9a4f0e; border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.mbtns { display: flex; gap: 6px; }
.prose figure.demo.rel-demo { grid-template-columns: 1fr; }
.rel-in { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.rel-in label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--dim); }
.rel-in input { width: 150px; font-family: ui-monospace, Menlo, monospace; }
.rel-demo .examples { margin: 0; }
.rel-tables { display: flex; flex-wrap: wrap; gap: 18px; }
.reltitle { font-size: 12px; color: var(--dim); font-weight: 600; margin-bottom: 4px; }
table.reltable { border-collapse: collapse; background: var(--panel2); font-variant-numeric: tabular-nums; }
table.reltable th, table.reltable td { width: 34px; height: 30px; text-align: center; border: 1px solid var(--line); font-size: 14px; }
table.reltable th { background: var(--panel); font-weight: 700; }
table.reltable td.good { background: #eef4ff; }
table.reltable td.hl { background: #e07a1f; color: #fff; font-weight: 700; }
.opchip { font-size: 13px; padding: 1px 8px; }
#drillOp { width: 120px; }
/* Inversion page */
.prose figure.demo.inv-demo { grid-template-columns: 280px 1fr; align-items: start; }
.inv-demo .examples { margin: 4px 0 0; }
.rulers { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.rrow { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 2px; }
.rrow.win { border-color: #3aa36a; box-shadow: 0 0 0 1px #3aa36a inset; }
.rhead { font-size: 13.5px; }
.rlab { font-weight: 700; } .rlab.orig { color: #1f6ae0; } .rlab.img { color: #b85f12; }
.rwin { background: #d9f2e3; color: #1d6b40; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; }
svg.ruler { display: block; width: 100%; max-width: 520px; height: auto; }
.ruler .rline { stroke: #9aa3b2; stroke-width: 1.5; }
.ruler .rtick { stroke: #9aa3b2; stroke-width: 1; }
.ruler .rnum { font-size: 11px; fill: var(--dim); text-anchor: middle; }
.ruler .rdot.orig { fill: var(--accent); } .ruler .rdot.img { fill: #e07a1f; }
.ruler .rstep { fill: none; stroke-width: 1.5; } .ruler .rstep.orig { stroke: var(--accent); } .ruler .rstep.img { stroke: #e07a1f; }
.ruler .rstepn { font-size: 12px; font-weight: 700; text-anchor: middle; } .ruler .rstepn.orig { fill: #1f6ae0; } .ruler .rstepn.img { fill: #b85f12; }
.ruler .rdecide { fill: none; stroke: var(--danger); stroke-width: 1.5; opacity: .7; } .ruler .rdecide.won { stroke: #3aa36a; opacity: 1; }
.ruler .rdecn { font-size: 12px; font-weight: 700; text-anchor: middle; fill: var(--danger); } .ruler .rdecn.won { fill: #1d6b40; }
#drillIn { width: 120px; }
@media (max-width: 780px) { .prose figure.demo.inv-demo { grid-template-columns: 1fr; } }
/* Common Tones page */
.wide { grid-column: 1 / -1; min-width: 0; }
.ctbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; margin-bottom: 10px; }
.ctbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 112px; padding: 2px 0; background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font: inherit; color: inherit; }
.ctbar:hover { background: var(--accent2); }
.ctbar.on { background: #fdf0e3; border-color: #e07a1f; }
.ctnum { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ctfill { display: block; width: 62%; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; }
.ctbar.on .ctfill { background: #e07a1f; }
.ctlab { font-size: 11px; color: var(--dim); margin-top: 3px; white-space: nowrap; }
table.cttally { margin-bottom: 0; }
table.cttally th, table.cttally td { padding-left: 6px; padding-right: 6px; }
table.cttally td { font-size: 17px; }
table.cttally .hit { background: #fdf0e3; color: #9a4f0e; }
table.maptable tr.kept td { background: #fdf0e3; }
/* Interval Cycles page */
.demo-clock .cystep { stroke: #e07a1f; stroke-width: 2; }
.demo-clock .cyfaint { stroke: #c7ccd6; stroke-width: 1; }
.cypath { font-size: 14px; margin: 0 0 6px !important; line-height: 1.5; }
.cyhide { visibility: hidden; }
table.cytable tr[data-n] { cursor: pointer; }
table.cytable tr[data-n]:hover td { background: var(--accent2); }
.btn.segon { background: #fdf0e3; border-color: #e07a1f; color: #9a4f0e; font-weight: 600; }
.demo-clock.static .node { pointer-events: none; }
.demo-side ul { margin: 0 0 10px; padding-left: 20px; }
/* Twelve-Tone Rows page */
.demo-clock .rwpath { stroke: var(--accent); stroke-width: 2; opacity: .75; }
.demo-clock .rwpath.mid { stroke-dasharray: 4 4; }
.demo-clock .fmpath { stroke: #e07a1f; stroke-width: 2; opacity: .8; }
.demo-clock .fmpath.mid { stroke-dasharray: 4 4; }
.demo-clock .node.first circle { stroke: #1d2129; stroke-width: 4; }
.demo-clock .node.img.first circle { stroke: #7a3d08; }
.demo-clock.building .node:hover circle { fill: var(--accent2); }
.rw-in input { width: 230px; }
.rw-in { margin-bottom: 10px; }
table.rwtable { table-layout: fixed; }
table.rwtable th { width: 108px; }
table.rwtable td { text-align: center; padding: 4px 2px; }
table.rwtable td.h1 b { color: #1f6ae0; }
table.segtable td { vertical-align: top; font-size: 13px; }
table.segtable td a { text-decoration: none; }
.staffrow + .staffrow { margin-top: 6px; }
.mxwrap { overflow-x: auto; margin: 6px 0; }
table.rowmatrix { border-collapse: collapse; margin: 0 auto; font-variant-numeric: tabular-nums; background: var(--panel2); }
table.rowmatrix td { width: 36px; height: 30px; text-align: center; border: 1px solid var(--line); font-size: 14.5px; font-weight: 600; }
table.rowmatrix td.diag { background: #f4f6fa; }
table.rowmatrix td.hl { background: #fdf0e3; color: #9a4f0e; }
table.rowmatrix td.new { background: #eef4ff; color: #1f6ae0; }
table.rowmatrix th { font-family: Georgia, serif; font-size: 13px; font-weight: 600; color: var(--dim); padding: 2px 5px; cursor: pointer; white-space: nowrap; }
table.rowmatrix th:empty { cursor: default; }
table.rowmatrix th[data-f]:hover { color: var(--accent); }
table.rowmatrix th.sel { color: #9a4f0e; background: #fdf0e3; border-radius: 6px; }

/* Matrix maker (Twelve-Tone Rows tab) */
.mkkeys { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; margin: 8px 0 10px; }
.mkkey { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 5px; min-width: 0; }
.mkkey b { font-size: 14px; }
.mkkey span { font-size: 11px; color: var(--dim); }
.prose figure.demo.mkfig { grid-template-columns: 1fr; }
.mkkey i { font-style: normal; font-size: 10px; color: #1f6ae0; font-weight: 600; min-height: 12px; }
.mkkey.used { background: var(--accent2); border-color: var(--accent); }
.mkkey:disabled { opacity: .55; cursor: default; }
.rw-in.mkin input { width: min(340px, 70vw); }
.mkopts { flex-wrap: wrap; gap: 8px; align-items: center; }
table.rowmatrix td.blank { background: transparent; min-width: 36px; }
@media (max-width: 560px) { .mkkeys { grid-template-columns: repeat(6, 1fr); } table.rowmatrix td { width: 22px; min-width: 0; height: 24px; font-size: 12px; padding: 0; } table.rowmatrix td.blank { min-width: 22px; } table.rowmatrix th { font-size: 10.5px; padding: 1px; } }
@media print {
  body.print-mk * { visibility: hidden; }
  body.print-mk #mkMx, body.print-mk #mkMx * { visibility: visible; }
  body.print-mk #mkMx { position: absolute; left: 0; right: 0; top: 0; margin: 0 auto; }
  body.print-mk table.rowmatrix td.diag { background: none; }
}
/* The Matrix maker breaks out of the 760px reading column on wide screens */
.prose figure.demo.mkfig { width: min(1100px, calc(100vw - 32px)); margin-left: calc(50% - min(550px, 50vw - 16px)); }
.mkfig .mxwrap { text-align: center; }
table.rowmatrix.mkmatrix td { width: 60px; height: 42px; font-size: 18px; }
table.rowmatrix.mkmatrix td.blank { min-width: 60px; }
table.rowmatrix.mkmatrix th { font-size: 15px; padding: 2px 8px; }
@media (max-width: 1000px) { table.rowmatrix.mkmatrix td { width: 44px; height: 34px; font-size: 15.5px; } table.rowmatrix.mkmatrix td.blank { min-width: 44px; } table.rowmatrix.mkmatrix th { font-size: 13px; padding: 2px 4px; } }
@media (max-width: 560px) { table.rowmatrix.mkmatrix td { width: 22px; height: 24px; font-size: 12px; } table.rowmatrix.mkmatrix td.blank { min-width: 22px; } table.rowmatrix.mkmatrix th { font-size: 10.5px; padding: 1px; } }
