/* 赞美诗 - shared styles (navy/gold theme, one mobile breakpoint) */
:root {
  --navy: #16213e;
  --navy2: #1f3a5f;
  --gold: #f0a500;
  --gold-soft: #fdf3dd;
  --ink: #24292f;
  --muted: #7a8494;
  --line: #e6e8ec;
  --bg: #f4f5f7;
  --ok: #1a9e5c;
  --warn: #d97706;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--navy2); text-decoration: none; }
a:hover { color: var(--gold); }

header.top {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
  color: #fff;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}
#welcomeBar:not([hidden]) { position: fixed; left: 0; right: 0; z-index: 49; }
.brand { font-size: 19px; font-weight: 700; white-space: nowrap; }
.brand .note { color: var(--gold); }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a {
  color: rgba(255,255,255,.85);
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 14px;
}
nav a:hover, nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.nav-toggle {
  display: none;
  background: rgba(255,255,255,.14);
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(255,255,255,.24); }
header .spacer { flex: 1; }
.nav-search {
  border: none; border-radius: 7px; padding: 7px 12px; font-size: 14px;
  width: 180px; max-width: 36vw; outline: none; background: rgba(255,255,255,.92);
}
.nav-search:focus { background: #fff; }
.searchbox { display: flex; gap: 6px; }
.searchbox input {
  border: none; border-radius: 7px; padding: 7px 12px; font-size: 14px;
  width: 200px; outline: none;
}
.welcome-bar {
  background: var(--gold-soft);
  color: #8a5a00;
  text-align: center;
  padding: 8px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f0e2c0;
}
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 90px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; margin-bottom: 16px;
}
h1 { font-size: 20px; margin-bottom: 12px; }
h2 { font-size: 16px; margin-bottom: 10px; color: var(--navy); }
.muted { color: var(--muted); font-size: 13px; }
.stats-strip { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.stats-strip b { color: var(--navy); font-size: 15px; margin-right: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 7px 13px; font-size: 14px; cursor: pointer;
  transition: all .12s;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy2); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.gold:hover { background: #d89500; color: #fff; }
.btn.small { padding: 4px 9px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.on { background: var(--gold-soft); border-color: var(--gold); color: #8a5a00; }

input[type=text], input[type=email], input[type=password], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
label { font-size: 13px; color: var(--muted); display: block; margin: 10px 0 4px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafbfc; }
table.grid tr:hover td { background: #fafbfc; }
td.num { font-variant-numeric: tabular-nums; color: var(--navy); font-weight: 600; width: 74px; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.book-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; cursor: pointer; transition: all .14s;
}
.book-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(22,33,62,.08); }
.book-card .t { font-weight: 700; font-size: 16px; margin-bottom: 6px; color: var(--navy); }
.book-card .s { font-size: 13px; color: var(--muted); line-height: 1.7; }
.book-card .s b { color: var(--gold); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; }
.pill.ok { background: #e7f6ee; color: var(--ok); }
.pill.no { background: #f1f2f4; color: var(--muted); }
.pill.gold { background: var(--gold-soft); color: #8a5a00; }
.pill.green { background: #e7f6ee; color: var(--ok); }
.pill.blue { background: #e7f0fb; color: #1f6fd6; }

.banner {
  border-radius: 10px; padding: 12px 16px; font-size: 14px; margin-bottom: 16px;
  background: var(--gold-soft); color: #8a5a00; border: 1px solid #f0e2c0;
}
.banner a { color: #8a5a00; text-decoration: underline; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 14px; z-index: 300; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: .95; }

/* ---------- viewer ---------- */
.viewer { display: grid; grid-template-columns: 1fr 340px; gap: 14px; margin-bottom: 14px; }
.score-pane {
  background: #3a3f4a; border-radius: 12px; overflow: hidden;
  height: calc(100vh - 210px); min-height: 420px; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.score-pane img { max-width: 100%; max-height: 100%; display: none; user-select: none; -webkit-user-drag: none; }
.score-pane.drag { cursor: grab; }
.score-pane.drag:active { cursor: grabbing; }
.score-tools {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; background: rgba(0,0,0,.4); padding: 5px 7px;
  border-radius: 9px; z-index: 5; pointer-events: none;
}
.score-tools .btn { pointer-events: auto; background: rgba(255,255,255,.92); border: none; padding: 5px 10px; font-size: 13px; }
.score-empty { color: rgba(255,255,255,.65); font-size: 14px; text-align: center; padding: 20px; }

.side-pane { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.tabs { display: flex; gap: 4px; }
.tabs .btn { flex: 1; justify-content: center; }
.pane-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: calc(100vh - 280px); }
.song-list { list-style: none; }
.song-list li {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px;
}
.song-list li:last-child { border-bottom: none; }
.song-list li:hover { background: #fafbfc; }
.song-list li.on { background: var(--gold-soft); }
.song-list .no { color: var(--navy); font-weight: 700; min-width: 44px; font-variant-numeric: tabular-nums; }
.song-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-list .mk { font-size: 12px; }
.lyrics { padding: 14px 16px; font-size: 15px; line-height: 2.05; white-space: pre-wrap; }
.lyrics .lrc-line { padding: 1px 4px; border-radius: 4px; color: var(--muted); }
.lyrics .lrc-line.on { color: var(--navy); font-weight: 700; background: var(--gold-soft); }
.lyrics-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.player-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: #fff; border-top: 1px solid var(--line);
  padding: 7px 16px 9px; box-shadow: 0 -4px 18px rgba(22,33,62,.06);
  display: flex; flex-direction: column; gap: 6px;
}
.pb-top { display: flex; align-items: center; min-width: 0; }
.player-bar .np { font-size: 14px; min-width: 0; flex: 1; line-height: 1.3; }
.player-bar .np b { color: var(--navy); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-bar .np .sub { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-bottom { display: flex; align-items: center; gap: 14px; }
.pb-controls { display: flex; align-items: center; gap: 8px; }
.pb-progress { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.pb-settings { display: flex; align-items: center; gap: 6px; }
.pb-settings .pbtn { width: auto; min-width: 34px; height: 34px; border-radius: 17px; padding: 0 10px; font-size: 12px; gap: 4px; }
.pbtn {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--navy); color: #fff; font-size: 15px; display: inline-flex;
  align-items: center; justify-content: center;
}
.pbtn:hover { background: var(--navy2); }
.pbtn.ghost { background: #eef0f3; color: var(--ink); width: 34px; height: 34px; font-size: 13px; }
.pbtn.ghost:hover { background: var(--gold-soft); color: #8a5a00; }
.progress { flex: 1; height: 6px; background: #eef0f3; border-radius: 4px; cursor: pointer; position: relative; }
.progress .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); border-radius: 4px; width: 0; }
.vol-wrap { position: relative; display: inline-flex; }
.vol-pop {
  position: absolute; bottom: calc(100% + 10px); right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; box-shadow: 0 6px 20px rgba(22,33,62,.14); z-index: 120;
}
.vol-pop input[type=range] { width: 120px; }
@media (max-width: 860px) {
  .player-bar { padding: 6px 10px 8px; gap: 5px; }
  /* Keep play button, timeline and the other buttons on a single row. */
  .pb-bottom { gap: 8px; }
  .pb-controls { gap: 6px; }
  .pb-progress { min-width: 60px; }
  .pb-settings .pbtn { padding: 0 8px; }
}

/* ---------- forms ---------- */
.form-page { max-width: 400px; margin: 40px auto; }
.form-page .card { padding: 26px; }
.form-page h1 { text-align: center; margin-bottom: 6px; }
.form-page input { width: 100%; }
.form-page label { margin: 14px 0 6px; }
.form-page .btn { width: 100%; justify-content: center; margin-top: 20px; padding: 10px 12px; font-size: 15px; }
.form-msg { font-size: 13px; margin-top: 10px; text-align: center; min-height: 18px; }
.form-msg.err { color: #c0392b; }
.form-msg.ok { color: var(--ok); }

/* ---------- pager ---------- */
.pager { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.pager .btn { min-width: 32px; justify-content: center; }
.pager-gap { color: var(--muted); padding: 0 2px; font-size: 13px; }
.pager-info { color: var(--muted); font-size: 12px; margin-left: auto; padding-left: 10px; }
table.grid .pager { grid-column: 1 / -1; }
.book-grid .pager { grid-column: 1 / -1; justify-content: flex-end; }

/* ---------- download progress ---------- */
.dl-box { margin-top: 14px; border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: rgba(22,33,62,.03); }
.dl-head { font-weight: 600; margin-bottom: 8px; color: var(--navy); }
.dl-list { max-height: 240px; overflow: auto; font-size: 13px; line-height: 1.7; }
.dl-item { padding: 1px 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-item.ok { color: var(--ok); }
.dl-item.fail { color: #c0392b; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; align-items: center; }
.kv .k { color: var(--muted); }
.assign-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.assign-row .pid { font-weight: 700; color: var(--navy); min-width: 76px; }
.assign-row .meta { color: var(--muted); font-size: 12px; flex: 1; min-width: 140px; }
.assign-row select { max-width: 220px; }

@media (max-width: 860px) {
  .viewer { grid-template-columns: 1fr; }
  .score-pane { height: 58vh; }
  .pane-box { max-height: 46vh; }
  header.top { gap: 8px; padding: 8px 12px; }
  .searchbox input { width: 130px; }
  .player-bar .np { min-width: 120px; }
  main { padding-bottom: 110px; }

  /* Collapsible nav: hamburger + dropdown panel */
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  header.top nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    padding: 8px 12px 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,.25);
  }
  header.top nav.open { display: flex; }
  header.top nav a { padding: 10px 12px; font-size: 15px; }
  header.top > span { display: none; } /* hide user email on phones */
  .nav-search { width: 120px; }
}
