/* ==========================================================================
 * css/module4-lab.css — 模块四：晴雨沉浸互动实验室、分集名场面时间码档案馆与海报长廊
 * 归属：由负责【模块四】的 Agent 独立维护，严格复用 tokens.css 双主题变量
 * 包含：
 *   1. 女主好看照片（BLK-DEAL-520 滚动发牌画廊 + 分类瀑布图库 + 4K暗房灯箱）
 *   2. 猫的树名场面高光剧场 & 沉浸式微互动（共享文档凌晨批注 / 老筒子楼15s声控灯）
 *   3. 24 集名场面空降时间码档案馆（标签筛选 / 搜索 / 一键复制空降码 / 跳芒果TV）
 *   4. Effect Atlas 十字线揭图剧照对比器（BLK-CROSSHAIR-140 暴雨冷调 vs 丁达尔暖金）
 * ========================================================================== */

.m4-root {
  position: relative;
  color: var(--ink-primary);
}

/* 顶部模块四导航锚点胶囊栏 */
.m4-subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.m4-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  border: 1px solid var(--hairline);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  transition: all 0.25s var(--ea-out);
  cursor: pointer;
  user-select: none;
}

.m4-pill-btn:hover {
  border-color: var(--sun-gold);
  color: var(--ink-primary);
  transform: translateY(-1px);
}

.m4-pill-btn.is-active {
  background: rgba(245, 185, 82, 0.16);
  border-color: var(--sun-gold);
  color: var(--sun-gold);
  font-weight: 600;
  box-shadow: 0 0 18px rgba(245, 185, 82, 0.14);
}

body[data-theme="paper"] .m4-pill-btn.is-active {
  background: rgba(189, 123, 18, 0.14);
  color: var(--sun-amber);
  border-color: var(--sun-amber);
}

/* ==========================================================================
 * 组件 1：BLK-DEAL-520 滚动发牌画廊 & 女主郑雨神图长廊
 * ========================================================================== */
.m4-deal-stage {
  position: relative;
  min-height: 410px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background:
    radial-gradient(circle at 50% 18%, rgba(245, 185, 82, 0.14), transparent 62%),
    radial-gradient(circle at 18% 82%, rgba(110, 198, 222, 0.12), transparent 55%),
    var(--bg-elevated);
  padding: 1.5rem 1rem 3.2rem;
}

.m4-deal-deck {
  position: relative;
  width: 220px;
  height: 310px;
  transform-style: preserve-3d;
}

.m4-deal-card {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(245, 185, 82, 0.32);
  background: #0d131a;
  box-shadow: 0 18px 42px -12px rgba(0, 0, 0, 0.65);
  cursor: pointer;
  transform-origin: 50% 115%;
  transition:
    transform 0.68s var(--ea-out),
    opacity 0.5s var(--ea-out),
    border-color 0.25s ease,
    box-shadow 0.3s ease;
  user-select: none;
}

.m4-deal-card.is-undealt {
  transform: translate3d(0, 120px, -160px) rotateZ(0deg) scale(0.72) !important;
  opacity: 0;
}

.m4-deal-card:hover,
.m4-deal-card.is-focused {
  border-color: var(--sun-gold);
  box-shadow: 0 24px 52px -8px rgba(245, 185, 82, 0.32);
  z-index: 30 !important;
}

.m4-deal-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s var(--ea-out);
}

.m4-deal-card:hover img {
  transform: scale(1.05);
}

.m4-deal-card-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 0.75rem 0.65rem;
  background: linear-gradient(to top, rgba(7, 10, 15, 0.94) 12%, rgba(7, 10, 15, 0.55) 62%, transparent 100%);
  color: #f3efe6;
}

/* 女主照片网格卡片 */
.m4-photo-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .m4-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .m4-photo-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.m4-photo-card {
  position: relative;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition:
    transform 0.35s var(--ea-out),
    border-color 0.25s ease,
    box-shadow 0.35s var(--ea-out);
}

.m4-photo-card:hover {
  transform: translateY(-4px);
  border-color: var(--hairline-strong);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.5);
}

.m4-photo-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #0b1017;
  cursor: zoom-in;
}

.m4-photo-thumb-wrap.is-landscape {
  aspect-ratio: 4 / 3;
}

.m4-photo-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ea-out), filter 0.35s ease;
}

.m4-photo-card:hover .m4-photo-thumb-wrap img {
  transform: scale(1.055);
}

.m4-photo-badge-top {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.m4-photo-tag {
  padding: 0.18rem 0.52rem;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  backdrop-filter: blur(8px);
  background: rgba(9, 13, 18, 0.76);
  color: #f5b952;
  border: 1px solid rgba(245, 185, 82, 0.35);
}

/* ==========================================================================
 * 组件 2：名场面 16:9 宽银幕高光剧场 & 沉浸式微互动
 * ========================================================================== */
.m4-theater-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--hairline-strong);
  background: #070a0f;
  box-shadow: 0 20px 48px -15px rgba(0, 0, 0, 0.7);
}

.m4-theater-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ea-out), opacity 0.32s ease;
}

.m4-theater-letterbox-top,
.m4-theater-letterbox-bottom {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 2;
}

.m4-theater-letterbox-top {
  top: 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(to bottom, rgba(6, 9, 14, 0.85), transparent);
}

.m4-theater-letterbox-bottom {
  bottom: 0;
  padding: 2.4rem 1.25rem 0.95rem;
  background: linear-gradient(to top, rgba(6, 9, 14, 0.94) 15%, rgba(6, 9, 14, 0.58) 68%, transparent 100%);
}

.m4-filmstrip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (min-width: 640px) {
  .m4-filmstrip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .m4-filmstrip {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }
}

.m4-filmstrip-item {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--hairline);
  cursor: pointer;
  opacity: 0.68;
  transition: all 0.25s var(--ea-out);
  background: #090d12;
}

.m4-filmstrip-item:hover {
  opacity: 0.95;
  transform: translateY(-2px);
}

.m4-filmstrip-item.is-active {
  opacity: 1;
  border-color: var(--sun-gold);
  box-shadow: 0 0 0 2px rgba(245, 185, 82, 0.28);
  transform: translateY(-2px);
}

.m4-filmstrip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 声控灯暖光呼吸动画 */
.m4-lamp-card {
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.m4-lamp-card.is-lit {
  border-color: rgba(245, 185, 82, 0.65) !important;
  box-shadow: 0 0 38px rgba(245, 185, 82, 0.18);
}

.m4-lamp-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 82% 22%, rgba(245, 185, 82, 0.28), rgba(232, 136, 58, 0.08) 48%, transparent 72%);
  opacity: 0;
  transition: opacity 0.45s ease;
}

.m4-lamp-card.is-lit .m4-lamp-glow {
  opacity: 1;
}

/* ==========================================================================
 * 组件 3：24 集名场面空降时间码档案馆
 * ========================================================================== */
.m4-tc-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 768px) {
  .m4-tc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .m4-tc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.m4-tc-card {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--bg-elevated);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.7rem;
  transition: all 0.25s var(--ea-out);
}

.m4-tc-card:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
}

.m4-tc-card.is-benchmark {
  border-color: rgba(245, 185, 82, 0.42);
  background:
    linear-gradient(135deg, rgba(245, 185, 82, 0.07), transparent 55%),
    var(--bg-elevated);
}

.m4-tc-thumb {
  width: 84px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--hairline);
  background: #0a0f16;
  position: relative;
}

.m4-tc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
 * 组件 4：Effect Atlas 十字线揭图剧照对比器 (BLK-CROSSHAIR-140)
 * ========================================================================== */
.m4-crosshair-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 300px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--hairline-strong);
  background: #070b10;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.m4-ch-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.m4-ch-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* 底层：丁达尔放晴暖金调 (6500K Warm Golden Sunshower) */
.m4-ch-warm img {
  filter: saturate(1.28) contrast(1.06) brightness(1.06) sepia(0.14);
}

.m4-ch-warm::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 78% 18%, rgba(245, 185, 82, 0.36), rgba(232, 136, 58, 0.14) 42%, transparent 70%),
    linear-gradient(125deg, rgba(245, 185, 82, 0.18) 0%, transparent 52%, rgba(245, 185, 82, 0.12) 100%);
  mix-blend-mode: screen;
}

/* 顶层被裁切层：暴雨阴霾冷调 (4100K Rainstorm Cold Darkroom) */
.m4-ch-cold {
  will-change: clip-path;
}

.m4-ch-cold img {
  filter: saturate(0.48) contrast(1.22) brightness(0.74) hue-rotate(172deg);
}

.m4-ch-cold::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14, 29, 46, 0.56) 0%, rgba(19, 42, 66, 0.35) 55%, rgba(8, 15, 24, 0.72) 100%),
    repeating-linear-gradient(
      108deg,
      rgba(110, 198, 222, 0.12) 0px,
      rgba(110, 198, 222, 0.12) 1px,
      transparent 1px,
      transparent 19px
    );
}

/* 十字准星线与光学刻度环 */
.m4-ch-line-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: linear-gradient(
    to bottom,
    rgba(110, 198, 222, 0.9),
    rgba(245, 185, 82, 0.95) 50%,
    rgba(110, 198, 222, 0.9)
  );
  box-shadow: 0 0 12px rgba(245, 185, 82, 0.65);
  pointer-events: none;
  z-index: 15;
}

.m4-ch-line-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(
    to right,
    rgba(110, 198, 222, 0.9),
    rgba(245, 185, 82, 0.95) 50%,
    rgba(110, 198, 222, 0.9)
  );
  box-shadow: 0 0 12px rgba(245, 185, 82, 0.65);
  pointer-events: none;
  z-index: 15;
}

.m4-ch-reticle {
  position: absolute;
  width: 68px;
  height: 68px;
  margin-left: -34px;
  margin-top: -34px;
  border-radius: 9999px;
  border: 1.5px solid rgba(245, 185, 82, 0.92);
  box-shadow:
    0 0 0 4px rgba(9, 13, 18, 0.45),
    0 0 24px rgba(245, 185, 82, 0.55),
    inset 0 0 14px rgba(110, 198, 222, 0.4);
  pointer-events: none;
  z-index: 16;
  display: flex;
  align-items: center;
  justify-content: center;
}

.m4-ch-reticle::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #f5b952;
  box-shadow: 0 0 8px #f5b952;
}

.m4-ch-hud-coord {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  background: rgba(9, 13, 18, 0.88);
  color: #f5b952;
  border: 1px solid rgba(245, 185, 82, 0.45);
}

/* ==========================================================================
 * 4K 剧照暗房灯箱 Modal & 全局复制 Toast
 * ========================================================================== */
.m4-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(6, 9, 14, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.m4-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.m4-lightbox-dialog {
  max-width: 1120px;
  width: 100%;
  max-height: 90vh;
  border-radius: 16px;
  border: 1px solid var(--hairline-strong);
  background: #0c1118;
  color: #f3efe6;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.85);
}

@media (min-width: 900px) {
  .m4-lightbox-dialog {
    grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr);
  }
}

.m4-toast {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 9995;
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(9, 13, 18, 0.94);
  color: #f5b952;
  border: 1px solid rgba(245, 185, 82, 0.55);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s var(--ea-out);
}

.m4-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
 * 晴昼羊皮纸主题精修 & 桌面端手机预览模式 (body.is-mobile-sim) 适配
 * ========================================================================== */
body[data-theme="paper"] .m4-photo-card:hover {
  box-shadow: 0 14px 28px -10px rgba(82, 58, 28, 0.16);
}

body.is-mobile-sim .m4-photo-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
}

body.is-mobile-sim .m4-tc-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
}

body.is-mobile-sim .m4-filmstrip {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

body.is-mobile-sim .m4-deal-stage {
  min-height: 320px;
  padding: 1rem 0.5rem 2.6rem;
}

body.is-mobile-sim .m4-deal-deck {
  width: 170px;
  height: 240px;
}

body.is-mobile-sim .m4-crosshair-stage {
  min-height: 220px;
}

