/* ============================================================
   Cloud Cinema — 夜里的一间放映厅
   品牌意象：暗下来的放映厅，屏幕的光是唯一光源。
   所以只有一套冷蓝强调色，其余全部交给黑、灰与留白。
   ============================================================ */

:root {
  --ink: #06070A;          /* 放映厅的暗 */
  --ink-2: #0B0D12;        /* 抬高一级的暗 */
  --slate: #10131A;        /* 表面 */
  --slate-2: #161A22;      /* 更高一层的表面 */
  --line: rgba(255, 255, 255, 0.065);
  --line-2: rgba(255, 255, 255, 0.12);
  --chalk: #E9ECF2;        /* 主文字 */
  --mist: #8790A0;         /* 次要文字 */
  --beam: #79A8FF;         /* 屏幕冷蓝 —— 全站唯一强调色 */
  --beam-soft: rgba(121, 168, 255, 0.10);
  --on-beam: #04101F;
  --ok: #4FD6A0;
  --bad: #FF7A7A;
  --r: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--chalk);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 顶棚漏下来的一束极淡冷光，几乎察觉不到，但让整页不再是死黑 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(72% 48% at 50% -12%, rgba(121, 168, 255, 0.085), transparent 70%);
}

.hidden { display: none !important; }

input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  background: #090B10;
  color: var(--chalk);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s, background 0.16s;
}
input:focus { border-color: rgba(121, 168, 255, 0.55); background: #0C0F15; }
input::placeholder { color: #5A6272; }

.btn-primary {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  background: var(--beam);
  color: var(--on-beam);
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: filter 0.16s, transform 0.12s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.985); }
.btn-primary.small { width: auto; height: 38px; padding: 0 16px; font-size: 13px; }

.btn-ghost {
  height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--chalk);
  font-size: 13px;
  font-family: inherit;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.2); }
.btn-ghost.small { height: 32px; padding: 0 12px; font-size: 12.5px; }

.btn-mini {
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--chalk);
  font-family: inherit;
  transition: all 0.16s;
}
.btn-mini:hover { border-color: rgba(121, 168, 255, 0.45); color: #fff; }
.btn-mini.danger { color: var(--bad); border-color: rgba(255, 122, 122, 0.28); }
.btn-mini.danger:hover { background: rgba(255, 90, 90, 0.10); border-color: rgba(255, 122, 122, 0.5); }

/* ============================== 启动动画 */

.boot-view {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--ink);
}
.boot-mark {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(180deg, #4C86F0, #2F63C8);
  animation: cc-breathe 1.9s ease-in-out infinite;
}
.boot-text { margin: 0; font-size: 12.5px; letter-spacing: 1.5px; color: var(--mist); }

@keyframes cc-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(121, 168, 255, 0.30); }
  50%      { transform: scale(1.04); box-shadow: 0 0 0 20px rgba(121, 168, 255, 0); }
}

/* ============================== 登录 */

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 372px;
  padding: 34px 30px 30px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
  background: linear-gradient(180deg, #4C86F0, #2F63C8);
}
.login-kicker {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--mist);
}
.login-card h1 {
  margin: 0 0 7px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.login-sub { margin: 0 0 26px; font-size: 13px; color: var(--mist); }

.login-card form label { display: block; margin-bottom: 14px; }
.login-card form label span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--mist);
}
.err { min-height: 18px; margin: 2px 0 10px; font-size: 12.5px; color: #FF8A8A; }

.login-tip {
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--mist);
}
.login-tip b { color: #C3CAD8; font-weight: 600; }
.login-tip a { color: var(--beam); text-decoration: none; }
.login-tip a:hover { text-decoration: underline; }

/* ============================== 顶栏 */

.app { position: relative; z-index: 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
  padding: 0 26px;
  background: rgba(6, 7, 10, 0.80);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  background: linear-gradient(180deg, #4C86F0, #2F63C8);
}
.dot { width: 1px; height: 14px; background: var(--line-2); }
.topbar-meta { font-size: 12px; color: var(--mist); letter-spacing: 0.3px; white-space: nowrap; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  background: #090B10;
  border: 1px solid var(--line);
  color: var(--mist);
  transition: border-color 0.16s;
}
.search-wrap:focus-within { border-color: rgba(121, 168, 255, 0.5); }
.search-wrap svg { flex: none; }
.search-wrap input {
  height: auto;
  width: 150px;
  padding: 0;
  border: none;
  background: none;
  font-size: 13px;
}
.search-wrap input:focus { background: none; border: none; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--slate-2);
  border: 1px solid var(--line-2);
  color: var(--chalk);
}

main {
  position: relative;
  max-width: 1360px;
  margin: 0 auto;
  padding: 34px 26px 80px;
}

/* ============================== 片库 */

.lib-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.lib-head h2 {
  margin: 0 0 7px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.028em;
}
.lib-sub { margin: 0; font-size: 12.5px; color: var(--mist); }

.chip-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
  height: 32px;
  padding: 0 13px;
  border-radius: 7px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mist);
  font-size: 12.5px;
  font-family: inherit;
  transition: all 0.16s;
}
.chip:hover { color: var(--chalk); border-color: var(--line-2); }
.chip.active { color: var(--on-beam); background: var(--beam); border-color: var(--beam); font-weight: 600; }

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(266px, 1fr));
  gap: 18px;
}

.movie-card {
  position: relative;
  cursor: pointer;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--slate);
  border: 1px solid var(--line);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.movie-card:hover {
  border-color: rgba(121, 168, 255, 0.28);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -20px rgba(0, 0, 0, 0.95);
}

/* 海报：极深冷底 + 一束打在幕布上的投影光（配色由 app.js 按片名生成） */
.poster {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(16, 19, 26, 0) 38%, rgba(16, 19, 26, 0.78));
}
.poster-letter {
  position: relative;
  z-index: 1;
  font-size: 46px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.24);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  user-select: none;
}
.poster-cat,
.poster-dur,
.poster-badge {
  position: absolute;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  letter-spacing: 0.4px;
  background: rgba(6, 7, 10, 0.60);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.poster-cat { left: 9px; top: 9px; }
.poster-dur { right: 9px; bottom: 9px; }
.poster-badge { right: 9px; top: 9px; color: var(--beam); border-color: rgba(121, 168, 255, 0.30); }

.card-body { padding: 12px 13px 13px; }
.card-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-track { height: 3px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.075); }
.progress-fill { height: 100%; border-radius: 2px; background: var(--beam); }

.empty { padding: 72px 0; text-align: center; color: var(--mist); }
.empty p { margin: 0 0 8px; font-size: 15px; color: var(--chalk); }
.empty span { font-size: 12.5px; }

/* ============================== 后台 */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 26px;
  margin-bottom: 10px;
}
/* 不做并排的圆角卡片，只留一条顶线和一个大数字 */
.stat-card { padding-top: 14px; border-top: 1px solid var(--line-2); }
.stat-label {
  display: block;
  margin-bottom: 8px;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: var(--mist);
}
.stat-card strong {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.block-title {
  margin: 38px 0 14px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--mist);
}

.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.user-card {
  padding: 16px 17px;
  background: var(--slate);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.user-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.user-name { font-size: 14px; font-weight: 600; }
.role-tag {
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  color: var(--beam);
  background: var(--beam-soft);
  border: 1px solid rgba(121, 168, 255, 0.22);
}
.role-tag.member { color: #9FB4D6; background: rgba(255, 255, 255, 0.05); border-color: var(--line-2); }
.user-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}
.user-card-head + .user-kv { border-top: none; }
.user-kv span { color: var(--mist); }
.user-kv b { font-weight: 500; color: #C6CDDA; font-variant-numeric: tabular-nums; }

.table-wrap {
  overflow: auto;
  background: var(--slate);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 11px 15px; text-align: left; white-space: nowrap; }
th {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--mist);
  background: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
td { color: #C6CDDA; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.022); }

.panel {
  padding: 20px;
  background: var(--slate);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.user-rows { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 11px 4px;
  border-top: 1px solid var(--line);
}
.user-rows .user-row:first-child { border-top: none; }
.user-row-main { display: flex; align-items: center; gap: 10px; }
.scope-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.scope-box label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--mist);
  cursor: pointer;
}
.scope-box label:hover { border-color: var(--line-2); color: var(--chalk); }
.scope-box input[type="checkbox"] { width: 13px; height: 13px; accent-color: var(--beam); cursor: pointer; }
.row-actions { display: flex; gap: 6px; }

.create-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.create-row input { flex: 1 1 150px; height: 40px; }

.admin-msg { min-height: 18px; margin: 12px 0 0; font-size: 12.5px; color: var(--mist); }
.hint { margin: 0; font-size: 12.5px; line-height: 1.9; color: var(--mist); }
.hint b { color: #C3CAD8; }
.sub-title {
  margin: 26px 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--chalk);
}

.invite-result {
  margin-top: 14px;
  padding: 15px 16px;
  border-radius: 8px;
  background: var(--slate-2);
  border: 1px solid rgba(121, 168, 255, 0.22);
  font-size: 12.5px;
  line-height: 1.9;
}
.invite-code {
  font-family: ui-monospace, Consolas, "SF Mono", monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--beam);
  user-select: all;
}

.invite-list { display: flex; flex-direction: column; }
.invite-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.invite-item .code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--chalk);
}
.invite-item .meta { color: var(--mist); }
.invite-item.dead { opacity: 0.45; }
.invite-item.dead .code { text-decoration: line-through; }

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: middle;
}
.status-dot.on { background: var(--ok); }
.status-dot.off { background: var(--bad); }

/* ============================== 播放器 */

body.playing { overflow: hidden; }

.player {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}
.player-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 30px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.90), rgba(0, 0, 0, 0.52) 55%, rgba(0, 0, 0, 0));
}
.btn-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background 0.16s;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.20); }
.player-title { min-width: 0; flex: 1; }
.player-title h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-title span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.player-top .btn-ghost {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.player-body { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; }
.player-body video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.play-error {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 84%;
  padding: 18px 22px;
  border-radius: 10px;
  background: rgba(16, 19, 26, 0.94);
  border: 1px solid rgba(255, 122, 122, 0.26);
  color: #FFD9D9;
  font-size: 13px;
  line-height: 1.8;
  text-align: left;
}
.play-error b { color: #fff; }

.play-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(10, 12, 17, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #D7DCE7;
  font-size: 12.5px;
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(121, 168, 255, 0.22);
  border-top-color: var(--beam);
  animation: cc-spin 0.9s linear infinite;
}
@keyframes cc-spin { to { transform: rotate(360deg); } }

.resume-toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 6px;
  background: rgba(14, 17, 24, 0.94);
  border: 1px solid var(--line-2);
  color: var(--chalk);
  font-size: 12.5px;
  white-space: nowrap;
  animation: cc-toast 0.28s ease;
}
@keyframes cc-toast {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================== 窄屏 */

@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 14px; gap: 10px; overflow: hidden; }
  .topbar-left { gap: 10px; min-width: 0; }
  .topbar-right { gap: 8px; flex: none; }
  .dot, .topbar-meta { display: none; }
  .logo { font-size: 14px; gap: 7px; }
  .logo-mark { width: 22px; height: 22px; font-size: 9.5px; }
  .search-wrap { flex: none; padding: 0 8px; gap: 6px; }
  .search-wrap input { width: 66px; font-size: 12px; }
  .btn-ghost {
    position: relative;
    flex: none;
    height: 30px;
    padding: 0 8px;
    font-size: 11.5px;
    white-space: nowrap;
  }
  .btn-ghost::after { content: ""; position: absolute; inset: -7px -5px; }
  .avatar { display: none; }

  main { padding: 24px 14px 70px; }
  .lib-head { align-items: center; flex-direction: row; gap: 12px; margin-bottom: 18px; }
  .lib-head > div { min-width: 0; }
  .lib-head h2 { font-size: 21px; }

  .chip-bar { gap: 6px; margin-bottom: 18px; }
  .chip { height: 30px; padding: 0 11px; font-size: 12px; }

  .movie-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
  .poster-letter { font-size: 30px; }
  .poster-cat, .poster-dur, .poster-badge { font-size: 9.5px; padding: 2px 6px; }
  .card-body { padding: 10px 11px 11px; }
  .card-title { font-size: 12.5px; margin-bottom: 8px; }

  .stat-row { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 18px; }
  .stat-card strong { font-size: 24px; }
  .user-grid { grid-template-columns: 1fr; }

  .player-top { padding: 12px 12px; gap: 10px; }
  .player-title h3 { font-size: 14.5px; }
  .user-row { grid-template-columns: 1fr; gap: 10px; padding: 12px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
