/* ========== 阿米掃地機器人知識樂園 · 精品版 ========== */
/* iPad Pro 12.9 橫向 (1366×1024) 優先優化 */

:root {
  --ink: #1a1530;
  --acc: #FF6B9D;
  --acc-2: #FFD166;
  --acc-3: #C77DFF;
  --bg-1: #FFF7ED;
  --bg-2: #FFE4D6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { border: none; cursor: pointer; font-family: inherit; }
img { user-select: none; -webkit-user-drag: none; }

/* ===== View Switching ===== */
.view { display: none; min-height: 100vh; }
.view.active { display: block; }
.view:not(#playerView) { padding: 24px; }

/* ===== 首頁 ===== */
.home-header { text-align: center; padding: 30px 0 20px; }
.logo-row { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 8px; }
.logo-ami { width: 110px; height: 110px; object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(255, 107, 157, .3));
  animation: amiBob 3s ease-in-out infinite; }
@keyframes amiBob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.home-header h1 {
  font-size: clamp(32px, 5vw, 56px); line-height: 1.1; font-weight: 900;
  background: linear-gradient(135deg, #FF6B9D, #FFD166, #C77DFF);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: left;
}
.home-header h1 span { font-size: 0.65em; display: block; }
.tagline { color: #666; font-size: 16px; line-height: 1.7; max-width: 600px; margin: 0 auto; }

.halls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin: 28px auto 0;
  max-width: 1400px;
}
.hall-card {
  background: white;
  border-radius: 24px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  cursor: pointer;
  transition: transform .25s, box-shadow .25s;
  position: relative;
  overflow: hidden;
}
.hall-card:hover { transform: translateY(-6px); box-shadow: 0 14px 32px rgba(0,0,0,.14); }
.hall-card .hall-emoji { font-size: 64px; display: block; margin-bottom: 8px; }
.hall-card .hall-no {
  position: absolute; top: 12px; right: 16px;
  color: #999; font-size: 12px; font-weight: 700; letter-spacing: .1em;
}
.hall-card .hall-name { font-size: 22px; font-weight: 900; margin: 8px 0; }
.hall-card .hall-tagline { font-size: 13px; color: #666; line-height: 1.6; min-height: 50px; }
.hall-card .hall-host {
  font-size: 13px; color: var(--acc); margin-top: 10px;
  font-weight: 800; padding: 4px 10px;
  background: rgba(255,107,157,.1); border-radius: 12px; display: inline-block;
}
.hall-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background: var(--card-color, var(--acc));
}

/* ===== 館內 ===== */
.hall-header { padding: 12px 0 20px; }
.back-btn {
  background: rgba(255,255,255,.85); border: 1px solid rgba(0,0,0,.06);
  border-radius: 16px; padding: 10px 18px; font-size: 15px; font-weight: 700;
  margin-bottom: 16px;
}
#hallTitle { font-size: clamp(28px, 5vw, 42px); margin-bottom: 8px; font-weight: 900; }
.eps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-width: 1400px; margin: 0 auto;
}
.ep-card {
  background: white; border-radius: 20px; padding: 20px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
  transition: transform .2s;
  position: relative;
}
.ep-card:hover { transform: translateY(-3px); }
.ep-card.coming { opacity: 0.55; cursor: not-allowed; }
.ep-card .ep-no { font-size: 12px; color: #999; font-weight: 800; letter-spacing: .12em; }
.ep-card .ep-icon { font-size: 36px; margin: 4px 0; display: inline-block; }
.ep-card .ep-title { font-size: 17px; font-weight: 900; margin: 6px 0; line-height: 1.4; }
.ep-card .ep-subject { font-size: 13px; color: #666; line-height: 1.5; }
.ep-card .ep-meta { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-size: 12px; color: #888; }
.ep-card .ep-pill { background: var(--acc); color: white; padding: 3px 10px; border-radius: 10px; font-weight: 800; font-size: 11px; }
.ep-card .ep-pill.coming { background: #aaa; }

/* ============================================ */
/* ===== 播放器（iPad Pro 12.9 橫向優先） ===== */
/* ============================================ */
#playerView { background: linear-gradient(135deg, #1a1530 0%, #3D2D4D 100%); color: white; padding: 0; min-height: 100vh; display: flex; flex-direction: column; }

.player-header {
  display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  background: rgba(0,0,0,.3); backdrop-filter: blur(20px);
}
.player-header .back-btn { background: rgba(255,255,255,.18); color: white; border: 0; padding: 8px 14px; }
.player-title-row { flex: 1; font-weight: 700; font-size: 16px; }
#playerProg { font-size: 14px; color: #ddd; }

.book-stage {
  flex: 1;
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #f7f2e8;
}

/* 每一頁 (絕對定位、淡入淡出) */
.page {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  transition: opacity .5s ease;
  display: flex; flex-direction: column;
}
.page.active { opacity: 1; pointer-events: auto; z-index: 5; }

/* 底層：場景區 + 對話區 */
.scene-area { flex: 1; position: relative; overflow: hidden; }
.bubble-area {
  height: 220px;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px);
  display: flex; align-items: center; gap: 24px; padding: 18px 32px;
  border-top: 3px solid rgba(0,0,0,.04);
  position: relative; z-index: 10;
}
.bubble-char {
  flex-shrink: 0;
  width: 160px; height: 180px;
  display: flex; align-items: center; justify-content: center;
}
.bubble-char img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  animation: charIdle 2.8s ease-in-out infinite;
}
.bubble-char.speaking img {
  animation: charSpeak 0.55s ease-in-out infinite;
  filter: drop-shadow(0 0 18px #FFD166);
}
@keyframes charIdle { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-6px) scale(1.01); } }
@keyframes charSpeak { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-12px) scale(1.04); } }

.bubble {
  flex: 1;
  font-size: clamp(20px, 1.6vw, 26px);
  line-height: 1.7;
  color: #1a1530;
  font-weight: 500;
}
.bubble .who {
  display: inline-block;
  background: linear-gradient(135deg, #FF6B9D, #FFD166);
  color: white; padding: 4px 12px; border-radius: 10px;
  font-size: clamp(15px, 1.2vw, 18px); font-weight: 900;
  margin-right: 10px; vertical-align: middle;
}

/* ===== Title page ===== */
.page.title-page {
  background: radial-gradient(circle at 30% 40%, #FFE4A8 0%, #FFB6C1 60%, #C77DFF 100%);
}
.page.title-page .scene-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px;
  position: relative;
}
.page.title-page .icon-big { font-size: clamp(80px, 12vw, 160px); filter: drop-shadow(0 8px 20px rgba(0,0,0,.2)); }
.page.title-page h2 {
  font-size: clamp(36px, 5vw, 64px); margin: 16px 0; font-weight: 900;
  color: #2d1f3d; text-shadow: 0 4px 12px rgba(255,255,255,.5);
}
.page.title-page .subject {
  font-size: clamp(18px, 2vw, 26px); color: #4a3a5d;
  background: rgba(255,255,255,.7); padding: 8px 20px; border-radius: 16px;
  font-weight: 700;
}
.page.title-page .ep-tag {
  background: linear-gradient(135deg, #FF6B9D, #C77DFF); color: white;
  padding: 8px 20px; border-radius: 16px; font-size: clamp(16px, 1.6vw, 22px); font-weight: 900;
  margin-bottom: 16px;
}
.page.title-page .title-chars {
  display: flex; gap: 16px; margin: 24px 0;
}
.page.title-page .title-chars img { width: 140px; height: 140px; object-fit: contain; }
.page.title-page .start-btn {
  background: linear-gradient(135deg, #FF6B9D, #C77DFF);
  color: white; padding: 16px 36px; border-radius: 30px;
  font-size: 20px; font-weight: 900;
  box-shadow: 0 8px 24px rgba(199,125,255,.5);
  animation: btnPulse 1.5s ease-in-out infinite;
}
@keyframes btnPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ===== 共用：場景 sky / floor / 漸層底 ===== */
.scn-bg-1996 { background: linear-gradient(180deg, #FFE5A8 0%, #FFC18A 70%, #B8896F 100%); }
.scn-bg-living { background: linear-gradient(180deg, #FFE4E1 0%, #FFC9C9 50%, #E8B8A0 100%); }
.scn-bg-night { background: linear-gradient(180deg, #1a1530 0%, #3D2D4D 70%, #5C2B8C 100%); }
.scn-bg-sky { background: linear-gradient(180deg, #87CEEB 0%, #E0F2FF 70%, #F0E6D2 100%); }
.scn-bg-warm { background: linear-gradient(180deg, #FFE5B4 0%, #FFB347 70%, #FF8C42 100%); }
.scn-bg-cool { background: linear-gradient(180deg, #C5E8F5 0%, #A0D2E5 70%, #6CB7D1 100%); }
.scn-bg-fossil { background: linear-gradient(180deg, #D4C29A 0%, #A89070 70%, #6B5840 100%); }

.scn-floor {
  position: absolute; bottom: 0; left: 0; right: 0; height: 25%;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,.08) 100%);
}
.scn-floor.wood {
  background:
    repeating-linear-gradient(90deg,
      #8B6F4E 0px, #8B6F4E 80px, #745933 80px, #745933 82px),
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,.2) 100%);
}
.scn-floor.tile {
  background:
    repeating-linear-gradient(0deg, transparent 0px, transparent 60px, rgba(0,0,0,.05) 60px, rgba(0,0,0,.05) 62px),
    repeating-linear-gradient(90deg, transparent 0px, transparent 60px, rgba(0,0,0,.05) 60px, rgba(0,0,0,.05) 62px),
    #D4C29A;
}

/* ===== 機器人主圖 ===== */
.robot-hero {
  position: absolute;
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,.3));
  /* fallback: 圖載入失敗時用漸層圓+ emoji */
  background:
    radial-gradient(circle at 50% 50%, rgba(255,209,102,.4), rgba(199,125,255,.2));
  border-radius: 50%;
  min-width: 200px;
  min-height: 200px;
}
.robot-hero[src]:not([src=""]) { background: none; border-radius: 0; min-width: 0; min-height: 0; }
img.robot-hero { transition: opacity .4s; }
img.robot-hero[loading="lazy"] { opacity: 0; }
img.robot-hero[loading="lazy"].loaded { opacity: 1; }
.robot-hero.center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.robot-hero.right { right: 8%; top: 50%; transform: translateY(-50%); width: 36%; }
.robot-hero.left { left: 8%; top: 50%; transform: translateY(-50%); width: 36%; }
.robot-hero.bottom-center { left: 50%; bottom: 12%; transform: translateX(-50%); width: 28%; }

.robot-hero.anim-pulse { animation: heroPulse 2s ease-in-out infinite; }
.robot-hero.anim-roam { animation: heroRoam 8s linear infinite; }
.robot-hero.anim-spin { animation: heroSpin 6s linear infinite; }
.robot-hero.anim-rotate { animation: heroRotate 12s linear infinite; }
.robot-hero.anim-float { animation: heroFloat 4s ease-in-out infinite; }
@keyframes heroPulse {
  0%,100% { transform: translate(-50%, -50%) scale(1); filter: drop-shadow(0 12px 28px rgba(0,0,0,.3)); }
  50% { transform: translate(-50%, -50%) scale(1.04); filter: drop-shadow(0 16px 36px rgba(255,107,157,.5)); }
}
@keyframes heroRoam {
  0% { transform: translateX(-30%) translateY(0); }
  25% { transform: translateX(0%) translateY(-10%); }
  50% { transform: translateX(20%) translateY(5%); }
  75% { transform: translateX(-10%) translateY(8%); }
  100% { transform: translateX(-30%) translateY(0); }
}
@keyframes heroSpin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes heroRotate {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}
@keyframes heroFloat {
  0%,100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-15px); }
}

/* ===== 超音波 / LiDAR 雷射波紋 ===== */
.sonar-rings { position: absolute; pointer-events: none; }
.sonar-rings .ring {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 100px; height: 100px; border-radius: 50%;
  border: 3px solid rgba(80,150,255,.7);
  animation: sonarExpand 2s ease-out infinite;
}
.sonar-rings .ring:nth-child(2) { animation-delay: .5s; }
.sonar-rings .ring:nth-child(3) { animation-delay: 1s; }
.sonar-rings .ring:nth-child(4) { animation-delay: 1.5s; }
@keyframes sonarExpand {
  0% { width: 60px; height: 60px; opacity: 1; border-width: 4px; }
  100% { width: 700px; height: 700px; opacity: 0; border-width: 1px; }
}

.lidar-beam {
  position: absolute; left: 50%; top: 50%;
  width: 1px; height: 50%;
  background: linear-gradient(180deg, rgba(0,255,200,1) 0%, rgba(0,255,200,0) 100%);
  transform-origin: top center;
  animation: lidarSpin 1.8s linear infinite;
  pointer-events: none;
}
@keyframes lidarSpin {
  0% { transform: translate(-50%, 0) rotate(0deg); }
  100% { transform: translate(-50%, 0) rotate(360deg); }
}

/* ===== 灰塵粒子 ===== */
.dust-particles { position: absolute; inset: 0; pointer-events: none; }
.dust-particles .dust {
  position: absolute; width: 8px; height: 8px;
  background: #8b6f4e; border-radius: 50%; opacity: .7;
  animation: dustSuck 2s ease-in infinite;
}
@keyframes dustSuck {
  0% { transform: translate(0, 0) scale(1); opacity: .8; }
  100% { transform: translate(var(--tx, -200px), var(--ty, -200px)) scale(.1); opacity: 0; }
}

/* ===== 清掃軌跡 ===== */
.clean-trail {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(45deg,
    transparent 0px, transparent 20px,
    rgba(100,255,200,.2) 20px, rgba(100,255,200,.2) 24px);
  animation: trailMove 4s linear infinite;
  opacity: .5;
}
@keyframes trailMove {
  0% { background-position: 0 0; }
  100% { background-position: 100px 100px; }
}

/* ===== 大數字 / 事實卡 infographic ===== */
.fact-board {
  position: absolute; top: 8%; right: 4%;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 24px 28px;
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
  max-width: 40%;
  min-width: 280px;
}
.fact-board .ft-label {
  font-size: 14px; color: #888; font-weight: 700; letter-spacing: .08em;
  margin-bottom: 6px;
}
.fact-board .ft-big {
  font-size: clamp(40px, 5vw, 72px); font-weight: 900;
  background: linear-gradient(135deg, #FF6B9D, #FFD166);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1; margin-bottom: 4px;
}
.fact-board .ft-unit { font-size: 18px; color: #666; font-weight: 700; margin-left: 4px; }
.fact-board .ft-sub { font-size: 14px; color: #444; line-height: 1.6; margin-top: 8px; }
.fact-board.left { right: auto; left: 4%; }
.fact-board.bottom { top: auto; bottom: 14%; }

/* ===== 對比 split ===== */
.split-compare {
  position: absolute; inset: 0;
  display: flex;
}
.split-compare .sc-half {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  flex-direction: column; padding: 20px;
}
.split-compare .sc-half img { max-width: 70%; max-height: 70%; object-fit: contain; }
.split-compare .sc-label {
  position: absolute; top: 16px; left: 16px;
  background: rgba(0,0,0,.7); color: white; padding: 6px 14px;
  border-radius: 14px; font-size: 16px; font-weight: 800;
}
.split-compare .sc-vs {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 80px; font-weight: 900; color: var(--acc);
  text-shadow: 0 4px 12px rgba(0,0,0,.3);
  background: white; width: 100px; height: 100px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  z-index: 5;
}

/* ===== 時間軸 ===== */
.timeline-band {
  position: absolute; left: 5%; right: 5%; top: 50%; transform: translateY(-50%);
  height: 6px; background: rgba(255,255,255,.4); border-radius: 3px;
}
.timeline-band .tl-fill {
  height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc-2));
  border-radius: 3px;
}
.timeline-band .tl-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%; background: white;
  border: 4px solid var(--acc);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900;
  cursor: pointer;
}
.timeline-band .tl-dot.active {
  background: var(--acc); color: white; transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 0 8px rgba(255,107,157,.3);
}
.timeline-band .tl-year {
  position: absolute; top: 100%; transform: translateX(-50%); margin-top: 16px;
  font-size: 14px; font-weight: 800; color: white;
  background: rgba(0,0,0,.4); padding: 4px 10px; border-radius: 10px;
  white-space: nowrap;
}

/* ===== 漂浮 emoji 裝飾 ===== */
.deco-float {
  position: absolute; font-size: 48px;
  pointer-events: none;
}
.deco-float.f1 { top: 10%; left: 5%; animation: float1 6s ease-in-out infinite; }
.deco-float.f2 { top: 15%; right: 8%; animation: float2 7s ease-in-out infinite; }
.deco-float.f3 { bottom: 30%; left: 10%; animation: float1 8s ease-in-out infinite reverse; }
.deco-float.f4 { top: 30%; left: 30%; animation: float2 5s ease-in-out infinite; }
.deco-float.bg-large {
  font-size: 280px; opacity: .1; top: 30%; left: 40%;
  animation: float1 12s ease-in-out infinite;
}
@keyframes float1 {
  0%,100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-25px) rotate(8deg); }
}
@keyframes float2 {
  0%,100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(15px) rotate(-8deg); }
}

/* ===== 電視機 (1996 復古) SVG container ===== */
.crt-tv {
  position: absolute; left: 8%; bottom: 28%;
  width: 220px; height: 200px;
}
.crt-tv .screen-glow {
  animation: crtFlicker 4s ease-in-out infinite;
}
@keyframes crtFlicker {
  0%,100% { opacity: 1; }
  10%,15% { opacity: 0.7; }
  20%,80% { opacity: 1; }
}

/* ===== Windows 95 desktop ===== */
.win95 {
  position: absolute; right: 10%; bottom: 22%;
  width: 260px; height: 200px;
  background: white;
  border: 4px solid #888;
  border-radius: 6px;
  box-shadow: 0 10px 20px rgba(0,0,0,.4);
}
.win95::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 28px;
  background: linear-gradient(90deg, #000080, #1084d0);
}
.win95::after {
  content: "C:\\> Trilobite.exe"; position: absolute; top: 38px; left: 12px;
  font-family: monospace; font-size: 14px; color: #00ff00;
  background: #000; padding: 4px 8px;
  animation: typewriter 3s steps(20) infinite;
}

/* ===== Sweden 國旗 ===== */
.sweden-flag {
  position: absolute; right: 8%; top: 15%;
  width: 180px; height: 110px;
  background: #006AA7;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,.2);
  position: relative;
}
.sweden-flag::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 40%;
  width: 20px; background: #FECC02;
}
.sweden-flag::after {
  content: ""; position: absolute; left: 0; right: 0; top: 45%;
  height: 20px; background: #FECC02;
}

/* ===== 充電座 ===== */
.dock-station {
  position: absolute; bottom: 25%; right: 12%;
  width: 90px; height: 110px;
  background: linear-gradient(135deg, #888, #555);
  border-radius: 14px 14px 8px 8px;
  box-shadow: 0 10px 20px rgba(0,0,0,.4);
}
.dock-station::before {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle, #00ff66 0%, transparent 70%);
  animation: dockGlow 1.5s ease-in-out infinite;
}
@keyframes dockGlow {
  0%,100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
}

/* ===== 控制列 ===== */
.player-controls {
  display: flex; gap: 12px; justify-content: center; padding: 14px;
  background: rgba(0,0,0,.4); backdrop-filter: blur(20px);
}
.player-controls button {
  background: rgba(255,255,255,.18); color: white;
  padding: 14px 28px; border-radius: 28px; font-size: 17px; font-weight: 800;
  min-width: 90px; transition: background .2s;
}
.player-controls button:hover { background: rgba(255,255,255,.28); }
.player-controls button:disabled { opacity: 0.3; cursor: not-allowed; }
#playBtn.playing { background: linear-gradient(135deg, #FF6B9D, #C77DFF); }

/* ===== Sparkle 粒子 (通用) ===== */
.sparkles { position: absolute; inset: 0; pointer-events: none; }
.sparkles .sp {
  position: absolute; font-size: 24px;
  animation: spkRise 4s linear infinite;
  opacity: 0;
}
@keyframes spkRise {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-300px) rotate(360deg); opacity: 0; }
}

/* ===== 背景圖片整張 ===== */
.bg-image {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: .85;
}
.bg-image.dim { filter: brightness(.7); }

/* ===== 紅外線光束 ===== */
.ir-beam {
  position: absolute;
  width: 4px; height: 200px;
  background: linear-gradient(180deg, rgba(255,30,30,.9) 0%, rgba(255,30,30,0) 100%);
  transform-origin: top;
  animation: irFlick 0.6s linear infinite;
}
@keyframes irFlick {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ===== 電池條 ===== */
.battery-bar {
  position: absolute;
  width: 220px; height: 60px;
  background: white; border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,.2);
  overflow: hidden;
}
.battery-bar::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0;
  width: var(--bat, 50%);
  background: linear-gradient(90deg, #FFD166, #FF6B9D);
}
.battery-bar .bat-label {
  position: relative; z-index: 2; padding: 18px; font-weight: 900; font-size: 18px; color: #1a1530;
}

/* ===== 一些 unique 場景元素 ===== */
.timeline-card {
  position: absolute;
  background: white; border-radius: 16px; padding: 14px;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  text-align: center;
}
.timeline-card .tc-year { font-size: 20px; font-weight: 900; color: var(--acc); }
.timeline-card .tc-img { font-size: 60px; }
.timeline-card .tc-name { font-size: 14px; font-weight: 700; margin-top: 4px; }

/* ===== iPad 12.9 橫向 specific ===== */
@media (min-width: 1300px) and (max-width: 1500px) and (orientation: landscape) {
  .book-stage { height: calc(100vh - 64px - 60px); }
  .bubble-area { height: 240px; }
  .bubble { font-size: 26px; line-height: 1.75; }
  .bubble-char { width: 200px; height: 220px; }
}

/* ===== 手機 / 直向降級 ===== */
@media (max-width: 900px) {
  .halls-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hall-card { padding: 16px 12px; }
  .hall-card .hall-emoji { font-size: 48px; }
  .hall-card .hall-name { font-size: 18px; }
  .bubble-area { height: 170px; padding: 12px 16px; gap: 12px; }
  .bubble-char { width: 110px; height: 130px; }
  .bubble { font-size: 17px; }
  .robot-hero.center { width: 60% !important; }
  .fact-board { max-width: 60%; padding: 14px 18px; }
  .fact-board .ft-big { font-size: 36px; }
}
