/* 朴素听书 — 蓝白主题 */
:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a8a;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --bg: #f5f9ff;
  --card: #ffffff;
  --danger: #dc2626;
  --ok: #059669;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(37, 99, 235, 0.08);
  --shadow-hover: 0 12px 36px rgba(37, 99, 235, 0.14);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: linear-gradient(180deg, var(--blue-50) 0%, #ffffff 280px);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }

.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem; color: var(--ink);
}
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff; display: grid; place-items: center;
  font-size: 14px; font-weight: 800; letter-spacing: -0.5px;
}
.nav { display: flex; align-items: center; gap: 8px; }
.nav a {
  padding: 8px 14px; border-radius: 999px; color: var(--ink-2); font-size: 0.95rem;
}
.nav a:hover, .nav a.active { background: var(--blue-50); color: var(--blue-700); }

/* Hero / search */
.hero {
  padding: 48px 0 24px;
  text-align: center;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: 0.02em;
  color: var(--blue-900);
}
.hero p { margin: 0 auto 24px; color: var(--ink-3); max-width: 520px; }

.search-bar {
  display: flex; gap: 8px; max-width: 560px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px; box-shadow: var(--shadow);
}
.search-bar input {
  flex: 1; border: 0; outline: 0; padding: 10px 16px;
  font-size: 1rem; background: transparent; color: var(--ink);
}
.search-bar button {
  border: 0; border-radius: 999px; padding: 10px 22px;
  background: var(--blue-600); color: #fff; font-weight: 600; cursor: pointer;
}
.search-bar button:hover { background: var(--blue-700); }

/* Cards grid */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 28px 0 16px;
}
.section-title h2 { margin: 0; font-size: 1.2rem; color: var(--ink); }
.muted { color: var(--ink-3); font-size: 0.9rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  padding-bottom: 48px;
}

.novel-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
  color: inherit;
}
.novel-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  color: inherit;
}
.novel-cover {
  aspect-ratio: 3/4;
  background: linear-gradient(160deg, var(--blue-100), var(--blue-500));
  display: grid; place-items: center;
  color: #fff; font-size: 2rem; font-weight: 700;
  position: relative; overflow: hidden;
}
.novel-cover img {
  width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0;
}
.novel-cover .initial { opacity: 0.95; }
.novel-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.novel-body h3 {
  margin: 0; font-size: 1rem; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.novel-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.8rem; color: var(--ink-3); }
.tag {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 999px; background: var(--blue-50); color: var(--blue-700);
  font-size: 0.75rem;
}
.tag.done { background: #ecfdf5; color: var(--ok); }
.tag.ongoing { background: var(--blue-50); color: var(--blue-600); }

/* Detail */
.detail-hero {
  display: grid; grid-template-columns: 200px 1fr; gap: 28px;
  padding: 36px 0 8px;
}
.detail-cover {
  aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(160deg, var(--blue-100), var(--blue-600));
  box-shadow: var(--shadow); display: grid; place-items: center; color: #fff;
  font-size: 3rem; font-weight: 700; position: relative;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.detail-info h1 { margin: 0 0 8px; font-size: 1.7rem; color: var(--blue-900); }
.detail-info .desc { color: var(--ink-2); margin: 12px 0 18px; white-space: pre-wrap; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: .15s ease;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--blue-200); color: var(--blue-700); }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Chapter list */
.chapter-list {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 48px; box-shadow: var(--shadow);
}
.chapter-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  color: inherit;
}
.chapter-item:last-child { border-bottom: 0; }
.chapter-item:hover { background: var(--blue-50); color: inherit; }
.chapter-item .num {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  background: var(--blue-50); color: var(--blue-700);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
}
.chapter-item .meta { flex: 1; min-width: 0; }
.chapter-item .meta strong {
  display: block; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chapter-item .meta span { font-size: 0.8rem; color: var(--ink-3); }

/* Player page */
.player-shell {
  max-width: 720px; margin: 28px auto 64px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.player-top {
  background: linear-gradient(145deg, var(--blue-600), var(--blue-900));
  color: #fff; padding: 28px 28px 22px;
}
.player-top .crumb { font-size: 0.85rem; opacity: .85; margin-bottom: 8px; }
.player-top .crumb a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.player-top h1 { margin: 0; font-size: 1.35rem; }
.player-top .sub { opacity: .8; font-size: 0.9rem; margin-top: 6px; }

.player-body { padding: 22px 24px 28px; }
.audio-controls { display: flex; flex-direction: column; gap: 14px; }
.progress-row { display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--ink-3); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px;
  background: var(--blue-100); flex: 1; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue-600); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
}
.btn-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--blue-700); font-size: 1rem; cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn.main {
  width: 64px; height: 64px; background: var(--blue-600); color: #fff;
  border: 0; font-size: 1.4rem;
}
.icon-btn.main:hover { background: var(--blue-700); }
.speed-select {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px;
  background: #fff; color: var(--ink-2); font-size: 0.9rem;
}
.player-nav {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line);
}

/* Admin */
.admin-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 24px;
  padding: 28px 0 64px; align-items: start;
}
.admin-side {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); position: sticky; top: 80px;
}
.admin-side a {
  display: block; padding: 12px 14px; border-radius: 10px; color: var(--ink-2);
  font-weight: 500;
}
.admin-side a:hover, .admin-side a.active { background: var(--blue-50); color: var(--blue-700); }
.admin-main {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); min-height: 420px;
}
.admin-main h1 { margin: 0 0 6px; font-size: 1.35rem; color: var(--blue-900); }
.admin-main .lead { color: var(--ink-3); margin: 0 0 22px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
  margin-bottom: 28px;
}
.stat {
  background: linear-gradient(180deg, var(--blue-50), #fff);
  border: 1px solid var(--blue-100); border-radius: 12px; padding: 16px;
}
.stat .label { font-size: 0.8rem; color: var(--ink-3); }
.stat .value { font-size: 1.6rem; font-weight: 700; color: var(--blue-700); margin-top: 4px; }

.form-grid { display: grid; gap: 14px; max-width: 560px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-size: 0.9rem; font-weight: 600; color: var(--ink-2); }
.form-row input, .form-row textarea, .form-row select {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: inherit; color: var(--ink); background: #fff; outline: none;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100);
}
.form-row textarea { min-height: 100px; resize: vertical; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
}
table.data th, table.data td {
  text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
table.data th { color: var(--ink-3); font-weight: 600; font-size: 0.82rem; }
table.data tr:hover td { background: var(--blue-50); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.toolbar .left, .toolbar .right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: .25s ease; z-index: 100;
  max-width: min(90vw, 420px); text-align: center; font-size: 0.92rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

.empty {
  text-align: center; padding: 48px 16px; color: var(--ink-3);
}
.empty strong { display: block; color: var(--ink-2); margin-bottom: 6px; }

.login-card {
  max-width: 400px; margin: 80px auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 28px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 8px; font-size: 1.35rem; color: var(--blue-900); text-align: center; }
.login-card p { text-align: center; color: var(--ink-3); margin: 0 0 20px; }

.site-footer {
  border-top: 1px solid var(--line); padding: 24px 0 36px;
  color: var(--ink-3); font-size: 0.85rem; text-align: center;
  background: #fff;
}

.progress-bar {
  height: 4px; background: var(--blue-100); border-radius: 999px; overflow: hidden; margin-top: 8px;
}
.progress-bar > i {
  display: block; height: 100%; width: 0%; background: var(--blue-600);
  transition: width .2s linear;
}

@media (max-width: 800px) {
  .detail-hero { grid-template-columns: 1fr; }
  .detail-cover { max-width: 200px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .admin-side a { white-space: nowrap; }
}
