/* ==========================================================================
   尋章摘句 — 故宮宮廷古典美學 × 綾絹裝裱密室主題樣式庫
   (Palace Museum Imperial Classical Aesthetics & Silk Brocade Mounting)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=LXGW+WenKai+TC:wght@400;700&family=Noto+Serif+TC:wght@400;600;700;900&display=swap');

:root {
  /* ── 1. 故宮宮廷經典配色體系 (Palace Imperial Color System) ── */
  --palace-vermilion: #b82823;          /* 故宮硃牆紅 / 朱砂紅 */
  --palace-vermilion-deep: #8e1e19;     /* 硃紅重彩 / 醇厚印泥色 */
  --palace-vermilion-light: #d8453d;    /* 丹砂霞光 */
  --palace-vermilion-glow: rgba(184, 40, 35, 0.42);

  --palace-indigo: #2c4a6f;             /* 霽藍景泰藍 / 霽青釉色 */
  --palace-indigo-deep: #192e46;        /* 幽藍霽青 / 沉香墨藍 */
  --palace-indigo-light: #3e6594;       /* 淺霽青天色 */
  --palace-indigo-glow: rgba(44, 74, 111, 0.38);

  --palace-gold: #c59a3f;               /* 泥金描金 / 蒔金 */
  --palace-gold-bright: #e8c15a;        /* 庫金明耀 / 泥金提亮 */
  --palace-gold-dark: #8a6721;          /* 古銅泥金 / 烏金 */
  --palace-gold-glow: rgba(197, 154, 63, 0.45);

  --palace-jade: #2e5d4b;               /* 宮廷翡翠玉色 / 碧玉翡翠 */
  --palace-jade-light: #46836b;         /* 青碧靈玉 */
  --palace-jade-glow: rgba(46, 93, 75, 0.36);

  --palace-ink: #1a1714;                /* 玄墨 / 徽墨 */
  --palace-ink-deep: #0e0c0a;           /* 松煙重墨 */
  --palace-ink-soft: #554b41;           /* 淡墨松煙 */
  --palace-ink-faint: rgba(26, 23, 20, 0.08);

  --palace-paper: #f7f1e5;              /* 宋代澄心堂仿古宣紙底 */
  --palace-paper-deep: #ede3d1;         /* 煮硾熟宣底色 / 隔水宣紙 */
  --palace-paper-card: #faf6ed;         /* 宋畫精裱玉版宣紙心 */
  --palace-paper-dark: #dfd2bc;         /* 古色熟宣邊綾 */

  --palace-rosewood: #3d261d;           /* 故宮紫檀紅木 */
  --palace-rosewood-dark: #271812;      /* 老紅木榫卯深色 */
  --palace-duan-stone: #32252b;         /* 紫袍玉帶紫端硯 */
  --palace-bronze: #4a6b63;             /* 宣德青銅器古銹色 */
  --palace-bronze-copper: #9a6945;      /* 赤銅金屬光澤 */

  /* 基礎相容映射 (Backward Compatibility) */
  --paper: var(--palace-paper);
  --paper-deep: var(--palace-paper-deep);
  --paper-trans: rgba(247, 241, 229, 0.88);
  --paper-card: var(--palace-paper-card);
  
  --ink: var(--palace-ink);
  --ink-deep: var(--palace-ink-deep);
  --ink-soft: var(--palace-ink-soft);
  --ink-faint: var(--palace-ink-faint);
  
  --vermilion: var(--palace-vermilion);
  --vermilion-dark: var(--palace-vermilion-deep);
  --vermilion-glow: var(--palace-vermilion-glow);
  
  --gold: var(--palace-gold);
  --gold-bright: var(--palace-gold-bright);
  --gold-dark: var(--palace-gold-dark);
  --gold-glow: var(--palace-gold-glow);
  
  --indigo: var(--palace-indigo);
  --indigo-dark: var(--palace-indigo-deep);
  --indigo-light: var(--palace-indigo-light);
  
  --jade: var(--palace-jade);
  --jade-light: var(--palace-jade-light);
  
  --cell-bg: #fdfbf7;                   /* 漢白玉溫潤石質 */
  --cell-border: #d4c5ab;               /* 泥金描線邊 */
  --radius: 12px;
  --radius-sm: 6px;
  --radius-lg: 18px;

  /* 五行琉璃破陣色調 (Five-Element Imperial Gemstones) */
  --found-0: #ebd3c8; /* 火靈赤霞・珊瑚紅 */
  --found-1: #c9dbe7; /* 水靈幽瀾・霽青釉 */
  --found-2: #cee0cb; /* 木靈青嵐・翡翠碧 */
  --found-3: #e1d3e8; /* 坤土玄紫・紫袍玉 */
  --found-4: #eee4c2; /* 乾金耀魄・蒔金黃 */
  
  /* 故宮宮廷陰影與光暈 */
  --shadow-ink: 0 4px 20px rgba(26, 23, 20, 0.12), 0 1px 4px rgba(26, 23, 20, 0.08);
  --shadow-talisman: 0 8px 26px rgba(184, 40, 35, 0.22), 0 2px 8px rgba(26, 23, 20, 0.14);
  --shadow-gold: 0 0 18px rgba(197, 154, 63, 0.38);
  --shadow-curio: 0 6px 22px rgba(39, 24, 18, 0.18), inset 0 0 0 1px rgba(197, 154, 63, 0.35);

  /* 宮廷國風開源字型體系 (楷書・行書・宋體) */
  --font-serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;
  --font-title: "LXGW WenKai TC", "Kaiti TC", "BiauKai", "DFKai-SB", "Noto Serif TC", serif;
  --font-kai: "LXGW WenKai TC", "Kaiti TC", "BiauKai", "DFKai-SB", "Noto Serif TC", serif;
  --font-calligraphy: "LXGW WenKai TC", "Kaiti TC", "BiauKai", "DFKai-SB", "Noto Serif TC", serif;
}

/* ── 全域背景：宋代澄心堂宣紙底 × 綾絹暗紋 ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--palace-paper);
  color: var(--palace-ink);
  font-family: var(--font-serif);
  min-height: 100%;
  position: relative;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* 宋代澄心堂宣紙微紋理與四方金石水墨微光 */
body {
  background-image: 
    radial-gradient(circle at 12% 12%, rgba(197, 154, 63, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 88% 88%, rgba(44, 74, 111, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(247, 241, 229, 0.95) 0%, rgba(237, 227, 209, 0.72) 100%),
    /* 綾絹經緯織錦幾何暗紋 (Silk Brocade Woven Pattern) */
    url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c59a3f' fill-opacity='0.035' fill-rule='evenodd'%3E%3Cpath d='M0 20L20 0l20 20-20 20L0 20zm4 0l16-16 16 16-16 16L4 20z'/%3E%3Ccircle cx='20' cy='20' r='3'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
}

/* 宮廷雲氣與松煙暗香浮動 */
body::before {
  content: "";
  position: fixed;
  top: -80px;
  right: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(26, 23, 20, 0.07) 0%, rgba(44, 74, 111, 0.04) 50%, transparent 70%);
  border-radius: 46% 54% 62% 38% / 45% 42% 58% 55%;
  filter: blur(32px);
  pointer-events: none;
  z-index: 0;
  animation: palace-ink-drift 24s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  bottom: -90px;
  left: -90px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(184, 40, 35, 0.06) 0%, rgba(197, 154, 63, 0.05) 45%, transparent 70%);
  border-radius: 56% 44% 39% 61% / 42% 64% 36% 58%;
  filter: blur(38px);
  pointer-events: none;
  z-index: 0;
  animation: palace-ink-drift 30s ease-in-out infinite alternate-reverse;
}

@keyframes palace-ink-drift {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(30px, 24px) scale(1.09) rotate(10deg); }
  100% { transform: translate(-20px, 38px) scale(0.94) rotate(-8deg); }
}

.hidden { display: none !important; }
.muted { color: var(--palace-ink-soft); }

/* ── 頂部導航 (App Header - 故宮金絲宣和裝) ── */
.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.95rem 1.5rem;
  background: linear-gradient(180deg, rgba(250, 246, 237, 0.97) 0%, rgba(247, 241, 229, 0.9) 100%);
  border-bottom: 2px solid var(--palace-gold);
  box-shadow: 
    0 4px 18px rgba(26, 23, 20, 0.08),
    inset 0 -1px 0 rgba(184, 40, 35, 0.35);
  backdrop-filter: blur(8px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  position: relative;
}

.brand-mascot-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mascot-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffdf8 0%, #f7ecd7 100%);
  border: 2px solid var(--palace-gold);
  box-shadow: 0 2px 8px rgba(197, 154, 63, 0.35), inset 0 1px 3px #fff;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  flex-shrink: 0;
}

.app-brand:hover .brand-mascot-icon {
  transform: scale(1.12) rotate(6deg);
  box-shadow: 0 6px 16px rgba(197, 154, 63, 0.5), 0 0 12px var(--palace-gold-glow);
}

.mascot-sparkle-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--palace-gold-bright);
  box-shadow: 0 0 8px #fef08a;
  animation: sparkle-pulse 1.8s infinite alternate;
}

@keyframes sparkle-pulse {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 1; }
}

.brand-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* 故宮御用璽印 (Imperial Chop Seal) */
.app-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #ffffff;
  background: linear-gradient(135deg, var(--palace-vermilion) 0%, var(--palace-vermilion-deep) 100%);
  border: 1.5px solid var(--palace-gold-bright);
  border-radius: 4px;
  padding: 0.18rem 0.48rem;
  line-height: 1.2;
  box-shadow: 
    0 2px 6px rgba(184, 40, 35, 0.4),
    inset 0 0 0 1px rgba(142, 30, 25, 0.7);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  position: relative;
}

.app-title {
  font-family: var(--font-calligraphy);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--palace-ink-deep);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8), 2px 2px 5px rgba(26, 23, 20, 0.15);
}

.demo-badge {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: #fff;
  background: linear-gradient(135deg, var(--palace-vermilion), var(--palace-vermilion-deep));
  border: 1px solid var(--palace-gold-bright);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  box-shadow: 0 2px 6px var(--palace-vermilion-glow);
}

.app-nav {
  margin-left: auto;
  display: flex;
  gap: 0.55rem;
}

/* 景泰藍與泥金導航按鈕 (Cloisonné & Gold Nav Buttons) */
.nav-btn {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  background: rgba(250, 246, 237, 0.9);
  color: var(--palace-indigo-deep);
  border: 1.5px solid rgba(197, 154, 63, 0.6);
  border-radius: 999px;
  padding: 0.38rem 1.15rem;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(26, 23, 20, 0.05);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.nav-btn:hover {
  background: #ffffff;
  border-color: var(--palace-gold-bright);
  color: var(--palace-vermilion);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(197, 154, 63, 0.28);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--palace-indigo) 0%, var(--palace-indigo-deep) 100%);
  color: #fdfaf2;
  border-color: var(--palace-gold-bright);
  box-shadow: 
    0 3px 10px rgba(25, 46, 70, 0.38),
    inset 0 1px 0 rgba(232, 193, 90, 0.45);
}

/* 仙童即時對話氣泡 (Mascot Speech Bubble) */
.mascot-speech-bubble {
  position: absolute;
  top: 110%;
  left: 0;
  z-index: 30;
  background: linear-gradient(135deg, #ffffff 0%, #faf4e6 100%);
  border: 1.5px solid var(--palace-gold);
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
  box-shadow: 0 6px 20px rgba(26, 23, 20, 0.15);
  white-space: nowrap;
  animation: bubble-float-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.mascot-speech-bubble p {
  font-family: var(--font-calligraphy);
  font-size: 0.88rem;
  color: var(--palace-ink-deep);
  font-weight: 700;
}

.mascot-speech-triangle {
  position: absolute;
  top: -7px;
  left: 24px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-left: 1.5px solid var(--palace-gold);
  border-top: 1.5px solid var(--palace-gold);
  transform: rotate(45deg);
}

@keyframes bubble-float-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

main {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

.view-title {
  font-family: var(--font-calligraphy);
  font-size: 1.45rem;
  letter-spacing: 0.25em;
  margin-bottom: 1.2rem;
  color: var(--palace-indigo-deep);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8);
}

.view-title::before {
  content: "❖";
  font-size: 0.95rem;
  color: var(--palace-gold);
}

.view-title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--palace-gold) 0%, rgba(197, 154, 63, 0.1) 100%);
  margin-left: 0.6rem;
}

/* ── 寬螢幕桌面排版 ────────────────────────── */
@media (min-width: 992px) {
  main:has(#view-game:not(.hidden)) {
    max-width: 1200px;
    padding: 1.5rem 1.8rem 3.5rem;
  }
  
  #view-game .game-layout {
    display: grid;
    grid-template-columns: minmax(480px, 1fr) 410px;
    gap: 2.2rem;
    align-items: start;
  }
  
  #view-game .game-board {
    min-width: 0;
    position: relative;
  }
  
  #view-game .game-panel {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
  }
  
  #view-game .game-panel .character-stage { order: -3; margin-bottom: 1rem; }
  #view-game .game-panel .hint-bar { order: -2; margin-bottom: 0.9rem; }
  #view-game .game-panel .hint-msg { order: -1; }
  
  #view-game .grid {
    width: min(48vw, 560px);
  }
  
  #view-game .cell {
    font-size: clamp(0.95rem, calc(min(48vw, 560px) * 0.58 / var(--grid-n, 5)), 2.4rem);
  }
}

/* ── 密室大廳／陣法選擇視圖 (Chamber Hero & Curio Shelf) ── */
.chamber-hero {
  text-align: center;
  padding: 1.5rem 1.2rem 1.8rem;
  margin-bottom: 1.6rem;
  background: linear-gradient(180deg, rgba(252, 248, 240, 0.96) 0%, rgba(244, 235, 217, 0.85) 100%);
  border: 2px solid var(--palace-gold);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 8px 24px rgba(26, 23, 20, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 0 0 4px var(--palace-paper-deep);
  position: relative;
  overflow: hidden;
}

.chamber-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--palace-vermilion), var(--palace-gold), var(--palace-indigo));
}

.chamber-hero-tag {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--palace-vermilion);
  background: rgba(184, 40, 35, 0.08);
  border: 1px solid rgba(184, 40, 35, 0.3);
  padding: 0.22rem 0.9rem;
  border-radius: 999px;
  letter-spacing: 0.18em;
  margin-bottom: 0.6rem;
}

.chamber-hero-title {
  font-family: var(--font-calligraphy);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--palace-ink-deep);
  letter-spacing: 0.28em;
  margin-bottom: 0.6rem;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8);
}

.chamber-hero-desc {
  font-size: 0.95rem;
  color: var(--palace-ink-soft);
  line-height: 1.75;
  max-width: 540px;
  margin: 0 auto;
}

.chamber-grid {
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

/* 故宮紅木博古架陣法卡片 (Palace Curio Shelf Chamber Cards) */
.chamber-card {
  background: var(--palace-paper-card);
  border: 2px solid var(--palace-gold);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-curio);
  position: relative;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
}

.chamber-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--chamber-color, var(--palace-indigo));
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
}

.chamber-card:hover {
  transform: translateY(-4px);
  border-color: var(--palace-gold-bright);
  box-shadow: 0 12px 32px rgba(26, 23, 20, 0.16), 0 0 16px var(--palace-gold-glow);
}

.chamber-card.locked {
  opacity: 0.72;
  background: #eae0cf;
  border-color: #baa98f;
}

.chamber-card.done {
  border-color: var(--palace-gold-bright);
  box-shadow: 0 4px 18px rgba(197, 154, 63, 0.25);
}

.chamber-badge-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.chamber-element-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--chamber-color, var(--palace-indigo));
  padding: 0.16rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.12em;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.chamber-status-badge {
  font-size: 0.76rem;
  padding: 0.16rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.chamber-status-badge.open {
  color: var(--palace-indigo-deep);
  background: #e1edf5;
  border: 1px solid #b7d6ea;
}

.chamber-status-badge.win {
  color: var(--palace-gold-dark);
  background: #fdf5df;
  border: 1px solid var(--palace-gold);
}

.chamber-status-badge.lock {
  color: #7f8c8d;
  background: #e5e7e9;
  border: 1px solid #bdc3c7;
}

.chamber-title {
  font-family: var(--font-calligraphy);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.12em;
  color: var(--palace-ink-deep);
  margin-bottom: 0.15rem;
}

.chamber-alias {
  font-size: 0.85rem;
  color: var(--palace-ink-soft);
  letter-spacing: 0.08em;
}

.chamber-guardian-section {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(197, 154, 63, 0.35);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.9rem 0;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.8);
}

.chamber-guardian-standee-box {
  flex: 0 0 110px;
  height: 125px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chamber-guardian-name {
  font-family: var(--font-calligraphy);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--palace-indigo-deep);
  margin-right: 0.45rem;
}

.chamber-guardian-title {
  font-size: 0.78rem;
  color: var(--palace-gold-dark);
  background: #fef8eb;
  padding: 0.08rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(197, 154, 63, 0.3);
}

.chamber-lore {
  font-size: 0.9rem;
  color: var(--palace-ink-deep);
  line-height: 1.7;
  margin-bottom: 0.9rem;
}

.chamber-progress-box { margin-bottom: 0.9rem; }
.chamber-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--palace-ink-soft);
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.chamber-progress-bar {
  height: 9px;
  background: var(--palace-paper-deep);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(197, 154, 63, 0.25);
}
.chamber-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--chamber-color, var(--palace-indigo)), var(--chamber-accent, var(--palace-gold-bright)));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.chamber-treasure-preview {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: #fdfaf2;
  border: 1.5px dashed var(--palace-gold);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  margin-bottom: 1.1rem;
}
.chamber-treasure-preview .treasure-icon { font-size: 1.4rem; }
.chamber-treasure-preview .treasure-text small {
  display: block;
  font-size: 0.74rem;
  color: var(--palace-gold-dark);
}
.chamber-treasure-preview .treasure-text strong {
  font-size: 0.9rem;
  color: var(--palace-ink-deep);
}

.chamber-card-actions { display: flex; gap: 0.65rem; }
.chamber-enter-btn { flex: 1; }

/* ── 遊戲盤面頂部 HUD (宣德青銅獸首古香爐 × 御用松煙紫端硯) ── */
.game-top {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
  background: linear-gradient(135deg, rgba(252, 248, 240, 0.97) 0%, rgba(244, 235, 217, 0.94) 100%);
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  box-shadow: var(--shadow-ink);
  flex-wrap: wrap;
}

.game-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-array-badge {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--palace-indigo) 0%, var(--palace-indigo-deep) 100%);
  border: 1px solid var(--palace-gold-bright);
  padding: 0.18rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.1em;
  box-shadow: 0 2px 6px rgba(25, 46, 70, 0.3);
}

.game-level-title {
  font-family: var(--font-calligraphy);
  font-size: 1.35rem;
  letter-spacing: 0.18em;
  color: var(--palace-ink-deep);
  font-weight: 700;
}

/* 宣德青銅獸首古香爐 (Xuande Bronze Censer Incense Timer) */
.timer-display {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--palace-ink-deep);
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #e8dfcf 0%, #dbcbaf 100%);
  border: 1.5px solid var(--palace-bronze);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.6), 0 2px 6px rgba(26, 23, 20, 0.12);
  position: relative;
}

.incense-burner-mini {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 30px;
  margin-right: 2px;
}

.incense-stick-wrap {
  width: 6px;
  height: 26px;
  background: rgba(46, 38, 29, 0.2);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: visible;
  border: 1px solid rgba(138, 103, 33, 0.3);
}

.incense-stick-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #d33c2a 0%, #8c2a1e 70%, #4a2018 100%);
  border-radius: 2px;
  transition: height 0.25s linear;
}

/* 宣德香爐香頭赤紅炭火與微光微震 (Glowing Ember) */
.incense-ember-dot {
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #fff7c2 0%, #ff5722 60%, #b71c1c 100%);
  border-radius: 50%;
  box-shadow: 0 0 8px #ff5722, 0 0 14px #ff9800;
  animation: ember-incense-glow 1.2s infinite alternate;
}

@keyframes ember-incense-glow {
  0% { transform: translateX(-50%) scale(0.85); opacity: 0.8; box-shadow: 0 0 6px #ff5722; }
  100% { transform: translateX(-50%) scale(1.35); opacity: 1; box-shadow: 0 0 12px #ff9800, 0 0 18px #ffeb3b; }
}

.incense-censer-icon {
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(74, 107, 99, 0.4));
}

.timer-display.warn {
  color: var(--palace-vermilion);
  background: linear-gradient(135deg, #fae0db 0%, #f4cac3 100%);
  border-color: var(--palace-vermilion);
  animation: timer-alarm-shake 0.8s ease-in-out infinite;
}

.timer-display.warn .incense-ember-dot {
  background: radial-gradient(circle, #ffffff 0%, #ff1744 60%, #b71c1c 100%);
  box-shadow: 0 0 14px #ff1744, 0 0 22px #d50000;
}

/* 故宮御用松煙紫端硯 (Imperial Duan Inkstone Pool) */
.ink-display {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--palace-indigo-deep);
  background: linear-gradient(135deg, #ede4d1 0%, #e0d0af 100%);
  border: 1.5px solid var(--palace-gold);
  border-radius: 999px;
  padding: 0.3rem 0.95rem;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.7), 0 2px 6px rgba(26, 23, 20, 0.12);
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ink-display:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(197, 154, 63, 0.35);
}

.ink-dish-icon {
  font-size: 1.25rem;
  margin-right: 0.15rem;
  filter: drop-shadow(0 2px 3px rgba(50, 37, 43, 0.35));
}

.timer-text-wrap, .ink-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.timer-tag, .ink-tag {
  font-size: 0.68rem;
  color: var(--palace-ink-soft);
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ── 密室破陣封印條 (Seal Runes Bar - 掐絲琺瑯紫金符印) ── */
.seal-progress-bar {
  background: linear-gradient(135deg, #fdfaf2 0%, #f6edd9 100%);
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.65rem 0.95rem;
  margin-bottom: 1rem;
  box-shadow: 0 3px 10px rgba(26, 23, 20, 0.08);
}

.seal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--palace-indigo-deep);
  margin-bottom: 0.5rem;
}

.seal-title { letter-spacing: 0.12em; font-family: var(--font-calligraphy); }

.seal-count {
  font-size: 0.8rem;
  color: var(--palace-gold-dark);
  background: #fff8e8;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(197, 154, 63, 0.4);
  font-weight: 700;
}

.seal-runes {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.seal-rune-node {
  flex: 1 1 auto;
  min-width: 48px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.seal-rune-node.locked {
  background: #ede3ce;
  color: #8c7d67;
  border: 1.5px dashed #baa98f;
}

.seal-rune-node.unsealed {
  background: linear-gradient(135deg, #fff3cf 0%, #fed966 100%);
  color: #783f04;
  border: 1.5px solid var(--palace-gold-bright);
  box-shadow: 0 0 12px rgba(232, 193, 90, 0.55);
  transform: scale(1.05);
}

.rune-symbol {
  font-family: var(--font-calligraphy);
  font-size: 1.05rem;
}

/* ── 密室字陣 (Game Board & Matrix - 故宮太極殿漢白玉盤面) ── */
.game-board {
  position: relative;
  background: linear-gradient(145deg, rgba(250, 246, 237, 0.94) 0%, rgba(244, 233, 212, 0.94) 100%);
  border: 2px solid var(--palace-gold);
  border-radius: var(--radius-lg);
  padding: 1.25rem 0.9rem;
  box-shadow: 
    var(--shadow-ink),
    0 0 30px rgba(197, 154, 63, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

/* 盤面太極與八卦雲氣金線底紋 */
.game-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='400' height='400' viewBox='0 0 400 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='200' cy='200' r='180' stroke='%23c59a3f' stroke-width='1.5' stroke-opacity='0.16' stroke-dasharray='4 6'/%3E%3Ccircle cx='200' cy='200' r='140' stroke='%23c59a3f' stroke-width='1' stroke-opacity='0.12'/%3E%3Ccircle cx='200' cy='200' r='80' stroke='%232c4a6f' stroke-width='1.5' stroke-opacity='0.09'/%3E%3Cpath d='M200 20 L200 380 M20 200 L380 200 M72 72 L328 328 M72 328 L328 72' stroke='%23c59a3f' stroke-width='0.8' stroke-opacity='0.12'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: min(90%, 400px);
  pointer-events: none;
  opacity: 0.9;
}

/* 故宮雙層錦綾描金滾邊護角 */
.game-board::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(197, 154, 63, 0.3);
  border-radius: calc(var(--radius-lg) - 6px);
  pointer-events: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(92vw, 450px);
  margin: 0 auto 1.2rem;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 2;
  padding: 10px;
  background: linear-gradient(145deg, #eee4d1, #dfd2bc);
  border: 2px solid var(--palace-gold);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 8px 24px rgba(26, 23, 20, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    inset 0 3px 8px rgba(26, 23, 20, 0.12);
}

/* 漢白玉石字格微浮雕 (Han White Jade Stone Cell Relief) */
.cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(0.88rem, calc(min(92vw, 450px) * 0.58 / var(--grid-n, 5)), 2.1rem);
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f8f2e7 75%, #ece1cf 100%);
  color: var(--palace-ink-deep);
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius-sm);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(197, 154, 63, 0.4),
    0 2px 6px rgba(26, 23, 20, 0.1);
  position: relative;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}

.cell:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: var(--palace-gold-bright);
  z-index: 5;
  box-shadow: 0 5px 15px rgba(197, 154, 63, 0.35), inset 0 0 0 1px #fff;
}

/* 拖曳預覽：霽青玉色半透靈光 */
.cell.preview {
  background: linear-gradient(135deg, #e3eef7 0%, #bfd8ec 100%) !important;
  color: var(--palace-indigo-deep);
  border-color: var(--palace-indigo);
  transform: scale(1.08) !important;
  z-index: 10;
  box-shadow: 0 4px 14px rgba(44, 74, 111, 0.38), 0 0 12px var(--palace-indigo-glow);
  animation: preview-breath 0.6s ease-in-out infinite alternate;
}

@keyframes preview-breath {
  0% { box-shadow: 0 2px 8px rgba(44, 74, 111, 0.28); }
  100% { box-shadow: 0 5px 16px rgba(44, 74, 111, 0.48), 0 0 14px var(--palace-gold-glow); }
}

/* 破陣成功：五行琉璃靈光 */
.cell.found {
  animation: palace-breakthrough 0.65s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  border-color: var(--palace-gold-bright);
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(26, 23, 20, 0.15), inset 0 0 8px rgba(255, 255, 255, 0.7);
}

@keyframes palace-breakthrough {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.22) rotate(2deg); filter: brightness(1.35) drop-shadow(0 0 14px var(--palace-gold-bright)); }
  70% { transform: scale(0.96) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); filter: brightness(1); }
}

.cell.found-0 { background: linear-gradient(135deg, #faeae5 0%, var(--found-0) 100%); color: #6a1c15; border-color: #d1978a; }
.cell.found-1 { background: linear-gradient(135deg, #e5f2fa 0%, var(--found-1) 100%); color: #16364a; border-color: #8bb3cb; }
.cell.found-2 { background: linear-gradient(135deg, #e9f5e5 0%, var(--found-2) 100%); color: #1e451b; border-color: #9ac290; }
.cell.found-3 { background: linear-gradient(135deg, #f2e9f7 0%, var(--found-3) 100%); color: #431f54; border-color: #b79cc4; }
.cell.found-4 { background: linear-gradient(135deg, #faf5de 0%, var(--found-4) 100%); color: #5a450e; border-color: #c9b77d; }

/* 錯誤震顫 (Cinnabar Shake) */
.cell.invalid {
  animation: shake-cinnabar 0.4s ease;
  background: linear-gradient(135deg, #fae0db 0%, #f0bdb4 100%);
  border-color: var(--palace-vermilion);
  color: var(--palace-vermilion-deep);
}

@keyframes shake-cinnabar {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-1.5deg); }
  40% { transform: translateX(5px) rotate(1.5deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* 閃現金光 */
.cell.flash {
  background: linear-gradient(135deg, #fff7dc 0%, #fce196 100%) !important;
  border-color: var(--palace-gold-bright) !important;
  color: var(--palace-gold-dark) !important;
  box-shadow: 0 0 18px var(--palace-gold-bright);
  animation: flash-gold-pulse 0.7s infinite alternate;
}

@keyframes flash-gold-pulse {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.08); filter: brightness(1.28); }
}

/* 乾隆御覽硃砂圈印 (Circle Seal) */
.cell.hint-circle::after {
  content: "";
  position: absolute;
  inset: 5%;
  border: 3px solid var(--palace-vermilion);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 10px var(--palace-vermilion-glow), inset 0 0 6px var(--palace-vermilion-glow);
  animation: circle-seal-stamp 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes circle-seal-stamp {
  0% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── 密室線索古卷清單 (Target List - 故宮紅木博古架卡片) ── */
.target-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.target-list li.target-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.68;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, rgba(255, 253, 249, 0.97) 0%, rgba(248, 241, 227, 0.95) 100%);
  border: 1.5px solid var(--palace-gold);
  border-left: 5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.7rem 0.95rem;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-ink);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.target-list li.target-card:hover {
  transform: translateX(5px);
  border-color: var(--palace-gold-bright);
  box-shadow: 0 5px 15px rgba(197, 154, 63, 0.25);
}

.target-list li.target-card.selected {
  border-color: var(--palace-indigo);
  border-left-color: var(--palace-vermilion);
  background: linear-gradient(135deg, #ffffff 0%, #f2ebdf 100%);
  box-shadow: 0 0 0 2px rgba(44, 74, 111, 0.35), 0 5px 16px rgba(26, 23, 20, 0.12);
  transform: translateX(7px);
}

.target-list li.target-card.done {
  text-decoration: line-through;
  text-decoration-color: var(--palace-vermilion);
  text-decoration-thickness: 2.5px;
  color: var(--palace-ink-soft);
  cursor: default;
  letter-spacing: 0.18em;
  font-size: 1.05rem;
  border-left-color: var(--palace-vermilion);
  background: rgba(239, 230, 214, 0.65);
  opacity: 0.85;
}

.target-list li.target-card.done::after {
  content: "破";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(12deg);
  font-family: var(--font-calligraphy);
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--palace-vermilion);
  border: 1.5px solid var(--palace-vermilion);
  border-radius: 4px;
  padding: 0 0.3rem;
  opacity: 0.8;
  box-shadow: 0 2px 4px var(--palace-vermilion-glow);
}

.clue-text { flex: 1; min-width: 0; }

.clue-tag {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  border-radius: 4px;
  padding: 0.14rem 0.55rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.clue-tag[data-style="釋義"]   { background: #dceaf2; color: #1c455c; border: 1px solid #acc8d8; }
.clue-tag[data-style="急轉彎"] { background: #faecc3; color: #7f5203; border: 1px solid #e0c67e; }
.clue-tag[data-style="典故"]   { background: #ebd5e4; color: #6b335c; border: 1px solid #ccaec4; }
.clue-tag[data-style="諧音"]   { background: #dfebd4; color: #3b5d23; border: 1px solid #b6d1a5; }
.clue-tag[data-style="情境"]   { background: #f7ded3; color: #873d1f; border: 1px solid #dfb09e; }

/* ── 提示工具列 (Hint Bar) ── */
.hint-bar {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hint-btn {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: linear-gradient(145deg, #fffdf8 0%, #f4e9d7 100%);
  color: var(--palace-ink-deep);
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(26, 23, 20, 0.08);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hint-btn:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: var(--palace-gold-bright);
  box-shadow: 0 5px 14px rgba(197, 154, 63, 0.3);
}

.hint-btn small { color: var(--palace-ink-soft); font-size: 0.74rem; font-weight: 400; }
.hint-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.6); }

.hint-btn.earn {
  background: linear-gradient(135deg, var(--palace-indigo) 0%, var(--palace-indigo-deep) 100%);
  color: #fff9ed;
  border-color: var(--palace-gold-bright);
  box-shadow: 0 3px 10px rgba(44, 74, 111, 0.35);
}
.hint-btn.earn small { color: #dce7ee; }
.hint-btn.earn:not(:disabled):hover {
  box-shadow: 0 5px 16px rgba(44, 74, 111, 0.48), 0 0 12px var(--palace-gold-glow);
}

.hint-quota {
  flex-basis: 100%;
  text-align: center;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--palace-ink-soft);
  font-weight: 600;
}
.hint-quota.exhausted { color: var(--palace-vermilion); text-shadow: 0 0 8px var(--palace-vermilion-glow); font-weight: 700; }
.hint-msg {
  text-align: center;
  margin-top: 0.7rem;
  min-height: 1.4em;
  color: var(--palace-vermilion);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

/* ── 國風按鈕全域 (Buttons) ── */
.primary-btn, .ghost-btn, .danger-btn {
  font-family: var(--font-serif);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  border-radius: 999px;
  padding: 0.48rem 1.3rem;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.primary-btn {
  background: linear-gradient(135deg, var(--palace-indigo) 0%, var(--palace-indigo-deep) 100%);
  color: #fff9ee;
  border: 1.5px solid var(--palace-gold-bright);
  box-shadow: 0 3px 10px rgba(44, 74, 111, 0.35);
}
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(44, 74, 111, 0.45), 0 0 12px var(--palace-gold-glow);
}

.ghost-btn {
  background: rgba(250, 246, 237, 0.9);
  color: var(--palace-indigo-deep);
  border: 1.5px solid var(--palace-gold);
  box-shadow: 0 2px 6px rgba(26, 23, 20, 0.05);
}
.ghost-btn:hover {
  background: #ffffff;
  border-color: var(--palace-gold-bright);
  color: var(--palace-vermilion);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(197, 154, 63, 0.22);
}

.danger-btn {
  background: linear-gradient(135deg, var(--palace-vermilion) 0%, var(--palace-vermilion-deep) 100%);
  color: #fff9ee;
  border: 1.5px solid var(--palace-gold-bright);
  box-shadow: 0 3px 10px rgba(184, 40, 35, 0.35);
}
.danger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(184, 40, 35, 0.45);
}

/* ── 彈窗系統 (Modals - 故宮綾絹裝裱錦匣) ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 10, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  z-index: 1000;
  backdrop-filter: blur(6px);
}

.modal {
  position: relative;
  width: min(92vw, 460px);
  background: var(--palace-paper-card);
  border: 2.5px solid var(--palace-gold);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: 
    0 18px 50px rgba(14, 12, 10, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 0 0 4px var(--palace-paper-deep);
  animation: palace-modal-in 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes palace-modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.95rem;
  font: inherit;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--palace-ink-soft);
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  transform: rotate(90deg);
  color: var(--palace-vermilion);
}

.card-badge {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--palace-vermilion) 0%, var(--palace-vermilion-deep) 100%);
  border: 1px solid var(--palace-gold-bright);
  border-radius: 4px;
  padding: 0.18rem 0.65rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.22em;
  box-shadow: 0 2px 6px var(--palace-vermilion-glow);
}

.card-text {
  font-family: var(--font-calligraphy);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  margin-bottom: 0.85rem;
  color: var(--palace-ink-deep);
}

.card-meaning { margin-bottom: 0.65rem; line-height: 1.8; font-size: 1.02rem; }
.card-insight { color: var(--palace-indigo-deep); line-height: 1.8; margin-bottom: 0.65rem; font-weight: 600; }
.card-source { color: var(--palace-ink-soft); font-size: 0.9rem; }

/* 研墨答題 (Quiz Modal) */
.quiz-examiner-wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.75rem 0.95rem;
  margin-bottom: 1.1rem;
}

.quiz-examiner-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--palace-gold);
  box-shadow: 0 2px 6px rgba(197, 154, 63, 0.25);
  flex-shrink: 0;
  overflow: hidden;
}

.examiner-name {
  display: block;
  font-family: var(--font-calligraphy);
  font-size: 1rem;
  color: var(--palace-indigo-deep);
  margin-bottom: 0.15rem;
}

.examiner-quote {
  font-size: 0.85rem;
  color: var(--palace-ink-soft);
  line-height: 1.45;
}

.quiz-prompt {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.85;
  margin-bottom: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--palace-ink-deep);
}

.quiz-options { display: grid; gap: 0.65rem; }
.quiz-options button {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  background: var(--palace-paper-card);
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 5px rgba(26, 23, 20, 0.06);
  transition: all 0.2s ease;
}

.quiz-options button:hover:not(:disabled) {
  border-color: var(--palace-gold-bright);
  transform: translateY(-1px);
}

.quiz-options button.correct {
  background: #e2f0d9;
  border-color: var(--palace-jade);
  color: var(--palace-jade);
  font-weight: 700;
}

.quiz-options button.wrong {
  background: #fde4e2;
  border-color: var(--palace-vermilion);
  color: var(--palace-vermilion-deep);
}

/* ── 角色展演台與漫畫對話 (Character Stage & Comic Bubbles) ── */
.fengshen-companion.character-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98) 0%, rgba(246, 238, 222, 0.95) 100%);
  border: 2px solid var(--palace-gold);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.1rem 1.2rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 8px 24px rgba(26, 23, 20, 0.12), 0 2px 6px rgba(197, 154, 63, 0.2);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.stage-aura-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.stage-magic-circle {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1.5px dashed rgba(197, 154, 63, 0.38);
  box-shadow: inset 0 0 20px rgba(197, 154, 63, 0.15), 0 0 15px rgba(197, 154, 63, 0.2);
  animation: magic-circle-spin 24s linear infinite;
}

@keyframes magic-circle-spin {
  0% { transform: translateX(-50%) rotate(0deg); }
  100% { transform: translateX(-50%) rotate(360deg); }
}

.companion-standee-container {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 68px;
  margin-top: 0.15rem;
}

.standee-img-container.stage-large .fengshen-standee-img {
  max-height: 60px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(26, 23, 20, 0.18));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: standee-float 4s ease-in-out infinite;
}

@keyframes standee-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}

.character-stage:hover {
  transform: translateY(-3px);
  border-color: var(--palace-gold-bright);
  box-shadow: 0 12px 32px rgba(197, 154, 63, 0.28);
}

.character-stage:hover .fengshen-standee-img {
  transform: translateY(-4px) scale(1.05);
}

/* 漫畫音效標籤 (SFX Tag) */
.comic-sfx-tag {
  position: absolute;
  top: 10px;
  right: 18px;
  z-index: 5;
  font-family: var(--font-calligraphy);
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--palace-vermilion) 0%, var(--palace-vermilion-deep) 100%);
  border: 2px solid #fff;
  border-radius: 8px;
  padding: 0.12rem 0.6rem;
  transform: rotate(12deg) scale(1);
  box-shadow: 0 4px 12px var(--palace-vermilion-glow), 2px 2px 0 rgba(0,0,0,0.15);
  pointer-events: none;
  letter-spacing: 0.1em;
}

.comic-bubble {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #ffffff;
  border: 2px solid var(--palace-gold);
  box-shadow: 0 4px 14px rgba(26, 23, 20, 0.08);
}

.companion-name {
  font-family: var(--font-calligraphy);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--palace-indigo-deep);
}

.companion-hint-badge {
  font-size: 0.74rem;
  color: var(--palace-gold-dark);
  background: #fef8eb;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(197, 154, 63, 0.3);
}

.companion-text {
  font-size: 0.95rem;
  color: var(--palace-ink-deep);
  line-height: 1.65;
  margin-top: 0.3rem;
}

/* ── 破陣漫畫特寫 Cut-In 特效 (.manga-cutin-overlay) ── */
.manga-cutin-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(14, 12, 10, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.cutin-speedlines-bg {
  position: absolute;
  inset: -50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(197, 154, 63, 0.2) 0deg 3deg,
    transparent 3deg 8deg,
    rgba(255, 255, 255, 0.12) 8deg 11deg,
    transparent 11deg 16deg
  );
  animation: cutin-spin 18s linear infinite;
}

@keyframes cutin-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cutin-slash-bar {
  position: absolute;
  width: 140%;
  height: 130px;
  background: linear-gradient(90deg, transparent 0%, rgba(184, 40, 35, 0.95) 20%, rgba(197, 154, 63, 0.95) 80%, transparent 100%);
  transform: rotate(-12deg);
  box-shadow: 0 0 40px var(--palace-gold-glow);
  filter: blur(1px);
}

.cutin-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2.2rem;
  max-width: 940px;
  width: 90%;
  padding: 1.5rem;
}

.cutin-kanji-stamp {
  font-family: var(--font-calligraphy);
  font-size: clamp(5.5rem, 16vw, 9rem);
  font-weight: 900;
  line-height: 1;
  color: #fff6d6;
  text-shadow: 
    0 0 20px #f59e0b,
    0 0 40px #b45309,
    4px 4px 0 #78350f,
    8px 8px 20px rgba(0,0,0,0.6);
}

.cutin-kanji-sub {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: #fef08a;
  background: rgba(18, 14, 11, 0.88);
  border: 1.5px solid #eab308;
  border-radius: 999px;
  padding: 0.25rem 1.1rem;
  margin-top: -0.5rem;
}

/* ── 結算視窗增強：故宮題名榜與法寶 ── */
.complete-modal { text-align: center; }
.complete-array-name {
  font-family: var(--font-calligraphy);
  font-size: 1.05rem;
  color: var(--palace-indigo-deep);
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.1em;
}

.complete-group-photo-wrap {
  margin: 0.8rem 0 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--palace-gold);
  box-shadow: 0 4px 16px rgba(26, 23, 20, 0.15);
}

.complete-group-photo-img {
  width: 100%;
  height: auto;
  display: block;
}

.complete-guardian-feedback, .timeout-rescue-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #ffffff;
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.75rem 0.95rem;
  margin-bottom: 1.1rem;
  text-align: left;
}

.settle-avatar {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}

.complete-treasure-box {
  background: linear-gradient(135deg, #fdf9ee 0%, #faecd0 100%);
  border: 1.5px solid var(--palace-gold);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.3rem;
  text-align: left;
  box-shadow: 0 4px 16px rgba(197, 154, 63, 0.22);
}

.treasure-header {
  font-size: 0.85rem;
  color: var(--palace-vermilion);
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 0.45rem;
}

.treasure-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.treasure-icon { font-size: 2.2rem; line-height: 1; }
.treasure-name {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--palace-ink-deep);
  margin-bottom: 0.15rem;
}
.treasure-desc {
  font-size: 0.82rem;
  color: var(--palace-ink-soft);
  line-height: 1.45;
}

/* ── 底部趣味仙童彩蛋 (.easter-egg-mascot) ── */
.easter-egg-mascot {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

.mascot-avatar-box {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffdf8 0%, #fef3c7 100%);
  border: 2.5px solid var(--palace-gold);
  box-shadow: 0 6px 20px rgba(197, 154, 63, 0.38), inset 0 2px 4px #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: mascot-idle 4s ease-in-out infinite alternate;
}

@keyframes mascot-idle {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(4deg); }
  100% { transform: translateY(0) rotate(-2deg); }
}

.easter-egg-mascot:hover .mascot-avatar-box {
  transform: scale(1.14) translateY(-6px);
  box-shadow: 0 10px 26px rgba(197, 154, 63, 0.48);
}

.mascot-tooltip {
  margin-top: 0.4rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--palace-ink-deep);
  background: #ffffff;
  border: 1px solid var(--palace-gold);
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  white-space: nowrap;
}

/* ── 響應式優化 (Mobile RWD) ───────────────── */
@media (max-width: 480px) {
  .app-title { font-size: 1.4rem; letter-spacing: 0.18em; }
  main { padding: 0.8rem 0.6rem 2.5rem; }
  .grid { gap: 4px; }
  .hint-btn { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .chapter-levels { grid-template-columns: repeat(2, 1fr); }
  .game-top { gap: 0.5rem; flex-wrap: wrap; }
  .card-text { font-size: 1.5rem; }
  .modal { padding: 1.3rem 1rem 1.1rem; }
  .chamber-hero-title { font-size: 1.5rem; }
  .seal-runes { gap: 0.3rem; }
  .seal-rune-node { min-width: 36px; height: 30px; font-size: 0.75rem; }
  .easter-egg-mascot { bottom: 0.8rem; right: 0.8rem; }
  .mascot-avatar-box { width: 52px; height: 52px; }
}

/* ==========================================================================
   故宮博物院宮廷古風 UI 與 1:1 Q版生圖深度整合樣式
   ========================================================================== */

/* ── 1. 密室大廳 (Chamber View) 故宮宮廷 Hero 大圖與名陣水印 ── */
.palace-hero-card {
  padding: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(180deg, #fffcf5 0%, #f7eee0 100%);
  border: 2px solid rgba(198, 146, 36, 0.45);
  box-shadow: 0 10px 30px rgba(24, 20, 17, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  margin-bottom: 1.6rem;
}

.palace-hero-banner-wrap {
  position: relative;
  width: 100%;
  max-height: 240px;
  overflow: hidden;
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  border-bottom: 3px solid var(--gold);
}

.palace-hero-banner-img {
  width: 100%;
  height: 100%;
  max-height: 240px;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  transition: transform 0.4s ease;
}

.palace-hero-banner-wrap:hover .palace-hero-banner-img {
  transform: scale(1.03);
}

.palace-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(24,20,17,0.4) 100%);
  pointer-events: none;
}

.palace-hero-body {
  padding: 1.2rem 1.4rem 1.4rem;
  text-align: center;
}

.palace-seal-tag {
  display: inline-block;
  font-family: var(--font-calligraphy);
  background: var(--vermilion);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--gold-bright);
  margin-right: 0.4rem;
  box-shadow: 0 2px 4px rgba(185, 43, 39, 0.3);
}

/* 陣法卡片故宮名陣水印暗紋與法寶預覽 */
.chamber-card {
  position: relative;
}

.chamber-card-watermark {
  position: absolute;
  right: 12px;
  top: 8px;
  font-family: var(--font-calligraphy);
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--chamber-color, var(--indigo));
  opacity: 0.07;
  pointer-events: none;
  line-height: 1;
  user-select: none;
  letter-spacing: 0.1em;
}

.treasure-preview-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #faecd0 100%);
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(198, 146, 36, 0.25);
  flex-shrink: 0;
  padding: 4px;
}

.treasure-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── 2. 遊戲盤面 (Game View) 故宮金絲玉石質感與博古架展演台 ── */
.palace-jade-board {
  position: relative;
  background: linear-gradient(135deg, #fbf7ee 0%, #f3e8d2 100%);
  border: 3px solid #c69224;
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 
    0 8px 24px rgba(24, 20, 17, 0.15),
    inset 0 0 0 2px rgba(255, 255, 255, 0.7),
    inset 0 0 16px rgba(198, 146, 36, 0.12);
}

.board-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 3;
}
.board-corner.corner-tl {
  top: 4px;
  left: 4px;
  border-top: 3px solid #c69224;
  border-left: 3px solid #c69224;
  border-top-left-radius: 4px;
}
.board-corner.corner-tr {
  top: 4px;
  right: 4px;
  border-top: 3px solid #c69224;
  border-right: 3px solid #c69224;
  border-top-right-radius: 4px;
}
.board-corner.corner-bl {
  bottom: 4px;
  left: 4px;
  border-bottom: 3px solid #c69224;
  border-left: 3px solid #c69224;
  border-bottom-left-radius: 4px;
}
.board-corner.corner-br {
  bottom: 4px;
  right: 4px;
  border-bottom: 3px solid #c69224;
  border-right: 3px solid #c69224;
  border-bottom-right-radius: 4px;
}

/* 故宮玉石字格 (Palace Jade Cells) */
.palace-jade-board .cell {
  background: linear-gradient(145deg, #ffffff 0%, #fcf8ee 60%, #f4ebd9 100%);
  border: 1.5px solid #d4af37;
  border-radius: 8px;
  box-shadow: 
    inset 0 1px 2px rgba(255, 255, 255, 0.95),
    inset 0 -1px 2px rgba(198, 146, 36, 0.15),
    0 3px 6px rgba(24, 20, 17, 0.08);
  font-family: var(--font-serif);
  font-weight: 700;
  color: #1a1613;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.palace-jade-board .cell:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: #b45309;
  box-shadow: 
    0 6px 14px rgba(198, 146, 36, 0.35),
    0 0 10px rgba(250, 204, 21, 0.4);
}

/* 故宮博古架立繪展演台 (Palace Bogu Shelf Stage) */
.palace-bogu-stage {
  position: relative;
  width: 100%;
  height: 220px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 253, 248, 0.95) 0%, rgba(244, 235, 217, 0.6) 80%);
  border: 2px solid rgba(198, 146, 36, 0.35);
  box-shadow: inset 0 0 20px rgba(198, 146, 36, 0.08), 0 4px 14px rgba(24, 20, 17, 0.06);
  overflow: hidden;
}

.bogu-shelf-lattice {
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(140, 99, 16, 0.2);
  border-radius: 8px;
  background-image: 
    linear-gradient(rgba(140, 99, 16, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 99, 16, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.bogu-cloud-halo {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 2px dashed rgba(212, 175, 55, 0.4);
  box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.15), 0 0 15px rgba(212, 175, 55, 0.2);
  animation: magic-circle-spin 28s linear infinite;
  pointer-events: none;
}

.bogu-jade-pedestal {
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 14px;
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 50%, #86efac 100%);
  border: 1.5px solid #2b5442;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 2px 8px rgba(43, 84, 66, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.companion-avatar-wrap {
  position: relative;
  z-index: 2;
  height: 68px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.companion-avatar-wrap .fengshen-avatar-img {
  max-height: 60px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(24, 20, 17, 0.2));
  animation: standee-float 4s ease-in-out infinite;
  transition: transform 0.25s ease;
}

.fengshen-companion:hover .companion-avatar-wrap .fengshen-avatar-img {
  transform: scale(1.06) translateY(-4px);
}

/* ── 3. 破陣結算彈窗 (宮廷聖旨 / 金榜題名) ── */
.palace-edict-modal {
  position: relative;
  background: linear-gradient(180deg, #fffbf0 0%, #fdf5e2 40%, #f8ecc8 100%) !important;
  border: 3px solid #b45309 !important;
  border-radius: var(--radius-lg);
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(250, 204, 21, 0.35),
    inset 0 0 0 3px rgba(254, 240, 138, 0.8);
  padding: 1.6rem 1.4rem 1.4rem;
  max-width: 520px;
}

.edict-header-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(90deg, #991b1b 0%, #b91c1c 50%, #991b1b 100%);
  color: #fef08a;
  border: 2px solid var(--gold-bright);
  border-radius: 999px;
  padding: 0.35rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(153, 27, 27, 0.4);
}

.edict-plaque-title {
  font-family: var(--font-calligraphy);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.edict-dragon-mark {
  font-size: 1.2rem;
}

.edict-body-wrap {
  position: relative;
}

.palace-vermilion-seal-stamp {
  position: absolute;
  top: -10px;
  right: -5px;
  width: 58px;
  height: 58px;
  border: 2.5px solid var(--vermilion);
  background: rgba(185, 43, 39, 0.08);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(12deg);
  box-shadow: 0 3px 10px rgba(185, 43, 39, 0.25);
  animation: seal-stamp-in 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  z-index: 10;
  pointer-events: none;
}

@keyframes seal-stamp-in {
  0% { transform: scale(2.2) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(12deg); opacity: 1; }
}

.seal-inner-text {
  font-family: var(--font-calligraphy);
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--vermilion);
  line-height: 1.15;
  text-align: center;
  writing-mode: vertical-rl;
  letter-spacing: 0.15em;
}

.group-photo-silk-ribbon {
  font-family: var(--font-calligraphy);
  font-size: 0.88rem;
  font-weight: 700;
  color: #78350f;
  background: linear-gradient(90deg, #fef08a 0%, #fde047 50%, #fef08a 100%);
  border: 1px solid #ca8a04;
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  margin-top: 0.4rem;
  box-shadow: 0 2px 6px rgba(202, 138, 4, 0.25);
  display: inline-block;
}

.treasure-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: radial-gradient(circle, #ffffff 40%, #fef08a 100%);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(198, 146, 36, 0.35);
  flex-shrink: 0;
  padding: 6px;
}

.treasure-shard-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

/* ── 響應式優化 (Mobile & Tablet RWD) ── */
@media (max-width: 959px) {
  .fengshen-companion.character-stage {
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 0.95rem;
    gap: 0.95rem;
  }

  .companion-standee-container {
    flex: 0 0 105px;
    height: 115px;
    margin-top: 0;
  }

  .standee-img-container.stage-large .fengshen-standee-img {
    max-height: 110px;
  }

  .stage-magic-circle {
    width: 130px;
    height: 130px;
    top: 5%;
  }

  .comic-bubble {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.8rem;
  }

  .cutin-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .cutin-character-stage {
    flex: 0 0 180px;
    height: 190px;
  }
}

@media (max-width: 480px) {
  .app-title { font-size: 1.45rem; letter-spacing: 0.2em; }
  main { padding: 0.8rem 0.6rem 2.8rem; }
  .grid { gap: 5px; padding: 6px; }
  .hint-btn { padding: 0.45rem 0.65rem; font-size: 0.86rem; }
  .chapter-levels { grid-template-columns: repeat(2, 1fr); }
  .game-top { gap: 0.5rem; flex-wrap: wrap; }
  .card-text { font-size: 1.55rem; }
  .modal { padding: 1.35rem 1.1rem 1.2rem; }
  .chamber-hero-title { font-size: 1.6rem; }
  .seal-runes { gap: 0.35rem; }
  .seal-rune-node { min-width: 38px; height: 32px; font-size: 0.78rem; }
  .easter-egg-mascot { bottom: 0.9rem; right: 0.9rem; }
  .mascot-avatar-box { width: 54px; height: 54px; }
}
