/* The redesigned practice session screen (Areas/Musician/Pages/Practice/Session.cshtml).
   Layout: a header (tune, clock, Prev/Next, routine bar), then a stage beside a sidebar of
   tool cards. See docs/product/practice-session-redesign-decisions.md.

   components/button.css styles every <button> and .card outside the cascade layers, and
   unlayered rules beat layered ones, so the few declarations here that undo its shadow,
   border or display need !important to win, the same way object-row.css and tag.css do. */
@layer components {
  /* Full-bleed, as drawn: the header is a band across the window and the page is the
     prototype's pale blue-grey, with no fixed-width column. */
  .av-session-container {
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* The header band sits flush under the navigation bar. */
  body:has(.av-session) header > .navbar {
    margin-bottom: 0 !important;
  }

  .av-session-container main {
    padding-bottom: 0 !important;
  }

  .av-session {
    display: flex;
    flex-direction: column;
    background: #eef3f4;
  }

  /* ---- Header ---- */
  /* The header stays plain while an item runs: the clock and the routine bar say how far
     along it is. It turns sage green when the planned time is met. Calm, never an alert:
     no red, nothing flashes, nothing repeats. (A fill that crept across the whole header
     as the timer was tried and was distracting.) */
  .av-session-header {
    position: relative;
    background-color: var(--av-card);
    flex: none;
    border: 0;
    border-bottom: 3px solid rgba(15, 23, 42, 0.14);
    padding: 12px 24px 6px;
    transition: background-color 900ms ease, border-color 900ms ease;
  }

  /* A single tune or Practice Anything on its own has no routine bar under the top row,
     so the space under it matches the space over it. */
  .av-session-header--no-bar {
    padding-bottom: 12px;
  }

  .av-session-header--met {
    background-color: #d9efd5;
    border-bottom-color: var(--av-success);
  }

  /* The one-time moment when planned time is met. */
  .av-session-header--bloom {
    animation: av-session-bloom 1600ms ease-out 1;
  }

  .av-session-next--nudge {
    animation: av-session-nudge 650ms ease-in-out 400ms 2;
  }

  .av-session-float {
    position: absolute;
    bottom: 14px;
    left: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 3;
  }

  .av-session-float__note {
    position: absolute;
    bottom: 0;
    left: 0;
    color: #4f9a52;
    font-size: 1.1rem;
    opacity: 0;
    animation: av-session-float 1900ms ease-out 1 both;
  }

  @keyframes av-session-bloom {
    0% { box-shadow: inset 0 0 0 0 rgba(118, 188, 121, 0); }
    35% { box-shadow: inset 0 -60px 80px -20px rgba(118, 188, 121, 0.55); }
    100% { box-shadow: inset 0 0 0 0 rgba(118, 188, 121, 0); }
  }

  @keyframes av-session-nudge {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(6px) scale(1.06); }
    60% { transform: translateX(0) scale(1); }
  }

  @keyframes av-session-float {
    0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx, 0), -90px) scale(1.1) rotate(12deg); }
  }

  /* Reduced motion: the colour still changes, with no fade, notes, bloom or nudge. */
  @media (prefers-reduced-motion: reduce) {
    .av-session-header {
      transition: none;
    }

    .av-session-header--bloom,
    .av-session-next--nudge {
      animation: none;
    }

    .av-session-float {
      display: none;
    }
  }

  /* The sides never shrink below their buttons; the middle gives way instead, so on a
     narrow window a long title and the clock wrap rather than run under Prev. */
  .av-session-top {
    display: grid;
    grid-template-columns: minmax(min-content, 1fr) minmax(0, auto) minmax(min-content, 1fr);
    align-items: center;
    gap: 24px;
  }

  .av-session-top__side--end {
    justify-self: end;
  }

  /* Prev and Next are the screen's two big controls: 56px, bold, a hard shadow. The site's
     own .btn rules sit outside the layers, so these need !important to apply. */
  .av-session-top .btn {
    min-height: 56px;
    min-width: 0;
    padding: 0 20px !important;
    /* Without !important the site's .btn keeps these inline-block, and the icon then sits
       on the text baseline instead of the button's centre line. */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 17px !important;
    font-weight: 700 !important;
    border: 2px solid rgba(15, 23, 42, 0.28) !important;
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12) !important;
    white-space: nowrap;
  }

  .av-session-top .btn:disabled {
    opacity: 0.45;
    box-shadow: none !important;
  }

  /* Prev on a single item (session.js hides it); the display above would otherwise win. */
  .av-session-top .btn[hidden] {
    display: none !important;
  }

  /* The left of the header, as drawn: Resume later small and quiet on top, and Prev under
     it, shorter than Next so the way forward is the bigger button. */
  .av-session-top__side--start {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 148px;
  }

  /* Smaller again (1 Dec 2026): with Resume later over it, a 42px Prev crowded the routine
     bar underneath. */
  .av-session-top #avPrev {
    min-height: 34px;
    font-size: 15px !important;
  }

  .av-session-later {
    min-height: 24px;
    padding: 0 8px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2;
    color: var(--av-ink);
    background: var(--av-card) !important;
    border: 2px solid rgba(15, 23, 42, 0.28) !important;
    border-radius: var(--av-btn-radius);
    box-shadow: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease;
  }

  .av-session-later:hover:not(:disabled) {
    background: #e3f1f2 !important;
  }

  .av-session-later:disabled {
    opacity: 0.45;
    cursor: default;
  }

  .av-session-later:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 1px;
  }

  /* The phone's Resume later, in the site navbar where the wordmark sits. A quiet light
     outline on the dark bar, no shadow. Hidden on wider screens, where the header has it. */
  .av-session-navlater {
    display: none;
    min-height: 44px;
    padding: 0 12px 0 8px;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--av-btn-radius);
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease;
  }

  .av-session-navlater:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
  }

  .av-session-navlater:disabled {
    opacity: 0.45;
    cursor: default;
  }

  .av-session-navlater:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 1px;
  }

  /* The tune and its clock share one row, so the header stays slim; the clock drops under
     the tune only when the two don't fit side by side. */
  .av-session-now {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 20px;
    min-width: 0;
    /* Room for a long title and the big clock on one row at 1440px (was 760px with the
       small clock). */
    max-width: 920px;
  }

  .av-session-tune {
    min-width: 0;
    max-width: 100%;
  }

  .av-session-tune .av-object-row__title {
    font-size: 20px !important;
    font-weight: 400 !important;
    color: var(--av-ink);
  }

  /* As drawn: the artist sits beside the title, and drops under it only when there is
     no room. */
  .av-session-tune .av-object-row__text {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
    row-gap: 0;
  }

  .av-session-tune .av-object-row__meta {
    font-size: 16px !important;
    color: rgba(34, 36, 52, 0.72);
  }

  /* The tune's tags have a line of their own under the title and artist (1 Dec 2026), so
     a long title doesn't push the clock off its row. */
  .av-session-tune .av-object-row__tags {
    flex-basis: 100%;
    min-width: 0;
    margin-top: 2px;
  }

  .av-session-thumb--break { background: var(--av-tone-break); }
  .av-session-thumb--free { background: var(--av-tone-free); }

  /* The clock follows the tune, past a thin divider, big enough to read from a music stand
     (1 Dec 2026, canvas option B). The sign says which way it runs: − time left, + time
     past the plan. Words such as "Done! Move on!" and "Paused" sit small beside it. */
  .av-session-clock {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 22px;
    border-left: 2px solid rgba(15, 23, 42, 0.14);
  }

  /* Wrapped under a long title (set by session.js): no divider to the left of nothing. */
  .av-session-clock--under {
    padding-left: 0;
    border-left: 0;
  }

  .av-session-clock__text {
    font-family: "Roboto Mono", monospace !important;
    font-variant-numeric: tabular-nums;
    /* Full size on a wide screen, shrinking with the window down to the phone breakpoint:
       46px at 1440px, about 32px at 1024px, and never below 24px (a little over the
       tune's 20px title). Phones set their own size below. */
    font-size: clamp(24px, calc(3.274vw - 1.14px), 46px);
    font-weight: 500;
    line-height: 1;
    color: var(--av-ink);
    white-space: nowrap;
  }

  .av-session-clock__text--met {
    color: #2f6e31;
  }

  .av-session-clock__note {
    font-size: 14px;
    font-weight: 700;
    color: rgba(34, 36, 52, 0.72);
    white-space: nowrap;
  }

  .av-session-clock__note:empty {
    display: none;
  }

  .av-session-clock__note--met {
    color: #2f6e31;
  }

  .av-session-top .av-session-next--met {
    box-shadow: 0 0 0 4px rgba(118, 188, 121, 0.55), 3px 3px 0 rgba(15, 23, 42, 0.12) !important;
  }

  /* Small bordered icon buttons, as drawn: Pause beside the clock, and the actions in a
     tool card's header (split, close, open in a new tab). They are standalone controls on
     their card, not row actions, so they carry the outline and a small hard shadow. */
  .av-session-clock .av-btn-ghost--icon,
  .av-session-hint .av-btn-ghost--icon,
  .av-tool__head .av-btn-ghost--icon {
    flex: none;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px;
    min-height: 34px !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center;
    color: var(--av-ink);
    background: var(--av-card) !important;
    border: 2px solid rgba(15, 23, 42, 0.28) !important;
    border-radius: var(--av-btn-radius);
    box-shadow: 2px 2px 0 rgba(15, 23, 42, 0.1) !important;
    font-size: 13px;
    text-decoration: none;
    transition: transform 140ms ease, box-shadow 140ms ease;
  }

  .av-session-clock .av-btn-ghost--icon:hover:not(:disabled),
  .av-tool__head .av-btn-ghost--icon:hover {
    transform: scale(1.03);
    box-shadow: 4px 4px 0 rgba(15, 23, 42, 0.18) !important;
  }

  .av-session-clock .av-btn-ghost--icon {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px;
    min-height: 32px !important;
    font-size: 11px;
  }

  /* Pause is yellow and turns into a green Resume, as on today's screen: the two states of
     one control, told apart at a glance. The yellow is the site's btn-warning; the green is
     the practice-button green (docs/design-system.md, "Practice buttons"). */
  .av-session-clock #avPause {
    background: #eba63f !important;
    color: #212529;
  }

  .av-session-clock #avPause:hover:not(:disabled) {
    background: #e7961c !important;
  }

  .av-session-clock #avPause[data-paused="true"] {
    background: var(--av-practice) !important;
    border-color: var(--av-practice-border) !important;
    color: var(--av-practice-text);
  }

  .av-session-hint .av-btn-ghost--icon {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }

  /* ---- Routine bar: one segment per item, sized by planned minutes ---- */
  /* An ol: the site's reset sets its top margin outside the cascade layers, so without
     !important the bar sat right on the buttons above it. */
  .av-session-bar {
    list-style: none;
    margin: 12px 0 0 !important;
    padding: 0;
    display: flex;
    gap: 4px;
  }

  .av-session-bar > li {
    min-width: 28px;
  }

  .av-session-seg {
    width: 100%;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: var(--av-btn-radius);
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    text-align: left;
    box-shadow: none !important;
  }

  .av-session-seg:hover {
    background: var(--av-ghost-hover-bg);
  }

  .av-session-seg:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 1px;
  }

  .av-session-seg__track {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.12);
    overflow: hidden;
  }

  .av-session-seg__fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--av-accent);
  }

  .av-session-seg--met .av-session-seg__fill {
    background: var(--av-success);
  }

  .av-session-seg--played .av-session-seg__fill {
    background: rgba(53, 171, 178, 0.45);
  }

  .av-session-seg--current .av-session-seg__track {
    box-shadow: 0 0 0 2px rgba(53, 171, 178, 0.45);
  }

  .av-session-seg__name {
    font-size: 11px;
    line-height: 1.2;
    color: rgba(34, 36, 52, 0.66);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .av-session-seg--current .av-session-seg__name {
    color: var(--av-ink);
    font-weight: 700;
  }

  .av-session-notices p {
    margin: 0;
    text-align: center;
  }

  /* ---- Paused: the whole screen dims behind one calm card ---- */
  .av-session-paused {
    position: fixed;
    inset: 0;
    z-index: 1040;            /* over the navbar and the phone dock, under Bootstrap modals */
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(28, 34, 48, 0.62);
    backdrop-filter: blur(6px) grayscale(0.4);
    animation: av-session-paused-in 180ms ease-out both;
  }

  .av-session-paused[hidden] {
    display: none;
  }

  .av-session-paused__card {
    width: min(440px, 100%);
    padding: 32px 36px 24px;
    background: var(--av-card);
    border: 2px solid rgba(15, 23, 42, 0.32);
    border-radius: var(--av-card-radius);
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }

  /* A plain mark beside the word, not a tile: a circle with a glyph in it reads as a button. */
  .av-session-paused__icon {
    margin-right: 10px;
    color: #176269;
    font-size: 0.7em;
    vertical-align: 0.15em;
  }

  .av-session-paused__title {
    margin: 0;
    font-size: 2rem;
  }

  .av-session-paused__where {
    margin: 0;
    max-width: 100%;
    font-family: "Roboto Mono", monospace;
    font-size: 1rem;
    overflow-wrap: anywhere;
  }

  .av-session-paused__card .btn-lg {
    margin-top: 8px;
    min-width: 180px;
  }

  /* Under Resume later: how long a parked routine waits. Phones get no tooltip, so this is
     where they learn it. Quiet, and no countdown. */
  .av-session-paused__later-note {
    margin: -4px 0 0;
    font-size: 0.85rem;
    color: var(--av-muted);
  }

  /* A save that failed while paused. The page's own message is behind the card, so it is
     said here too; hidden until then. */
  .av-session-paused__error {
    margin: 4px 0 0;
    font-size: 0.9rem;
    text-wrap: balance;       /* two even lines, not one long line and a stray word */
  }

  @keyframes av-session-paused-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @media (prefers-reduced-motion: reduce) {
    .av-session-paused {
      animation: none;
    }
  }

  /* ---- Break ---- */
  .av-session-break {
    width: min(560px, 100%);
    margin: auto;
    padding: 36px 40px;
    background: var(--av-card);
    border: 2px solid rgba(15, 23, 42, 0.32);
    border-radius: var(--av-card-radius);
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
  }

  .av-session-break[hidden] {
    display: none;
  }

  .av-session-break h2,
  .av-session-break p {
    margin: 0;
  }

  .av-session-break__clock {
    font-family: "Roboto Mono", monospace;
    font-size: 1.6rem;
  }

  /* ---- Stage and sidebar ---- */
  .av-session-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 16px;
    align-items: start;
    padding: 16px 24px 20px;
  }

  .av-session-main[hidden] {
    display: none;
  }

  .av-session-main {
    position: relative;
  }

  .av-session-main--no-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The tools panel: the sidebar is open or closed, in every layout. Closed, it is a 56px
     strip with one button that opens it. Opening pushes the stage over: the column grows,
     and nothing floats over the stage. */
  .av-session-main--panel-closed {
    grid-template-columns: minmax(0, 1fr) 56px;
  }

  .av-session-main--panel-closed .av-session-sidebar {
    display: none;
  }

  .av-session-panel-strip {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
  }

  .av-session-panel-strip[hidden] {
    display: none;
  }

  /* The whole strip is one thing to click, so it is a clickable card: the 8px radius, an
     outline, and no hard shadow, which belongs to standalone buttons. */
  .av-session-panel-open {
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 14px 0 !important;
    border: 2px solid rgba(15, 23, 42, 0.16) !important;
    border-radius: var(--av-clickable-card-radius, 8px) !important;
    background: var(--av-card) !important;
    color: #176269;
    font-size: 14px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease;
  }

  .av-session-panel-open[hidden] {
    display: none;
  }

  .av-session-panel-open:hover {
    border-color: #35abb2 !important;
    background: #f1f9f9 !important;
  }

  .av-session-panel-open:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 1px;
  }

  .av-session-panel-open__label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    letter-spacing: 0.04em;
  }

  /* With the rail under it, the open button is its own height, not the strip's. */
  #avPanelOpen {
    flex: none;
    min-height: 96px;
  }

  /* The rail: one quiet icon button per tool, as on the phone tool bar, in each tool's ink.
     A click puts the tool on the stage; the one on the stage is marked. */
  .av-session-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .av-session-rail:empty {
    display: none;
  }

  /* The shared ghost button sets its own width and colour, so these need !important. */
  .av-session-rail__btn {
    width: 40px !important;
    height: 40px;
    min-width: 40px !important;
    min-height: 40px !important;
    font-size: 17px;
  }

  .av-session-rail__btn[hidden] {
    display: none;
  }

  .av-session-rail__btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .av-session-rail__btn[data-rail-tool="metronome"] { color: var(--av-tool-metronome-ink) !important; }
  .av-session-rail__btn[data-rail-tool="drone"] { color: var(--av-tool-drone-ink) !important; }
  .av-session-rail__btn[data-rail-tool="tuner"] { color: var(--av-tool-tuner-ink) !important; }
  .av-session-rail__btn[data-rail-tool="recorder"] { color: var(--av-tool-recorder-ink) !important; }
  .av-session-rail__btn[data-rail-tool="materials"] { color: var(--av-tool-materials-ink) !important; }
  .av-session-rail__btn[data-rail-tool="youtube"] { color: var(--av-tool-youtube-ink) !important; }
  .av-session-rail__btn[data-rail-tool="theory"] { color: var(--av-tool-theory-ink) !important; }
  .av-session-rail__btn[data-rail-tool="notes"] { color: var(--av-tool-notes-ink) !important; }

  .av-session-rail__btn[aria-pressed="true"] {
    background: rgba(53, 171, 178, 0.16) !important;
    box-shadow: inset 3px 0 0 var(--av-accent) !important;
    cursor: default;
  }

  /* The Metronome's beat, while it runs out of sight. */
  .av-session-panel-open--beat {
    flex: none;
    min-height: 0;
    padding: 10px 0 !important;
  }

  .av-session-panel-open__dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #35abb2;
    animation: av-session-beat-dot var(--av-session-beat, 1s) linear infinite;
  }

  .av-session-panel-open--beat b {
    font-family: "Roboto Mono", monospace !important;
    font-size: 12px;
    font-weight: 700;
  }

  @keyframes av-session-beat-dot {
    0% { box-shadow: 0 0 0 0 rgba(53, 171, 178, 0.75); }
    70% { box-shadow: 0 0 0 8px rgba(53, 171, 178, 0); }
    100% { box-shadow: 0 0 0 0 rgba(53, 171, 178, 0); }
  }

  @media (prefers-reduced-motion: reduce) {
    .av-session-panel-open__dot {
      animation: none;
    }
  }

  /* The open panel's header: what this column is, and the way to close it. */
  .av-session-panel-head {
    order: -100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 2px;
  }

  .av-session-panel-head__label {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(34, 36, 52, 0.7);
  }

  .av-session-panel-head .av-btn-ghost {
    min-height: 32px !important;
  }

  /* The button says the panel is open (aria-expanded), which on a ghost button elsewhere
     means an open menu and gets a tint. Here open is the resting state, so it stays quiet. */
  .av-session-panel-head .av-btn-ghost[aria-expanded="true"]:not(:hover) {
    background: transparent !important;
  }

  .av-session-main--no-sidebar .av-session-sidebar {
    display: none;
  }

  .av-session-stage {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
  }

  /* The handle between the two halves of a split. Its column is 16px and the stage's own
     gap would triple that, so a split closes the gap and the handle is the gap. */
  .av-session-stage--split {
    column-gap: 0;
  }

  .av-session-grip {
    order: 1;
    align-self: stretch;
    min-height: 120px;
    display: grid;
    place-items: center;
    cursor: col-resize;
    touch-action: none;
    border-radius: var(--av-btn-radius);
  }

  .av-session-grip[hidden] {
    display: none;
  }

  .av-session-grip > span {
    width: 4px;
    height: 44px;
    border-radius: 2px;
    background: rgba(15, 23, 42, 0.22);
    transition: background 140ms ease, height 140ms ease;
  }

  .av-session-grip:hover > span,
  .av-session-grip:focus-visible > span {
    background: var(--av-accent);
    height: 64px;
  }

  .av-session-grip:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: -2px;
  }

  /* Shown while a sidebar card is dragged: left three-fifths puts it on the stage, right
     two-fifths splits. The zones are solid so their labels read cleanly. */
  .av-session-drop {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 12px;
  }

  .av-session-drop[hidden] {
    display: none;
  }

  .av-session-drop__zone {
    display: grid;
    place-items: center;
    padding: 12px;
    text-align: center;
    border-radius: var(--av-card-radius);
    border: 3px dashed rgba(23, 98, 105, 0.35);
    background: #f6f8f9;
    color: #0f4d52;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12);
  }

  .av-session-drop__zone.is-over {
    border-color: var(--av-accent);
    background: #d4eef0;
  }

  /* The one-time tip sits across the top of the stage. */
  .av-session-hint {
    grid-column: 1 / -1;
    order: -1;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 14px;
    border-radius: 12px;
    background: #e3f1f2;
    border: 1px solid rgba(23, 98, 105, 0.25);
    color: #174a4f;
    font-size: 14px;
  }

  .av-session-hint[hidden] {
    display: none;
  }

  .av-session-hint > span {
    flex: 1;
  }

  /* The screen-on notice floats at the foot of the screen, above the phone tool bar, so it
     never pushes the stage down mid-practice. Same tint as the stage tip. */
  .av-session-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--av-session-dock, 0px) + 16px);
    transform: translateX(-50%);
    z-index: 1030;            /* over the stage and the dock, under the paused screen */
    width: min(560px, calc(100% - 32px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 14px;
    border-radius: 12px;
    background: #e3f1f2;
    border: 1px solid rgba(23, 98, 105, 0.25);
    box-shadow: 0 6px 18px rgba(28, 34, 48, 0.18);
    color: #174a4f;
    font-size: 14px;
  }

  .av-session-toast[hidden],
  .av-session-toast [hidden] {
    display: none;
  }

  .av-session-toast > span {
    flex: 1;
  }

  .av-session-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
  }

  /* ---- Tool cards: one header everywhere ---- */
  /* The content card as drawn: a firm 2px outline and the hard offset shadow. */
  .av-tool {
    background: var(--av-card);
    border: 2px solid rgba(15, 23, 42, 0.32);
    border-radius: var(--av-card-radius);
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12);
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    /* Anything positioned inside a card (the Metronome's hidden tempo slider is) is
       measured against the card and clipped by it, not against the page. */
    position: relative;
  }

  /* The cards are <section>s, and Bootstrap's reset gives those a display outside the
     layers, so the flex has to insist. */
  .av-tool:not([hidden]) {
    display: flex !important;
  }

  .av-tool[hidden] {
    display: none;
  }

  .av-tool__head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 8px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.12);
    font-size: 15px;
    font-weight: 700;
  }

  .av-tool__icon {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: var(--av-clickable-card-radius);
    display: grid;
    place-items: center;
    font-size: 14px;
  }

  /* A soft tint to find a tool by; it is not a status. Each tool has its own (tokens.css),
     so the four sound tools no longer share one teal. A card with no tool (Add to this
     tune) takes the Notes slate. */
  .av-tool { --av-tool-tint: var(--av-tool-notes-tint); --av-tool-ink: var(--av-tool-notes-ink); }
  .av-tool[data-tool="metronome"] { --av-tool-tint: var(--av-tool-metronome-tint); --av-tool-ink: var(--av-tool-metronome-ink); }
  .av-tool[data-tool="drone"] { --av-tool-tint: var(--av-tool-drone-tint); --av-tool-ink: var(--av-tool-drone-ink); }
  .av-tool[data-tool="tuner"] { --av-tool-tint: var(--av-tool-tuner-tint); --av-tool-ink: var(--av-tool-tuner-ink); }
  .av-tool[data-tool="recorder"] { --av-tool-tint: var(--av-tool-recorder-tint); --av-tool-ink: var(--av-tool-recorder-ink); }
  .av-tool[data-tool="materials"] { --av-tool-tint: var(--av-tool-materials-tint); --av-tool-ink: var(--av-tool-materials-ink); }
  .av-tool[data-tool="youtube"] { --av-tool-tint: var(--av-tool-youtube-tint); --av-tool-ink: var(--av-tool-youtube-ink); }
  .av-tool[data-tool="theory"] { --av-tool-tint: var(--av-tool-theory-tint); --av-tool-ink: var(--av-tool-theory-ink); }

  .av-tool__icon {
    background: var(--av-tool-tint);
    color: var(--av-tool-ink);
  }

  /* The Metronome's own mark (Font Awesome Free has no metronome; the drum is The Beat's). */
  .av-tool__icon svg,
  .av-session-toolbar__svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* The phone toolbar's icons wear their tool's ink, so with seven or more tools, when the
     words drop away, the four sound tools still look like four. */
  .av-session-toolbar__btn[data-tool="metronome"] > :first-child { color: var(--av-tool-metronome-ink); }
  .av-session-toolbar__btn[data-tool="drone"] > :first-child { color: var(--av-tool-drone-ink); }
  .av-session-toolbar__btn[data-tool="tuner"] > :first-child { color: var(--av-tool-tuner-ink); }
  .av-session-toolbar__btn[data-tool="recorder"] > :first-child { color: var(--av-tool-recorder-ink); }
  .av-session-toolbar__btn[data-tool="materials"] > :first-child { color: var(--av-tool-materials-ink); }
  .av-session-toolbar__btn[data-tool="youtube"] > :first-child { color: var(--av-tool-youtube-ink); }
  .av-session-toolbar__btn[data-tool="theory"] > :first-child { color: var(--av-tool-theory-ink); }
  .av-session-toolbar__btn[data-tool="notes"] > :first-child { color: var(--av-tool-notes-ink); }

  /* ---- "Working on", in Practice Notes: a bar, the list, and the method beside the notes ----
     The "Working On Picker" canvas, option D. */

  /* The bar: a whole clickable row, so the clickable-card radius; no hard shadow. */
  .av-session-focusbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .av-session-focusbar[hidden] {
    display: none !important;
  }

  .av-session-focusbar__pick {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px !important;
    border: 2px solid rgba(15, 23, 42, 0.16) !important;
    border-radius: var(--av-clickable-card-radius) !important;
    background: #fffaf0;
    color: var(--av-text);
    text-align: left;
    box-shadow: none !important;
  }

  .av-session-focusbar__pick:hover {
    background: #fff4dc;
  }

  .av-session-focusbar__pick:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 2px;
  }

  .av-session-focusbar__icon {
    flex: none;
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--av-clickable-card-radius);
    background: #fff1cc;
    color: #8a5a12;
    font-size: 13px;
  }

  .av-session-focusbar__label {
    flex: none;
    font-size: 13px;
    color: var(--av-muted);
  }

  .av-session-focusbar__value {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .av-session-focusbar__action {
    flex: none;
    font-size: 13px;
    color: var(--av-accent-ink);
  }

  /* In the sidebar the notes are small: the bar and the notes, no label, no method. */
  .av-session-sidebar .av-session-focusbar__label,
  .av-session-sidebar .av-session-focus__plan {
    display: none !important;
  }

  /* The list fills the notes card while it is open: a filter row, then the groups in as
     many columns as fit. */
  .av-session-focus__menu {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .av-session-focus__menu[hidden],
  .av-session-focus__menu [hidden],
  .av-session-notes__work[hidden] {
    display: none !important;
  }

  .av-session-focus__menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .av-session-focus__filter {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    /* !important: Bootstrap's unlayered `label { display: inline-block }` would win, and the
       input could not grow to fill the box. */
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: 6px;
    background: #fff;
    color: var(--av-muted);
  }

  .av-session-focus__filter:focus-within {
    border-color: var(--av-accent);
    box-shadow: 0 0 0 0.25rem rgba(138, 195, 198, 0.18);
  }

  .av-session-focus__filter input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 15px;
    color: var(--av-text);
  }

  .av-session-focus__groups {
    columns: 260px;
    column-gap: 28px;
  }

  .av-session-focus__groups > div {
    break-inside: avoid;
    margin-bottom: 18px;
  }

  .av-session-focus__menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .av-session-focus__group {
    margin: 0 0 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.12);
    font-size: 14px;
    font-weight: 700;
    color: var(--av-text);
  }

  .av-session-focus__none {
    margin: 4px 0;
  }

  /* Quiet rows in a list: one line each, a tint on hover, a focus ring, no shadow. */
  .av-session-focus__groups button {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: var(--av-clickable-card-radius) !important;
    background: transparent;
    color: var(--av-text);
    font-size: 15px;
    line-height: 1.3;
    text-align: left;
    box-shadow: none !important;
  }

  .av-session-focus__groups button:hover {
    background: #eef7f7;
  }

  .av-session-focus__groups button[aria-current="true"] {
    background: #e3f2f2;
  }

  .av-session-focus__groups button:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 2px;
  }

  /* The notes and, once a problem is picked, the method in a column beside them. */
  .av-session-notes__work {
    display: flex;
    align-items: flex-start;
    gap: 20px;
  }

  .av-session-notes__write {
    flex: 1 1 auto;
    min-width: 0;
  }

  .av-session-focus__plan {
    flex: 0 0 300px;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .av-session-focus__plan[hidden],
  .av-session-focus__add[hidden],
  .av-session-focus__setup[hidden],
  .av-session-focus__added[hidden] {
    display: none;
  }

  .av-session-focus__method {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--av-accent-ink);
  }

  .av-session-focus__why {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: var(--av-muted);
  }

  .av-session-focus__steps {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
  }

  .av-session-focus__add {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.1);
  }

  /* Move on when / Step back when / later days: short lines under the steps. */
  .av-session-focus__when {
    margin: 0;
    font-size: 0.85rem;
  }

  .av-session-focus__when[hidden] {
    display: none;
  }

  /* What "Set up my workspace" will do, then the button (or Undo once it is done). */
  .av-session-focus__setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.1);
  }

  .av-session-focus__setup-text {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.85rem;
    color: var(--av-muted);
  }

  .av-session-focus__setup [hidden] {
    display: none !important;
  }

  .av-session-focus__added {
    margin: 0;
    font-size: 0.85rem;
    color: #2f7a33;
  }

  .av-session-add__choices,
  .av-session-add__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .av-session-add__choices[hidden] {
    display: none;
  }

  .av-session-add__form {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .av-session-add__form[hidden] {
    display: none;
  }

  .av-session-add__form label,
  .av-session-add__form p {
    margin: 0;
  }

  .av-tool__name {
    font-size: 15px;
    font-weight: 700 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .av-tool__body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
  }

  .av-tool__hint {
    margin: 0;
  }

  .av-session-stage .av-tool__body {
    padding: 18px 22px;
  }

  /* On the stage the header says loudly which tool this is: a bigger name and icon on a band
     of the tool's own tint, so the two halves of a split (Drone beside Tuner, say) can't be
     taken for each other. The sidebar keeps the small header. */
  .av-session-stage .av-tool__head {
    background: var(--av-tool-tint);
    padding: 10px 12px 10px 20px;
  }

  .av-session-stage .av-tool__name {
    font-size: 20px;
    color: var(--av-tool-ink);
  }

  .av-session-stage .av-tool__icon {
    width: 36px;
    height: 36px;
    background: var(--av-card);
    font-size: 17px;
  }

  .av-session-stage .av-tool__icon svg {
    width: 22px;
    height: 22px;
  }

  .av-session-stage .av-tool__sub {
    color: var(--av-tool-ink);
  }

  /* ---- Each tool, small in the sidebar and full on the stage ---- */
  .av-tool .av-metronome {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .av-tool .av-metronome > .card-body {
    padding: 0;
  }

  /* The Metronome: one row (Start, tempo, target), then the band, then the click volume.
     Full on the stage; in the sidebar a square play/stop button and no labels. */
  .av-session-metro {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .av-session-metro__row {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .av-session-metro__tempo {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    white-space: nowrap;
  }

  .av-session-metro__current strong,
  .av-session-metro__target strong {
    font-family: "Roboto Mono", monospace !important;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
  }

  .av-session-metro__pct {
    font-size: 12px;
    color: rgba(34, 36, 52, 0.72);
  }

  .av-session-metro__target {
    margin-left: auto;
    flex: none;
  }

  /* ---- The stage Metronome's modes (the "Stage Metronome Modes" design) ----
     Mode at the top, then the tempo, then the picked mode's settings under a rule. The
     modes, ±5% and every setting are for the stage; the sidebar keeps Start, the tempo,
     − / band / + and nothing else. */
  .av-session-metro__mode {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .av-session-metro__mode-label {
    font-size: 15px;
    font-weight: 700;
  }

  .av-session-metro__short {
    display: none;
  }

  .av-session-metro__tempo-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .av-session-metro__band-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  /* ±5%: quiet outlined buttons either side of − and +. */
  .av-session-metro__five {
    flex: none;
    height: 44px;
    padding: 0 10px;
    border: 2px solid rgba(15, 23, 42, 0.2);
    border-radius: var(--av-btn-radius);
    background: var(--av-card);
    color: var(--av-ink);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    box-shadow: none !important;
  }

  .av-session-metro__five:hover {
    background: rgba(53, 171, 178, 0.12);
  }

  .av-session-metro__five:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 2px;
  }

  .av-session-sidebar .av-session-metro__mode,
  .av-session-sidebar .av-session-metro__five,
  .av-session-sidebar .av-session-metro__panel,
  .av-session-sidebar .av-session-band__label {
    display: none !important;
  }

  .av-session-metro__panel[hidden] {
    display: none !important;
  }

  /* The band: 50% to 120% of the target between two short end zones (« and »), a tick
     every 10%, the target as a dark line. --f is how far along the inner band (0 to 1). */
  .av-session-band {
    --av-band-end: 34px;
    position: relative;
    flex: 1 1 0;
    min-width: 60px;
    height: 34px;
    margin-bottom: 12px;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    outline: none;
  }

  .av-session-sidebar .av-session-band {
    margin-bottom: 0;
  }

  .av-session-band:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 4px;
    border-radius: var(--av-btn-radius);
  }

  .av-session-band__track {
    position: absolute;
    left: 0;
    right: 0;
    top: 10px;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: #e6eaef;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2);
  }

  .av-session-band__zones {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--av-band-end);
    right: var(--av-band-end);
    /* 50–70% teal, 70–85% deeper teal, 85–100% gold, 100–110% and 110–120% red. */
    background: linear-gradient(90deg,
      #e2f2f3 0 28.57%, #cfe9ea 28.57% 50%, #f4d58a 50% 71.43%,
      #f6c9c2 71.43% 85.71%, #f0a89e 85.71% 100%);
  }

  .av-session-band__end {
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--av-band-end);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--av-muted);
    font-size: 11px;
  }

  .av-session-band__end--slow { left: 0; }
  .av-session-band__end--fast { right: 0; }

  .av-session-band__marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .av-session-band__tick,
  .av-session-band__target,
  .av-session-band__label {
    position: absolute;
    left: calc(var(--av-band-end) + (100% - 2 * var(--av-band-end)) * var(--f));
  }

  .av-session-band__tick {
    top: 26px;
    width: 1px;
    height: 8px;
    background: rgba(15, 23, 42, 0.4);
    transform: translateX(-0.5px);
  }

  .av-session-band__target {
    --f: 0.7143;
    top: 4px;
    width: 4px;
    height: 26px;
    margin-left: -2px;
    border-radius: 2px;
    background: var(--av-ink);
  }

  .av-session-band__label {
    top: 36px;
    transform: translateX(-50%);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--av-muted);
  }

  /* Which labels show: percents with a target, words without. */
  .av-session-band[data-has-target="true"] .av-session-band__label--none,
  .av-session-band[data-has-target="false"] .av-session-band__label--set {
    display: none;
  }

  /* No target (the "Metronome target nudge" canvas, board 3): the zones in their real
     colours under white hatching, a dashed line where a target would go, and "slow",
     "target ?" and "fast" under it. The colour draws the eye and asks to be finished; a
     faded or grey band looked switched off. The knob still moves on a 40 to 250 BPM line. */
  .av-session-band[data-has-target="false"] .av-session-band__zones {
    background:
      repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0 5px, rgba(255, 255, 255, 0) 5px 10px),
      linear-gradient(90deg,
        #e2f2f3 0 28.57%, #cfe9ea 28.57% 50%, #f4d58a 50% 71.43%,
        #f6c9c2 71.43% 85.71%, #f0a89e 85.71% 100%);
  }

  .av-session-band[data-has-target="false"] .av-session-band__tick {
    background: rgba(15, 23, 42, 0.22);
  }

  .av-session-band[data-has-target="false"] .av-session-band__tick--target {
    display: none;
  }

  .av-session-band[data-has-target="false"] .av-session-band__target {
    width: 0;
    margin-left: -1px;
    border-radius: 0;
    background: transparent;
    border-left: 2px dashed rgba(15, 23, 42, 0.45);
  }

  /* The Target button: "Target: N BPM" with a target, a dashed "Set target" without. */
  .av-session-metro__target-set {
    display: contents;
  }

  .av-session-metro__target-none {
    display: none;
  }

  .av-session-metro[data-has-target="false"] .av-session-metro__target-set {
    display: none;
  }

  .av-session-metro[data-has-target="false"] .av-session-metro__target-none {
    display: inline;
  }

  .av-session-metro[data-has-target="false"] #metronomeTargetEdit {
    border-style: dashed !important;
    border-color: #176269 !important;
    color: #176269 !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  /* "Make N BPM my target", under the band. */
  .av-session-metro__nudge {
    padding-top: 12px;
    border-top: 1px solid rgba(17, 24, 39, 0.1);
  }

  .av-session-metro__nudge[hidden],
  .av-session-metro__nudge-ask[hidden],
  .av-session-metro__nudge-saved[hidden] {
    display: none !important;
  }

  .av-session-metro__nudge-ask,
  .av-session-metro__nudge-saved {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .av-session-metro__nudge p {
    margin: 0;
    font-size: 14px;
    color: #3d4654;
  }

  .av-session-metro__nudge strong {
    font-family: "Roboto Mono", monospace;
  }

  /* In the sidebar the band shows its stripes and the button asks; the line is for the
     stage, where there is room for it. */
  .av-session-sidebar .av-session-metro__nudge {
    display: none !important;
  }

  .av-session-band__knob {
    position: absolute;
    top: 5px;
    width: 24px;
    height: 24px;
    margin-left: -12px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #1f6f74;
    box-shadow: 2px 2px 0 rgba(15, 23, 42, 0.25);
    pointer-events: none;
  }

  .av-session-band__knob.is-beat {
    animation: av-session-knob-beat 180ms ease-out;
  }

  .av-session-band__knob.is-beat.is-accent {
    animation-name: av-session-knob-accent;
  }

  @keyframes av-session-knob-beat {
    from { background: #35abb2; }
    to { background: #ffffff; }
  }

  @keyframes av-session-knob-accent {
    from { background: #1f6f74; transform: scale(1.15); }
    to { background: #ffffff; transform: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    .av-session-band__knob.is-beat {
      animation: none;
    }
  }

  /* The Start button's keyboard hint, beside its label in the modes that drill. */
  .av-session-metro__key {
    margin-left: 4px;
    padding: 1px 5px;
    border: 1px solid rgba(13, 34, 36, 0.45);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 400;
  }

  .av-session-sidebar .av-session-metro__key {
    display: none;
  }

  /* A mode's settings: an intro line, then fields side by side, label above control. */
  .av-session-metro__panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 16px;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
  }

  .av-session-metro__intro {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
  }

  .av-session-metro__intro b {
    font-size: 15px;
  }

  .av-session-metro__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 22px;
  }

  .av-session-metro__field,
  .av-session-metro__beats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }

  .av-session-metro__field-label {
    font-size: 14px;
    color: var(--av-muted);
  }

  /* Custom beat: one toggle per beat, dark when accented. */
  .av-session-metro__cells {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .av-session-metro__cell {
    width: 52px;
    height: 48px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border: 2px solid rgba(15, 23, 42, 0.2);
    border-radius: var(--av-btn-radius);
    background: var(--av-card);
    color: var(--av-ink);
    box-shadow: none !important;
  }

  .av-session-metro__cell strong {
    font-size: 15px;
  }

  .av-session-metro__cell span {
    font-size: 11px;
  }

  .av-session-metro__cell:hover {
    background: rgba(53, 171, 178, 0.12);
  }

  .av-session-metro__cell[aria-pressed="true"] {
    background: var(--av-nav);
    color: #ffffff;
  }

  .av-session-metro__cell:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 2px;
  }

  /* Subdivision buttons draw the notes themselves (quarter, two beamed eighths, a beamed
     triplet, four beamed sixteenths) in the text colour, so the picked one turns white. */
  .av-session-metro__note {
    display: block;
    width: auto;
    height: 22px;
    fill: currentColor;
  }

  /* The click/quiet pattern over 8 bars. */
  .av-session-metro__strip {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
  }

  .av-session-metro__bar {
    height: 18px;
    border-radius: 3px;
    border: 1px solid rgba(15, 23, 42, 0.25);
    background: #f6f9fa;
  }

  .av-session-metro__bar.is-on {
    background: #35abb2;
  }

  /* Instant Playback is one of the modes now: shown under a rule when picked. */
  .av-session-playback.av-session-metro__panel {
    padding-top: 16px;
  }

  .av-session-metro__volume {
    /* !important: Bootstrap's unlayered `label { display: inline-block }` would win, and the
       slider could not grow to fill the row on a phone. */
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0;
    align-self: flex-end;
    font-size: 0.8rem;
  }

  .av-session-metro__volume input {
    flex: none;
    width: 160px !important;
    accent-color: var(--av-ghost-focus);
  }

  /* The volume as a number, so going past 100% reads as louder than full. */
  .av-session-metro__volume-value {
    min-width: 3.5em;
    font-variant-numeric: tabular-nums;
  }

  /* Slower and faster, as drawn: square outlined buttons with the hard shadow. 40px in
     the sidebar, 52px on the stage. */
  .av-session-metro .av-metronome-icon-btn {
    flex: none;
    width: 40px !important;
    height: 40px !important;
    display: inline-grid;
    place-items: center;
    color: var(--av-ink);
    background: var(--av-card) !important;
    border: 2px solid rgba(15, 23, 42, 0.28) !important;
    border-radius: var(--av-btn-radius) !important;
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12) !important;
    font-size: 14px;
  }

  .av-session-stage .av-session-metro .av-metronome-icon-btn {
    width: 52px !important;
    height: 52px !important;
    font-size: 16px;
  }

  /* The target, as drawn: a small outlined button in the sidebar, a full one on the stage. */
  .av-session-metro__target .btn {
    min-height: 32px;
    padding: 0 10px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px !important;
    border: 2px solid rgba(15, 23, 42, 0.28) !important;
    box-shadow: 2px 2px 0 rgba(15, 23, 42, 0.1) !important;
    background: var(--av-card) !important;
    color: var(--av-ink) !important;
    white-space: nowrap;
  }

  .av-session-stage .av-session-metro__target .btn {
    min-height: 40px;
    padding: 0 14px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12) !important;
  }

  /* Instant Playback, under the Metronome on the stage: the loop on the left (its three
     steps, the beat grid, Start loop) and its settings on the right. Play is teal and
     Playback is gold, as in the woodshed-loop project it came from. */
  .av-session-playback {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
  }

  .av-session-sidebar .av-session-playback {
    display: none;
  }

  .av-session-playback__head {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  /* The mode's name with its Beta pill beside it. */
  .av-session-playback__name {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .av-session-playback__body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 22px;
  }

  .av-session-playback__loop {
    flex: 1 1 280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-radius: 16px;
    background: rgba(53, 171, 178, 0.09);
    text-align: center;
  }

  .av-session-playback__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
  }

  /* Status, not controls: the pill shape is right for these. */
  .av-session-playback__steps > li[data-phase] {
    padding: 3px 10px;
    border-radius: var(--av-pill-radius);
    border: 1px solid rgba(15, 23, 42, 0.2);
    color: var(--av-muted);
  }

  .av-session-playback__steps > li[aria-current="step"] {
    background: var(--av-accent);
    border-color: var(--av-accent);
    color: var(--av-text);
    font-weight: 700;
  }

  .av-session-playback__steps > li[data-phase="playback"][aria-current="step"] {
    background: var(--av-free);
    border-color: var(--av-free);
  }

  .av-session-playback__grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .av-session-playback__bar {
    display: flex;
    gap: 4px;
  }

  .av-session-playback__cell {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid rgba(15, 23, 42, 0.22);
    background: var(--av-card);
  }

  .av-session-playback__cell.is-done {
    background: rgba(53, 171, 178, 0.35);
    border-color: rgba(53, 171, 178, 0.6);
  }

  .av-session-playback__cell.is-now {
    background: var(--av-accent);
    border-color: var(--av-ghost-focus);
  }

  .av-session-playback__cell.is-playback.is-done {
    background: rgba(215, 172, 79, 0.4);
    border-color: rgba(215, 172, 79, 0.7);
  }

  .av-session-playback__cell.is-playback.is-now {
    background: var(--av-free);
    border-color: #8a6a1c;
  }

  #avPlaybackStart {
    min-height: 48px;
    min-width: 170px;
    font-size: 16px !important;
    font-weight: 700 !important;
  }

  /* The small outlined buttons inside cards (Add to this tune, Set key). */
  .av-session-add__choices .btn {
    min-height: 32px;
    font-size: 13px !important;
    font-weight: 700 !important;
    border: 2px solid rgba(15, 23, 42, 0.28) !important;
    box-shadow: 2px 2px 0 rgba(15, 23, 42, 0.1) !important;
  }

  .av-session-playback__key {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
  }

  .av-session-playback__settings {
    flex: 1 1 280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .av-session-playback__setting {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
  }

  .av-session-playback__label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--av-muted);
  }

  .av-session-playback__setting input[type="range"] {
    width: 260px !important;
    max-width: 100%;
    accent-color: var(--av-ghost-focus);
  }

  .av-session-switch > output {
    min-width: 44px;
    min-height: 34px;
    padding: 0 6px;
    /* !important: Bootstrap's unlayered `output { display: block }` would win and leave the
       text at the top of the cell. */
    display: grid !important;
    place-items: center;
    border-left: 1px solid rgba(15, 23, 42, 0.16);
    background: var(--av-card);
    font: 700 15px "Roboto Mono", monospace;
  }

  .av-session-switch > button:disabled {
    opacity: 0.45;
  }

  /* Stage: the full labels, a big Start, and the percentage beside the tempo. */
  .av-session-stage .av-session-metro {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    gap: 18px;
  }

  .av-session-stage .av-session-metro__start {
    min-height: 52px;
    min-width: 130px;
    font-size: 17px !important;
    font-weight: 700 !important;
  }

  .av-session-stage .av-session-metro__current {
    font-size: 17px;
  }

  .av-session-stage .av-session-metro__pct {
    display: none;
  }

  /* Sidebar: compact. The button's label is hidden and an icon stands in for it. */
  .av-session-sidebar .av-session-metro__label,
  .av-session-sidebar .av-session-metro__volume {
    display: none !important;
  }

  .av-session-sidebar .av-session-metro__start {
    flex: none;
    width: 44px !important;
    min-width: 0 !important;
    height: 44px !important;
    padding: 0 !important;
    font-size: 0 !important;
  }

  .av-session-sidebar .av-session-metro__start > i {
    display: none;
  }

  .av-session-sidebar .av-session-metro__start::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 1rem;
    content: "\f04b"; /* play */
  }

  .av-session-sidebar .av-session-metro[data-running="true"] .av-session-metro__start::before {
    content: "\f04d"; /* stop */
  }

  .av-session-sidebar .av-session-metro__current strong {
    font-size: 22px;
  }

  .av-session-sidebar .av-session-metro__unit {
    font-size: 13px;
  }

  /* While it runs the Start button is a beat light, pulsing in time with the tempo. */
  .av-session-metro[data-running="true"] .av-session-metro__start {
    animation: av-session-beat var(--av-session-beat, 1s) linear infinite;
  }

  @keyframes av-session-beat {
    0% { box-shadow: 0 0 0 0 rgba(53, 171, 178, 0.75), var(--av-btn-shadow); filter: brightness(1.12); }
    70% { box-shadow: 0 0 0 9px rgba(53, 171, 178, 0), var(--av-btn-shadow); filter: none; }
    100% { box-shadow: 0 0 0 0 rgba(53, 171, 178, 0), var(--av-btn-shadow); }
  }

  @media (prefers-reduced-motion: reduce) {
    .av-session-metro[data-running="true"] .av-session-metro__start {
      animation: none;
    }
  }

  /* The Theory Map brings its own card; inside a tool card that would be a box in a box. */
  .av-tool .av-theory-helper {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 4px 12px;
    overflow: visible !important;
  }

  /* Notes/Degrees, as drawn: one outlined group, the chosen one dark. (The instrument
     is a drop-down in the map's top row; its buttons stay hidden.) */
  .av-tool [data-role="label-toggle"] {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;
    border: 2px solid rgba(15, 23, 42, 0.28);
    border-radius: var(--av-btn-radius);
    overflow: hidden;
    box-shadow: 2px 2px 0 rgba(15, 23, 42, 0.1);
  }

  .av-tool [data-role="label-toggle"] > button {
    min-height: 34px;
    min-width: 38px;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-left: 1px solid rgba(15, 23, 42, 0.16) !important;
    border-radius: 0 !important;
    background: var(--av-card) !important;
    color: var(--av-ink) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
    transform: none !important;
    white-space: nowrap;
  }

  .av-tool [data-role="label-toggle"] > button:first-child {
    border-left: 0 !important;
  }

  .av-tool [data-role="label-toggle"] > button.is-active {
    background: var(--av-nav) !important;
    color: #ffffff !important;
  }

  .av-tool [data-role="label-toggle"] > button:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: -3px;
  }

  /* Host of the materials link, beside the title on the stage. */
  .av-tool__sub {
    font-size: 12px;
    font-weight: 400;
    color: rgba(34, 36, 52, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .av-session-sidebar #avMaterialsHost {
    display: none;
  }

  .av-session-materials iframe {
    display: block;
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.14);
  }

  .av-session-stage .av-session-materials iframe {
    height: max(420px, calc(100vh - 340px)) !important;
  }

  /* The frame's own "BETA" line is today's screen's; the card header says what this is. */
  .av-session-materials > p {
    display: none;
  }

  /* While the server finds out whether the site may be framed. */
  .av-session-materials__note {
    padding: 14px 16px;
    font-size: 13px;
    color: rgba(34, 36, 52, 0.72);
  }

  /* A site that won't be framed: one calm line saying so, and the way in. Never the
     browser's broken-page face. */
  .av-session-materials__link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    font-size: 14px;
  }

  .av-session-materials__why {
    color: rgba(34, 36, 52, 0.72);
  }

  .av-session-materials__link .btn {
    font-weight: 700 !important;
    border: 2px solid rgba(15, 23, 42, 0.28) !important;
    box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.12) !important;
  }

  /* In the sidebar the peek's fixed, unclickable box gives way to the link. */
  .av-session-sidebar .av-session-materials.av-session-materials--link {
    height: auto;
    overflow: visible;
    border: 0;
    background: transparent;
    pointer-events: auto;
  }

  .av-session-sidebar .av-session-materials.av-session-materials--link > div {
    padding: 0;
  }

  .av-session-stage .av-session-materials--link {
    align-items: center;
    justify-content: center;
  }

  .av-session-stage .av-session-materials--link > div {
    align-items: center;
    text-align: center;
    font-size: 16px;
  }

  /* In the sidebar the materials are a peek: the same page drawn small and not
     clickable. On the stage it is the whole page. */
  .av-session-sidebar .av-session-materials {
    height: 84px;
    overflow: hidden;
    border-radius: var(--av-clickable-card-radius);
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: #fbfbf8;
    pointer-events: none;
  }

  .av-session-sidebar .av-session-materials iframe {
    width: 250% !important; /* the frame carries Bootstrap's w-100 */
    height: 300px !important;
    border: 0;
    transform: scale(0.4);
    transform-origin: top left;
  }

  .av-session-sidebar .av-session-materials p,
  .av-session-stage #avMaterialsHint {
    display: none;
  }

  /* A segmented switch: buttons, so the button radius. */
  /* As drawn: one outlined group with a small hard shadow; the chosen one goes dark. */
  .av-session-switch {
    display: inline-flex;
    flex: none;
    border: 2px solid rgba(15, 23, 42, 0.28);
    border-radius: var(--av-btn-radius);
    overflow: hidden;
    box-shadow: 2px 2px 0 rgba(15, 23, 42, 0.1);
  }

  .av-session-switch > button {
    min-height: 34px;
    min-width: 38px;
    padding: 0 10px;
    border: 0 !important;
    border-left: 1px solid rgba(15, 23, 42, 0.16) !important;
    border-radius: 0 !important;
    background: var(--av-card);
    color: var(--av-ink);
    font-size: 14px;
    font-weight: 700;
    box-shadow: none !important;
    transform: none !important;
  }

  .av-session-switch > button:first-child {
    border-left: 0 !important;
  }

  .av-session-switch > button[aria-pressed="true"] {
    background: var(--av-nav);
    color: #ffffff;
  }

  .av-session-switch > button:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: -2px;
  }

  /* Speed is for watching big; the small player keeps its header short. */
  .av-session-sidebar #avYouTubeSpeed {
    display: none;
  }

  /* Repeat A–B: a row under the video, on the stage only. */
  .av-yt-repeat {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding-top: 10px;
  }

  .av-session-sidebar .av-yt-repeat {
    display: none;
  }

  .av-yt-repeat__point {
    display: inline-flex;
    align-items: center;
    gap: 2px;
  }

  .av-yt-repeat__point output {
    min-width: 3.2em;
    text-align: center;
    font: 700 15px "Roboto Mono", monospace;
  }

  .av-yt-repeat__arrow {
    color: var(--av-muted, #64748b);
  }

  .av-yt-repeat [hidden] {
    display: none !important;
  }

  .av-tool .youtube-embed-container iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .av-session-sidebar [data-tool="theory"] [data-theory-helper],
  .av-session-stage .av-session-theory-small {
    display: none !important;
  }

  /* The small Theory Map (theory-mini.js): key, tones, first-position neck. */
  .av-session-theory-small {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .av-session-theory-small__head {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .av-session-theory-small__head > b {
    flex: 1;
    min-width: 0;
  }

  #avTheoryMini {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #avTheoryMini:empty {
    display: none;
  }

  .av-mini-tones {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
  }

  .av-mini-tone {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3px 0;
    border-radius: var(--av-btn-radius);
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: var(--av-card);
    font-size: 0.75rem;
    line-height: 1.2;
  }

  .av-mini-tone__degree {
    font-size: 0.6rem;
    color: rgba(34, 36, 52, 0.75);
  }

  /* Root, third and fifth, in the Theory Map's colours. The doubled class is so these
     outrank the plain note style further down. */
  .av-mini-tone--root,
  .av-mini-note.av-mini-note--root { background: #cfe8cf; }
  .av-mini-tone--third,
  .av-mini-note.av-mini-note--third { background: #f6e3b4; }
  .av-mini-tone--fifth,
  .av-mini-note.av-mini-note--fifth { background: #cfe7e8; }

  .av-mini-neck {
    display: grid;
  }

  .av-mini-neck__open,
  .av-mini-neck__fret {
    display: grid;
    place-items: center;
    font: 0.6rem "Roboto Mono", monospace;
    color: rgba(34, 36, 52, 0.7);
  }

  .av-mini-neck__cell {
    height: 20px;
    display: grid;
    place-items: center;
    border-left: 1px solid rgba(15, 23, 42, 0.3);
    /* the string */
    background: linear-gradient(transparent 9px, rgba(15, 23, 42, 0.22) 9px, rgba(15, 23, 42, 0.22) 11px, transparent 11px);
  }

  .av-mini-neck__cell--open {
    border-left: 0;
    border-right: 3px solid rgba(15, 23, 42, 0.55); /* the nut */
  }

  .av-mini-note {
    min-width: 20px;
    height: 16px;
    padding: 0 2px;
    display: grid;
    place-items: center;
    border-radius: 4px;
    border: 1px solid rgba(15, 23, 42, 0.22);
    background: var(--av-card);
    font: 700 0.6rem "Roboto Mono", monospace;
  }

  .av-mini-keys {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    height: 70px;
  }

  .av-mini-key {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 4px;
    border: 1px solid rgba(15, 23, 42, 0.35);
    border-right-width: 0;
    background: var(--av-card);
  }

  .av-mini-key:last-child {
    border-right-width: 1px;
  }

  /* Black keys sit over the joins between the white ones. They are the 2nd, 4th, 7th,
     9th and 11th keys of the octave, so they are placed by position rather than flow. */
  .av-mini-key--black {
    position: absolute;
    top: 0;
    width: 9%;
    height: 42px;
    padding-bottom: 2px;
    border: 0;
    border-radius: 0 0 3px 3px;
    background: var(--av-ink);
    z-index: 1;
  }

  .av-mini-key--black:nth-child(2) { left: calc(100% / 7 * 1 - 4.5%); }
  .av-mini-key--black:nth-child(4) { left: calc(100% / 7 * 2 - 4.5%); }
  .av-mini-key--black:nth-child(7) { left: calc(100% / 7 * 4 - 4.5%); }
  .av-mini-key--black:nth-child(9) { left: calc(100% / 7 * 5 - 4.5%); }
  .av-mini-key--black:nth-child(11) { left: calc(100% / 7 * 6 - 4.5%); }

  .av-mini-key--black .av-mini-note {
    min-width: 16px;
    height: 14px;
    font-size: 0.5rem;
  }

  .av-session-stage [data-tool="theory"] .av-tool__body {
    overflow-x: auto;
  }

  .av-session-notes {
    width: 100%;
    font-family: "Roboto Mono", monospace !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    padding: 10px 12px !important;
    border: 1px solid rgba(15, 23, 42, 0.2) !important;
    border-radius: var(--av-input-radius) !important;
    background: var(--av-card);
    color: var(--av-ink);
    resize: none;
  }

  /* The placeholder must not pass for a note (founder, 2 Dec 2026): notes are dark monospace,
     the placeholder the page's own font in grey italics. The grey keeps 4.5:1 on the card. */
  /* !important: Bootstrap's .form-control colours sit outside the cascade layers and beat any
     layered rule, which left notes in Bootstrap's grey (#495057), close to the placeholder. */
  .av-session-notes {
    color: var(--av-ink) !important;
  }

  .av-session-notes::placeholder {
    color: #6b7280 !important;
    opacity: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-style: italic;
  }

  .av-session-stage .av-session-notes {
    min-height: max(320px, calc(100vh - 420px));
    font-size: 17px !important;
    line-height: 1.7 !important;
    padding: 16px 18px !important;
  }

  /* ---- Spotify footer bar ---- */
  /* A footer: the site's reset gives it a display of its own outside the cascade layers,
     so the row needs !important, and so does hiding it. */
  .av-session-spotify {
    display: flex !important;
    align-items: center;
    gap: 6px;
    padding-right: 8px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--av-nav);
  }

  .av-session-spotify__player {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Change track: a secondary action beside the player, so a quiet ghost button, light on
     the bar's dark. The site's button styles are unlayered, hence the !important. */
  .av-session-spotify__change {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 10px !important;
    font-size: 13px !important;
    font-weight: 700;
    color: #fff;
    background: transparent !important;
    border: 0 !important;
    border-radius: var(--av-btn-radius);
    box-shadow: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease;
  }

  .av-session-spotify__change:hover {
    background: rgba(255, 255, 255, 0.14) !important;
  }

  .av-session-spotify__change:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: -3px;
  }

  .av-session-spotify__change[hidden] {
    display: none;
  }

  .av-session-spotify[hidden] {
    display: none !important;
  }

  .av-session-spotify iframe {
    display: block;
    width: 100%;
    height: 80px;
    border: 0;
    border-radius: 12px;
  }

  .av-session-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  /* "Love it or something wrong? Shoot me a note!": the address is spelled out where there is
     room, for a browser with no mail to open. A phone always has mail, and no room: there the
     words break after the question, two short lines in the link's 44px, instead of wrapping
     wherever the width runs out (one line needs about 330px with the envelope). */
  .av-session-foot__report {
    text-decoration: none;
  }

  @media (max-width: 767.98px) {
    .av-session-foot__address {
      display: none;
    }

    .av-session-foot__break {
      display: block;
    }
  }

  /* The dock: on a desktop only the Spotify bar shows in it. */
  .av-session-strip,
  .av-session-toolbar,
  .av-session-theory-upright {
    display: none;
  }

  /* The upright neck (theory-mini.js): strings across, frets 0 to 12 down. */
  .av-upright-neck {
    display: grid;
    width: 100%;
  }

  .av-upright-neck__open,
  .av-upright-neck__fret {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    font: 0.75rem "Roboto Mono", monospace;
    color: rgba(34, 36, 52, 0.7);
  }

  .av-upright-neck__open {
    font-weight: 700;
    border-bottom: 4px solid rgba(15, 23, 42, 0.55); /* the nut */
  }

  /* A fret with a dot on the real neck. */
  .av-upright-neck__fret.is-marked {
    color: var(--av-ink);
    font-weight: 700;
  }

  .av-upright-neck__fret.is-marked::after {
    content: "•";
    margin-left: 2px;
  }

  .av-upright-neck__cell {
    min-height: 36px;
    display: grid;
    place-items: center;
    border-bottom: 1px solid rgba(15, 23, 42, 0.3); /* the fret */
    /* the string */
    background: linear-gradient(90deg, transparent calc(50% - 1px), rgba(15, 23, 42, 0.22) calc(50% - 1px), rgba(15, 23, 42, 0.22) calc(50% + 1px), transparent calc(50% + 1px));
  }

  .av-upright-neck__cell--open {
    border-bottom: 0;
  }

  .av-upright-neck .av-mini-note {
    min-width: 28px;
    height: 24px;
    font-size: 0.75rem;
  }

  .av-mini-note.is-dimmed {
    opacity: 0.3;
  }

  /* Desktop: the whole session fits the window, as drawn. The header and the Spotify bar
     keep their height, the stage and the sidebar share the rest, and a long tool scrolls
     inside its own card. session.js measures where the session starts (--av-session-top). */
  @media (min-width: 992px) {
    .av-session {
      height: calc(100vh - var(--av-session-top, 56px));
      min-height: 520px;
    }

    .av-session-main {
      flex: 1 1 auto;
      min-height: 0;
      align-items: stretch;
    }

    .av-session-stage {
      min-height: 0;
      align-items: stretch;
      grid-template-rows: minmax(0, 1fr);
    }

    .av-session-stage:has(> .av-session-hint:not([hidden])) {
      grid-template-rows: auto minmax(0, 1fr);
    }

    .av-session-sidebar {
      min-height: 0;
      overflow-y: auto;
      padding: 0 4px 4px 0;
    }

    .av-session-sidebar > .av-tool {
      flex: none;
    }

    .av-session-stage .av-tool__body {
      flex: 1 1 auto;
      min-height: 0;
      overflow: auto;
    }

    /* A tall tool keeps its height and the card scrolls; without this the Theory Map
       was squashed to fit and its neck cut off. */
    .av-session-stage .av-tool__body > * {
      flex-shrink: 0;
    }

    .av-session-stage .av-session-notes {
      flex: 1 1 auto;
      min-height: 160px;
    }

    /* The notes sit in a row with the Working on method; the stretch passes down to them. */
    .av-session-stage .av-session-notes__work {
      flex: 1 1 auto;
      align-items: stretch;
    }

    .av-session-stage .av-session-notes__write {
      display: flex;
      flex-direction: column;
    }

    .av-session-stage .av-session-focus__plan {
      align-self: flex-start;
    }

    /* The video fills the card, as drawn, instead of running off its bottom edge. */
    /* The site's player box keeps 16:9 with bottom padding; on the stage the box takes
       the card's height and the player fills the box. */
    .av-session-stage .youtube-embed-container {
      flex: 1 1 auto;
      min-height: 0;
      height: auto !important;
      padding: 0 !important;
    }

    .av-session-stage .youtube-embed-container iframe {
      position: absolute;
      inset: 0;
      width: 100% !important;
      height: 100% !important;
      aspect-ratio: auto;
    }

    .av-session-stage [data-tool="materials"] .av-tool__body {
      padding: 0;
    }

    .av-session-stage .av-session-materials {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .av-session-stage .av-session-materials iframe {
      flex: 1 1 auto;
      min-height: 0;
      height: auto !important;
      border: 0;
      resize: none !important;
    }

    /* The Spotify bar sits under the stage only (session.js moves it into this grid), so the
       tools panel keeps the full height beside both. */
    .av-session-main {
      grid-template-rows: minmax(0, 1fr);
    }

    .av-session-main:has(> .av-session-spotify:not([hidden])) {
      grid-template-rows: minmax(0, 1fr) auto;
    }

    .av-session-main > .av-session-stage {
      grid-column: 1;
      grid-row: 1;
    }

    .av-session-main > .av-session-spotify {
      grid-column: 1;
      grid-row: 2;
    }

    .av-session-main > .av-session-panel-strip,
    .av-session-main > .av-session-sidebar {
      grid-column: 2;
      grid-row: 1 / -1;
    }

    .av-session-dock {
      flex: none;
      padding: 0 24px 14px;
    }

    .av-session-dock:not(:has(> .av-session-spotify:not([hidden]))) {
      padding-bottom: 0;
    }

    .av-session-notices {
      flex: none;
      padding: 0 24px;
    }

    .av-session-foot {
      flex: none;
      padding: 0 24px 10px;
    }

    /* ---- The Metronome alone on the stage ----
       ("Practice Anything Workspace" canvas, 1 Dec 2026; for tunes too since 2 Dec 2026.)
       The stage card fills the window, so a strip of controls pinned to the top left most of
       it blank. Here the same partial is laid out as an instrument centred in the card: the
       Mode switch on the card's title line; Start, the tempo big between − and +, and the
       target on one row; the band with ±5% at its ends; a tune's "Make N BPM my target"
       line; the picked mode's settings; the click volume. Every mode fits a 1440x900 window
       without the card scrolling. The wrappers become `display: contents` so the existing
       controls can be placed on one grid. Margins on the buttons need !important:
       Bootstrap's unlayered `button { margin: 0 }` wins otherwise. A split, the sidebar and
       phones are untouched. */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-tool__body {
      justify-content: safe center;
      padding: 20px 24px;
    }

    /* 840px: the row is Start, −, the tempo, +, the target. A three-digit tempo at 84px is
       about 280px wide, and in 760px the target then sat on top of + (by 28px at 200 BPM)
       and Start on − ; an 80 only just fitted. */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro {
      max-width: 840px;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto auto auto minmax(0, 1fr) auto;
      grid-template-areas:
        "start start minus num   plus  tgt   tgt  "
        "fivel band  band  band  band  band  fiver"
        "nudge nudge nudge nudge nudge nudge nudge"
        "panel panel panel panel panel panel panel"
        "vol   vol   vol   vol   vol   vol   vol  ";
      align-items: center;
      column-gap: 0;
      row-gap: 16px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__nudge {
      grid-area: nudge;
    }

    /* No line to show: no row for it, or its gap would still be there. */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro:has(> .av-session-metro__nudge[hidden]) {
      grid-template-areas:
        "start start minus num   plus  tgt   tgt  "
        "fivel band  band  band  band  band  fiver"
        "panel panel panel panel panel panel panel"
        "vol   vol   vol   vol   vol   vol   vol  ";
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] :is(.av-session-metro__tempo-block, .av-session-metro__row, .av-session-metro__band-row, .av-session-metro__tempo) {
      display: contents;
    }

    /* The Mode switch sits on the card's title line (the card is the positioned box; on a
       full stage its header has nothing on the right). */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__mode {
      position: absolute;
      top: 8px;
      right: 16px;
      z-index: 1;
      min-height: 40px;
      gap: 10px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__mode-label {
      font-size: 14px;
      font-weight: 400;
      color: var(--av-muted);
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__current {
      grid-area: num;
      display: flex;
      align-items: baseline;
      justify-content: center;
      gap: 10px;
      min-width: 220px;
      font-size: 20px;
    }

    /* "Current:" goes: the big number says it. */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__current > .av-session-metro__label:first-child {
      display: none;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #metronomeCurrent {
      font-size: 64px;
      line-height: 1;
      letter-spacing: -0.03em;
      color: var(--av-ink);
    }

    /* Basic has no settings under the band, so the tempo can be bigger. */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro[data-mode="basic"] #metronomeCurrent {
      font-size: 84px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__unit {
      color: var(--av-muted);
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #metronomeMinus {
      grid-area: minus;
      margin-right: 24px !important;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #metronomePlus {
      grid-area: plus;
      margin-left: 24px !important;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__target {
      grid-area: tgt;
      justify-self: end;
      margin-left: 0;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avMetroSlower5 {
      grid-area: fivel;
      margin-right: 10px !important;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avMetroFaster5 {
      grid-area: fiver;
      margin-left: 10px !important;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-band {
      grid-area: band;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__panel {
      grid-area: panel;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__start {
      grid-area: start;
      justify-self: start;
      min-width: 170px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__volume {
      grid-area: vol;
      justify-self: center;
      align-self: center;
    }

    /* Tighter settings, so Custom beat and Instant Playback fit the card too. */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-tool__body {
      padding-top: 12px;
      padding-bottom: 12px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__panel {
      gap: 10px;
      padding-top: 12px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] :is(.av-session-metro__intro, .av-session-playback__head) {
      font-size: 13px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__cell {
      height: 40px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-playback__settings {
      gap: 10px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-playback__loop {
      align-self: stretch;
      justify-content: center;
    }

    /* Custom beat: the click/quiet strip and its summary sit beside "Click for" and "Then
       quiet for" rather than under them. */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avBeat {
      display: grid;
      grid-template-columns: auto minmax(160px, 1fr);
      column-gap: 24px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avBeat > * {
      grid-column: 1 / -1;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avBeat > .av-session-metro__beats + .av-session-metro__fields {
      grid-column: 1;
      grid-row: span 2;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avBeatStrip,
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avBeatSummary {
      grid-column: 2;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #avBeatStrip {
      align-self: end;
    }
  }

  /* With the tools panel open the stage is narrow up to about 1366px: the Mode switch on
     the title line takes the short labels there, as on a phone, so it clears the title.
     (Up to 1280px until 3 Dec 2026; from 1280 to 1365px the open panel leaves an 811 to
     896px card, too narrow for the one row with a three-digit tempo.) */
  @media (min-width: 992px) and (max-width: 1365.98px) {
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__mode-label,
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__mode .av-session-metro__long {
      display: none;
    }

    /* Start and the target can't share the tempo's row here: they take a row under it,
       meeting at the card's middle. Both sit in the one full-width area and each keeps to
       its own half with a margin of half the row; splitting the row at a column line put
       the join right of centre, and the target ran off the card's edge with the panel open
       (16px between them: 8px each side of the middle). */
    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro {
      max-width: 760px;
      grid-template-areas:
        ".     .     minus num   plus  .     .    "
        "pair  pair  pair  pair  pair  pair  pair "
        "fivel band  band  band  band  band  fiver"
        "nudge nudge nudge nudge nudge nudge nudge"
        "panel panel panel panel panel panel panel"
        "vol   vol   vol   vol   vol   vol   vol  ";
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro:has(> .av-session-metro__nudge[hidden]) {
      grid-template-areas:
        ".     .     minus num   plus  .     .    "
        "pair  pair  pair  pair  pair  pair  pair "
        "fivel band  band  band  band  band  fiver"
        "panel panel panel panel panel panel panel"
        "vol   vol   vol   vol   vol   vol   vol  ";
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__start {
      grid-area: pair;
      justify-self: end;
      margin-right: calc(50% + 8px) !important;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__target {
      grid-area: pair;
      justify-self: start;
      margin-left: calc(50% + 8px);
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__current {
      min-width: 0;
      padding: 0 4px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #metronomeMinus {
      margin-right: 12px !important;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] #metronomePlus {
      margin-left: 12px !important;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-tool__body {
      padding-left: 16px;
      padding-right: 16px;
    }

    .av-session-stage:not(.av-session-stage--split) > [data-tool="metronome"] .av-session-metro__mode .av-session-metro__short {
      display: inline;
    }
  }

  /* Phone: one tool fills the screen, switched from a tool bar at the bottom. No sidebar,
     no split, no dragging. See "Phone" in the redesign decisions. */
  @media (max-width: 767.98px) {
    .av-session {
      gap: 10px;
      padding-top: 10px;
      /* keep the last line clear of the fixed dock */
      padding-bottom: calc(var(--av-session-dock, 150px) + 12px);
    }

    .av-session-sidebar,
    .av-session-hint,
    .av-session-drop {
      display: none !important;
    }

    /* Header: Prev and Next as 44px icon buttons, the tune and clock between them. */
    .av-session-header {
      padding: 8px 12px 4px;
    }

    .av-session-header--no-bar {
      padding-bottom: 8px;
    }

    .av-session-top__side--start {
      width: 44px;
    }

    /* Between two 44px buttons there is no room to spare: the clock goes under the tune. */
    .av-session-now {
      flex-direction: column;
      flex-wrap: nowrap;
    }

    /* Under the tune there is nothing to divide it from, and 46px would crowd the row. */
    .av-session-clock {
      padding-left: 0;
      border-left: 0;
      gap: 8px;
    }

    .av-session-clock__text {
      font-size: 32px;
    }

    /* Resume later moves up into the site navbar, in the wordmark's place, so the session
       header stays one slim row. */
    .av-session-later {
      display: none !important;
    }

    .av-session-navlater {
      display: inline-flex;
    }

    /* The site's navbar styles are unlayered and beat this layer, so it needs !important. */
    .navbar:has(.av-session-navlater) .navbar-brand {
      display: none !important;
    }

    .av-session-main {
      padding: 0 12px;
    }

    /* A phone's header stays slim: the title a step down from the desktop's 20px. */
    .av-session-tune .av-object-row__title {
      font-size: 17px !important;
    }

    .av-session-tune .av-object-row__meta {
      font-size: 13px !important;
    }

    /* No Spotify bar on a phone: the tool bar's Spotify link opens the app instead
       (spotify-tool.js keeps the bar hidden; this is the backstop). */
    .av-session-spotify {
      display: none !important;
    }

    a.av-session-toolbar__btn,
    a.av-session-toolbar__btn:hover {
      text-decoration: none;
    }

    .av-session-foot,
    .av-session-notices {
      padding: 0 12px;
    }

    .av-session-top {
      grid-template-columns: 44px minmax(0, 1fr) 44px;
    }

    /* The wide header's 20px side padding is !important, so this has to be too: left in, it
       takes the whole 44px and pushes the icon 7px right of centre. */
    .av-session-top .btn {
      width: 44px;
      min-width: 44px;
      min-height: 44px;
      padding: 0 !important;
    }

    /* Prev is shorter than Next on a wide screen; on a phone both are the full 44px. */
    .av-session-top #avPrev {
      min-height: 44px;
    }

    /* The word stays for screen readers; the icon is what shows. */
    .av-session-navlabel {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
    }

    .av-session-bar {
      gap: 3px;
      margin-top: 6px !important;
    }

    .av-session-bar > li {
      min-width: 12px;
    }

    .av-session-seg {
      min-height: 24px;
    }

    .av-session-stage .av-tool__body {
      padding: 12px;
    }

    .av-session-break {
      padding: 28px 20px;
      margin: 8px auto;
    }

    /* The dock, fixed to the bottom: now playing, Spotify, then the tool bar. */
    .av-session-dock {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 20;
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding-top: 6px;
      background: var(--av-bg);
      box-shadow: 0 -6px 14px rgba(15, 23, 42, 0.08);
    }

    .av-session-strip {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 0 12px;
      padding: 6px 8px 6px 6px;
      border-radius: 12px;
      background: var(--av-nav);
      color: #e6ebf3;
      font-size: 0.9rem;
    }

    .av-session-strip[hidden] {
      display: none;
    }

    .av-session-strip__text {
      flex: 1;
      min-width: 0;
    }

    .av-session-strip__text b {
      font-family: "Roboto Mono", monospace;
    }

    .av-session-strip__stop,
    .av-session-strip__step {
      width: 44px;
      height: 44px;
      padding: 0;
      display: grid;
      place-items: center;
      border-radius: var(--av-btn-radius);
      box-shadow: none !important;
    }

    .av-session-strip__stop {
      border: 0;
      background: var(--av-accent);
      color: var(--av-text);
      animation: av-session-beat var(--av-session-beat, 1s) linear infinite;
    }

    .av-session-strip__step {
      border: 1px solid rgba(230, 235, 243, 0.35);
      background: transparent;
      color: #e6ebf3;
      font-size: 1.25rem;
    }

    .av-session-spotify {
      margin: 0 12px;
      padding-right: 4px;
    }

    /* A phone's player needs the width: the icon alone, its name kept for screen readers. */
    .av-session-spotify__change {
      min-width: 44px;
      min-height: 44px;
      justify-content: center;
      padding: 0 !important;
      font-size: 16px !important;
    }

    .av-session-spotify__change > span {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      white-space: nowrap;
    }

    .av-session-toolbar {
      display: flex;
      background: var(--av-card);
      border-top: 2px solid rgba(15, 23, 42, 0.14);
      padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    /* Each button is as wide as its label needs, and they share what is left over: with
       "+ Add" there can be six, and at equal widths "Metronome" ran off the screen's edge. */
    .av-session-toolbar__btn {
      flex: 1 1 auto;
      min-width: 44px;
      min-height: 52px;
      padding: 6px 2px 4px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      border: 0;
      border-radius: 0;
      border-top: 3px solid transparent;
      background: transparent;
      color: var(--av-muted);
      /* Without !important the site's own button style sets the label at the page's 14px,
         and six labels that size don't fit a phone. */
      font-size: 12px !important;
      box-shadow: none !important;
    }

    .av-session-toolbar__btn > i {
      font-size: 1.1rem;
    }

    /* Icons only on narrow phones, and whenever there are seven buttons (a tune with
       materials and a video but no track, now the Drone is there): seven labels don't fit
       a phone at any readable size, and under 360px fewer don't either. Each label stays in
       its button, hidden from sight but not from a screen reader, so the button keeps its
       name. session.js marks a seven-button bar. */
    .av-session-toolbar--icons .av-session-toolbar__btn {
      padding-left: 1px;
      padding-right: 1px;
    }

    .av-session-toolbar--icons .av-session-toolbar__btn > i {
      font-size: 1.3rem;
    }

    .av-session-toolbar--icons .av-session-toolbar__btn > span {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      padding: 0;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    @media (max-width: 359.98px) {
      .av-session-toolbar__btn {
        padding-left: 1px;
        padding-right: 1px;
      }

      .av-session-toolbar__btn > i {
        font-size: 1.3rem;
      }

      .av-session-toolbar__btn > span {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }
    }

    .av-session-toolbar__btn[aria-pressed="true"] {
      color: var(--av-ghost-focus);
      border-top-color: var(--av-accent);
      font-weight: 700;
    }

    .av-session-toolbar__btn:focus-visible {
      outline: 3px solid var(--av-ghost-focus);
      outline-offset: -3px;
    }

    /* "+ Add" fills the screen with the Add to this tune card. Its buttons and its link
       box get a thumb's height here; in the sidebar they are small on purpose. */
    .av-session-stage .av-session-add__choices .btn,
    .av-session-stage .av-session-add__actions .btn,
    .av-session-stage .av-session-add__actions .av-btn-ghost,
    .av-session-stage .av-session-add__form .form-control {
      min-height: 44px;
    }

    /* Under 16px, iPhones zoom the whole page in when the box is tapped. */
    .av-session-stage .av-session-add__form .form-control {
      font-size: 16px !important;
    }

    /* Theory Map: the wide neck gives way to the upright one. */
    .av-session-stage [data-tool="theory"] [data-role="fretboard"],
    .av-session-stage [data-tool="theory"] [data-role="keyboard"],
    .av-session-stage [data-tool="theory"] [data-role="box-hint"],
    .av-session-stage [data-tool="theory"] [data-role="position-hint"] {
      display: none !important;
    }

    .av-session-theory-upright {
      display: block;
    }

    .av-session-metro__row {
      flex-wrap: wrap;
    }

    .av-session-stage .av-session-notes {
      min-height: 40vh;
    }

    .av-session-stage .av-session-materials iframe {
      height: 60vh !important;
    }

    @media (prefers-reduced-motion: reduce) {
      .av-session-strip__stop {
        animation: none;
      }
    }
  }

  /* Phones and narrow windows: one column, the stage first, then the tools. */
  @media (max-width: 991.98px) {
    .av-session-main,
    .av-session-main--panel-closed {
      grid-template-columns: minmax(0, 1fr);
    }

    .av-session-foot,
    .av-session-notices {
      padding: 0 24px 12px;
    }

    .av-session-stage {
      grid-template-columns: minmax(0, 1fr) !important;
      row-gap: 16px;
    }

    /* One column has no side for a panel to close to: the tools simply follow the stage. */
    .av-session-grip,
    .av-session-panel-strip,
    .av-session-panel-head {
      display: none !important;
    }

    .av-session-main--panel-closed .av-session-sidebar {
      display: flex;
    }

    .av-session-top {
      gap: 8px;
    }

    .av-session-top .btn {
      min-width: 0;
    }

    .av-session-seg__name {
      display: none;
    }
  }

  /* Practice Notes on a phone: the method sits above the notes, full width. */
  @media (max-width: 767.98px) {
    .av-session-notes__work {
      flex-direction: column;
      align-items: stretch;
    }

    .av-session-focus__plan {
      order: -1;
      flex: none;
    }

    .av-session-focus__menu-head {
      flex-wrap: wrap;
    }
  }

  /* The Metronome picks its narrow layout by the room it has, not by the window: a phone
     and one half of a split stage are both narrow. Half a split used to get the wide row
     whatever its width, so beside the Theory Map the tempo sat under the target button and
     the Mode switch ran past the card (3 Dec 2026). The card's body is the measured box
     wherever that can happen. Alone on a desktop stage the Metronome has its own layout
     (above), and in the Tools panel its compact one; neither is measured. */
  @media (max-width: 767.98px) {
    .av-session-stage > [data-tool="metronome"] .av-tool__body {
      container: av-metro / inline-size;
    }
  }

  @media (min-width: 992px) {
    .av-session-stage--split > [data-tool="metronome"] .av-tool__body {
      container: av-metro / inline-size;
    }
  }

  /* The narrow Metronome (a phone, or half a split under about 770px): the mode switch goes
     four across with short names; Start and the target share a row; the number is big with
     − and + beside it and "N% of target" under it; the band runs the full width between
     −5% and +5%; each setting is one row, label on the left. */
  @container av-metro (max-width: 767.98px) {
    /* Half a wide split: the same layout, kept to a phone's width in the middle of the card. */
    .av-session-stage--split .av-session-metro {
      max-width: 520px;
    }

    .av-session-metro .av-session-metro__long {
      display: none;
    }

    .av-session-metro .av-session-metro__short {
      display: inline;
    }

    .av-session-metro__mode {
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
    }

    .av-session-metro__modes {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      width: 100%;
    }

    .av-session-metro__modes > button {
      min-height: 44px;
      padding: 0 4px;
    }

    .av-session-metro__tempo-block {
      display: grid;
      grid-template-columns: 52px minmax(0, 1fr) auto 52px;
      grid-template-areas:
        "start start target target"
        "minus tempo tempo plus"
        "slower band band faster";
      align-items: center;
      gap: 12px 8px;
    }

    .av-session-metro__row,
    .av-session-metro__band-row {
      display: contents;
    }

    .av-session-metro .av-session-metro__start {
      grid-area: start;
      width: 100%;
      min-height: 48px;
      font-size: 16px !important;
    }

    .av-session-metro__target { grid-area: target; margin: 0; }
    .av-session-metro__target .btn { min-height: 48px; width: 100%; justify-content: center; }
    .av-session-metro #metronomeMinus { grid-area: minus; }
    .av-session-metro #metronomePlus { grid-area: plus; }
    .av-session-metro #avMetroSlower5 { grid-area: slower; width: 52px; padding: 0; }
    .av-session-metro #avMetroFaster5 { grid-area: faster; width: 52px; padding: 0; }

    .av-session-metro .av-metronome-icon-btn {
      width: 52px !important;
      height: 52px !important;
    }

    .av-session-metro__tempo {
      grid-area: tempo;
      align-items: center;
    }

    .av-session-metro__current .av-session-metro__label {
      display: none !important;
    }

    .av-session-metro__current strong {
      font-size: 40px;
      line-height: 1;
    }

    .av-session-stage .av-session-metro__pct,
    .av-session-metro__pct {
      display: block;
      font-size: 13px;
    }

    .av-session-band {
      --av-band-end: 32px;
      grid-area: band;
      height: 44px;
      margin-bottom: 14px;
    }

    .av-session-band__track { top: 13px; height: 16px; }
    .av-session-band__tick { top: 32px; }
    .av-session-band__target { top: 6px; height: 30px; }
    .av-session-band__label { top: 44px; font-size: 12px; }
    .av-session-band__knob { top: 7px; width: 28px; height: 28px; margin-left: -14px; }

    .av-session-metro__volume {
      align-self: stretch;
      min-height: 44px;
      font-size: 14px;
    }

    .av-session-metro__volume input {
      flex: 1 1 0;
      width: auto !important;
      min-width: 0;
    }

    .av-session-metro__fields {
      flex-direction: column;
      align-items: stretch;
      gap: 12px;
    }

    .av-session-metro__field {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .av-session-metro__panel .av-session-switch > button,
    .av-session-metro__panel .av-session-switch > output {
      min-height: 44px;
      min-width: 44px;
    }

    .av-session-metro__cells {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .av-session-metro__cell {
      width: 100%;
    }

    /* Instant Playback stacks under the Metronome. */
    .av-session-playback__body {
      flex-direction: column;
    }

    .av-session-playback__loop,
    .av-session-playback__settings {
      flex: none;
      width: 100%;
    }
  }

  /* Eight bar counts at a thumb's width need about 350px: with less they go four across,
     two rows, rather than the last ones being cut off (they were at 375px and under). */
  @container av-metro (max-width: 351.98px) {
    .av-session-metro #avPlaybackBars {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      align-self: stretch;
    }

    .av-session-metro #avPlaybackBars > button:nth-child(n + 5) {
      border-top: 1px solid rgba(15, 23, 42, 0.16) !important;
    }

    .av-session-metro #avPlaybackBars > button:nth-child(5) {
      border-left: 0 !important;
    }
  }

  /* The smallest phones (320 to 375px): Start and the target overlapped. "Target:" goes,
     the bullseye and the number say it, and Start may shrink to fit. A setting whose switch
     can't sit beside its label drops under it; Subdivision's was cut off at 320px. A 390px
     phone has 338px of room and keeps the word. */
  @container av-metro (max-width: 329.98px) {
    .av-session-metro .av-session-metro__start {
      min-width: 0;
    }

    .av-session-metro__target-set > .av-session-metro__label:first-child {
      display: none;
    }

    .av-session-metro__field {
      flex-wrap: wrap;
    }
  }

  /* At 320px the band is too short for its last two labels side by side ("100%" ran into
     "120%"): the fast end goes unlabelled; its » zone and ticks still show it. */
  @container av-metro (max-width: 299.98px) {
    .av-session-band__label--set[style="--f: 1"],
    .av-session-band__label--none[style="--f: 0.93"] {
      display: none;
    }
  }

  /* On a desktop the beats are clicked, however narrow the Metronome's half is. */
  @media (min-width: 992px) {
    .av-session-metro__beats .av-session-metro__long {
      display: inline;
    }

    .av-session-metro__beats .av-session-metro__short {
      display: none;
    }
  }
}

/* ---- The Drone (docs/product/drone-tool-decisions.md) ----
   In the Tools panel the whole card is one row: the title, the note, the volume and an
   icon-only Play, all in the header. On the stage the header row hides and the body has
   every control. While it sounds its wave drifts sideways, slowly, wherever it shows; a
   drone has no beat, so nothing pulses. */
@layer components {
  .av-tool__icon--drone svg,
  .av-session-panel-open--drone svg,
  .av-session-strip__wave {
    overflow: hidden;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
  }

  .av-tool__icon--drone svg {
    width: 18px;
    height: 18px;
  }

  @keyframes av-drone-drift-icon {
    from { transform: translateX(0); }
    to { transform: translateX(12px); }
  }

  @keyframes av-drone-drift {
    from { transform: translateX(0); }
    to { transform: translateX(24px); }
  }

  .av-tool--drone[data-playing="true"] .av-drone__drift-icon,
  .av-session-panel-open--drone .av-drone__drift-icon,
  .av-session-strip--drone .av-drone__drift-icon {
    animation: av-drone-drift-icon 3.2s linear infinite;
  }

  .av-tool--drone[data-playing="true"] .av-drone__drift {
    animation: av-drone-drift 3.2s linear infinite;
  }

  /* The controls row: only in the panel. The card is two rows there, the title and split
     on top and the note, volume and Play under them; in one row the volume squeezed the
     title down to its first letter. */
  .av-drone__small {
    display: none;
  }

  .av-session-sidebar .av-drone__small {
    order: 10;
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .av-session-sidebar .av-tool--drone .av-tool__head {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-bottom: 12px;
    border-bottom: 0;
  }

  .av-session-sidebar .av-tool--drone .av-tool__body {
    display: none;
  }

  .av-drone__select {
    min-height: 32px;
    padding: 2px 6px;
    border: 2px solid rgba(15, 23, 42, 0.22);
    border-radius: var(--av-btn-radius);
    background: #fff;
    color: var(--av-ink);
    font-size: 15px;
    font-weight: 700;
  }

  .av-drone__small-volume {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    accent-color: var(--av-accent);
  }

  .av-drone__small-play {
    width: 34px;
    height: 32px;
    padding: 0 !important;
    display: grid;
    place-items: center;
  }

  /* The whole tool, on the stage. */
  .av-drone {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .av-drone__row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
  }

  .av-drone__play {
    min-width: 104px;
  }

  .av-drone__pitch {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .av-drone__step {
    width: 40px;
    height: 40px;
    padding: 0 !important;
    display: grid;
    place-items: center;
  }

  /* A fixed width, so - and + never move when Play becomes Stop or the note changes. */
  .av-drone__readout {
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    white-space: nowrap;
  }

  .av-drone__readout strong {
    font-size: 34px;
  }

  .av-drone__readout span {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(34, 36, 52, 0.72);
  }

  .av-drone__wave {
    width: 64px;
    height: 26px;
    overflow: hidden;
    fill: none;
    stroke: rgba(15, 23, 42, 0.25);
    stroke-width: 2.5;
    stroke-linecap: round;
  }

  .av-drone__wave .av-drone__drift {
    display: none;
  }

  .av-tool--drone[data-playing="true"] .av-drone__wave {
    stroke: var(--av-accent);
  }

  .av-tool--drone[data-playing="true"] .av-drone__wave .av-drone__drift {
    display: inline;
  }

  .av-tool--drone[data-playing="true"] .av-drone__wave .av-drone__flat {
    display: none;
  }

  .av-drone__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }

  .av-drone__label {
    font-size: 14px;
    color: rgba(34, 36, 52, 0.72);
  }

  .av-drone__hint {
    font-size: 12px;
    color: rgba(34, 36, 52, 0.72);
  }

  .av-drone__notes {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 5px;
  }

  /* A ghost button each: no shadow, a tint on hover, the current note filled. */
  .av-drone__note {
    position: relative;
    min-height: 40px;
    padding: 0;
    border: 2px solid rgba(15, 23, 42, 0.2);
    border-radius: var(--av-btn-radius);
    background: #fff;
    color: var(--av-ink);
    font-size: 14px;
    box-shadow: none !important;
  }

  .av-drone__note:hover {
    background: #eaf5f5;
  }

  .av-drone__note:focus-visible {
    outline: 3px solid var(--av-ghost-focus);
    outline-offset: 2px;
  }

  .av-drone__note[aria-pressed="true"] {
    background: var(--av-nav);
    border-color: var(--av-nav);
    color: #fff;
  }

  /* The tune's key: a short underline. */
  .av-drone__note--key::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 14px;
    height: 3px;
    margin-left: -7px;
    border-radius: 2px;
    background: var(--av-accent);
  }

  .av-drone__settings {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 22px;
  }

  .av-drone__volume {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 0 auto;
    min-height: 34px;
    font-size: 13px;
    color: rgba(34, 36, 52, 0.72);
  }

  .av-drone__volume input {
    width: 140px;
    accent-color: var(--av-accent);
  }

  /* On a split the Drone gets a slim column: the notes go to two rows of six. */
  .av-session-stage--split .av-drone__notes {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  /* The closed panel's mark for a sounding drone. */
  .av-session-panel-open--drone {
    flex: none;
    min-height: 0;
    padding: 10px 0 !important;
    color: var(--av-tool-drone-ink);
  }

  .av-session-panel-open--drone svg {
    width: 22px;
    height: 13px;
  }

  .av-session-panel-open--drone b {
    font-size: 14px;
    font-weight: 700;
  }

  @media (max-width: 767.98px) {
    .av-drone__row {
      gap: 12px;
    }

    .av-drone__play {
      flex: 1 1 100%;
      min-height: 48px;
    }

    .av-drone__pitch {
      flex: 1 1 auto;
      justify-content: center;
    }

    .av-drone__step {
      width: 48px;
      height: 48px;
    }

    .av-drone__readout {
      width: 120px;
    }

    .av-drone__readout strong {
      font-size: 40px;
    }

    .av-drone__notes {
      grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .av-drone__note {
      min-height: 44px;
    }

    .av-drone__settings {
      flex-direction: column;
      align-items: stretch;
    }

    .av-drone__settings .av-session-switch {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .av-drone__settings .av-session-switch > button {
      min-height: 44px;
    }

    .av-drone__volume {
      margin: 0;
      min-height: 44px;
    }

    .av-drone__volume input {
      flex: 1 1 0;
      width: auto;
    }

    /* The drone's row in the now-playing strip: steady, not pulsing like the click. */
    .av-session-strip__stop--drone {
      animation: none !important;
    }

    .av-session-strip__wave {
      flex: none;
      width: 26px;
      height: 14px;
      color: #8ac3c6;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .av-drone__drift-icon,
    .av-drone__drift {
      animation: none !important;
    }
  }
}

/* ---- The Recorder (docs/product/recorder-tool-decisions.md) ----
   Record a practice take, listen back, keep it if you want it. In the Tools panel the card is
   the title, then Record with the time and the newest take, then the one line that says takes
   aren't kept. On the stage the header row hides and the body has the whole tool. While it
   records a steady red dot shows wherever the Recorder isn't in view: a hot mic is never hidden. */
@layer components {
  .av-recorder__mono {
    font-family: 'Roboto Mono', ui-monospace, monospace;
  }

  /* The red dot on Record; a square on Stop. */
  .av-recorder__dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #c73b30;
    vertical-align: -1px;
  }

  .av-recorder__toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 700 !important;
    white-space: nowrap;
  }

  .av-recorder__toggle--stop {
    background: var(--av-ink) !important;
    border-color: #141a26 !important;
    color: #f4f7fb !important;
  }

  .av-recorder__toggle--stop .av-recorder__dot {
    border-radius: 2px;
    background: #f4f7fb;
  }

  /* ---- In the Tools panel ---- */
  .av-recorder__small {
    display: none;
  }

  .av-session-sidebar .av-recorder__small {
    order: 10;
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }

  .av-session-sidebar .av-tool--recorder .av-tool__head {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-bottom: 12px;
    border-bottom: 0;
  }

  .av-session-sidebar .av-tool--recorder .av-tool__body {
    display: none;
  }

  .av-tool--recorder[data-recording="true"] .av-tool__sub {
    color: #a0332a;
  }

  .av-recorder__small-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .av-recorder__small-time {
    font-size: 16px;
    color: rgba(15, 23, 42, 0.68);
  }

  .av-tool--recorder[data-recording="true"] .av-recorder__small-time {
    color: var(--av-ink);
  }

  .av-recorder__latest {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding-left: 10px;
    border-left: 1px solid rgba(17, 24, 39, 0.1);
  }

  .av-recorder__latest[hidden] {
    display: none;
  }

  .av-recorder__latest-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .av-recorder__play {
    width: 34px;
    height: 32px;
    flex: none;
    padding: 0 !important;
    display: grid !important;
    place-items: center;
  }

  .av-recorder__small-note {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: #1f3148;
  }

  /* ---- On the stage ---- */
  .av-recorder {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .av-recorder__row {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
  }

  .av-recorder__row .av-recorder__toggle {
    min-width: 140px;
    justify-content: center;
    padding: 12px 22px !important;
    font-size: 17px;
  }

  .av-recorder__readout {
    display: flex;
    flex-direction: column;
    min-width: 110px;
  }

  .av-recorder__readout strong {
    font-size: 36px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--av-ink);
  }

  .av-recorder__status {
    font-size: 14px;
    color: rgba(15, 23, 42, 0.68);
  }

  .av-tool--recorder[data-recording="true"] .av-recorder__status {
    color: #a0332a;
    font-weight: 700;
  }

  /* The microphone's level right now: one slim bar, empty until a take is recording. A pill,
     because it's a reading, not something to click. */
  .av-recorder__meter {
    flex: 1 1 160px;
    align-self: center;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.1);
  }

  .av-recorder__meter > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--av-accent);
    transition: width 80ms linear;
  }

  .av-tool--recorder:not([data-recording="true"]) .av-recorder__meter > span {
    width: 0 !important;
  }

  .av-recorder__note {
    margin: 0;
    padding: 9px 12px;
    border-radius: 8px;
    background: #f2f7f8;
    color: #1f3148;
    font-size: 15px;
  }

  .av-recorder__problem {
    margin: 0;
    color: #a0332a;
    font-size: 14px;
  }

  .av-recorder__list-head {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  /* Bootstrap's h3 size is unlayered, so it beats this rule without !important. */
  .av-recorder__heading {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 700;
    color: #1f3148;
  }

  .av-recorder__count {
    flex: 1 1 auto;
    font-size: 14px;
    color: rgba(15, 23, 42, 0.68);
  }

  .av-recorder__takes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .av-recorder__take {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 8px 10px 10px;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 8px;
    background: #fff;
  }

  .av-recorder__take--open {
    border-color: rgba(23, 98, 105, 0.35);
    background: #f7fbfb;
  }

  .av-recorder__take-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  .av-recorder__take-row .av-recorder__play {
    width: 40px;
    height: 40px;
  }

  .av-recorder__take-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .av-recorder__take-text b {
    font-size: 16px;
  }

  .av-recorder__take-text .av-recorder__mono {
    font-weight: 400;
    font-size: 14px;
    color: rgba(15, 23, 42, 0.68);
  }

  .av-recorder__meta {
    font-size: 13px;
    color: rgba(15, 23, 42, 0.68);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .av-recorder__done,
  .av-recorder__saved {
    flex: none;
    font-size: 13px;
    color: #357a37;
    white-space: nowrap;
  }

  .av-recorder__saved {
    color: rgba(15, 23, 42, 0.68);
  }

  /* The open take: a waveform with a slider laid over it, so a click or a drag jumps there
     and the arrow keys step through. Without WaveSurfer a plain bar stands in. */
  .av-recorder__scrub {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 52px;
  }

  .av-recorder__wave {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 56px;
    display: flex;
    align-items: center;
    border-radius: 4px;
  }

  .av-recorder__wave:focus-within {
    outline: 3px solid var(--av-accent);
    outline-offset: 2px;
  }

  /* WaveSurfer's own layers carry z-indexes; z-index 0 here keeps them all under the
     see-through slider, which takes the clicks. */
  .av-recorder__wave > div:not(.av-recorder__progress) {
    position: relative;
    z-index: 0;
    flex: 1 1 auto;
    min-width: 0;
  }

  .av-recorder__progress {
    flex: 1 1 auto;
    height: 6px;
    border-radius: 999px;
    background: rgba(53, 171, 178, 0.18);
    overflow: hidden;
  }

  .av-recorder__progress > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: var(--av-accent);
  }

  .av-recorder__wave--drawn .av-recorder__progress {
    display: none;
  }

  /* The see-through slider covers the whole waveform, so a click anywhere on it seeks.
     !important: site-v5.css sets every range input to 25px tall, unlayered, which beats
     this layer and left most of the waveform unclickable. */
  .av-recorder__seek {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }

  .av-recorder__position {
    flex: none;
    font-size: 13px;
    color: rgba(15, 23, 42, 0.68);
  }

  .av-recorder__empty {
    margin: 0;
    padding: 18px;
    border: 2px dashed rgba(17, 24, 39, 0.12);
    border-radius: 8px;
    text-align: center;
    color: rgba(15, 23, 42, 0.68);
    font-size: 15px;
  }

  .av-recorder__empty[hidden] {
    display: none;
  }

  .av-recorder__settings {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding-top: 12px;
    border-top: 1px solid rgba(17, 24, 39, 0.1);
  }

  .av-recorder__setting {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    color: #1f3148;
    cursor: pointer;
  }

  .av-recorder__setting input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #176269;
  }

  /* A tool, or one mode of a tool, still in beta: a status label beside its name, not
     clickable, so a pill. The Recorder, the Tuner and Instant Playback. The hairline keeps
     its shape on a stage header's tint (the Tuner's blue is close to the pill's lilac). */
  .av-tool__beta {
    flex: none;
    padding: 1px 8px;
    border-radius: var(--av-pill-radius);
    background: #ece6f3;
    box-shadow: inset 0 0 0 1px rgba(91, 48, 130, 0.22);
    color: #5b3082;
    font-size: 12px;
    font-weight: 700;
  }

  /* ---- Wherever the Recorder isn't in view, while a take records ---- */
  .av-session-panel-open__rec {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #c73b30;
    flex: none;
  }

  .av-session-panel-open--recorder {
    flex: none;
    min-height: 0;
    padding: 10px 0 !important;
    gap: 5px;
    border-color: rgba(199, 59, 48, 0.45) !important;
    color: var(--av-ink);
  }

  .av-session-panel-open--recorder b {
    font-family: 'Roboto Mono', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 500;
  }

  /* ---- Finishing with takes not downloaded ---- */
  .av-recorder-leave__card {
    width: min(500px, 100%);
    align-items: stretch;
    text-align: left;
    gap: 14px;
  }

  .av-recorder-leave__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }

  /* !important for the same reason as the Takes heading: Bootstrap's h2 is unlayered. */
  .av-recorder-leave__title {
    flex: 1 1 auto;
    margin: 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--av-ink);
  }

  .av-recorder-leave__text {
    margin: 0;
    color: #1f3148;
  }

  .av-recorder-leave__takes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .av-recorder-leave__take {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 12px;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 8px;
  }

  .av-recorder-leave__take > span {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .av-recorder-leave__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
  }

  @media (max-width: 767.98px) {
    .av-recorder__row .av-recorder__toggle {
      flex: 1 1 100%;
      min-height: 48px;
    }

    .av-recorder__meter {
      flex-basis: 100%;
    }

    .av-recorder__scrub {
      padding-left: 0;
    }

    .av-recorder__take-row .av-btn-ghost--icon {
      min-width: 44px;
      min-height: 44px;
    }

    .av-recorder-leave__actions > .btn {
      flex: 1 1 100%;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .av-recorder__meter > span {
      transition: none;
    }
  }
}
