* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #0e0f16;
  --bg-1: #161824;
  --card: #1c1e2e;
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #ececf4;
  --text-dim: #9a9ab3;
  --douban: #00b51a;
  --rt: #fa320a;
  --accent: #e6b85c;
  --glow: #23263a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, var(--glow) 0%, var(--bg-0) 60%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 20px;
  transition: background 0.4s ease;
}

.page { width: 100%; max-width: 860px; }

.page-header { text-align: center; margin-bottom: 32px; }
.site-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(120deg, #ffffff 10%, var(--accent) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
}
.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.date-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.date {
  color: var(--accent);
  letter-spacing: 3px;
  font-size: 14px;
}
.today-btn {
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}
.today-btn:hover { color: var(--accent); }

.card {
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 28px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.card > .poster,
.card > .info { position: relative; z-index: 1; }
.card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(48px) saturate(1.3);
  opacity: 0.45;
  transform: scale(1.3);
  pointer-events: none;
}
.card-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 15, 22, 0.5), rgba(14, 15, 22, 0.72));
}

.poster {
  flex: 0 0 200px;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  background: linear-gradient(160deg, #3a3f5c 0%, #202338 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}
.card:hover .poster-img { transform: scale(1.06); }
.poster-title { font-size: 22px; font-weight: 700; line-height: 1.4; }
.poster-en { font-size: 12px; color: var(--text-dim); }

.info { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.movie-title { font-size: 28px; font-weight: 700; }
.movie-title-en { color: var(--text-dim); font-size: 15px; margin-top: -4px; }
.meta { color: var(--text-dim); font-size: 14px; line-height: 1.6; }

.scores { display: flex; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
.score {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid var(--card-border);
}
.score b { font-size: 20px; }
.score.douban b { color: var(--douban); }
.score.rt b { color: var(--rt); }
.score.tmdb b { color: #01b4e4; }
.score small { color: var(--text-dim); }

.reason {
  font-size: 16px;
  line-height: 1.8;
  color: #d8d8e6;
  border-left: 3px solid var(--accent);
  padding-left: 14px;
}

.diverge {
  font-size: 14px;
  line-height: 1.6;
  color: #d8d8e6;
  background: rgba(1, 180, 228, 0.08);
  border: 1px solid rgba(1, 180, 228, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
}

.actions { margin-top: 2px; display: flex; flex-wrap: wrap; gap: 10px; }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: none;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.action-btn:hover { background: var(--accent); color: var(--bg-0); }
.action-btn.primary { background: var(--accent); color: var(--bg-0); font-weight: 600; }
.action-btn.primary:hover { background: transparent; color: var(--accent); }

.source-note { color: var(--text-dim); font-size: 12px; margin-top: auto; }

.page-footer { text-align: center; margin-top: 28px; color: var(--text-dim); font-size: 12px; line-height: 1.8; }
.page-footer .tip { opacity: 0.7; }
.page-footer .disclaimer { opacity: 0.55; font-size: 11px; max-width: 480px; margin: 8px auto 0; }
.page-footer code {
  background: var(--card);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* —— 氛围主题：按电影类型换色调 —— */
body[data-mood="romance"] { --glow: #3a2730; --accent: #f08a9b; }
body[data-mood="happy"]   { --glow: #3a3323; --accent: #f0c86b; }
body[data-mood="scifi"]   { --glow: #292a44; --accent: #8b7bf0; }
body[data-mood="dark"]    { --glow: #2e1d20; --accent: #e0665a; }
body[data-mood="action"]  { --glow: #33241a; --accent: #f07b4b; }
body[data-mood="anime"]   { --glow: #22332a; --accent: #7bd88f; }
body[data-mood="drama"]   { --glow: #23263a; --accent: #e6b85c; }

/* —— 随机多档推荐 —— */
.random-section {
  margin-top: 40px;
  text-align: center;
}
.random-title {
  font-size: 18px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 18px;
}
.random-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.random-btn {
  padding: 12px 22px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: none;
  color: var(--accent);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.random-btn:hover { background: var(--accent); color: var(--bg-0); }
.random-btn.big { font-size: 16px; padding: 14px 26px; }
.random-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.random-label { color: var(--text-dim); font-size: 13px; margin-right: 4px; }
.random-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.random-tag {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.random-tag:hover { border-color: var(--accent); color: var(--accent); }
.random-result { margin-top: 24px; text-align: left; }
.random-result-label {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 12px;
}
.random-result .card { margin: 0; }

/* —— 评分星级 —— */
.stars {
  position: relative;
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 2px;
  vertical-align: -1px;
}
.stars::before { content: "★★★★★"; }
.stars-fill {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  white-space: nowrap;
  color: #f5c518;
}
.stars-fill::before { content: "★★★★★"; letter-spacing: 2px; }

/* —— 卡片切换动画 —— */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.card.animate { animation: cardIn 0.35s ease; }

/* —— 可点击的导演/演员名 —— */
.person-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--text-dim);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.person-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* —— 导演/演员作品合集 —— */
.collection {
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
}
.collection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.collection-name { font-size: 18px; }
.collection-count { color: var(--text-dim); font-size: 13px; font-weight: 400; }
.collection-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.collection-close:hover { color: var(--text); }
.collection-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.collection-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}
.collection-item:hover { border-color: var(--accent); }
.collection-poster {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 6px;
  flex: none;
}
.collection-poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #3a3f5c, #202338);
  font-size: 20px;
}
.collection-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.collection-title {
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.collection-meta { color: var(--text-dim); font-size: 12px; }
.collection-douban {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
}
.collection-douban:hover { text-decoration: underline; }

/* —— 一周口碑榜（近期热门电影）—— */
.chart-section { margin-top: 44px; }
.chart-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.chart-sub {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-dim);
}
.chart-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.chart-item a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.chart-item a:hover { border-color: var(--accent); transform: translateY(-2px); }
.chart-rank {
  flex: none;
  width: 32px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  color: var(--accent);
}
/* 前三名金银铜配色 */
.chart-item:nth-child(1) .chart-rank { color: #f5c518; }
.chart-item:nth-child(2) .chart-rank { color: #cdd3dd; }
.chart-item:nth-child(3) .chart-rank { color: #d8945a; }
.chart-poster {
  flex: none;
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: linear-gradient(160deg, #3a3f5c, #202338);
}
.chart-poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.chart-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chart-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-meta {
  color: var(--text-dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-score {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.cs-douban { color: var(--douban); font-weight: 700; font-size: 14px; }
.cs-tmdb { color: #01b4e4; font-weight: 600; font-size: 12px; }

@media (max-width: 640px) {
  .card { flex-direction: column; }
  .poster { flex: none; width: 100%; max-width: 220px; margin: 0 auto; }
  .movie-title { font-size: 24px; }
  .chart-item a { gap: 10px; padding: 8px 10px; }
  .chart-rank { width: 24px; font-size: 18px; }
}

/* —— 全部片库 —— */
.header-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.library-btn {
  padding: 10px 22px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.library-btn:hover { background: var(--accent); color: var(--bg-0); }
.theme-btn {
  padding: 10px 22px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }

.library-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 11, 17, 0.82);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 40px 20px;
}
.library-panel {
  max-width: 960px;
  margin: 0 auto;
  background: var(--bg-1);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 24px;
}
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.library-title { font-size: 22px; font-weight: 700; }
.library-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.library-close:hover { color: var(--text); }

.library-search {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  margin-bottom: 16px;
}
.library-search:focus { border-color: var(--accent); }
.library-search::placeholder { color: var(--text-dim); }

.library-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.library-row { display: flex; align-items: flex-start; gap: 12px; }
.library-label {
  flex: none;
  width: 40px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 30px;
}
.library-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.library-tag {
  padding: 5px 13px;
  border-radius: 18px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.library-tag:hover { border-color: var(--accent); color: var(--accent); }
.library-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-0);
  font-weight: 600;
}

.library-count { color: var(--text-dim); font-size: 13px; margin: 8px 0 14px; }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.lib-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
}
.lib-poster-wrap {
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, #3a3f5c, #202338);
}
.lib-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.lib-card:hover .lib-poster { transform: scale(1.06); }
.lib-poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.lib-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-meta { color: var(--text-dim); font-size: 12px; }

body.no-scroll { overflow: hidden; }

@media (max-width: 640px) {
  .library-overlay { padding: 16px 10px; }
  .library-panel { padding: 16px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
  .library-row { gap: 8px; }
  .library-label { width: 32px; }
}

/* —— 浅色主题（白天模式）—— */
body[data-theme="light"] {
  --bg-0: #ffffff;
  --bg-1: #f7f8fb;
  --card: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  --text: #1c1e26;
  --text-dim: #7a7f8c;
  --accent: #c88a2a;
  --glow: #f5f1e8;
}
body[data-theme="light"] .site-title {
  background: linear-gradient(120deg, #1c1e26 10%, var(--accent) 95%);
  -webkit-background-clip: text;
  background-clip: text;
}
body[data-theme="light"] .card { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08); }
body[data-theme="light"] .card-bg::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.72));
}
body[data-theme="light"] .stars { color: rgba(0, 0, 0, 0.15); }
body[data-theme="light"] .reason { color: #3a3f4d; }
body[data-theme="light"] .diverge { color: #3a3f4d; }
body[data-theme="light"] .library-overlay { background: rgba(245, 247, 250, 0.85); }
body[data-theme="light"] .chart-item:nth-child(2) .chart-rank { color: #9aa0a8; }
