/* =====================================================================
   一起看 · SyncWatch 样式
   ===================================================================== */
:root {
  --bg: #0b0d12;
  --bg-2: #12151d;
  --panel: #161a23;
  --panel-2: #1d2230;
  --line: #262c3a;
  --text: #e8ebf2;
  --muted: #98a2b8;
  --accent: #ff4d6d;
  --accent-2: #ff8a5c;
  --ok: #35d07f;
  --warn: #ffc94d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

/* 元素带 hidden 属性时必须真的隐藏（否则会被 .empty{display:flex} 之类的规则覆盖） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100%; }
kbd {
  display: inline-block; padding: 1px 6px; margin: 0 1px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--panel-2); font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; color: #cfd6e6;
}
.muted { color: var(--muted); }
.spacer { flex: 1; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ------------------------------ 顶部栏 ------------------------------ */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #131722, #10131b);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .3px; }
.logo { font-size: 20px; }
.brand-name { font-size: 16px; }
.room-badge {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  padding: 1px 8px; border-radius: 999px; background: #0e1219;
}
.status-wrap {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #0e1219;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(255,255,255,.04); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(53,208,127,.8); }
.dot.off { background: var(--accent); box-shadow: 0 0 8px rgba(255,77,109,.7); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 7px 12px; border-radius: 10px; cursor: pointer; font-size: 13px;
  transition: .15s; white-space: nowrap;
}
.btn:hover { background: #262d3d; border-color: #38415a; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.btn.big { padding: 11px 20px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------ 布局 ------------------------------ */
.layout { flex: 1; min-height: 0; display: flex; gap: 14px; padding: 14px; }
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.side {
  width: 380px; flex: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden;
}
.side.hidden { display: none; }

/* ------------------------------ 播放器 ------------------------------ */
.player-shell {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; max-height: calc(100vh - 300px); min-height: 260px;
  box-shadow: var(--shadow); outline: none;
}
.player-shell:fullscreen { border-radius: 0; max-height: none; aspect-ratio: auto; height: 100%; }
#video { width: 100%; height: 100%; display: block; background: #000; }

.empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 500px at 50% 0%, #1a2030, #0a0c11 70%); text-align: center; padding: 20px;
}
.empty-inner { max-width: 520px; }
.empty-emoji { font-size: 44px; }
.empty h2 { margin: 8px 0 6px; font-size: 20px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

.buffering {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: rgba(0,0,0,.55); padding: 16px 22px; border-radius: 14px; font-size: 13px;
  backdrop-filter: blur(4px);
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.osd {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  background: rgba(0,0,0,.6); padding: 8px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none;
  backdrop-filter: blur(4px);
}
.osd.show { opacity: 1; }

.video-top {
  position: absolute; top: 0; left: 0; right: 0; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,.7), transparent);
  transition: opacity .25s; pointer-events: none;
}
.video-title { font-weight: 600; text-shadow: 0 1px 4px #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill {
  font-size: 11px; padding: 2px 9px; border-radius: 999px; background: rgba(53,208,127,.18);
  color: #7ff0b3; border: 1px solid rgba(53,208,127,.35); flex: none;
}
.pill.off { background: rgba(255,201,77,.15); color: var(--warn); border-color: rgba(255,201,77,.35); }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px 12px;
  background: linear-gradient(0deg, rgba(0,0,0,.85), rgba(0,0,0,.35) 60%, transparent);
  transition: opacity .25s;
}
.player-shell.hide-ui .controls,
.player-shell.hide-ui .video-top { opacity: 0; pointer-events: none; }

.progress-row { display: flex; align-items: center; gap: 10px; }
.time { font: 12px/1 ui-monospace, Consolas, monospace; color: #dfe4ee; min-width: 46px; text-align: center; }
.bar {
  position: relative; flex: 1; height: 16px; display: flex; align-items: center; cursor: pointer;
}
.bar::before {
  content: ''; position: absolute; left: 0; right: 0; height: 5px; border-radius: 3px; background: rgba(255,255,255,.22);
}
.bar-buffer { position: absolute; left: 0; height: 5px; border-radius: 3px; background: rgba(255,255,255,.32); width: 0; }
.bar-played {
  position: absolute; left: 0; height: 5px; border-radius: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.knob {
  position: absolute; right: -6px; top: 50%; transform: translateY(-50%) scale(.6);
  width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6);
  transition: transform .15s;
}
.bar:hover .knob { transform: translateY(-50%) scale(1); }
.bar-hover { position: absolute; width: 0; height: 5px; background: rgba(255,255,255,.18); border-radius: 3px; }
.bar-tip {
  position: absolute; bottom: 22px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px;
  background: rgba(0,0,0,.85); font: 12px/1.3 ui-monospace, monospace; opacity: 0; transition: opacity .12s; pointer-events: none;
}
.bar:hover .bar-tip { opacity: 1; }

.btn-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ic {
  background: transparent; border: none; color: #eaeef7; font-size: 17px; cursor: pointer;
  padding: 5px 8px; border-radius: 9px; transition: .15s; line-height: 1;
}
.ic:hover { background: rgba(255,255,255,.13); }
.ic.txt { font-size: 13px; font-weight: 700; min-width: 54px; }
.ic.active { color: var(--accent-2); }

.vol-wrap { display: flex; align-items: center; gap: 6px; }
#vol { width: 88px; accent-color: var(--accent); }
.vol-num { font: 11px/1 ui-monospace, monospace; color: var(--muted); width: 26px; }

.speed-menu {
  position: absolute; right: 12px; bottom: 58px; width: 260px; z-index: 5;
  background: rgba(18,21,29,.97); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow);
}
.speed-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.speeds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.speeds button {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 8px;
  padding: 6px 0; font-size: 12px; cursor: pointer;
}
.speeds button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; font-weight: 700; }
.speed-custom { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.speed-custom input { flex: 1; accent-color: var(--accent); }
.speed-custom span { font: 12px/1 ui-monospace, monospace; width: 46px; text-align: right; }
.speed-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.speed-tip { font-size: 11px; color: var(--muted); margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }

/* ------------------------------ 连播列表 ------------------------------ */
.playlist-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; }
.card-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.playlist { list-style: none; margin: 8px 0 0; padding: 0; max-height: 190px; overflow: auto; }
.playlist li {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 9px; cursor: pointer; font-size: 13px;
}
.playlist li:hover { background: var(--panel-2); }
.playlist li.current { background: rgba(255,77,109,.14); border: 1px solid rgba(255,77,109,.35); }
.playlist .idx { color: var(--muted); font: 12px/1 ui-monospace, monospace; width: 18px; }
.playlist .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist .rm { color: var(--muted); border: none; background: transparent; cursor: pointer; font-size: 14px; }
.playlist .rm:hover { color: var(--accent); }
.playlist .empty-line { color: var(--muted); font-size: 12px; padding: 6px 8px; }

/* ------------------------------ 右侧面板 ------------------------------ */
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  flex: 1; padding: 11px 0; background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.pane { display: none; flex: 1; min-height: 0; flex-direction: column; padding: 12px; overflow: auto; }
.pane.active { display: flex; }
.pane-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.pane-tools input {
  flex: 1; background: #0d1016; border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 8px 10px; font-size: 13px;
}

.lib { display: flex; flex-direction: column; gap: 8px; }
.lib-item {
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; background: var(--bg-2);
  cursor: pointer; transition: .15s;
}
.lib-item:hover { border-color: #3b455e; background: #191e29; }
.lib-item.current { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(255,77,109,.35) inset; }
.lib-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.lib-meta { display: flex; gap: 10px; font-size: 11px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.lib-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.lib-actions .btn { padding: 3px 8px; font-size: 11px; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.warn { color: var(--warn); border-color: rgba(255,201,77,.4); }
.badge.ok { color: var(--ok); border-color: rgba(53,208,127,.4); }
.badge.exp { color: #9fb6d6; border-color: rgba(159,182,214,.35); background: rgba(159,182,214,.08); }
.badge.exp.urgent { color: var(--accent); border-color: rgba(255,77,109,.45); background: rgba(255,77,109,.1); }
.retention-note {
  font-size: 11px; color: var(--muted); background: #10141d; border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 9px; margin-bottom: 10px; line-height: 1.5;
}
.retention-note b { color: var(--warn); }

.dropzone {
  border: 2px dashed #33405a; border-radius: 14px; padding: 26px 16px; text-align: center;
  cursor: pointer; background: #10141d; transition: .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(255,77,109,.07); }
.dz-icon { font-size: 26px; margin-bottom: 6px; }
.dz-note { color: var(--muted); font-size: 11px; margin-top: 8px; }

.tip-card {
  margin-top: 14px; background: #10141d; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 12px; color: var(--muted);
}
.tip-card b { color: var(--text); }
.tip-card ul { margin: 8px 0 0; padding-left: 18px; }
.tip-card li { margin-bottom: 6px; }

.uploads { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.up-item { background: #10141d; border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.up-name { font-size: 12px; margin-bottom: 6px; word-break: break-all; }
.up-bar { height: 6px; border-radius: 3px; background: #222835; overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.up-info { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.chat { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.chat .msg { font-size: 13px; background: var(--bg-2); border: 1px solid var(--line); padding: 7px 10px; border-radius: 10px; }
.chat .msg b { color: var(--accent-2); }
.chat .sys { color: var(--muted); font-size: 12px; text-align: center; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { flex: 1; background: #0d1016; border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 8px 10px; }

/* ------------------------------ 弹窗 / 提示 ------------------------------ */
.modal { position: fixed; inset: 0; background: rgba(5,7,10,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: min(680px, 100%); max-height: 86vh; overflow: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.modal-head b { flex: 1; }
.keys { padding: 8px 16px 4px; }
.keys > div { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.keys > div span { color: var(--muted); font-size: 13px; }
.keys > div kbd:first-child, .keys > div kbd { flex: none; }
.modal-foot { padding: 12px 16px 16px; color: var(--muted); font-size: 12px; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: flex-end; }
.toast {
  background: rgba(22,26,35,.97); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow);
  animation: slideIn .22s ease; max-width: 340px;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } }

/* ------------------------------ 设置弹窗 ------------------------------ */
.settings-body { padding: 14px 16px 16px; }
.set-block { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: var(--bg-2); }
.set-block h3 { margin: 0 0 8px; font-size: 14px; }
.set-hint { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 8px 0 0; }
.set-hint b { color: var(--text); }
.set-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.set-row label { width: 120px; flex: none; font-size: 13px; color: var(--muted); }
.set-row input {
  flex: 1; background: #0d1016; border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 8px 10px; font-size: 13px; min-width: 0;
}
.set-row input:focus { outline: none; border-color: var(--accent); }
.set-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.set-msg { font-size: 12px; color: var(--accent-2); }

/* 上传完成提示条（不自动播放，先把人引到片库） */
.lib-hint {
  background: rgba(53,208,127,.1); border: 1px solid rgba(53,208,127,.35); border-radius: 9px;
  padding: 8px 10px; margin-bottom: 10px; font-size: 12px; line-height: 1.5;
}
.lib-hint-actions { display: flex; gap: 6px; margin-top: 7px; }
.upload-note { margin: 10px 0 0; }
.badge.fresh { color: #7ff0b3; border-color: rgba(53,208,127,.45); background: rgba(53,208,127,.12); margin-left: 6px; }

/* ------------------------------ 登录页 ------------------------------ */
.login-msg { min-height: 20px; color: var(--accent-2); font-size: 13px; }
.login-foot { font-size: 11px; line-height: 1.6; margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; }

/* ------------------------------ 窄屏 ------------------------------ */
@media (max-width: 1080px) {
  .layout { flex-direction: column; }
  .side { width: auto; max-height: 46vh; }
  .side.hidden { display: none; }
  .player-shell { max-height: none; }
  .top-actions .btn span { display: none; }
  .playlist-card .hint { display: none; }
  .set-row { flex-direction: column; align-items: stretch; }
  .set-row label { width: auto; }
}

/* ------------------------------ 口令页 ------------------------------ */
.center-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
.card-narrow { max-width: 460px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.card-narrow h1 { font-size: 20px; margin: 6px 0 10px; }
.card-narrow p { color: var(--muted); font-size: 13px; }
.card-narrow form { display: flex; gap: 8px; margin: 18px 0 6px; }
.card-narrow input { flex: 1; background: #0d1016; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 12px; }
code { background: #0d1016; border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: 12px; }
