:root {
  --ink: #2b2420;
  --muted: #7d7069;
  --faint: #b3a89e;
  --line: #ebe3d8;
  --line-strong: #dccfbf;
  --bg: #f2ece3;
  --panel: #fffdf9;
  --hover: #f7f1e8;
  --accent: #9b2c3c;
  --accent-hover: #7e2231;
  --accent-soft: #f7e6e6;
  --gold: #c58a26;
  --gold-soft: #fbf3e2;
  --display-font: "Fraunces", Georgia, serif;
  --bad: #c92a2a;
  --bad-soft: #ffe3e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(60, 35, 20, .06), 0 6px 20px rgba(60, 35, 20, .08);
  --slot-w: 24px;
  --page-font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 13.5px/1.4 var(--page-font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
h3 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.hint { color: var(--muted); font-weight: 400; }
.spacer { flex: 1; }
.sep { width: 1px; height: 20px; background: var(--line); flex: none; }

/* ---------- buttons and inputs ---------- */
.btn, .seg button, .addbar button {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 11px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink); cursor: pointer;
  white-space: nowrap; transition: background .1s, border-color .1s;
}
.btn:hover, .seg button:hover { background: var(--hover); }
.btn:disabled, .seg button:disabled { opacity: .45; cursor: default; background: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
label.btn input[type=file], .mi input[type=file] { display: none; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; padding: 0 9px; }
.seg button:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.seg button:last-child { border-radius: 0 7px 7px 0; }
select, input[type=number], .fields input {
  height: 30px; padding: 0 8px; font-size: 13px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff;
}
select:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input[type=range] { accent-color: var(--accent); }
kbd { font: 11px ui-monospace, Menlo, monospace; background: #fff; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; color: var(--ink); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-rows: auto auto 1fr auto; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 17px; flex: none; }
.title-in { font-size: 16px; font-weight: 600; border: 1px solid transparent; border-radius: 7px; padding: 4px 8px;
  width: 280px; background: none; }
.title-in:hover { border-color: var(--line); }
.title-in:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); background: #fff; }

/* menus */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu .caret { font-size: 10px; color: var(--muted); }
.menu[open] summary { background: var(--hover); }
.mpop { position: absolute; top: calc(100% + 6px); left: 0; min-width: 270px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.mpop button, .mpop .mi { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  padding: 7px 10px; border: none; background: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.mpop button:hover, .mpop .mi:hover { background: var(--hover); }
.mpop .sc { color: var(--faint); font-size: 12px; }
.mpop hr { border: none; border-top: 1px solid var(--line); margin: 6px 4px; }
.mhead { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.recent { max-height: 260px; overflow: auto; display: flex; flex-direction: column; }
.recent button .hint { font-size: 12px; }
.recent:empty::before { content: "Songs you save or open appear here."; color: var(--faint); padding: 4px 10px 6px; font-size: 12px; }

/* photos waiting for transcription */
.photobar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.thumbs figure { margin: 0; position: relative; }
.thumbs img { height: 52px; border-radius: 5px; border: 1px solid var(--line); display: block; }
.thumbs button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;
  border: none; background: #000a; color: #fff; font-size: 11px; line-height: 18px; padding: 0; cursor: pointer; }

.work { display: grid; grid-template-columns: minmax(520px, 52%) 1fr; min-height: 0; }
.editor { display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }

/* ---------- song settings drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 20, 35, .25); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100vw; background: var(--panel); z-index: 41;
  box-shadow: -8px 0 30px rgba(20, 20, 40, .15); display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .2s ease; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 0 18px 24px; overflow: auto; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fields label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; font-weight: 500; }
.fields .wide { grid-column: 1 / -1; }
.fields input, .fields select { min-width: 0; color: var(--ink); font-weight: 400; }
.fields label.check, label.check { flex-direction: row; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); font-weight: 400; cursor: pointer; }
.fields.checks { gap: 10px 12px; }
.mini { font-size: 11px; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; cursor: pointer; margin-left: 6px; }
.allowed .lbl { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.kbd { position: relative; height: 54px; width: calc(7 * 34px); }
.kbd button { position: absolute; top: 0; padding: 0 0 4px; border: 1px solid #888; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center; font-size: 10px; font-weight: 600; }
.kbd button.w { width: 34px; height: 54px; background: #fff; color: #999; border-radius: 0 0 4px 4px; z-index: 1; }
.kbd button.k { width: 24px; height: 34px; background: #555; color: #bbb; border-radius: 0 0 3px 3px; z-index: 2; }
.kbd button.w.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.kbd button.k.on { background: #111; color: #fff; outline: 2px solid var(--accent); }

/* ---------- keyboard shortcuts ---------- */
.help { position: fixed; inset: 0; background: rgba(20, 20, 35, .3); z-index: 50; display: grid; place-items: center; padding: 20px; }
.help-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); width: min(860px, 100%); max-height: 90vh; overflow: auto; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; padding: 0 22px 20px; }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.help dt { white-space: nowrap; }
.help dd { margin: 0; color: #444; }

/* ---------- dock: recording and notation player ---------- */
.dock { background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(20, 20, 40, .05); z-index: 10; }
.dock-tabs { display: flex; align-items: center; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tab { border: none; background: none; padding: 9px 12px 8px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab .hint { font-size: 12px; }
.dock.collapsed .pane { display: none !important; }
.dock.collapsed #dockToggle { transform: rotate(180deg); }
.pane { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 13px; color: var(--muted); }
.bar label { display: flex; align-items: center; gap: 6px; }
.bar input[type=number] { width: 64px; }
.bar input[type=range] { width: 90px; }
.atime { font-variant-numeric: tabular-nums; color: var(--ink); min-width: 92px; font-weight: 500; }
#aPlay, #playSong { min-width: 84px; justify-content: center; }
#wave { width: 100%; height: 104px; border: 1px solid var(--line); border-radius: var(--radius); cursor: text; touch-action: none; display: block; }
#overview { width: 100%; height: 24px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; touch-action: none; display: block; margin-top: -3px; }
.play-vis { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

/* ---------- line editor ---------- */
.lines { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px 16px; outline: none; }
.line { display: flex; align-items: flex-start; gap: 8px; padding: 6px 4px; border-radius: 6px; }
.line.active { background: var(--gold-soft); }
.line .lnum { width: 22px; text-align: right; color: var(--muted); font-size: 12px; padding-top: 7px; flex: none; }
.line .rows { display: flex; flex-direction: column; gap: 2px; }
.srow, .lrow { display: flex; align-items: center; }
.ecol { display: flex; padding: 0 3px; }
.ebar { width: 16px; text-align: center; color: #999; font-size: 13px; flex: none; }
.slot { width: var(--slot-w); height: 30px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; position: relative; border-bottom: 1px solid var(--line-strong); cursor: text; user-select: none; }
.slot.b { font-weight: 800; }
.slot.cur { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.lines:not(:focus-within) .slot.cur { background: #f1ebe2; box-shadow: none; }
.slot.bad { color: var(--bad); background: var(--bad-soft); }
.slot.up::after, .slot.lo::after, .n.up::after, .n.lo::after {
  /* drawn with a border, not a background, so it prints even with "Background graphics" off */
  content: ""; position: absolute; left: 50%; width: 0; height: 0; margin-left: -.1em;
  border: .1em solid currentColor; border-radius: 50%;
}
.slot.up::after { top: 2px; }
.slot.lo::after { bottom: 3px; }

/* beat labels above slots */
.lines.beats .srow { padding-top: 12px; }
.blab { position: absolute; top: -12px; left: -4px; right: -4px; text-align: center; font-size: 9.5px;
  font-weight: 400; color: #8a8a95; line-height: 1; }

/* anuswaram: small grace notes above a note */
.lines.anu .srow { padding-top: 12px; }
.lines.anu.beats .srow { padding-top: 22px; }
.lines.anu.beats .blab { top: -22px; }
.slot .anu, .sub .anu { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); font-size: 10px;
  font-weight: 400; color: #a8671a; line-height: 1; white-space: nowrap; display: flex; gap: 1px; }
.sub .anu { top: -17px; }
.slot .anu .b, .sub .anu .b { font-weight: 800; }
.anu.editing { min-width: 10px; min-height: 11px; padding: 0 2px; background: #fff3bf; outline: 1px solid #f59f00; border-radius: 2px; }
.anu.editing::after { content: ""; width: 1px; height: 10px; background: #f59f00; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* 2 or 4 notes in one slot: underlined once / twice */
.slot.grp { gap: 1px; font-size: 13px; }
.slot.grp.u2 { font-size: 12px; }
.slot.grp::before { content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; border-bottom: 1.5px solid currentColor; }
.slot.grp.u2::before { border-bottom: 4px double currentColor; bottom: 1px; }
.sub { position: relative; display: inline-flex; justify-content: center; min-width: 8px; height: 17px;
  align-items: center; border-radius: 2px; margin-top: -4px; }
.sub:empty { background: #ece4d8; width: 6px; height: 10px; margin-top: 2px; }
.sub.b { font-weight: 800; }
.sub.bad { color: var(--bad); background: var(--bad-soft); }
.sub.subcur { background: #ecc3c7; }
.sub.up::after, .sub.lo::after {
  content: ""; position: absolute; left: 50%; width: 0; height: 0; margin-left: -1.5px; border: 1.5px solid currentColor; border-radius: 50%;
}
.sub.up::after { top: -3px; }
.sub.lo::after { bottom: -2px; }
.lrow input { font-size: 12px; padding: 2px 3px; border: 1px solid transparent; border-radius: 3px;
  background: transparent; color: #444; margin: 0 3px; }
.lrow input:hover { border-color: var(--line); }
.lrow input:focus { border-color: var(--accent); background: #fff; outline: none; }
.lrow input::placeholder { color: #ccc; }
.lnote-in { display: block; width: 100%; margin-top: 4px; font-size: 12px; font-style: italic; color: #555; padding: 3px 5px;
  border: 1px dashed transparent; border-radius: 4px; background: transparent; }
.line:hover .lnote-in, .line.active .lnote-in { border-color: var(--line); }
.lnote-in:focus { border: 1px solid var(--accent); background: #fff; outline: none; }
.lnote-in::placeholder { color: #ccc; }
.ltools { display: flex; align-items: center; gap: 4px; padding-top: 4px; margin-left: auto; flex: none; }
.ltools input.rep { width: 32px; font-size: 12px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; }
.ltools button { border: none; background: none; color: #aaa; cursor: pointer; font-size: 15px; padding: 2px 4px; }
.ltools button { font-size: 14px; padding: 2px 3px; }
.ltools button:hover { color: var(--ink); }
.ltools button.at { font-size: 11px; color: #2b8a3e; background: #ebfbee; border-radius: 4px; padding: 1px 5px;
  font-variant-numeric: tabular-nums; }
.ltools button.at:hover { color: #fff; background: #2f9e44; }
.line.rec { box-shadow: inset 3px 0 0 #2f9e44; }
.page tbody.rec tr.sw td { background: #ebfbee; }
@media print { .page tbody.rec tr.sw td { background: none; } }
.ltools button[data-act=del]:hover { color: var(--bad); }
.ltools button:disabled { opacity: .35; cursor: default; }
.line .tag { font-size: 11px; color: var(--muted); padding-top: 6px; width: 70px; flex: none; }
.line input.txt { flex: 1; font-size: 13px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; }
.line.sec input.txt { font-weight: 600; }

.addbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); }
.status { flex: 1; text-align: right; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.err { color: var(--bad); }

/* ---------- player ---------- */
.beat-dots { display: flex; align-items: center; gap: 4px; }
.bcol { display: flex; gap: 4px; padding: 0 3px; }
.bbar { color: #999; font-size: 13px; }
.beat-dots i { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid var(--line); font: 600 10px/18px var(--page-font);
  text-align: center; color: var(--muted); font-style: normal; transition: background .05s; }
.beat-dots i.clap { border: 2px solid #ddb0b5; line-height: 16px; }
.beat-dots i.first { border: 2px solid var(--accent); line-height: 16px; }
.beat-dots i.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.piano-wrap { overflow-x: auto; padding-bottom: 2px; }
.piano { position: relative; height: 78px; }
.pk { position: absolute; top: 0; padding: 0 0 4px; border: 1px solid #999; cursor: pointer; display: flex; align-items: flex-end;
  justify-content: center; font: 600 8.5px var(--page-font); }
.pk.w { width: 24px; height: 78px; background: #fff; color: #bbb; border-radius: 0 0 4px 4px; z-index: 1; }
.pk.k { width: 16px; height: 48px; background: #444; color: #888; border-radius: 0 0 3px 3px; z-index: 2; }
.pk.ok.w { color: #333; }
.pk.ok.k { color: #fff; }
.pk.sa.w { background: #fff4e0; }
.pk.sa.k { background: #8a5a00; }
.pk.lit { background: var(--accent) !important; color: #fff !important; }
.pl { position: relative; }
.pl.up::after, .pl.lo::after { content: ""; position: absolute; left: 50%; margin-left: -1.5px; width: 0; height: 0;
  border: 1.5px solid currentColor; border-radius: 50%; }
.pl.up::after { top: -5px; }
.pl.lo::after { bottom: -4px; }
.page td.lbl[data-play] { cursor: pointer; position: relative; }
.page td.lbl[data-play]:hover { color: var(--accent); }
.page td.lbl[data-play]:hover::before { content: "▶"; position: absolute; left: -1.4em; bottom: .15em; font-size: 9pt; color: var(--accent); }
.ltools button[data-act=play] { color: var(--accent); }
.slot.playing { background: #ffe8a3 !important; }
.n.playing { color: var(--accent); }

/* ---------- preview ---------- */
.preview { overflow: auto; padding: 28px; min-width: 0; background: #e9e1d5; }
.page {
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  width: 210mm; min-height: 297mm; background: #fff; color: #000; transform-origin: top left;
  padding: 18mm 16mm 22mm; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(20,20,40,.08); border-radius: 2px; position: relative; font-family: var(--page-font);
}
.page .n[data-l] { cursor: pointer; }
.hdr { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  font-size: 10.5pt; line-height: 1.45; padding-bottom: 10pt; border-bottom: 1px solid #000; margin-bottom: 18pt; }
.hdr .title { font-weight: 800; font-size: 11.5pt; }
.hdr .cat { font-style: italic; }
.hdr .right { text-align: right; }

table.song { border-collapse: collapse; font-size: 11pt; }
table.song td { padding: 0 1.1em 0 0; white-space: nowrap; vertical-align: baseline; }
table.song tbody { break-inside: avoid; }
table.song td.lbl { padding-right: 1.2em; }
table.song td.bar { padding-right: .9em; }
table.song td.rep { padding-left: .2em; padding-right: 0; }
table.song tr.sw td { padding-top: 14pt; line-height: 1.5; }
table.song tr.ly td { font-size: 10pt; color: #222; padding-top: 5pt; }
table.song tr.txt td { padding-top: 16pt; font-size: 10.5pt; }
table.song tr.sw.anu td { padding-top: 24pt; }
table.song.beats tr.sw.anu td { padding-top: 14pt; }
table.song tr.sw.anu .bg { row-gap: 1.1em; }
.n .anu { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% - .2em); font-size: .62em;
  font-weight: 400; display: inline-flex; gap: .12em; white-space: nowrap; line-height: 1.2; }
.n.up > .anu { bottom: calc(100% + .32em); }
table.song tr.lnote td { font-size: 9.5pt; font-style: italic; color: #444; padding-top: 4pt; white-space: normal; }
table.song tr.cnt td { font-size: 10pt; font-weight: 600; color: #666; }
table.song tr.cnt .g { gap: .32em; }
table.song tr.sec td { padding-top: 18pt; font-weight: 600; font-size: 10.5pt; }
.g { display: inline-flex; gap: .32em; }
.n { position: relative; display: inline-block; font-weight: 400; }
.n.b { font-weight: 800; }
.n.up::after { top: -.2em; }
.n.lo::after { bottom: -.2em; }
/* the line(s) sit below any lower-octave dots */
.g { align-items: baseline; }
/* Every cell of a labelled row is a 2-row grid, so labels share one baseline and notes another. */
.bg { display: inline-grid; grid-auto-flow: column; grid-template-rows: auto auto; column-gap: .45em;
  justify-items: center; align-items: baseline; vertical-align: baseline; }
.bl { font-size: 7.5pt; color: #777; line-height: 1.6; }
.bn { line-height: 1.5; }
.fast { display: inline-flex; align-items: baseline; gap: .14em; padding-bottom: .3em; position: relative;
  border-bottom: .08em solid currentColor; line-height: 1.15; }
.fast.u2::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.28em; border-bottom: .08em solid currentColor; }

.foot { position: absolute; left: 0; right: 0; bottom: 12mm; text-align: center;
  font-weight: 800; font-size: 13pt; color: #888; }
table.frame { border-collapse: collapse; width: 100%; }
table.frame > * > tr > td { padding: 0; }
table.frame tfoot { display: none; }
table.frame tfoot td { height: 16mm; }

@page { size: A4; margin: 18mm 16mm 12mm; }
@media print {
  body { background: #fff; }
  .app, .work { display: block; height: auto; }
  .editor, .topbar, .photobar, .dock, .drawer, .scrim, .help { display: none !important; }
  .preview { padding: 0; overflow: visible; height: auto !important; background: none; }
  .page { width: auto; min-height: 0; padding: 0; box-shadow: none; transform: none !important; }
  .foot { position: fixed; bottom: 0; }
  table.frame tfoot { display: table-footer-group; }
}

/* ---------- quieter editor: placeholders and line buttons only where you are working ---------- */
.fields > * { min-width: 0; }
.fields select, .fields input { width: 100%; }
select, input[type=number], .fields input { color: var(--ink); }
.line:not(.active) .lrow input::placeholder { color: transparent; }
.line:not(.active) .lnote-in:placeholder-shown { display: none; }
.line .ltools > * { transition: opacity .1s; }
.line:not(:hover):not(.active) .ltools > * { opacity: 0; }
.line:not(:hover):not(.active) .ltools > .at,
.line:not(:hover):not(.active) .ltools > input.rep:not(:placeholder-shown) { opacity: 1; }
.ltools input.rep:placeholder-shown { border-style: dashed; }
.lines { padding: 10px 12px 24px; }
.line { padding: 6px 6px; }
.line.active { background: var(--gold-soft); }
.fields input[type=checkbox] { width: 15px; height: 15px; flex: none; }

/* ---------- warm finish: cards on a sandalwood desk, maroon and gold accents ---------- */
body { background: var(--bg); }
.topbar { padding: 12px 18px 11px; gap: 10px; box-shadow: 0 1px 0 var(--line); border-bottom: none; }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold)); }
.logo { width: 34px; height: 34px; border-radius: 10px; font-size: 18px;
  background: linear-gradient(140deg, #b23a48, var(--accent) 55%, #7a2433); box-shadow: 0 2px 6px rgba(155, 44, 60, .3); }
.title-in { font: 600 20px/1.2 var(--display-font); letter-spacing: -.01em; width: 320px; }
h2 { font: 600 18px var(--display-font); }

.btn, .seg button, .addbar button { height: 32px; border-radius: 8px; box-shadow: 0 1px 0 rgba(60, 35, 20, .04); background: var(--panel); }
.seg button { border-radius: 0; box-shadow: none; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.btn.primary { background: linear-gradient(180deg, #a8323f, var(--accent)); border-color: var(--accent-hover);
  box-shadow: 0 1px 2px rgba(126, 34, 49, .3), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { box-shadow: none; }
.btn:disabled, .seg button:disabled { background: var(--panel); }
select, input[type=number], .fields input { height: 32px; border-radius: 8px; background: var(--panel); }
select:focus, input:focus { outline: 3px solid var(--accent-soft); }
.mpop { border-radius: 12px; background: var(--panel); }

.work { padding: 14px 14px 0; gap: 14px; }
.editor { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.preview { border: 1px solid #ddd2c3; border-radius: var(--radius); box-shadow: inset 0 1px 3px rgba(60, 35, 20, .06); }
.addbar { background: #fbf7f1; border-top-color: var(--line); padding: 10px 14px; }

.line { border-radius: 10px; }
.line.active { box-shadow: inset 0 0 0 1px #f0dfbf; }
.line.rec.active { box-shadow: inset 3px 0 0 #2f9e44, inset 0 0 0 1px #f0dfbf; }
.line .lnum { font-variant-numeric: tabular-nums; }
.slot.cur { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 4px 4px 0 0; }
.ebar { color: var(--faint); }

.dock { margin: 14px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.dock-tabs { padding: 8px 10px; gap: 4px; }
.tab { border: none; border-radius: 8px; padding: 6px 12px; margin: 0; }
.tab:hover { background: var(--hover); }
.tab.on { background: var(--accent-soft); color: var(--accent); }
.tab.on .hint { color: #b06a74; }
.pane { padding: 12px 14px 14px; }
#wave, #overview { border-color: var(--line); }

.drawer, .help-card { background: var(--panel); }
.drawer { border-radius: 14px 0 0 14px; }
.help-card { border-radius: 14px; }
.scrim, .help { background: rgba(50, 30, 20, .28); }
.kbd button.w.on { background: var(--accent-soft); color: var(--accent); }
