/* ============================================================
   《16人格合租屋：活過這 7 天》 V2 電影級編輯黑金 × X-Ray 透視美學
   ============================================================ */

:root {
  --bg-obsidian: #08090e;
  --bg-surface: #121521;
  --bg-card-paper: #f7f4ec;
  --ink-dark: #101219;
  --ink-muted: #5a6275;
  --text-light: #f8fafc;
  --text-dim: #94a3b8;
  --neon-pink: #ff2a85;
  --neon-cyan: #00f0ff;
  --neon-amber: #fbbf24;
  --neon-green: #10b981;
  --neon-red: #ef4444;
  --border-subtle: rgba(255, 255, 255, 0.11);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-obsidian);
  color: var(--text-light);
  font-family: var(--font-sans);
  overflow-x: hidden;
  user-select: none;
}

/* ==================== 日夜動態環境光與底片顆粒 ==================== */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(115px);
  opacity: 0.25;
  transition: background 0.9s ease, opacity 0.4s ease, transform 0.8s ease;
}

.orb-1 {
  width: 440px;
  height: 440px;
  top: -130px;
  right: -110px;
  background: radial-gradient(circle, #0ea5e9, transparent 70%);
}

.orb-2 {
  width: 400px;
  height: 400px;
  bottom: -120px;
  left: -110px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
}

body.time-morning .orb-1 { background: radial-gradient(circle, #38bdf8, transparent 70%); }
body.time-morning .orb-2 { background: radial-gradient(circle, #fbbf24, transparent 70%); opacity: 0.18; }

body.time-afternoon .orb-1 { background: radial-gradient(circle, #f59e0b, transparent 70%); opacity: 0.22; }
body.time-afternoon .orb-2 { background: radial-gradient(circle, #ec4899, transparent 70%); opacity: 0.2; }

body.time-midnight .orb-1 { background: radial-gradient(circle, #6366f1, transparent 70%); opacity: 0.28; }
body.time-midnight .orb-2 { background: radial-gradient(circle, #ff2a85, transparent 70%); opacity: 0.26; }

body.xray-active .orb-1 {
  background: radial-gradient(circle, #00f0ff, transparent 70%) !important;
  opacity: 0.42 !important;
}
body.xray-active .orb-2 {
  background: radial-gradient(circle, #ff2a85, transparent 70%) !important;
  opacity: 0.44 !important;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
}

.grain-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: radial-gradient(#ffffff 0.7px, transparent 0.7px);
  background-size: 4px 4px;
}

/* 危險紅邊呼吸暈影 */
.danger-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  box-shadow: inset 0 0 90px rgba(239, 68, 68, 0);
  transition: box-shadow 0.4s ease;
}

body.danger-critical .danger-vignette {
  animation: vignettePulse 1.4s ease-in-out infinite;
}

@keyframes vignettePulse {
  0%, 100% { box-shadow: inset 0 0 70px rgba(239, 68, 68, 0.16); }
  50% { box-shadow: inset 0 0 110px rgba(239, 68, 68, 0.46); }
}

/* 螢幕震動特效 */
.app-shell.shake {
  animation: screenShake 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes screenShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-6px, 2px, 0); }
  35% { transform: translate3d(6px, -2px, 0); }
  55% { transform: translate3d(-4px, 1px, 0); }
  75% { transform: translate3d(4px, -1px, 0); }
}

/* 主應用容器 */
.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 16px 26px;
  display: flex;
  flex-direction: column;
}

/* ==================== 頂部導覽列 ==================== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 12px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.brand-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.brand-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #e2e8f0;
}

.top-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-light);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(8px);
  transition: all 0.18s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

/* 畫面切換系統 */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeSlideIn 0.28s ease;
}

.screen.active {
  display: flex;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* ==================== 按鈕系統 ==================== */
.btn {
  border: none;
  border-radius: 14px;
  font-family: var(--font-sans);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 13px 16px;
  font-size: 14.5px;
  color: #fff;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-block { width: 100%; }
.btn-lg { width: 100%; padding: 16px 20px; font-size: 15.5px; }
.btn-lg small { font-weight: 500; font-size: 12px; opacity: 0.8; }

.btn-primary {
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  color: #090a0f;
  box-shadow: 0 10px 26px rgba(255, 255, 255, 0.14);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 255, 255, 0.24);
}

.btn-hell {
  background: linear-gradient(135deg, #221029 0%, #340e22 100%);
  border: 1.5px solid rgba(255, 42, 133, 0.7);
  color: #fff;
  align-items: stretch;
  text-align: left;
  box-shadow: 0 10px 28px rgba(255, 42, 133, 0.24);
}

.btn-hell:hover {
  transform: translateY(-2px);
  border-color: var(--neon-pink);
  box-shadow: 0 14px 32px rgba(255, 42, 133, 0.38);
}

.hell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.hell-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--neon-pink);
  color: #fff;
}

.hell-rate {
  font-size: 11px;
  color: #fda4af;
  font-weight: 700;
}

.hell-name {
  font-size: 16px;
  font-weight: 900;
}

.btn-neon {
  background: linear-gradient(135deg, #ff2a85 0%, #a855f7 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 42, 133, 0.32);
}

.btn-neon:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(255, 42, 133, 0.48);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.085);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.24);
  color: #cbd5e1;
  font-size: 13.5px;
}

.btn-ghost:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.btn-danger {
  background: var(--neon-red);
  color: #fff;
}

/* ==================== 首頁大廳 ==================== */
.invite-banner {
  background: linear-gradient(135deg, rgba(255, 42, 133, 0.18), rgba(0, 240, 255, 0.14));
  border: 1.5px solid var(--neon-pink);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
}

.invite-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--neon-pink);
  margin-bottom: 6px;
}

.invite-desc {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #f1f5f9;
}

.hero-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(18, 21, 33, 0.86) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 26px;
  padding: 26px 20px 22px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
}

/* 監控鏡頭四角準星 */
.hero-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: rgba(0, 240, 255, 0.55);
  border-style: solid;
  pointer-events: none;
}
.hero-corner.tl { top: 12px; left: 12px; border-width: 2px 0 0 2px; border-radius: 4px 0 0 0; }
.hero-corner.tr { top: 12px; right: 12px; border-width: 2px 2px 0 0; border-radius: 0 4px 0 0; }
.hero-corner.bl { bottom: 12px; left: 12px; border-width: 0 0 2px 2px; border-radius: 0 0 0 4px; }
.hero-corner.br { bottom: 12px; right: 12px; border-width: 0 2px 2px 0; border-radius: 0 0 4px 0; }

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--neon-cyan);
  margin-bottom: 10px;
}

.hero-title {
  margin: 0 0 12px;
  font-size: 35px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.accent-gradient {
  background: linear-gradient(90deg, #ff2a85, #fbbf24, #00f0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.65;
  color: #cbd5e1;
}

.hero-sub strong { color: #fff; }

/* 首頁角色立繪預覽列 */
.home-avatar-showcase {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.showcase-mini {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 5px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.showcase-mini:hover {
  transform: translateY(-3px) rotate(-1deg);
  border-color: var(--neon-cyan);
}

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.home-cta-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.home-secondary-row .btn {
  font-size: 13px;
  padding: 12px 10px;
}

.home-stats-bar {
  margin-top: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

/* ==================== 室友入住簡報畫面 ==================== */
.intro-header { margin-bottom: 14px; }
.mono-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-pink);
  letter-spacing: 0.08em;
}
.intro-header h2 { margin: 6px 0 0; font-size: 22px; font-weight: 900; }

.roster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.roster-card {
  background: rgba(18, 21, 33, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-card-top { display: flex; align-items: center; gap: 10px; }
.roster-card-avatar { width: 50px; height: 50px; flex-shrink: 0; }
.roster-card-name { font-size: 14px; font-weight: 800; }
.roster-card-role { font-size: 11px; color: var(--text-dim); }
.roster-card-quote {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px;
  border-radius: 10px;
}
.roster-card-passive { font-size: 11px; color: #fda4af; font-weight: 700; }

.combo-preview-box {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.55);
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 14px;
}
.combo-preview-title { font-size: 12px; font-weight: 800; color: #e9d5ff; margin-bottom: 6px; }
.combo-preview-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.combo-mini-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 12, 20, 0.78);
  color: #fde047;
  border: 1px solid rgba(253, 224, 71, 0.3);
}

.intro-tips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.035);
  border-radius: 12px;
}

.intro-tips code {
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: #fff;
}

/* ==================== 核心遊玩 HUD ==================== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 9px;
}

.stat-item {
  position: relative;
  background: rgba(18, 21, 33, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 8px 8px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-item.danger {
  border-color: rgba(239, 68, 68, 0.85);
  animation: dangerPulse 0.95s infinite;
}

@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
  50% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.5); }
}

.stat-dot {
  position: absolute;
  top: -5px;
  width: 0;
  height: 0;
  border-radius: 50%;
  transition: all 0.18s ease;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}
.stat-dot.dot-sm { width: 8px; height: 8px; background: var(--neon-cyan); }
.stat-dot.dot-lg { width: 12px; height: 12px; background: var(--neon-pink); }

/* 數值浮動跳字特效 */
.stat-float-wrap {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 15;
}

.stat-float-num {
  position: absolute;
  left: -18px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
  animation: floatDelta 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.stat-float-num.pos { color: #34d399; }
.stat-float-num.neg { color: #fb7185; }

@keyframes floatDelta {
  0% { opacity: 0; transform: translateY(6px) scale(0.8); }
  20% { opacity: 1; transform: translateY(-6px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-28px) scale(0.95); }
}

.stat-icon { font-size: 16px; line-height: 1; }
.stat-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  width: 50%;
  border-radius: 999px;
  transition: width 0.36s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s;
}
.stat-item[data-stat="harmony"] .stat-fill { background: #10b981; }
.stat-item[data-stat="finance"] .stat-fill { background: #fbbf24; }
.stat-item[data-stat="cleanliness"] .stat-fill { background: #0ea5e9; }
.stat-item[data-stat="san"] .stat-fill { background: #a855f7; }
.stat-item.danger .stat-fill { background: #ef4444; }

.stat-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}
.stat-val { font-family: var(--font-mono); color: #fff; }

/* 天數與日夜時段 + 電量 */
.hud-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.day-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  border-radius: 10px;
}
.day-big { font-family: var(--font-mono); font-size: 12px; font-weight: 900; color: #fff; }
.time-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-amber);
}

.battery-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  border-radius: 10px;
}
.bat-label { font-size: 11px; font-weight: 700; color: #cbd5e1; white-space: nowrap; }
.bat-track { flex: 1; height: 7px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; overflow: hidden; }
.bat-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #00f0ff, #ff2a85); transition: width 0.15s linear; }
.bat-pct { font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: var(--neon-cyan); min-width: 34px; text-align: right; }

/* 4 位室友監控列 */
.roommate-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 9px;
}

.rm-chip {
  background: rgba(18, 21, 33, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.rm-chip:hover { border-color: rgba(255, 255, 255, 0.34); transform: translateY(-1px); }
.rm-chip.speaking { border-color: var(--neon-cyan); box-shadow: 0 0 14px rgba(0, 240, 255, 0.28); }
.rm-chip.slammed { opacity: 0.4; filter: grayscale(1); }
.rm-chip-avatar { width: 32px; height: 32px; flex-shrink: 0; }
.rm-chip-info { flex: 1; min-width: 0; }
.rm-chip-code { font-family: var(--font-mono); font-size: 11px; font-weight: 900; color: #fff; display: block; }
.rm-stress-track { margin-top: 3px; width: 100%; height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; overflow: hidden; }
.rm-stress-fill { height: 100%; background: #34d399; transition: width 0.3s ease; }
.rm-stress-fill.low { background: #ef4444; }

/* 房東緊急道具列 */
.tools-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 6px;
  margin-bottom: 11px;
}

.tool-pill {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  padding: 6px 6px;
  color: #e2e8f0;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.tool-pill:hover:not(:disabled) {
  background: rgba(0, 240, 255, 0.14);
  border-color: var(--neon-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.tool-pill.used,
.tool-pill:disabled {
  opacity: 0.32;
  text-decoration: line-through;
  cursor: not-allowed;
}

.tool-chat-btn {
  padding: 6px 10px;
  border-color: rgba(168, 85, 247, 0.45);
  color: #e9d5ff;
}

/* ==================== 多層實體滑卡舞台 ==================== */
.card-stage {
  position: relative;
  flex: 1;
  min-height: 342px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin-bottom: 12px;
  perspective: 1100px;
}

.card-back-layer {
  position: absolute;
  border-radius: 26px;
  pointer-events: none;
  transition: transform 0.25s ease;
}

.card-back-1 {
  inset: 10px 10px -7px;
  background: rgba(247, 244, 236, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transform: scale(0.96);
}

.card-back-2 {
  inset: 18px 20px -13px;
  background: rgba(247, 244, 236, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: scale(0.92);
}

.swipe-card {
  position: relative;
  width: 100%;
  background: var(--bg-card-paper);
  color: var(--ink-dark);
  border-radius: 26px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.6);
  border: 2px solid #e6e1d5;
  cursor: grab;
  touch-action: none;
  overflow: hidden;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  will-change: transform;
}

.swipe-card:active { cursor: grabbing; }

/* 化學反應金色高光卡框 */
.swipe-card.is-combo {
  border-color: #c084fc;
  box-shadow: 0 24px 56px rgba(168, 85, 247, 0.35), 0 0 0 2px rgba(253, 224, 71, 0.35);
}

/* 3D 滑動高光反光層 */
.card-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* X-Ray 透視狀態 */
.swipe-card.is-xray {
  background: #0c0e18;
  color: #f8fafc;
  border-color: var(--neon-pink);
  box-shadow: 0 0 42px rgba(255, 42, 133, 0.48), inset 0 0 32px rgba(0, 240, 255, 0.16);
}

.xray-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  top: -10px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-pink), transparent);
  box-shadow: 0 0 20px var(--neon-cyan);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}

.swipe-card.is-xray .xray-scanline {
  opacity: 0.95;
  animation: scanSweep 1.25s linear infinite;
}

@keyframes scanSweep {
  0% { top: 0%; }
  100% { top: 100%; }
}

.danmaku-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
}
.swipe-card.is-xray .danmaku-layer { opacity: 1; }

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 42, 133, 0.26);
  border: 1px solid rgba(255, 42, 133, 0.65);
  color: #ffe4ef;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  animation: floatDanmaku 5s linear infinite;
}

@keyframes floatDanmaku {
  0% { transform: translateX(110%); }
  100% { transform: translateX(-135%); }
}

.choice-stamp {
  position: absolute;
  top: 22px;
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 13px;
  font-weight: 900;
  font-size: 13px;
  line-height: 1.3;
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

.stamp-left { right: 16px; background: #0ea5e9; color: #fff; border: 2px solid #fff; transform: rotate(7deg); }
.stamp-right { left: 16px; background: #ff2a85; color: #fff; border: 2px solid #fff; transform: rotate(-7deg); }
.stamp-dir { display: block; font-family: var(--font-mono); font-size: 10px; opacity: 0.92; margin-bottom: 2px; }

/* 卡片內容 */
.card-header { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.card-avatar-wrap { width: 64px; height: 64px; flex-shrink: 0; }
.avatar-svg { width: 100%; height: 100%; display: block; border-radius: 16px; }
.card-speaker-meta { flex: 1; min-width: 0; }
.card-speaker-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.speaker-name { font-size: 16.5px; font-weight: 900; }
.event-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(16, 18, 25, 0.1);
  color: #334155;
}
.swipe-card.is-xray .event-tag { background: rgba(0, 240, 255, 0.18); color: var(--neon-cyan); }
.speaker-role { font-size: 12px; color: var(--ink-muted); margin-top: 2px; font-weight: 600; }
.swipe-card.is-xray .speaker-role { color: #fda4af; }

.xray-mode-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(16, 18, 25, 0.08);
  color: #475569;
  letter-spacing: 0.06em;
}
.swipe-card.is-xray .xray-mode-badge {
  background: var(--neon-pink);
  color: #fff;
  box-shadow: 0 0 14px var(--neon-pink);
}

.card-combo-banner {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, #1e1033, #3b0d30);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  border: 1px solid #c084fc;
  position: relative;
  z-index: 2;
}
.card-combo-banner strong { color: #fde047; }

.card-body {
  position: relative;
  z-index: 2;
  margin: 13px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dialogue-box { border-radius: 16px; padding: 16px; }
.surface-box { background: #ffffff; border: 1.5px solid #e2ddd0; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); }
.surface-box p { margin: 0; font-size: 16px; line-height: 1.65; font-weight: 700; color: #101219; }

.inner-box { display: none; background: rgba(255, 42, 133, 0.12); border: 1.5px solid rgba(0, 240, 255, 0.6); }
.inner-label { font-family: var(--font-mono); font-size: 11px; font-weight: 900; color: var(--neon-cyan); margin-bottom: 8px; letter-spacing: 0.05em; }
.inner-box p { margin: 0; font-size: 15.5px; line-height: 1.65; font-weight: 800; color: #fff; white-space: pre-line; }

.swipe-card.is-xray .surface-box { display: none; }
.swipe-card.is-xray .inner-box { display: block; animation: glitchPop 0.22s ease; }

@keyframes glitchPop {
  0% { transform: skewX(-4deg) scale(0.98); opacity: 0.4; }
  60% { transform: skewX(2deg) scale(1.01); }
  100% { transform: skewX(0) scale(1); opacity: 1; }
}

.card-footer-hint {
  position: relative;
  z-index: 2;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  padding-top: 6px;
  border-top: 1px dashed rgba(16, 18, 25, 0.12);
}
.swipe-card.is-xray .card-footer-hint { color: var(--neon-cyan); border-top-color: rgba(0, 240, 255, 0.28); }

/* ==================== 底部控制區 ==================== */
.controls-dock {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
}

.choice-btn {
  background: rgba(18, 21, 33, 0.92);
  border: 1.5px solid var(--border-subtle);
  border-radius: 16px;
  padding: 10px 10px;
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  transition: all 0.18s ease;
}
.choice-btn-right { text-align: right; justify-content: flex-end; }
.choice-btn-left:hover { border-color: #0ea5e9; background: rgba(14, 165, 233, 0.14); }
.choice-btn-right:hover { border-color: #ff2a85; background: rgba(255, 42, 133, 0.14); }
.choice-arrow { font-family: var(--font-mono); font-weight: 900; font-size: 14px; color: var(--text-dim); }
.choice-btn-content { display: flex; flex-direction: column; gap: 4px; }
.choice-label { font-size: 12.5px; line-height: 1.35; font-weight: 800; }
.choice-peek { font-size: 11px; line-height: 1.3; color: var(--neon-cyan); font-weight: 700; }

.xray-hold-btn {
  width: 68px;
  background: linear-gradient(180deg, #1b152b 0%, #2a1126 100%);
  border: 1.5px solid rgba(255, 42, 133, 0.65);
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
  transition: all 0.15s ease;
}
.xray-hold-btn:hover,
.xray-hold-btn.holding {
  background: var(--neon-pink);
  border-color: #fff;
  box-shadow: 0 0 22px rgba(255, 42, 133, 0.65);
  transform: scale(0.96);
}
.xray-eye { font-size: 18px; }

.outcome-banner {
  margin-top: 10px;
  background: rgba(14, 18, 30, 0.94);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #e2e8f0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: fadeSlideIn 0.2s ease;
}

.outcome-live-dot {
  color: var(--neon-cyan);
  font-size: 10px;
  margin-top: 3px;
}

/* ==================== 打破第四面牆黑屏測謊畫面 ==================== */
.screen-blackout {
  background: #040508;
  border-radius: 24px;
  padding: 24px 18px;
  border: 1px solid rgba(255, 42, 133, 0.4);
  box-shadow: 0 0 55px rgba(255, 42, 133, 0.2);
}
.terminal-status { font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: var(--neon-pink); letter-spacing: 0.08em; margin-bottom: 16px; }
.reveal-headline { font-size: 22px; line-height: 1.55; font-weight: 900; color: #fff; min-height: 70px; margin-bottom: 18px; }
.evidence-box { background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--neon-cyan); border-radius: 0 14px 14px 0; padding: 14px; margin-bottom: 18px; }
.evidence-title { font-size: 12px; font-weight: 800; color: var(--neon-cyan); margin-bottom: 10px; }
.evidence-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.55; color: #e2e8f0; }
.verdict-box { text-align: center; padding-top: 8px; }
.verdict-sub { font-size: 13px; color: var(--text-dim); }
.verdict-code {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 4px 0;
  background: linear-gradient(90deg, #00f0ff, #ff2a85);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.verdict-role { font-size: 15px; font-weight: 800; color: #f8fafc; margin-bottom: 20px; }
.claim-prompt p { font-size: 14px; font-weight: 800; margin: 0 0 12px; color: #fff; }
.claim-prompt small { font-weight: 500; color: var(--text-dim); }
.mbti-picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.mbti-pick-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 4px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mbti-pick-btn:hover { background: var(--neon-pink); border-color: #fff; transform: translateY(-2px); }

/* ==================== 最終結算畫面 ==================== */
.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.result-top-tags { display: flex; justify-content: space-between; align-items: center; }
.badge-pill { font-size: 12px; font-weight: 900; padding: 4px 10px; border-radius: 999px; background: var(--neon-green); color: #090a0f; }
.badge-pill.dead { background: var(--neon-red); color: #fff; }
.wordle-strip { font-size: 14px; letter-spacing: 2px; }
.res-ending-title { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 900; }
.res-ending-desc { margin: -8px 0 0; font-size: 13.5px; line-height: 1.6; color: #cbd5e1; }

.contrast-box { background: linear-gradient(145deg, #161826, #1c1122); border: 1.5px solid var(--neon-pink); border-radius: 18px; padding: 15px; }
.contrast-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.contrast-kicker { font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: var(--neon-cyan); }
.contrast-badge { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: rgba(255, 42, 133, 0.25); color: #fda4af; }
.contrast-vs-row { display: flex; align-items: center; justify-content: space-around; background: rgba(0, 0, 0, 0.3); border-radius: 14px; padding: 10px; margin-bottom: 12px; }
.vs-side { text-align: center; }
.vs-side small { display: block; font-size: 11px; color: var(--text-dim); }
.vs-side strong { font-family: var(--font-mono); font-size: 28px; font-weight: 900; }
.vs-real strong { color: var(--neon-cyan); }
.vs-bolt { font-size: 22px; }
.contrast-headline { margin: 0 0 6px; font-size: 15px; font-weight: 900; color: #fff; }
.contrast-roast { margin: 0; font-size: 13.5px; line-height: 1.6; color: #f1f5f9; }

.friend-result-box { background: rgba(0, 240, 255, 0.1); border: 1.5px solid var(--neon-cyan); border-radius: 16px; padding: 14px; text-align: center; }
.friend-res-label { font-size: 12px; font-weight: 800; color: var(--neon-cyan); }
.friend-res-rate { font-family: var(--font-mono); font-size: 40px; font-weight: 900; color: #fff; margin: 4px 0; }
.friend-res-desc { font-size: 13px; color: #cbd5e1; }

.telemetry-bars { display: flex; flex-direction: column; gap: 9px; }
.t-bar-row { display: grid; grid-template-columns: 98px 1fr 40px; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.t-bar-track { height: 8px; background: rgba(255, 255, 255, 0.09); border-radius: 999px; overflow: hidden; }
.t-bar-fill { height: 100%; border-radius: 999px; }
.t-bar-val { font-family: var(--font-mono); text-align: right; color: #fff; }

.match-pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-mini-card { border-radius: 14px; padding: 10px 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-subtle); }
.match-mini-card.best { border-color: rgba(16, 185, 129, 0.5); }
.match-mini-card.worst { border-color: rgba(239, 68, 68, 0.5); }
.match-mini-label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.match-mini-card strong { font-size: 14px; color: #fff; }

.poster-section { background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border-subtle); border-radius: 18px; padding: 14px; }
.poster-section-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 800; margin-bottom: 10px; }
.poster-section-head small { font-family: var(--font-mono); color: var(--text-dim); }
.poster-preview-wrap { width: 100%; max-width: 240px; margin: 0 auto 12px; border-radius: 14px; overflow: hidden; border: 1.5px solid rgba(255, 255, 255, 0.2); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.poster-preview-img { width: 100%; display: block; }
.result-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-action-grid .btn { font-size: 13px; padding: 12px 10px; }
.result-bottom-actions { display: flex; flex-direction: column; gap: 8px; }

/* ==================== 彈窗系統 ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 6, 10, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 450px;
  background: #141724;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.modal-tall { max-height: 85vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 900; }
.modal-close { background: rgba(255, 255, 255, 0.08); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.modal-sub { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: #cbd5e1; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 5px; }
.form-group input,
.form-group select {
  width: 100%;
  background: #0b0d15;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--neon-cyan); }

.invite-result-box { margin-top: 14px; padding-top: 14px; border-top: 1px dashed rgba(255, 255, 255, 0.16); }
.invite-result-box input {
  width: 100%;
  background: #090a0f;
  border: 1px solid var(--neon-cyan);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin-bottom: 10px;
}
.invite-result-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* 沙盒自選 4 人導演彈窗 */
.sandbox-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.sandbox-slot {
  height: 62px;
  border-radius: 12px;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
  color: var(--text-dim);
  cursor: pointer;
}

.sandbox-slot.filled {
  border-style: solid;
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.12);
  color: #fff;
}

.sandbox-combo-live {
  font-size: 12px;
  font-weight: 700;
  color: #fde047;
  background: rgba(168, 85, 247, 0.16);
  border: 1px solid rgba(192, 132, 252, 0.4);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 12px;
  line-height: 1.45;
}

.sandbox-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.sandbox-pick-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 4px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s ease;
}

.sandbox-pick-btn:hover {
  background: rgba(255, 42, 133, 0.25);
  border-color: var(--neon-pink);
}

.sandbox-pick-btn strong { font-family: var(--font-mono); font-size: 12.5px; }
.sandbox-pick-btn span { font-size: 10px; color: var(--text-dim); }

.sandbox-actions {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
}

/* 群組實況紀錄抽屜 */
.chat-log-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-right: 4px;
}

.chat-msg {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
}

.chat-msg-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--neon-cyan);
  margin-bottom: 4px;
}

.chat-msg-choice {
  font-size: 11.5px;
  color: #fda4af;
  margin-bottom: 4px;
}

/* 圖鑑分頁 */
.codex-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.codex-tab { background: rgba(255, 255, 255, 0.06); border: 1px solid transparent; border-radius: 10px; padding: 8px 4px; color: var(--text-dim); font-size: 12px; font-weight: 800; cursor: pointer; }
.codex-tab.active { background: rgba(0, 240, 255, 0.16); border-color: var(--neon-cyan); color: #fff; }
.codex-body { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.codex-item { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 10px 12px; }
.codex-item.locked { opacity: 0.5; }
.codex-item-title { font-size: 13.5px; font-weight: 800; color: #fff; margin-bottom: 3px; }
.codex-item-sub { font-size: 12px; color: var(--text-dim); line-height: 1.45; }

.rm-modal-body { display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.55; }
.rm-modal-head-row { display: flex; align-items: center; gap: 12px; }
.rm-modal-avatar { width: 64px; height: 64px; }
.rm-passive-box { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.45); border-radius: 12px; padding: 10px; color: #fecaca; }

.meltdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 4, 10, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.meltdown-box {
  width: 100%;
  max-width: 400px;
  background: #160910;
  border: 2px solid var(--neon-red);
  border-radius: 24px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 0 55px rgba(239, 68, 68, 0.5);
  animation: screenShake 0.4s ease;
}
.meltdown-kicker { font-family: var(--font-mono); font-size: 11px; font-weight: 900; color: var(--neon-red); margin-bottom: 12px; }
.meltdown-avatar { width: 88px; height: 88px; margin: 0 auto 10px; }
.meltdown-box h3 { margin: 0 0 10px; font-size: 20px; color: #fff; }
.meltdown-box p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; color: #fecaca; }

.global-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: #f8fafc;
  color: #090a0f;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
}

@media (max-width: 400px) {
  .hero-title { font-size: 30px; }
  .choice-label { font-size: 11.5px; }
  .xray-hold-btn { width: 58px; font-size: 10px; }
  .tool-pill { font-size: 10.5px; padding: 6px 4px; }
}
