:root {
  --control-height: 44px;
  font-size: 118.75%;
  color-scheme: dark;
  --bg: #121614;
  --panel: #1b211d;
  --raised: #242d25;
  --hover: #2c3828;
  --line: #323b33;
  --text: #f1f1e9;
  --muted: #a1ada2;
  --accent: #cbec94;
  --accent-hover: #def5b7;
  --accent-ink: #172214;
  --accent-soft: #293623;
  --field: #151b17;
  --song-text: #e0e7da;
  --danger: #f2a69b;
  --danger-soft: #3e2929;
  --shadow: 0 16px 48px rgb(0 0 0 / .35);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f5f6ef;
  --panel: #ffffff;
  --raised: #ffffff;
  --hover: #e9efdf;
  --line: #d1d9c9;
  --text: #202b20;
  --muted: #586653;
  --accent: #416522;
  --accent-hover: #305019;
  --accent-ink: #ffffff;
  --accent-soft: #e6efd9;
  --field: #fafbf7;
  --song-text: #263129;
  --danger: #a33228;
  --danger-soft: #fce9e6;
  --shadow: 0 16px 48px rgb(25 40 20 / .12);
}
* { box-sizing: border-box; }
/* Narrow mobile screens can scale the minimum layout without forced 1:1 zoom. */
html, body { min-width: 400px; }
body { margin: 0; line-height: 1.6; background: var(--bg); }
a { color: var(--accent); text-underline-offset: .22em; }
a:hover { color: var(--accent-hover); }
button, input, textarea, select, summary, a { -webkit-tap-highlight-color: transparent; }
:where(a, button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.muted, .song-meta { color: var(--muted); }
.site-header { border-bottom: 1px solid var(--line); }
.main-nav { max-width: 1060px; margin: auto; display: flex; gap: 1.6rem; align-items: center; padding: 1rem 2rem; }
.brand-lockup { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; margin-right: auto; }
.brand { color: var(--text); font-size: 1.8rem; font-weight: 850; letter-spacing: -.08em; line-height: 1; text-decoration: none; }
.brand:hover { color: var(--text); }
.brand span { color: var(--accent); }
.tagline { color: var(--muted); font-size: .6rem; line-height: 1; letter-spacing: .02em; white-space: nowrap; }
.menu-divider { height: 1px; background: var(--line); margin: .5rem .15rem; }
.menu-account { margin: .5rem .7rem; color: var(--muted); font-size: .77rem; overflow-wrap: anywhere; }
main { max-width: 1000px; margin: 3.5rem auto 1rem; padding: 0 2rem 1rem; min-height: 70vh; }
main:has(> .library), main:has(> .reader), main:has(> .editor) { margin-top: 1rem; }
main:has(> .reader) { margin-bottom: 0; padding-bottom: 0; min-height: 0; }
main:focus { outline: none; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 750; line-height: 1.12; margin: 0 0 1.4rem; letter-spacing: -.055em; overflow-wrap: anywhere; }
h2 { font-size: 1.22rem; font-weight: 650; line-height: 1.4; margin: 0 0 .6rem; letter-spacing: -.02em; }
h3 { font-size: 1.08rem; font-weight: 650; line-height: 1.4; margin: 0 0 .35rem; letter-spacing: -.025em; }
p { margin: .6rem 0; }

/* Newz control dimensions and typography, with Jamz colors. */
label { display: block; font-size: .9rem; font-weight: 550; margin-top: 1rem; }
input, select, textarea, button, .button { font: inherit; border: 1px solid var(--line); border-radius: .5rem; padding: .65rem .85rem; }
input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=range]), select:not([multiple]), button, .button { height: var(--control-height); padding-block: 0; line-height: normal; }
input[type=text], input[type=search], input[type=number], input[type=email], input[type=password], select, textarea { display: block; width: 100%; max-width: 600px; min-width: 0; background-color: var(--field); color: var(--text); font-size: .9rem; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input[type=submit], button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; margin: .8rem 0; background: var(--accent); color: var(--accent-ink); font-size: .85rem; font-weight: 600; cursor: pointer; text-decoration: none; border-color: transparent; white-space: nowrap; }
input[type=submit]:hover, button:hover, .button:hover { background: var(--accent-hover); color: var(--accent-ink); }
.quiet, .secondary, .insert-tools button { background: var(--raised); color: var(--muted); border-color: var(--line); }
.quiet:hover, .secondary:hover, .insert-tools button:hover { background: var(--hover); color: var(--text); }
button:disabled, input[type=submit]:disabled { cursor: wait; opacity: .7; }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex-shrink: 0; }
input[type=range] { accent-color: var(--accent); height: var(--control-height); border: 0; padding: 0; margin: 0; cursor: pointer; }
.check { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-weight: 400; }
.check input { margin: 0; }
.danger { background: var(--raised); color: var(--danger); border-color: var(--line); }
.danger:hover { background: var(--danger-soft); color: var(--danger); }
.flash, .errors { padding: .85rem 1rem; border: 1px solid var(--accent); border-radius: .6rem; background: var(--accent-soft); color: var(--text); font-size: .9rem; }
.errors { background: var(--danger-soft); border-color: var(--danger); margin: 1rem 0; }
.field_with_errors { display: contents; }
.field_with_errors :is(input, textarea, select) { border-color: var(--danger); }
.card { padding: 1.5rem; margin: 1rem 0; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); overflow-wrap: anywhere; }
.auth { max-width: 600px; margin-inline: auto; }
.meta { color: var(--muted); font-size: .77rem; }

.library-tools { padding-bottom: 1rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.song-search-row { display: flex; align-items: stretch; gap: .5rem; height: var(--control-height); }
.song-search { flex: 1; min-width: 0; }
.song-search input { max-width: none; height: 100%; }
.song-search-row input[type=submit] { flex-shrink: 0; height: 100%; margin: 0; }
.library-filters { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; }
.library-filters .button { margin: 0; flex-shrink: 0; }
/* One dropdown foundation for navigation, artist filtering and reader settings. */
.dropdown { position: relative; min-width: 0; max-width: 100%; }
.dropdown-trigger { display: flex; align-items: center; justify-content: space-between; gap: .65rem; height: var(--control-height); padding: 0 .85rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--panel); color: var(--muted); font-size: .85rem; font-weight: 550; cursor: pointer; list-style: none; user-select: none; }
.dropdown-trigger::-webkit-details-marker { display: none; }
.dropdown--compact .dropdown-trigger { gap: .25rem; padding-inline: .5rem; }
.dropdown--compact .dropdown-trigger > span:first-child { flex: 1; text-align: center; }
.dropdown-trigger > span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dropdown-trigger:hover, .dropdown[open] > .dropdown-trigger { background: var(--hover); color: var(--text); }
.dropdown-chevron { display: block; flex-shrink: 0; width: 1rem; height: 1rem; color: var(--text); }
.dropdown[open] > summary .dropdown-chevron { transform: rotate(180deg); }
.dropdown-panel { position: absolute; top: calc(100% + .5rem); left: 0; z-index: 20; width: 100%; max-height: min(20rem, 50dvh); overflow-y: auto; overscroll-behavior: contain; padding: .6rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--raised); box-shadow: var(--shadow); }
.dropdown-panel .dropdown-item { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: var(--control-height); height: auto; margin: 0; padding: .4rem .7rem; border: 0; border-radius: .45rem; background: transparent; color: var(--text); font-size: .9rem; font-weight: 400; line-height: 1.4; text-align: left; text-decoration: none; white-space: normal; overflow-wrap: anywhere; }
.dropdown-panel .dropdown-item:hover, .dropdown-panel .dropdown-item:focus-visible { background: var(--hover); color: var(--text); }
.dropdown-panel .dropdown-item[aria-current=true], .dropdown-panel .dropdown-item[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.dropdown-panel .appearance-toggle { justify-content: space-between; gap: 1rem; height: var(--control-height); padding-block: 0; }
.theme-value { padding: .1rem .5rem; color: var(--accent); background: var(--accent-soft); border-radius: .35rem; font-size: .75rem; }
.dropdown-panel .menu-sign-out { color: var(--danger); }
.dropdown-panel .menu-sign-out:hover { background: var(--danger-soft); color: var(--danger); }
.dropdown-panel--right { left: auto; right: 0; width: 240px; max-width: calc(100vw - 2.5rem); }
.dropdown--up > .dropdown-panel { top: auto; bottom: calc(100% + .5rem); left: 0; right: auto; min-width: 170px; }
.artist-filter { width: 320px; }
.text-size { width: 150px; }
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.page-size { width: 64px; flex-shrink: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: .65rem; margin: 0; color: var(--muted); font-size: .7rem; white-space: nowrap; }
.pagination a { display: grid; place-items: center; width: var(--control-height); height: var(--control-height); border: 1px solid var(--line); border-radius: .5rem; color: var(--text); text-decoration: none; font-size: 0; }
.pagination a::before { font-size: 1rem; }
.pagination-previous::before { content: "←"; }
.pagination-next::before { content: "→"; }
.pagination a:hover { background: var(--hover); }
.library-count { margin: 0 0 1rem; }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: .65rem; color: var(--muted); font-size: .77rem; margin: 1.25rem 0 .85rem; }
.section-label label { margin: 0; color: var(--text); }
.song-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.song-card { display: flex; gap: .65rem; align-items: center; padding: .65rem .85rem; background: var(--panel); border: 1px solid var(--line); border-radius: .6rem; min-width: 0; color: var(--text); text-decoration: none; }
.song-card:hover { border-color: var(--accent); color: var(--text); }
.song-card > div { min-width: 0; overflow-wrap: anywhere; }
.song-card h3 { margin: 0 0 .1rem; }
.song-card p { color: var(--muted); margin: 0; font-size: .85rem; line-height: 1.4; }
.song-icon { flex-shrink: 0; font-size: 1.2rem; color: var(--accent); background: var(--accent-soft); border-radius: .5rem; padding: .35rem .5rem; }
.song-meta { font-size: .77rem; }
.empty { padding: 3.5rem 1.5rem; text-align: center; border: 1px dashed var(--line); border-radius: 1rem; margin: 2rem 0; }
.empty p { color: var(--muted); max-width: 34rem; margin: .65rem auto 1rem; }

.reader { --transport-bottom: max(1rem, env(safe-area-inset-bottom)); max-width: 900px; margin: auto; padding-bottom: calc(var(--transport-height, 140px) + var(--transport-bottom) + .75rem); }
.page-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.page-heading h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); margin: 0; }
.page-heading .button { margin: 0; }
.page-heading--compact { gap: .75rem; margin-bottom: .35rem; }
.page-heading--compact .button { align-self: start; }
.song-header { padding-bottom: .75rem; margin-bottom: .75rem; border-bottom: 1px solid var(--line); }
.song-updates { margin-top: 1rem; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.song-updates p { margin: 0; }
.song-identity { min-width: 0; }
.song-artist { margin: .1rem 0 0; color: var(--muted); font-size: .77rem; font-weight: 400; line-height: 1.3; }
.song-details { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .35rem; margin: 0; color: var(--muted); font-size: .77rem; line-height: 1.4; }
.metadata-dot { font-size: 1rem; line-height: 1; }
.sheet-viewport { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.song-sheet { font: 16px/1.85 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; white-space: pre; tab-size: 4; margin: 1.9rem 0; color: var(--song-text); padding-bottom: .8rem; }
.reader .song-sheet { margin: 0; -webkit-text-size-adjust: none; text-size-adjust: none; }
.transport { position: fixed; bottom: var(--transport-bottom); left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 1rem; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: .85rem; padding: .65rem .85rem; max-width: calc(100% - 2rem); width: max-content; }
.transport button { margin: 0; }
.transport label { display: flex; gap: .5rem; align-items: center; font-size: .78rem; color: var(--muted); margin: 0; font-weight: 400; min-width: 0; }
.transport input { width: 75px; min-width: 0; }
.transport output { width: 55px; font-size: .7rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.metadata { display: grid; grid-template-columns: 2fr 2fr .65fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.metadata label { margin: 0; min-width: 0; }
.metadata input { margin-top: .35rem; }
.editor-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.editor-columns > div { min-width: 0; }
.insert-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .65rem; }
.insert-tools button { margin: 0; }
.editor textarea { font: 14px/1.85 ui-monospace, SFMono-Regular, Consolas, monospace; max-width: none; min-height: max(640px, 70dvh); resize: vertical; tab-size: 4; }
.preview { border-left: 1px solid var(--line); padding-left: 1.5rem; }
.preview .song-sheet { font-size: 14px; min-height: 520px; margin-top: 4rem; }
.editor-footer { position: sticky; bottom: max(.65rem, env(safe-area-inset-bottom)); z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.25rem 0; padding: .65rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--raised); box-shadow: var(--shadow); }
.editor-footer span { font-size: .77rem; }
.editor-footer input[type=submit] { margin: 0; }
.sr-only, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: fixed; top: 1rem; left: 1rem; width: auto; height: auto; clip-path: none; padding: .7rem 1rem; background: var(--panel); border: 1px solid var(--accent); border-radius: .5rem; z-index: 100; }

@media (max-width: 900px) {
  .transport { display: grid; grid-template-columns: 1fr 1fr; width: max-content; gap: .65rem; }
  .transport label { justify-content: center; }
}
@media (max-width: 700px) {
  .main-nav { padding: 1rem 1.25rem; gap: 1rem; }
  main { padding: 0 1.1rem 1rem; margin-top: 2.25rem; }
  .artist-filter { flex: 1; width: auto; }
  .song-grid { grid-template-columns: 1fr; }
  .card { padding: 1.15rem; }
  .reader { --transport-bottom: max(.65rem, env(safe-area-inset-bottom)); }
  .transport { width: calc(100% - 1.3rem); max-width: none; gap: .5rem; padding: .65rem; }
  .transport button { padding-inline: .5rem; }
  .transport label { flex-wrap: wrap; gap: .25rem; font-size: .7rem; }
  .transport input { width: 60px; }
  .transport output { width: auto; }
  .text-size { width: 100%; }
  .metadata { grid-template-columns: 1fr 1fr; gap: .85rem; }
  .metadata label:first-child, .metadata label:nth-child(2) { grid-column: 1 / -1; }
  .editor-columns { grid-template-columns: 1fr; }
  .preview { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .preview .song-sheet { min-height: 100px; margin-top: 1rem; }
  .section-label { font-size: .7rem; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
