:root { --fs: 32px; --bar: 52px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }

.theme-dark  { --bg: #000; --fg: #f5f5f0; --muted: #8b8b85; --accent: #f2c14e; --chorus: #ffe7a8; --panel: #161616; --line: #2a2a2a; }
.theme-light { --bg: #fffdf8; --fg: #111; --muted: #6b6b66; --accent: #a05a00; --chorus: #5a3500; --panel: #f1eee6; --line: #ddd8cc; }
body { background: var(--bg); color: var(--fg); }

/* top bar */
.bar { position: fixed; inset: 0 0 auto 0; height: var(--bar); padding: 0 8px; padding-top: env(safe-area-inset-top);
       display: flex; align-items: center; gap: 4px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 10; }
.bar button, .bar a { font: inherit; color: var(--fg); background: none; border: 0; cursor: pointer; text-decoration: none; }
.b { min-width: 40px; height: 40px; border-radius: 8px; font-size: 20px !important; display: inline-flex; align-items: center; justify-content: center; }
.b:hover:not(:disabled) { background: var(--line); }
.b:disabled { opacity: .3; cursor: default; }
.exit { font-size: 18px !important; color: var(--muted) !important; }
.now { flex: 1; min-width: 0; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 8px; }
.now:hover { background: var(--line); }
.pos { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.ttl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.caret { color: var(--muted); flex: none; }
.tools { display: flex; align-items: center; gap: 2px; }
.pill { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line) !important; font-size: 14px !important; white-space: nowrap; }
.pill.on { background: var(--accent) !important; color: #000 !important; border-color: var(--accent) !important; font-weight: 600; }
.b[hidden] { display: none; }
.menu-tools { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.menu-tools button { font: inherit; color: var(--fg); background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
@media (max-width: 640px) {
  .wide-only, #fs { display: none !important; }
  .b { min-width: 34px; }
  .pill { padding: 0 9px; }
}

/* song list dropdown */
.menu { position: fixed; top: calc(var(--bar) + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
        width: min(560px, 96vw); max-height: 70vh; overflow-y: auto; z-index: 20;
        background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 12px 12px; box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.menu-head { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.menu-head strong { color: var(--fg); }
.menu ol { margin: 0; padding: 6px 0 6px 44px; }
.menu li { padding: 0; color: var(--muted); }
.menu li button { width: 100%; text-align: left; font: inherit; font-size: 18px; color: var(--fg); background: none; border: 0; padding: 10px 12px 10px 4px; cursor: pointer; }
.menu li button:hover { color: var(--accent); }
.menu li button.on { color: var(--accent); font-weight: 700; }

/* the deck: one song per screen, swipe sideways between songs, scroll down inside a song */
.deck { position: fixed; inset: calc(var(--bar) + env(safe-area-inset-top)) 0 0 0; display: flex; overflow-x: auto; overflow-y: hidden;
        scroll-snap-type: x mandatory; scrollbar-width: none; outline: none; overscroll-behavior-x: contain; }
.deck::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; width: 100%; height: 100%; overflow-y: auto; scroll-snap-align: start; scroll-snap-stop: always; -webkit-overflow-scrolling: touch; }
.inner { max-width: 40em; margin: 0 auto; padding: 24px 20px 30vh; font-size: var(--fs); line-height: 1.35; }
.song-title { font-size: 1.15em; margin: 0 0 .1em; color: var(--accent); line-height: 1.2; }
.by { margin: 0 0 1em; font-size: .55em; color: var(--muted); }
.lyrics .sec { margin: 0 0 1em; }
.lyrics .lbl, .lyrics .cmt { font-size: .5em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 0 0 .25em; }
.lyrics .cmt { text-transform: none; letter-spacing: 0; font-style: italic; font-weight: 500; font-size: .6em; }
.lyrics .sec-chorus { padding-left: .6em; border-left: 4px solid var(--accent); color: var(--chorus); }
.lyrics .sec-bridge { padding-left: .6em; border-left: 4px dotted var(--muted); }
.lyrics .gap { height: .6em; }
.next-up { margin-top: 1.5em; padding-top: .6em; border-top: 1px solid var(--line); font-size: .5em; color: var(--muted); }

.banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--accent); color: #000; padding: 10px 14px;
          border-radius: 10px; font-size: 15px; z-index: 30; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.banner button { margin-left: 8px; font: inherit; font-weight: 700; border: 0; border-radius: 6px; padding: 4px 10px; background: #000; color: #fff; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); background: var(--panel); color: var(--fg); border: 1px solid var(--line);
         padding: 8px 14px; border-radius: 999px; font-size: 14px; z-index: 30; white-space: nowrap; }
[hidden] { display: none !important; }
