:root {
  --bg: #0b0f14;
  --panel: #131a23;
  --panel-2: #1a2330;
  --text: #e6edf5;
  --muted: #93a3b5;
  --accent: #4f9cf9;
  --accent-2: #2f7de1;
  --danger: #ff6b6b;
  --border: #24303f;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --panel-2: #eef2f7;
    --text: #17202b;
    --muted: #5a6b7d;
    --accent: #1c6fd4;
    --accent-2: #1558ab;
    --danger: #c0392b;
    --border: #dbe3ec;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 0 14px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .2px; }
.logo { width: 26px; height: 26px; color: var(--accent); }

.view { flex: 1; display: flex; flex-direction: column; gap: 16px; }
[hidden] { display: none !important; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.login-view { justify-content: center; align-items: center; }
.login-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; font-size: 1.25rem; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.field span { color: var(--muted); }

input[type=password] {
  width: 100%;
  padding: 13px 14px;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
input[type=password]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,156,249,.18); }

.remember { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.remember input { width: 16px; height: 16px; accent-color: var(--accent); }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.error { margin: 0; color: var(--danger); font-size: .88rem; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-head h2 { margin: 0; font-size: 1.1rem; }

.media-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.media-item { margin: 0; }

.media-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 14px 16px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 60px;
}
.media-button:hover { border-color: var(--accent); }
.play-icon {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--accent);
  font-size: .9rem;
}
.media-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.media-name { font-weight: 600; overflow-wrap: anywhere; }
.media-sub { color: var(--muted); font-size: .8rem; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }

.player-head { display: flex; align-items: center; gap: 12px; }
.player-head h2 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.player-shell {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
video { width: 100%; max-height: 72dvh; display: block; background: #000; }

.footer {
  padding: 18px 0 calc(6px + env(safe-area-inset-bottom));
  text-align: center;
}

@media (max-width: 480px) {
  .card { padding: 18px; }
  .brand span { font-size: .95rem; }
}

/* Login is anonymous: hide branding chrome on the login screen only */
body.is-login .topbar,
body.is-login .footer { display: none; }

.login-reminder {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: .95rem;
  line-height: 1.5;
}
