/* 留聲閣 — 纸墨金石
   光源与物体一致：左上 45°。材质图见 web/assets/tex/ */

:root {
  --ink: #1a1712;
  --ink-2: #3f382e;
  --ink-3: #6d6354;
  --paper: #ece1cb;
  --cinnabar: #a6332b;
  --cinnabar-d: #7d211a;
  --jade: #5f7b64;

  --f-kai: "KaiTi", "STKaiti", "楷体", "SimSun", serif;
  --f-fang: "FangSong", "STFangsong", "仿宋", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: #ece1cb url("../tex/paper.jpg") center center / cover no-repeat fixed;
  color: var(--ink);
  font-family: var(--f-fang);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 50% at 26% 12%, rgba(255, 253, 244, .55), transparent 62%),
    radial-gradient(92% 82% at 80% 98%, rgba(72, 50, 24, .28), transparent 68%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 250px rgba(56, 36, 14, .42), inset 0 0 70px rgba(48, 30, 12, .22);
}

[hidden] { display: none !important; }

button { font-family: inherit; cursor: pointer; }

/* ═══════════════════════════ 登录 ═══════════════════════════ */

.lock {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}

.lock__card {
  width: min(360px, 88vw);
  padding: 38px 34px 26px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, .5), rgba(238, 228, 208, .2)),
    url("../tex/paper.jpg") center / 620px;
  border: 1px solid rgba(60, 44, 24, .28);
  box-shadow:
    0 30px 50px -30px rgba(50, 32, 12, .6),
    inset 0 0 0 1px rgba(255, 255, 255, .4),
    inset 0 0 60px rgba(120, 92, 56, .16);
}

.lock__title {
  margin: 0;
  font-family: var(--f-kai);
  font-size: 38px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: #17140f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

.lock__sub {
  margin: 10px 0 26px;
  font-size: 11.5px;
  letter-spacing: .22em;
  color: var(--ink-3);
}

.lock__field { display: block; }

.lock__input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(70, 52, 30, .38);
  background: rgba(255, 252, 244, .6);
  font-family: var(--f-kai);
  font-size: 17px;
  letter-spacing: .3em;
  text-align: center;
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 2px 5px rgba(70, 50, 24, .16);
}

.lock__input:focus { border-color: rgba(166, 51, 43, .65); }

.lock__btn {
  width: 100%;
  height: 42px;
  margin-top: 14px;
  border: 1px solid rgba(80, 22, 16, .6);
  background: linear-gradient(180deg, #b03a30, #8d2a20);
  color: #f6ecdb;
  font-family: var(--f-kai);
  font-size: 17px;
  letter-spacing: .4em;
  text-indent: .4em;
  box-shadow: 0 10px 18px -12px rgba(80, 16, 10, .9), inset 0 1px 0 rgba(255, 210, 190, .4);
}

.lock__btn:hover { filter: brightness(1.06); }

.lock__err {
  min-height: 16px;
  margin: 12px 0 0;
  font-size: 11.5px;
  letter-spacing: .1em;
  color: var(--cinnabar-d);
}

/* ═══════════════════════════ 主框架 ═══════════════════════════ */

.shell {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 292px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0 22px;
  padding: 30px 38px 22px;
}

/* ── 左侧 ── */
.side {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-height: 0;
}

.brand {
  writing-mode: vertical-rl;
  margin: 0;
  font-family: var(--f-kai);
  font-size: clamp(38px, 3.5vw, 54px);
  letter-spacing: .14em;
  color: #14120d;
  text-shadow: 0 1px 0 rgba(255, 252, 244, .5), 0 -1px 0 rgba(0, 0, 0, .18);
}

.seal {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  border-radius: 2px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .12), rgba(0, 0, 0, .45)),
    url("../tex/cinnabar.jpg") center / 88px,
    #93281f;
  color: #f2e8d5;
  font-family: var(--f-kai);
  font-size: 19px;
  line-height: 1;
  transform: rotate(-2.4deg);
  box-shadow: 0 9px 14px -9px rgba(60, 14, 8, .85), inset 0 0 0 2px rgba(242, 232, 213, .16);
  text-shadow: 0 1px 1px rgba(50, 10, 6, .85);
}

.now {
  margin-top: auto;
  padding-bottom: 8px;
  text-align: center;
  writing-mode: horizontal-tb;
  max-width: 100%;
}

.now__k {
  margin: 0 0 6px;
  font-size: 10px;
  letter-spacing: .34em;
  color: var(--cinnabar);
  opacity: .8;
}

.now__title {
  margin: 0;
  font-family: var(--f-kai);
  font-size: 21px;
  letter-spacing: .08em;
  line-height: 1.3;
  color: #17140f;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.now__meta {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 中间：灵枢盘 ── */
.hall {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
}

.altar {
  position: relative;
  width: min(74vh, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.altar::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -1%;
  height: 15%;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(56, 36, 12, .5), transparent 72%);
  filter: blur(16px);
  z-index: 0;
}

.altar__rotor {
  position: absolute;
  inset: 0;
  z-index: 1;
  animation: spin 40s linear infinite;
  animation-play-state: paused;
  will-change: transform;
}

.altar.is-playing .altar__rotor { animation-play-state: running; }

@keyframes spin { to { transform: rotate(360deg); } }

.altar__plate {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.mirror {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 41%;
  height: 41%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  overflow: hidden;
  background: #241c13;
  box-shadow:
    0 0 0 3px rgba(14, 9, 5, .9),
    0 0 0 5px rgba(184, 148, 96, .5),
    0 0 0 6px rgba(24, 15, 8, .6),
    inset 0 0 40px rgba(0, 0, 0, .75);
}

.mirror img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  filter: sepia(.12) contrast(1.06) brightness(.84) saturate(.94);
  transition: opacity .6s ease;
}

.mirror img.is-on { opacity: 1; }

.mirror::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    linear-gradient(126deg, rgba(255, 252, 240, .22) 0 9%, transparent 26%),
    radial-gradient(44% 30% at 50% -10%, rgba(255, 255, 255, .18), transparent 62%),
    radial-gradient(74% 66% at 74% 94%, rgba(0, 0, 0, .38), transparent 62%);
  mix-blend-mode: screen;
  pointer-events: none;
}

/* 玉笛 */
.altar__flute {
  position: absolute;
  top: -3.5%;
  left: 50%;
  width: 64%;
  height: auto;
  transform: translateX(-50%) rotate(-7deg);
  transform-origin: 50% 100%;
  transition: transform 1.1s cubic-bezier(.32, .9, .28, 1), filter 1.1s;
  filter: drop-shadow(0 18px 14px rgba(28, 18, 6, .35));
  user-select: none;
  -webkit-user-drag: none;
  z-index: 3;
}

.altar.is-playing .altar__flute {
  transform: translateX(-50%) translateY(15%) rotate(-1.5deg);
  filter: drop-shadow(0 10px 10px rgba(28, 18, 6, .45));
}

.altar__flute-shadow {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 52%;
  height: 4%;
  transform: translateX(-50%) rotate(-7deg);
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, .55), transparent 74%);
  filter: blur(9px);
  opacity: 0;
  transition: opacity 1s ease, top 1s ease;
  z-index: 2;
}

.altar.is-playing .altar__flute-shadow {
  opacity: .8;
  top: 22%;
}

/* ── 右侧：歌词 ── */
.verse {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 6px;
}

.verse__head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(60, 44, 24, .22);
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--ink-3);
}

.verse__view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
}

.verse__list {
  list-style: none;
  margin: 0;
  padding: 0;
  transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}

.verse__list li {
  padding: 7px 0;
  font-family: var(--f-kai);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: .06em;
  color: var(--ink-3);
  opacity: .72;
  transition: color .35s, font-size .35s, opacity .35s;
  cursor: pointer;
}

.verse__list li:hover { color: var(--ink-2); opacity: 1; }

.verse__list li.is-on {
  font-size: 19px;
  color: var(--cinnabar);
  opacity: 1;
  text-shadow: 0 0 18px rgba(166, 51, 43, .22);
}

.verse__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-size: 12px;
  letter-spacing: .3em;
  color: var(--ink-3);
  opacity: .6;
}

/* ── 底部：玉简 ── */
.slip {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: center;
  position: relative;
  width: min(940px, 100%);
  height: 132px;
  margin-top: 6px;
  padding: 16px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(232, 244, 234, .10), rgba(92, 120, 96, .28) 42%, rgba(34, 58, 42, .44)),
    url("../tex/jade.jpg") center / 660px,
    #5c7660;
  box-shadow:
    0 22px 36px -26px rgba(18, 28, 20, .95),
    0 1px 0 rgba(255, 255, 255, .38) inset,
    0 -5px 12px rgba(20, 36, 26, .55) inset,
    0 0 0 1px rgba(40, 58, 44, .75);
}

.slip__bg { display: none; }

.slip__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
}

.slip__time {
  font-size: 11.5px;
  letter-spacing: .1em;
  color: #2f3d29;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
  min-width: 44px;
}

.slip__time:last-of-type { text-align: right; }

.bar {
  position: relative;
  flex: 1;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.bar::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: rgba(28, 40, 28, .38);
  box-shadow: inset 0 1px 2px rgba(10, 18, 12, .6), 0 1px 0 rgba(255, 255, 255, .3);
}

.bar__fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #6f1c16, #a6332b 60%, #c0553a);
  box-shadow: 0 0 8px rgba(166, 51, 43, .45);
}

.bar__bead {
  position: absolute;
  left: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #e2a086, #9c3327 52%, #57110b);
  box-shadow: 0 2px 4px rgba(40, 10, 6, .65);
  pointer-events: none;
}

.slip__keys {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 6px;
}

.kbtn {
  min-width: 40px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(60, 42, 22, .35);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, .75), rgba(226, 212, 186, .55));
  color: var(--ink-2);
  font-family: var(--f-kai);
  font-size: 13px;
  letter-spacing: .12em;
  box-shadow: 0 2px 0 rgba(255, 255, 255, .5) inset, 0 6px 10px -8px rgba(60, 40, 16, .7);
  transition: .2s;
}

.kbtn:hover { color: var(--ink); border-color: rgba(166, 51, 43, .5); }
.kbtn:active { transform: translateY(1px); }

.kbtn--main {
  min-width: 56px;
  height: 42px;
  border-color: rgba(90, 24, 18, .55);
  background: linear-gradient(180deg, #b03a30, #8a281f);
  color: #f7eddc;
  font-size: 15px;
  box-shadow: 0 8px 14px -10px rgba(90, 20, 12, .9), inset 0 1px 0 rgba(255, 210, 190, .45);
}

.kbtn--main:hover { color: #fff; }

.kbtn--main .i-pause { display: none; }
.kbtn--main.is-playing .i-play { display: none; }
.kbtn--main.is-playing .i-pause { display: inline; }

.kbtn--mode { color: var(--jade); }
.kbtn--lib b { color: var(--cinnabar); font-weight: 400; }

.vol {
  display: flex;
  align-items: center;
  padding: 0 6px;
}

.vol input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 78px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cinnabar) var(--v, 80%), rgba(40, 52, 40, .3) var(--v, 80%));
  outline: none;
}

.vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #e2a086, #9c3327 55%, #57110b);
  box-shadow: 0 1px 3px rgba(40, 10, 6, .7);
}

/* ═══════════════════════════ 曲库（竹简） ═══════════════════════════ */

.shelf {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  padding: 18px 18px 12px;
  background:
    linear-gradient(90deg, rgba(255, 250, 238, .55), rgba(240, 228, 204, .5)),
    url("../tex/bamboo.jpg") center / 420px,
    #e8dcbe;
  border-left: 1px solid rgba(60, 42, 20, .35);
  box-shadow: -30px 0 60px -34px rgba(50, 32, 10, .6), inset 2px 0 0 rgba(255, 255, 255, .35);
  transform: translateX(103%);
  transition: transform .42s cubic-bezier(.22, .61, .36, 1);
}

.shelf.is-open { transform: none; }

.shelf__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
}

.tabs { display: flex; gap: 6px; }

.tab {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--f-kai);
  font-size: 13px;
  letter-spacing: .1em;
  transition: .2s;
}

.tab:hover { color: var(--ink); }

.tab.is-on {
  color: #f7eddc;
  border-color: rgba(90, 24, 18, .5);
  background: linear-gradient(180deg, #b03a30, #8a281f);
}

.shelf__close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(60, 42, 22, .3);
  border-radius: 2px;
  background: rgba(255, 252, 244, .5);
  color: var(--ink-3);
  font-size: 12px;
}

.shelf__search {
  display: block;
  margin-bottom: 10px;
}

.shelf__search input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(60, 42, 22, .3);
  background: rgba(255, 252, 244, .55);
  font-family: var(--f-fang);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 2px 4px rgba(60, 40, 16, .12);
}

.shelf__search input::placeholder { color: rgba(90, 74, 52, .55); }

.tracks {
  flex: 1;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 0 4px 6px 0;
  overflow-y: auto;
}

.track {
  display: grid;
  grid-template-columns: 22px 38px minmax(0, 1fr) auto 26px;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  margin-bottom: 2px;
  border-bottom: 1px dashed rgba(70, 52, 28, .22);
  cursor: pointer;
  transition: background .2s;
}

.track:hover { background: rgba(255, 252, 244, .45); }

.track.is-on { background: rgba(166, 51, 43, .10); }
.track.is-drag { opacity: .4; }
.track.is-over { box-shadow: inset 0 2px 0 var(--cinnabar); }

.track__idx {
  font-family: var(--f-mono, "Consolas", monospace);
  font-size: 10px;
  color: var(--ink-3);
  text-align: right;
}

.track.is-on .track__idx { color: var(--cinnabar); }

.track__art {
  width: 38px;
  height: 38px;
  border-radius: 2px;
  background-color: #cfc0a2;
  background-position: center;
  background-size: cover;
  box-shadow: 0 2px 5px -3px rgba(40, 26, 10, .8), 0 0 0 1px rgba(60, 42, 20, .35);
}

.track__meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.track__meta b {
  font-family: var(--f-kai);
  font-weight: 400;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track__meta i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track.is-on .track__meta b { color: var(--cinnabar); }

.track__time {
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.track__fav {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(90, 74, 52, .5);
  font-size: 13px;
  opacity: .55;
}

.track:hover .track__fav { opacity: 1; }
.track__fav.is-on { opacity: 1; color: var(--cinnabar); }

.library__empty {
  padding: 40px 10px;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: .16em;
  color: var(--ink-3);
  line-height: 2;
  list-style: none;
}

.shelf__foot {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(60, 42, 22, .25);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--ink-3);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(28, 22, 12, .38);
  opacity: 0;
  transition: opacity .35s;
}

.scrim.is-on { opacity: 1; }

/* ── 提示 ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 158px;
  z-index: 90;
  transform: translate(-50%, 12px);
  padding: 9px 20px;
  border: 1px solid rgba(60, 42, 22, .3);
  background: rgba(247, 240, 226, .95);
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: .12em;
  box-shadow: 0 14px 24px -18px rgba(40, 26, 10, .8);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── 窄屏 ── */
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 180px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 22px 24px 16px;
  }
  .verse { display: none; }
  .hall { grid-column: 2; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { flex-direction: row; align-items: center; gap: 14px; }
  .brand { writing-mode: horizontal-tb; font-size: 30px; }
  .now { margin: 0 0 0 auto; text-align: right; }
  .slip { transform: scale(.94); }
  .slip__row { padding: 22px 40px 0; }
  .vol { display: none; }
}
