:root {
  --bg: #000;
  --fg: #e8e8e8;
  --dim: #6b7280;
  --dim2: #9ca3af;
  --accent: #ffd866;
  --section: #94a3b8;
  --ok: #a3e635;
  --warn: #fbbf24;
  --err: #f87171;
  --bar-bg: #0a0a0a;
  --bar-border: #1f2937;
  --btn-bg: #1a1a1a;
  --btn-border: #374151;
  --rec-bg: #7f1d1d;
  --rec-border: #dc2626;
  --rec-active: #dc2626;
  --edit-bg: #1f2937;
  --edit-border: #facc15;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang TC", "Microsoft JhengHei", monospace;
  height: 100%; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ----- top bar ----- */
#topbar {
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-border);
  flex-shrink: 0;
  padding: 8px 12px 6px;
}
.title-line {
  display: flex; align-items: baseline; gap: 12px;
}
#title { font-size: 18px; margin: 0; color: var(--fg); font-weight: 600; }
#artist { color: var(--dim2); font-size: 13px; }

.meta-line {
  display: flex; align-items: center;
  gap: 8px;
  min-height: 34px;
}
.meta { cursor: pointer; padding: 2px 4px; border-radius: 3px; white-space: nowrap; }
.meta:hover { background: #111827; }
.meta em { font-style: normal; color: var(--fg); }
.meta em.empty { color: var(--dim); font-style: italic; }
.meta.editing { background: var(--edit-bg); }
.meta-edit {
  background: transparent;
  border: 1px solid var(--edit-border);
  color: var(--fg);
  font: inherit;
  padding: 1px 4px;
  width: 8em;
  border-radius: 2px;
  outline: none;
}

.btn {
  background: var(--btn-bg); color: var(--fg);
  border: 1px solid var(--btn-border);
  font: inherit; font-size: 13px; padding: 6px 12px;
  cursor: pointer; border-radius: 3px;
  -webkit-tap-highlight-color: transparent;
}
.btn.rec {
  background: var(--rec-bg); border-color: var(--rec-border); color: #fff;
  margin-left: auto;
  min-width: 78px;
}
.btn.rec.active { background: var(--rec-active); }
.btn.report.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}
.btn.add {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 32px;
  padding: 0;
  text-decoration: none;
  font-size: 19px;
  line-height: 1;
}
.btn.auth {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  height: 32px;
  padding: 0 9px;
  text-decoration: none;
}

.song-picker {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  background: var(--btn-bg);
  color: var(--fg);
  border: 1px solid var(--btn-border);
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
}

/* ----- body ----- */
.lyrics {
  flex: 1; overflow-y: auto;
  min-width: 0;
  padding: 28px 18px 4.8em;
  font-size: 25px; line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 700px) {
  .lyrics { font-size: 32px; padding: 36px 56px 4.8em; }
}
.section {
  font-size: 0.7em; color: var(--section);
  margin: 1.4em 0 0.4em;
  font-weight: normal; letter-spacing: 1px;
}
.bar {
  max-width: 100%;
  min-width: 0;
  margin: 0.1em 0 0.65em;
  cursor: text;
}
.correction-mode .bar {
  cursor: help;
}
.correction-mode .bar:hover .lyric-line {
  color: var(--accent);
}
.bar.editing { margin-bottom: 0.45em; }
.lyric-line {
  display: block;
  max-width: 100%;
  color: var(--fg);
  line-height: 1.2;
  white-space: normal;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lyric-edit {
  width: 100%;
  background: #111827;
  color: var(--fg);
  border: 1px solid var(--edit-border);
  border-radius: 4px;
  font: inherit;
  line-height: 1.25;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
}

/* ----- bottom bar ----- */
#bottombar {
  background: var(--bar-bg);
  border-top: 1px solid var(--bar-border);
  padding: 6px 12px;
  flex-shrink: 0;
  font-size: 11px;
}
#status { color: var(--dim); }
#status.ok { color: var(--ok); }
#status.warn { color: var(--warn); }
#status.err { color: var(--err); }
#status.dim { color: var(--dim); }

.hint { color: var(--dim); padding: 24px; }

.float-refresh {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(46px, calc(env(safe-area-inset-bottom) + 34px));
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--btn-border);
  background: rgba(26, 26, 26, 0.92);
  color: var(--fg);
  font: 24px/1 ui-monospace, Menlo, Consolas, monospace;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.float-refresh:active { background: #374151; }
