:root {
  --ink: #1d2433;
  --ink-soft: #5b6475;
  --bg: #f1ede4;
  --paper: #fffdf8;
  --line: #ddd5c4;
  --accent: #7a3b2e;
  --accent-ink: #fff;
  --c1: #17914a;   /* root  */
  --c3: #1f6fd6;   /* third */
  --c5: #e8830c;   /* fifth */
  --c7: #d42a3c;   /* seventh */
  --c9: #8b3fc4;   /* ninth */
  --ok: #17914a;
  --bad: #c62a3a;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", "Arial Hebrew", "Noto Sans Hebrew", Arial, sans-serif;
  font-size: 16px; line-height: 1.45;
  min-height: 100vh; display: flex; flex-direction: column;
}
button { font: inherit; }

.top {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--ink); color: #f6f1e6;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { font-size: 44px; line-height: 1; font-family: "Segoe UI Symbol", "Noto Music", serif; color: #e6c98f; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: .2px; }
.meta { margin: 2px 0 0; color: #cfc7b6; font-size: 14.5px; }
.meta bdi { font-family: Georgia, "Times New Roman", serif; font-style: italic; color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
  border: 1px solid #ffffff40; background: #ffffff14; color: inherit; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; transition: background .15s, transform .05s;
}
.btn:hover:not(:disabled) { background: #ffffff2b; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: #e6c98f; border-color: #e6c98f; color: #2a1f10; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #f0d7a4; }
.btn.small { padding: 5px 10px; font-size: 14px; }
.goto { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #cfc7b6; }
.goto input { width: 64px; padding: 5px 6px; border-radius: 6px; border: 1px solid #ffffff40; background: #ffffff14; color: #fff; font: inherit; }

.statusbar {
  display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; justify-content: space-between;
  padding: 10px 24px; background: #e8e2d4; border-bottom: 1px solid var(--line);
}
.progress { display: flex; align-items: center; gap: 10px; flex: 1 1 240px; max-width: 460px; }
.progress-track { flex: 1; height: 8px; background: #d3cbb8; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .35s; }
.progress-text { font-size: 14px; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; font-size: 14px; color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.c1 { background: var(--c1); } .dot.c3 { background: var(--c3); } .dot.c5 { background: var(--c5); }
.dot.c7 { background: var(--c7); } .dot.c0 { background: #111; }

.hint { margin: 12px 24px 0; font-size: 14.5px; color: var(--ink-soft); }
.q-demo { display: inline-block; min-width: 22px; text-align: center; border: 1.5px solid var(--accent); color: var(--accent); border-radius: 6px; background: #fff; font-family: Georgia, serif; }

#stage { flex: 1; padding: 12px 24px 28px; position: relative; }
#score-wrap {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 2px 10px #0000000f; overflow: hidden; min-height: 200px;
}
#score svg { display: block; }
#overlay { position: absolute; inset: 0; pointer-events: none; }
#overlay > * { pointer-events: auto; }
.loading { position: absolute; inset: 12px 24px auto; padding: 40px; text-align: center; color: var(--ink-soft); }

/* score colouring */
#score g.harm { opacity: 0; }
#score g.note.r1, #score g.note.r1 * { fill: var(--c1); stroke: var(--c1); color: var(--c1); }
#score g.note.r3, #score g.note.r3 * { fill: var(--c3); stroke: var(--c3); color: var(--c3); }
#score g.note.r5, #score g.note.r5 * { fill: var(--c5); stroke: var(--c5); color: var(--c5); }
#score g.note.r7, #score g.note.r7 * { fill: var(--c7); stroke: var(--c7); color: var(--c7); }
#score g.note.r9, #score g.note.r9 * { fill: var(--c9); stroke: var(--c9); color: var(--c9); }
#score g.note { transition: fill .25s; }
#score g.note.now { filter: drop-shadow(0 0 5px #f5b301) drop-shadow(0 0 2px #f5b301); }
#score g.note.pop { animation: notepop .5s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes notepop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* chord slots under the staff */
.slot {
  position: absolute; transform: translateX(-50%);
  height: 26px; min-width: 26px; padding: 0 5px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1; white-space: nowrap;
  direction: ltr;
}
button.slot { border: 1.5px solid var(--accent); background: #fff; color: var(--accent); cursor: pointer; font-weight: 700; }
button.slot:hover { background: #fbeee9; }
button.slot.active { background: var(--accent); color: #fff; box-shadow: 0 0 0 3px #7a3b2e33; }
button.slot.next { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 #7a3b2e55; } 50% { box-shadow: 0 0 0 6px #7a3b2e00; } }
.slot.solved { color: var(--ink); background: #e9f6ee; border: 1px solid #bfe3cd; }
.slot.solved::after { content: "✓"; color: var(--ok); font-family: "Segoe UI", sans-serif; font-size: 12px; font-weight: 700; margin-inline-start: 2px; }
.slot.revealed { background: #fdf1e3; border: 1px solid #f0d3ae; }
.slot.revealed::after { content: ""; }
.slot.given { color: var(--ink-soft); background: #f1eee7; border: 1px dashed #cfc7b6; }
.slot.given::after { content: ""; }
.slot.shake { animation: shake .35s; }
@keyframes shake { 20% { margin-left: -5px; } 40% { margin-left: 5px; } 60% { margin-left: -3px; } 80% { margin-left: 3px; } }
.keytag {
  position: absolute; transform: translateX(-50%); font-family: Georgia, serif; font-size: 12.5px; font-weight: 700;
  color: #2c5aa0; white-space: nowrap; direction: ltr; cursor: default;
}

/* roman numeral typography */
.rn { display: inline-flex; align-items: center; }
.rn .q { font-size: .8em; align-self: flex-start; margin-top: -2px; }
.figs { display: inline-flex; flex-direction: column; font-size: .68em; line-height: .95; margin-left: 1px; text-align: left; font-weight: 600; }
.figs.one { align-self: flex-start; margin-top: -2px; }
.rn .sec { margin-left: 1px; }

/* popover */
.popover {
  position: absolute; z-index: 30; width: 330px; max-width: calc(100vw - 16px);
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px;
  box-shadow: 0 12px 34px #1d243340, 0 2px 6px #1d24331f;
}
.pop-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); margin-bottom: 4px; }
.pop-head b { color: #2c5aa0; font-family: Georgia, serif; }
.pop-close { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-soft); padding: 0 4px; }
.pop-label { font-size: 13px; font-weight: 650; margin: 8px 0 5px; }
.opts { display: flex; gap: 5px; flex-wrap: wrap; }
.opt {
  border: 1.5px solid var(--line); background: #faf8f3; border-radius: 8px; cursor: pointer; color: var(--ink);
  min-width: 37px; height: 40px; padding: 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center;
}
.opt:hover { border-color: var(--accent); }
.opt.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt.wrong { border-color: var(--bad); background: #fdecee; color: var(--bad); }
.opt.right { border-color: var(--ok); background: #e9f6ee; color: var(--ok); }
.opt .figs { font-size: .82em; line-height: 1; margin: 0; align-items: center; }
.inv-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.inv-kind { font-size: 13px; color: var(--ink-soft); width: 68px; flex: none; }
.pop-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pop-foot .btn { border-color: var(--line); background: #f4f1ea; color: var(--ink); }
.pop-foot .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pop-foot .btn.primary:hover:not(:disabled) { background: #8f4a3b; }
.pop-msg { font-size: 13.5px; color: var(--bad); flex: 1 1 120px; }
.pop-msg.good { color: var(--ok); }
.linkbtn { border: 0; background: none; color: #2c5aa0; text-decoration: underline; cursor: pointer; font-size: 13.5px; padding: 0; }

/* finish */
.done { position: fixed; inset: auto 0 22px 0; display: flex; justify-content: center; z-index: 40; pointer-events: none; }
.done[hidden] { display: none; }
.done-card {
  pointer-events: auto; background: var(--ink); color: #fff; border-radius: 16px; padding: 16px 22px; text-align: center;
  box-shadow: 0 14px 40px #00000059; animation: rise .5s cubic-bezier(.2,1.4,.4,1);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.done-title { font-size: 26px; font-weight: 700; color: #e6c98f; }
.done-sub { font-size: 14.5px; color: #d9d2c3; margin: 2px 0 12px; }
.done-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 35; }
#confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.foot { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; padding: 10px 24px 16px; font-size: 12.5px; color: var(--ink-soft); }

@media (max-width: 640px) {
  .top, .statusbar { padding-inline: 14px; }
  #stage { padding-inline: 8px; }
  .hint { margin-inline: 14px; }
  .brand-mark { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* option buttons: centre single figures; dismiss button on the finish card */
.opt .figs.one { align-self: center; margin-top: 0; }
.done-card { position: relative; }
.done-x { position: absolute; top: 6px; inset-inline-end: 10px; border: 0; background: none; color: #cfc7b6; font-size: 20px; cursor: pointer; line-height: 1; }

/* line-by-line navigation */
.linebar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.linebar[hidden] { display: none; }
.line-info { flex: 1 1 260px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.line-pos { font-weight: 700; font-size: 17px; }
.line-key { font-size: 16px; color: var(--ink-soft); }
.line-key[hidden] { display: none; }
.line-key b { font-family: Georgia, serif; font-size: 22px; color: #2c5aa0; margin: 0 4px; }
.line-key #line-key-he { color: var(--ink); font-weight: 600; }
.line-dots { display: inline-flex; gap: 5px; align-items: center; }
.ldot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid #b9b09c; background: #fff; padding: 0; cursor: pointer; }
.ldot.ok { background: var(--ok); border-color: var(--ok); }
.ldot.cur { box-shadow: 0 0 0 3px #2c5aa055; }
.navbtn {
  border: 1px solid var(--line); background: #f4f1ea; color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; font: inherit;
}
.navbtn:hover:not(:disabled) { background: #ebe6da; }
.navbtn:disabled { opacity: .4; cursor: default; }
.navbtn[hidden] { display: none; }
.navbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.navbtn.primary:hover:not(:disabled) { background: #8f4a3b; }
.navbtn.ghost { background: none; color: #2c5aa0; border-color: #c9d6ea; }
.navbtn.pulse { animation: pulse 1.4s ease-in-out infinite; }

/* playback cursor */
.cursor {
  position: absolute; display: none; width: 14px; margin-left: -7px; border-radius: 7px; pointer-events: none !important;
  background: linear-gradient(90deg, #f5b30100, #f5b30166 40%, #f5b30166 60%, #f5b30100);
}
.cursor::after { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: #e09a00; border-radius: 2px; }
.rn .kp { font-size: .75em; color: #2c5aa0; margin-right: 3px; }

/* click-on-the-chord interaction (replaces the question-mark boxes) */
.zone { position: absolute; border: 0; padding: 0; background: transparent; border-radius: 9px; cursor: pointer; transition: background .12s; }
@media (hover: hover) { /* (on a phone a tapped chord would stay lit) */
  .zone.open:hover { background: #2c5aa01c; }
  .zone.answered:hover { background: #17914a12; }
}
.zone.next { animation: zonepulse 1.8s ease-in-out infinite; }
@keyframes zonepulse { 0%,100% { background: #2c5aa000; } 50% { background: #2c5aa01f; } }
.zone.active, .zone.active:hover { background: #2c5aa026; box-shadow: inset 0 0 0 2px #2c5aa099; animation: none; }
.zone.shake { animation: zonebad .45s; }
@keyframes zonebad { 0%,100% { background: #c62a3a00; } 30% { background: #c62a3a40; } }
.zone:focus-visible { outline: 2px solid #2c5aa0; }
.lab {
  position: absolute; transform: translateX(-50%); pointer-events: none !important; white-space: nowrap; direction: ltr;
  font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 26px; color: var(--ink); font-weight: 600;
}
.lab.revealed { color: #a8661a; }
.lab.given { color: var(--ink-soft); font-weight: 400; font-style: italic; }
.lab.solved::after { content: "✓"; color: var(--ok); font-family: "Segoe UI", sans-serif; font-size: 11px; font-weight: 700; margin-left: 3px; vertical-align: top; }

/* the notes of the chord being pointed at */
/* the notes of the chord being looked at, also those held over from before: a tight blue glow on the note itself */
#score g.note.hl { filter: drop-shadow(0 0 1.5px rgba(11, 87, 208, .7)); }
#score g.note.nct { opacity: .28; }

/* "of which degree" row for secondary chords */
.opt.of { min-width: 37px; font-size: 15px; }

/* where another key begins (and where the main key returns): a plain mark, no words */
.keymark { position: absolute; width: 9px; height: 9px; margin-left: -4.5px; background: #2c5aa0; transform: rotate(45deg); border-radius: 1.5px; pointer-events: none !important; opacity: .85; }

/* previous / next line: two arrows side by side */
.line-arrows { display: flex; gap: 6px; }
.navbtn.arrow { min-width: 46px; padding: 6px 12px; font-size: 18px; line-height: 1; }

/* top bar: plain icons, no frames */
.iconbtn { background: none; border: 0; padding: 6px; margin: 0 2px; color: #f6f1e6; cursor: pointer; border-radius: 6px; line-height: 0; }
.iconbtn:hover:not(:disabled) { color: #e6c98f; background: #ffffff14; }
.iconbtn:disabled { opacity: .4; cursor: default; }
.iconbtn svg { display: block; }

/* the chord's area joined with its held notes: drawn as one shape (see markChord) */
.areashape { position: absolute; left: 0; top: 0; pointer-events: none !important; overflow: visible; }
.zone.merged, .zone.merged:hover, .zone.merged.active { background: transparent !important; box-shadow: none !important; animation: none !important; }
/* line bar: everything together at the start of the line */
.linebar { justify-content: flex-start; }
.line-dots { margin-inline-start: 8px; }

/* toolbar: one even row of plain icons; the chorale number is a bare field with a thin underline */
.actions { gap: 4px; flex-wrap: nowrap; }
.iconbtn { width: 40px; height: 40px; padding: 8px; margin: 0; display: inline-flex; align-items: center; justify-content: center; }
.tool-sep { width: 1px; height: 24px; background: #ffffff2e; margin: 0 8px; }
.goto { gap: 2px; color: #cfc7b6; font-size: 16px; }
.goto-hash { font-size: 17px; opacity: .7; padding-inline-end: 2px; }
.goto input { width: 46px; height: 32px; padding: 0 2px; border: 0; border-bottom: 1.5px solid #ffffff4d; border-radius: 0; background: transparent; color: #f6f1e6; font: inherit; font-size: 17px; text-align: center; -moz-appearance: textfield; }
.goto input:focus { outline: none; border-bottom-color: #e6c98f; }
.goto input::-webkit-outer-spin-button, .goto input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* the joined shape: same look as the area of a chosen chord */
.areashape path { fill: rgba(44, 90, 160, .11); stroke: none; }
.areashape.strong path { fill: rgba(44, 90, 160, .15); stroke: rgba(44, 90, 160, .6); stroke-width: 2; stroke-linejoin: round; }
.goto-label { font-size: 15px; color: #cfc7b6; padding-inline-end: 4px; }

/* both arrows look the same; at the first or last line the unusable one is only slightly dimmed */
.navbtn.arrow:disabled { opacity: .55; }

/* the line dots are not used: "line 2 of 6" says it already */
.line-dots { display: none !important; }

/* success marks */
.line-ok { color: #17914a; font-weight: 800; margin-inline-start: 4px; }
.flash-check { position: absolute; z-index: 45; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%;
  background: #17914a; color: #fff; display: flex; align-items: center; justify-content: center; pointer-events: none;
  box-shadow: 0 8px 26px rgba(23, 145, 74, .35); animation: flashcheck 1.2s ease-out forwards; }
.flash-check svg { width: 58%; height: 58%; }
.flash-check.big { width: 150px; height: 150px; margin: -75px 0 0 -75px; animation-duration: 1.7s; }
@keyframes flashcheck { 0% { transform: scale(.4); opacity: 0; } 18% { transform: scale(1.08); opacity: 1; } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }
/* end of the chorale: a small bar with a check and two icons, no words */
.done-card { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 40px; }
.done-check { width: 40px; height: 40px; border-radius: 50%; background: #17914a; color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-inline-end: 6px; }
.done-card .iconbtn { color: #fff; }

/* credits */
.credits { line-height: 1.6; }
.credits a { color: inherit; text-decoration: underline; text-decoration-color: rgba(0,0,0,.25); }
.credits .owner { color: #333; }

/* the cadence question: a bracket under the line's last two chords */
.cad {
  position: absolute; height: 28px; border: 0; padding: 0; background: none; cursor: pointer;
  display: flex; justify-content: center; align-items: flex-end; font-family: inherit; direction: rtl;
}
.cad::before {
  content: ""; position: absolute; left: 4px; right: 4px; top: 0; height: 7px;
  border: 1.5px solid #2c5aa080; border-top: 0; border-radius: 0 0 6px 6px;
}
.cad .cad-txt { position: relative; font-size: 14.5px; font-weight: 700; line-height: 19px; white-space: nowrap; padding: 0 6px; border-radius: 8px; }
.cad.open .cad-txt { color: #2c5aa0; background: #2c5aa014; }
.cad.open:hover .cad-txt { background: #2c5aa029; }
.cad.solved .cad-txt { color: var(--ink); }
.cad.solved .cad-txt::after { content: " ✓"; color: var(--ok); font-size: 11px; }
.cad.revealed .cad-txt { color: #a8661a; }
.cad.solved::before, .cad.revealed::before { border-color: #9aa3b5; }
.cad.active::before { border-color: #2c5aa0; border-width: 2px; }
.cad.active .cad-txt { background: #2c5aa026; box-shadow: inset 0 0 0 1.5px #2c5aa099; }
.cad.shake { animation: shake .35s; }
.cad-area { position: absolute; pointer-events: none; border-radius: 9px; background: #2c5aa026; box-shadow: inset 0 0 0 2px #2c5aa099; }
.cadpop { width: 300px; }
.cad-q { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.opts-cad { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.opt.cad-opt { font-family: inherit; font-size: 14.5px; height: 38px; }
.cad-name { font-family: inherit; }

/* the degree row holds I-VII and N (the Neapolitan) on one line */
.opts-deg { flex-wrap: nowrap; gap: 4px; }
.opts-deg .opt { flex: 1 1 0; min-width: 0; padding: 0 2px; font-size: 16px; }
.opts-deg .opt.deg-n { margin-inline-start: 6px; font-style: italic; }

/* our own analysis, before it is checked */
.own-badge { display: inline-block; margin-inline-start: 6px; padding: 0 7px; border-radius: 8px; font-size: 12px; font-weight: 700; background: #f5b301; color: #2a1f10; vertical-align: 1px; }

/* corrections to the draft */
.lab.fixed { color: #7a2fb0; }
.lab.fixed::after { content: "\270E"; font-size: 11px; margin-left: 2px; color: #7a2fb0; }
.popover.fixing { border-color: #7a2fb0; box-shadow: 0 0 0 2px #7a2fb055, 0 12px 34px #1d243340; }
.fix-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 8px 16px; border-radius: 20px; z-index: 60; font-size: 15px; }
.fix-card textarea { width: 100%; height: 140px; font: 12px/1.4 Consolas, monospace; margin: 8px 0; }

/* checking the draft: the teacher's own answer */
.pop-teacher { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed #c9b8e6; font-size: 13px; color: #563599; }
.pop-teacher[hidden] { display: none; }
.pop-teacher .btn { border-color: #b9a2e0; background: #f5f0fd; color: #3d1f78; }

/* checking the draft: the other answers that count, under the chord's name */
.lab.alt-lab { font-size: 14px; line-height: 20px; color: #8a8f9c; font-weight: 500; }
.lab.alt-lab::after { content: none; }
.lab.alt-lab .alt-key { font-family: "Segoe UI", sans-serif; font-size: 11px; }

/* English (left to right): the few places written right-to-left on purpose for Hebrew */
html[dir="ltr"] .cad, html[dir="ltr"] .mail-dlg form { direction: ltr; }

/* a phone: the toolbar must fit in the width (with the mail button it did not) */
@media (max-width: 430px) {
  .goto-label { display: none; }
  .tool-sep { margin: 0 4px; }
  .iconbtn { width: 36px; padding: 6px; }
}

/* a phone (upright or sideways): the open cadence question is the bracket alone (no word), still easy to tap */
@media (max-width: 640px), (max-height: 520px) and (orientation: landscape) {
  .cad.open { height: 22px; }
  .cad.open .cad-txt { display: none; }
  .cad.open::before { height: 9px; border-width: 2px; }
}

/* a phone held sideways (a low screen): a slim header and line bar, so the whole line of music fits;
   the chord and cadence windows stand beside the music (js: placeBeside) */
@media (max-height: 520px) and (orientation: landscape) {
  .top { padding: 4px 16px; gap: 4px 16px; }
  .brand { gap: 10px; }
  .brand-mark { font-size: 26px; }
  .brand h1 { font-size: 16px; }
  .meta { font-size: 12.5px; margin: 0; }
  #stage { padding-top: 6px; padding-bottom: 12px; }
  .linebar { padding: 3px 10px; margin-bottom: 6px; }
  .linebar .navbtn { padding-block: 2px; }
  .popover.beside { width: 384px; max-height: calc(100vh - 12px); overflow-y: auto; scrollbar-width: thin; padding: 6px 8px 8px; }
  .popover.beside .opts { gap: 3px; }
  .popover.beside .opt { min-width: 33px; padding-left: 4px; padding-right: 4px; }
  .popover.beside .pop-label { margin: 4px 0 3px; }
  .popover.beside .inv-row { margin-bottom: 3px; }
  .popover.beside .pop-foot { margin-top: 6px; }
}
