/* Zazpivaj Beta — Analog vocabulary, shared by every village and route.
   Loaded after the legacy sheet and server tokens. No external font requests. */
:root,
body {
    color-scheme: dark;
    --beta-bg: #060606;
    --beta-surface: #151515;
    --beta-raised: #202020;
    --beta-text: #e5e3df;
    --beta-muted: #a3a3a3;
    --beta-accent: #a4c6af;
    --beta-on-accent: #102017;
    --beta-line: #303030;
    --beta-selection: #24342a;
    --sans: Georgia, 'Times New Roman', serif;
    --mono: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    --gutter: 18px;
    --bg-main: var(--beta-bg);
    --surface: var(--beta-surface);
    --surface-soft: var(--beta-raised);
    --text-main: var(--beta-text);
    --text-muted: var(--beta-muted);
    --accent-primary: var(--beta-accent);
    --accent-secondary: var(--beta-accent);
    --border: var(--beta-line);
    --danger: #d8a89e;
    --card-shadow: none;
    --focus-ring: 0 0 0 2px var(--beta-accent);
    --md-sys-color-primary: var(--beta-accent);
    --md-sys-color-on-primary: var(--beta-on-accent);
    --md-sys-color-primary-container: var(--beta-selection);
    --md-sys-color-on-primary-container: var(--beta-text);
    --md-sys-color-secondary: var(--beta-accent);
    --md-sys-color-on-secondary: var(--beta-on-accent);
    --md-sys-color-secondary-container: var(--beta-selection);
    --md-sys-color-on-secondary-container: var(--beta-text);
    --md-sys-color-tertiary: var(--beta-accent);
    --md-sys-color-on-tertiary: var(--beta-on-accent);
    --md-sys-color-tertiary-container: var(--beta-selection);
    --md-sys-color-on-tertiary-container: var(--beta-text);
    --md-sys-color-surface: var(--beta-surface);
    --md-sys-color-on-surface: var(--beta-text);
    --md-sys-color-on-surface-variant: var(--beta-muted);
    --md-sys-color-surface-dim: var(--beta-bg);
    --md-sys-color-surface-bright: var(--beta-raised);
    --md-sys-color-surface-container-lowest: var(--beta-bg);
    --md-sys-color-surface-container-low: var(--beta-surface);
    --md-sys-color-surface-container: var(--beta-surface);
    --md-sys-color-surface-container-high: var(--beta-raised);
    --md-sys-color-surface-container-highest: var(--beta-raised);
    --md-sys-color-outline: var(--beta-line);
    --md-sys-color-outline-variant: var(--beta-line);
    --md-sys-color-error: var(--danger);
    --md-sys-color-on-error: #17110f;
    --md-sys-shape-corner-extra-small: 0;
    --md-sys-shape-corner-small: 0;
    --md-sys-shape-corner-medium: 0;
    --md-sys-shape-corner-large: 0;
    --md-sys-shape-corner-extra-large: 0;
    --md-sys-shape-corner-full: 0;
    --md-ref-typeface-brand: var(--sans);
    --md-ref-typeface-plain: var(--sans);
    --md-sys-typescale-label-large-weight: 500;
    --md-sys-typescale-title-large-weight: 500;
    --md-sys-typescale-headline-large-weight: 500;
    --shape-small: 0;
    --shape-medium: 0;
    --shape-large: 0;
    --shape-extra-large: 0;
}
@supports (padding: clamp(1px, 2vw, 3px)) {
    :root, body { --gutter: clamp(1.1rem, 4vw, 4.5rem); }
}
body.light-mode,
html.initial-light-mode body {
    color-scheme: light;
    --beta-bg: #f5f4ef;
    --beta-surface: #faf9f6;
    --beta-raised: #eae9e3;
    --beta-text: #242823;
    --beta-muted: #61655e;
    --beta-accent: #496b53;
    --beta-on-accent: #ffffff;
    --beta-line: #cfcec6;
    --beta-selection: #e0e9df;
    --bg-main: var(--beta-bg);
    --surface: var(--beta-surface);
    --surface-soft: var(--beta-raised);
    --text-main: var(--beta-text);
    --text-muted: var(--beta-muted);
    --border: var(--beta-line);
    --danger: #924f42;
    --card-shadow: none;
}
html { scroll-padding-top: 24px; }
body { background: var(--beta-bg); color: var(--beta-text); font-family: var(--sans); line-height: 1.6; }
::selection { background: var(--beta-selection); color: var(--beta-text); }
body :is(button, input, select, textarea) { font-family: var(--sans); font-weight: 500; }
body :is(button, summary, input:not([type=checkbox]):not([type=radio]), select, textarea, .btn) { border-radius: 0; }
body.public-page :is(button, a[href], summary, input, select, textarea, [tabindex], md-filled-button, md-filled-tonal-button, md-outlined-button, md-text-button, md-icon-button, md-outlined-text-field, md-filled-select):focus-visible,
body.admin-page :is(button, a[href], summary, input, select, textarea, [tabindex], md-filled-button, md-filled-tonal-button, md-outlined-button, md-text-button, md-icon-button, md-outlined-text-field, md-filled-select):focus-visible {
    outline: 2px solid var(--beta-accent); outline-offset: 4px; box-shadow: none;
}
body :is(button, a[href]):active { transform: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
/* Host-level overrides are intentional: legacy component classes set local
   corner tokens, which otherwise defeat inherited design-system tokens. */
body :is(md-filled-button, md-filled-tonal-button, md-outlined-button, md-text-button, md-icon-button, md-assist-chip, md-outlined-text-field, md-filled-select) {
    --md-filled-button-container-shape: 0 !important;
    --md-filled-tonal-button-container-shape: 0 !important;
    --md-outlined-button-container-shape: 0 !important;
    --md-text-button-container-shape: 0 !important;
    --md-icon-button-state-layer-shape: 0 !important;
    --md-assist-chip-container-shape: 0 !important;
    --md-outlined-text-field-container-shape: 0 !important;
    --md-filled-select-container-shape: 0 !important;
    --md-filled-select-text-field-container-shape: 0 !important;
    --md-menu-container-shape: 0;
    --md-filled-button-label-text-weight: 500 !important;
    --md-filled-tonal-button-label-text-weight: 500 !important;
    --md-outlined-button-label-text-weight: 500 !important;
    --md-assist-chip-label-text-weight: 400 !important;
    --md-assist-chip-label-text-font: var(--mono) !important;
    --md-assist-chip-label-text-color: var(--beta-muted) !important;
    --md-assist-chip-label-text-size: 11px;
    --md-assist-chip-outline-color: var(--beta-line);
    --md-filled-button-container-elevation: 0;
    --md-filled-button-hover-container-elevation: 0;
}
body :is(md-outlined-text-field, md-filled-select) { min-width: 0; max-width: 100%; }
body .material-search-field { --md-outlined-text-field-container-height: 54px; --md-outlined-text-field-input-text-size: 1rem; }
body .material-category-select { --md-filled-select-text-field-container-height: 54px; }
body .song-actions :is(md-filled-tonal-button, md-outlined-button) { --md-filled-tonal-button-container-height: 44px; --md-outlined-button-container-height: 44px; }

/* Identity and shell */
body .songbook-shell { display: flex; flex-direction: column; width: 100%; max-width: 1440px; min-height: 100vh; min-height: 100svh; padding: 0 var(--gutter) 24px; gap: 0; }
body .top-shell { display: block; border: 0; border-radius: 0; background: transparent; margin: 0; padding: 0; }
body .top-shell .songbook-hero,
.picker-brand-header { min-height: 104px; padding: 18px 0; border: 0; border-bottom: 1px solid var(--beta-line); border-radius: 0; background: transparent; box-shadow: none; display: flex; align-items: center; justify-content: space-between; gap: 24px; overflow: visible; }
.beta-brand { display: inline-flex; align-items: center; gap: 14px; color: var(--beta-text); text-decoration: none; }
body .wordmark { display: inline; font: 700 30px/1 var(--sans); letter-spacing: -.055em; color: var(--beta-text); }
body .brand-dot { display: inline; color: var(--beta-accent); font: inherit; letter-spacing: inherit; }
body .beta-badge { display: inline-block; margin: 0; border: 1px solid var(--beta-line); padding: 4px 6px; color: var(--beta-accent); font: 10px/1.2 var(--mono); letter-spacing: .13em; text-transform: uppercase; white-space: nowrap; }
body .songbook-hero h1 { margin: 0; font-size: inherit; }
body .songbook-hero p { margin-top: 8px; font: 11px/1.4 var(--mono); letter-spacing: .045em; color: var(--beta-muted); }
.hero-side { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
body .theme-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--beta-line); border-radius: 0; background: transparent; color: var(--beta-text); font: 400 13px/1.2 var(--sans); cursor: pointer; }
body .theme-toggle > span + span { margin-left: 8px; }
body .theme-toggle:hover { background: var(--beta-raised); }
body .mobile-theme-toggle { display: none; }
body .hero-jam-button { --md-filled-button-container-height: 44px; }
body .village-switch-button { min-height: 44px; border: 1px solid var(--beta-line); border-radius: 0; background: transparent; color: var(--beta-text); font-weight: 400; }
.picker-brand-header nav { display: flex; align-items: center; gap: 24px; font-size: 13px; }
.picker-brand-header nav :is(a, button) { display: inline-flex; align-items: center; min-height: 44px; padding: 0; background: none; border: 0; color: var(--beta-muted); text-decoration: none; }
.picker-brand-header nav :is(a, button):hover { color: var(--beta-text); }
body .header-menu summary, body .song-more summary { border-color: var(--beta-line); border-radius: 0; background: transparent; }
body .header-menu > div, body .song-more > div { border-radius: 0; background: var(--beta-raised); box-shadow: 0 12px 32px #0003; }
body .header-menu :is(button, a), body .song-more :is(button, a) { border-radius: 0; font-family: var(--sans); font-weight: 400; }

/* Landing and village selection */
body .village-picker-panel { width: 100%; margin: 0; padding: clamp(36px, 5vw, 72px) 0 64px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
body .village-picker-head { align-items: start; margin-bottom: 36px; }
.section-kicker, body .detail-meta, body .sidebar-header > span,
body :is(.jam-kicker, .jam-dialog-kicker, .jam-current-kicker, .install-help-kicker) { color: var(--beta-muted); font: 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .1em; }
body .village-picker-head h2 { margin: 20px 0 18px; color: var(--beta-text); font: 400 clamp(2.2rem, 4.3vw, 4rem)/1.08 var(--sans); letter-spacing: -.045em; }
body .village-picker-head p { max-width: 52ch; margin: 0; font-size: 15px; font-weight: 400; line-height: 1.8; color: var(--beta-muted); }
body .village-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
body .village-choice-grid button { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr) 28px; grid-template-rows: auto auto; align-content: center; align-items: center; gap: 6px 26px; min-width: 0; min-height: 190px; padding: 32px; text-align: left; border: 1px solid var(--beta-line); border-radius: 0; background: var(--beta-surface); color: var(--beta-text); box-shadow: none; transition: border-color 160ms, background 160ms; }
body .village-choice-grid button:is(:hover, .active) { border-color: var(--beta-accent); border-radius: 0; background: var(--beta-raised); transform: none; }
body .village-choice-grid img { grid-column: 1; grid-row: 1 / 3; width: 58px; height: 72px; padding: 0; object-fit: contain; border-radius: 0; background: transparent; filter: saturate(.45); }
body .village-choice-grid strong { grid-column: 2; grid-row: 1; align-self: end; font: 400 clamp(1.5rem, 2.7vw, 2.2rem)/1.2 var(--sans); letter-spacing: -.025em; overflow-wrap: anywhere; }
body .village-choice-grid span { grid-column: 2; grid-row: 2; align-self: start; padding: 0; background: transparent; color: var(--beta-muted); font: 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
body .village-choice-grid .village-choice-arrow { grid-column: 3; grid-row: 1 / 3; align-self: center; color: var(--beta-accent); font: 24px/1 var(--sans); }
body .village-choice-grid .village-selected-mark { position: absolute; inset: 12px 12px auto auto; width: 20px; height: 20px; background: var(--beta-accent); color: var(--beta-on-accent); border-radius: 0; }
.village-feedback { min-height: 190px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 12px; padding: 28px; border: 1px solid var(--beta-line); background: var(--beta-surface); color: var(--beta-muted); }
.village-feedback strong { color: var(--beta-text); font-weight: 500; }
.village-feedback button { min-height: 44px; padding: 8px 18px; border: 1px solid var(--beta-accent); color: var(--beta-accent); background: transparent; }
.loading-rule { width: 64px; height: 2px; background: var(--beta-accent); animation: beta-pulse 1.4s ease-in-out infinite alternate; }
@keyframes beta-pulse { to { opacity: .25; } }
.app-loading, .no-script-note { max-width: 640px; margin: 15vh auto; padding: 24px; display: grid; gap: 24px; color: var(--beta-muted); }
.app-loading > span:last-child { font: 12px/1.6 var(--mono); }


/* Search and catalog: navigation, not a dashboard of badges. */
body .top-shell .songbook-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 24px 0; border: 0; border-bottom: 1px solid var(--beta-line); border-radius: 0; background: transparent; }
body .search-box { flex: 1 1 280px; min-width: 0; }
body .controls-panel { gap: 8px; flex-wrap: wrap; }
body .material-category-select { width: 220px; min-width: 0; }
body .toolbar-tool { width: auto; height: 54px; min-width: 54px; flex: 0 0 auto; gap: 7px; padding: 0 12px; border: 1px solid var(--beta-line); border-radius: 0; background: transparent; color: var(--beta-muted); }
body .toolbar-tool:hover { color: var(--beta-text); background: var(--beta-surface); }
body .toolbar-tool.active { border-color: var(--beta-accent); color: var(--beta-accent); background: var(--beta-selection); }
body .toolbar-tool-label { display: block; font-size: 12px; font-weight: 400; }
body .toolbar-tool-icon .ui-icon { width: 18px; height: 18px; }
body .results-summary { margin: 0; min-height: 68px; gap: 12px; padding: 14px 0; color: var(--beta-muted); font: 11px/1.6 var(--mono); letter-spacing: .025em; }
body .results-summary :is(strong, span) { min-height: 0; padding: 0; border-radius: 0; color: inherit; background: transparent; font-weight: 400; }
body .results-summary strong { color: var(--beta-text); }
body .catalog-trigger { margin-left: auto; border-radius: 0; font-weight: 400; }
body .songbook-layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); }
body .songbook-layout.catalog-collapsed { grid-template-columns: minmax(0, 1fr); }
body .song-sidebar { top: 24px; height: calc(100vh - 48px); height: calc(100dvh - 48px); border: 1px solid var(--beta-line); border-radius: 0; background: transparent; box-shadow: none; }
body .sidebar-header { min-height: 56px; padding-left: 18px; border-bottom: 1px solid var(--beta-line); }
body .song-sidebar nav { padding: 8px 0; }
body .song-sidebar a { display: block; padding: 12px 18px; min-height: 46px; border-radius: 0; color: var(--beta-muted); font-weight: 400; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
body .song-sidebar a:hover { background: var(--beta-surface); color: var(--beta-text); transform: none; }
body .song-sidebar a.active { background: var(--beta-surface); color: var(--beta-accent); }
body .song-sidebar a.active::before { width: 2px; inset: 0 auto 0 0; border-radius: 0; background: var(--beta-accent); }
body .song-results { min-width: 0; gap: 32px; padding: 0; background: none; }
body .public-song-card { min-width: 0; padding: 32px clamp(24px, 3vw, 44px) 40px; border: 1px solid var(--beta-line); border-radius: 0; background: var(--beta-surface); box-shadow: none; }
body .public-song-card:hover { background: var(--beta-surface); transform: none; box-shadow: none; }
body .song-badges { margin-bottom: 18px; gap: 8px; }
body .public-song-card h2 { margin: 0 0 18px; }
body .public-song-card h2 button { color: var(--beta-text); font: 500 clamp(1.5rem, 2.2vw, 2rem)/1.25 var(--sans); letter-spacing: -.025em; overflow-wrap: anywhere; }
body .song-title-open-icon { width: 30px; height: 30px; border-radius: 0; color: var(--beta-accent); background: none; }
body .song-actions { gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
body .song-more summary { width: 44px; height: 44px; }
body .public-song-card pre, body .detail-lyrics { max-width: 70ch; font-family: var(--sans); color: var(--beta-text); font-size: clamp(1.06rem, 1rem + .3vw, 1.2rem); font-weight: 400; line-height: 1.45; letter-spacing: .005em; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
body .public-song-card mark { border-radius: 0; background: var(--beta-selection); color: var(--beta-text); box-shadow: none; }
body .version-switcher button { border-radius: 0; font-weight: 400; }
body .version-switcher button.active { background: var(--beta-selection); color: var(--beta-accent); border-color: var(--beta-accent); }
body .song-comment { border-color: var(--beta-line); background: transparent; color: var(--beta-muted); border-radius: 0; font-family: var(--sans); }
body :is(.empty-state, .song-skeleton, .jam-status-panel, .jam-inline-message, .jam-current-box, .jam-choice-button, .jam-list-item, .pending-jam, .empty-jams, .shuffle-hint) { border: 1px solid var(--beta-line); border-radius: 0; background: var(--beta-surface); box-shadow: none; }
body :is(.empty-state, .song-skeleton-grid) { margin: 24px 0; }
body .jam-status-panel { margin-bottom: 24px; }
body :is(.jam-choice-button, .jam-list-item):hover { border-color: var(--beta-accent); background: var(--beta-raised); transform: none; }
body .jam-choice-button strong { font-size: 20px; font-weight: 500; }
body .jam-choice-button span { color: var(--beta-muted); font: 400 14px/1.6 var(--sans); }
body .jam-member-chip { border-radius: 0; font-weight: 400; }
body .jam-member-chip:is(.leader, .me) { color: var(--beta-accent); background: var(--beta-selection); border-color: var(--beta-line); }
body .jam-live-dot { background: var(--beta-accent); box-shadow: none; }

/* Reading and every existing utility dialog */
body .modal { top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .7); background: #000b; backdrop-filter: blur(4px); }
body .modal-content { border: 1px solid var(--beta-line); border-radius: 0; background: var(--beta-surface); color: var(--beta-text); box-shadow: none; }
body .modal-content::before { display: none; }
body .modal-content h2 { color: var(--beta-text); font-weight: 400; letter-spacing: -.03em; }
body .modal-content h3 { font-weight: 500; }
body .song-detail-modal .song-detail { background: var(--beta-bg); border-radius: 0; }
body .song-detail h2 { max-width: 20ch; padding-right: 26px; font-size: clamp(2rem, 4.5vw, 3.5rem); line-height: 1.12; }
body .detail-lyrics { font-size: inherit; }
body :is(.detail-close, .modal-close) { min-width: 44px; min-height: 44px; border: 1px solid var(--beta-line); border-radius: 0; background: var(--beta-surface); color: var(--beta-text); }
body :is(.detail-primary-actions, .detail-tools) button { border-radius: 0; font-weight: 400; }
body .detail-primary-actions button:first-child { background: transparent; border-color: var(--beta-line); }
body .detail-primary-actions button[aria-pressed=true] { background: var(--beta-selection); color: var(--beta-accent); border-color: var(--beta-accent); }
body .install-help { border-radius: 0; }
body :is(.install-help-icon, .install-help-steps li > strong, .install-offline-note) { border-radius: 0; color: var(--beta-accent); background: var(--beta-selection); }
body :is(.install-help-done, .btn-primary, .btn.primary, .btn-primary.blue) { border-radius: 0; background: var(--beta-accent); color: var(--beta-on-accent); font-weight: 500; text-transform: none; }
body :is(.connection-status, .update-banner, .install-tip, .toast, .quick-top-button) { border-radius: 0; background: var(--beta-raised); color: var(--beta-text); border: 1px solid var(--beta-line); box-shadow: none; }
body :is(.install-tip button, .install-tip .install-tip-action) { border-radius: 0; }
body :is(.connection-status, .update-banner) { max-width: calc(100vw - 32px); width: max-content; font-weight: 400; }
body .filter-count { background: var(--beta-accent); color: var(--beta-on-accent); }
body .app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 28px; margin-top: auto; padding: 48px 0 0; border: 0; text-align: left; color: var(--beta-muted); font: 11px/1.7 var(--mono); }
body .app-footer p { margin: 0; }
.footer-beta { margin-left: 12px; color: var(--beta-muted); }
body .app-footer a { margin-left: 20px; color: var(--beta-muted); text-underline-offset: 4px; }

/* Admin/login keep all original forms and navigation. */
body .wrap { width: calc(100% - var(--gutter) * 2); max-width: 1320px; }
body .admin-top { background: var(--beta-bg); border-bottom: 1px solid var(--beta-line); box-shadow: none; }
body .admin-top-inner { min-height: 88px; gap: 24px; padding-block: 20px; flex-wrap: wrap; }
body .admin-top .brand { color: var(--beta-text); font-size: inherit; }
body .admin-top .nav { flex-wrap: wrap; gap: 8px; }
body .admin-main { padding-top: 40px; }
body.admin-page :is(.panel, .stat-card, .card, .admin-card, .dashboard-card) { border: 1px solid var(--beta-line); border-radius: 0; background: var(--beta-surface); box-shadow: none; }
body.admin-page :is(h1, h2, h3) { color: var(--beta-text); font-weight: 500; letter-spacing: -.025em; }
body.admin-page .login-panel { width: min(460px, 100%); margin: 6vh auto; padding: clamp(22px, 4vw, 40px); }
body.admin-page :is(input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea) { min-width: 0; border: 1px solid var(--beta-line); border-radius: 0; background-color: var(--beta-bg); color: var(--beta-text); font-size: 16px; font-weight: 400; }
body.admin-page :is(button, .btn, .nav a, .nav button) { min-height: 44px; border-radius: 0; font-weight: 400; background: transparent; color: var(--beta-text); }
body.admin-page .btn.primary { background: var(--beta-accent); color: var(--beta-on-accent); }
body.admin-page th { color: var(--beta-muted); background: var(--beta-raised); font: 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
body.admin-page :is(td, th) { border-color: var(--beta-line); }
body.admin-page .flash { border-radius: 0; border: 1px solid var(--beta-accent); background: var(--beta-selection); color: var(--beta-text); }

@media (max-width: 1050px) and (min-width: 781px) {
    body .toolbar-tool-label { display: none; }
    body .songbook-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 780px) {
    body .songbook-shell { padding: env(safe-area-inset-top) var(--gutter) calc(24px + env(safe-area-inset-bottom)); width: 100%; background: var(--beta-bg); }
    body .top-shell .songbook-hero { display: none; }
    .picker-brand-header { min-height: 88px; gap: 14px; flex-wrap: wrap; padding-block: 18px; }
    .picker-brand-header nav { gap: 18px; font-size: 11px; }
    body .wordmark { font-size: 27px; }
    body .beta-brand { gap: 9px; }
    body .mobile-brand { display: flex; padding: 14px 0; min-height: 76px; gap: 6px; border-bottom: 1px solid var(--beta-line); }
    body .mobile-theme-toggle { display: inline-flex; flex: 0 0 44px; width: 44px; padding: 0; font-size: 24px; }
    body .mobile-theme-toggle span { line-height: 1; }
    body .mobile-brand-copy { flex: 1; min-width: 0; }
    body .mobile-brand-copy > span { margin-top: 7px; color: var(--beta-muted); font: 10px/1.3 var(--mono); }
    body .mobile-brand .wordmark { font-size: 25px; }
    body .mobile-brand .brand-dot { font: inherit; color: var(--beta-accent); }
    body .mobile-brand .beta-badge { font: 9px/1.2 var(--mono); padding: 3px 4px; margin: 0; }
    body :is(.mobile-jam-link, .mobile-village-button) { min-height: 44px; border: 1px solid var(--beta-line); border-radius: 0; background: transparent; color: var(--beta-text); padding-inline: 10px; }
    body .mobile-jam-link span { color: inherit; margin: 0; font-weight: 400; font-size: 12px; }
    body .mobile-village-button { width: 44px; padding: 0; }
    body .village-picker-panel { padding: 40px 0; }
    body .village-picker-head { margin-bottom: 28px; }
    body .village-picker-head h2 { margin-top: 18px; max-width: 10ch; font-size: clamp(2.5rem, 10vw, 3.4rem); }
    body .village-picker-head p { font-size: 14px; }
    body .village-choice-grid { grid-template-columns: 1fr; gap: 12px; }
    body .village-choice-grid button { grid-template-columns: 52px minmax(0, 1fr) 24px; min-height: 132px; padding: 24px; gap: 6px 20px; }
    body .village-choice-grid img { width: 44px; height: 58px; }
    body .village-choice-grid strong { font-size: 26px; }
    body .top-shell .songbook-toolbar, body .songbook-toolbar.is-compact { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 8px; padding: 18px 0; }
    body .search-box { width: 100%; grid-column: 1; min-width: 0; }
    body .mobile-menu-btn { display: inline-flex; grid-column: 2; width: 48px; height: 54px; border: 1px solid var(--beta-line); border-radius: 0; background: transparent; }
    body .songbook-toolbar .controls-panel { display: none; }
    body .songbook-toolbar.controls-open .controls-panel { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px 0 0; border-radius: 0; background: transparent; }
    body .songbook-toolbar.controls-open .material-category-select { width: 100%; min-width: 0; grid-column: 1 / -1; }
    body .songbook-toolbar.controls-open .toolbar-tool { width: 100%; min-width: 0; height: 48px; flex-direction: row; }
    body .toolbar-tool-label { font-size: 12px; }
    body .search-clear { top: 5px; }
    body .results-summary { gap: 12px; min-height: 64px; }
    body .results-summary :is(strong, span) { padding: 0; font-size: 10px; }
    body .catalog-trigger { display: inline-flex; min-height: 44px; padding-inline: 12px; border-radius: 0; font-size: 12px; }
    body .songbook-layout, body .songbook-layout.catalog-collapsed { display: block; }
    body .song-sidebar, body .songbook-layout.catalog-collapsed .song-sidebar { position: fixed; z-index: 11000; top: 0; right: auto; bottom: 0; left: 0; inset: 0 auto 0 0; display: flex; width: 88vw; max-width: 340px; height: 100vh; height: 100dvh; border-radius: 0; background: var(--beta-bg); transform: translateX(-105%); }
    body .song-sidebar.open, body .songbook-layout.catalog-collapsed .song-sidebar.open { transform: translateX(0); }
    body .song-results { gap: 0; }
    body .public-song-card { padding: 26px 0 32px; margin-bottom: 0; border: 0; border-bottom: 1px solid var(--beta-line); border-radius: 0; background: transparent; }
    body .public-song-card:hover { background: transparent; }
    body .public-song-card h2 button { font-size: 1.65rem; line-height: 1.25; }
    body .public-song-card pre { font-size: 1.1rem; line-height: 1.45; overflow-wrap: anywhere; }
    body .song-badges { margin-bottom: 16px; }
    body .song-actions { margin-bottom: 16px; }
    body .modal { padding-left: 12px; padding-right: 12px; padding-inline: 12px; }
    body .modal-content { padding: 24px 20px; max-width: 100%; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
    body .song-detail-modal { padding: 0; }
    body .song-detail-modal .song-detail { max-height: 100vh; max-height: 100dvh; padding: 24px var(--gutter) 28px; padding: max(24px, env(safe-area-inset-top)) var(--gutter) max(28px, env(safe-area-inset-bottom)); }
    body .detail-lyrics { line-height: 1.45; }
    body .print-controls { flex-wrap: wrap; grid-template-columns: minmax(0, 1fr); }
    body .print-controls :is(input, select) { min-width: 0; width: 100%; }
    body .print-actions { gap: 8px; }
    body .app-footer { padding-top: 40px; padding-bottom: 8px; font-size: 10px; }
    body .app-footer a { margin-left: 12px; }
    body .jam-choice-box { grid-template-columns: minmax(0, 1fr); }
    body .admin-top-inner { padding-block: 22px; }
    body .admin-main { padding-top: 24px; }
}
@media (max-width: 400px) {
    body .mobile-jam-link { flex: 0 0 44px; width: 44px; padding-left: 0; padding-right: 0; }
    body .mobile-jam-link span { display: none; }
}
@media (max-width: 360px) {
    body { --gutter: 14px; }
    body .mobile-brand .wordmark { font-size: 22px; }
}
/* Native layout fallbacks; a new viewport unit must not be required for spacing. */
@supports not (height: 100dvh) {
    body .mobile-brand, body .hero-side, body .beta-brand, body .song-actions { gap: 0; }
    body .mobile-brand > * + * { margin-left: 6px; }
    body .hero-side > * + * { margin-left: 12px; }
    body .beta-brand > * + * { margin-left: 9px; }
    body .song-actions > * { margin-right: 8px; margin-bottom: 8px; }
    body .modal-close, body .detail-close { border-radius: 0; background: var(--beta-surface); color: var(--beta-text); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    :root, body, body.light-mode { color-scheme: light; --beta-bg: #ffffff; --beta-surface: #ffffff; --beta-raised: #ffffff; --beta-text: #000000; --beta-muted: #333333; --beta-line: #cccccc; --text-main: #000000; background: #ffffff !important; color: #000000 !important; }
    body .songbook-shell { width: 100%; max-width: none; padding: 0; }
    body :is(.top-shell, .app-footer, .results-summary, .song-sidebar, .song-actions, .quick-top-button, .connection-status, .update-banner, .install-tip, .modal, .toast, .jam-status-panel, .app-loading) { display: none !important; }
    body .songbook-layout { display: block; }
    body .public-song-card { break-inside: avoid; background: #ffffff; color: #000000; border: 0; padding: 0 0 24px; }
    body .public-song-card h2 button, body .public-song-card pre { color: #000000; }
    body .song-title-open-icon { display: none; }
    body.printing #printArea, body.printing #printArea * { color: #000000; background: #ffffff; }
}
