:root {
  --forest: #1f4a3d;
  --forest-2: #2d6653;
  --ink: #1f2a26;
  --muted: #68736e;
  --paper: #fffdf7;
  --sand: #f2ecdf;
  --line: #ddd4c4;
  --gold: #d89b36;
  --coral: #b95942;
  --shadow: 0 16px 48px rgba(31, 42, 38, .14);
  --reader-size: 26px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--sand); font-family: "Trebuchet MS", "Gill Sans", sans-serif; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a, input, select, textarea { outline-color: var(--gold); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ui-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.splash { position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--paper); background: radial-gradient(circle at 68% 24%, rgba(126, 193, 232, 0.42) 0, transparent 34%), radial-gradient(circle at 32% 78%, rgba(92, 138, 230, 0.18) 0, transparent 28%), linear-gradient(145deg, #123a63, #1d5d94 56%, #173f6a); transition: opacity .55s ease, visibility .55s; }
.splash.leaving { opacity: 0; visibility: hidden; }
.splash-mark { position: relative; width: 88px; height: 88px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.45); border-radius: 50% 50% 46% 54%; transform: rotate(-5deg); }
.splash-mark::before { content: ""; position: absolute; inset: 8px; border-radius: inherit; border: 1px solid rgba(255,255,255,.2); }
.splash-mark span { font: 700 48px/1 Georgia, serif; transform: rotate(5deg); }
.splash-mark i { position: absolute; width: 2px; height: 29px; background: #9ad7ff; right: 18px; top: -10px; transform: rotate(17deg); }
.splash-name { font: 700 33px/1 Georgia, serif; letter-spacing: .04em; }
.splash-pulse { width: 58px; height: 2px; overflow: hidden; background: rgba(255,255,255,.16); }
.splash-pulse::after { content: ""; display: block; width: 50%; height: 100%; background: #9ad7ff; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: translateX(100%); } }

.auth-screen { height: calc(100dvh - 24px); min-height: 0; overflow-x: hidden; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom)); overscroll-behavior: contain; background: radial-gradient(circle at 20% 10%, rgba(126,193,232,.24), transparent 28%), linear-gradient(135deg, #dceefa, #f6fbff 52%, #e8f3fb); }
.auth-card { flex: none; width: min(440px, 100%); margin-block: auto; padding: 28px; border: 1px solid rgba(31,74,61,.14); border-radius: 18px 18px 48px 18px; background: rgba(255,253,247,.94); box-shadow: var(--shadow); }
.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.mini-mark, .wordmark span { display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--forest); border-radius: 50% 50% 44% 56%; font: 700 24px Georgia, serif; }
.brand-row strong { display: block; font: 700 25px Georgia, serif; }
.brand-row span { color: var(--muted); font-size: 13px; }
.auth-tabs, .admin-tabs { display: flex; gap: 4px; padding: 4px; background: var(--sand); border-radius: 10px; }
.auth-tabs button, .admin-tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-size: 13px; }
.auth-tabs button.active, .admin-tabs button.active { background: var(--paper); color: var(--forest); box-shadow: 0 2px 8px rgba(31,42,38,.09); font-weight: 700; }
.auth-form, .stack-form { display: grid; gap: 14px; margin-top: 18px; }
.auth-step { display: grid; gap: 14px; }
.auth-step-copy { display: grid; gap: 4px; line-height: 1.4; }
.auth-step-copy strong { font: 700 20px Georgia, serif; }
.auth-step-copy span { color: var(--muted); font-size: 13px; }
.auth-step-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: #fff; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(45,102,83,.12); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 78px; }
.password-toggle { position: absolute; top: 50%; right: 7px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 7px; color: #1f6f99; background: #e5f3fc; font-size: 11px; font-weight: 800; transform: translateY(-50%); cursor: pointer; }
.password-toggle:focus-visible { outline: 2px solid #4fa7df; outline-offset: 1px; }
.primary, .secondary { min-height: 44px; border-radius: 8px; padding: 0 16px; cursor: pointer; font-weight: 700; }
.primary { border: 1px solid var(--forest); color: white; background: var(--forest); }
.primary:hover { background: var(--forest-2); }
.secondary { border: 1px solid var(--line); background: var(--paper); }
.primary:disabled, .secondary:disabled, .text-button:disabled { cursor: wait; opacity: .62; }
.form-message { min-height: 20px; margin: 10px 0 0; color: var(--coral); font-size: 13px; }
.auth-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.account-email-form { padding-top: 4px; border-top: 1px solid var(--line); }

.app-shell { position: relative; height: calc(100dvh - 24px); overflow: hidden; }
.global-footer { position: fixed; inset: auto 0 0; z-index: 900; height: 24px; display: grid; place-items: center; padding-bottom: env(safe-area-inset-bottom); color: #68849b; background: #edf6fc; font-size: 11px; }
.global-footer a { color: inherit; text-decoration: none; }
.global-footer a:hover, .global-footer a:focus-visible { color: #1f6f99; text-decoration: underline; }
.topbar { z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: white; background: transparent; box-shadow: none; }
.wordmark { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.wordmark span { width: 36px; height: 36px; color: var(--forest); background: #f4e8c7; font-size: 21px; }
.wordmark strong { font: 700 22px Georgia, serif; letter-spacing: .02em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-action { min-height: 40px; padding: 0 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; color: white; background: rgba(255,255,255,.07); cursor: pointer; }
.top-action.accent { border-color: var(--gold); background: var(--gold); color: #2f2616; }
.avatar-button { width: 40px; height: 40px; border: 2px solid rgba(255,255,255,.65); border-radius: 50%; color: var(--forest); background: #f6e9c6; cursor: pointer; font-weight: 800; }
.icon-button { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font-size: 20px; }
#menu-button { color: var(--forest); }
.text-button { min-height: 40px; border: 0; padding: 0 6px; color: var(--forest-2); background: transparent; cursor: pointer; font-weight: 700; text-align: left; }
.danger { color: var(--coral); }

.library-panel { grid-area: side; z-index: 15; min-width: 0; overflow: hidden; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #f7f2e8; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px; }
.eyebrow { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.panel-head strong { font: 700 19px Georgia, serif; }
.search-field { position: relative; display: block; margin: 0 14px 12px; }
.search-field span { position: absolute; left: 12px; top: 12px; display: grid; color: var(--muted); }
.search-field input { padding-left: 34px; background: rgba(255,255,255,.76); }
.category-list { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.category-list button { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 20px; background: transparent; cursor: pointer; }
.category-list button.active { color: white; border-color: var(--forest); background: var(--forest); }
.folder-tree { display: grid; gap: 4px; padding: 0 10px 10px; }
.folder-row { width: 100%; min-height: 38px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; font-weight: 700; }
.folder-row:hover, .folder-row.active { background: #fffdf7; }
.folder-row.active { box-shadow: inset 3px 0 var(--gold); }
.folder-tools { display: grid; gap: 4px; margin: 0 14px 8px; }
.library-panel > .text-button { margin: 0 14px 8px; }
.song-list { flex: 1; overflow: auto; padding: 0 10px 24px; }
.song-row { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 12px 10px; border: 0; border-bottom: 1px solid rgba(221,212,196,.72); background: transparent; cursor: pointer; text-align: left; }
.song-row:hover, .song-row.active { border-radius: 8px; background: #fffdf7; }
.song-row.active { box-shadow: inset 3px 0 var(--gold); }
.song-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 16px Georgia, serif; }
.song-row small { grid-column: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-row .star { color: var(--gold); }

.reader { grid-area: reader; min-width: 0; overflow: auto; scroll-behavior: smooth; background: radial-gradient(circle at 90% 5%, rgba(216,155,54,.10), transparent 25%), var(--paper); }
.empty-reader { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 30px; text-align: center; }
.empty-symbol { width: 78px; height: 78px; display: grid; place-items: center; border-radius: 50%; color: var(--forest); background: var(--sand); font-size: 38px; }
.empty-reader h1 { margin: 8px 0 0; font: 700 34px Georgia, serif; }
.empty-reader p { max-width: 480px; margin: 0 0 12px; color: var(--muted); line-height: 1.55; }
.empty-reader div:last-child { display: flex; gap: 8px; }
.song-reader { min-height: 100%; }
.reader-toolbar { position: sticky; top: 0; z-index: 10; min-height: 56px; display: flex; align-items: center; gap: 8px; padding: 8px 22px; border-bottom: 1px solid var(--line); background: rgba(255,253,247,.92); backdrop-filter: blur(12px); }
.reader-spacer { flex: 1; }
.reader-tool-group { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid rgba(29, 66, 56, 0.14); border-radius: 999px; background: rgba(255, 255, 255, 0.68); }
.reader-tool-button { min-width: 34px; height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--sand); color: var(--forest); font: 700 14px/1 "Trebuchet MS", "Gill Sans", sans-serif; cursor: pointer; transition: transform .16s ease, background .16s ease, color .16s ease; }
.reader-tool-button:hover { background: #dfd1b5; }
.reader-tool-button:active { transform: translateY(1px); }
.reader-tool-value { min-width: 46px; text-align: center; color: var(--forest); font-size: 13px; font-weight: 700; }
.scroll-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--forest); }
.scroll-toggle input { position: absolute; opacity: 0; }
.scroll-toggle span { width: 38px; height: 22px; padding: 2px; border-radius: 12px; background: #b8bdb9; transition: .2s; }
.scroll-toggle span::after { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: white; transition: .2s; }
.scroll-toggle input:checked + span { background: var(--forest-2); }
.scroll-toggle input:checked + span::after { transform: translateX(16px); }
.scroll-toggle b { font-size: 12px; }
.reader-speed-input { width: 54px; min-height: 34px; padding: 0 6px; border: 0; background: transparent; color: var(--forest); font-size: 14px; font-weight: 700; text-align: center; }
.reader-speed-input::-webkit-outer-spin-button, .reader-speed-input::-webkit-inner-spin-button { margin: 0; }
.song-heading, .lyrics, .video-wrap { width: min(830px, calc(100% - 40px)); margin-inline: auto; }
.song-heading { padding: 46px 0 26px; border-bottom: 1px solid var(--line); }
.song-heading h1 { margin: 12px 0 8px; font: 700 clamp(34px, 5vw, 56px)/1.05 Georgia, serif; color: #183c32; }
.song-heading p { margin: 0; color: var(--muted); }
.language-pill, .status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; margin-right: 6px; border-radius: 12px; color: var(--forest); background: #dfeadf; font-size: 11px; font-weight: 800; }
.status-pill.review { color: #754324; background: #f5dfc3; }
.song-actions { display: flex; gap: 14px; margin-top: 14px; }
.lyrics { padding: 36px 0 70px; font: 400 var(--reader-size)/1.65 "Palatino Linotype", Palatino, Georgia, serif; letter-spacing: .005em; }
.lyrics-section { margin-bottom: 28px; }
.lyrics-section h3 { margin: 0 0 12px; color: var(--forest); font: 700 16px/1.2 "Trebuchet MS", "Gill Sans", sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.lyrics-section p { margin: 0 0 8px; white-space: pre-wrap; }
.video-wrap { padding-bottom: 80px; }
.video-wrap iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #1b211f; box-shadow: var(--shadow); }

dialog { color: var(--ink); }
dialog[open] { overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
dialog::backdrop { background: rgba(18,31,27,.55); backdrop-filter: blur(3px); }
.workspace-dialog, .form-dialog { width: min(960px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.form-dialog { width: min(720px, calc(100% - 28px)); }
.compact-dialog { width: min(460px, calc(100% - 28px)); padding-bottom: 20px; }
dialog > header { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
dialog h2 { margin: 0; font: 700 25px Georgia, serif; }
.dialog-tools { padding: 14px 6px 0; }
.catalog-list, .admin-section { min-height: 280px; padding: 0 18px 24px; overflow: auto; }
.catalog-card, .admin-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.catalog-card h3, .admin-row strong { margin: 0; font: 700 17px Georgia, serif; }
.catalog-card p, .admin-row p { margin: 0; color: var(--muted); font-size: 13px; }
.catalog-card small { color: var(--muted); }
.catalog-card .primary { grid-row: 1 / 4; grid-column: 2; }
.stack-form { padding: 20px; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-note { padding: 12px; border-left: 3px solid var(--gold); color: var(--muted); background: var(--sand); font-size: 13px; line-height: 1.45; }
.compact-dialog > p, .compact-dialog > .text-button { margin-inline: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 18px; }
.stat-card { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--sand); }
.stat-card strong { display: block; font: 700 28px Georgia, serif; }
.stat-card span { color: var(--muted); font-size: 12px; }
.admin-tabs { margin: 0 18px 14px; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-actions button { min-height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: white; cursor: pointer; font-size: 12px; }
.log-detail { margin: 10px 0 0; padding: 10px; overflow: auto; border-radius: 8px; color: #214338; background: #eef4ef; font: 12px/1.4 Consolas, monospace; white-space: pre-wrap; }
.admin-screen {
  position: fixed;
  inset: 0 0 24px;
  z-index: 70;
  overflow: auto;
  background: var(--paper);
}

.admin-screen-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 24px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.admin-screen-header h2 {
  margin: 0;
  font: 700 clamp(22px, 2.6vw, 28px)/1.12 Georgia, serif;
}
.app-dialog #app-dialog-text { min-height: 20px; margin: 0; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; z-index: 1200; left: 50%; bottom: 24px; max-width: min(440px, calc(100% - 28px)); padding: 11px 16px; border-radius: 8px; color: white; background: #263d35; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .25s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav, .mobile-only, .scrim { display: none; }

@media (max-width: 760px) {
  body { overflow: hidden; }
  .mobile-only { display: grid; }
  .app-shell { grid-template: 58px 1fr 66px / 1fr; grid-template-areas: "top" "reader" "nav"; }
  .topbar { padding: 0 10px; }
  .wordmark strong { display: none; }
  .top-action { display: none; }
  .library-panel { position: fixed; inset: 0 auto 0 0; width: min(88vw, 340px); transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .library-panel.open { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; z-index: 12; display: block; background: rgba(18,31,27,.42); }
  .reader-toolbar { min-height: 52px; padding: 6px 10px; gap: 5px; }
  .reader-toolbar .icon-button { min-width: 36px; height: 36px; }
  .reader-tool-group { gap: 5px; padding: 3px 4px; }
  .reader-tool-button { min-width: 30px; height: 30px; padding: 0 9px; }
  .reader-tool-value { min-width: 40px; font-size: 11px; }
  .reader-speed-input { width: 42px; min-height: 30px; font-size: 12px; }
  .scroll-toggle b { display: none; }
  .song-heading, .lyrics, .video-wrap { width: calc(100% - 28px); }
  .song-heading { padding-top: 28px; }
  .song-heading h1 { font-size: 38px; }
  .song-actions { align-items: flex-start; flex-direction: column; gap: 0; }
  .lyrics { padding-top: 26px; padding-bottom: 50px; }
  .mobile-nav { grid-area: nav; z-index: 11; display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 6px 8px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
  .mobile-nav button { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.mobile-nav span { display: block; color: var(--forest); font-size: 22px; line-height: 24px; }
  .mobile-nav .ui-icon { display: block; width: 21px; height: 21px; margin: 1px auto 2px; }
  .mobile-nav .nav-add span { width: 38px; height: 30px; display: grid; place-items: center; margin: -10px auto 4px; border-radius: 16px; color: white; background: var(--gold); }
  .auth-screen { padding-inline: 10px; }
  .auth-card { padding: 22px 18px; border-radius: 16px 16px 36px 16px; }
  .workspace-dialog, .form-dialog { width: 100%; max-width: none; max-height: calc(100dvh - 12px); margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .admin-screen { inset: 0 0 24px; }
  .admin-screen-header { align-items: flex-start; flex-direction: column; gap: 12px; padding: 18px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .catalog-card { grid-template-columns: 1fr; }
  .catalog-card .primary { grid-area: auto; margin-top: 7px; }
  .catalog-toggle { grid-row: 1 / 4; grid-column: 2; }
  .admin-row { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
  .empty-reader h1 { font-size: 29px; }
}

/* Reference shell import from songslib, adapted for Worship */
.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  height: 100%;
  padding: 18px clamp(18px, 4vw, 34px) max(18px, env(safe-area-inset-bottom));
}

.topbar, .drawer-head, .editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 30;
  padding: 0;
  pointer-events: none;
  background: transparent;
  box-shadow: none;
}

.edge-tab {
  position: fixed;
  top: 50vh;
  z-index: 35;
  width: 22px;
  height: 64px;
  transform: translateY(-50%);
  border: 1px solid rgba(129, 117, 104, 0.28);
  background: rgba(255, 250, 242, 0.72);
  color: #1f6f99;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(72, 55, 38, 0.1);
  pointer-events: auto;
}

.edge-tab-left {
  left: max(0px, env(safe-area-inset-left));
  border-radius: 0 14px 14px 0;
  border-left: 0;
}

.brand { display: grid; gap: 1px; min-width: 0; }
.brand-title {
  margin: 0;
  color: #244e7d;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
}
.brand-kicker {
  color: #7e93ab;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}

.drawer-admin-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #e3d8c8;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.86);
  color: #1f6f99;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 8px 22px rgba(72, 55, 38, 0.07);
}

.drawer-backdrop, .editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(47, 47, 45, 0.2);
  backdrop-filter: blur(4px);
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  width: min(420px, 100%);
  padding: 16px;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 250, 242, 0.98);
  border-left: 1px solid #e3d8c8;
  box-shadow: -26px 0 80px rgba(72, 55, 38, 0.2);
}

.left-drawer {
  inset: 0 auto 0 0;
  border-right: 1px solid #e3d8c8;
  border-left: 0;
  box-shadow: 26px 0 80px rgba(72, 55, 38, 0.2);
}

.panel-block {
  margin-top: 9px;
  padding: 9px;
  border: 1px solid #e3d8c8;
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.74);
}

.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-title-row h3 { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }

.icon-btn, .favorite-btn, .font-tools button, .editor-actions button, .edit-song-btn {
  border: 1px solid #e3d8c8;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.86);
  color: #29251f;
  box-shadow: 0 8px 22px rgba(72, 55, 38, 0.07);
}

.icon-btn {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.font-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  flex-wrap: nowrap;
}

.font-tools button { min-width: 36px; min-height: 32px; padding: 5px 9px; font-size: 15px; }

#fontSizeLabel {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.scroll-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 32px;
  border: 1px solid #e3d8c8;
  border-radius: 999px;
  padding: 4px 6px;
  background: rgba(255, 250, 242, 0.78);
  color: #29251f;
  font-size: 13px;
  font-weight: 800;
}

.scroll-toggle input {
  position: static;
  width: 18px;
  height: 18px;
  margin: 0;
  opacity: 1;
  accent-color: #d85b91;
}

.scroll-toggle span, .scroll-toggle b, .reader-tool-group, .reader-tool-button, .reader-tool-value, .reader-speed-input { all: unset; }

.scroll-speed-input {
  width: 46px;
  min-height: 32px;
  padding: 5px 4px;
  border: 1px solid #e3d8c8;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  background: #fffdf8;
}

.scroll-speed-control { display: inline-flex; align-items: center; gap: 4px; }
.scroll-speed-control button {
  min-width: 28px;
  min-height: 28px;
  padding: 4px 7px;
  color: #1f6f99;
  border: 1px solid rgba(91, 158, 196, 0.34);
  background: linear-gradient(135deg, #ecf8ff, #b9def7);
  font-size: 14px;
  font-weight: 900;
}

.door-btn, .primary-btn, .danger-btn {
  border: 0;
  border-radius: 999px;
  min-height: 38px;
  padding: 8px 13px;
  color: #1f6f99;
  background: linear-gradient(135deg, #ecf8ff, #b9def7);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(77, 142, 181, 0.14);
}

.door-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 20px;
}

.danger-btn { background: linear-gradient(135deg, #d9705f, #a34235); color: #fffaf2; }
.create-mini { color: #fffaf2; border: 0; background: linear-gradient(135deg, #f0a846, #bf7f2f); }
.mini-btn { min-width: 28px; min-height: 28px; border: 1px solid #e3d8c8; border-radius: 999px; background: rgba(241, 231, 216, 0.62); color: #29251f; padding: 2px 6px; font-size: 15px; font-weight: 900; box-shadow: none; }

.editor-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.choice-actions {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.choice-actions button {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
}

.create-choice-folder {
  color: #fffaf2;
  background: linear-gradient(135deg, #f0a846, #bf7f2f);
  box-shadow: 0 12px 28px rgba(191, 127, 47, 0.22);
}

.create-choice-song {
  color: #1f6f99;
  background: linear-gradient(135deg, #ecf8ff, #b9def7);
  box-shadow: 0 8px 18px rgba(77, 142, 181, 0.14);
}

.text-badge {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(91, 158, 196, 0.28);
  border-radius: 999px;
  background: rgba(236, 248, 255, 0.88);
  color: #1f6f99;
  font-size: 12px;
  font-weight: 800;
}

.text-badge.active {
  color: #fff;
  border-color: #1f6f99;
  background: #1f6f99;
}

.folder-tree, .song-list { display: grid; gap: 2px; }
.folder-tree {
  align-content: start;
  gap: 0;
}
.song-list { gap: 0; align-content: start; }
.playlist-list { display: grid; gap: 2px; max-height: 116px; overflow-y: auto; scrollbar-width: thin; }
.playlist-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.playlist-open {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #24445b;
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.playlist-open span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-open:hover { border-color: rgba(91, 158, 196, 0.32); background: rgba(220, 240, 253, 0.75); }
.playlist-shared { color: #2f85b8; font-size: 14px; font-weight: 900; }
.library-song-list-block {
  display: flex;
  flex: 1 1 160px;
  min-height: 72px;
  overflow: hidden;
}
#librarySongList {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
#librarySongList::-webkit-scrollbar { display: none; }
.folder-btn, .song-btn, .folder-row {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 11px;
  min-height: 30px;
  background: rgba(255, 253, 248, 0.78);
  color: #29251f;
  padding: 4px 8px;
  text-align: left;
  font-size: 16px;
}

.folder-row {
  min-height: auto;
  padding: 0;
  gap: 6px;
}

.folder-btn {
  width: auto;
  min-height: auto;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  align-self: flex-start;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.folder-icon {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: var(--folder-icon-color, #5e8df6);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--folder-icon-color, #5e8df6) 16%, transparent);
}

.folder-btn.active {
  color: #153d57;
  background: linear-gradient(135deg, rgba(235, 247, 255, 0.98), rgba(207, 232, 250, 0.96));
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(91, 158, 196, 0.34), 0 8px 18px rgba(77, 142, 181, 0.12);
  padding-block: 3px;
  padding-right: 9px;
}

.song-btn.active, .folder-row.active, .song-row.active .song-btn {
  color: #153d57;
  border-color: rgba(91, 158, 196, 0.42);
  background: linear-gradient(135deg, rgba(235, 247, 255, 0.98), rgba(207, 232, 250, 0.94));
  box-shadow: 0 10px 22px rgba(77, 142, 181, 0.12);
}
.song-row.active {
  background: transparent;
  box-shadow: none;
}
.song-row.active .song-btn {
  border-color: rgba(91, 158, 196, 0.34);
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(91, 158, 196, 0.18), 0 6px 14px rgba(77, 142, 181, 0.09);
}
.song-btn:focus-visible { outline: 2px solid #72b6dc; outline-offset: 1px; }
.song-btn {
  min-height: 26px;
  padding: 2px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.15;
}
.folder-row, .song-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.folder-row .folder-btn { flex: 1; }
.song-row .song-btn { flex: 1; min-width: 0; }
.folder-row .mini-btn {
  min-width: 22px;
  min-height: 22px;
  padding: 0 4px;
  font-size: 12px;
}
.song-row {
  min-height: 28px;
  padding: 0;
}
.song-row .mini-btn {
  min-width: 24px;
  min-height: 24px;
  padding: 0 5px;
  font-size: 13px;
}
.favorite-mini {
  color: #2b78a6;
  border-color: rgba(91, 158, 196, 0.32) !important;
  background: rgba(229, 244, 253, 0.86) !important;
}
.favorite-mini.active {
  color: #17628f;
  background: linear-gradient(135deg, #dff3ff, #b9def7) !important;
}
.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f4a6c4, #d85b91);
  color: #fffaf2;
  font-size: 9px;
  font-weight: 900;
}

.search-input { margin: 0; }

.reader {
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-rows: 1fr;
  height: calc(100dvh - 36px - env(safe-area-inset-bottom));
  padding: 0;
  background: transparent;
  box-shadow: none;
  width: 100%;
}

.reader-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px;
  border-radius: 28px;
  background: rgba(255, 250, 242, 0.82);
  box-shadow: 0 26px 70px rgba(72, 55, 38, 0.12);
  backdrop-filter: blur(10px);
}

.song-pager {
  position: static;
  z-index: 8;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 8px;
  transform: none;
}

.song-pager button {
  min-width: 46px;
  min-height: 46px;
  border: 1px solid #e3d8c8;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.92);
  color: #29251f;
  box-shadow: 0 8px 22px rgba(72, 55, 38, 0.07);
  font-size: 20px;
}

.pager-edit-btn { color: #1f6f99 !important; }

.global-song-actions {
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
}

.global-song-actions-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.lyrics {
  display: grid;
  gap: 14px;
  font-size: var(--reader-size);
  line-height: 1.42;
  padding: 0;
}

.lyrics-section, .section { display: grid; gap: 5px; }
.lyrics-section + .lyrics-section, .section + .section { margin-top: 5px; padding-top: 15px; border-top: 1px solid rgba(129, 117, 104, 0.22); }
.lyrics-section h3, .section-header { margin: 0 0 8px; color: #bf7f2f; font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.12em; }
.lyrics-section p, .line-text { white-space: pre-wrap; }
.line { display: flex; align-items: flex-start; gap: 6px; }
.youtube-block { margin-top: 24px; }
.youtube-block iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 16px; background: #1b211f; }

.catalog-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 8px;
}

.catalog-toggle {
  grid-row: 1 / 4;
  grid-column: 2;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(91, 158, 196, 0.36);
  border-radius: 999px;
  color: #17628f;
  background: linear-gradient(135deg, #ecf8ff, #c9e8fb);
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(77, 142, 181, 0.14);
}
.catalog-toggle.added {
  color: #315a77;
  background: #e8f1f7;
}
.catalog-toggle:disabled { cursor: default; opacity: 0.82; }

.song-action-list { display: grid; gap: 10px; padding: 18px 20px 22px; }
.song-action-list button { width: 100%; }

.reorder-save-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(91, 158, 196, 0.24);
  background: rgba(240, 248, 254, 0.96);
  box-shadow: 0 -12px 30px rgba(54, 112, 148, 0.12);
}
.reorder-item { transition: background-color 160ms ease, transform 160ms ease; }
.reorder-item.dragging { opacity: 0.62; background: rgba(194, 227, 248, 0.72); }
.reorder-item.reorder-drop-target { background: rgba(218, 239, 252, 0.88); }
.reorder-handle {
  width: 30px;
  min-width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(91, 158, 196, 0.34);
  border-radius: 9px;
  color: #216f9b;
  background: linear-gradient(135deg, #e9f7ff, #c9e7f8);
  cursor: grab;
  touch-action: none;
  font-size: 17px;
  font-weight: 800;
}
.reorder-handle:active { cursor: grabbing; }

.folder-picker-list { display: grid; gap: 3px; }
.folder-picker-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  border-radius: 10px;
  padding: 6px 10px;
  color: #263f52;
  background: rgba(236, 248, 255, 0.58);
  cursor: pointer;
}
.folder-picker-option input {
  width: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: #2f85b8;
}
.editor-folder-fieldset {
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid rgba(91, 158, 196, 0.28);
  border-radius: 14px;
}
.editor-folder-fieldset legend { padding: 0 6px; color: var(--muted); }
.editor-folder-list { max-height: 150px; overflow-y: auto; }

.playlist-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
}
.playlist-dialog-list { display: grid; gap: 3px; padding: 0 18px 20px; }
.playlist-song-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 34px 34px;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 4px 8px;
  border-radius: 11px;
  background: rgba(231, 244, 252, 0.64);
}
.playlist-song-row > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-song-row button, .public-playlist-pager button, .playlist-library-toggle {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(91, 158, 196, 0.34);
  border-radius: 999px;
  color: #1f6f99;
  background: linear-gradient(135deg, #ecf8ff, #c9e8fb);
  font-weight: 900;
}
.playlist-song-number { color: #4380a5; font-size: 12px; font-weight: 900; }
.playlist-song-check-number { width: 18px; color: #2f85b8; font-weight: 900; }

.public-song-page {
  overflow: auto;
  background: linear-gradient(180deg, #eef6fb, #f8fbff 24%, #edf4fb);
}

.public-song-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.public-song-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-bottom: 18px;
  padding: 0 16px;
  border: 1px solid rgba(91, 158, 196, 0.28);
  border-radius: 999px;
  color: #1f6f99;
  background: rgba(236, 248, 255, 0.88);
  text-decoration: none;
  font-weight: 800;
}

.public-song-card {
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 24px 60px rgba(77, 142, 181, 0.16);
}
.public-playlist-shell { width: min(1060px, calc(100% - 24px)); }
.public-playlist-header { margin-bottom: 12px; color: #24445b; }
.public-playlist-header > span { color: #2f85b8; font-size: 12px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.public-playlist-header h1 { margin: 4px 0; font-size: clamp(24px, 4vw, 38px); }
.public-playlist-header small { color: #5d7180; }
.public-playlist-list {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 5px;
  overflow-x: auto;
}
.public-playlist-item {
  flex: 0 0 auto;
  max-width: 240px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid rgba(91, 158, 196, 0.28);
  border-radius: 12px;
  color: #24445b;
  background: rgba(255, 255, 255, 0.76);
  text-align: left;
}
.public-playlist-item span, .public-playlist-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-playlist-item small { color: #657b8b; }
.public-playlist-item.active { border-color: #4fa7df; background: #dff2ff; box-shadow: 0 8px 18px rgba(77, 142, 181, 0.12); }
.public-playlist-song { position: relative; }
.playlist-library-toggle { position: absolute; top: 12px; right: 12px; z-index: 2; font-size: 22px; }
.public-playlist-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.public-playlist-pager span { min-width: 64px; color: #496b82; text-align: center; font-weight: 800; }

.editor {
  position: fixed;
  top: 24px;
  bottom: 24px;
  left: 50%;
  z-index: 60;
  width: min(560px, calc(100% - 24px));
  transform: translateX(-50%);
  overflow: auto;
  border: 1px solid #e3d8c8;
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 22px 60px rgba(72, 55, 38, 0.16);
  padding: 18px;
}

.song-form { display: grid; gap: 14px; }
.song-form label { display: grid; gap: 7px; color: var(--muted); }
.song-form textarea { min-height: 320px; resize: vertical; line-height: 1.5; }
.check-label { display: flex !important; align-items: center; gap: 8px; }
.check-label input { width: auto; min-height: auto; }

@media (max-width: 760px) {
  .reader { height: calc(100dvh - 24px - env(safe-area-inset-bottom)); }
  .reader-frame { min-height: 0; padding: 11px; border-radius: 20px; }
  .drawer { width: min(92vw, 380px); }
  .playlist-list { max-height: 86px; }
  .playlist-dialog-actions { padding: 10px; }
  .playlist-dialog-list { padding: 0 10px 16px; }
  .public-playlist-shell { width: calc(100% - 16px); padding-top: 10px; }
  .public-playlist-item { max-width: 190px; }
  .public-playlist-song { padding-top: 54px; }
  .shell { width: calc(100% - 20px); height: 100dvh; padding: 12px 10px max(12px, env(safe-area-inset-bottom)); }
  .drawer-head { align-items: center; gap: 8px; }
  .brand-title { font-size: 18px; letter-spacing: 0.04em; }
  .brand-kicker { font-size: 10px; letter-spacing: 0.1em; }
  .drawer-head-actions { gap: 6px; justify-content: flex-end; }
  .drawer-admin-button {
    min-height: 32px;
    padding-inline: 8px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }
  .door-btn {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }
  .font-tools {
    gap: 4px;
    justify-content: space-between;
  }
  .font-tools button {
    min-width: 30px;
    min-height: 30px;
    padding: 4px 7px;
    font-size: 13px;
  }
  #fontSizeLabel {
    min-width: 38px;
    font-size: 11px;
  }
  .scroll-toggle {
    min-width: 28px;
    min-height: 30px;
    padding-inline: 5px;
  }
  .scroll-toggle input {
    width: 16px;
    height: 16px;
  }
  .scroll-speed-control { gap: 3px; }
  .scroll-speed-control button {
    min-width: 24px;
    min-height: 24px;
    padding: 3px 5px;
    font-size: 13px;
  }
  .scroll-speed-input {
    width: 38px;
    min-height: 28px;
    font-size: 11px;
  }
  .public-song-shell { width: calc(100% - 20px); padding-top: 14px; }
  .public-song-card { padding: 12px; border-radius: 20px; }
}
