/* Tunebag app. Layout: bottom tab bar on phones, left rail on tablets; Library shows list + tune side by side when wide.
   Palette and type match the claude.ai phone page (app/my-tunes.html). */
:root {
  --bg: #f3f5f1; --surface: #ffffff; --surface-2: #eef2ee; --fg: #17201b; --muted: #5a6860; --line: #d7dfd8;
  --accent: #23664a; --accent-ink: #ffffff; --accent-soft: #e2efe7;
  --paper: #fbfaf5; --ink: #1b1d1a; --warn: #9a5a0c; --warn-soft: #fbf0dc; --danger: #a3423a;
  --st-known: #23664a; --st-polishing: #a0650f; --st-learning: #2d5c9c; --st-wishlist: #6a5a94;
  --st-dormant: #7a817c; --st-overplayed: #a3423a; --st-unknown: #7a817c;
  --font-display: "Alegreya", Georgia, "Times New Roman", serif;
  --font-ui: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101612; --surface: #18201b; --surface-2: #1d2621; --fg: #e5ebe6; --muted: #9baaa1; --line: #2b3630;
    --accent: #6cbf95; --accent-ink: #0b1610; --accent-soft: #1f3329;
    --paper: #ecebe3; --ink: #1b1d1a; --warn: #e0a54a; --warn-soft: #33281a; --danger: #e48a80;
    --st-known: #6cbf95; --st-polishing: #e0a54a; --st-learning: #7fa8e3; --st-wishlist: #b4a3e0;
    --st-dormant: #9aa29d; --st-overplayed: #e48a80; --st-unknown: #9aa29d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
html { scrollbar-gutter: stable; }   /* pages with and without a scrollbar line up */
body { font-family: var(--font-ui); font-size: 16px; line-height: 1.45; padding-top: env(safe-area-inset-top, 0px); -webkit-tap-highlight-color: transparent; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h1 { font-size: 1.7rem; line-height: 1.15; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; }

/* shell */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 8px; height: 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; white-space: nowrap; }
.sync { min-width: 0; }
#sync-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; display: block; }
.spacer { flex: 1; }
.sync { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: .85rem; display: inline-flex; align-items: center; gap: 7px; color: var(--fg); text-decoration: none; white-space: nowrap; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-known); flex: 0 0 auto; }
.sync.waiting .dot { background: var(--warn); }
.updbtn { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 5px 12px 5px 9px; font-size: .85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.updbtn svg { width: 16px; height: 16px; }
.updbtn:disabled { opacity: .7; }

.main { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); min-width: 0; }
.page { max-width: 760px; margin: 0 auto; padding-block: 16px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 18px; }
.page > * { min-width: 0; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tab { border: 0; background: none; display: grid; justify-items: center; gap: 2px; padding: 8px 4px 9px; font-size: .8rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); font-weight: 700; }
.tab[aria-current="page"] .ico { background: var(--accent-soft); }
.tab .ico { border-radius: 999px; padding: 3px 12px; display: grid; }
/* the rail on the left from 900px, and on phones held sideways, where a bottom bar would eat a fifth of the height */
@media (min-width: 900px), (orientation: landscape) and (max-height: 500px) and (min-width: 560px) {
  .app { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
  .tabs { position: sticky; top: calc(49px + env(safe-area-inset-top, 0px)); bottom: auto; align-self: start; height: calc(100vh - 49px - env(safe-area-inset-top, 0px)); grid-template-columns: none; grid-auto-rows: max-content; align-content: start; gap: 6px; padding-top: 16px; border-top: 0; border-right: 1px solid var(--line); background: var(--bg); }
  .main { padding-bottom: 24px; }
}

/* common bits */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 8px 14px; font-weight: 700; display: inline-flex; gap: 7px; align-items: center; text-decoration: none; color: var(--fg); }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: none; }
.btn.ghost { background: none; }
.btn.sm { padding: 5px 10px; font-size: .9rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; min-width: 0; }
.card.soft { background: var(--accent-soft); border-color: transparent; }
.card.warn { background: var(--warn-soft); border-color: transparent; }
.sec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-head > h1, .sec-head > h2, .sec-head > h3 { flex: 1; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; white-space: nowrap; color: var(--c, var(--muted)); }
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); }
.pill.unknown::before { background: none; border: 1.5px dashed var(--c); width: 7px; height: 7px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
@media (hover: hover) and (pointer: fine) { .chips { flex-wrap: wrap; overflow: visible; } }   /* a mouse can't swipe a row sideways */
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: .9rem; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .n { opacity: .65; margin-left: 4px; font-variant-numeric: tabular-nums; }
.search { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 10px 12px; }
.list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; color: var(--fg); text-decoration: none; }
.item:first-child { border-top: 0; }
a.item:hover, button.item:hover { background: var(--surface-2); }
.item[aria-current="true"] { background: var(--accent-soft); }
.item .t { font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.item .s { color: var(--muted); font-size: .88rem; grid-column: 1; }
.item .r { grid-row: 1 / span 2; grid-column: 2; display: grid; justify-items: end; gap: 2px; }
.back { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 10px 12px 10px 0; margin: -10px 0;   /* a bigger tap area, same spot */ display: inline-flex; gap: 4px; align-items: center; text-decoration: none; justify-self: start; }
.back svg { width: 18px; height: 18px; }
.empty { color: var(--muted); padding: 18px; text-align: center; }
.linkish { color: inherit; text-decoration: none; border: 0; background: none; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; padding: 0; flex: 0 0 auto; color: var(--fg); }
.iconbtn.plain { border: 0; background: none; }
.iconbtn svg { width: 20px; height: 20px; }
.tag { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-2); border-radius: 6px; padding: 2px 7px; color: var(--muted); white-space: nowrap; }
.tag.on { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* library */
.lib { display: grid; gap: 14px; }
.lib-list { display: grid; gap: 12px; min-width: 0; }
.filters { display: grid; gap: 8px; }
@media (min-width: 1100px) {
  /* the overview: tunes in rows of two or three, with grid lines between them */
  .lib-over #tlist { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .lib-over #tlist .item { border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin: -1px 0 0 -1px; width: calc(100% + 1px); }
  .lib-wide { max-width: none; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); align-items: start; gap: 22px; }
  /* the heading and filters stay put; only the tune list scrolls, so its scrollbar never covers them */
  .lib-wide .lib-list { position: sticky; top: calc(65px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 81px - env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; overflow: hidden; }
  .lib-wide #tlist { flex: 0 1 auto; min-height: 0; overflow-y: auto; align-content: start; }
}
/* a tune opened from Sessions or Practice: that page stays on the left, in one column */
@media (min-width: 1100px) {
  .ctx-split { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); }
  .side { position: sticky; top: calc(65px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 81px - env(safe-area-inset-top, 0px)); overflow-y: auto; scrollbar-gutter: stable; padding-right: 6px; }
  .side > .page { padding: 0; max-width: none; }
  .side .cols { grid-template-columns: minmax(0, 1fr); }
  .side .cols.sess > .col:first-child { order: 0; }
  .side .tools { grid-template-columns: minmax(0, 1fr); }
  .side [aria-current="true"] { background: var(--accent-soft); }
}
/* wide pages: two columns from 1100px, one column below */
.page.wide { max-width: 1240px; }
.cols, .col { display: grid; gap: 18px; align-content: start; min-width: 0; }
@media (min-width: 1100px) {
  .cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .cols.sess > .col:first-child { order: 2; }
}

/* tune */
.tune-head { display: grid; gap: 6px; }
.meta { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: .88rem; display: inline-flex; gap: 6px; align-items: center; }
.seg button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.seg button[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); font-weight: 700; }
.keybtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 10px; font-size: .92rem; color: var(--fg); display: inline-flex; gap: 5px; align-items: center; }
.keybtn svg { width: 14px; height: 14px; opacity: .6; }
.keybtn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.seg2 { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg2 button { border: 0; background: var(--surface); padding: 8px 10px; display: grid; gap: 1px; text-align: center; }
.seg2 button + button { border-left: 1px solid var(--line); }
.seg2 button span { font-size: .8rem; color: var(--muted); }
.seg2 button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.hint.warn { background: var(--warn-soft); color: var(--fg); }
.paper { background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 12px 10px 4px; border: 1px solid var(--line); overflow-x: auto; }
.paper svg .abcjs-bar { stroke-width: 1.6px; }
.paper pre { margin: 0; white-space: pre-wrap; font-size: .9rem; }
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subtabs button { border: 0; background: none; padding: 8px 12px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.subtabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.version { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.version:first-child { border-top: 0; }
.version > div { min-width: 0; }
.notes-text { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea { width: 100%; min-height: 6em; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 9px 11px; resize: vertical; }
textarea.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 15px; line-height: 1.5; min-height: 14em; }
.thumb { max-width: 100%; max-height: 300px; border-radius: 8px; border: 1px solid var(--line); justify-self: start; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs img { height: 110px; width: auto; border-radius: 6px; border: 1px solid var(--line); }
audio { width: 100%; height: 40px; }
.clip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); }
.clip:first-child { border-top: 0; }
.clip .cap { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); }
.playbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.playbar input[type=range] { flex: 1; min-width: 120px; }

/* forms */
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.field input, .field select { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 9px 11px; width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two.key { grid-template-columns: 1fr 110px; }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 15; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 320px; overflow-y: auto; }
.ac-list button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 8px 12px; }
.ac-list button:hover, .ac-list button.hi { background: var(--surface-2); }
.ac-group { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 12px 2px; }
.hint { font-size: .9rem; background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; }
.keys button { min-width: 42px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 8px; font-weight: 700; }
.keys button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.recbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 16px 8px 12px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.recbtn i { width: 14px; height: 14px; border-radius: 50%; background: var(--st-overplayed); }
.recbtn.on { background: var(--st-overplayed); color: #fff; border-color: var(--st-overplayed); }
.recbtn.on i { background: #fff; border-radius: 3px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--warn-soft); border-radius: 8px; padding: 8px 12px; }

/* sessions */
.sess-card { display: grid; gap: 4px; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--fg); text-decoration: none; }
.sess-card:hover { background: var(--surface-2); }
.sess-date { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.stat-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.set { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.set-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--surface-2); flex-wrap: wrap; }
.set-head h3 { flex: 1 0 auto; font-size: 1rem; font-family: var(--font-ui); font-weight: 700; letter-spacing: .02em; }
.set-tune { display: grid; grid-template-columns: 1.6em minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); }
.set-tune .i { color: var(--muted); font-variant-numeric: tabular-nums; }
.set-tune .t { font-family: var(--font-display); font-size: 1.08rem; min-width: 0; overflow-wrap: anywhere; }
.set-tune .t a { color: inherit; text-decoration: none; }
.set-tune .t a:hover { text-decoration: underline; }
.set-tune .k { color: var(--muted); font-size: .9rem; margin-left: 4px; font-family: var(--font-ui); }
.set-tune .x { grid-column: 2 / span 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.draft { display: grid; gap: 6px; }
.set-editing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.draft-t { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.draft-t span:first-child { flex: 1; min-width: 0; }

/* practice */
.plan-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 14px 8px 8px; border-top: 1px solid var(--line); cursor: pointer; }
.plan-item:first-child { border-top: 0; }
.plan-item:hover { background: var(--surface-2); }
.plan-item .tick { grid-row: 1 / span 2; }
.plan-item.done .t b { text-decoration: line-through; color: var(--muted); }
.plan-item .t b { font-family: var(--font-display); font-size: 1.08rem; font-weight: 500; }
.plan-item .why { grid-column: 2 / span 2; color: var(--muted); font-size: .85rem; }
.tick { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; padding: 0; color: transparent; }
.tick svg { width: 28px; height: 28px; padding: 3px; border: 2px solid var(--muted); border-radius: 8px; box-sizing: border-box; }
.tick[aria-pressed="true"] { color: var(--accent-ink); }
.tick[aria-pressed="true"] svg { background: var(--accent); border-color: var(--accent); }
.btn.practiced[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.practiced[aria-pressed="false"] svg { opacity: .35; }
.tools { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.big-num { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.beats { display: flex; gap: 6px; align-items: center; }
.beats i { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.beats i.on { background: var(--accent); border-color: var(--accent); }
.beats i.acc { width: 18px; height: 18px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 320px; }
.cal i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); max-width: 100%; }
.cal i.l1 { background: color-mix(in srgb, var(--accent) 35%, var(--surface-2)); }
.cal i.l2 { background: color-mix(in srgb, var(--accent) 65%, var(--surface-2)); }
.cal i.l3 { background: var(--accent); }
.cal i.today { outline: 2px solid var(--fg); outline-offset: -2px; }
.cal b { font-size: .7rem; color: var(--muted); text-align: center; font-weight: 500; }
.timer { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* books */
.books { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.book { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 0; overflow: hidden; text-align: left; display: grid; color: var(--fg); text-decoration: none; }
.cover { aspect-ratio: 3 / 4; max-width: 100%; display: grid; align-content: end; padding: 12px; color: #f7f4ea; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.15; background: var(--cv); overflow-wrap: anywhere; }
.cover small { display: block; font-family: var(--font-ui); font-weight: 500; font-size: .8rem; opacity: .85; margin-top: 4px; }
.book .info { padding: 8px 12px 10px; font-size: .88rem; color: var(--muted); }
.pages { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.pg { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); }
.pg img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; border-radius: 6px; border: 1px solid var(--line); }

/* full screen */

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 50; background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: .92rem; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: calc(100% - 40px); }
@media (min-width: 900px), (orientation: landscape) and (max-height: 500px) and (min-width: 560px) { .toast { bottom: 28px; } }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
@media (max-width: 360px) { .set-head .lbl { display: none; } }   /* the set's buttons stay on the title's line */
@media (prefers-reduced-motion: reduce) { .recbtn.on i { animation: none; } }
.tempos { display: grid; gap: 6px; }
.tempo-row { display: grid; grid-template-columns: 6.5em minmax(0, 1fr) 5em; gap: 10px; align-items: center; font-size: .92rem; }
.tempo-row .num { text-align: right; }
/* sheet music full screen */
.paper-wrap { position: relative; }
.sheet-fs { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border-radius: 10px; border: 1px solid #d7dfd8; background: rgba(255,255,255,.85); color: #1b1d1a; display: grid; place-items: center; padding: 0; }
.sheet-fs svg { width: 22px; height: 22px; }
.fsx { position: fixed; inset: 0; z-index: 40; background: #fbfaf5; color: #1b1d1a; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); overflow: hidden; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#fs-sheet { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; min-width: 0; min-height: 0; }
.fsx-btn { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(27,29,26,.08); color: #1b1d1a; display: grid; place-items: center; padding: 0; opacity: .55; }
.fsx-btn:hover, .fsx-btn:focus-visible { opacity: 1; }
.fsx-btn svg { width: 20px; height: 20px; }
.fsx-close { top: calc(6px + env(safe-area-inset-top, 0px)); right: calc(6px + env(safe-area-inset-right, 0px)); }
.fsx-prev { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); left: calc(6px + env(safe-area-inset-left, 0px)); }
.fsx-next { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); right: calc(6px + env(safe-area-inset-right, 0px)); }
.fsx-next svg { transform: scaleX(-1); }
html.fs-open, html.fs-open body { overflow: hidden; }
html.fs-open { scrollbar-gutter: auto; }
.fsx-hint { display: none; position: absolute; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: .85rem; color: #5a6860; pointer-events: none; }
@media (orientation: portrait) and (max-width: 700px) { .fsx-hint { display: block; } }
.fsx-btn { transition: opacity .3s; }
.fsx.idle .fsx-btn { opacity: 0; pointer-events: none; }
.fsx.idle .fsx-hint { opacity: 0; transition: opacity .3s; }
.page.auth { max-width: 440px; }
.page.auth form .linkish { justify-self: start; }

/* friends (docs/friends.md) */
.who { justify-self: start; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: var(--radius); padding: 8px 11px; font-weight: 700; min-height: 40px; max-width: 100%; }
.btn.accent { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.friends-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: .88rem; color: var(--fg); text-decoration: none; background: var(--surface); }
.fchip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.fchip:hover { background: var(--surface-2); }
.owner-badge { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 2px 8px; background: var(--st-learning); color: var(--bg); white-space: nowrap; }
.mine-tag { color: var(--accent); font-weight: 700; }
.card.rec.done { opacity: .7; }
.vbadge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 1px 7px; margin-left: 4px; vertical-align: 2px; white-space: nowrap; }
.vbadge.mine { background: var(--accent); color: var(--accent-ink); }
.vbadge.friend { background: var(--st-learning); color: var(--bg); }
/* sheet viewer: mine and friends' versions */
.paper-wrap { position: relative; }
.sv-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sv-chip { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 5px 12px; font-size: .88rem; font-weight: 700; min-height: 34px; }
.sv-chip.mine[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sv-chip.friend[aria-pressed="true"] { background: var(--st-learning); border-color: var(--st-learning); color: var(--bg); }
.sv-edge { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 64px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--fg); border-radius: 10px; display: grid; place-items: center; z-index: 2; }
.sv-edge svg { width: 20px; height: 20px; }
.sv-edge.prev { left: -6px; }
.sv-edge.next { right: -6px; }
.sv-edge.next svg { transform: rotate(180deg); }
.sv-edge:disabled { opacity: 0; pointer-events: none; }
/* discussion */
.disc-list { display: grid; gap: 10px; }
.comment { display: grid; gap: 4px; border-left: 3px solid var(--line); padding: 2px 0 2px 10px; }
.comment.mine { border-left-color: var(--accent); }
.c-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.c-acts { display: flex; gap: 14px; }
.disc textarea, .comment textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: var(--radius); padding: 8px 10px; font: inherit; }
#settings-disc { scroll-margin-top: calc(70px + env(safe-area-inset-top, 0px)); }
