:root {
  --bg: #0b101b;
  --surface: #131b2c;
  --surface-2: #1a2438;
  --border: #263450;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.small-text { font-size: 0.82rem; color: var(--muted); }

/* 登录页 */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
}
.brand-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1rem;
}
textarea { min-height: 120px; resize: vertical; }

/* 顶部与底部导航 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(11, 16, 27, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.brand-title { font-size: 1.08rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.user-pill {
  padding: 4px 10px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--muted);
}

.content {
  padding: 14px 14px 86px;
  max-width: 1040px;
  margin: 0 auto;
}

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(15, 23, 42, 0.96);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav-item {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 4px;
  border-radius: 10px;
}
.nav-item.active { color: var(--accent); background: rgba(56, 189, 248, 0.12); }

/* 按钮 */
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: #082f49; border-color: transparent; }
.btn.accent { background: rgba(56, 189, 248, 0.18); color: var(--accent); border-color: rgba(56, 189, 248, 0.4); }
.btn.danger { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
.btn.small { padding: 7px 10px; font-size: 0.84rem; }
.btn.full { width: 100%; }

/* 区块与卡片 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 10px;
}
.section-head h2 { margin: 0; font-size: 1.08rem; }

.h-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}
.cat-card {
  min-width: 128px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1b2842, #121a2b);
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
}
.cat-card .cat-name { font-weight: 700; font-size: 1rem; }
.cat-card .cat-cnt { color: var(--accent); font-size: 0.86rem; margin-top: 4px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 12px;
}
.poster-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  width: 156px;
}
.grid .poster-card { width: auto; }
.poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #0f172a;
}
.poster-wrap img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.badge-top {
  position: absolute; top: 8px; left: 8px; right: 8px;
  display: flex; justify-content: space-between; gap: 4px;
}
.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.pill.ok { color: #86efac; border-color: rgba(34, 197, 94, 0.45); }
.pill.warn { color: #fcd34d; border-color: rgba(245, 158, 11, 0.5); }
.pill.danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); }
.pill.accent { color: #7dd3fc; border-color: rgba(56, 189, 248, 0.5); }

.card-body { padding: 10px; }
.card-title {
  font-weight: 700; font-size: 0.94rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px; font-size: 0.8rem; color: var(--muted);
}
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* 仪表盘面板 */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 680px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-box {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px;
}
.stat-label { font-size: 0.8rem; color: var(--muted); }
.stat-val { font-size: 1.08rem; font-weight: 700; margin-top: 4px; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media (min-width: 680px) {
  .filter-grid { grid-template-columns: repeat(4, 1fr); }
}

/* 弹窗 */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(2, 6, 23, 0.78);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 18px 16px 28px;
}
@media (min-width: 680px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal-sheet { border-radius: 18px; border: 1px solid var(--border); }
}

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.code-box {
  background: #090e18;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-all;
  color: #cbd5e1;
}
.error-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  font-size: 0.9rem;
}
.toast {
  position: fixed;
  left: 50%; bottom: 84px; transform: translateX(-50%);
  z-index: 60;
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--accent);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
