:root {
  --bg: #F6F5FC;
  --surface: #FFFFFF;
  --ink: #24223B;
  --muted: #7C7A96;
  --line: #E5E3F3;
  --purple: #9B9BF0;
  --purple-deep: #5B58C7;
  --purple-wash: #EEEDFC;
  --peach: #FF9A76;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--purple-deep); outline-offset: 2px; }
.muted { color: var(--muted); }

/* ---------- 按钮 / 输入 ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0 18px; height: 44px; white-space: nowrap; font-weight: 500; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--purple); }
.btn.primary { background: var(--purple-deep); border-color: var(--purple-deep); color: #fff; }
.btn.primary:hover { background: #4A47B4; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.block { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.toggle { color: var(--muted); }
.btn.toggle[aria-pressed="true"] { background: var(--purple-wash); border-color: var(--purple); color: var(--purple-deep); font-weight: 600; }
input { height: 44px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: var(--surface); min-width: 0; width: 100%; }
input::placeholder { color: #A9A7BF; }
input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-wash); }

.brand-mark { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .02em; color: var(--ink); text-decoration: none; }
.brand-mark .dot { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #fff 0 22%, var(--purple) 24%); }

/* ---------- 首页 ---------- */
.landing { min-height: 100%; display: grid; place-items: center; padding: 48px 24px; }
.landing-inner { width: min(520px, 100%); }
.landing h1 { font: 600 clamp(30px, 6vw, 44px)/1.3 var(--serif); margin: 28px 0 16px; letter-spacing: .01em; }
.lede { color: var(--muted); max-width: 30em; }
.landing-form { margin-top: 32px; }
.landing-form.quiet { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.landing-form label, .sheet label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.row { display: flex; gap: 10px; }

/* ---------- 房间框架 ---------- */
.room { height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.invite { display: inline-flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 6px 6px 14px; font-size: 13px; }
.invite b { font-weight: 600; letter-spacing: .08em; }
.invite-act { background: var(--surface); border-radius: 999px; padding: 4px 12px; color: var(--purple-deep); font-weight: 500; }
.invite:hover .invite-act { background: var(--purple-wash); }
.members { margin-left: auto; display: flex; align-items: center; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: #fff; flex: none; }
.members .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.members .count { margin-left: 10px; font-size: 13px; color: var(--muted); }

.cols { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "pick stage board" "pick queue board"; }
.pane { min-height: 0; display: flex; flex-direction: column; }
.pane h2 { font-size: 14px; font-weight: 600; padding: 16px 20px 10px; }
.pane h2 span { color: var(--muted); font-weight: 400; }
.pick { grid-area: pick; border-right: 1px solid var(--line); background: var(--surface); }
.stage { grid-area: stage; padding: 36px 44px 20px; position: relative; }
.queue { grid-area: queue; padding: 0 24px; }
.board { grid-area: board; border-left: 1px solid var(--line); background: var(--surface); }
.tabbar { display: none; }

/* ---------- 点歌 ---------- */
.search { display: flex; gap: 8px; padding: 16px 16px 12px; }
.seg { display: flex; gap: 4px; margin: 0 16px 8px; padding: 3px; background: var(--bg); border-radius: 12px; }
.seg button { flex: 1; border: 0; background: transparent; height: 32px; border-radius: 9px; font-size: 13px; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(36, 34, 59, .08); }
.results { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; }
.item:hover { background: var(--bg); }
.cover { width: 44px; height: 44px; border-radius: 8px; background: var(--purple-wash) center/cover; object-fit: cover; display: block; }
.item .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint { padding: 28px 20px; color: var(--muted); font-size: 14px; }
.hint b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

/* ---------- 正在播放 ---------- */
.now { display: flex; gap: 20px; align-items: center; }
.now .cover { width: 76px; height: 76px; border-radius: 14px; flex: none; }
.now .t { font-size: 18px; font-weight: 600; }
.now .s { color: var(--muted); font-size: 13px; }
.now .src { font-size: 12px; color: var(--muted); margin-top: 2px; }
.linkish { border: 0; background: none; padding: 0; color: var(--purple-deep); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.lyric { margin: 30px 0 26px; min-height: 124px; }
.lyric .cur { font: 600 clamp(26px, 3.4vw, 42px)/1.35 var(--serif); letter-spacing: .01em; text-wrap: balance; }
.lyric .nxt { margin-top: 10px; color: var(--muted); font: 400 17px/1.5 var(--serif); }
.bar { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 20px; padding: 0; border: 0; background: transparent; box-shadow: none; flex: 1; --p: 0%; }
input[type="range"]:focus { box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--purple-deep) var(--p), var(--line) var(--p)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--purple-deep); margin-top: -5px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(36, 34, 59, .3); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--purple-deep); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--purple-deep); border: 2px solid #fff; }
.ctl { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.ctl .play { width: 52px; height: 52px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.ctl .play svg { width: 20px; height: 20px; fill: currentColor; }
.ctl .vol { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); width: 150px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--peach); }
.live.on i { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.empty-stage h2 { font: 600 clamp(26px, 3.4vw, 40px)/1.35 var(--serif); }
.empty-stage p { color: var(--muted); margin-top: 12px; max-width: 28em; }
.unlock { position: absolute; inset: 0; border: 0; background: rgba(246, 245, 252, .9); color: var(--purple-deep); font-size: 17px; font-weight: 600; backdrop-filter: blur(4px); }

/* ---------- 队列 ---------- */
.queue h2 { padding-left: 20px; }
.queue-list { flex: 1; overflow-y: auto; padding-bottom: 20px; }
.qitem { display: grid; grid-template-columns: 22px 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 12px 8px 20px; border-radius: 12px; }
.qitem:hover { background: var(--surface); }
.qitem .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.qitem .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acts { display: flex; gap: 2px; }
.acts button { border: 0; background: none; color: var(--muted); font-size: 12px; padding: 6px 8px; border-radius: 8px; }
.acts button:hover { background: var(--purple-wash); color: var(--purple-deep); }

.list-head { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-right: 12px; }
.list-head h2 { flex: 1; border-top: 0; }
.qitem.on { background: var(--purple-wash); }
.qitem.on .t { color: var(--purple-deep); font-weight: 600; }
.qitem.bad .t { color: var(--muted); }
.qitem .warn { color: #B4412F; }
.playing { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--peach); margin-left: 2px; }
.batch-open { margin: 0 16px 8px; border: 1px dashed var(--line); background: none; border-radius: 12px; height: 38px; font-size: 13px; color: var(--purple-deep); }
.batch-open:hover { border-color: var(--purple); background: var(--purple-wash); }
.sheet.batch { padding: 22px; }
.sheet.batch .sheet-head { padding: 0 0 14px; }
textarea { font: inherit; color: inherit; width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; resize: vertical; line-height: 1.6; background: var(--surface); }
textarea::placeholder { color: #A9A7BF; }
textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-wash); }

/* ---------- 留言板 ---------- */
.comments { flex: 1; overflow-y: auto; padding: 4px 20px 12px; }
.cmt { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 9px 0; }
.cmt .who { font-size: 13px; font-weight: 600; }
.cmt .who time { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 12px; }
.cmt .txt { overflow-wrap: anywhere; white-space: pre-wrap; }
.cmt .song { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt.mine .who { color: var(--purple-deep); }
.comment-form { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* ---------- 浮层 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(36, 34, 59, .32); display: grid; place-items: center; padding: 20px; z-index: 20; }
.sheet { background: var(--surface); border-radius: 22px; padding: 26px; width: min(400px, 100%); box-shadow: 0 24px 60px rgba(36, 34, 59, .22); }
.sheet h2 { font-size: 19px; }
.sheet > .muted { margin: 6px 0 20px; font-size: 14px; }
.sheet.wide { width: min(560px, 100%); max-height: 82vh; display: flex; flex-direction: column; padding: 22px 14px 10px; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; padding: 0 10px 12px; }
.sheet-head .muted { font-size: 13px; margin-top: 4px; }
.using { font-size: 12px; color: var(--purple-deep); font-weight: 600; padding: 0 12px; }
.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 30; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 14px; box-shadow: 0 8px 24px rgba(36, 34, 59, .25); }
.toast.err { background: #B4412F; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1080px) and (min-width: 761px) {
  .cols { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "pick stage" "pick queue" "pick board"; }
  .board { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .top { padding: 10px 14px; gap: 10px; }
  .top .brand-mark { font-size: 0; gap: 0; }
  .invite-act { display: none; }
  .invite { padding: 8px 14px; }
  .cols { display: flex; flex-direction: column; }
  .stage { order: -1; padding: 16px 16px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .now .cover { width: 52px; height: 52px; border-radius: 10px; }
  .now .t { font-size: 16px; }
  .lyric { margin: 14px 0 12px; min-height: 0; }
  .lyric .cur { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lyric .nxt { display: none; }
  .ctl .vol, .ctl .live { display: none; }
  .ctl { gap: 8px; }
  .ctl .btn { padding: 0 14px; }
  .ctl .play { width: 46px; height: 46px; }
  .pane { display: none; flex: 1; border: 0; background: var(--bg); padding: 0; }
  .cols[data-tab="pick"] .pick, .cols[data-tab="queue"] .queue, .cols[data-tab="board"] .board { display: flex; }
  .list-head { border-top: 0; }
  .qitem { padding-left: 14px; }
  .tabbar { display: flex; border-top: 1px solid var(--line); background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar button { flex: 1; height: 52px; border: 0; background: none; color: var(--muted); font-size: 14px; position: relative; }
  .tabbar button[aria-current="true"] { color: var(--purple-deep); font-weight: 600; }
  .tabbar .badge { position: absolute; top: 12px; margin-left: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--peach); }
  .acts button { padding: 10px 8px; }
  .acts button[data-act="upNext"] { display: none; }
  .toasts { bottom: 72px; }
}
@media (prefers-reduced-motion: reduce) { .live.on i { animation: none; } * { transition: none !important; } }
