/* ============================================================
   HymnTutor — “One Body, in Harmony”
   Visual language: aged hymnal paper, burgundy leather, gilt edges.
   ============================================================ */

/* ---- the three faces, all served from here ----

   Every one is SIL Open Font License 1.1, and each ships its license
   beside it in public/fonts/ as that license requires.

   They are self-hosted rather than fetched from Google Fonts, which is
   not only about privacy and about a church wifi that blocks it. Two of
   these faces are MEASURED: notation.js sizes and places time-signature
   numerals from Source Sans 3's figures and tuplet and ending numerals
   from EB Garamond's italic, so a face that arrives late or not at all
   does not merely look different — it engraves differently until the
   metrics are re-measured. Noto Music was brought in-house for that
   reason and the other two followed.

   There is nothing left to gain from the CDN either: browsers have
   partitioned the HTTP cache by site since 2020, so a font cached for
   another site is fetched again for this one, and these sit on the same
   Cloudflare edge as the rest of the assets. What the CDN did cost was
   two extra origins — DNS and TLS to fonts.googleapis.com, then the same
   again to fonts.gstatic.com — before a single glyph could be drawn.

   Latin subset only, which is what the Google stylesheet was serving
   anyway; the roman and italic files are VARIABLE across their whole
   weight axis, so one file per style covers every weight the app uses.
   Note that the old stylesheet asked for italic at 400 and 500 only,
   while notation.js sets tuplet numerals in italic 700 — which the
   browser had been faking. It is a real weight now. */

/* Noto Music: traditional engraving-style clefs, rests, and accidentals.
   notation.js prefers this family for all music glyphs.

   WOFF2 like the other two, and for a reason worth writing down: this is the
   one face carrying `font-display: block`, so the clefs and rests are drawn
   as nothing at all until it lands — every other face is allowed to fall back
   and swap. It was the only face still shipping as raw TrueType, at 178 kB
   against the 74 kB the same 913 glyphs come to in WOFF2. Same font, same
   glyph set, same metrics; less of it to fetch on the one asset the staff
   waits for. */
@font-face {
  font-family: 'Noto Music';
  src: url('/fonts/NotoMusic-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* EB Garamond: the body serif, the lyrics under the staff, and the italic
   numerals on tuplet and ending brackets. */
@font-face {
  font-family: 'EB Garamond';
  src: url('/fonts/EBGaramond-normal.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('/fonts/EBGaramond-italic.woff2') format('woff2');
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}

/* Noto Serif, condensed: the words under the staff on a printed page
   (PRINT_FACE in practice.js). Only the print page loads it. */
@font-face {
  font-family: 'Noto Serif';
  src: url('/fonts/NotoSerif-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Noto Serif';
  src: url('/fonts/NotoSerif-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: italic;
  font-display: block;
}

/* Source Sans 3: the interface, and the lining tabular figures a time
   signature is stacked from. */
@font-face {
  font-family: 'Source Sans 3';
  src: url('/fonts/SourceSans3-normal.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('/fonts/SourceSans3-italic.woff2') format('woff2');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #faf6ec;
  --paper-deep: #f3ecdc;
  --paper-card: #fffdf6;
  --ink: #2b2620;
  --ink-soft: #5d5548;
  --ink-faint: #8a8172;
  --burgundy: #6e2639;
  --burgundy-deep: #521b2a;
  --burgundy-bright: #8e3349;
  --gold: #b8912f;
  --gold-soft: #d9c58a;
  --green: #3e5c46;
  /* The four voice-part colors — single source of truth. Used for the notes
     and chips in the Practice Room, the colored example notes in the lessons,
     and the voice-card borders. practice.js and curriculum.js read these off
     :root at runtime, so change a part's color here and it changes everywhere. */
  --voice-soprano: #b8912f;
  --voice-alto: #8e3349;
  --voice-tenor: #2c9949;
  --voice-bass: #3971a8;
  /* The note under the pointer, before it is clicked. It cannot be one of the
     four above, because hover REPLACES a note's own color: this used to be
     --burgundy-bright, which is the very same #8e3349 the alto is drawn in,
     so hovering an alto note changed it to the color it already was and the
     one part whose notes most need pointing at was the one part that gave no
     answer. Violet is the hue nothing in the engraving uses, and this is the
     quiet end of it — a hover is a note saying "you are on me", not a note
     shouting. */
  --note-hover: #7a3f9c;
  --danger: #a02020;
  --line: #e2d8c2;
  --shadow: 0 2px 6px rgba(60, 45, 20, 0.08), 0 12px 32px rgba(60, 45, 20, 0.08);
  --shadow-lift: 0 4px 10px rgba(60, 45, 20, 0.12), 0 18px 44px rgba(60, 45, 20, 0.14);
  --radius: 14px;
  /* Every pill in the header is exactly this tall. They used to be whatever
     their own font's line-height made them — 27px, 34px and 37px sitting in a
     row — which is close enough to look like a mistake rather than a rhythm. */
  --pill-h: 34px;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --music: "Noto Music", "Segoe UI Symbol", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% -10%, rgba(184, 145, 47, 0.07), transparent 55%),
    radial-gradient(ellipse at 90% 110%, rgba(110, 38, 57, 0.05), transparent 50%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Viewing as another user ----------

   The bar the site owner sees across the top of every page while they are
   looking at the app as one of its users. Everything else on screen belongs
   to that user and says so; this is the only thing that says otherwise, so it
   is fixed rather than sticky (it cannot be scrolled past), it carries no
   dismiss control (there is only the way OUT of the mode), and it is drawn in
   a slate blue used nowhere else in HymnTutor — nothing in the burgundy-and-
   gilt palette would read as "this is not the ordinary app".

   The page is pushed down by exactly the bar's height and the sticky header
   is re-anchored underneath it, so the layout below is untouched. */
:root { --view-as-h: 44px; }

.view-as-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;              /* above the sticky header, which is 50 */
  height: var(--view-as-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: linear-gradient(180deg, #2f4a63, #24384b);
  border-bottom: 2px solid #7ea6c9;
  color: #eef4f9;
  font-family: var(--sans);
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(20, 35, 50, 0.35);
}

.view-as-eye { font-size: 17px; flex: none; }

/* The name must survive; the sentence after it may be truncated. */
.view-as-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
/* The name is last to give up room, but it still truncates rather than being
   cut through the middle of a word if somebody's display name is enormous. */
.view-as-text strong {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-as-email,
.view-as-detail {
  color: #b9cddd;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-as-email { flex: none; }

.view-as-exit {
  flex: none;
  margin-left: auto;
  height: 28px;
  padding: 0 14px;
  border: 1px solid #8fb4d4;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #eef4f9;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.view-as-exit:hover { background: rgba(255, 255, 255, 0.2); }
.view-as-exit:focus-visible { outline: 2px solid #cfe2f2; outline-offset: 2px; }

body.viewing-as { padding-top: var(--view-as-h); }
body.viewing-as .site-header { top: var(--view-as-h); }

@media (max-width: 700px) {
  /* Dropped from the right: the sentence first, then the address, leaving the
     name — the part that matters. Each goes whole rather than being clipped
     through, and the bar stays one line so its height stays predictable. */
  .view-as-detail,
  .view-as-email { display: none; }
  .view-as-bar { padding: 0 12px; gap: 8px; font-size: 13px; }
  .view-as-exit { padding: 0 10px; }
}

/* ---------- Header ---------- */

/* The header stays one row at every width. Nothing in it may push the page
   wider than the screen — a header that overflows takes the whole document
   with it, and every page then scrolls sideways. So the flex children are
   allowed to shrink (min-width: 0, which they do not have by default), and
   the two things that can be said more briefly — the user's name and the
   word "Admin" — are shortened on a phone rather than allowed to win the
   argument over the viewport. */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 28px;
  background: linear-gradient(180deg, var(--burgundy-deep), var(--burgundy));
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 12px rgba(40, 10, 20, 0.25);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

/* The note is set larger than the wordmark beside it. A music glyph carries
   far less ink at a given size than a capital letter does, so matching the
   two on font-size leaves the note looking like an afterthought. */
.brand-mark {
  font-family: var(--music);
  font-size: 36px;
  color: var(--gold-soft);
  line-height: 1;
}

.brand-text {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.5px;
  color: #f7efdd;
  white-space: nowrap;
}

.brand-accent { color: var(--gold-soft); }

.header-right { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* The three pills that can appear here — sound, administration, the signed-in
   user — are one height and one shape, whatever their own text measures. The
   height is fixed rather than left to padding, because these carry text at
   three different sizes and an emoji, and each of those has its own idea of
   how tall a line is. Vertical padding is left off for the same reason: the
   height rules, and align-items does the centring. */
.audio-trigger,
.admin-link,
.user-chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: var(--pill-h);
  padding-top: 0;
  padding-bottom: 0;
  border-radius: 999px;
}

/* Each pill sits in a wrapper that carries the panel it opens, and those
   wrappers are what the header actually lines up. Left as blocks, a wrapper
   holds its pill on a text line, and a line reserves room under the baseline
   for descenders whether or not anything is there to descend. A pill with
   words in it puts its own baseline where the line wants it; the empty user
   chip on the sign-in page has no baseline of its own, so it hands the line
   its bottom edge instead and the whole line grows underneath it — leaving
   the circle riding 4px above the sound pill next to it. Making the wrappers
   flex boxes takes the text line out of it, and the pills line up whether or
   not they have anything to say. */
.audio-menu,
.admin-menu,
.user-menu {
  display: flex;
  align-items: center;
}
/* A display of its own outranks the browser's rule for [hidden], and the two
   hats are hidden that way until app.js knows who is signed in. */
.audio-menu[hidden],
.admin-menu[hidden],
.user-menu[hidden] { display: none; }

/* ---- the sound menu: instrument and volume ----

   A pill in the header that opens a panel of hymnal paper below it. The
   trigger keeps the shape the old instrument picker had, so the header reads
   the same; what it opens is the app's own panel rather than the operating
   system's dropdown, which could never have held a volume slider. */

.audio-menu { position: relative; flex: none; }

.audio-trigger {
  gap: 6px;
  background-color: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(230, 205, 150, 0.35);
  padding-left: 12px;
  padding-right: 11px;
  color: #ecdfc6;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.audio-trigger:hover { background-color: rgba(255, 255, 255, 0.18); }
.audio-trigger:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}
.audio-trigger[aria-expanded="true"] {
  background-color: rgba(255, 255, 255, 0.20);
  border-color: var(--gold-soft);
}

.audio-trigger-icon { font-size: 15px; line-height: 1; }
.audio-trigger-label { white-space: nowrap; }

/* A chevron drawn in borders rather than fetched or set as a background image,
   so it can turn when the panel opens. */
.audio-trigger-chevron {
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1.6px solid var(--gold-soft);
  border-bottom: 1.6px solid var(--gold-soft);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.16s ease;
}
.audio-trigger[aria-expanded="true"] .audio-trigger-chevron {
  transform: translateY(1px) rotate(-135deg);
}

/* The speaker in the trigger, when everything is turned off. Otherwise the
   only sign of a muted app is a panel nobody has open. */
.audio-menu.muted .audio-trigger-icon { opacity: 0.45; }
.audio-menu.muted .audio-trigger::after {
  content: "🔇";
  font-size: 12px;
  line-height: 1;
}

.audio-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 268px;
  padding: 14px 16px 12px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  color: var(--ink);
}
.audio-panel[hidden] { display: none; }

.audio-panel-head {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.audio-panel-head + * + .audio-panel-head { margin-top: 16px; }

.audio-instruments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.audio-inst {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 4px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.audio-inst:hover { background: var(--paper-deep); transform: translateY(-1px); }
.audio-inst:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.audio-inst.on {
  background: var(--burgundy);
  border-color: var(--burgundy-deep);
  box-shadow: inset 0 0 0 1px rgba(230, 205, 150, 0.4);
}
.audio-inst-icon { font-size: 19px; line-height: 1; }
.audio-inst-label { font-size: 12.5px; color: var(--ink-soft); }
.audio-inst.on .audio-inst-label { color: #f7efdd; }

.audio-volume {
  display: flex;
  align-items: center;
  gap: 9px;
}

.audio-mute {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.audio-mute:hover { background: var(--paper-deep); }
.audio-mute:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* The track and thumb are drawn by hand in both engines: a browser's default
   range control is the one gray plastic thing this page would otherwise
   contain. */
.audio-slider {
  flex: 1;
  min-width: 0;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.audio-slider:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.audio-slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}
.audio-slider::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}
.audio-slider::-moz-range-progress {
  height: 5px;
  border-radius: 3px;
  background: var(--gold);
}
.audio-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px; /* centres a 15px thumb on a 5px track */
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--paper-card);
  box-shadow: 0 1px 3px rgba(60, 45, 20, 0.35);
}
.audio-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--paper-card);
  box-shadow: 0 1px 3px rgba(60, 45, 20, 0.35);
}

.audio-volume-read {
  flex: none;
  width: 44px;
  text-align: right;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.audio-panel-note {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-faint);
  font-style: italic;
}

.user-chip {
  gap: 6px;
  font-size: 13.5px;
  color: #ecdfc6;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(230, 205, 150, 0.35);
  padding-left: 14px;
  padding-right: 14px;
  cursor: pointer;
  user-select: none;
  /* An email address has no spaces to break at, so left to itself the chip
     grows to whatever the address needs. Cap it and cut it instead. */
  min-width: 0;
  max-width: 24ch;
  white-space: nowrap;
}
.user-chip:hover { background: rgba(255, 255, 255, 0.18); }
.user-chip:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.user-chip[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.20);
  border-color: var(--gold-soft);
}
.chip-name { overflow: hidden; text-overflow: ellipsis; }
.chip-initial { display: none; font-weight: 600; }

/* Nobody signed in. The same chip in the same place — it opens the same panel
   and must not move the header around — but lit, because for a visitor it is
   the one thing in the header worth pressing. */
.user-chip.chip-guest {
  background: rgba(230, 205, 150, 0.22);
  border-color: var(--gold-soft);
  color: #fdf6e6;
  font-weight: 600;
}
.user-chip.chip-guest:hover { background: rgba(230, 205, 150, 0.32); }

/* Signing in is an arrival, not a departure — set apart from the list like
   Sign out, but in the app's own gold rather than the quiet grey of leaving. */
.um-in {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--burgundy);
}

/* ---- the user menu ----

   The chip's own panel, built like the sound menu beside it: hymnal paper
   hung under the pill, with a gold edge along the top. What it holds is a
   list of destinations rather than controls, so the rows are wide targets
   with the page's name over a line saying what is on it. */

.user-menu { position: relative; flex: none; }

.user-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 268px;
  padding: 8px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  color: var(--ink);
}
.user-panel[hidden] { display: none; }

.um-who {
  margin: 4px 8px 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-faint);
  word-break: break-all;
}
.um-who strong { color: var(--ink); font-weight: 600; }
.um-org { display: block; word-break: normal; }

.um-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-family: var(--sans);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
}
.um-item:hover { background: var(--paper-deep); }
.um-item:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.um-icon { font-size: 14px; width: 17px; text-align: center; flex: none; }
.um-label { min-width: 0; font-weight: 600; }

/* Leaving is the last thing on the list, and set apart from the places you
   can go. */
.um-out {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--ink-soft);
}

/* ---- pages that are only prose (#/workbook, #/church-accounts,
   #/why-harmony, #/about) ----

   These wear the tutorial page's clothes: `.lesson-page` centres the column,
   `.lesson-header` sets the title, and `.lesson-content` supplies the card,
   the measure, the 17px body and the h2. A page of reading should look like
   the reading the course already asks for, and anything defined twice here
   would be a second answer to a question .lesson-content has answered.

   What follows is only what prose wants and a lesson does not. */

.page-prose p:last-child { margin-bottom: 0; }
.lesson-content .ref { color: var(--ink-faint); font-size: 15px; white-space: nowrap; }
.page-prose .page-note { font-size: 15px; color: var(--ink-faint); }
.page-cta { margin: 26px 0 10px; }

/* A signature under a page written in the first person. Set in the serif the
   hymn pages use, so it reads as a hand at the end of a letter rather than
   one more line of the paragraph above it. */
.page-signoff {
  margin: 22px 0 0;
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  color: var(--burgundy-deep);
}

/* A verse, given the room a verse wants: set in the serif face the hymn
   pages use, indented behind a gold rule. */
.page-verse {
  margin: 28px 0 8px;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--gold);
}
.page-verse p {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  font-style: italic;
  color: var(--burgundy-deep);
}
.page-verse cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 14px;
  letter-spacing: 0.4px;
  color: var(--ink-faint);
}

/* ---------- Layout ---------- */

.app-main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.loading {
  text-align: center;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink-faint);
  padding: 90px 0;
}

.site-footer {
  text-align: center;
  padding: 28px 20px 36px;
  color: var(--ink-faint);
  font-size: 14px;
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
}
.site-footer p { margin: 4px 0; }
.footer-verse { font-family: var(--serif); font-style: italic; font-size: 15px; max-width: 42em; margin-inline: auto !important; }
.footer-verse-ref { display: block; }

/* ---------- Dashboard hero ---------- */

.hero {
  text-align: center;
  margin: 8px auto 44px;
  max-width: 700px;
}

/* the title wraps only between its phrases, never inside one */
.hero-phrase { white-space: nowrap; }
.hero h1 {
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 600;
  text-wrap: balance;
  margin: 0 0 6px;
  color: var(--burgundy-deep);
  line-height: 1.15;
}

.hero .hero-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0;
  color: var(--gold);
}
.hero .hero-rule::before,
.hero .hero-rule::after {
  content: "";
  height: 1px;
  width: 90px;
  background: linear-gradient(90deg, transparent, var(--gold-soft));
}
.hero .hero-rule::after {
  background: linear-gradient(90deg, var(--gold-soft), transparent);
}
.hero .hero-rule span { font-family: var(--music); font-size: 20px; }
/* The clef glyphs are tall and the quarter/eighth notes are drawn much smaller
   at the same font-size, so the notes get their own size to match by eye. */
.hero .hero-rule span i {
  font-style: normal;
  font-size: 1.8em;
  letter-spacing: 0.12em;
  margin: 0 0.34em;
  vertical-align: -0.06em;
}

.hero p {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0;
}

.hero .continue-btn { margin-top: 24px; }

/* ---------- Module cards ---------- */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}

.module-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
}

.module-card:not(.locked):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.module-card.locked {
  opacity: 0.62;
  cursor: default;
  background: var(--paper-deep);
}
.module-card.locked::before { background: var(--line); }

.module-num {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
}

.module-card h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--burgundy-deep);
  line-height: 1.2;
}

.module-card p {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin: 0;
  flex: 1;
}

.module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-faint);
}

.locked-tag {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* progress ring */
.ring { width: 44px; height: 44px; }
.ring .ring-bg { stroke: var(--line); }
.ring .ring-fg { stroke: var(--green); transition: stroke-dashoffset 0.5s ease; }
.ring text {
  font: 700 11px var(--sans);
  fill: var(--ink-soft);
}
.ring.done .ring-fg { stroke: var(--gold); }
.ring.done text { fill: var(--gold); }

/* ---------- Module page ---------- */

.crumbs {
  font-size: 14px;
  color: var(--ink-faint);
  margin-bottom: 18px;
  line-height: 2;
}
.crumbs a { color: var(--burgundy); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* One step back, in front of the trail. The trail says where you are; this
   says how to leave — so it is a button rather than another link in the same
   quiet gray, or it would read as one more place to go.

   Left in the normal flow rather than making .crumbs a flexbox: the trail is
   a run of text with links in it, and flex would have turned each stretch of
   " ›› " between them into its own item with its own gap. */
.crumb-back {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 4px;
  margin-right: 12px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--burgundy);
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px 5px 11px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.crumb-back span { font-size: 17px; line-height: 1; margin-top: -1px; }
.crumb-back:hover { background: var(--paper-deep); border-color: var(--gold-soft); }
.crumb-back:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.module-header { margin-bottom: 28px; }
.module-header .module-num { font-size: 15px; }
.module-header h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 600;
  margin: 4px 0 8px;
  color: var(--burgundy-deep);
}
.module-header p { color: var(--ink-soft); font-size: 18px; margin: 0; max-width: 640px; }
.module-header.module-overview p { max-width: none; }

.lesson-list { display: flex; flex-direction: column; gap: 12px; }

.lesson-row {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lesson-row:hover { transform: translateX(4px); box-shadow: var(--shadow-lift); }

.lesson-status {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 15px;
  border: 2px solid var(--line);
  color: var(--ink-faint);
  background: #fff;
}
.lesson-status.completed { border-color: var(--green); background: var(--green); color: #fff; }
.lesson-status.started { border-color: var(--gold); color: var(--gold); }

.lesson-row-body { flex: 1; }
.lesson-row-body h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
}
.lesson-row-body .lesson-kind {
  font-size: 12.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.lesson-row .lesson-score { font-size: 13.5px; color: var(--green); font-weight: 600; }
.lesson-row .go { color: var(--gold); font-size: 20px; }

/* ---------- Lesson page ---------- */

.lesson-page { max-width: 780px; margin: 0 auto; }

.lesson-header { margin-bottom: 8px; }
.lesson-header .lesson-kind {
  font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold);
  font-weight: 700;
}
.lesson-header h1 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 600;
  color: var(--burgundy-deep);
  margin: 4px 0 20px;
}

.lesson-content {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 40px 38px;
}

.lesson-content h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--burgundy);
  margin: 34px 0 10px;
}
.lesson-content h2:first-child { margin-top: 0; }

.lesson-content p { margin: 12px 0; }
.lesson-content strong { color: var(--burgundy-deep); }
.lesson-content ul { padding-left: 24px; }
.lesson-content li { margin: 6px 0; }

.callout {
  display: flex;
  gap: 14px;
  background: linear-gradient(90deg, rgba(184, 145, 47, 0.10), rgba(184, 145, 47, 0.04));
  border-left: 4px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 15.5px;
}
.callout .callout-icon { font-size: 20px; line-height: 1.4; }

.callout.hymnal {
  background: linear-gradient(90deg, rgba(110, 38, 57, 0.08), rgba(110, 38, 57, 0.03));
  border-left-color: var(--burgundy);
}

.figure {
  margin: 22px 0;
  text-align: center;
}
.figure svg { max-width: 100%; height: auto; }
/* A word over one system of a figure's hymn page, naming what that line is
   doing. Set small and away from the music, so it reads as an annotation
   rather than as something the hymnal printed. */
.fig-phrase-label {
  margin: 14px 0 -2px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-faint);
}
.fig-phrase-label:first-child { margin-top: 2px; }

.figure figcaption {
  font-size: 14px;
  color: var(--ink-faint);
  font-style: italic;
  margin-top: 6px;
}

/* Tabs inside a lesson (the capstone's four hymns). Underlined like the
   Practice Room's own tabs, and allowed to wrap on a phone rather than scroll. */
.lesson-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: 26px 0 0;
  border-bottom: 1px solid var(--line);
}
.lesson-tabs [role="tab"] {
  padding: 9px 14px 8px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-soft);
  font: 600 15px var(--sans);
  cursor: pointer;
}
.lesson-tabs [role="tab"]:hover { color: var(--burgundy); }
.lesson-tabs [role="tab"][aria-selected="true"] { color: var(--burgundy); border-bottom-color: var(--gold); }
.lesson-tabs [role="tab"]:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
[role="tabpanel"] > h2:first-child { margin-top: 18px; }

/* 9.4: a hymnal's four parts, the hymn numbers in their own column. */
.hymnal-contents { width: 100%; border-collapse: collapse; margin: 14px 0 20px; font-size: 15.5px; }
.hymnal-contents th, .hymnal-contents td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.hymnal-contents th { color: var(--burgundy); width: 30%; }
.hymnal-contents .nos { white-space: nowrap; color: var(--ink-faint); text-align: right; }

/* 9.4: tap five hymns into hymnal order. */
.order-list { display: flex; flex-direction: column; gap: 8px; max-width: 520px; margin: 0 auto; text-align: left; }
.order-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper-card);
  color: var(--ink);
  font: 16px var(--serif);
  text-align: left;
  cursor: pointer;
}
.order-item:hover:not(:disabled) { border-color: var(--gold); }
.order-item:disabled { cursor: default; }
.order-badge {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px dashed var(--gold-soft);
  font: 700 14px/23px var(--sans);
  text-align: center;
  color: var(--burgundy);
}
.order-item.on .order-badge { border: 1.5px solid var(--gold); background: rgba(184, 145, 47, 0.14); }
.order-item.right { border-color: var(--green); }
.order-item.right .order-badge { border-color: var(--green); background: var(--green); color: #fff; }
.order-item.wrong { border-color: var(--danger); }
.order-item.wrong .order-badge { border-color: var(--danger); background: var(--danger); color: #fff; }
.order-text { display: flex; flex-direction: column; }
.order-note { font: 13px var(--sans); color: var(--ink-faint); }
.order-note:empty { display: none; }
.order-msg { text-align: center; color: var(--ink-soft); margin: 12px 0 0; }

/* One note value per block, its play button on the same line as its label, and
   a rule between blocks — so no button can be mistaken for the next label's. */
.note-family-row {
  border-top: 1px solid var(--line);
  padding: 10px 0 4px;
}
.note-family-row:first-child { border-top: none; }
.note-family-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}
.note-family-head strong { color: var(--burgundy-deep); font-size: 16.5px; }
.note-family-head .btn { padding: 8px 18px; font-size: 15px; flex: none; }

/* clickable notes glow */
.note-hit { cursor: pointer; }
.note-hit:hover .notehead { fill: var(--note-hover); }
.note-hit:hover .stem, .note-hit:hover .noteflag { stroke: var(--note-hover); }
.note-playing .notehead { fill: var(--gold) !important; }

/* A sounding note lit in its own voice's color, for a figure whose point is
   WHICH part is singing rather than merely that something is. */
.note-playing.note-voice-s .notehead { fill: var(--voice-soprano) !important; }
.note-playing.note-voice-a .notehead { fill: var(--voice-alto) !important; }
.note-playing.note-voice-t .notehead { fill: var(--voice-tenor) !important; }
.note-playing.note-voice-b .notehead { fill: var(--voice-bass) !important; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  padding: 11px 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, var(--burgundy-bright), var(--burgundy));
  color: #fdf7ea;
  box-shadow: 0 3px 10px rgba(110, 38, 57, 0.35);
}
.btn-primary:hover { background: linear-gradient(180deg, #a03d55, var(--burgundy-bright)); }

.btn-secondary {
  background: transparent;
  color: var(--burgundy);
  border: 1.5px solid var(--burgundy);
}
.btn-secondary:hover { background: rgba(110, 38, 57, 0.06); }

/* "Optional", worn on the button that leads to an optional page */
.btn-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(110, 38, 57, 0.1);
}

.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { color: var(--burgundy); }

/* for the confirm button of an action that destroys something */
.btn-danger {
  background: linear-gradient(180deg, #b8452f, var(--danger));
  color: #fdf7ea;
  box-shadow: 0 3px 10px rgba(160, 32, 32, 0.32);
}
.btn-danger:hover { background: linear-gradient(180deg, #c44f38, #b8452f); }

.btn:disabled { opacity: 0.45; cursor: default; }

.lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
  gap: 12px;
}

/* ---------- Quiz ---------- */

.quiz-progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  margin-bottom: 16px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  border-radius: 3px;
  transition: width 0.35s ease;
}

.quiz-question h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0 0 12px;
  color: var(--ink);
}

/* A checkpoint question is worth keeping on one screen: the answer buttons
   below a figure were being pushed off the bottom on a laptop. Everything in a
   question is tightened, and an empty figure (most questions have none) takes
   no vertical room at all. */
.quiz-question .figure { margin: 10px 0; }
.quiz-question .figure:empty { display: none; }

.quiz-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.quiz-choice {
  text-align: left;
  font-size: 16px;
  font-family: var(--sans);
  padding: 7px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--gold); background: #fffcf2; }
.quiz-choice.correct { border-color: var(--green); background: #eef5ef; color: var(--green); font-weight: 600; }
.quiz-choice.wrong { border-color: var(--burgundy-bright); background: #f9eef0; color: var(--burgundy); }
.quiz-choice:disabled { cursor: default; }

.quiz-feedback {
  margin-top: 16px;
  padding: 13px 17px;
  border-radius: 10px;
  font-size: 15px;
}
.quiz-feedback.good { background: #eef5ef; border: 1px solid #c6dcc9; color: var(--green); }
.quiz-feedback.bad { background: #f9eef0; border: 1px solid #e5c3ca; color: var(--burgundy); }

.quiz-result { text-align: center; padding: 20px 0; }
.quiz-result .score-big {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 700;
  color: var(--burgundy-deep);
  line-height: 1;
}
.quiz-result .score-label { color: var(--ink-soft); margin: 8px 0 20px; }
.quiz-result .pass-badge {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.quiz-result .pass-badge.pass { background: #eef5ef; color: var(--green); border: 1px solid #c6dcc9; }
.quiz-result .pass-badge.fail { background: #f9eef0; color: var(--burgundy); border: 1px solid #e5c3ca; }

/* ---------- Drill ---------- */

.drill-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 4px 0 18px;
}
.drill-stat { text-align: center; }
.drill-stat .stat-num {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 700;
  color: var(--burgundy-deep);
  line-height: 1.1;
}
.drill-stat .stat-label {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* A drill round's question, printed above its figure. */
.drill-question {
  text-align: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 4px 0 12px;
}
.drill-start { text-align: center; margin: 8px 0 4px; }
.drill-start .btn { font-size: 18px; padding: 12px 40px; }

/* Which notes a note drill draws from: both staves, or one part's. */
.drill-mode {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}
.drill-mode-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 7px 16px;
  color: var(--burgundy);
  background: #fff;
  border: 1.5px solid var(--gold-soft);
  cursor: pointer;
}
.drill-mode-btn:first-child { border-radius: 20px 0 0 20px; }
.drill-mode-btn:last-child { border-radius: 0 20px 20px 0; border-left: 0; }
.drill-mode-btn:hover { background: var(--gold-soft); }
.drill-mode-btn[aria-pressed="true"] { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
.drill-mode-btn:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; }

/* A row of numbered buttons that swaps one figure between several examples
   without growing it (Lesson 3.4's clapping patterns). */
.pattern-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 4px;
}
.pattern-pick-label {
  font-size: 15px;
  color: var(--ink-soft);
  margin-right: 4px;
}
.pattern-pick-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  min-width: 38px;
  padding: 5px 0;
  color: var(--burgundy);
  background: #fff;
  border: 1.5px solid var(--gold-soft);
  border-radius: 20px;
  cursor: pointer;
}
.pattern-pick-btn:hover { background: var(--gold-soft); }
.pattern-pick-btn[aria-pressed="true"] { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
.pattern-pick-btn:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; }

.drill-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.drill-note-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--burgundy);
  background: #fff;
  border: 2px solid var(--gold-soft);
  cursor: pointer;
  transition: all 0.12s ease;
}
.drill-note-btn:hover:not(:disabled) { background: var(--gold-soft); color: var(--burgundy-deep); transform: translateY(-2px); }
.drill-note-btn.correct { background: var(--green); border-color: var(--green); color: #fff; }
.drill-note-btn.wrong { background: var(--burgundy-bright); border-color: var(--burgundy-bright); color: #fff; }
.drill-note-btn:disabled { cursor: default; }
.drill-note-btn.word {
  width: auto;
  height: 52px;
  padding: 0 26px;
  border-radius: 26px;
  font-size: 19px;
}

.drill-feedback { text-align: center; min-height: 28px; font-size: 16px; margin-top: 14px; font-weight: 600; }
.drill-feedback.good { color: var(--green); }
.drill-feedback.bad { color: var(--burgundy); }
/* the button that asks for the next round of a drill that waits to be asked */
.drill-next { text-align: center; margin-top: 16px; }
.drill-next .play-hint { margin: 10px 0 0; }

/* ---------- Hymn page anatomy hotspots ---------- */

.hotspot { cursor: pointer; }
.hotspot .hotspot-ring {
  fill: rgba(184, 145, 47, 0.14);
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  transition: fill 0.15s ease;
}
.hotspot:hover .hotspot-ring { fill: rgba(184, 145, 47, 0.30); }
.hotspot.active .hotspot-ring { fill: rgba(110, 38, 57, 0.18); stroke: var(--burgundy); stroke-dasharray: none; }
.hotspot .hotspot-num {
  font: 700 12px var(--sans);
  fill: #fff;
}
.hotspot .hotspot-dot { fill: var(--gold); }
.hotspot.active .hotspot-dot { fill: var(--burgundy); }
.hotspot.visited .hotspot-dot { fill: var(--green); }

.anatomy-panel {
  margin-top: 14px;
  background: #fffdf4;
  border: 1px solid var(--gold-soft);
  border-radius: 10px;
  padding: 16px 20px;
  min-height: 84px;
  text-align: left;
}
.anatomy-panel h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--burgundy-deep);
}
.anatomy-panel p { margin: 0; font-size: 15px; color: var(--ink-soft); }
.anatomy-panel .hint { color: var(--ink-faint); font-style: italic; }

/* ---------- Voice part cards ---------- */

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.voice-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.voice-card.soprano { border-top-color: var(--voice-soprano); }
.voice-card.alto { border-top-color: var(--voice-alto); }
.voice-card.tenor { border-top-color: var(--voice-tenor); }
.voice-card.bass { border-top-color: var(--voice-bass); }
.voice-card h4 { margin: 0 0 4px; font-family: var(--serif); font-size: 20px; color: var(--ink); }
.voice-card .voice-who { font-size: 13px; color: var(--ink-faint); }
.voice-card .voice-color { font-size: 13px; font-weight: 700; margin-top: 6px; }
.voice-card.soprano .voice-color { color: var(--voice-soprano); }
.voice-card.alto .voice-color { color: var(--voice-alto); }
.voice-card.tenor .voice-color { color: var(--voice-tenor); }
.voice-card.bass .voice-color { color: var(--voice-bass); }
.voice-card .voice-where { font-size: 13.5px; margin-top: 8px; color: var(--ink-soft); }

/* ---------- Practice Room ---------- */

.hymn-sheet {
  background: #fffef9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 34px 26px;
}
.hymn-sheet.embedded {
  padding: 20px 22px 16px;
  margin: 10px 0;
  box-shadow: none;
}

/* The number and the title are set at the same size, always: they are one
   heading with the numeral pulled out to the corner, and a numeral a few
   pixels off the title reads as a mistake rather than a hierarchy. One
   variable so the two cannot drift — change it here and both follow. */
.hymn-head {
  position: relative;
  margin-bottom: 6px;
  --hymn-title-size: 30px;
}
.hymn-number {
  position: absolute;
  left: 0; top: 0;
  font-family: var(--serif);
  font-size: var(--hymn-title-size);
  font-weight: 700;
  color: var(--ink);
}
.hymn-titles h1 {
  text-align: center;
  font-family: var(--serif);
  font-size: var(--hymn-title-size);
  font-weight: 600;
  color: var(--ink);
  margin: 0 60px 4px;
}
/* The fine print under the music, the way a hymnal sets the foot of its page:
   words over music on the left, the tune and its meter on the right with the
   copyright beneath. The two columns start at the same height, so the tune
   reads across from the words credit. */
.hymn-credits {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  /* Set from the lyrics' own drawn size once the staff has been scaled —
     see fitCredits in practice.js. The value here is only what shows before
     the music has been measured. */
  font-size: var(--credit-size, 11.5px);
  letter-spacing: 0.6px;
  color: var(--ink-soft);
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.hymn-credit-left { text-align: left; }
/* A direction about how to sing the page — what its small print means — set
   on a line of its own above the credits it is not one of. */
.hymn-perf-note {
  flex: 0 0 100%;
  text-align: left;
  font-style: italic;
  letter-spacing: 0.3px;
  margin-bottom: 5px;
}
.hymn-credit-right { text-align: right; }
.hymn-credits > div > div + div { margin-top: 2px; }

/* Toolbar and the ⚙ panel stick to the top together. They have to be one
   sticky box rather than two: the panel opens beneath the bar, and a bar that
   stuck on its own would leave the panel behind at the top of the page,
   opening out of sight for anyone who pressed ⚙ partway down the music. */
.practice-controls {
  position: sticky;
  top: 66px;
  z-index: 20;
  margin: 14px 0 10px;
}

.practice-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
}

.part-chips { display: flex; gap: 6px; }
.part-chip {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--part-color);
  color: var(--part-color);
  background: #fff;
  cursor: pointer;
  transition: all 0.12s ease;
}
.part-chip.loud { background: var(--part-color); color: #fff; }
.part-chip.mute { opacity: 0.4; text-decoration: line-through; }
/* The part the singer told us is theirs (Profile → Your part). A dot, not a
   different color: the four colors already mean the four voices, and the
   chip has to keep saying which voice it is. */
.part-chip.mine::before {
  content: "•";
  margin-right: 5px;
  font-size: 16px;
  line-height: 0;
  vertical-align: middle;
}

/* Tempo, count-in and loop, folded away behind ⚙ on the toolbar. They are set
   once and left alone, and hiding them is what keeps Play and the four parts
   on a single line on a phone. */
.tools-btn {
  padding: 4px 10px;
  font-size: 13.5px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tools-btn.open { background: var(--paper); border-color: var(--burgundy); }
/* The gear reads as a target rather than a speck. The button does not grow
   with it: the glyph is bigger than the button's own text, so the vertical
   padding is taken back by the same amount to keep the button the height of
   the Play button beside it. */
.tools-icon {
  font-size: 19px;
  line-height: 1;
}
.practice-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 6px 0 0;
}
.practice-tools[hidden] { display: none; }

.tempo-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.tempo-ctl input[type="range"] { width: 110px; accent-color: var(--burgundy); }
.tempo-val { min-width: 4.8em; }
.toolbar-check { font-size: 13.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }
.toolbar-check input { accent-color: var(--burgundy); }
.practice-tools .tools-print { margin-left: auto; padding: 6px 14px; font-size: 14px; }

.hymn-music { margin-top: 8px; }
.hymn-system { display: block; margin: 2px 0; }

.col-band { fill: transparent; cursor: pointer; transition: fill 0.12s ease; }
.col-band:hover { fill: rgba(184, 145, 47, 0.14); }
.col-band.active { fill: rgba(184, 145, 47, 0.22); }

/* Words under the staff. A syllable is a label on the column beneath it, so
   it hands its click down to the band, which is where the click was going
   anyway: clicking a word selects and sounds its column, and hovering one
   gives the pointer the band gives, not an I-beam offering a selection that
   leads nowhere. `user-select` goes with it, or a drag begun on the staff
   beside a word would still sweep it up. */
.lyric,
.lyric-hyphen { pointer-events: none; user-select: none; }

/* Sits under the tune in the credits block, so it takes that column's right
   alignment and its measured size rather than setting either itself. */
.hymn-copyright {
  font-size: inherit;
  font-style: italic;
  color: var(--ink-faint);
  margin: 0;
}

.practice-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(120deg, var(--burgundy-deep), var(--burgundy) 60%, #7e3046);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 22px 28px;
  margin: 0 0 30px;
  color: #f3e9d4;
  text-decoration: none;
  border: 1px solid rgba(230, 205, 150, 0.35);
  transition: transform 0.15s ease;
}
.practice-banner:hover { transform: translateY(-2px); }
.practice-banner .pb-icon { font-family: var(--music); font-size: 38px; color: var(--gold-soft); }
.practice-banner h3 { margin: 0 0 2px; font-family: var(--serif); font-size: 24px; color: #fbf3e1; }
.practice-banner p { margin: 0; font-size: 14.5px; color: #e3d3b4; }
.practice-banner .go { margin-left: auto; font-size: 24px; color: var(--gold-soft); }

@media (max-width: 640px) {
  .hymn-sheet { padding: 18px 12px; }
  .practice-controls { top: 58px; }
}

/* The toolbar stays on one line all the way down, which is the whole point of
   folding tempo, count-in and loop away. It gives things up in the order it
   can afford to lose them:

     above 700px   everything labeled — the bar needs about 567px
     520 - 700px   the gear loses its words; ⚙ says it already
     below 520px   ▶ loses "Play" too and the chips step down a size

   The part NAMES never go: this is an app for people learning which line is
   theirs, and "S A T B" would be teaching them the abbreviation instead of
   the part. On a 375px screen that leaves about 24px to spare, which is the
   margin a scrollbar appearing needs. */
@media (max-width: 700px) {
  .tools-btn-label { display: none; }
}

/* Play sits in a round button on a phone with no word beside it, so the
   glyph has to be centered by eye rather than by box. ▶ carries more empty
   space on its right than its left inside its em, which reads as the
   triangle sitting too far left; ◼ is symmetrical and wants no nudge. */
.play-btn { display: inline-flex; align-items: center; justify-content: center; }
.play-icon { line-height: 1; position: relative; }
.play-icon.is-play { left: 1.5px; }
.play-icon + .play-label { margin-left: 5px; }

@media (max-width: 520px) {
  /* A long hymn title fell to three lines on a phone at the full size. Down a
     step, with the room beside the number and the star narrowed to match, it
     sets in two — still the biggest thing on the page, as a hymn title
     should be. The number comes down with it, being the same variable. */
  .hymn-head { --hymn-title-size: 24px; }
  .hymn-titles h1 { margin: 0 46px 4px; }

  .practice-toolbar { gap: 5px; padding: 7px; }
  .play-label { display: none; }
  .practice-toolbar .play-btn { padding: 7px 9px; }
  .tools-btn { padding: 5px 7px; }
  .part-chips { gap: 3px; }
  .part-chip { font-size: 11px; padding: 5px 6px; letter-spacing: 0; }
  .part-chip::before { margin-right: 2px; font-size: 12px; }
  .practice-tools { gap: 10px; padding: 9px 10px; }
}

/* ---------- the hint that the long line exists ---------- */

.turn-hint { display: none; }
.page-btn { display: none; }
@media (max-width: 640px) and (orientation: portrait) {
  .turn-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 4px 0 6px;
    font-family: var(--serif);
    font-size: 16px;
    font-style: italic;
    color: var(--ink-soft);
  }
  /* A phone, about to be turned. */
  .turn-icon {
    flex: none;
    width: 11px;
    height: 18px;
    border: 1.5px solid var(--gold);
    border-radius: 2.5px;
    transform: rotate(-28deg);
  }
}

/* ---------- the long line: a phone on its side ----------
   The hymn alone, as one unbroken staff that scrolls sideways. A hymn with a
   refrain is two: the verse, then the refrain centered beside it. Play and
   the four parts stand in a rail down the left edge, because height is the
   thing a sideways phone has least of and width the thing it has most.
   The same design as CarolTutor's (docs/CAROLTUTOR_PLAN.md). */

body.long { overflow: hidden; }
body.long .site-header,
body.long .site-footer,
body.long .view-as-bar,
body.long .crumbs-row,
body.long .hymn-head,
body.long .tools-btn,
body.long .practice-tools,
body.long .hymn-credits,
body.long .turn-hint { display: none !important; }
body.long .app-main { max-width: none; padding: 0; }
body.long .hymn-sheet {
  position: fixed;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.long .practice-controls {
  position: fixed;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(60px + env(safe-area-inset-left));
  padding-left: env(safe-area-inset-left);
  margin: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, var(--burgundy-deep), var(--burgundy));
  border-right: 1px solid var(--gold);
}
body.long .practice-toolbar {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}
body.long .part-chips { flex-direction: column; gap: 6px; }
body.long .page-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-bottom: 2px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--gold-soft);
  background: transparent;
  border: 1px solid rgba(217, 197, 138, 0.7);
  border-radius: 50%;
}
body.long .practice-toolbar .play-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  margin-bottom: 4px;
  border: 1px solid var(--gold-soft);
}
body.long .play-label { display: none; }
body.long .part-chip {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 15px;
  border-radius: 50%;
  text-decoration: none;
}
body.long .part-chip.mute { opacity: 0.5; }
/* Your part: a gold ring, as the dot has no room beside the initial. */
body.long .part-chip.mine::before { content: none; }
body.long .part-chip.mine { box-shadow: 0 0 0 2px var(--gold-soft); }
body.long .hymn-music {
  position: fixed;
  top: 6px;
  bottom: calc(4px + env(safe-area-inset-bottom));
  left: calc(61px + env(safe-area-inset-left));
  right: 0;
  margin: 0;
  display: flex;
  align-items: center;
  /* A little air between the verse and the refrain. */
  gap: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Room to bring the last chord back to the reading point. */
  padding-right: 60vw;
  scrollbar-width: none;
}
body.long .hymn-music::-webkit-scrollbar { display: none; }
body.long .hymn-system { flex: none; margin: 0; }

/* ---------- Modals ---------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(35, 25, 15, 0.5);
  display: grid; place-items: center;
  z-index: 100;
}
.modal {
  background: var(--paper-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 28px 32px;
  width: min(430px, 92vw);
}
.modal h2 { font-family: var(--serif); margin: 0 0 4px; color: var(--burgundy-deep); }
.modal p { font-size: 14.5px; color: var(--ink-soft); margin: 4px 0 16px; }
.modal input[type="email"], .modal input[type="text"] {
  width: 100%;
  font-size: 16px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  font-family: var(--sans);
  background: #fff;
}
.modal input:focus { outline: none; border-color: var(--gold); }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* the shared confirm dialog (HymnCommon.confirmDialog) */
.modal-confirm { width: min(460px, 92vw); }
.modal-confirm h2 { font-size: 24px; line-height: 1.25; }
.modal-confirm p { margin: 8px 0 0; }
.modal-confirm .modal-detail { color: var(--ink-faint); font-size: 13.5px; }
.modal-confirm .modal-actions { margin-top: 22px; }
.modal-confirm .btn { padding: 9px 22px; font-size: 15px; }

/* A question with more than two answers. Buttons that say what they do are
   too wide to sit in a row, and stacking them reads as a list of options
   rather than as a decision already leaning one way. Cancel goes last and
   stays quiet. */
.modal-confirm .modal-actions-stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.modal-confirm .modal-actions-stacked .btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 16px;
}
.modal-confirm .modal-actions-stacked .btn-ghost { text-align: center; margin-top: 2px; }
/* the quiet second line under a choice, saying what it costs */
.modal-confirm .btn-detail {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 400;
  opacity: 0.78;
}

/* The welcome (showWelcome in app.js): stacked choices, each a button that
   says what it does and what it is for. Preview Access is quieter, not
   smaller: it is a real answer, not a cancel. */
.modal-welcome { width: min(520px, 94vw); }
.modal-welcome h2 { font-size: 26px; line-height: 1.25; }
.welcome-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.welcome-choices[hidden] { display: none; }
.welcome-choice {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 13px 16px;
  background: var(--paper-card);
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--burgundy);
  border-radius: 10px;
  font-family: var(--sans);
  color: var(--ink);
}
.welcome-choice strong { display: block; font-size: 16.5px; color: var(--burgundy-deep); }
.welcome-choice span { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-soft); }
.welcome-choice:hover, .welcome-choice:focus-visible {
  border-color: var(--gold); border-left-color: var(--burgundy-bright);
  background: var(--paper); outline: none;
}
.welcome-choice.quiet { border-left-color: var(--gold-soft); }
.welcome-choice.quiet strong { color: var(--ink); }
.welcome-code { margin-top: 16px; }
.welcome-code label { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
.modal-welcome .invite-error { margin: 10px 0 0; min-height: 0; font-size: 13.5px; }
.welcome-back { justify-content: flex-start !important; margin-top: 12px !important; }
.church-code-row { display: flex; gap: 10px; align-items: flex-start; }
.church-code-row input[type="text"] {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.church-code-row .btn { flex: none; white-space: nowrap; padding: 10px 18px; }
.church-ask-note {
  margin: 14px 0 0 !important;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px !important;
  color: var(--ink-faint) !important;
}

/* ---------- the Profile panel ----------
   One label-and-control row per setting, the label carrying a quiet line of
   what the setting actually does. Wider than the other modals because the
   three-state controls need the room, and scrollable because a short phone
   in landscape has none. */
.modal-profile {
  width: min(560px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
}
.modal-profile .profile-who { margin: 4px 0 18px; }
.modal-profile .pref-head {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--burgundy-deep);
  margin: 22px 0 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.modal-profile .pref-intro { font-size: 13.5px; margin: 0 0 14px; }

.pref-row {
  display: grid;
  grid-template-columns: 1fr minmax(0, 250px);
  align-items: start;
  gap: 10px 18px;
  margin-bottom: 14px;
}
.pref-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  padding-top: 6px;
}
.pref-hint {
  display: block;
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-faint);
  margin-top: 2px;
}
/* The shared .modal input rule gives every field a bottom margin meant for a
   stacked form; in a two-column row the grid gap is already doing that. */
.pref-row input[type="text"] { margin-bottom: 0; }
.pref-row select {
  width: 100%;
  font-size: 15px;
  font-family: var(--sans);
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.pref-row select:focus { outline: none; border-color: var(--gold); }

/* Not set / On / Off. A segmented control rather than a checkbox, because a
   checkbox has two states and this has three — and "not set" is the one that
   has to be visibly available, not merely implied by never touching it. */
.pref-seg {
  display: flex;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.pref-seg button {
  flex: 1;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 4px;
  border: none;
  border-right: 1px solid var(--line);
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.pref-seg button:last-child { border-right: none; }
.pref-seg button:hover { background: var(--paper); }
.pref-seg button.on { background: var(--burgundy); color: #fff; }
.pref-seg button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.pref-parts { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }

.profile-actions { align-items: center; }

@media (max-width: 560px) {
  /* One column: the hints are long enough that a 250px control column would
     leave the labels a word wide. */
  .pref-row { grid-template-columns: 1fr; }
  .pref-label { padding-top: 0; }
  .modal-profile { padding: 22px 20px; }
  .profile-actions { flex-wrap: wrap; }
}

/* ---------- Toasts (HymnCommon.notify) ---------- */

.toast-stack {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  pointer-events: auto;
  max-width: min(420px, calc(100vw - 36px));
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  padding: 12px 14px;
  font-size: 14.5px;
  color: var(--ink);
  animation: toast-in 0.18s ease-out;
}
.toast-error { border-left-color: var(--danger); }
.toast-text { flex: 1; }
/* A toast whose whole point is that there is somewhere to go. Inline with the
   sentence, because it finishes it. */
.toast-action {
  white-space: nowrap;
  font-weight: 700;
  color: var(--burgundy);
  text-decoration: underline;
}
.toast-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 2px;
  color: var(--ink-faint);
}
.toast-close:hover { color: var(--ink); }
.toast-going { opacity: 0; transform: translateY(6px); transition: opacity 0.2s ease, transform 0.2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast-going { transition: none; }
}

/* ---------- Misc ---------- */

.play-hint {
  font-size: 13.5px;
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
  margin-top: -8px;
}

@media (max-width: 640px) {
  .app-main { padding: 22px 14px 56px; }
  .lesson-content { padding: 24px 20px 28px; }
  .hero h1 { font-size: 34px; }
  .module-header h1 { font-size: 30px; }
  .site-header { padding: 12px 16px; gap: 10px; }
  .brand-text { font-size: 22px; }
  .brand-mark { font-size: 30px; }

  /* Phone header: the brand keeps its words, the name becomes its first
     letter and the admin link becomes its gear. Both of those still say who
     and what they are when tapped. */
  /* Somebody who is both the site owner and a church's administrator wears
     four pills here, which at this width is 3px more than there is room for.
     The gap gives it back. */
  .header-right { gap: 8px; }
  .chip-name { display: none; }
  .chip-initial { display: inline; }
  /* Except for a visitor: an initial stands in for a name, and somebody with
     no account has none. "Sign in" is two syllables and fits where an email
     address never could, so it keeps its words here. */
  .chip-guest .chip-name { display: inline; }
  .chip-guest .chip-initial { display: none; }
  /* Narrower, not shorter — the height is the header's, set once in :root. */
  .user-chip { padding-left: 11px; padding-right: 11px; max-width: none; }
  .admin-link { padding-left: 10px; padding-right: 10px; }
  .admin-link-word { display: none; }

  /* The instrument's name goes, leaving the emoji that was already showing
     which one is chosen — and which the panel spells out in full the moment
     the pill is tapped. */
  .audio-trigger { padding-left: 9px; padding-right: 9px; }
  .audio-trigger-label { display: none; }

  /* The panel is hung off the header's right edge rather than the pill's, so
     it cannot reach past the screen on a narrow phone. */
  .audio-menu, .user-menu { position: static; }
  .audio-panel, .user-panel {
    right: 16px;
    left: 16px;
    width: auto;
    max-width: 320px;
    margin-left: auto;
  }
}

/* ================= admin panel & invite gate ================= */

/* One per hat the signed-in person wears, so somebody who is both the site
   owner and a church's administrator gets both pills. They never shrink —
   the user chip beside them is what gives way when the header is tight. */
.admin-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding-left: 12px;
  padding-right: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.admin-link:hover { background: rgba(255, 255, 255, 0.18); }

/* ---- the admin and church menus ----

   Both pills open rather than navigate: each section is a handful of pages
   with no home page above them, so the menu IS the way between them. One set
   of rules for the two, because two pills side by side that opened panels of
   different widths and manners would look like a mistake.
   It borrows the user panel's paper and rows wholesale (.user-panel, .um-*),
   because two panels hanging off two neighbouring pills that did not match
   would look like a mistake. Only what differs is written here. */

.admin-menu { position: relative; flex: none; }
.admin-trigger {
  gap: 4px;
  font-family: var(--sans);
  background: none;
  cursor: pointer;
}
.admin-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.20);
  border-color: var(--gold-soft);
}
.admin-trigger:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
/* The chevron is the audio pill's, turned by the same rule. */
.admin-trigger[aria-expanded="true"] .audio-trigger-chevron { transform: rotate(180deg); }

/* Narrower than the user panel beside it, and deliberately: these are five
   short labels, and a panel sized for prose that is not there reads as a
   panel with something missing. Wide enough for "Copyright Approvals" with
   its count beside it, which is the longest this list ever gets. */
.admin-panel { width: 220px; }
.admin-panel[hidden] { display: none; }

/* Approvals waiting, said on the closed pill too: the count inside the menu
   is no use to somebody with no reason to open it. A dot, not a number —
   the number is on the row itself, one tap away. */
.admin-trigger.has-pending::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 1px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--burgundy);
}

/* The page you are already on, marked in the list rather than left to be
   guessed at, since the menu is the only navigation these pages have. */
.um-here { background: var(--paper-deep); }
.um-here .um-label { color: var(--burgundy); }

.um-item .pending-dot { margin-left: auto; align-self: center; }

/* The Practice Room's two tabs, under the page title. Underlined rather than
   boxed so they read as places in one room, not as buttons. */
.admin-subnav {
  display: flex;
  gap: 4px;
  margin: -12px 0 24px;
  border-bottom: 1px solid var(--line);
}
.admin-subnav a {
  padding: 9px 16px 8px;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
}
.admin-subnav a:hover { color: var(--burgundy); }
.admin-subnav a.on { color: var(--burgundy); border-bottom-color: var(--gold); }
.admin-subnav a:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
/* The same strip where the tabs are views of one page and not pages of
   their own (Instrument Settings): buttons, dressed as the links are. */
.admin-subnav button {
  padding: 9px 16px 8px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.admin-subnav button:hover { color: var(--burgundy); }
.admin-subnav button.on { color: var(--burgundy); border-bottom-color: var(--gold); }
.admin-subnav button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.subnav-count[hidden] { display: none; }
.subnav-count {
  display: inline-block;
  min-width: 19px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--burgundy-deep);
  font-size: 12.5px;
  line-height: 19px;
  text-align: center;
}

/* The trail's own name for the admin section. It is not a link — there is no
   admin home page to send anyone to — so it must not look like one. */
.crumb-flat { color: var(--ink-faint); }

/* The pill is hidden from anyone who is not a church's administrator, and the
   display above outranks the browser's own [hidden] rule — the same trap
   .ed-bar[hidden] further down is written against. */
.admin-link[hidden] { display: none; }

/* The phone. Four pills is one more than the header can hold at this width.
   The word beside the icon has already gone; the chevron goes too, leaving
   the icon to say what the pill is, as the other pills' icons do.

   This sits below the base rules above rather than in the shared media query
   further up the file, because at equal specificity the later rule wins and
   the base rules would take it straight back off.

   The panel itself needs no phone treatment now that it is 220px: hung off
   the pill it cannot reach past the screen edge, which is the only thing the
   sound and user panels move for. */
@media (max-width: 640px) {
  .admin-trigger { padding-left: 9px; padding-right: 9px; }
  .admin-trigger .audio-trigger-chevron { display: none; }
}

.admin-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  margin: 0 0 24px;
}
.admin-card h2 {
  font-family: var(--serif);
  color: var(--burgundy-deep);
  margin: 0 0 14px;
  font-size: 24px;
}
.admin-dim { color: var(--ink-faint); font-size: 13px; }

/* The same job as .admin-dim, on the pages an ordinary member reads rather
   than the ones behind a role. 13px is fine in an admin table, where the
   density is the point and the reader is looking something up; it is too
   small for a paragraph somebody is being asked to read and act on. This
   matches the prose pages (#/church-accounts and its neighbours) so the two
   halves of the same explanation are set the same size. */
.card-copy {
  color: var(--ink-soft);
  font-size: 16.5px;
  line-height: 1.6;
}
/* A footnote under a card's own business — the pointer from an individual
   subscription to the page that sells a church one. Quieter than the copy
   above it and set off by a rule, so it reads as "and if you are here for
   something else" rather than as a second offer. */
.card-aside {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.card-aside a { color: var(--burgundy); font-weight: 600; }

.admin-toggle {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  cursor: pointer;
  font-size: 15px;
}
.admin-toggle input { transform: translateY(2px); }

/* The piano's sliders (Admin → Instrument Settings): two to a row where
   there is room for two. */
.touch-sliders {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px 32px; margin: 0 0 18px;
}
.touch-slider label { display: flex; justify-content: space-between; font-weight: 600; }
.touch-slider output { font-weight: 400; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.touch-slider input[type="range"] { width: 100%; accent-color: var(--burgundy); }
.touch-slider p { margin: 0; }
#piano-state { align-self: center; }

.admin-invite-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.admin-invite-form input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14.5px;
}
.admin-invite-form input[type="number"] {
  width: 76px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14.5px;
}
.admin-invite-form input:focus { outline: none; border-color: var(--gold); }

.admin-banner {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14.5px;
}

.invite-code {
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(110, 38, 57, 0.07);
  padding: 2px 7px;
  border-radius: 6px;
}

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.admin-table th {
  text-align: left;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  border-bottom: 2px solid var(--line);
  padding: 6px 10px;
}
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
/* Stays a real table cell, so the row's rule runs unbroken beneath it. It was
   display:flex, which takes a cell out of the table and leaves a gap in the
   line. The gaps between the buttons are margins for that reason. */
.admin-actions-cell > * { margin: 2px 8px 2px 0; vertical-align: middle; }
.admin-actions-cell select {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  max-width: 220px;
}
/* Admin → Settings → AI models and prices: the add/edit form labels each field above it. */
.ai-model-form-title { font-size: 15px; margin: 18px 0 8px; }
.ai-model-form { align-items: flex-end; }
.ai-model-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.ai-model-form label:first-child { flex: 1; min-width: 200px; }
.ai-model-form label:first-child input { flex: none; }
.ai-model-form select {
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14.5px;
}
.ai-model-form input[type="number"] { width: 96px; }
.ai-model-form input:disabled, .ai-model-form select:disabled { background: var(--paper-deep); color: var(--ink-soft); }
.ai-model-form-buttons { display: flex; gap: 8px; }
.ai-model-form-buttons [hidden] { display: none; }
.ai-model-table td:nth-child(n+3):nth-child(-n+7) { white-space: nowrap; }

.admin-mini-btn { padding: 7px 12px; font-size: 13.5px; }
.admin-mini-btn.danger { color: #a02020; border-color: #a02020; }
.admin-mini-btn.danger:hover { background: rgba(160, 32, 32, 0.07); }

/* A hymn row's Actions menu (admin-practice.js). The editor's menu panel, but
   hung from <body> and fixed to its button: the table sits in a sideways-
   scrolling wrapper that would clip anything positioned inside it. */
/* Doubled class: .ed-menu-pop comes later in this file and would otherwise
   win back its right: 0, stretching the fixed panel to the window's edge. */
.ed-menu-pop.row-menu-pop { position: fixed; top: 0; left: 0; right: auto; z-index: 60; }
.row-menu-btn[aria-expanded="true"] { border-color: var(--gold); background: var(--gold-soft); }
.ed-menu-item.danger { color: #a02020; }
.ed-menu-item.danger:hover:not(:disabled) { background: rgba(160, 32, 32, 0.07); color: #a02020; }

/* The mark on a row whose hymn carries the reader's own note. Gold like the
   Hymn List star, and a button: it opens the note. */
.note-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font: inherit;
  font-size: 12px;
  color: var(--burgundy-deep);
  background: rgba(184, 145, 47, 0.14);
  border: 1px solid var(--gold);
  border-radius: 999px;
  cursor: pointer;
  vertical-align: 1px;
}
.note-flag:hover { background: var(--gold-soft); }
.note-stamp { margin: 6px 0 0; font-size: 13px; }
.modal-actions .note-delete { color: #a02020; margin-right: auto; }
.modal-actions:has(.note-delete) .btn { white-space: nowrap; }

.invite-gate {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}
.invite-gate input {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  width: 210px;
}
.invite-gate input:focus { outline: none; border-color: var(--gold); }
.invite-error { color: #a02020; font-weight: 600; min-height: 1.4em; margin-top: 10px; }

/* ================= sign-in card ================= */

.login-card {
  max-width: 420px;
  margin: 26px auto 0;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  text-align: center;
}
.login-card h2 {
  font-family: var(--serif);
  color: var(--burgundy-deep);
  margin: 0 0 6px;
  font-size: 26px;
}
.login-card p { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 16px; }
.login-step { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.login-step input {
  flex: 1;
  min-width: 170px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
.login-step input:focus { outline: none; border-color: var(--gold); }
#login-code { letter-spacing: 6px; text-align: center; font-weight: 700; }
.login-links { margin-top: 14px !important; font-size: 13.5px; }
.login-links a { color: var(--burgundy); }
.login-step[hidden] { display: none; }
.login-links[hidden] { display: none; }
.login-card p.invite-error { color: #a02020; }

/* The way out of the sign-in page. Quiet and below the card: nobody has to be
   here, and the offer to carry on looking should read as an offer rather than
   as a second call to action competing with the one above it. */
.login-browse { margin-top: 18px; font-size: 14px; }
.login-browse a { color: var(--ink-soft); text-decoration: underline; }
.login-browse a:hover { color: var(--burgundy); }

/* The same thought on the course home, for a visitor who has not signed in:
   said once, under the button that starts the course, and never in front of
   it. */
.hero p.hero-guest {
  margin: 14px auto 0;
  max-width: 46ch;
  font-size: 14px;
  color: var(--ink-faint);
}
.hero p.hero-guest a { color: var(--burgundy); font-weight: 600; }

/* ================= hymn editor (admin) ================= */

/* The toolbar rides under the site header, the chip row rides under the
   toolbar, and the Hymn and Actions menus drop over both.
   `position` carries two jobs here and neither is decoration. It is what
   makes the bar STICK — left static it scrolled away with the music, taking
   Preview, Hymn and Actions off the screen exactly when a long hymn needs
   them. And it is what makes `z-index` mean anything: z-index is ignored on
   a static element, so the 70 below did nothing and the menus opened
   UNDERNEATH the chip row, which is sticky at 30.
   The offset is the site header's own height, measured (see fitBar) rather
   than assumed, because that header is one row of flexible content and is
   not the same height at every width. The fallback is its height on a
   desktop, used only until the first measurement lands. Sticking any higher
   would slide the bar under the header — and with z-index 70 against the
   header's 50, it would draw straight over it. */
.editor-toolbar {
  flex-wrap: wrap;
  position: sticky;
  top: var(--ed-toolbar-top, 74px);
  z-index: 70;
}
.ed-spacer { flex: 1; }
.ed-status { font-size: 13.5px; color: var(--ink-faint); font-weight: 600; }
.ed-status.dirty { color: #a02020; }

.ed-error-box {
  background: #f9eef0;
  border: 1px solid #e5c3ca;
  border-radius: 8px;
  color: var(--burgundy);
  font-size: 14px;
  padding: 10px 14px;
  margin: 0 0 14px;
}
.ed-error-box ul { margin: 6px 0 0; padding-left: 22px; }

/* ---- the chip row: one line of controls, one popover open at a time ---- */

.ed-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 7px 14px;
  margin: 0 0 16px;
  position: sticky;
  /* Clears the sticky toolbar above it, which in turn clears the site header.
     Neither height is a constant — the toolbar wraps onto a second line when
     the window narrows or a control is added, and the header is shorter on a
     phone — so the editor measures both and sets this variable (see fitBar).
     The fallback is the desktop sum, 74 header + 69 toolbar + 8 clear, used
     only before the first measurement lands. */
  top: var(--ed-bar-top, 151px);
  z-index: 30;
}
.ed-bar .admin-mini-btn { border-radius: 999px; }
/* `display: flex` above outranks the browser's own [hidden] rule, so the
   row with nothing selected needs telling twice. */
.ed-bar[hidden] { display: none; }
.ed-bar-rule { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }

/* where you are, over the part chips — two tight lines rather than one wide
   one, so the row keeps its width free for chips added later */
.ed-selblock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-right: 2px;
}
.ed-selblock .ed-pos { font-size: 12.8px; line-height: 1.25; letter-spacing: 0.02em; }
.ed-bar .ed-voice-tabs { gap: 4px; }
.ed-bar .ed-voice-tab { font-size: 12px; padding: 2px 9px; }

.ed-chip-val { font-weight: 400; color: var(--ink-faint); }
.ed-chip.ed-on .ed-chip-val { color: var(--burgundy-deep); }

.ed-anchor { position: relative; display: inline-flex; }
.ed-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 9px);
  z-index: 60;
  min-width: 250px;
  max-width: min(560px, 92vw);
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(43, 38, 32, 0.18);
  padding: 10px 14px 12px;
}
/* Wide enough for the row of eight note values, which is the widest thing the
   editor ever has to keep on one line, and no wider — the floor is here to
   stop a wrapping group collapsing to one button per line, not to reserve
   room nothing uses. A panel needing more (Pitch) takes it from its content. */
.ed-pop.wide { min-width: min(420px, 88vw); }
.ed-pop.flip { left: auto; right: 0; }
/* The guide's "?" gets a corner of its own. Floated, it sat over whatever
   reached the right edge — the Words panel's Next button among them — since
   a shrink-to-fit panel is sized without counting the float. */
.ed-pop:has(> .ed-guide-mark) { padding-right: 40px; }
.ed-pop > .ed-guide-mark { position: absolute; top: 9px; right: 10px; float: none; margin: 0; }
.ed-pop[hidden] { display: none; }
.ed-pop .ed-group { border-top: none; padding-top: 0; }
.ed-pop .ed-group + .ed-group { border-top: 1px dashed var(--line); padding-top: 7px; }
.ed-pop .ed-group-label { min-width: 0; width: 100%; margin-bottom: 2px; }
/* Chips that belong on one line whatever the popover would rather do: the
   row's own width is what widens the popover to hold them, and a popover has
   width to spare where it has no height to spare.
   The chips keep their natural size. Left shrinkable, they obey the line by
   going square and wrapping their own labels instead — which trades the
   height back and loses the elongated pill shape they are drawn as. */
.ed-chip-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 7px; }

/* A note value shown as the note. The glyph carries its own stem, so it sits
   high in the line and the chip's top padding is trimmed to match the height
   of the chips beside it. The augmentation dot is an ordinary middle dot in
   the surrounding face — see durGlyph — so it stays beside the notehead
   instead of following the flag. */
.ed-note {
  font-family: 'Noto Music', 'Segoe UI Symbol', serif;
  font-size: 27px;
  line-height: 1;
}
.ed-dur {
  min-width: 42px;
  padding: 1px 10px 5px;
  justify-content: center;
  font-size: 17px;   /* the dot */
}
.ed-dur-glyph { margin-left: 4px; }
/* the same note inline in a sentence, where 27px would open up the line */
.ed-dur-glyph .ed-note { font-size: 20px; }

/* The augmentation dot, drawn beside the notehead. Sized and offset in em so
   it holds its place against the note at whatever size the note is shown. */
.ed-dot {
  display: inline-block;
  width: 0.15em;
  height: 0.15em;
  margin-left: 0.06em;
  vertical-align: 0.13em;
  border-radius: 50%;
  background: currentColor;
}
.ed-chip-row > .btn { flex: 0 0 auto; white-space: nowrap; }

/* A one-line group keeps its label beside its buttons instead of above them,
   so the popover is as shallow as a row of chips. It needs no width rule to
   do it: an absolutely positioned box shrink-to-fits to its MIN-content, and
   a nowrap row's min-content is the whole row — so this group, and the note
   values in .ed-chip-row, already set the width between them.
   `width: max-content` used to be here and was the reason these panels ran to
   their 560px cap: max-content lays a WRAPPING group out on one line too, so
   an eight-button row plus its label asked for far more width than anything
   in the panel actually needed. .flip still swings the box left of its chip
   when it would reach past the page. */
.ed-pop .ed-group-1line { flex-wrap: nowrap; }
.ed-pop .ed-group-1line .ed-group-label {
  width: auto;
  margin-bottom: 0;
  white-space: nowrap;
}

/* Tabs inside an Advanced section — one panel showing instead of all of them
   stacked, which is what keeps these popovers shallower than the music they
   hang over. They ride on the Advanced button's own line rather than taking
   one of their own, so the tabs themselves cost no height at all: small type,
   tight padding, and never wrapping. */
.ed-tabs { display: flex; gap: 4px; flex-wrap: nowrap; margin-left: 2px; }
.ed-tab {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-faint);
  white-space: nowrap;
  cursor: pointer;
}
.ed-tab:hover { color: var(--burgundy-deep); border-color: var(--gold); }
.ed-tab.active {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--burgundy-deep);
}
/* A tab whose panel has something set on this column. Without it a fermata
   could sit one unchosen tab away and read as absent — the same mistake the
   folded section itself is careful not to make. */
.ed-tab-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 5px;
  vertical-align: 0.1em;
  border-radius: 50%;
  background: var(--burgundy);
}

/* armed to pick the first chord of the refrain */
.ed-armed {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(184, 145, 47, 0.18);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  margin: 0 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--burgundy-deep);
}
.ed-armed[hidden] { display: none; }

.ed-pos { font-weight: 700; color: var(--burgundy-deep); font-size: 14.5px; }
.ed-voice-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-voice-tab {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--part-color);
  color: var(--part-color);
  background: transparent;
  cursor: pointer;
}
.ed-voice-tab.active { background: var(--part-color); color: #fff; }

.ed-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border-top: 1px dashed var(--line);
}
.ed-group-label { font-size: 13px; color: var(--ink-faint); margin-right: 4px; min-width: 150px; }
.ed-on { background: var(--gold-soft); border-color: var(--gold); }

/* Why a control in an open panel is refusing — said beside the control rather
   than in a tooltip nobody hovers, since the buttons are already disabled. */
.ed-warn { color: var(--burgundy-deep); }
/* A field whose meaning is narrower than its label suggests: the Details
   panel's time signature, once a hymn changes meter part-way through. */
.ed-field-note { font-weight: 400; font-size: 12px; color: var(--ink-faint); }

.ed-pair {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-faint);
  cursor: pointer;
  user-select: none;
}
.ed-pair input { accent-color: var(--gold); }
.ed-pair:has(input:disabled) { opacity: 0.45; cursor: default; }

.ed-lyric { font-size: 12.5px; font-weight: 700; color: var(--ink-faint); }
.ed-lyric input {
  font: inherit;
  font-size: 13.5px;
  font-weight: 400;
  width: 96px;
  margin-left: 4px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.ed-lyric input:focus { outline: none; border-color: var(--gold); }
/* The verse boxes stack, and "Next" stands in the space beside them — a whole
   line of words is typed box, box, Next, without the mouse. They share a row
   of their own: left to the group's own wrapping they part company over a
   single pixel, the popover being only as wide as its widest line. */
.ed-words .ed-lyric-row { display: flex; align-items: center; gap: 9px; }
/* Neither may give ground: a box squeezed by a hair drops under its own
   "V1" and the stack doubles in height. */
.ed-words .ed-lyric-stack { display: flex; flex-direction: column; gap: 7px; flex: none; }
.ed-words .ed-lyric { white-space: nowrap; }
.ed-words .ed-lyric-row .btn { white-space: nowrap; flex: none; }

/* ---- the whole-hymn sections, opened from the toolbar's Hymn menu ---- */

.ed-section-modal { width: min(560px, 92vw); text-align: left; }
.ed-section-modal.wide { width: min(680px, 94vw); }
.ed-section-modal h2 { font-size: 22px; margin-bottom: 12px; }
.ed-section-body { max-height: min(60vh, 540px); overflow-y: auto; }
.ed-section-body > p:first-child { margin-top: 0; }
.ed-section-body p { font-size: 14px; margin: 4px 0 8px; }
.ed-section-body .import-form { margin: 0 0 10px; }
/* The Details form owns every field in it. Left alone, `.modal input[type=text]`
   is the more specific rule and would claim the text fields only — leaving them
   bigger, with a margin the grid has already allowed for, beside selects and
   number fields that no longer matched them. */
.ed-section-body .import-form input,
.ed-section-body .import-form select {
  width: 100%;
  font-size: 14.5px;
  padding: 8px 10px;
  margin-bottom: 0;
  border: 1px solid var(--line);
  background: #fff;
}
.ed-section-body .import-form input:disabled,
.ed-section-body .import-form select:disabled {
  background: var(--paper-deep);
  color: var(--ink-soft);
}
.ed-section-body .ed-group:first-of-type { border-top: none; }
.ed-section-modal .modal-actions { margin-top: 16px; }

/* On a phone the toolbar above wraps onto several lines, and a row stuck
   below it would leave almost no window to read the music through. It rides
   with the page instead, and drops its pill shape now that it is several
   lines tall itself. */
@media (max-width: 640px) {
  .ed-bar { position: static; border-radius: 16px; padding: 9px 12px; }
  .ed-pop { max-width: calc(100vw - 40px); }
}

/* ================= the hymn editor guide (#/admin/hymns/guide) ================= */

/* The guide's navigation is one slim bar that stays under the site header: the
   Contents button opens the list, the middle says where you are, and the
   arrows step through the sections. It replaced a column of links down the
   left, which took a third of the width to say what a line can. */
.guide-bar {
  position: sticky;
  top: 80px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 16px;
  padding: 5px 6px 5px 5px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.guide-bar-menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--burgundy-deep);
  background: var(--paper-card);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 4px 14px 4px 5px;
  cursor: pointer;
}
.guide-bar-menu:hover, .guide-bar-menu[aria-expanded="true"] { background: var(--gold-soft); }
.guide-bar-menu .chip-icon { width: 22px; height: 22px; font-family: var(--sans); font-size: 12px; }
.guide-bar-here {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--burgundy-deep);
}
.guide-bar-count {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-right: 10px;
}
.guide-bar-step { display: flex; flex: none; gap: 2px; }
.guide-bar-step button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--burgundy-deep);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.guide-bar-step button:hover:not(:disabled) { background: var(--paper-deep); }
.guide-bar-step button:disabled { color: var(--ink-faint); opacity: 0.4; cursor: default; }

.guide-toc-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(380px, 100%);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  counter-reset: guide;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(40, 10, 20, 0.18);
}
.guide-toc-pop[hidden] { display: none; }
.guide-toc-pop li { counter-increment: guide; }
.guide-toc-link {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  text-align: left;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-radius: 6px;
  padding: 7px 8px;
  cursor: pointer;
  line-height: 1.35;
}
.guide-toc-link::before {
  content: counter(guide) ".";
  display: inline-block;
  width: 24px;
  color: var(--ink-faint);
  font-size: 12.5px;
}
.guide-toc-link:hover { background: var(--paper-deep); color: var(--burgundy-deep); }
.guide-toc-link.active { color: var(--burgundy-deep); font-weight: 700; }
.guide-toc-link.active::before { color: var(--gold); }

.guide {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 38px 34px;
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--ink);
}
.guide-lede {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

/* An aside for whoever runs the site, in a guide written for everybody who
   edits hymns — set apart so a church administrator can see it is not for
   them without having to read it twice. */
.guide-note {
  border-left: 3px solid var(--gold-soft);
  background: var(--paper-deep);
  padding: 10px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  color: var(--ink-soft);
}
.guide h2 {
  font-family: var(--serif);
  font-size: 25px;
  color: var(--burgundy-deep);
  margin: 34px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 150px;
}
.guide h2:first-of-type { margin-top: 26px; }
.guide h3 {
  font-family: var(--serif);
  font-size: 18.5px;
  color: var(--burgundy);
  margin: 20px 0 2px;
}
.guide p { margin: 0 0 12px; }
.guide ul, .guide ol { margin: 0 0 14px; padding-left: 24px; }
.guide li { margin-bottom: 6px; }
.guide a { color: var(--burgundy); }
.guide strong { color: var(--ink); }

.guide-steps li { margin-bottom: 10px; }

.guide-chip {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--burgundy);
  background: rgba(184, 145, 47, 0.18);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 1px 8px;
}

/* A screenshot in a guide: framed like the page it shows, and held to a
   width a reader can take in. The files are 2x, so max-width does the scaling. */
.guide-shot { margin: 16px 0 22px; }
.guide-shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.guide-shot.narrow img { max-width: 520px; }
.guide-shot figcaption {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink-faint);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 18px;
  font-size: 14px;
}
.guide-table caption {
  caption-side: bottom;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.5;
  padding-top: 8px;
}
.guide-table th, .guide-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.guide-table thead th, .guide-table tbody th {
  background: var(--paper-deep);
  color: var(--burgundy-deep);
  font-weight: 700;
  white-space: nowrap;
}
.guide-hold { color: var(--gold); font-weight: 700; text-align: center !important; }

.guide-keys { font-size: 13.5px; }
.guide-keys th { width: 34%; }

kbd {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
}

.guide-gloss { margin: 0 0 14px; }
.guide-gloss dt {
  font-weight: 700;
  color: var(--burgundy-deep);
  margin-top: 12px;
}
.guide-gloss dd { margin: 2px 0 0; }

@media (max-width: 640px) {
  .guide { padding: 22px 20px 26px; font-size: 15px; }
  .guide-bar-count { display: none; }
  .guide-bar-menu { padding-right: 12px; }
}

/* one-line "the beats don't add up" bar, with the rest a click away */
.ed-errors-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  background: #f9eef0;
  border: 1px solid #e5c3ca;
  border-radius: 8px;
  color: var(--burgundy);
  font-size: 13.5px;
  padding: 7px 12px;
  margin: 0 0 10px;
}
.ed-errors-icon { color: #a02020; }
.ed-errors-text { font-weight: 600; }
.ed-errors-note { color: var(--ink-faint); font-size: 12.5px; margin-left: auto; }

/* a one-off note (fresh import) — compact, expandable when it has a list */
.ed-note-box {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 8px 14px;
  margin: 0 0 10px;
  font-size: 13.5px;
}
.ed-note-box ul { margin: 6px 0 0; padding-left: 22px; }

/* AI review (hymn-ai-review.js): the dialog that asks for the scan, and the
   box under the toolbar that says where the review stands */
.ai-review-modal { width: min(580px, 94vw); text-align: left; max-height: 92vh; overflow-y: auto; }
.ai-review-modal p { line-height: 1.5; }
.ai-review-modal .ai-review-warn { margin-bottom: 4px; color: var(--ink); }
.ai-review-lost { margin: 0 0 12px; padding-left: 22px; font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.ai-review-lost li { margin-bottom: 5px; }
.ai-review-modal .ai-review-kept { font-size: 13.5px; margin: 0 0 14px; }
.ai-review-modal .import-drop { margin-bottom: 8px; }
.ai-review-box .ai-review-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* a button that reads as a link (help, "+2 more") */
.linkish {
  font: inherit;
  font-size: inherit;
  color: var(--burgundy);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.linkish:hover { color: var(--burgundy-deep); }

.module-header.compact { margin-bottom: 14px; }
.module-header.compact h1 { margin-bottom: 0; }

/* title on the left, the Instructions chip riding the same line on the right */
.ed-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
}
/* where the header carries a paragraph too, the chip belongs up by the title */
.ed-header.align-top { align-items: flex-start; }
.ed-header.align-top .chip-btn { margin-top: 6px; }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--burgundy-deep);
  text-decoration: none;
  background: var(--paper-card);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 6px 16px 6px 7px;
  margin-bottom: 6px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s, box-shadow 0.15s;
}
.chip-btn:hover { background: var(--gold-soft); box-shadow: none; }
/* The trail on the left, a chip on the right. The trail stays outside the
   flexbox for the reason given at .crumb-back: it is a run of text. */
.crumbs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.crumbs-row .crumbs, .crumbs-row .chip-btn { margin-bottom: 0; }

.chip-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

/* ---- the Actions menu ---- */

.ed-menu { position: relative; }
.ed-menu-caret { font-size: 11px; opacity: 0.8; }
.ed-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 236px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(43, 38, 32, 0.18);
  padding: 6px;
  z-index: 10;
}
.ed-menu-pop[hidden] { display: none; }
.ed-menu-pop hr { border: none; border-top: 1px solid var(--line); margin: 5px 8px; }
.ed-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  text-align: left;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}
.ed-menu-item:hover:not(:disabled) { background: var(--gold-soft); color: var(--burgundy-deep); }
.ed-menu-item:disabled { opacity: 0.4; cursor: default; }
.ed-menu-hint { font-size: 12px; color: var(--ink-faint); }

/* the instructions card — where the guide is, with the keys folded away */
.ed-help-modal { width: min(510px, 92vw); text-align: left; }
.ed-help-modal h3 {
  font-family: var(--serif);
  color: var(--burgundy-deep);
  font-size: 18px;
  margin: 16px 0 4px;
}
.ed-help-modal p { margin: 0 0 8px; line-height: 1.55; }
.ed-help-modal .guide-table { margin: 10px 0 4px; }
.ed-help-more { color: var(--ink-faint); font-size: 13.5px !important; line-height: 1.5; }

/* Actions → History: the versions a hymn held before its last ten saves. */
.ed-history-modal { width: min(560px, 92vw); text-align: left; }
.ed-history-list {
  list-style: none; margin: 0 0 14px; padding: 0;
  max-height: min(52vh, 460px); overflow-y: auto;
  border-top: 1px solid var(--line);
}
.ed-history-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 2px; border-bottom: 1px solid var(--line);
}
.ed-history-what { flex: 1; min-width: 0; font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.ed-history-modal .ed-history-what p { margin: 3px 0 0; font-size: 14px; }
.ed-history-modal .ed-history-what .ed-history-fate { color: var(--ink-faint); font-size: 13px; }
.ed-history-none { color: var(--ink-faint); }

.ed-help-keys {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 0 14px;
  margin: 16px 0 2px;
}
.ed-help-keys > summary {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--burgundy-deep);
  cursor: pointer;
  padding: 10px 0;
  list-style: none;
}
.ed-help-keys > summary::-webkit-details-marker { display: none; }
.ed-help-keys > summary::before {
  content: "›";
  color: var(--gold);
  display: inline-block;
  width: 14px;
  transition: transform 0.15s;
}
.ed-help-keys[open] > summary { border-bottom: 1px solid var(--line); }
.ed-help-keys[open] > summary::before { transform: rotate(90deg); }
.ed-help-keys > *:last-child { margin-bottom: 12px !important; }

/* the “?” on a popover or a section window, opening the guide at that section */
.ed-guide-mark {
  float: right;
  margin: -2px 0 0 10px;
  width: 21px;
  height: 21px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
  background: transparent;
  border: 1.5px solid var(--gold-soft);
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.ed-guide-mark:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
/* the same mark shown inside a sentence, to name it rather than to be clicked */
.ed-guide-mark.inline {
  float: none;
  display: inline-grid;
  place-items: center;
  margin: 0 2px;
  vertical-align: -4px;
  cursor: inherit;
}
.ed-guide-mark.inline:hover { background: transparent; border-color: var(--gold-soft); color: var(--gold); }

.ed-verse-list, .ed-line-list { list-style: none; margin: 4px 0 0; padding: 0; }
.ed-verse, .ed-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
}
.ed-verse-num, .ed-line-num {
  font-weight: 700;
  color: var(--burgundy-deep);
  font-size: 14px;
  min-width: 54px;
}
/* How many measures the line carries, counted rather than worked out from
   the range beside it — a measure the refrain cuts in two is drawn on both
   lines and named by the same number on each, so the numbers cannot be
   subtracted to get this. Fixed width, so the ranges stay in a column. */
.ed-line-count {
  min-width: 88px;
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.ed-line.lonely .ed-line-count { color: #a02020; font-weight: 600; }

.ed-verse-text, .ed-line-range {
  flex: 1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed-verse-text.empty { color: var(--ink-faint); font-style: italic; }
.ed-line.lonely .ed-line-range { color: #a02020; font-weight: 600; }
.ed-verse-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Transpose: what each part sings now, and what it would sing after. Read
   across a row, so the two spans line up and the change is the eye's work
   rather than the reader's. */
.ed-range-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 4px;
  font-size: 14px;
}
.ed-range-table th, .ed-range-table td { padding: 5px 10px 5px 0; text-align: left; }
.ed-range-table thead th {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
}
.ed-range-table tbody th {
  font-weight: 700;
  color: var(--burgundy-deep);
  min-width: 74px;
}
.ed-range-table tbody tr { border-top: 1px dashed var(--line); }
.ed-range-table tr.ed-range-strain td:last-child { color: var(--danger); font-weight: 600; white-space: nowrap; }
.ed-transpose-stuck { color: var(--danger); font-weight: 600; font-size: 14px; }

.ed-words-modal { max-width: 560px; }
.ed-words-modal textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}
.ed-words-modal textarea:focus { outline: none; border-color: var(--gold); }
.ed-words-count { font-size: 13px; color: var(--ink-faint); margin: 8px 0 4px !important; }
.ed-words-count.over { color: #a02020; font-weight: 600; }

/* while picking the first chord of the refrain */
.editor-music.ed-marking .col-band { fill: rgba(184, 145, 47, 0.16); cursor: crosshair; }

/* measure numbers over the treble staff (editor only) — a reference mark,
   not part of the music, so they stay faint and never take a click */
.measure-no { pointer-events: none; user-select: none; }

/* A column the notation cannot draw honestly, marked over the staff. Unlike
   the measure numbers this one IS to be clicked: it selects its column. */
.col-flag {
  fill: var(--danger);
  cursor: pointer;
  user-select: none;
  font-weight: 700;
}
.col-flag:hover { fill: #c44f38; }
.guide-flag { color: var(--danger); }

/* A time signature the count refused — printed part-way through a measure, or
   changing the beat value. The editor draws it where the document actually
   holds it so it can be found and taken out; nothing counts by it, so it is
   drawn as the mistake it is rather than as music. */
.sig-refused { fill: var(--danger); opacity: 0.75; }

/* The ✱ over a column, and what it says. The mark is keyboard-reachable, so
   it takes a focus ring as well as a hover — and the message is the page's
   own, not the browser's grey system box in the browser's own font. */
.editor-music { position: relative; }
.col-flag:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }
.ed-flag-tip {
  position: absolute;
  z-index: 20;
  max-width: 22rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: #2b2620;
  color: #f7f3ea;
  font-size: 0.82rem;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  pointer-events: none;   /* never steals the click meant for the mark */
  white-space: pre-line;  /* the tip carries its own line breaks */
}

/* A measure whose parts do not add up to a full measure. The wash is behind
   the staff lines and has to stay faint enough to read music through — it is
   saying "look here", not "this is unreadable". The tally under it names only
   the parts that are wrong, each in its own part colour, so the eye goes to
   the right staff without reading a word. */
.measure-short { fill: rgba(196, 79, 56, 0.07); }

/* Everything wrong with one column, opened from its mark on the score. The
   list is the whole point of the dialog, so it is set to be READ — one
   message to a row, well separated, at the body size and not smaller. */
.modal-flags { max-width: 34rem; }
.ed-flag-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  max-height: 50vh;
  overflow-y: auto;
}
.ed-flag-list li {
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: #f9eef0;
  border-radius: 0 6px 6px 0;
  font-size: 13.5px;
  line-height: 1.5;
}
.ed-flag-list li + li { margin-top: 8px; }
/* Where a note came from, and what that means for it. A beat-check problem
   retires itself when the bar adds up; an import note is about the file as it
   arrived and only the reader can retire it — so only that one carries a
   button, and the border colour keeps the two apart at a glance. */
.ed-flag-list li.note-import { border-left-color: var(--gold); }
.ed-flag-from {
  display: block;
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: 12px;
}
.ed-note-done { margin-left: 6px; font-size: 12px; }
.ed-note-box li { margin-bottom: 4px; }
.measure-short-tally { user-select: none; }

/* selected note & column highlights in the score */
.editor-music .note-hit { cursor: pointer; }
.col-band.col-selected { fill: rgba(184, 145, 47, 0.12); stroke: var(--gold); stroke-width: 1; }
.note-hit.note-selected,
.rest-hit.note-selected { filter: drop-shadow(0 0 3px rgba(211, 84, 42, 0.85)); }
.note-hit.note-selected .notehead { stroke: #d3542a; }
.note-hit.note-selected .notehead:not([fill="none"]) { fill: #d3542a; }
.note-hit.note-selected .stem,
.note-hit.note-selected .noteflag { stroke: #d3542a; }
/* A rest is all fill and no parts to pick out, so it colors whole. Only the
   editor's rests answer to the pointer; elsewhere the column band takes the
   click, and a rest in a teaching figure takes none at all. */
.rest-hit.note-selected > * { fill: #d3542a; }
.editor-music .rest-hit { cursor: pointer; }
.editor-music .rest-hit:hover > * { fill: var(--note-hover); }

/* ============ Admin → Import from scan ============ */

.import-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.import-drop.over { border-color: var(--gold); background: var(--gold-soft); }
.import-drop p { margin: 0; }

/* "What you can drop here, and what it carries" — reference, not controls,
   so it sits quieter than the tables that have buttons in them. */
.imp-sources { margin-top: 18px; }
.imp-sources table { font-size: 13.5px; }
.imp-sources td { vertical-align: top; }
.imp-sources td:first-child { white-space: nowrap; }

/* The three ways of adding a hymn, as cards you choose between. */
.imp-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.imp-method {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 4px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  background: var(--paper-card);
}
.imp-method input { grid-row: 1 / span 2; margin-top: 4px; }
.imp-method span { grid-column: 2; font-size: 13.5px; color: var(--ink-soft, var(--ink-faint)); }
.imp-method:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.imp-method.disabled { opacity: 0.55; cursor: not-allowed; }

/* Scans chosen for a batch, before they are sent. */
.imp-picked { list-style: none; margin: 12px 0 0; padding: 0; }
.imp-picked li { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }

/* "Scan Conversion Status" — where each background job is. */
.scan-panel td { vertical-align: top; }
.scan-status { min-width: 220px; }
.scan-failed { color: #a1291f; }
.scan-saved { color: #2f6b3a; }
.scan-attention { color: #8a5a00; }

/* Entry cards side by side when there is room (the admin panels' hubs). */
.admin-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.admin-hub .admin-card {
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
}
.admin-hub .admin-card p { flex: 1; }
.admin-hub .admin-card .btn { align-self: flex-start; margin-top: 14px; }

/* A card's heading with an action riding the right-hand end of it. */
.admin-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.admin-card-head h2 { margin-bottom: 10px; }

.import-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px 16px;
  margin: 16px 0 10px;
}
.import-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
}
/* A field is white and its value is written in full ink — the label above it
   is the faint one. Sharing the card's own color made a filled-in field look
   disabled, and `color: inherit` handed it the label's faintness as well. */
.import-form input,
.import-form select {
  font: inherit;
  font-size: 14.5px;
  font-weight: 400;
  color: var(--ink);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.import-form input:focus,
.import-form select:focus { outline: none; border-color: var(--gold); }

/* The time signature is one field holding two numbers, so its pair of selects
   sit on one row with the slash between them and share the height of an
   ordinary field. Each is only ever one or two digits wide. */
.ed-timesig { display: flex; align-items: center; gap: 6px; }
.ed-timesig select { flex: 1 1 0; min-width: 0; }
.ed-timesig-slash { font-size: 16px; color: var(--ink-faint); }

.import-facts { margin: 6px 0 0; }
/* Who is already at the id the import wants, above the fields that would
   move it out of their way. */
.import-taken { margin: 10px 0 6px; }

.imp-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  background: rgba(0, 0, 0, 0.03);
}
.imp-badge.live {
  border-color: #3f7d47;
  color: #2c5c33;
  background: rgba(63, 125, 71, 0.1);
}

/* ============================================================
   The Practice Room's hymn list — built for a hymnal of several
   hundred, where the search box does the work the eye used to.
   Rows are deliberately denser and quieter than .lesson-row:
   a course has twenty lessons to present, this has a library to
   let someone scan.
   ============================================================ */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hymn-search {
  display: flex;
  /* Bottom-aligned, so the sort control's label can sit above it without
     stretching the search box to match. The two controls line up along the
     edge that matters — the one you click. */
  align-items: flex-end;
  gap: 10px;
  margin: 22px 0 14px;
}

.hymn-sort {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hymn-sort label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--ink-soft);
  padding-left: 2px;
}

/* A search box with its own ✕ at the right end, inside the box. The browser's
   built-in clear mark is hidden so there is only the one. The ✕ shows only
   while something is typed (an empty box shows its placeholder). The click is
   handled once for every box in common.js. */
.search-box { position: relative; display: block; }
.search-box input[type="search"] { width: 100%; padding-right: 40px; }
.search-box input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { background: var(--line); color: var(--ink); }
.search-clear:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.search-box input:placeholder-shown + .search-clear { display: none; }

.hymn-search .search-box { flex: 1; min-width: 0; }
.hymn-search input[type="search"] {
  min-width: 0;
  font-family: inherit;
  font-size: 16px;
  padding: 12px 40px 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.hymn-search input[type="search"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--shadow), 0 0 0 3px rgba(184, 145, 47, 0.18);
}
.hymn-search input[type="search"]::placeholder { color: var(--ink-faint); }

.hymn-search select {
  font-family: inherit;
  font-size: 15px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-card);
  color: var(--ink-soft);
  cursor: pointer;
}

.hymn-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.hymn-filters[hidden] { display: none; }

.hymn-chip {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.hymn-chip span { color: var(--ink-faint); font-size: 12px; }
.hymn-chip:hover { border-color: var(--gold-soft); }
.hymn-chip.active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
}
.hymn-chip.active span { color: rgba(255, 255, 255, 0.7); }

/* The hymnal and tag pickers: a chip that opens a menu. The chip is only as
   wide as what it currently says. The menu under it is as wide as its longest
   line, and its text is the size a menu's should be, not the chip's. */
.hymn-pick { position: relative; max-width: 100%; }
.hymn-pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.hymn-pick-label {
  font-weight: inherit;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hymn-pick-caret { font-style: normal; font-size: 10px; opacity: 0.7; }
.hymn-pick-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 220px;
  width: max-content;
  max-width: min(340px, calc(100vw - 24px));
  overflow-y: auto;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(43, 38, 32, 0.18);
  padding: 6px;
}
.hymn-pick-pop[hidden] { display: none; }
.hymn-pick-pop hr { border: none; border-top: 1px solid var(--line); margin: 4px 8px; }
.hymn-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 31px;
  font: inherit;
  font-size: 15px;
  text-align: left;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
}
.hymn-pick-item b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hymn-pick-item span { font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.hymn-pick-item:hover, .hymn-pick-item:focus-visible {
  background: var(--gold-soft);
  color: var(--burgundy-deep);
  outline: none;
}
.hymn-pick-item.on b { font-weight: 700; color: var(--burgundy); }
.hymn-pick-item.on b::before { content: "✓ "; }
.hymn-pick-item.more b { color: var(--burgundy); font-weight: 600; }

/* Every tag (practice.js, tagsDialog). A dialog on a wide screen. On a phone
   it is a sheet that comes up from the bottom edge, where a thumb is. */
.modal.hymn-tags-modal {
  position: relative;
  width: min(560px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.hymn-tags-modal h2 { font-size: 26px; padding-right: 34px; }
.hymn-tags-modal p { margin: 4px 0 14px; }
.hymn-tags-modal input[type="search"] {
  width: 100%;
  font-family: inherit;
  font-size: 16px;          /* 16px keeps a phone from zooming in on focus */
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.hymn-tags-modal input[type="search"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 145, 47, 0.18);
}
.hymn-tags-x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
}
.hymn-tags-x:hover { background: var(--paper-deep); color: var(--ink); }
.hymn-tags-cloud {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  margin: 14px -6px 0;
  padding: 2px 6px 6px;
}
.hymn-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--gold-soft);
  background: rgba(184, 145, 47, 0.1);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
}
.hymn-tag span { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.hymn-tag:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-soft); }
.hymn-tag:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.hymn-tag.on { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
.hymn-tag.on span { color: rgba(255, 255, 255, 0.75); }
.hymn-tag.on:hover:not(:disabled) { background: var(--burgundy-bright); border-color: var(--burgundy-bright); }
.hymn-tag:disabled { opacity: 0.35; cursor: default; }
.hymn-tags-modal .modal-actions { margin-top: 16px; align-items: center; }
.hymn-tags-modal .modal-actions [hidden] { display: none; }

@media (max-width: 560px) {
  .modal-backdrop.modal-sheet { place-items: end center; }
  .modal.hymn-tags-modal {
    width: 100%;
    max-height: 86dvh;
    border-radius: 18px 18px 0 0;
    padding: 22px 18px calc(16px + env(safe-area-inset-bottom));
  }
  .hymn-tags-modal .modal-actions .btn-primary { flex: 1; justify-content: center; }
  .hymn-chip { padding: 8px 14px; }
  .hymn-pick-item { min-height: 34px; }
}

.hymn-count {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-faint);
}

.hymn-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hymn-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.hymn-row:last-child { border-bottom: none; }
.hymn-row:hover { background: var(--paper-deep); }

.hymn-row-body { flex: 1; min-width: 0; }

.hymn-row-title {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--burgundy-deep);
  line-height: 1.3;
}

.hymn-row-sub {
  display: block;
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hymn-row-meta {
  flex-shrink: 0;
  text-align: right;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  text-transform: uppercase;
}
/* Credits run long ("…; tr. Frederick H. Hedge, 1805–1890"), so the column
   has a ceiling and the overflow is cut rather than squeezing the first line. */
.hymn-row-author {
  display: block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-faint);
  text-transform: none;
  letter-spacing: 0;
}

.hymn-badge {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  background: rgba(0, 0, 0, 0.03);
}
.hymn-badge.ours {
  border-color: var(--gold-soft);
  color: #8a6b14;
  background: rgba(184, 145, 47, 0.12);
}
.hymn-badge.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(160, 32, 32, 0.08);
}

.hymn-empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--ink-faint);
}

/* "Where you left off" — with hundreds of hymns, the handful someone
   actually returns to is the real front door. Kept on the device rather
   than the server: it is a convenience, and it should never wait. */
.hymn-recent { margin-top: 24px; }
.hymn-recent h2 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 10px;
}
.hymn-recent-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.hymn-recent-card {
  flex: 0 0 auto;
  max-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.hymn-recent-card:hover { border-color: var(--gold-soft); }
.hymn-recent-no {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--gold);
}
.hymn-recent-title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--burgundy-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .hymn-search { flex-wrap: wrap; }
  /* The box gets the whole row, so its placeholder can be read. */
  .hymn-search .search-box { flex-basis: 100%; }
  .hymn-sort { flex: 1; }
  .hymn-search select { width: 100%; padding: 10px 12px; }
  /* The tune and meter are the first thing to go when the row is narrow:
     the title and the first line are what identify a hymn. */
  .hymn-row-meta { display: none; }
  .hymn-row { gap: 12px; padding: 11px 14px; }
}

/* ============================================================
   Multi-church administration: seats, copyright approvals, and
   the prompt dialog they both lean on.
   ============================================================ */

.admin-banner.warn {
  border-color: var(--gold);
  background: rgba(184, 145, 47, 0.12);
}

/* The strip above a hymn table: how it is sorted on the left, and whatever
   that shelf can do as a whole on the right. On local dev the shared library's
   strip also carries the hymn export button (tools/dev-hymn-sync.js) and its
   "N commits waiting" reminder, which is when it takes the banner's colouring. */
.admin-list-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.admin-list-bar .list-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-banner.dev-sync { margin-bottom: 14px; }

.admin-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.admin-sort select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  font: inherit;
  font-size: 13.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.admin-sort select:focus { outline: none; border-color: var(--gold); }

/* The shelf's search box takes the strip's first line to itself, so the long
   placeholder can be read and the selects wrap beneath it as a row. */
.admin-search { flex: 1 1 100%; }
.admin-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
}
.admin-search input:focus { outline: none; border-color: var(--gold); }
.admin-list-count { font-size: 13px; }

/* A single number that is the answer to the section's question —
   how many seats are taken, how many hymns can actually be sung. */
.seat-count {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
  color: var(--burgundy-deep);
  margin: 0 0 8px;
}
.seat-count span { font-size: 17px; color: var(--ink-faint); }
.seat-count.full { color: var(--danger); }
.seat-full { color: var(--danger); font-weight: 600; }

/* A church's administrators, each with the ✕ that stands them down. */
.org-admin-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.org-admin-line + .org-admin-line { margin-top: 6px; }
.org-admin-line .admin-mini-btn { flex: none; }

.imp-badge.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(160, 32, 32, 0.08);
}

/* The count on the Copyright card — a queue nobody is watching is
   the failure mode this is here to prevent. */
.pending-dot {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

.rights-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--paper);
}
.rights-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.rights-card h3 {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--burgundy-deep);
  margin: 0 0 2px;
}
.rights-card header p { margin: 0; font-size: 13px; }

/* What the church told us, set apart as the quotation it is —
   this is the text the decision is actually made on. */
.rights-claim {
  margin: 0 0 12px;
  padding: 10px 16px;
  border-left: 3px solid var(--gold-soft);
  background: var(--paper-card);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
}

.rights-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* prompt dialog (see promptDialog in common.js) */
.modal-prompt input[type="text"],
.modal-prompt textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  color: var(--ink);
  margin-bottom: 4px;
}
.modal-prompt textarea { resize: vertical; line-height: 1.5; }
.modal-prompt input[type="text"]:focus,
.modal-prompt textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 145, 47, 0.18);
}
.prompt-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.modal-prompt .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* The favorite star. Quiet until it is pressed — an unstarred hymn should
   not look like it is asking for something, and a starred one should be
   findable at a glance down a list of hundreds. */
.hymn-star {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  color: var(--line);
  transition: color 0.15s ease, transform 0.12s ease;
}
.hymn-star:hover { color: var(--gold-soft); transform: scale(1.15); }
.hymn-star.on { color: var(--gold); }
.hymn-star:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* On the hymn's own page it takes the top right corner, opposite the hymn
   number — the two things the page is filed under, one at each end of the
   head. Big enough to be the obvious thing to press, and drawn as a hollow
   star when the hymn is not starred: the outline is the invitation, and it
   fills in when taken. (It used to sit against the title in paper-colored
   ink, where it was all but invisible until you knew it was there.) */
.hymn-star.big {
  position: absolute;
  right: 0; top: 0;
  font-size: 34px;
  padding: 0;
  color: var(--gold-soft);
}
.hymn-star.big:hover { color: var(--gold); }
.hymn-star.big.on { color: var(--gold); }

/* Room for it: the title is centered between the number and the star, so it
   is kept clear of both. */
@media (max-width: 560px) {
  .hymn-star.big { font-size: 28px; }
}

/* Tags in the hymn editor — the subject headings a hymnal prints in its
   topical index. Chips rather than a comma-separated field, so the shape of
   a tag ("two words, not a sentence") is visible while typing them. */
.ed-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  align-items: center;
  margin: 14px 0;
}

.ed-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--gold-soft);
  background: rgba(184, 145, 47, 0.12);
  font-size: 14px;
  color: var(--ink);
}
.ed-tag button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  color: var(--ink-faint);
  border-radius: 50%;
}
.ed-tag button:hover { color: var(--danger); }

.ed-tag-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ed-tag-add input {
  flex: 1;
  min-width: 160px;
  font-family: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  color: var(--ink);
}
.ed-tag-add input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 145, 47, 0.18);
}
.ed-tag-add input:disabled { opacity: 0.5; }

/* ============================================================
   Accounts, subscriptions and the church Hymn List
   ============================================================ */

/* A module that is built but not paid for. It stays a LINK — clicking it goes
   to the account page — so the dimming has to read as "not yours yet" rather
   than as the "coming soon" card above it, which is genuinely inert. */
a.module-card.locked {
  cursor: pointer;
  opacity: 0.72;
}
a.module-card.locked:hover {
  opacity: 1;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}
a.module-card.locked:hover::before { background: var(--gold); }

/* The upgrade nudge. Deliberately quiet: a gold rule and a plain sentence,
   not a banner. It appears under a course somebody is part-way through, and
   shouting at them there would be the wrong tone entirely. */
.upgrade-note {
  margin: 28px 0 0;
  padding: 20px 22px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.upgrade-note h3 {
  font-family: var(--serif);
  font-size: 21px;
  margin: 0 0 6px;
  color: var(--burgundy-deep);
}
.upgrade-note p { margin: 0 0 14px; color: var(--ink-soft); font-size: 15px; }

/* Whether a subscription renews, stated in words. The color is a second
   signal and never the only one — the sentence says it outright, because a
   green dot is not an answer to "will I be charged again?". */
.renew-line {
  margin: 4px 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
  background: var(--paper-deep);
  border-left: 3px solid var(--line);
}
.renew-line.on { border-left-color: var(--green); }
.renew-line.off { border-left-color: var(--gold); }

/* Who runs the church, on a member's own account page. A name above the
   address it belongs to, so a list of two or three administrators reads as
   people rather than as a run of mailto links. */
.church-admins-head {
  font-family: var(--serif);
  font-size: 16px;
  margin: 14px 0 8px;
  color: var(--burgundy-deep);
}
.church-admins { list-style: none; margin: 0 0 14px; padding: 0; }
.church-admins li { margin: 0 0 10px; font-size: 15px; line-height: 1.4; }
.church-admins li:last-child { margin-bottom: 0; }
.church-admin-name { display: block; color: var(--ink); }
.church-admins a { color: var(--ink-soft); }

/* The reason to hand a seat back sits next to the button that hands it
   back, so the ask and the means are read together. */
.seat-plea { margin-top: 16px; }

/* The buy-a-church form, and the seat box on the church page. */
.church-buy {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 10px;
}
.church-buy label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex: 1 1 180px;
}
.church-buy input {
  font-family: inherit;
  font-size: 16px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
}
/* The Contact page's form: the same fields, one to a line, and a message box. */
.contact-form { flex-direction: column; }
.contact-form label { flex: none; }
.contact-form textarea {
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  min-height: 180px;
  resize: vertical;
}
.contact-form .contact-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-church {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 8px;
  background: var(--paper-card);
  border: 1px solid var(--line);
}
.church-buy input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 145, 47, 0.18);
}
.church-quote {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--ink-soft);
  min-height: 1.2em;
}

.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* A hymn already on the church's Hymn List. Gold rather than a checkbox: it
   is the same star the Practice Room uses for a favorite, and it means the
   same kind of thing — somebody chose this one out of hundreds. */
.admin-mini-btn.on {
  border-color: var(--gold);
  color: var(--burgundy-deep);
  background: rgba(184, 145, 47, 0.14);
}

/* A button that reads as a link, for an escape offered inside a sentence. */
.link-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--burgundy);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--burgundy-bright); }

/* ============================================================
   Tag Administration (admin-tags.js), at #/admin/tags.

   The charts are drawn in one hue, the burgundy the rest of the
   app already uses for emphasis: every one of them shows how much,
   never which kind, so depth of color is the only thing that has
   to be read. Numbers and labels stay in the ink colors.
   ============================================================ */

.tg-where { background: rgba(184, 145, 47, 0.1); border-color: var(--gold-soft); color: var(--ink-soft); }

.tg-h3 {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--burgundy-deep);
  margin: 0 0 2px;
}
.tg-gap { margin-top: 26px; }
.tg-chart > .admin-dim { margin: 0 0 12px; }

/* the four headline numbers */
.tg-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.tg-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 14px 16px 15px;
}
.tg-tile-num {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.05;
  color: var(--burgundy-deep);
}
.tg-tile-num span { font-size: 19px; color: var(--ink-faint); }
.tg-tile-label { font-size: 14px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }
.tg-tile-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 6px; }
.tg-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  margin-top: 12px;
  overflow: hidden;
}
.tg-meter span { display: block; height: 100%; border-radius: 999px; background: var(--burgundy-bright); }

.tg-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 34px;
}

/* horizontal bars: a name, a thin track, a number */
.tg-bars { display: grid; gap: 2px; }
.tg-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 30px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 5px 6px;
  border: none;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
}
button.tg-bar-row { cursor: pointer; }
button.tg-bar-row:hover { background: rgba(184, 145, 47, 0.14); }
button.tg-bar-row:focus-visible { outline: 2px solid var(--gold); }
.tg-bars.compact .tg-bar-row { grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 24px; padding: 4px 0; }
.tg-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-bar-track { display: block; height: 10px; border-radius: 4px; background: rgba(110, 38, 57, 0.08); }
.tg-bar-fill { display: block; height: 100%; min-width: 3px; border-radius: 4px; background: var(--burgundy-bright); }
.tg-bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 600; }

/* columns: tags on a hymn */
.tg-cols {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 150px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.tg-col {
  flex: 1;
  max-width: 54px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.tg-col-val { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.tg-col-bar { width: 100%; flex: none; border-radius: 4px 4px 0 0; background: var(--burgundy-bright); }
.tg-col:hover .tg-col-bar { background: var(--burgundy); }
/* Hymns with no tags at all are the gap in the work, not a quantity of it. */
.tg-col-bar.none,
.tg-col:hover .tg-col-bar.none {
  background: repeating-linear-gradient(135deg, rgba(110, 38, 57, 0.5) 0 3px, rgba(110, 38, 57, 0.18) 3px 6px);
}
.tg-col-x { position: absolute; bottom: -21px; font-size: 12.5px; color: var(--ink-faint); }
.tg-axis { text-align: center; font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }

/* one bar, cut into the four bands of use */
.tg-stack { display: flex; gap: 2px; height: 22px; }
.tg-stack-seg { border: none; padding: 0; min-width: 6px; flex-basis: 0; cursor: pointer; }
.tg-stack-seg:first-child { border-radius: 4px 0 0 4px; }
.tg-stack-seg:last-child { border-radius: 0 4px 4px 0; }
.tg-stack-seg:hover { filter: brightness(1.12); }
.tg-stack-seg:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tg-stack-seg.once, .tg-swatch.once { background: #dcb9c2; }
.tg-stack-seg.few, .tg-swatch.few { background: #bd7f8f; }
.tg-stack-seg.some, .tg-swatch.some { background: #8e3349; }
.tg-stack-seg.many, .tg-swatch.many { background: #521b2a; }
.tg-legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 10px; }
.tg-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.tg-legend-item strong { color: var(--ink); }
.tg-legend-item:hover:not(:disabled) { background: rgba(184, 145, 47, 0.14); }
.tg-legend-item:disabled { cursor: default; opacity: 0.55; }
.tg-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* the grid of tags against tags */
.tg-heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.tg-heat {
  display: grid;
  grid-template-columns: minmax(110px, 170px) repeat(var(--n), 44px);
  gap: 2px;
  width: max-content;
  padding-right: 70px;
}
.tg-heat-top { height: 84px; position: relative; }
.tg-heat-top span {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform-origin: left bottom;
  transform: rotate(-52deg);
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.tg-heat-side {
  border: none;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  text-align: right;
  padding: 0 10px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.tg-heat-side:hover { color: var(--burgundy); text-decoration: underline; }
.tg-heat-cell {
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background:
    linear-gradient(rgba(110, 38, 57, var(--s, 0)), rgba(110, 38, 57, var(--s, 0))),
    var(--paper-deep);
}
.tg-heat-cell.deep { color: #fdf7ea; }
.tg-heat-cell.self { background: none; border: 1px dashed var(--line); }
.tg-heat-cell:not(.self):hover { outline: 2px solid var(--gold); }

.tg-tip {
  position: fixed;
  z-index: 70;
  max-width: 280px;
  pointer-events: none;
  background: var(--ink);
  color: #fdf7ea;
  font-size: 13px;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(43, 38, 32, 0.25);
}
.tg-tip[hidden] { display: none; }

/* tags as chips, here and in the dialogs */
.tg-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--gold-soft);
  background: rgba(184, 145, 47, 0.12);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.tg-chip.static { cursor: default; }
button.tg-chip:hover { background: var(--gold-soft); border-color: var(--gold); }
button.tg-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.tg-chip-n { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.tg-chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.tg-chip-row.tight { margin-top: 0; gap: 5px; }
.tg-chip-row.tight .tg-chip { font-size: 13px; padding: 2px 10px; }

/* worth a look */
.tg-sug { list-style: none; margin: 0; padding: 0; }
.tg-sug li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.tg-sug li:first-child { padding-top: 0; }
.tg-sug li:last-child { border-bottom: none; padding-bottom: 0; }
.tg-sug .btn { flex: none; }

/* browse */
.tg-browse-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.tg-browse-head h2 { margin: 0; }
.tg-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--paper);
  flex: none;
}
.tg-seg button {
  border: none;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.tg-seg button span { font-weight: 400; color: var(--ink-faint); margin-left: 3px; }
.tg-seg button.on { background: var(--burgundy); color: #fdf7ea; }
.tg-seg button.on span { color: rgba(253, 247, 234, 0.75); }
.tg-seg button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.tg-search,
.modal .tg-field {
  font: inherit;
  font-size: 14.5px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  color: var(--ink);
  min-width: 200px;
}
.tg-search:focus,
.modal .tg-field:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 145, 47, 0.18);
}
.modal .tg-field { width: 100%; font-size: 16px; padding: 10px 12px; margin-bottom: 4px; }

.tg-bulk {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #f6eceb;
  border: 1px solid rgba(110, 38, 57, 0.2);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 14px;
  position: sticky;
  top: 70px;
  z-index: 5;
}
.tg-bulk[hidden] { display: none; }
.tg-bulk strong { margin-right: 4px; color: var(--burgundy-deep); }

.tg-table td { vertical-align: middle; }
.tg-table .tg-pick { width: 34px; padding-right: 0; }
.tg-table input[type="checkbox"],
.tg-check input { width: 16px; height: 16px; accent-color: var(--burgundy); cursor: pointer; margin: 0; }
.tg-inline { display: grid; grid-template-columns: 30px minmax(60px, 180px); align-items: center; gap: 10px; }
.tg-inline-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tg-inline .tg-bar-track { height: 8px; }

/* the dialogs */
.modal.tg-modal {
  width: min(820px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
}
.modal.tg-modal-small { width: min(470px, 94vw); }
.modal.tg-modal-mid { width: min(600px, 94vw); }
.tg-modal h2 { font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }
.tg-modal .modal-actions { align-items: center; margin-top: 20px; }
.tg-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2px;
}
.modal p.tg-hint { min-height: 20px; margin: 8px 0 0; font-size: 13.5px; color: var(--burgundy); }
.modal p.tg-hint.quiet { color: var(--ink-faint); }
.modal p.tg-first { font-family: var(--serif); font-style: italic; font-size: 17px; margin: 2px 0 8px; }
.tg-modal .tg-chip-row { margin: 0 0 18px; }
.tg-dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tg-dlg-tools { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 3px; }
.tg-dlg-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; margin-top: 4px; }
.tg-dlg-cols.one { grid-template-columns: minmax(0, 1fr); }
.tg-dlg-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.tg-dlg-bar .tg-search { flex: 1; min-width: 150px; }
.tg-checklist {
  height: min(330px, 42vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 4px;
}
.tg-check {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 14.5px;
  cursor: pointer;
}
.tg-check:hover { background: rgba(184, 145, 47, 0.14); }
.tg-check.full { opacity: 0.5; cursor: default; }
.tg-check-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-check-meta { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; }
.tg-empty { padding: 14px 10px; margin: 0; }
.tg-dlg-status { margin-right: auto; font-size: 13.5px; color: var(--burgundy); font-weight: 600; }
.tg-dlg-link { margin-right: auto; font-size: 14px; color: var(--burgundy); }

@media (max-width: 860px) {
  .tg-tiles { grid-template-columns: repeat(2, 1fr); }
  .tg-charts, .tg-dlg-cols { grid-template-columns: minmax(0, 1fr); gap: 26px; }
}
@media (max-width: 560px) {
  .tg-bar-row { grid-template-columns: minmax(0, 104px) minmax(0, 1fr) 26px; gap: 8px; }
  .tg-sug li { flex-direction: column; align-items: flex-start; gap: 10px; }
  .modal.tg-modal { padding: 22px 18px; }
  .tg-search { min-width: 0; flex: 1; }
}

/* ---------- Printed hymn (#/admin/hymns/<id>/print) ----------
   The sheets are US Letter at their real size, in inches and points, and
   scaled to the window for looking at. See public/js/hymn-print.js. */
.print-bar { max-width: 8.5in; margin: 0 auto 18px; }
.print-bar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.print-bar h1 { font-family: var(--serif); font-size: 30px; margin: 0; }
.print-facts { margin: 2px 0 0; color: var(--ink-soft); font-size: 14.5px; }
.print-how { margin: 10px 0 0; font-size: 14px; }

/* The Lines control, folded away until wanted. The list inside is the hymn
   editor's own (.ed-line-list). */
.print-lines {
  margin-top: 14px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 16px;
}
.print-lines summary { cursor: pointer; }
.print-lines-title { font-weight: 600; margin-right: 8px; }
.print-lines-body { margin-top: 8px; }
.print-lines-body > p { margin: 0 0 8px; font-size: 14px; }
.print-lines-body .ed-pair { margin-top: 10px; }
.print-lines-body .ed-group { margin-top: 10px; align-items: center; }

/* The sheets themselves are drawn by hymn-sheet.js, which brings its own
   style so that HymnTutor and CarolTutor print alike. This is only the admin
   preview around them: scaled to the window, each sheet framed on the desk. */
.print-view .print-pages {
  zoom: var(--print-zoom, 1);
  margin: 0 auto;
}
.print-view .print-page {
  margin: 0 0 0.3in;
  outline: 1px solid var(--line);
  box-shadow: var(--shadow);
}

@media print {
  body.printing-hymn { background: #fff; }
  body.printing-hymn .site-header,
  body.printing-hymn .site-footer,
  body.printing-hymn .toast-stack,
  body.printing-hymn .print-bar { display: none !important; }
  body.printing-hymn .app-main { max-width: none; margin: 0; padding: 0; }
  body.printing-hymn .print-pages { zoom: 1; margin: 0; }
  body.printing-hymn .print-page {
    margin: 0;
    outline: 0;
    box-shadow: none;
    break-after: page;
    break-inside: avoid;
  }
  body.printing-hymn .print-page:last-child { break-after: auto; }
}
