/* ===== 影视作品展示页（movies.html）—— 深色主题 · 卡片列布局 ===== */
.movies-page {
  background: #000;
  min-height: 100vh;
  color: #e9e4f5;
}
/* 去掉全局 .app 的左右 18px 内边距，让卡片区在窄屏更宽、两列不挤在中间 */
.movies-page.app { padding-left: 0; padding-right: 0; }
.movies-page .topbar {
  background: rgba(0, 0, 0, .82);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .4);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
/* 与 gotcha 页 GOTCHA 大标题完全同款：衬线字体、字号、彩色字母（见 style.css 的 .ltr 规则） */
.movies-page .topbar .logo { color: #f3ecff; margin-bottom: 20px; }
.movies-page .subtitle { color: #c9bff0; }

.movies-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 12px 64px;
}
.movies-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 14px;
}
.movies-count {
  flex: 1 1 auto;
  min-width: 0;
  color: #b9aee0;
  font-size: 16px;
  text-align: left;
}

/* 标题行右侧：搜索 / 骰子 图标按钮 */
.movies-head-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.movies-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #cbbdf5;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease, border-color .15s ease;
}
.movies-icon-btn svg { width: 20px; height: 20px; display: block; }
.movies-icon-btn:hover {
  background: rgba(155, 120, 224, .24);
  border-color: rgba(179, 155, 240, .45);
  color: #fff;
  transform: translateY(-2px);
}
.movies-icon-btn.is-active {
  background: rgba(155, 120, 224, .34);
  border-color: rgba(179, 155, 240, .6);
  color: #fff;
}

/* 搜索框独占下一行，默认隐藏，点搜索图标才展开 */
.movies-search-row {
  margin: 0 0 16px;
  animation: moviesSearchIn .18s ease;
}
.movies-search-row[hidden] { display: none; }
.movies-search-row .movies-search {
  width: 100%;
  max-width: none;
  flex: none;
}
@keyframes moviesSearchIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
/* 右侧关键词检索 */
.movies-search {
  flex: 1 1 220px;
  max-width: 340px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #f2eeff;
  font-size: 16px;
  padding: 9px 16px;
  border-radius: 999px;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.movies-search::placeholder { color: #9b8fc4; }
.movies-search:focus { border-color: #9b78e0; background: rgba(255, 255, 255, .1); }

/* 列布局：每张卡片高度独立，展开「出处台词」只推高本列，不影响其它列/卡片 */
.movie-grid {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.movie-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.movie-card {
  position: relative;
  background: #241e38;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.movie-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .5);
}

/* 骰子选中的卡片：金色高亮 + 弹一下 */
.movie-card--picked {
  border-color: rgba(249, 200, 14, .9);
  box-shadow:
    0 0 0 2px rgba(249, 200, 14, .5),
    0 14px 34px rgba(249, 200, 14, .22),
    0 8px 20px rgba(0, 0, 0, .5);
  animation: cardPicked 1s ease;
  z-index: 60;
}
.movie-card--picked::after {
  content: '今晚就看它！';
  position: absolute;
  left: 0;
  top: 14px;
  z-index: 6;
  padding: 4px 12px 4px 10px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, #f9c80e, #ef7d3b);
  color: #2a1a06;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .4);
  pointer-events: none;
}
@keyframes cardPicked {
  0%   { transform: scale(1); }
  28%  { transform: scale(1.05); }
  58%  { transform: scale(.99); }
  100% { transform: scale(1); }
}

/* 海报：固定 2:3，加载/失败显示占位；有海报时可点击看大图 */
.movie-poster-box {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #1c1830;
}
.movie-poster-box.has-poster { cursor: zoom-in; }
.movie-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.movie-poster-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #8a7fb0;
  font-size: 13px;
  background: repeating-linear-gradient(45deg, #221c36, #221c36 12px, #1c1730 12px, #1c1730 24px);
}
.movie-poster-ph .ph-ico { font-size: 34px; line-height: 1; }

.movie-body {
  padding: 13px 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.movie-title-en {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  color: #f2eeff;
}
.movie-title-cn {
  font-size: 13px;
  color: #b3a8d6;
  margin-top: -4px;
}
.movie-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.badge-type {
  background: #9b78e0;
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
  white-space: nowrap;
}
.movie-source {
  color: #a99fce;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* 出处台词：过长折叠 + 渐隐 + More/Less；整块可点击切换 */
.movie-lines-wrap { margin-top: 2px; }
.movie-lines-wrap.is-collapsible { cursor: pointer; }
.movie-lines {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 13px;
  color: #d8d0ee;
  position: relative;
}
.movie-lines.collapsed {
  max-height: 5.2em;
  overflow: hidden;
}
.movie-lines.collapsed::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2em;
  background: linear-gradient(to bottom, rgba(36, 30, 56, 0), #241e38);
  pointer-events: none;
}
.lines-toggle {
  margin-top: 4px;
  align-self: flex-start;
  background: none;
  border: none;
  color: #b79bf0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}
.lines-toggle:hover { text-decoration: underline; }

/* 豆瓣「豆」字标：全部移到海报右下角 */
.douban-badges {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.douban-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #00b51c;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 181, 28, .35);
  transition: transform .15s ease, background .15s ease;
}
.douban-badge:hover { transform: translateY(-2px); background: #009d18; }

.movies-empty {
  text-align: center;
  color: #9b8fc4;
  padding: 60px 0;
  font-size: 15px;
}

/* 海报大图灯箱：点击海报打开，再次点击关闭 */
.poster-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(8, 6, 14, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.poster-lightbox[hidden] { display: none; }
.poster-lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

/* 底部导航（深色适配） */
.movies-page .admin-links { margin-top: 28px; }
.movies-page .admin-link {
  color: #c9bff0;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
}
.movies-page .admin-link:hover { color: #fff; background: rgba(155, 120, 224, .22); }

/* ===== 骰子：半透遮罩 + 3D 旋转 ===== */
.dice-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(6, 4, 12, .72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.dice-overlay[hidden] { display: none; }

.dice-stage { perspective: 900px; }
/* 遮罩出现时骰子「弹出」：缩放 + 上浮淡入 */
.dice-stage.is-pop { animation: dicePopIn .3s cubic-bezier(.2,.8,.3,1.25); }
@keyframes dicePopIn {
  from { opacity: 0; transform: scale(.55) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.dice {
  position: relative;
  width: 104px;
  height: 104px;
  transform-style: preserve-3d;
  transform: rotateX(-18deg) rotateY(22deg);
}
.dice.is-rolling {
  animation: diceRoll .62s linear infinite;
}
@keyframes diceRoll {
  0%   { transform: rotateX(0deg)   rotateY(0deg)   rotateZ(0deg); }
  25%  { transform: rotateX(180deg) rotateY(90deg)  rotateZ(20deg); }
  50%  { transform: rotateX(360deg) rotateY(180deg) rotateZ(0deg); }
  75%  { transform: rotateX(540deg) rotateY(270deg) rotateZ(-20deg); }
  100% { transform: rotateX(720deg) rotateY(360deg) rotateZ(0deg); }
}

.dice-face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(155deg, #fffdf8, #e5dbf6);
  border: 1px solid rgba(109, 74, 166, .3);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .65),
    inset 0 -6px 12px rgba(109, 74, 166, .16),
    0 6px 18px rgba(0, 0, 0, .45);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 13px;
}
.dice-face i {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #6d4aa6, #2e1a4d);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .45);
}
.dice-face--1 { transform: translateZ(52px); }
.dice-face--2 { transform: rotateY(180deg) translateZ(52px); }
.dice-face--3 { transform: rotateY(90deg)  translateZ(52px); }
.dice-face--4 { transform: rotateY(-90deg) translateZ(52px); }
.dice-face--5 { transform: rotateX(90deg)  translateZ(52px); }
.dice-face--6 { transform: rotateX(-90deg) translateZ(52px); }

.dice-face--1 i { grid-area: 2 / 2; }
.dice-face--2 i:nth-child(1) { grid-area: 1 / 1; }
.dice-face--2 i:nth-child(2) { grid-area: 3 / 3; }
.dice-face--3 i:nth-child(1) { grid-area: 1 / 1; }
.dice-face--3 i:nth-child(2) { grid-area: 2 / 2; }
.dice-face--3 i:nth-child(3) { grid-area: 3 / 3; }
.dice-face--4 i:nth-child(1) { grid-area: 1 / 1; }
.dice-face--4 i:nth-child(2) { grid-area: 1 / 3; }
.dice-face--4 i:nth-child(3) { grid-area: 3 / 1; }
.dice-face--4 i:nth-child(4) { grid-area: 3 / 3; }
.dice-face--5 i:nth-child(1) { grid-area: 1 / 1; }
.dice-face--5 i:nth-child(2) { grid-area: 1 / 3; }
.dice-face--5 i:nth-child(3) { grid-area: 2 / 2; }
.dice-face--5 i:nth-child(4) { grid-area: 3 / 1; }
.dice-face--5 i:nth-child(5) { grid-area: 3 / 3; }
.dice-face--6 i:nth-child(1) { grid-area: 1 / 1; }
.dice-face--6 i:nth-child(2) { grid-area: 1 / 3; }
.dice-face--6 i:nth-child(3) { grid-area: 2 / 1; }
.dice-face--6 i:nth-child(4) { grid-area: 2 / 3; }
.dice-face--6 i:nth-child(5) { grid-area: 3 / 1; }
.dice-face--6 i:nth-child(6) { grid-area: 3 / 3; }

.dice-tip {
  color: #ece4ff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .7);
}

/* 骰子选中卡片后：页面其余地方半透遮罩，选中卡浮于其上 */
.pick-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 5, 16, .62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}
.pick-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 回到顶部：滚动过一屏后显示 */
.movies-backtop {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 70;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(109, 74, 166, .88);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease, background .15s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.movies-backtop.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.movies-backtop:hover { background: #6d4aa6; transform: translateY(-2px); }
.movies-backtop:active { transform: scale(.94); }

/* 窄屏：收紧间距；检索框占满整行 */
@media (max-width: 520px) {
  .movie-grid { gap: 12px; }
  .movie-col { gap: 12px; }
  .movies-search { flex-basis: 100%; max-width: none; }
  .movies-count { font-size: 15px; }
  .dice { width: 88px; height: 88px; }
  .dice-face { padding: 11px; }
  .dice-face i { width: 13px; height: 13px; }
  .dice-face--1 { transform: translateZ(44px); }
  .dice-face--2 { transform: rotateY(180deg) translateZ(44px); }
  .dice-face--3 { transform: rotateY(90deg)  translateZ(44px); }
  .dice-face--4 { transform: rotateY(-90deg) translateZ(44px); }
  .dice-face--5 { transform: rotateX(90deg)  translateZ(44px); }
  .dice-face--6 { transform: rotateX(-90deg) translateZ(44px); }
}

/* 底部导航固定后，内容仍可完整滚动到按钮上方。 */
.movies-page.app{padding-bottom:calc(80px + env(safe-area-inset-bottom, 0px));}
.movies-page .fixed-bottom-nav{margin-top:0;}
