:root {
  --bg: #121014; --panel: #1c1920; --panel2: #25212b; --line: #34303b; --text: #f1ece4; --muted: #9a93a3;
  --accent: #e8a33d; --accent-ink: #1a1206; --rec: #e5484d; --ok: #46a758; --ghost: #c9b8f0;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f4ef; --panel: #ffffff; --panel2: #f0ebe3; --line: #ddd5ca; --text: #1e1a16; --muted: #6e665d;
    --accent: #b8741a; --accent-ink: #fff; --ghost: #6b4fb8; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; min-height: 40px; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; }
button.rec { background: var(--rec); color: #fff; border-color: transparent; font-weight: 600; }
button.on { outline: 2px solid var(--accent); }
button:disabled { opacity: .45; cursor: default; }
input, textarea, select { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; }
.muted { color: var(--muted); font-size: .9em; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 1.1rem; margin: 0; flex: 1; }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.card h2 { font-size: 1rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.songlist button { width: 100%; text-align: left; display: flex; justify-content: space-between; margin-bottom: 8px; padding: 12px 14px; }
.title-input { font-size: 1.3rem; font-weight: 600; background: transparent; border-color: transparent; padding-left: 0; }
.title-input:focus { border-color: var(--line); padding-left: 10px; }
.wave { width: 100%; height: 96px; display: block; border-radius: 8px; background: var(--panel2); touch-action: none; cursor: pointer; }
.time { font-variant-numeric: tabular-nums; min-width: 92px; }
.section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.section:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.section-name { font-weight: 600; max-width: 220px; }
.line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; margin: 6px 0; }
.line input { padding: 7px 9px; }
.line .syl { font-size: .8em; color: var(--muted); min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.line button { min-height: 34px; padding: 4px 8px; font-size: .85em; }
.pin.set { color: var(--accent); border-color: var(--accent); }
.ghostline { color: var(--ghost); font-style: italic; display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.ghostline span { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .85em; min-height: 0; }
.take { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.take:first-child { border-top: 0; }
.take .meta { font-size: .8em; color: var(--muted); }
.comment { padding: 8px 0; border-top: 1px solid var(--line); }
.comment b { margin-right: 6px; }
.banner { background: var(--panel2); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
pre.pack { white-space: pre-wrap; background: var(--panel2); border-radius: 8px; padding: 10px; max-height: 260px; overflow: auto; margin: 6px 0; }
ol.steps { padding-left: 20px; margin: 6px 0 10px; }
ol.steps li { margin-bottom: 4px; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: calc(100vw - 32px); }
.recording-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rec); display: inline-block; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
details summary { cursor: pointer; color: var(--muted); }
@media (max-width: 560px) {
  main { padding: 12px 16px; }
}
@media (max-width: 560px) {
  .take { grid-template-columns: auto 1fr; }
  .take > .row { grid-column: 1 / -1; }
}
.tools { margin: 0 0 8px; padding: 8px; background: var(--panel2); border-radius: 8px; }
.tools button { min-height: 34px; padding: 4px 10px; font-size: .85em; }
.booth { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom)); }
body.booth-open { overflow: hidden; }
.booth-top { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.booth .warn { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--panel2); border-left: 3px solid var(--accent); font-size: .9em; }
.meter { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .06s linear; }
.meter i.hot { background: var(--rec); }
.booth-lyrics { flex: 1; overflow-y: auto; padding: 8px 4px; font-size: 1.35rem; line-height: 1.5; }
.booth-sec { color: var(--muted); font-size: .7em; text-transform: uppercase; letter-spacing: .08em; margin: 14px 0 4px; }
.booth-line { opacity: .55; transition: opacity .15s; }
.booth-line.now { opacity: 1; color: var(--accent); font-weight: 600; }
.booth-bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.booth-bottom .time { font-size: 1.1rem; }
.booth-bottom > button:last-child { justify-self: end; }
.bigrec { width: 84px; height: 84px; border-radius: 50%; background: var(--rec); border: 4px solid var(--panel2); color: #fff; font-size: 1.6rem; }
.bigrec.live { animation: pulse 1s infinite; }
.booth-status { text-align: center; margin: 0; }
