/* ==========================================================================
 * 《魔幻蒸汽》V6 — FINAL FANTASY RESONANCE × FINAL FANTASY XVI
 * Crystalline Astral Midnight-Sapphire & Champagne-Platinum Hairline Fine-Art UI
 * Zero OS Emojis · 1px Celestial Hairlines · Bust + Spanning Dialogue + Choices
 * (PIXEL-273: Removed render-blocking Google Fonts @import; uses offline-safe system serif stack)
 * ========================================================================== */

:root {
  --abyss-void: #03060e;
  --sapphire-950: rgba(4, 8, 18, 0.95);
  --sapphire-900: rgba(8, 14, 30, 0.90);
  --sapphire-800: rgba(12, 20, 42, 0.82);
  --sapphire-600: rgba(18, 32, 64, 0.64);

  --champagne: #e5d5b5;
  --champagne-bright: #f7efe0;
  --champagne-soft: rgba(229, 213, 181, 0.72);
  --champagne-line: rgba(229, 213, 181, 0.44);
  --champagne-faint: rgba(229, 213, 181, 0.18);

  --astral-cyan: #7dd3fc;
  --astral-ice: #e0f2fe;
  --astral-glow: rgba(125, 211, 252, 0.38);
  --astral-deep: #0c4a6e;

  --crimson-core: #e11d48;
  --crimson-hi: #fda4af;
  --crimson-deep: #881337;

  --celadon-ok: #6ee7b7;
  --ivory-ink: #f5f0e6;
  --silver-ink: #c6d0e0;
  --muted-ink: #8e9cb2;

  --ff-roman: 'Marcellus', 'Cinzel', 'Palatino Linotype', 'Book Antiqua', Georgia, 'Latin Modern Roman Caps', 'Noto Serif TC', 'Noto Serif CJK TC', 'Songti TC', 'PingFang TC', 'Microsoft JhengHei', serif;
  --ff-serif: 'Noto Serif TC', 'Noto Serif CJK TC', 'Source Han Serif TC', 'Songti TC', 'STSong', 'Palatino Linotype', Georgia, 'PingFang TC', 'Microsoft JhengHei', serif;
  --ff-num: 'Cinzel', 'Marcellus', 'Palatino Linotype', 'Book Antiqua', Georgia, 'Noto Serif TC', 'Noto Serif CJK TC', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 42%, #0a1122 0%, #03050a 100%);
  color: var(--ivory-ink);
  font-family: var(--ff-serif);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hide {
  display: none !important;
}

/* ==========================================================================
 * 1. 無邊際深邃暗幕舞台與四角 1px 香檳星軌游標刻線 (.canvas-box)
 * ========================================================================== */
.arena-outer {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0px, 0.35vw, 6px);
  background:
    radial-gradient(circle at 50% 50%, rgba(125, 211, 252, 0.035) 0%, transparent 62%),
    linear-gradient(180deg, #060a14 0%, #020408 100%);
}

.canvas-box {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  max-width: 1680px;
  aspect-ratio: 16 / 9;
  background: #04070f;
  border: 1px solid rgba(229, 213, 181, 0.22);
  overflow: hidden;
  box-shadow:
    0 26px 72px rgba(0, 0, 0, 0.95),
    inset 0 0 48px rgba(2, 5, 12, 0.46);
}

.canvas-box::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 28px rgba(3, 6, 14, 0.42);
  z-index: 11;
}

canvas#stageCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  cursor: crosshair;
}

canvas#townV2ShaderCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
  z-index: 2;
}

.canvas-box[data-scene="COMBAT"] canvas#townV2ShaderCanvas {
  display: none !important;
}

.canvas-box[data-scene="TOWN"] canvas#stageCanvas {
  cursor: pointer;
}

/* 實戰 / 靶場：世界準星繪製期間，畫布保留十字游標作為備援 */
.canvas-box[data-range-combat="true"] canvas#stageCanvas,
.canvas-box[data-scene="COMBAT"] canvas#stageCanvas {
  cursor: crosshair;
}

/* 四角極細 1px 香檳金星軌游標刻線 */
.viewport-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 24;
  opacity: 0.78;
}
.viewport-corner.nw { top: 6px; left: 6px; }
.viewport-corner.ne { top: 6px; right: 6px; transform: scaleX(-1); }
.viewport-corner.sw { bottom: 6px; left: 6px; transform: scaleY(-1); }
.viewport-corner.se { bottom: 6px; right: 6px; transform: scale(-1, -1); }

/* ==========================================================================
 * 2. 左上主角狀態區 (FF Resonance Minimalist Party / Hero Strip)
 * ========================================================================== */
.hud-hero-plaque {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: min(318px, 38vw);
  pointer-events: none;
  zoom: var(--ui-scale, 1);
}

.hero-plaque-main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 18px 6px 6px;
  background: linear-gradient(90deg, rgba(6, 10, 22, 0.82) 0%, rgba(10, 16, 34, 0.48) 68%, transparent 100%);
  pointer-events: auto;
}

/* 頂底僅綴一條 1px 漸隱香檳金髮絲線 */
.hero-plaque-main::before,
.hero-plaque-main::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(229, 213, 181, 0.68) 0%, rgba(229, 213, 181, 0.22) 62%, transparent 100%);
  pointer-events: none;
}
.hero-plaque-main::before { top: 0; }
.hero-plaque-main::after { bottom: 0; }

.hero-crest-wrap { cursor: pointer; pointer-events: auto; }

/* 英雄切換列：單行細膠囊 */
.hero-switch-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  pointer-events: auto;
}

.hero-pill-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 6px;
  white-space: nowrap;
  font-family: var(--ff-serif);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--champagne-soft);
  background: rgba(6, 12, 28, 0.82);
  border: 0.8px solid rgba(229, 213, 181, 0.34);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.hero-pill-btn .hero-pill-key {
  font-family: var(--ff-num);
  font-size: 9px;
  color: var(--astral-cyan);
  opacity: 0.85;
}

.hero-pill-btn:hover {
  color: var(--champagne-bright);
  border-color: rgba(229, 213, 181, 0.75);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.28);
}

.hero-pill-btn.is-active {
  color: var(--astral-ice);
  background: linear-gradient(135deg, rgba(12, 74, 110, 0.9) 0%, rgba(10, 24, 54, 0.96) 100%);
  border-color: var(--astral-cyan);
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.45), inset 0 0 0 0.5px rgba(229, 213, 181, 0.4);
}

.hero-pill-btn.is-active .hero-pill-key {
  color: var(--champagne-bright);
  opacity: 1;
}

/* 流派分支與等級快速演練切換面板 (#townTestSwitcher) */
.town-test-switcher {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 6px;
  background: linear-gradient(180deg, rgba(6, 13, 30, 0.86) 0%, rgba(4, 9, 22, 0.92) 100%);
  border: 0.8px solid rgba(229, 213, 181, 0.28);
  border-radius: 3px;
  pointer-events: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.test-switcher-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.test-row-tag {
  flex: 0 0 auto;
  font-family: var(--ff-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--champagne);
  opacity: 0.86;
  white-space: nowrap;
}

.test-branch-bar,
.test-level-bar {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.test-speed-wrap {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.test-speed-slider {
  flex: 1 1 auto;
  min-width: 72px;
  height: 4px;
  accent-color: var(--astral-cyan);
  cursor: pointer;
}

.test-speed-val {
  flex: 0 0 auto;
  min-width: 32px;
  text-align: right;
  font-family: var(--ff-num);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--astral-ice);
}

.test-reset-btn {
  flex: 0 0 auto !important;
  padding: 1px 6px !important;
}

.test-branch-pill,
.test-lv-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 1px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--ff-serif);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: var(--champagne-soft);
  background: rgba(8, 17, 38, 0.84);
  border: 0.8px solid rgba(229, 213, 181, 0.28);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.test-lv-btn {
  font-family: var(--ff-num);
  font-size: 9px;
  padding: 1px 4px;
}

.test-branch-pill:hover,
.test-lv-btn:hover {
  color: var(--champagne-bright);
  border-color: rgba(229, 213, 181, 0.72);
  box-shadow: 0 0 6px rgba(125, 211, 252, 0.25);
}

.test-branch-pill.is-active,
.test-lv-btn.is-active {
  color: var(--astral-ice);
  background: linear-gradient(135deg, rgba(14, 86, 124, 0.92) 0%, rgba(10, 26, 56, 0.96) 100%);
  border-color: var(--astral-cyan);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.42), inset 0 0 0 0.5px rgba(229, 213, 181, 0.4);
}

.test-lv-btn.is-max-btn.is-active {
  color: #fde68a;
  background: linear-gradient(135deg, rgba(120, 74, 18, 0.92) 0%, rgba(45, 26, 8, 0.96) 100%);
  border-color: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.45);
}

/* 八角菱晶肖像框 */
.hero-crest-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-crest-octagon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(125, 211, 252, 0.18));
}

canvas#heroPortraitHud {
  width: 42px;
  height: 42px;
  clip-path: polygon(29% 0%, 71% 0%, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0% 71%, 0% 29%);
  background: radial-gradient(circle at 50% 38%, rgba(26, 48, 78, 0.92) 0%, rgba(5, 9, 18, 0.96) 82%);
  image-rendering: pixelated;
  position: relative;
  z-index: 2;
}

.lv-wax-seal {
  position: absolute;
  right: -4px;
  bottom: -4px;
  z-index: 4;
  padding: 1px 6px;
  background: linear-gradient(180deg, rgba(8, 14, 30, 0.95) 0%, rgba(4, 8, 18, 0.98) 100%);
  border: 1px solid rgba(229, 213, 181, 0.68);
  color: var(--champagne);
  font-family: var(--ff-roman);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  font-variant-numeric: tabular-nums;
}

.lv-wax-seal b {
  color: var(--champagne-bright);
  font-family: var(--ff-num);
  font-size: 10.5px;
  font-weight: 700;
}

.lv-wax-seal.lv-flash {
  animation: astralLvPulse 0.65s ease-out;
}

@keyframes astralLvPulse {
  0% { transform: scale(1); border-color: var(--astral-cyan); box-shadow: 0 0 0 rgba(125, 211, 252, 0.85); }
  45% { transform: scale(1.18); border-color: #ffffff; box-shadow: 0 0 14px rgba(125, 211, 252, 0.9); }
  100% { transform: scale(1); }
}

/* 右側斜切晶體細光條區 */
.hero-vitals-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 196px;
}

.ff-gauge-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ff-gauge-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-right: 4px;
}

.ff-gauge-key {
  font-family: var(--ff-roman);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--champagne);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.ff-gauge-key.astral {
  color: var(--astral-cyan);
  font-size: 8px;
  letter-spacing: 0.24em;
}

.vial-hp-text {
  font-family: var(--ff-num);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--champagne-bright);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

/* 極具 FF 標誌性的斜切晶體細光條 (height: 5px; transform: skewX(-24deg)) */
.alch-vial {
  position: relative;
  width: 100%;
  height: 5px;
  transform: skewX(-24deg);
  background: rgba(4, 8, 18, 0.86);
  border: 0.8px solid rgba(229, 213, 181, 0.38);
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
}

.alch-vial.xp-tube {
  height: 5px;
  border-color: rgba(125, 211, 252, 0.34);
}

.meter-fill {
  height: 100%;
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.hp-fill {
  background: linear-gradient(90deg, #881337 0%, #e11d48 64%, #fecdd3 100%);
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.65);
}

.vial-mp-text {
  font-family: var(--ff-num);
  font-size: 10px;
  font-weight: 600;
  color: #bae6fd;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.alch-vial.mp-tube {
  height: 5px;
  border-color: rgba(56, 189, 248, 0.42);
}

.mp-fill {
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 60%, #a5f3fc 100%);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.55);
  transition: width 0.08s linear;
}

.mp-gauge-group.is-low-mp .alch-vial.mp-tube {
  border-color: #f87171;
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.65);
}

.xp-fill {
  background: linear-gradient(90deg, #075985 0%, #38bdf8 66%, #e0f2fe 100%);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.65);
}

/* GIL / AETHER 襯線資源列 */
.wallet-obsidian-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  font-family: var(--ff-roman);
  font-size: 10px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.wallet-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wallet-micro-svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.wallet-unit-tag {
  font-family: var(--ff-roman);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--champagne-soft);
}

.wallet-unit-tag.astral {
  color: rgba(125, 211, 252, 0.85);
}

.wallet-coin-val {
  font-family: var(--ff-num);
  font-size: 11px;
  font-weight: 600;
  color: var(--champagne-bright);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.wallet-core-val {
  font-family: var(--ff-num);
  font-size: 11px;
  font-weight: 600;
  color: var(--astral-ice);
  text-shadow: 0 0 6px rgba(125, 211, 252, 0.35);
}

.wallet-dot-sep {
  color: rgba(229, 213, 181, 0.35);
  font-size: 10px;
}

/* 羽化狀態銘文 (#buffStatus) */
.buff-parchment-ribbon {
  pointer-events: auto;
  padding: 2px 10px 2px 6px;
  background: linear-gradient(90deg, rgba(6, 10, 22, 0.66) 0%, transparent 92%);
  border-left: 1px solid rgba(229, 213, 181, 0.55);
  font-family: var(--ff-serif);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--champagne-soft) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
 * 3. 頂部中央：地名天球銘牌 (FF Resonance Chapter / Sector Title Plinth)
 * ========================================================================== */
.hud-region-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
  zoom: var(--ui-scale, 1);
}

/* 首領戰自動平滑下移避讓首領血條 */
.canvas-box[data-boss-active="true"] .hud-region-banner {
  transform: translate(-50%, 44px);
  opacity: 0.84;
}

.region-plaque-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 28px 6px;
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 48%, rgba(5, 9, 20, 0.84) 0%, rgba(5, 9, 20, 0.56) 66%, transparent 94%);
}

.region-kicker-en {
  font-family: var(--ff-roman);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.34em;
  color: rgba(229, 213, 181, 0.84);
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

/* 1px 雙端漸隱香檳白金星軌細線 + 中央 5px 菱形星核 */
.region-astral-axis {
  position: relative;
  width: 288px;
  height: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.region-astral-axis::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent 0%, rgba(229, 213, 181, 0.72) 26%, #f8f0e2 50%, rgba(229, 213, 181, 0.72) 74%, transparent 100%);
}

.region-axis-core {
  position: relative;
  z-index: 1;
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--astral-cyan);
  border: 0.8px solid var(--champagne-bright);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.85);
}

.wave-badge-text {
  font-family: var(--ff-serif);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--champagne-bright);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.98),
    0 2px 10px rgba(0, 0, 0, 0.92),
    0 0 18px rgba(8, 14, 30, 0.85);
  white-space: nowrap;
}

.region-plaque-frame.banner-pulse {
  animation: chapterReveal 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes chapterReveal {
  0% { opacity: 0.55; transform: scale(0.97); filter: brightness(1.4); }
  60% { opacity: 1; transform: scale(1.015); filter: brightness(1.15); }
  100% { opacity: 1; transform: scale(1); filter: brightness(1); }
}

/* 懸浮極簡透明列車時刻細銘文 (#trainStatusPill) */
.train-ticker-pill {
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 14px;
  background: linear-gradient(90deg, transparent 0%, rgba(6, 11, 24, 0.68) 20%, rgba(6, 11, 24, 0.68) 80%, transparent 100%);
  border-bottom: 1px solid rgba(229, 213, 181, 0.28);
  font-family: var(--ff-serif);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(229, 213, 181, 0.88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  transition: all 0.18s ease;
  font-variant-numeric: tabular-nums;
}

.train-ticker-pill:hover {
  color: #ffffff;
  border-bottom-color: var(--astral-cyan);
}

.canvas-box[data-scene="COMBAT"] .train-ticker-pill {
  display: none;
}

.train-watch-dot {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--celadon-ok);
  box-shadow: 0 0 6px var(--celadon-ok);
  flex-shrink: 0;
}

.train-ticker-pill[data-phase="whistle"] .train-watch-dot {
  background: var(--champagne-bright);
  box-shadow: 0 0 8px var(--champagne-bright);
  animation: diamondPulse 0.48s infinite alternate;
}

.train-ticker-pill[data-phase="depart"] .train-watch-dot,
.train-ticker-pill[data-phase="arrive"] .train-watch-dot {
  background: var(--champagne);
  box-shadow: 0 0 6px var(--champagne);
}

.train-ticker-pill[data-phase="away"] .train-watch-dot {
  background: var(--astral-cyan);
  box-shadow: 0 0 7px var(--astral-cyan);
}

.train-ticker-pill[data-phase="brake"] .train-watch-dot {
  background: #ffffff;
  box-shadow: 0 0 7px #ffffff;
}

@keyframes diamondPulse {
  from { opacity: 0.4; transform: rotate(45deg) scale(0.82); }
  to { opacity: 1; transform: rotate(45deg) scale(1.24); }
}

/* ==========================================================================
 * 4. 右上星盤小地圖與極簡天球控制列
 *    100% 穿透點擊對齊 MINIMAP_RECT = { x: 1042, y: 14, w: 224, h: 126 } on 1280×720
 * ========================================================================== */
.astrolabe-minimap-bezel {
  position: absolute;
  left: 81.40625%;
  top: 1.94444%;
  width: 17.5%;
  height: 17.5%;
  pointer-events: none;
  z-index: 19;
  border: 0.85px solid rgba(229, 213, 181, 0.56);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(6, 10, 22, 0.68);
  transition: opacity 0.22s ease;
}

.canvas-box[data-scene="COMBAT"] .astrolabe-minimap-bezel {
  opacity: 0;
}

.astrolabe-ring-svg {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  pointer-events: none;
}

.astro-cardinal {
  position: absolute;
  font-family: var(--ff-roman);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--champagne-bright);
  padding: 0 3px;
  background: rgba(5, 9, 20, 0.82);
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
}
.astro-cardinal.n { top: -6px; left: 50%; transform: translateX(-50%); }
.astro-cardinal.s { bottom: -6px; left: 50%; transform: translateX(-50%); }
.astro-cardinal.w { left: -6px; top: 50%; transform: translateY(-50%); }
.astro-cardinal.e { right: -6px; top: 50%; transform: translateY(-50%); }

/* 小地圖下方無框羽化極簡天球控制列 */
.quick-brass-controls {
  position: absolute;
  top: 20.6%;
  right: 14px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 2px 6px;
  background: linear-gradient(90deg, transparent 0%, rgba(5, 10, 22, 0.72) 18%, rgba(5, 10, 22, 0.82) 100%);
  border-top: 0.8px solid rgba(229, 213, 181, 0.32);
  border-bottom: 0.8px solid rgba(229, 213, 181, 0.32);
  transition: top 0.22s ease;
  zoom: var(--ui-scale, 1);
}

.canvas-box[data-scene="COMBAT"] .quick-brass-controls {
  top: 12px;
}

button.btn {
  position: relative;
  font-family: var(--ff-serif);
  background: rgba(8, 14, 30, 0.46);
  color: var(--ivory-ink);
  border: none;
  border-bottom: 1px solid transparent;
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.16s ease;
  white-space: nowrap;
}

button.btn:hover {
  color: #ffffff;
  background: rgba(125, 211, 252, 0.12);
  border-bottom-color: var(--champagne);
}

button.btn.portal-cta {
  color: var(--astral-ice);
  border-bottom: 1px solid rgba(125, 211, 252, 0.65);
  background: linear-gradient(90deg, rgba(12, 74, 110, 0.45), rgba(8, 22, 48, 0.65));
  padding-left: 18px;
}

/* 純向量四角星芒微徽記 (不依賴 textContent，不怕主程式覆寫文字) */
button.btn.portal-cta::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 8px;
  height: 8px;
  transform: translateY(-50%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 0.5 L7.4 4.6 L11.5 6 L7.4 7.4 L6 11.5 L4.6 7.4 L0.5 6 L4.6 4.6 Z' fill='none' stroke='%237dd3fc' stroke-width='1'/%3E%3C/svg%3E");
}

button.btn.portal-cta:hover {
  border-bottom-color: #ffffff;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.32);
}

.ctrl-svg-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  opacity: 0.9;
}

.cam-zoom-compact {
  display: inline-block;
  font-family: var(--ff-num);
  font-size: 10.5px;
  max-width: 44px;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--champagne);
}

/* 純向量 Pause / Play 與 Mute / Sound 圖示鈕 (零 Emoji) */
button.btn.icon-pill {
  width: 26px;
  height: 24px;
  padding: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

#btnPause {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cline x1='4' y1='2' x2='4' y2='10' stroke='%23e5d5b5' stroke-width='1.2'/%3E%3Cline x1='8' y1='2' x2='8' y2='10' stroke='%23e5d5b5' stroke-width='1.2'/%3E%3C/svg%3E");
}

#btnPause[data-state="paused"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpolygon points='3,2 10,6 3,10' fill='none' stroke='%237dd3fc' stroke-width='1.1'/%3E%3C/svg%3E");
}

#btnMute {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5 H4.4 L7.2 2.2 V9.8 L4.4 7.5 H2 Z' fill='none' stroke='%23e5d5b5' stroke-width='1'/%3E%3Cpath d='M9 4 C10.1 5 10.1 7 9 8' fill='none' stroke='%237dd3fc' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
}

#btnMute[data-muted="true"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5 H4.4 L7.2 2.2 V9.8 L4.4 7.5 H2 Z' fill='none' stroke='%238e9cb2' stroke-width='1'/%3E%3Cline x1='8.6' y1='4.2' x2='11' y2='7.8' stroke='%23fda4af' stroke-width='1.1'/%3E%3Cline x1='11' y1='4.2' x2='8.6' y2='7.8' stroke='%23fda4af' stroke-width='1.1'/%3E%3C/svg%3E");
}

button.btn.settings-gear-btn.active {
  color: var(--astral-ice);
  border-bottom-color: var(--astral-cyan);
  background: rgba(125, 211, 252, 0.15);
}

button.btn.on-ai {
  color: var(--astral-ice);
  border: 0.8px solid rgba(125, 211, 252, 0.55);
  background: rgba(12, 74, 110, 0.45);
}

button.btn.on-green {
  color: var(--celadon-ok);
  border: 0.8px solid rgba(110, 231, 183, 0.45);
  background: rgba(6, 78, 59, 0.38);
}

button.btn.on-brass {
  color: var(--champagne-bright);
  border: 0.8px solid rgba(229, 213, 181, 0.45);
  background: rgba(30, 41, 59, 0.48);
}

/* ==========================================================================
 * 5. 右側深藍星夜毛玻璃系統選單 (#settingsDrawer)
 * ========================================================================== */
.settings-drawer {
  position: absolute;
  top: 25.5%;
  right: 14px;
  width: min(344px, calc(100% - 28px));
  max-height: 68%;
  z-index: 30;
  background: linear-gradient(180deg, rgba(8, 14, 30, 0.92) 0%, rgba(4, 8, 18, 0.96) 100%);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--champagne);
  border-bottom: 1px solid var(--champagne);
  border-left: 1px solid rgba(229, 213, 181, 0.28);
  border-right: 1px solid rgba(229, 213, 181, 0.28);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.92);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.canvas-box[data-scene="COMBAT"] .settings-drawer {
  top: 44px;
}

.settings-drawer.show {
  display: flex;
  animation: astralDropIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes astralDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sd-head {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(229, 213, 181, 0.24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sd-title {
  font-family: var(--ff-roman);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--champagne-bright);
}

.sd-key-hint {
  font-family: var(--ff-roman);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--muted-ink);
  padding: 1px 6px;
  border: 0.8px solid rgba(229, 213, 181, 0.28);
}

.sd-body {
  padding: 10px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: rgba(10, 18, 38, 0.55);
  border-bottom: 1px solid rgba(229, 213, 181, 0.16);
}

.sd-row-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(10, 18, 38, 0.55);
  border-bottom: 1px solid rgba(229, 213, 181, 0.16);
}

.sd-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--silver-ink);
}

select.sel {
  width: 100%;
  font-family: var(--ff-serif);
  background: rgba(4, 8, 18, 0.94);
  color: var(--ivory-ink);
  border: 0.8px solid rgba(229, 213, 181, 0.42);
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
}

select.sel:hover,
select.sel:focus {
  border-color: var(--astral-cyan);
  outline: none;
}

.sd-manual-box {
  padding: 8px 10px;
  background: rgba(8, 15, 32, 0.72);
  border-left: 1.5px solid var(--astral-cyan);
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--silver-ink);
}

.sd-audio-panel {
  gap: 7px;
}

.sd-audio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sd-audio-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sd-sub-label {
  width: 58px;
  flex-shrink: 0;
  font-family: var(--ff-roman);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--champagne-soft);
}

.sd-vol-val {
  width: 34px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--ff-num);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--champagne-bright);
}

.sd-audio-meta {
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted-ink);
  border-top: 0.8px solid rgba(229, 213, 181, 0.14);
  padding-top: 4px;
}

input[type="range"].astral-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  background: rgba(229, 213, 181, 0.28);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"].astral-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  background: var(--astral-cyan);
  border: 1px solid var(--champagne-bright);
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.65);
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.14s ease;
}

input[type="range"].astral-slider::-webkit-slider-thumb:hover {
  transform: rotate(45deg) scale(1.18);
  background: #ffffff;
}

input[type="range"].astral-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  background: var(--astral-cyan);
  border: 1px solid var(--champagne-bright);
  border-radius: 0;
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.65);
  cursor: pointer;
}

/* ==========================================================================
 * 6. 底部城區單線星軌導覽列 (#townDock) 與實戰晶體指令牌 (#combatSkillBar)
 * ========================================================================== */
.town-dock-shell {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 120px);
  opacity: 0.68;
  transition: opacity 0.22s ease, transform 0.22s ease;
  zoom: var(--ui-scale, 1);
}

.town-dock-shell:hover {
  opacity: 1;
}

.canvas-box[data-scene="COMBAT"] .town-dock-shell,
.canvas-box[data-scene="TOWN"][data-range-combat="true"] .town-dock-shell {
  display: none;
}

/* 當開啟 NPC 立繪對話舞台時優雅淡出底部導覽列，避免重疊 */
.canvas-box:has(#venueDrawer.show) .town-dock-shell {
  opacity: 0;
  pointer-events: none;
}

.dock-toggle-btn {
  width: 22px;
  height: 22px;
  background: rgba(6, 11, 24, 0.76);
  border: 0.8px solid rgba(229, 213, 181, 0.48);
  color: var(--champagne);
  font-family: var(--ff-roman);
  font-size: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.dock-toggle-btn:hover {
  border-color: var(--astral-cyan);
  color: #ffffff;
}

.town-dock {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  padding: 3px 18px;
  background: linear-gradient(90deg, transparent 0%, rgba(5, 10, 22, 0.78) 10%, rgba(5, 10, 22, 0.78) 90%, transparent 100%);
  overflow-x: auto;
  scrollbar-width: none;
}
.town-dock::-webkit-scrollbar { display: none; }

.town-dock::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(229, 213, 181, 0.52) 50%, transparent 100%);
  pointer-events: none;
}

.town-dock.dock-collapsed {
  display: none;
}

.dock-btn {
  position: relative;
  font-family: var(--ff-serif);
  background: transparent;
  color: rgba(245, 240, 230, 0.88);
  border: none;
  border-bottom: 1px solid transparent;
  padding: 4px 9px 4px 15px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.dock-btn::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 4px;
  height: 4px;
  transform: translateY(-50%) rotate(45deg);
  border: 0.8px solid var(--champagne);
  background: transparent;
  transition: all 0.16s ease;
}

.dock-btn[data-cat="portal"]::before {
  border-color: var(--astral-cyan);
}

.dock-btn:hover {
  color: #ffffff;
  border-bottom-color: var(--astral-cyan);
  background: linear-gradient(180deg, transparent 0%, rgba(125, 211, 252, 0.14) 100%);
}

.dock-btn:hover::before {
  background: var(--astral-cyan);
  border-color: #ffffff;
  box-shadow: 0 0 6px var(--astral-cyan);
}

/* ==========================================================================
 * 實戰模式：v3 現代 PC／寬畫面《魔幻蒸汽》底部水平技能 Dock
 * Spec: docs/art/PIXEL-391-v3-ui-and-grounding-spec.md §3.2–§3.5
 * Zero skewX · Orthogonal Chamfered Obsidian + Brass · 26 Skill Icons
 * ========================================================================== */
.combat-skill-bar {
  --slot-size: 52px;
  --ult-size: 56px;
  --icon-size: 44px;
  --ult-icon-size: 48px;
  --dock-gap: 8px;
  --label-size: 10px;
  --keycap-size: 9px;
  --cd-font-size: 16px;
  --loadout-max-w: 132px;

  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  align-items: flex-end;
  gap: var(--dock-gap);
  padding: 2px 12px 1px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(13, 21, 32, 0.92) 0%, rgba(7, 12, 20, 0.96) 100%);
  border-top: 1px solid rgba(196, 165, 116, 0.65);
  border-bottom: 1px solid rgba(196, 165, 116, 0.55);
  border-left: 1px solid rgba(196, 165, 116, 0.28);
  border-right: 1px solid rgba(196, 165, 116, 0.28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.82), inset 0 1px 0 rgba(254, 240, 138, 0.14);
  zoom: var(--ui-scale, 1);
}

.canvas-box[data-scene="COMBAT"] .combat-skill-bar,
.canvas-box[data-range-combat="true"] .combat-skill-bar,
.canvas-box[data-scene="TOWN"][data-range-combat="true"] .combat-skill-bar {
  display: flex;
}

.canvas-box:has(#venueDrawer.show) .combat-skill-bar {
  opacity: 0;
  pointer-events: none;
}

/* 先鋒 0–6 格破彈蒸汽壓橫向分段計量條（貼合 Dock 正上方 5px，非先鋒 display:none 零佔位） */
.vanguard-steam-bar {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  width: clamp(260px, 24vw, 310px);
  height: 18px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(11, 17, 28, 0.96);
  border: 1px solid #c4a574;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.78);
  pointer-events: none;
  white-space: nowrap;
}

.vanguard-steam-label {
  font-family: var(--ff-serif);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #e5d5b5;
  flex-shrink: 0;
}

.vanguard-steam-segs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.vanguard-steam-seg {
  width: 22px;
  height: 8px;
  background: #1e293b;
  border: 1px solid rgba(196, 165, 116, 0.35);
  clip-path: polygon(2px 0, calc(100% - 2px) 0, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 0 calc(100% - 2px), 0 2px);
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.vanguard-steam-seg.is-filled {
  background: #f59e0b;
  border-color: #fde68a;
}

.vanguard-steam-seg.is-hot {
  background: #fb923c;
  border-color: #fed7aa;
  box-shadow: 0 0 6px rgba(251, 146, 60, 0.65);
}

.vanguard-steam-seg.is-full {
  background: #ffd75e;
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 215, 94, 0.85);
}

.vanguard-steam-bar.is-full-pressure {
  border-color: #ffd75e;
  box-shadow: 0 0 12px rgba(255, 215, 94, 0.45), 0 4px 12px rgba(0, 0, 0, 0.82);
}

.vanguard-breaker-pill {
  font-family: var(--ff-num);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fef08a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vanguard-breaker-pill.has-shield {
  color: #38bdf8;
}

/* 現代暗底黃銅浮動 Tooltip（懸停技能槽或右側裝備膠囊於上方 10–12px 展開） */
.skill-hud-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: clamp(236px, 21vw, 300px);
  padding: 10px 12px;
  background: rgba(11, 17, 28, 0.96);
  border: 1.5px solid #c4a574;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.92), inset 0 1px 0 rgba(254, 240, 138, 0.16);
  color: #e2e8f0;
  font-family: var(--ff-serif);
  text-align: left;
  pointer-events: none;
  z-index: 42;
  display: none;
}

.skill-hud-tooltip.is-visible {
  display: block;
}

.skill-hud-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 5px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(196, 165, 116, 0.30);
}

.skill-hud-tooltip-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff8e7;
  letter-spacing: 0.04em;
}

.skill-hud-tooltip-key {
  font-family: var(--ff-num);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  background: rgba(7, 12, 20, 0.94);
  border: 1px solid #c4a574;
  color: #fef08a;
  white-space: nowrap;
}

.skill-hud-tooltip-stats {
  font-family: var(--ff-num);
  font-size: 11px;
  font-weight: 600;
  color: #7dd3fc;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

.skill-hud-tooltip-desc {
  font-size: 11.5px;
  line-height: 1.45;
  color: #cbd5e1;
}

.skill-hud-tooltip-mods {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  font-size: 11px;
  line-height: 1.4;
  color: #fef08a;
}

/* 技能格間垂向黃銅細分隔線 */
.skill-dock-divider {
  width: 1px;
  height: calc(var(--slot-size) - 6px);
  margin-bottom: 14px;
  background: rgba(196, 165, 116, 0.32);
  flex-shrink: 0;
}

/* 正交技能按鈕容器（零 skewX） */
.skill-slot,
button.skill-slot,
button.nova-skill-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0;
  background: transparent;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.14s ease;
}

button.skill-slot:hover,
button.nova-skill-btn:hover {
  transform: translateY(-2px);
}

button.skill-slot:active,
button.nova-skill-btn:active {
  transform: scale(0.96);
}

/* 切角黑曜石圖示格 */
.skill-icon-box {
  position: relative;
  width: var(--slot-size);
  height: var(--slot-size);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1520;
  border: 1.5px solid #c4a574;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.72);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

button.nova-skill-btn .skill-icon-box.is-ult {
  width: var(--ult-size);
  height: var(--ult-size);
  border: 1.5px solid #eab344;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.65), inset 0 0 12px rgba(0, 0, 0, 0.76);
}

.skill-hud-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  display: block;
  image-rendering: pixelated;
  pointer-events: none;
  transition: filter 0.14s ease, opacity 0.14s ease;
}

button.nova-skill-btn .skill-hud-icon {
  width: var(--ult-icon-size);
  height: var(--ult-icon-size);
}

/* 左上角微型鍵帽膠囊（絕不遮擋圖示中心剪影） */
.skill-keycap {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 4;
  padding: 1px 4px;
  background: rgba(7, 12, 20, 0.92);
  border: 1px solid #c4a574;
  color: #f7efe0;
  font-family: var(--ff-num);
  font-size: var(--keycap-size);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
}

/* 右下角 MP 消耗 / READY / 充能角標 */
.skill-sub {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 4;
  padding: 0 3px;
  background: rgba(7, 12, 20, 0.88);
  font-family: var(--ff-num);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.2;
  color: #7dd3fc;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: nowrap;
}

#btnArcanePulse .skill-sub {
  bottom: 7px;
  color: #e0f2fe;
}

/* 普攻動態數值保留於 DOM 供 Tooltip 與 E2E 讀取，不撐寬按鈕 */
.skill-sub.is-sr-meta {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 魔導震波 3 顆微型菱形充能點 */
.pulse-charge-pips {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.pulse-pip {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: #1e293b;
  border: 1px solid rgba(125, 211, 252, 0.45);
}

.pulse-pip.is-filled {
  background: #38bdf8;
  border-color: #e0f2fe;
  box-shadow: 0 0 5px rgba(56, 189, 248, 0.85);
}

/* 順時針徑向暗遮罩 + 居中大號純白等寬讀秒 */
.skill-slot .cd-overlay,
.nova-skill-btn .cd-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: conic-gradient(rgba(4, 8, 16, 0.78) calc(var(--cd, 0) * 360deg), transparent 0);
}

.skill-slot.is-cooling .cd-overlay,
.nova-skill-btn.is-cooling .cd-overlay {
  opacity: 1;
}

.skill-slot .cd-text,
.nova-skill-btn .cd-text {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: var(--ff-num);
  font-size: var(--cd-font-size);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px #000000, 0 0 8px rgba(56, 189, 248, 0.65);
  font-variant-numeric: tabular-nums;
}

.skill-slot .cd-text:empty,
.nova-skill-btn .cd-text:empty {
  display: none;
}

/* 底部單行水平緊湊微標籤（嚴禁直排換行） */
.skill-name {
  display: block;
  width: calc(var(--slot-size) + 4px);
  max-width: calc(var(--slot-size) + 4px);
  font-family: var(--ff-serif);
  font-size: var(--label-size);
  font-weight: 600;
  line-height: 1.2;
  color: #e5d5b5;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

button.nova-skill-btn .skill-name {
  width: calc(var(--ult-size) + 6px);
  max-width: calc(var(--ult-size) + 6px);
  color: #fef08a;
}

/* 狀態樣式矩陣 (§3.4): Ready / Cooling / OOM / Hover / Channeling / Ult Ready */
.skill-slot.is-ready .skill-icon-box {
  border-color: #c4a574;
}

.skill-slot.is-ready .skill-sub,
.nova-skill-btn.is-ready .skill-sub {
  color: #7dd3fc;
}

#btnNovaDash.is-ready .skill-sub {
  color: #ffd75e;
}

.skill-slot.is-cooling .skill-icon-box,
.nova-skill-btn.is-cooling .skill-icon-box {
  border-color: rgba(196, 165, 116, 0.28);
}

.skill-slot.is-cooling .skill-hud-icon,
.nova-skill-btn.is-cooling .skill-hud-icon {
  filter: grayscale(0.75) brightness(0.45);
}

.skill-slot.is-cooling .skill-keycap,
.skill-slot.is-cooling .skill-name,
.nova-skill-btn.is-cooling .skill-keycap,
.nova-skill-btn.is-cooling .skill-name {
  opacity: 0.55;
}

.skill-slot.is-cooling .skill-sub,
.nova-skill-btn.is-cooling .skill-sub {
  opacity: 0;
}

/* OOM 魔力不足：冷藍／警示紅濾鏡 + 紅框 + 高亮 MP 角標（與冷卻明確區隔） */
.skill-slot.is-oom .skill-icon-box {
  border-color: #f87171;
  box-shadow: inset 0 0 10px rgba(248, 113, 113, 0.28);
}

.skill-slot.is-oom .skill-hud-icon {
  filter: saturate(0.55) brightness(0.65);
}

.skill-slot.is-oom .cd-overlay {
  opacity: 1;
  background: rgba(30, 58, 138, 0.32);
}

.skill-slot.is-oom .skill-sub {
  color: #fda4af;
  border: 1px solid rgba(248, 113, 113, 0.65);
}

/* Hover & Channeling */
button.skill-slot:hover .skill-icon-box,
button.nova-skill-btn:hover .skill-icon-box {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

button.skill-slot:hover .skill-hud-icon,
button.nova-skill-btn:hover .skill-hud-icon {
  filter: brightness(1.16);
}

.skill-slot.is-channeling .skill-icon-box {
  border-color: #fde047;
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.50);
}

.skill-slot.is-channeling .skill-hud-icon {
  filter: brightness(1.16);
}

.skill-slot.is-channeling .skill-sub {
  color: #fde047;
}

/* 大招就緒柔和 2.2s 呼吸外暈 */
@keyframes ultReadyHalo {
  0%, 100% {
    box-shadow: 0 0 10px rgba(234, 179, 68, 0.35), inset 0 0 0 1px rgba(56, 189, 248, 0.65);
  }
  50% {
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.55), inset 0 0 0 1px rgba(255, 215, 94, 0.85);
  }
}

#btnNovaDash.is-ready .skill-icon-box.is-ult {
  border-color: #ffd75e;
  animation: ultReadyHalo 2.2s ease-in-out infinite;
}

/* 冷卻歸零短暫 180ms 邊框金光掃掠（純 CSS） */
@keyframes skillReadyFlash {
  0% { border-color: #ffd75e; box-shadow: 0 0 14px rgba(255, 215, 94, 0.85); }
  100% { border-color: #c4a574; box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.72); }
}

.skill-slot.is-ready-flash .skill-icon-box,
.nova-skill-btn.is-ready-flash .skill-icon-box {
  animation: skillReadyFlash 0.18s ease-out;
}

/* 右側遺物／切換膠囊 (#hudCombatLoadout) */
.relic-socket-strip {
  display: flex;
  align-items: center;
  align-self: center;
  max-width: var(--loadout-max-w);
  padding: 4px 0 4px 10px;
  border-left: 1px solid rgba(196, 165, 116, 0.35);
  font-family: var(--ff-serif);
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: var(--champagne-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.relic-socket-strip:hover {
  color: #fff8e7;
}

/* 三解析度響應式斷點 (§3.3): 1280x720 / 1440x900 / 1920x1080 */
@media (min-width: 1400px) and (min-height: 820px) {
  .combat-skill-bar {
    --slot-size: 56px;
    --ult-size: 60px;
    --icon-size: 48px;
    --ult-icon-size: 52px;
    --dock-gap: 10px;
    --label-size: 10.5px;
    --keycap-size: 9.5px;
    --cd-font-size: 17px;
    --loadout-max-w: 148px;
    bottom: 14px;
    padding: 7px 14px 6px;
  }
  .skill-keycap { padding: 1px 5px; }
  .skill-sub { font-size: 10px; }
}

@media (min-width: 1680px) and (min-height: 920px) {
  .combat-skill-bar {
    --slot-size: 60px;
    --ult-size: 64px;
    --icon-size: 52px;
    --ult-icon-size: 56px;
    --dock-gap: 12px;
    --label-size: 11px;
    --keycap-size: 10px;
    --cd-font-size: 18px;
    --loadout-max-w: 164px;
    bottom: 16px;
    padding: 8px 16px 6px;
  }
  .skill-keycap { padding: 2px 5px; }
  .skill-sub { font-size: 10.5px; }
}

/* ==========================================================================
 * 7. JRPG 半身立繪 ＋ 底部橫幅深海藍寶石對話框 ＋ 分支對話選項系統 (#venueDrawer)
 * ========================================================================== */
.venue-drawer {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: none;
  pointer-events: none;
}

.canvas-box:has(#venueDrawer.show) .quick-brass-controls {
  opacity: 0;
  pointer-events: none;
}

.venue-drawer.show {
  display: block;
  animation: stageFadeIn 0.22s ease-out;
}

@keyframes stageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 僅在畫面下半部鋪設柔和深海暗角襯底，上半 65% 城鎮實景保持清澈無遮擋 */
.vd-stage-veil {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background: linear-gradient(180deg, transparent 0%, rgba(3, 6, 15, 0.42) 52%, rgba(2, 5, 12, 0.78) 100%);
  pointer-events: none;
  z-index: 1;
}

/* 7A. 左側半身角色立繪舞台 (#vdBustStage: left: 24px; bottom: 0; width: 350px; height: 430px) */
.vd-bust-stage {
  position: absolute;
  left: 24px;
  bottom: 0;
  width: 350px;
  height: 430px;
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* 角色背後星芒天球光暈 */
.vd-bust-aura {
  position: absolute;
  left: 50%;
  bottom: 92px;
  width: 280px;
  height: 280px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(125, 211, 252, 0.20) 0%, rgba(229, 213, 181, 0.08) 42%, transparent 72%);
  pointer-events: none;
  z-index: 1;
}

.vd-bust-astrolabe {
  position: absolute;
  left: 50%;
  bottom: 108px;
  width: 248px;
  height: 248px;
  transform: translateX(-50%);
  opacity: 0.42;
  pointer-events: none;
  z-index: 1;
  animation: slowAstrolabeTurn 48s linear infinite;
}

@keyframes slowAstrolabeTurn {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

.vd-bust-img {
  position: relative;
  z-index: 3;
  max-width: 342px;
  max-height: 426px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: bottom center;
  filter:
    drop-shadow(0 10px 26px rgba(0, 0, 0, 0.92))
    drop-shadow(0 0 14px rgba(125, 211, 252, 0.16));
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 88%, rgba(0, 0, 0, 0.35) 97%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 88%, rgba(0, 0, 0, 0.35) 97%, transparent 100%);
  animation: bustBreathFloat 4.2s ease-in-out infinite;
  display: none;
}

.vd-bust-stage[data-has-bust="true"] .vd-bust-img {
  display: block;
}

@keyframes bustBreathFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

/* 當尚未注入高解析立繪時的優雅天球肖像降級框 (#vdPortrait) */
.vd-portrait-fallback {
  position: absolute;
  left: 50%;
  bottom: 158px;
  transform: translateX(-50%);
  z-index: 2;
  width: 152px;
  height: 152px;
  padding: 8px;
  background: radial-gradient(circle at 50% 42%, rgba(14, 28, 56, 0.94) 0%, rgba(5, 9, 20, 0.96) 100%);
  border: 1px solid var(--champagne);
  clip-path: polygon(22% 0%, 78% 0%, 100% 22%, 100% 78%, 78% 100%, 22% 100%, 0% 78%, 0% 22%);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.9), 0 0 22px rgba(125, 211, 252, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bustBreathFloat 4.2s ease-in-out infinite;
}

.vd-bust-stage[data-has-bust="true"] .vd-portrait-fallback {
  opacity: 0;
  pointer-events: none;
  width: 48px;
  height: 48px;
}

.vd-portrait {
  width: 124px;
  height: 124px;
  image-rendering: pixelated;
  display: block;
}

/* 7B. 底部橫幅經典 FF 深海藍寶石對話框 (#vdDialogueBox) */
.vd-dialogue-box {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 18px;
  min-height: 136px;
  z-index: 3;
  pointer-events: auto;
  padding: 28px 36px 22px 344px;
  background: linear-gradient(180deg, rgba(8, 14, 30, 0.90) 0%, rgba(4, 8, 18, 0.95) 100%);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--champagne);
  border-bottom: 1px solid var(--champagne);
  border-left: 1px solid rgba(229, 213, 181, 0.30);
  border-right: 1px solid rgba(229, 213, 181, 0.30);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.92),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 32px rgba(12, 24, 52, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 四角微菱星飾 (◆) */
.vd-finial {
  position: absolute;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--abyss-void);
  border: 1px solid var(--champagne-bright);
  box-shadow: 0 0 6px rgba(229, 213, 181, 0.55);
  pointer-events: none;
}
.vd-finial.nw { top: -4px; left: -4px; }
.vd-finial.ne { top: -4px; right: -4px; }
.vd-finial.sw { bottom: -4px; left: -4px; }
.vd-finial.se { bottom: -4px; right: -4px; }

/* 左上懸浮古典羅馬襯線說話者名牌 (#vdTitle + #vdSub) */
.vd-speaker-plaque {
  position: absolute;
  top: -16px;
  left: 344px;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 20px 4px 14px;
  background: linear-gradient(90deg, rgba(6, 12, 28, 0.98) 0%, rgba(10, 20, 44, 0.94) 82%, transparent 100%);
  border-top: 1px solid var(--champagne-bright);
  border-bottom: 1px solid rgba(229, 213, 181, 0.42);
  border-left: 2px solid var(--astral-cyan);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.85);
}

.vd-title {
  font-family: var(--ff-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--champagne-bright);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}

.vd-speaker-sep {
  color: var(--astral-cyan);
  font-size: 11px;
}

.vd-sub {
  font-family: var(--ff-roman);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--astral-cyan);
  white-space: nowrap;
}

.vd-close {
  position: absolute;
  top: 8px;
  right: 14px;
  font-family: var(--ff-roman);
  background: transparent;
  color: var(--muted-ink);
  border: 0.8px solid rgba(229, 213, 181, 0.24);
  padding: 2px 9px;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.16s ease;
}

.vd-close:hover {
  color: #ffffff;
  border-color: var(--champagne-bright);
  background: rgba(229, 213, 181, 0.1);
}

.vd-speech {
  font-family: var(--ff-serif);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.72;
  letter-spacing: 0.05em;
  color: var(--ivory-ink);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.92);
  min-height: 52px;
  padding-right: 22px;
}

/* 對話框右下角呼吸菱晶繼續指示標 */
.vd-next-cursor {
  position: absolute;
  right: 18px;
  bottom: 12px;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--astral-cyan);
  border: 0.8px solid #ffffff;
  box-shadow: 0 0 10px var(--astral-cyan);
  animation: nextCursorBob 1.1s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes nextCursorBob {
  from { opacity: 0.45; transform: translateY(-2px) rotate(45deg) scale(0.9); }
  to { opacity: 1; transform: translateY(2px) rotate(45deg) scale(1.1); }
}

/* 7C. 對話框右上方懸浮《分支對話選項選單 (#vdChoiceMenu)》 */
.vd-choice-menu {
  position: absolute;
  right: 36px;
  bottom: 170px;
  width: min(392px, calc(100% - 404px));
  z-index: 5;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: choiceFloatIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.venue-drawer[data-dialogue-view="service"] .vd-choice-menu {
  display: none;
}

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

.vd-choice-kicker {
  align-self: flex-end;
  font-family: var(--ff-roman);
  font-size: 9px;
  letter-spacing: 0.26em;
  color: rgba(229, 213, 181, 0.78);
  padding: 0 6px 3px 24px;
  border-bottom: 1px solid rgba(229, 213, 181, 0.28);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.vd-choice-btn {
  position: relative;
  width: 100%;
  font-family: var(--ff-serif);
  background: linear-gradient(90deg, rgba(6, 12, 26, 0.84) 0%, rgba(8, 15, 32, 0.92) 75%, rgba(4, 8, 18, 0.95) 100%);
  backdrop-filter: blur(8px);
  color: var(--silver-ink);
  border: none;
  border-top: 1px solid rgba(229, 213, 181, 0.22);
  border-bottom: 1px solid rgba(229, 213, 181, 0.22);
  border-right: 1px solid rgba(229, 213, 181, 0.34);
  padding: 9px 14px 9px 34px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.72);
  transition: all 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 未選中時顯示空心香檳菱晶 (◇)，選中或懸停時浮現 FF 經典發光青白水晶菱標 (◆) 與柔和橫向光暈 */
.vd-choice-cursor {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translateY(-50%) rotate(45deg);
  border: 1px solid rgba(229, 213, 181, 0.65);
  background: transparent;
  transition: all 0.16s ease;
}

.vd-choice-key {
  font-family: var(--ff-roman);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--muted-ink);
  padding: 1px 5px;
  border: 0.8px solid rgba(229, 213, 181, 0.22);
  flex-shrink: 0;
}

.vd-choice-btn:hover,
.vd-choice-btn[data-selected="true"] {
  color: #ffffff;
  transform: translateX(-4px);
  background: linear-gradient(90deg, rgba(125, 211, 252, 0.22) 0%, rgba(14, 28, 58, 0.92) 48%, rgba(6, 12, 26, 0.96) 100%);
  border-top-color: var(--champagne-bright);
  border-bottom-color: var(--champagne-bright);
  border-right: 2px solid var(--astral-cyan);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.85),
    0 0 18px rgba(125, 211, 252, 0.20);
}

.vd-choice-btn:hover .vd-choice-cursor,
.vd-choice-btn[data-selected="true"] .vd-choice-cursor {
  background: #e0f2fe;
  border-color: #ffffff;
  box-shadow: 0 0 10px #7dd3fc, 0 0 18px rgba(125, 211, 252, 0.9);
  transform: translateY(-50%) rotate(45deg) scale(1.18);
}

.vd-choice-btn:hover .vd-choice-key,
.vd-choice-btn[data-selected="true"] .vd-choice-key {
  color: var(--astral-ice);
  border-color: rgba(125, 211, 252, 0.65);
}

/* 7D. 展開後之 FF Resonance 半透明星軌指令面板 (#vdServiceModal，內含 #vdBody) */
.vd-service-modal {
  position: absolute;
  right: 36px;
  bottom: 168px;
  width: min(568px, calc(100% - 404px));
  max-height: min(442px, calc(100% - 216px));
  z-index: 5;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(8, 14, 30, 0.92) 0%, rgba(4, 8, 18, 0.96) 100%);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--champagne);
  border-bottom: 1px solid var(--champagne);
  border-left: 1px solid rgba(229, 213, 181, 0.28);
  border-right: 1px solid rgba(229, 213, 181, 0.28);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.92);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.venue-drawer[data-dialogue-view="service"] .vd-service-modal {
  display: flex;
  animation: serviceReveal 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.vd-service-head {
  padding: 9px 14px;
  background: linear-gradient(90deg, rgba(125, 211, 252, 0.10) 0%, transparent 75%);
  border-bottom: 1px solid rgba(229, 213, 181, 0.26);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vd-service-kicker {
  font-family: var(--ff-roman);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--champagne-bright);
}

.vd-back-btn {
  font-family: var(--ff-serif);
  background: rgba(12, 24, 48, 0.65);
  color: var(--astral-ice);
  border: 0.8px solid rgba(125, 211, 252, 0.48);
  padding: 3px 11px;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.vd-back-btn:hover {
  background: rgba(125, 211, 252, 0.2);
  border-color: #ffffff;
  color: #ffffff;
}

.vd-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(229, 213, 181, 0.4) rgba(4, 8, 18, 0.8);
}

/* 星軌場館項目列 (.shop-item & .shop-act) */
.shop-item {
  background: linear-gradient(90deg, rgba(12, 22, 46, 0.68) 0%, rgba(6, 12, 26, 0.84) 100%);
  border-top: 0.8px solid rgba(229, 213, 181, 0.22);
  border-bottom: 0.8px solid rgba(229, 213, 181, 0.22);
  border-left: 2px solid rgba(229, 213, 181, 0.55);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.15s ease;
}

.shop-item:hover {
  border-left-color: var(--astral-cyan);
  background: linear-gradient(90deg, rgba(16, 32, 64, 0.78) 0%, rgba(8, 15, 32, 0.90) 100%);
}

.shop-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.shop-item h5 {
  font-family: var(--ff-serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--champagne-bright);
}

.shop-item-top span {
  font-family: var(--ff-roman) !important;
  letter-spacing: 0.06em;
}

.shop-item p {
  font-size: 11.5px;
  color: var(--silver-ink);
  line-height: 1.5;
}

.shop-act {
  align-self: flex-end;
  font-family: var(--ff-serif);
  background: linear-gradient(90deg, rgba(14, 28, 58, 0.86) 0%, rgba(8, 16, 36, 0.94) 100%);
  color: var(--champagne-bright);
  border: 0.8px solid rgba(229, 213, 181, 0.56);
  padding: 4px 13px;
  font-size: 11.2px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shop-act:hover:not(:disabled) {
  background: linear-gradient(90deg, rgba(125, 211, 252, 0.24) 0%, rgba(16, 34, 68, 0.95) 100%);
  border-color: var(--astral-cyan);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.28);
}

.shop-act:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: rgba(8, 12, 22, 0.6);
  border-color: rgba(142, 156, 178, 0.28);
  color: var(--muted-ink);
}

.shop-act.active-pill {
  background: linear-gradient(90deg, rgba(6, 78, 59, 0.55) 0%, rgba(8, 36, 42, 0.82) 100%);
  border-color: var(--celadon-ok);
  color: #d1fae5;
}

/* ==========================================================================
 * 8. 波次突破魔導調律強化卡視窗 (#perkModal — PIXEL-400 HD-2D Steampunk Upgrade)
 * ========================================================================== */
.perk-modal {
  position: absolute;
  inset: 0;
  z-index: 32;
  background: radial-gradient(circle at 50% 48%, rgba(5, 9, 19, 0.72) 0%, rgba(4, 7, 15, 0.88) 100%);
  backdrop-filter: blur(2px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 24px;
}

.perk-modal.show {
  display: flex;
  animation: stageFadeIn 0.22s ease-out;
}

.perk-header-ornament {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: min(760px, 92%);
  padding: 8px 24px 10px;
  background: linear-gradient(90deg, transparent 0%, rgba(8, 14, 29, 0.88) 16%, rgba(8, 14, 29, 0.88) 84%, transparent 100%);
  border-top: 1px solid rgba(189, 130, 40, 0.75);
  border-bottom: 1px solid rgba(254, 240, 138, 0.55);
}

.perk-kicker {
  font-family: var(--ff-roman);
  font-size: 10.5px;
  letter-spacing: 0.30em;
  color: var(--astral-cyan);
  text-transform: uppercase;
}

.perk-title {
  font-family: var(--ff-serif);
  color: #fff8e7;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.96);
  text-align: center;
}

.perk-cards {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  gap: 24px;
  max-width: 1220px;
  padding-top: 18px;
}

.perk-card {
  position: relative;
  width: 244px;
  min-height: 252px;
  padding: 38px 18px 36px;
  background: linear-gradient(180deg, rgba(10, 18, 38, 0.94) 0%, rgba(4, 8, 18, 0.98) 100%);
  border: 1px solid rgba(229, 213, 181, 0.52);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.9), inset 0 0 0 3px rgba(4, 8, 18, 0.92), inset 0 0 0 3.8px rgba(229, 213, 181, 0.22);
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s ease, border-color 0.16s ease;
}

.perk-card::before {
  content: attr(data-tarot-num);
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 10px;
  border-bottom: 0.8px solid rgba(229, 213, 181, 0.45);
  color: var(--champagne);
  font-family: var(--ff-roman);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  white-space: nowrap;
}

.perk-card::after {
  content: "◆ RESONANCE IMPRINT ◆";
  position: absolute;
  bottom: 11px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--ff-roman);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--champagne-soft);
  white-space: nowrap;
}

/* PIXEL-400 + PIXEL-504 Upgraded HD-2D Steampunk Boon Card (296x420 thin frame, 90.90% inner window) */
.perk-card.boon-card-v2 {
  width: clamp(312px, 24.5vw, 344px);
  height: clamp(424px, 59vh, 468px);
  min-height: 0;
  padding: clamp(14px, 1.15vw, 16px) clamp(15px, 1.25vw, 16px) 14px;
  border: none;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.86));
  justify-content: flex-start;
  align-items: stretch;
  gap: 8px;
  overflow: visible;
  isolation: isolate;
}

.perk-card.boon-card-v2::before,
.perk-card.boon-card-v2::after {
  display: none;
  content: none;
}

/* Inset card interior backdrop (8px inset fits cleanly behind 10px thin metallic frame) */
.boon-card-backdrop {
  position: absolute;
  inset: 8px;
  z-index: 1;
  pointer-events: none;
  background-color: rgba(11, 17, 28, 0.96);
}

.perk-card.boon-card-v2[data-boon-rarity="duo"] .boon-card-backdrop {
  inset: 8px;
}

/* Element-tinted dark backdrop + subtle geometric motif watermark (alpha ~10%) */
.perk-card.boon-card-v2[data-boon-element="fire"] {
  --boon-elem-primary: #f97316;
  --boon-elem-mid: #ea580c;
  --boon-elem-accent: #fdba74;
}
.perk-card.boon-card-v2[data-boon-element="fire"] .boon-card-backdrop {
  background-color: #1d100b;
  background-image:
    repeating-linear-gradient(
      -45deg,
      rgba(249, 115, 22, 0.11) 0px,
      rgba(249, 115, 22, 0.11) 2px,
      transparent 2px,
      transparent 12px
    ),
    radial-gradient(ellipse at 50% 24%, rgba(234, 88, 12, 0.28) 0%, rgba(29, 16, 11, 0.96) 72%);
}

.perk-card.boon-card-v2[data-boon-element="frost"] {
  --boon-elem-primary: #7dd3fc;
  --boon-elem-mid: #0284c7;
  --boon-elem-accent: #bae6fd;
}
.perk-card.boon-card-v2[data-boon-element="frost"] .boon-card-backdrop {
  background-color: #0b1622;
  background-image:
    repeating-linear-gradient(
      60deg,
      rgba(125, 211, 252, 0.10) 0px,
      rgba(125, 211, 252, 0.10) 1px,
      transparent 1px,
      transparent 14px
    ),
    repeating-linear-gradient(
      -60deg,
      rgba(125, 211, 252, 0.10) 0px,
      rgba(125, 211, 252, 0.10) 1px,
      transparent 1px,
      transparent 14px
    ),
    radial-gradient(ellipse at 50% 24%, rgba(2, 132, 199, 0.28) 0%, rgba(11, 22, 34, 0.96) 72%);
}

.perk-card.boon-card-v2[data-boon-element="arc"] {
  --boon-elem-primary: #fde047;
  --boon-elem-mid: #ca8a04;
  --boon-elem-accent: #fef08a;
}
.perk-card.boon-card-v2[data-boon-element="arc"] .boon-card-backdrop {
  background-color: #1b1809;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(253, 224, 71, 0.09) 0px,
      rgba(253, 224, 71, 0.09) 1px,
      transparent 1px,
      transparent 11px
    ),
    radial-gradient(ellipse at 50% 24%, rgba(202, 138, 4, 0.28) 0%, rgba(27, 24, 9, 0.96) 72%);
}

.perk-card.boon-card-v2[data-boon-element="corrosive"] {
  --boon-elem-primary: #84cc16;
  --boon-elem-mid: #4d7c0f;
  --boon-elem-accent: #bef264;
}
.perk-card.boon-card-v2[data-boon-element="corrosive"] .boon-card-backdrop {
  background-color: #111b0b;
  background-image:
    radial-gradient(rgba(132, 204, 22, 0.15) 1.5px, transparent 1.5px),
    radial-gradient(ellipse at 50% 24%, rgba(77, 124, 15, 0.28) 0%, rgba(17, 27, 11, 0.96) 72%);
  background-size: 16px 16px, 100% 100%;
}

/* Rarity Tier Themes (Brass / Mithril / Starlight / Duo — unified 14–16px thin-frame padding) */
.perk-card.boon-card-v2[data-boon-rarity="brass"] {
  --boon-rarity-accent: #d99b38;
  --boon-ribbon-bg: #2a1d0b;
  --boon-ribbon-ink: #fde68a;
}

.perk-card.boon-card-v2[data-boon-rarity="mithril"] {
  --boon-rarity-accent: #7dd3fc;
  --boon-ribbon-bg: #102136;
  --boon-ribbon-ink: #e0f2fe;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.88)) drop-shadow(0 0 10px rgba(125, 211, 252, 0.18));
}

.perk-card.boon-card-v2[data-boon-rarity="starlight"] {
  --boon-rarity-accent: #ffd75e;
  --boon-ribbon-bg: #321e06;
  --boon-ribbon-ink: #fef08a;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.90)) drop-shadow(0 0 14px rgba(255, 215, 94, 0.24));
}

.perk-card.boon-card-v2[data-boon-rarity="starlight"] .boon-card-backdrop {
  inset: 8px;
}

.perk-card.boon-card-v2[data-boon-rarity="duo"] {
  --boon-rarity-accent: #fef08a;
  --boon-ribbon-bg: linear-gradient(90deg, rgba(234, 88, 12, 0.84) 0%, rgba(20, 26, 44, 0.94) 50%, rgba(2, 132, 199, 0.84) 100%);
  --boon-ribbon-ink: #fffbeb;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.92)) drop-shadow(0 0 16px rgba(254, 240, 138, 0.26));
}

.perk-card.boon-card-v2[data-boon-rarity="duo"] .boon-card-backdrop {
  background-color: #131828;
  background-image:
    linear-gradient(90deg, rgba(249, 115, 22, 0.20) 0%, rgba(19, 24, 40, 0.92) 49%, rgba(217, 155, 56, 0.48) 50%, rgba(19, 24, 40, 0.92) 51%, rgba(125, 211, 252, 0.20) 100%);
}

/* AI-generated ornate frame PNG overlay (covers 100% of card cleanly with transparent window) */
.boon-frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 6;
}

/* AI-generated Duo Meshed Gears Crown perched across top center */
.boon-duo-crown {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 124px;
  height: 62px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 8;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.85));
}

/* Emblem Socket (Single Octagonal or Duo Interlocking Twin Ring) */
.boon-emblem-stage {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  min-height: 44px;
}

.boon-emblem-stage.is-duo {
  gap: 0;
}

.boon-emblem-socket {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, rgba(20, 32, 56, 0.96) 0%, #0a0c12 100%);
  border: 2px solid var(--boon-elem-primary, #e5d5b5);
  box-shadow: 0 0 0 2px #0a0c12, inset 0 0 8px rgba(0, 0, 0, 0.85);
  clip-path: polygon(28% 0%, 72% 0%, 100% 28%, 100% 72%, 72% 100%, 28% 100%, 0% 72%, 0% 28%);
}

.boon-emblem-stage.is-duo .boon-emblem-socket {
  width: 42px;
  height: 42px;
}

.boon-emblem-socket.elem-fire { border-color: #f97316; }
.boon-emblem-socket.elem-frost { border-color: #7dd3fc; }
.boon-emblem-socket.elem-arc { border-color: #fde047; }
.boon-emblem-socket.elem-corrosive { border-color: #84cc16; }

.boon-duo-clasp {
  position: relative;
  z-index: 4;
  width: 12px;
  height: 12px;
  margin: 0 -5px;
  transform: rotate(45deg);
  background: #fef08a;
  border: 2px solid #0a0c12;
  box-shadow: 0 0 6px rgba(254, 240, 138, 0.7);
}

.boon-emblem-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  display: block;
}

/* Colorblind-safe Rarity + Element Ribbon */
.boon-rarity-ribbon {
  position: relative;
  z-index: 3;
  padding: 2px 6px;
  background: var(--boon-ribbon-bg, #1e293b);
  border: 1px solid var(--boon-rarity-accent, #d99b38);
  color: var(--boon-ribbon-ink, #fef08a);
  font-family: var(--ff-serif);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  text-shadow: 0 1px 2px #000000;
  white-space: nowrap;
}

.perk-card:hover,
.perk-card.ai-pick {
  border-color: var(--astral-cyan);
  transform: translateY(-10px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.95), 0 0 22px rgba(254, 240, 138, 0.28);
}

.perk-card.boon-card-v2:hover,
.perk-card.boon-card-v2.ai-pick {
  box-shadow: none;
  filter: drop-shadow(0 22px 32px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 18px rgba(254, 240, 138, 0.28));
}

.perk-card:hover::after,
.perk-card.ai-pick::after {
  color: var(--astral-cyan);
}

.perk-card h4 {
  position: relative;
  z-index: 3;
  font-family: var(--ff-serif);
  color: #fff8e7;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(229, 213, 181, 0.30);
  text-shadow: 0 1px 3px #000000;
}

.boon-card-sub {
  position: relative;
  z-index: 3;
  font-family: var(--ff-serif);
  font-size: 10px;
  font-weight: 600;
  color: var(--boon-elem-accent, #fdba74);
  text-align: center;
  letter-spacing: 0.03em;
  margin-top: -2px;
}

.perk-card p {
  position: relative;
  z-index: 3;
  color: #f1f5f9;
  font-size: 11.5px;
  line-height: 1.48;
  text-align: left;
  flex: 1;
}

.perk-card.boon-card-v2 p {
  background: rgba(11, 17, 30, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.26);
  padding: 6px 8px;
  flex: 1 1 auto;
  min-height: 0;
  font-size: 11px;
  line-height: 1.42;
  overflow: hidden;
}

.boon-heat-pill {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid var(--boon-elem-primary, #d99b38);
  color: var(--boon-elem-accent, #fef08a);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boon-heat-icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.boon-select-footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 6px;
  background: rgba(10, 14, 26, 0.92);
  border: 1px solid rgba(229, 213, 181, 0.34);
  font-size: 10.5px;
  color: var(--champagne-bright);
  margin-top: auto;
}

.perk-card.boon-card-v2:hover .boon-select-footer,
.perk-card.boon-card-v2.ai-pick .boon-select-footer {
  background: rgba(66, 42, 10, 0.92);
  border-color: #fef08a;
  color: #fef08a;
}

.boon-keycap {
  font-family: var(--ff-num);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  background: #0a0c12;
  border: 1px solid #d99b38;
  color: #fef08a;
}

/* Bottom Action Bar (Reroll / Skip reserved styles for PIXEL-392 integration) */
.perk-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 2px;
  z-index: 4;
}

.perk-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 224px;
  height: 38px;
  padding: 0 16px;
  font-family: var(--ff-serif);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.perk-reroll-btn {
  background: linear-gradient(180deg, #16243d 0%, #0d1628 100%);
  border: 1.5px solid #7dd3fc;
  color: #e0f2fe;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.72);
}

.perk-reroll-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: #fef08a;
  color: #fef08a;
}

.perk-reroll-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.perk-skip-btn {
  background: linear-gradient(180deg, #1f2430 0%, #141720 100%);
  border: 1.5px solid #94a3b8;
  color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.72);
}

.perk-skip-btn:hover {
  transform: translateY(-2px);
  border-color: #e2e8f0;
  color: #f8fafc;
}

.perk-reroll-die-img {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  display: block;
}

/* ==========================================================================
 * 9. 極簡低干擾觸控方向盤 & 窄視窗適配
 * ========================================================================== */
.touch-dpad {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: grid;
  grid-template-columns: repeat(3, 22px);
  grid-template-rows: repeat(3, 22px);
  gap: 2px;
  opacity: 0.16;
  z-index: 16;
  transition: opacity 0.18s ease;
}
.touch-dpad:hover { opacity: 0.82; }

.canvas-box:has(#venueDrawer.show) .touch-dpad {
  opacity: 0;
  pointer-events: none;
}

.t-btn {
  background: rgba(6, 11, 24, 0.85);
  border: 0.8px solid rgba(229, 213, 181, 0.42);
  color: var(--champagne);
  font-size: 8.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1020px) {
  .vd-bust-stage {
    width: 260px;
    height: 330px;
    left: 12px;
  }
  .vd-bust-img {
    max-width: 254px;
    max-height: 326px;
  }
  .vd-dialogue-box {
    left: 18px;
    right: 18px;
    padding-left: 258px;
  }
  .vd-speaker-plaque {
    left: 258px;
  }
  .vd-choice-menu,
  .vd-service-modal {
    right: 18px;
    width: calc(100% - 290px);
  }
}

@media (max-width: 720px) {
  .vd-bust-stage {
    width: 150px;
    height: 200px;
    left: 8px;
    bottom: 132px;
  }
  .vd-dialogue-box {
    padding: 24px 16px 16px 18px;
    min-height: 118px;
  }
  .vd-speaker-plaque {
    left: 16px;
  }
  .vd-choice-menu,
  .vd-service-modal {
    left: 16px;
    right: 16px;
    width: auto;
    bottom: 148px;
  }
}

/* ==========================================================================
 * 10. 手機版適配 (PIXEL-336): 直向提示、開發面板開關、寬螢幕填滿與響應式 HUD
 *     所有樣式嚴格限定在 body.mobile-touch / body.mobile-landscape / body.mobile-portrait
 *     確保桌機（非觸控）零回歸
 * ========================================================================== */

/* 直向提示遮罩：預設與桌機／橫向完全隱藏 */
.mobile-portrait-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 42%, #0e1c3a 0%, #060c1d 54%, #02040a 100%);
  color: var(--ivory-ink);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

body.mobile-portrait .mobile-portrait-overlay {
  display: flex;
}

.mobile-portrait-card {
  position: relative;
  width: min(88vw, 340px);
  padding: 30px 26px 26px;
  text-align: center;
  background: linear-gradient(180deg, rgba(10, 18, 38, 0.94) 0%, rgba(4, 8, 20, 0.98) 100%);
  border: 1px solid rgba(229, 213, 181, 0.48);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.9),
    inset 0 0 32px rgba(125, 211, 252, 0.1);
}

.mobile-portrait-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  pointer-events: none;
}

.mobile-portrait-icon {
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: portraitRotateHint 2.6s ease-in-out infinite;
}

@keyframes portraitRotateHint {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(8deg); }
}

.mobile-portrait-kicker {
  font-family: var(--ff-roman);
  font-size: 9.5px;
  letter-spacing: 0.24em;
  color: var(--astral-cyan);
  margin-bottom: 6px;
}

.mobile-portrait-title {
  font-family: var(--ff-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--champagne-bright);
  text-shadow: 0 2px 12px rgba(125, 211, 252, 0.25);
  margin: 0 0 10px;
}

.mobile-portrait-desc {
  font-family: var(--ff-serif);
  font-size: 13px;
  line-height: 1.65;
  color: var(--silver-ink);
  margin: 0;
}

/* SYSTEM 選單的「開發用測試面板」開關：桌機不顯示（桌機原狀保留），手機觸控才顯示 */
body:not(.mobile-touch) .sd-dev-panels-row {
  display: none;
}

/* 手機觸控下預設隱藏開發用測試面板，直到 body.show-dev-panels 打開 */
body.mobile-touch:not(.show-dev-panels) #townTestSwitcher,
body.mobile-touch:not(.show-dev-panels) #btnCombatFeelPanelToggle,
body.mobile-touch:not(.show-dev-panels) #combatFeelPanel,
body.mobile-touch:not(.show-dev-panels) .map-panel {
  display: none !important;
}

/* 直向提示顯示時也隱藏固定浮動的打擊感按鈕與面板，避免蓋過遮罩 */
body.mobile-portrait #btnCombatFeelPanelToggle,
body.mobile-portrait #combatFeelPanel,
body.mobile-portrait .map-panel {
  display: none !important;
}

/* --------------------------------------------------------------------------
 * 手機橫向：寬螢幕填滿（消除左右黑邊）＋ 精簡貼邊 HUD
 * -------------------------------------------------------------------------- */
body.mobile-landscape {
  touch-action: manipulation;
  overscroll-behavior: none;
}

body.mobile-landscape .arena-outer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  background: #020408;
}

body.mobile-landscape .canvas-box {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  aspect-ratio: auto;
  border: none;
  box-shadow: none;
}

body.mobile-landscape .viewport-corner {
  width: 16px;
  height: 16px;
  opacity: 0.42;
}
body.mobile-landscape .viewport-corner.nw { top: 3px; left: 3px; }
body.mobile-landscape .viewport-corner.ne { top: 3px; right: 3px; }
body.mobile-landscape .viewport-corner.sw { bottom: 3px; left: 3px; }
body.mobile-landscape .viewport-corner.se { bottom: 3px; right: 3px; }

/* 1. 左上角色區：縮小肖像與晶條、隱藏職業熱鍵字樣、貼邊不擋中央角色與左下搖桿 */
body.mobile-landscape .hud-hero-plaque {
  top: 4px;
  left: max(8px, env(safe-area-inset-left));
  width: clamp(176px, 23vw, 224px);
  gap: 2px;
}

body.mobile-landscape .hero-plaque-main {
  gap: 6px;
  padding: 2px 8px 2px 4px;
}

body.mobile-landscape .hero-crest-wrap {
  width: 32px;
  height: 32px;
}

body.mobile-landscape canvas#heroPortraitHud {
  width: 24px;
  height: 24px;
}

body.mobile-landscape .lv-wax-seal {
  right: -3px;
  bottom: -3px;
  padding: 0 4px;
  font-size: 7.5px;
}

body.mobile-landscape .lv-wax-seal b {
  font-size: 8.5px;
}

body.mobile-landscape .hero-vitals-col {
  min-width: 0;
  gap: 1.5px;
}

body.mobile-landscape .ff-gauge-group {
  gap: 1px;
}

body.mobile-landscape .ff-gauge-key {
  font-size: 7px;
  letter-spacing: 0.1em;
}

body.mobile-landscape .ff-gauge-key.astral {
  font-size: 6.5px;
  letter-spacing: 0.12em;
}

body.mobile-landscape .vial-hp-text,
body.mobile-landscape .vial-mp-text {
  font-size: 8px;
}

body.mobile-landscape .alch-vial,
body.mobile-landscape .alch-vial.mp-tube,
body.mobile-landscape .alch-vial.xp-tube {
  height: 3.5px;
}

body.mobile-landscape .wallet-obsidian-strip {
  gap: 6px;
  margin-top: 0;
  font-size: 8px;
}

body.mobile-landscape .wallet-micro-svg {
  width: 8px;
  height: 8px;
}

body.mobile-landscape .wallet-unit-tag {
  font-size: 7px;
  letter-spacing: 0.08em;
}

body.mobile-landscape .wallet-coin-val,
body.mobile-landscape .wallet-core-val {
  font-size: 8.5px;
}

body.mobile-landscape .hero-switch-bar {
  gap: 2px;
  padding: 1px 2px;
}

body.mobile-landscape .hero-pill-btn {
  padding: 1px 2px;
  font-size: 8.5px;
  line-height: 1.25;
  min-height: 20px;
}

body.mobile-landscape .hero-pill-btn .hero-pill-key {
  display: none;
}

body.mobile-landscape .buff-parchment-ribbon {
  max-width: 100%;
  padding: 1px 6px 1px 5px;
  font-size: 8px;
  line-height: 1.3;
}

body.mobile-landscape .foundry-run-status-pill {
  max-width: 100%;
  margin-top: 1px;
  padding: 2px 6px 2px 5px;
  gap: 3px;
  font-size: 8.5px;
  line-height: 1.2;
}

/* 當從 SYSTEM 選單開啟開發用測試面板時，採用緊湊尺寸避免遮住中央角色 */
body.mobile-landscape.show-dev-panels .town-test-switcher {
  padding: 3px 5px;
  gap: 2px;
}

body.mobile-landscape.show-dev-panels .test-row-tag {
  font-size: 8px;
}

body.mobile-landscape.show-dev-panels .test-branch-pill,
body.mobile-landscape.show-dev-panels .test-lv-btn {
  font-size: 8px;
  padding: 1px 2px;
  line-height: 1.3;
  letter-spacing: 0;
}

body.mobile-landscape.show-dev-panels .test-level-bar {
  gap: 2px;
}

body.mobile-landscape.show-dev-panels .test-lv-btn.is-max-btn {
  flex: 1.25 1 0;
}

body.mobile-landscape.show-dev-panels .test-speed-slider {
  min-width: 54px;
}

body.mobile-landscape.show-dev-panels .test-speed-val {
  font-size: 8.5px;
  min-width: 28px;
}

body.mobile-landscape.show-dev-panels #btnCombatFeelPanelToggle {
  left: max(8px, env(safe-area-inset-left));
  bottom: calc(148px + env(safe-area-inset-bottom, 0px));
  padding: 4px 8px;
  font-size: 11px;
  z-index: 60;
}

/* 2. 頂部中央地名銘牌：單行精簡膠囊，不與左右 HUD 重疊 */
body.mobile-landscape .hud-region-banner {
  top: 4px;
  gap: 1px;
  max-width: 34vw;
  overflow: hidden;
}

body.mobile-landscape .canvas-box[data-boss-active="true"] .hud-region-banner {
  transform: translate(-50%, 34px);
}

body.mobile-landscape .region-plaque-frame {
  max-width: 100%;
  padding: 1px 10px 2px;
  gap: 1px;
  overflow: hidden;
}

body.mobile-landscape .region-kicker-en {
  display: none;
}

body.mobile-landscape .region-astral-axis {
  width: min(140px, 28vw);
  height: 4px;
}

body.mobile-landscape .region-axis-core {
  width: 4px;
  height: 4px;
}

body.mobile-landscape .wave-badge-text {
  max-width: 100%;
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile-landscape .train-ticker-pill {
  padding: 1px 8px;
  font-size: 8px;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 3. 右上小地圖外框與可換行緊湊按鈕列：保有 >=30px 觸控高度且絕不重疊中央銘牌 */
body.mobile-landscape .astrolabe-ring-svg {
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
}

body.mobile-landscape .astro-cardinal {
  font-size: 7px;
  padding: 0 2px;
}
body.mobile-landscape .astro-cardinal.n { top: -5px; }
body.mobile-landscape .astro-cardinal.s { bottom: -5px; }
body.mobile-landscape .astro-cardinal.w { left: -5px; }
body.mobile-landscape .astro-cardinal.e { right: -5px; }

body.mobile-landscape .quick-brass-controls,
body.mobile-landscape .canvas-box[data-scene="COMBAT"][data-foundry="true"] .quick-brass-controls {
  top: calc(var(--mobile-minimap-bottom-pct, 15.2%) + 4px);
  right: max(8px, env(safe-area-inset-right));
  max-width: min(46vw, 320px);
  flex-wrap: wrap;
  justify-content: flex-end;
  z-index: 28;
  gap: 3px;
  padding: 3px 5px;
}

body.mobile-landscape .canvas-box[data-scene="COMBAT"]:not([data-foundry="true"]) .quick-brass-controls {
  top: 6px;
}

body.mobile-landscape .quick-brass-controls button.btn {
  padding: 3px 6px;
  font-size: 9.5px;
  min-height: 28px;
  gap: 3px;
  pointer-events: auto;
}

body.mobile-landscape #btnChronicle,
body.mobile-landscape #btnRelicMetaAltar {
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 6px;
}

body.mobile-landscape #lblChronicleCount,
body.mobile-landscape #lblRelicAltarPoints {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-landscape #btnGameSettings,
body.mobile-landscape #btnSettingsDrawer {
  min-height: 30px;
  min-width: 30px;
  padding: 3px 7px;
  z-index: 29;
  pointer-events: auto;
}

body.mobile-landscape .quick-brass-controls button.btn.portal-cta {
  padding-left: 16px;
  padding-right: 7px;
}

body.mobile-landscape .quick-brass-controls button.btn.icon-pill {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
}

body.mobile-landscape .cam-zoom-compact {
  font-size: 9.5px;
  max-width: 34px;
}

/* 4. 底部 NPC 快捷列：避開左下搖桿與右下互動鍵，可流暢橫向滑動 */
body.mobile-landscape .town-dock-shell {
  bottom: 6px;
  max-width: calc(100% - 240px);
  gap: 4px;
  opacity: 0.88;
}

body.mobile-landscape .dock-toggle-btn {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

body.mobile-landscape .town-dock {
  padding: 2px 8px;
  gap: 2px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  touch-action: pan-x;
}

body.mobile-landscape .dock-btn {
  padding: 4px 7px 4px 13px;
  font-size: 9.5px;
  flex-shrink: 0;
}

body.mobile-landscape .combat-skill-bar {
  --slot-size: 40px;
  --ult-size: 44px;
  --icon-size: 34px;
  --ult-icon-size: 38px;
  --dock-gap: 5px;
  --label-size: 9px;
  bottom: 6px;
  padding: 4px 8px 3px;
  max-width: calc(100% - 200px);
}

body.mobile-landscape .skill-slot {
  padding: 0;
  gap: 1px;
}

body.mobile-landscape .skill-keycap {
  display: none;
}

body.mobile-landscape .skill-name {
  font-size: 9px;
}

body.mobile-landscape .skill-sub {
  font-size: 8.5px;
}

body.mobile-landscape .relic-socket-strip {
  display: none;
}

/* 5. 抽屜與對話框在較矮橫向螢幕（375-430px 高）不截斷、可捲動且所有按鈕好點 */
body.mobile-landscape .settings-drawer,
body.mobile-landscape .canvas-box[data-scene="COMBAT"] .settings-drawer {
  top: 6px;
  bottom: 6px;
  right: max(8px, env(safe-area-inset-right));
  width: min(320px, calc(100% - 16px));
  max-height: calc(100% - 12px);
  z-index: 40;
}

body.mobile-landscape .sd-head {
  padding: 6px 10px;
  flex-shrink: 0;
}

body.mobile-landscape .sd-title {
  font-size: 11px;
}

body.mobile-landscape .sd-key-hint {
  display: none;
}

body.mobile-landscape .sd-body {
  padding: 7px 10px;
  gap: 6px;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile-landscape .sd-row,
body.mobile-landscape .sd-row-col {
  padding: 4px 7px;
}

body.mobile-landscape .sd-row button.btn,
body.mobile-landscape .sd-audio-head button.btn {
  min-height: 28px;
  padding: 3px 9px;
}

body.mobile-landscape .vd-bust-stage {
  width: 136px;
  height: 196px;
  left: 8px;
}

body.mobile-landscape .vd-bust-img {
  max-width: 130px;
  max-height: 190px;
}

body.mobile-landscape .vd-portrait-fallback {
  width: 92px;
  height: 92px;
  bottom: 92px;
}

body.mobile-landscape .vd-portrait {
  width: 72px;
  height: 72px;
}

body.mobile-landscape .vd-dialogue-box {
  left: 10px;
  right: 10px;
  bottom: 6px;
  min-height: 78px;
  max-height: 114px;
  padding: 18px 14px 10px 142px;
}

body.mobile-landscape .vd-speaker-plaque {
  left: 142px;
  top: -12px;
  padding: 2px 10px;
  max-width: calc(100% - 250px);
}

body.mobile-landscape .vd-title {
  font-size: 13px;
}

body.mobile-landscape .vd-sub {
  font-size: 8.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile-landscape .vd-close {
  top: 5px;
  right: 8px;
  min-height: 28px;
  padding: 4px 10px;
  font-size: 10px;
  z-index: 6;
}

body.mobile-landscape .vd-speech {
  font-size: 12px;
  line-height: 1.42;
  min-height: 30px;
  max-height: 68px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 12px;
}

body.mobile-landscape .vd-choice-menu {
  right: 10px;
  bottom: 120px;
  width: min(340px, calc(100% - 156px));
  max-height: calc(100% - 128px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 4px;
}

body.mobile-landscape .vd-choice-btn {
  padding: 6px 10px 6px 26px;
  font-size: 11.5px;
  min-height: 32px;
}

body.mobile-landscape .vd-service-modal {
  right: 10px;
  top: 6px;
  bottom: 120px;
  max-height: none;
  width: min(540px, calc(100% - 156px));
}

body.mobile-landscape .vd-service-head {
  padding: 6px 10px;
  flex-shrink: 0;
}

body.mobile-landscape .vd-back-btn,
body.mobile-landscape .shop-act {
  min-height: 30px;
  padding: 4px 10px;
}

body.mobile-landscape .vd-body {
  padding: 7px 10px;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}

body.mobile-landscape .perk-modal {
  padding: 8px 12px;
  gap: 6px;
  overflow-y: auto;
  justify-content: safe center;
}

body.mobile-landscape .perk-title {
  font-size: 13.5px;
}

body.mobile-landscape .perk-cards {
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
}

body.mobile-landscape .perk-card {
  width: 210px;
  min-width: 184px;
  min-height: 176px;
  padding: 26px 12px 22px;
}

body.mobile-landscape .perk-card.boon-card-v2 {
  width: 220px;
  min-width: 196px;
  height: 248px;
  padding: 10px 11px 9px;
  gap: 4px;
}

body.mobile-landscape .perk-card.boon-card-v2[data-boon-rarity="duo"] {
  padding: 10px 11px 9px;
}

body.mobile-landscape .boon-duo-crown {
  width: 46px;
  height: 22px;
  top: -13px;
}

body.mobile-landscape .boon-emblem-stage {
  min-height: 26px;
}

body.mobile-landscape .boon-emblem-socket {
  width: 26px;
  height: 26px;
}

body.mobile-landscape .boon-emblem-icon {
  width: 18px;
  height: 18px;
}

body.mobile-landscape .perk-card.boon-card-v2 h4 {
  font-size: 12.5px;
  padding-bottom: 3px;
}

body.mobile-landscape .perk-card.boon-card-v2 p {
  font-size: 10.5px;
  line-height: 1.35;
  padding: 5px 7px;
}

body.mobile-landscape .perk-action-btn {
  height: 28px;
  min-width: 156px;
  font-size: 11px;
}

/* 較矮手機橫向（如 844×390 / 667×375）再微調尺寸，保留寬敞中央視野 */
@media (max-height: 520px) {
  body.mobile-landscape .hud-hero-plaque {
    top: 3px;
    width: clamp(176px, 23vw, 212px);
  }
  body.mobile-landscape .hero-plaque-main {
    gap: 5px;
    padding: 2px 7px 2px 3px;
  }
  body.mobile-landscape .hero-crest-wrap {
    width: 29px;
    height: 29px;
  }
  body.mobile-landscape canvas#heroPortraitHud {
    width: 22px;
    height: 22px;
  }
  body.mobile-landscape .hero-pill-btn {
    font-size: 8px;
    min-height: 18px;
    padding: 1px 2px;
  }
  body.mobile-landscape .buff-parchment-ribbon {
    font-size: 7.5px;
  }
  body.mobile-landscape .hud-region-banner {
    top: 2px;
    max-width: 34vw;
  }
  body.mobile-landscape .wave-badge-text {
    font-size: 10.5px;
  }
  body.mobile-landscape .train-ticker-pill {
    font-size: 7.5px;
    padding: 0 7px;
  }
  body.mobile-landscape .quick-brass-controls button.btn {
    min-height: 26px;
    padding: 2px 5px;
    font-size: 8.5px;
  }
  body.mobile-landscape #btnGameSettings,
  body.mobile-landscape #btnSettingsDrawer {
    min-height: 30px;
    min-width: 30px;
  }
  body.mobile-landscape .quick-brass-controls button.btn.portal-cta {
    padding-left: 14px;
  }
  body.mobile-landscape .quick-brass-controls button.btn.icon-pill {
    width: 26px;
    height: 26px;
    min-height: 26px;
  }
  body.mobile-landscape .town-dock-shell {
    bottom: 4px;
    max-width: calc(100% - 240px);
  }
  body.mobile-landscape .dock-toggle-btn {
    width: 24px;
    height: 24px;
  }
  body.mobile-landscape .dock-btn {
    padding: 3px 6px 3px 12px;
    font-size: 8.5px;
  }
  body.mobile-landscape.show-dev-panels #btnCombatFeelPanelToggle {
    bottom: calc(130px + env(safe-area-inset-bottom, 0px));
  }
}

/* ==========================================================================
   STAGE 2: SHARED MOBILE TOUCH CONTROLS (PIXEL-337)
   單一共用觸控模組 (#mobileTouchControls)：主城 / 戰鬥 / 靶場共用同一實例
   僅在 body.mobile-landscape 顯示，桌機非觸控、直向與手把模式完全隱藏
   ========================================================================== */
.mobile-touch-controls {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 26;
  opacity: var(--mtc-opacity, 0.92);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

body.mobile-landscape .mobile-touch-controls.is-visible {
  display: block;
}

/* 手機橫向排版取代舊 .touch-dpad 與桌機底部中央 #combatSkillBar */
body.mobile-landscape .touch-dpad,
body.mobile-landscape .combat-skill-bar,
body.mobile-landscape .canvas-box[data-scene="COMBAT"] .combat-skill-bar,
body.mobile-landscape .canvas-box[data-range-combat="true"] .combat-skill-bar,
body.mobile-landscape .canvas-box[data-scene="TOWN"][data-range-combat="true"] .combat-skill-bar {
  display: none !important;
}

/* 進入靶場戰鬥時隱藏底部城區快捷列，避免與右下技能群重疊 */
body.mobile-landscape .canvas-box[data-range-combat="true"] .town-dock-shell {
  display: none !important;
}

/* 開啟任意彈窗、對話、抽屜或手把模式時自動避讓隱藏 */
body.mobile-landscape .canvas-box:has(#venueDrawer.show) .mobile-touch-controls,
body.mobile-landscape .canvas-box:has(#perkModal.show) .mobile-touch-controls,
body.mobile-landscape .canvas-box:has(#settingsDrawer.show) .mobile-touch-controls,
body.mobile-landscape .canvas-box:has(#gameSettingsModal.show) .mobile-touch-controls,
body.mobile-landscape .canvas-box:has(#chronicleModal:not([hidden])) .mobile-touch-controls,
body.mobile-landscape .canvas-box:has(#inspectSpotCard:not([hidden])) .mobile-touch-controls,
body.mobile-landscape:has(#arcanaRelicMetaOverlay.is-open) .mobile-touch-controls,
body[data-input-mode="gamepad"] .mobile-touch-controls,
body.mobile-landscape .mobile-touch-controls.is-yielded {
  display: none !important;
  pointer-events: none !important;
}

/* 1. 左下角 360° 類比虛擬搖桿（支援固定與浮動模式 + 縮放） */
.mtc-joystick-zone {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: left bottom;
  transform: scale(calc(var(--mtc-scale, 1) * var(--ui-scale, 1)));
  pointer-events: auto;
  touch-action: none;
}

.mtc-joystick-zone.is-floating,
.mobile-touch-controls.is-floating .mtc-joystick-zone {
  width: 176px;
  height: 156px;
}

.mtc-joystick-base {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(12, 26, 54, 0.56) 0%, rgba(5, 11, 24, 0.72) 72%, rgba(4, 9, 20, 0.84) 100%);
  border: 1.5px solid rgba(229, 213, 181, 0.48);
  box-shadow:
    inset 0 0 18px rgba(56, 189, 248, 0.16),
    0 4px 16px rgba(2, 6, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mtc-joystick-zone.is-active .mtc-joystick-base {
  border-color: rgba(125, 211, 252, 0.88);
  box-shadow:
    inset 0 0 22px rgba(56, 189, 248, 0.34),
    0 0 16px rgba(56, 189, 248, 0.3);
}

.mtc-joystick-dir-glow {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from -32deg, rgba(125, 211, 252, 0.58) 0deg, rgba(229, 213, 181, 0.42) 32deg, transparent 74deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  opacity: 0;
  pointer-events: none;
}

.mtc-joystick-ticks {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1px dashed rgba(229, 213, 181, 0.28);
  pointer-events: none;
}

.mtc-joystick-deadzone {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.3);
  background: rgba(125, 211, 252, 0.06);
  pointer-events: none;
}

.mtc-joystick-knob {
  position: relative;
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, rgba(224, 242, 254, 0.92) 0%, rgba(56, 189, 248, 0.72) 36%, rgba(12, 34, 68, 0.92) 100%);
  border: 2px solid rgba(229, 213, 181, 0.9);
  box-shadow:
    0 2px 10px rgba(2, 6, 18, 0.65),
    0 0 12px rgba(125, 211, 252, 0.35);
  pointer-events: none;
  will-change: transform;
}

.mtc-joystick-zone.is-active .mtc-joystick-knob {
  border-color: #f8ecd1;
  box-shadow:
    0 2px 12px rgba(2, 6, 18, 0.7),
    0 0 18px rgba(125, 211, 252, 0.72);
}

/* 2. 右下角共用動作按鈕群（Thumb-Arc 扇形配置 + 技能圖示 + Arcane Pulse 充能點） */
.mtc-actions-cluster {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 224px;
  height: 164px;
  transform-origin: right bottom;
  transform: scale(calc(var(--mtc-scale, 1) * var(--ui-scale, 1)));
  pointer-events: none;
}

.mtc-btn {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: 1.6px solid rgba(229, 213, 181, 0.68);
  background: radial-gradient(circle at 50% 35%, rgba(16, 36, 72, 0.86) 0%, rgba(6, 13, 28, 0.92) 100%);
  color: #f4ebd6;
  font-family: inherit;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  overflow: visible;
  box-shadow:
    inset 0 0 10px rgba(125, 211, 252, 0.16),
    0 3px 12px rgba(2, 6, 18, 0.62);
  transition: transform 0.08s ease, border-color 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.mtc-btn-ring {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.34);
  pointer-events: none;
}

.mtc-btn-icon {
  position: relative;
  z-index: 2;
  display: none;
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85));
}

.mtc-btn.has-icon .mtc-btn-icon {
  display: block;
}

.mtc-btn-bolt.has-icon .mtc-btn-icon {
  width: 32px;
  height: 32px;
}

.mtc-btn.has-icon .mtc-btn-label {
  font-size: 8.5px;
  line-height: 1;
  margin-top: 1px;
  opacity: 0.92;
}

.mtc-btn.has-icon .mtc-btn-sub {
  font-size: 7.5px;
  margin-top: 0;
}

.mtc-btn-label {
  position: relative;
  z-index: 2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-shadow: 0 1px 3px rgba(2, 6, 18, 0.9);
  pointer-events: none;
}

.mtc-btn-sub {
  position: relative;
  z-index: 2;
  font-size: 8.5px;
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: 0.03em;
  line-height: 1.05;
  margin-top: 2px;
  pointer-events: none;
}

.mtc-pulse-pips {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
  pointer-events: none;
}

.mtc-pulse-pip {
  width: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.32);
  border: 0.6px solid rgba(125, 211, 252, 0.35);
}

.mtc-pulse-pip.is-filled {
  background: #67e8f9;
  border-color: #e0f2fe;
  box-shadow: 0 0 6px rgba(103, 232, 249, 0.85);
}

.mtc-btn-pulse.is-empty {
  opacity: 0.56;
  border-color: rgba(148, 163, 184, 0.45);
}

.mtc-btn.is-pressed {
  transform: scale(0.92);
  border-color: #7dd3fc;
  box-shadow:
    inset 0 0 16px rgba(125, 211, 252, 0.5),
    0 0 16px rgba(125, 211, 252, 0.55);
}

/* 冷卻遮罩與剩餘秒數 */
.mtc-cd-mask {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(3, 8, 18, 0.72);
  clip-path: inset(calc((1 - var(--mtc-cd, 0)) * 100%) 0 0 0);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.mtc-cd-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fde68a;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}

.mtc-btn.is-cooling .mtc-cd-mask,
.mtc-btn.is-oom .mtc-cd-mask {
  opacity: 1;
}

.mtc-btn.is-cooling .mtc-cd-text,
.mtc-btn.is-oom .mtc-cd-text {
  opacity: 1;
}

.mtc-btn.is-cooling .mtc-btn-icon,
.mtc-btn.is-cooling .mtc-btn-label,
.mtc-btn.is-cooling .mtc-btn-sub,
.mtc-btn.is-oom .mtc-btn-icon,
.mtc-btn.is-oom .mtc-btn-label,
.mtc-btn.is-oom .mtc-btn-sub {
  opacity: 0.35;
}

.mtc-btn.is-oom {
  border-color: rgba(248, 113, 113, 0.78);
}

.mtc-btn.is-oom .mtc-cd-text {
  color: #fca5a5;
  font-size: 10.5px;
}

.mtc-btn.is-channeling {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.65);
}

.mtc-btn.is-active-effect {
  border-color: #fbbf24;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.65);
}

/* 互動鍵上方靠近提示膠囊 */
.mtc-interact-hint {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(6, 16, 36, 0.9);
  border: 1px solid rgba(125, 211, 252, 0.72);
  color: #e0f2fe;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.mtc-interact-hint.is-shown {
  opacity: 1;
}

/* --- 模式一：主城（TOWN）只顯示大互動鍵，隱藏戰鬥技能鍵 --- */
.mobile-touch-controls[data-mode="TOWN"] .mtc-combat-only {
  display: none;
}

.mobile-touch-controls[data-mode="TOWN"] .mtc-actions-cluster {
  width: 82px;
  height: 82px;
}

.mobile-touch-controls[data-mode="TOWN"] .mtc-btn-interact {
  right: 4px;
  bottom: 4px;
  width: 68px;
  height: 68px;
  border-color: rgba(229, 213, 181, 0.72);
}

.mobile-touch-controls[data-mode="TOWN"] .mtc-btn-interact .mtc-btn-label {
  font-size: 14px;
}

.mobile-touch-controls[data-mode="TOWN"] .mtc-btn-interact .mtc-btn-sub {
  font-size: 9px;
  color: #cbd5e1;
}

/* --- 模式二：戰鬥／地城／靶場（COMBAT / RANGE）扇形弧線按鈕佈局 --- */
.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-bolt,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-bolt {
  right: 4px;
  bottom: 4px;
  width: 68px;
  height: 68px;
  border-width: 2px;
  border-color: rgba(245, 226, 180, 0.92);
  background: radial-gradient(circle at 50% 35%, rgba(22, 54, 102, 0.9) 0%, rgba(8, 18, 40, 0.94) 100%);
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-bolt .mtc-btn-label,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-bolt .mtc-btn-label {
  font-size: 14px;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-bolt.has-icon .mtc-btn-label,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-bolt.has-icon .mtc-btn-label {
  font-size: 9px;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-beam,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-beam {
  right: 84px;
  bottom: 8px;
  width: 52px;
  height: 52px;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-meteor,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-meteor {
  right: 78px;
  bottom: 70px;
  width: 52px;
  height: 52px;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-ult,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-ult {
  right: 10px;
  bottom: 82px;
  width: 54px;
  height: 54px;
  border-color: rgba(251, 191, 36, 0.85);
  background: radial-gradient(circle at 50% 35%, rgba(68, 46, 16, 0.88) 0%, rgba(20, 14, 10, 0.92) 100%);
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-ult .mtc-btn-label,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-ult .mtc-btn-label {
  color: #fde68a;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-mobility,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-mobility {
  right: 146px;
  bottom: 6px;
  width: 48px;
  height: 48px;
  border-color: rgba(56, 189, 248, 0.82);
  background: radial-gradient(circle at 50% 35%, rgba(12, 62, 84, 0.88) 0%, rgba(6, 22, 36, 0.92) 100%);
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-mobility .mtc-btn-label,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-mobility .mtc-btn-label {
  color: #bae6fd;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-pulse,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-pulse {
  right: 140px;
  bottom: 62px;
  width: 46px;
  height: 46px;
  border-color: rgba(103, 232, 249, 0.85);
  background: radial-gradient(circle at 50% 35%, rgba(14, 74, 104, 0.9) 0%, rgba(6, 20, 38, 0.94) 100%);
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-interact,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-interact {
  right: 136px;
  bottom: 116px;
  width: 44px;
  height: 44px;
  opacity: 0.78;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-interact .mtc-btn-label,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-interact .mtc-btn-label {
  font-size: 11px;
}

.mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-interact .mtc-btn-sub,
.mobile-touch-controls[data-mode="RANGE"] .mtc-btn-interact .mtc-btn-sub {
  display: none;
}

/* 左撇子鏡像模式 (.is-left-handed)：搖桿移右下、動作群移左下並水平鏡像 */
.mobile-touch-controls.is-left-handed .mtc-joystick-zone {
  left: auto;
  right: max(14px, env(safe-area-inset-right));
  transform-origin: right bottom;
}

.mobile-touch-controls.is-left-handed .mtc-actions-cluster {
  right: auto;
  left: max(14px, env(safe-area-inset-left));
  transform-origin: left bottom;
}

.mobile-touch-controls.is-left-handed[data-mode="TOWN"] .mtc-btn-interact {
  right: auto;
  left: 4px;
}

.mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-bolt,
.mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-bolt {
  right: auto;
  left: 4px;
}

.mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-beam,
.mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-beam {
  right: auto;
  left: 84px;
}

.mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-meteor,
.mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-meteor {
  right: auto;
  left: 78px;
}

.mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-ult,
.mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-ult {
  right: auto;
  left: 10px;
}

.mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-mobility,
.mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-mobility {
  right: auto;
  left: 146px;
}

.mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-pulse,
.mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-pulse {
  right: auto;
  left: 140px;
}

.mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-interact,
.mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-interact {
  right: auto;
  left: 136px;
}

/* 互動鍵靠近可互動 NPC / 星門 / 水晶機關時高亮 */
.mtc-btn-interact.is-nearby {
  opacity: 1 !important;
  border-color: #7dd3fc !important;
  background: radial-gradient(circle at 50% 35%, rgba(14, 92, 132, 0.92) 0%, rgba(8, 28, 56, 0.94) 100%) !important;
  box-shadow:
    inset 0 0 16px rgba(125, 211, 252, 0.42),
    0 0 18px rgba(125, 211, 252, 0.62),
    0 0 0 2px rgba(229, 213, 181, 0.45);
}

.mtc-btn-interact.is-nearby .mtc-btn-sub {
  color: #fde68a;
}

/* 較矮手機橫向（如 844×390 / 667×375）緊湊縮放，所有按鈕仍保持 >= 44px */
@media (max-height: 520px) {
  .mtc-joystick-zone {
    left: max(10px, env(safe-area-inset-left));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: 110px;
    height: 110px;
  }
  .mtc-joystick-zone.is-floating,
  .mobile-touch-controls.is-floating .mtc-joystick-zone {
    width: 152px;
    height: 136px;
  }
  .mtc-joystick-base {
    width: 96px;
    height: 96px;
  }
  .mtc-joystick-knob {
    width: 40px;
    height: 40px;
  }
  .mtc-actions-cluster {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: 196px;
    height: 146px;
  }
  .mobile-touch-controls.is-left-handed .mtc-joystick-zone {
    left: auto;
    right: max(10px, env(safe-area-inset-right));
  }
  .mobile-touch-controls.is-left-handed .mtc-actions-cluster {
    right: auto;
    left: max(10px, env(safe-area-inset-left));
  }
  .mobile-touch-controls[data-mode="TOWN"] .mtc-actions-cluster {
    width: 68px;
    height: 68px;
  }
  .mobile-touch-controls[data-mode="TOWN"] .mtc-btn-interact {
    width: 58px;
    height: 58px;
  }
  .mobile-touch-controls[data-mode="TOWN"] .mtc-btn-interact .mtc-btn-label {
    font-size: 13px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-bolt,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-bolt {
    right: 2px;
    bottom: 2px;
    width: 58px;
    height: 58px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-bolt .mtc-btn-label,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-bolt .mtc-btn-label {
    font-size: 13px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-bolt.has-icon .mtc-btn-label,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-bolt.has-icon .mtc-btn-label {
    font-size: 8.5px;
  }
  .mtc-btn-icon {
    width: 20px;
    height: 20px;
  }
  .mtc-btn-bolt.has-icon .mtc-btn-icon {
    width: 26px;
    height: 26px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-beam,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-beam {
    right: 68px;
    bottom: 4px;
    width: 46px;
    height: 46px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-meteor,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-meteor {
    right: 64px;
    bottom: 56px;
    width: 46px;
    height: 46px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-ult,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-ult {
    right: 6px;
    bottom: 66px;
    width: 48px;
    height: 48px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-mobility,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-mobility {
    right: 122px;
    bottom: 4px;
    width: 44px;
    height: 44px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-pulse,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-pulse {
    right: 118px;
    bottom: 52px;
    width: 44px;
    height: 44px;
  }
  .mobile-touch-controls[data-mode="COMBAT"] .mtc-btn-interact,
  .mobile-touch-controls[data-mode="RANGE"] .mtc-btn-interact {
    right: 118px;
    bottom: 100px;
    width: 44px;
    height: 44px;
  }
  .mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-bolt,
  .mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-bolt {
    right: auto;
    left: 2px;
  }
  .mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-beam,
  .mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-beam {
    right: auto;
    left: 68px;
  }
  .mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-meteor,
  .mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-meteor {
    right: auto;
    left: 64px;
  }
  .mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-ult,
  .mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-ult {
    right: auto;
    left: 6px;
  }
  .mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-mobility,
  .mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-mobility {
    right: auto;
    left: 122px;
  }
  .mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-pulse,
  .mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-pulse {
    right: auto;
    left: 118px;
  }
  .mobile-touch-controls.is-left-handed[data-mode="COMBAT"] .mtc-btn-interact,
  .mobile-touch-controls.is-left-handed[data-mode="RANGE"] .mtc-btn-interact {
    right: auto;
    left: 118px;
  }
  .mtc-btn-label {
    font-size: 10.5px;
  }
  .mtc-btn.has-icon .mtc-btn-label {
    font-size: 8px;
  }
  .mtc-btn-sub {
    font-size: 7.5px;
  }
}

/* ==========================================================================
 * PIXEL-475 / PIXEL-541: Chronicle Modal, Inspection Spot Card, Pixel Icons,
 * Hero Crest, Stargate Prep Bar & CODE-13 F9 Button Hide During Modals
 * ========================================================================== */
body.arcana-modal-open #btnCombatFeelPanelToggle,
body.arcana-modal-open #combatFeelPanel {
  display: none !important;
}

.town-ui-icon {
  display: inline-block;
  image-rendering: pixelated;
  vertical-align: middle;
  flex-shrink: 0;
}

.chronicle-hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: relative;
  border-color: rgba(217, 155, 56, 0.72) !important;
}
.canvas-box[data-scene="COMBAT"] .chronicle-hud-btn {
  display: none;
}
.chronicle-unread-pip {
  width: 12px;
  height: 12px;
  image-rendering: pixelated;
  object-fit: cover;
  object-position: left center;
}
.chronicle-unread-pip[hidden] {
  display: none !important;
}

.vd-speech-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.vd-hero-crest {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  flex-shrink: 0;
  margin-top: 2px;
  filter: drop-shadow(0 0 4px rgba(125, 211, 252, 0.65));
}
.vd-hero-crest[hidden] {
  display: none !important;
}

.stargate-prep-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 7px 10px;
  margin-bottom: 8px;
  background: rgba(8, 16, 34, 0.92);
  border: 1px solid rgba(125, 211, 252, 0.42);
  font-size: 11.5px;
  color: #e6f2ff;
}
.stargate-prep-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.town-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.town-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  color: #e8efff;
  background: rgba(16, 28, 52, 0.92);
  border: 1px solid rgba(229, 213, 181, 0.38);
  border-radius: 3px;
  cursor: pointer;
}
.town-pill-btn.is-active {
  background: rgba(24, 62, 92, 0.96);
  border-color: #38bdf8;
  color: #fef08a;
}
.sandbox-active-banner {
  padding: 5px 8px;
  margin-bottom: 6px;
  background: rgba(120, 53, 15, 0.55);
  border: 1px solid rgba(251, 191, 36, 0.72);
  color: #fde68a;
  font-size: 11.5px;
  font-weight: 700;
}

.chronicle-modal,
.inspect-spot-modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.chronicle-modal[hidden],
.inspect-spot-modal[hidden] {
  display: none !important;
}
.chronicle-backdrop,
.inspect-spot-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 16, 0.72);
}
.chronicle-shell {
  position: relative;
  z-index: 1;
  width: min(92vw, 820px);
  max-height: min(84vh, 620px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(10, 18, 36, 0.97) 0%, rgba(5, 10, 22, 0.98) 100%);
  border: 1.5px solid rgba(217, 155, 56, 0.72);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
  color: #f5f0e6;
  overflow: hidden;
}
.chronicle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(229, 213, 181, 0.28);
  flex-wrap: wrap;
}
.chronicle-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chronicle-kicker {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #7dd3fc;
}
.chronicle-title {
  margin: 0;
  font-size: 16px;
  color: #fef08a;
}
.chronicle-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chronicle-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(229, 213, 181, 0.18);
  background: rgba(4, 9, 20, 0.7);
}
.chronicle-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px;
  color: #cbd5e1;
  background: rgba(15, 25, 48, 0.86);
  border: 1px solid rgba(229, 213, 181, 0.3);
  cursor: pointer;
}
.chronicle-tab-btn.is-active {
  color: #fef08a;
  border-color: #38bdf8;
  background: rgba(14, 52, 86, 0.92);
}
.chronicle-body {
  display: grid;
  grid-template-columns: minmax(210px, 38%) 1fr;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.chronicle-list {
  overflow-y: auto;
  border-right: 1px solid rgba(229, 213, 181, 0.18);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chronicle-entry-btn {
  text-align: left;
  padding: 8px 10px;
  background: rgba(14, 23, 42, 0.85);
  border: 1px solid rgba(229, 213, 181, 0.22);
  color: #e2e8f0;
  cursor: pointer;
  font-size: 12px;
}
.chronicle-entry-btn.is-active {
  border-color: #38bdf8;
  background: rgba(16, 48, 78, 0.92);
}
.chronicle-entry-btn.is-locked {
  opacity: 0.55;
  cursor: default;
}
.chronicle-reader {
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #f1f5f9;
}
.chronicle-reader h3 {
  margin: 0 0 8px;
  color: #fef08a;
  font-size: 15px;
}
.chronicle-reader-meta {
  font-size: 11.5px;
  color: #7dd3fc;
  margin-bottom: 10px;
}
.chronicle-reader-empty {
  color: #94a3b8;
  font-size: 12.5px;
}

.inspect-spot-shell {
  position: relative;
  z-index: 1;
  width: min(90vw, 480px);
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(12, 22, 42, 0.97) 0%, rgba(6, 12, 24, 0.98) 100%);
  border: 1.5px solid rgba(217, 155, 56, 0.78);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.85);
  color: #f5f0e6;
}
.inspect-spot-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.inspect-spot-titles {
  flex: 1 1 auto;
}
.inspect-spot-kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #7dd3fc;
}
.inspect-spot-title {
  margin: 0;
  font-size: 15px;
  color: #fef08a;
}
.inspect-spot-body {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.65;
  color: #f1f5f9;
}
.inspect-spot-foot {
  font-size: 11.5px;
  color: #7dd3fc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

@media (max-width: 720px) {
  .chronicle-body {
    grid-template-columns: 1fr;
    grid-template-rows: 42% 58%;
  }
  .chronicle-list {
    border-right: none;
    border-bottom: 1px solid rgba(229, 213, 181, 0.18);
  }
}

/* 手機橫向與矮螢幕（375-540px 高）：#chronicleModal、#inspectSpotCard、#relicExtractionBanner 全數可讀且按鈕 100% 可點 */
@media (max-height: 540px) {
  .chronicle-modal {
    padding: 6px;
  }
  .chronicle-shell {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }
  .chronicle-head {
    padding: 6px 10px;
    gap: 6px;
  }
  .chronicle-kicker {
    display: none;
  }
  .chronicle-title {
    font-size: 13.5px;
  }
  .chronicle-head-actions .shop-act,
  .chronicle-head-actions .vd-close {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 11px;
  }
  .chronicle-tabs {
    padding: 5px 10px;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
  }
  .chronicle-tab-btn {
    padding: 4px 9px;
    font-size: 11px;
    min-height: 28px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .chronicle-body {
    grid-template-columns: minmax(168px, 36%) 1fr;
    grid-template-rows: 1fr;
  }
  .chronicle-list {
    border-right: 1px solid rgba(229, 213, 181, 0.18);
    border-bottom: none;
    padding: 6px;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .chronicle-entry-btn {
    padding: 6px 8px;
    font-size: 11px;
    min-height: 32px;
  }
  .chronicle-reader {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.55;
    -webkit-overflow-scrolling: touch;
  }
  .inspect-spot-modal {
    padding: 8px;
  }
  .inspect-spot-shell {
    width: min(94vw, 480px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 14px;
  }
  .inspect-spot-head {
    margin-bottom: 6px;
  }
  .inspect-spot-head .vd-close {
    min-height: 30px;
    min-width: 44px;
    padding: 4px 10px;
  }
  .inspect-spot-body {
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 8px;
  }
  .relic-extraction-banner {
    top: 48px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    padding: 8px 12px;
    z-index: 46;
  }
  .reb-btn {
    min-height: 30px;
    padding: 5px 12px;
  }
}

body.mobile-landscape .chronicle-modal {
  padding: 6px;
}

body.mobile-landscape .chronicle-shell {
  width: calc(100vw - 12px);
  max-height: calc(100dvh - 12px);
}

body.mobile-landscape .chronicle-head {
  padding: 6px 10px;
  gap: 6px;
}

body.mobile-landscape .chronicle-head-actions .shop-act,
body.mobile-landscape .chronicle-head-actions .vd-close {
  min-height: 30px;
  padding: 4px 10px;
}

body.mobile-landscape .chronicle-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

body.mobile-landscape .chronicle-tab-btn {
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 28px;
}

body.mobile-landscape .chronicle-body {
  grid-template-columns: minmax(168px, 36%) 1fr;
  grid-template-rows: 1fr;
}

body.mobile-landscape .chronicle-list {
  border-right: 1px solid rgba(229, 213, 181, 0.18);
  border-bottom: none;
  -webkit-overflow-scrolling: touch;
}

body.mobile-landscape .chronicle-reader {
  -webkit-overflow-scrolling: touch;
}

body.mobile-landscape .inspect-spot-modal {
  padding: 8px;
}

body.mobile-landscape .inspect-spot-shell {
  width: min(94vw, 480px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile-landscape .inspect-spot-head .vd-close {
  min-height: 30px;
  min-width: 44px;
}

body.mobile-landscape .relic-extraction-banner {
  top: 48px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  padding: 8px 12px;
  z-index: 46;
}

body.mobile-landscape .reb-btn {
  min-height: 30px;
  padding: 5px 12px;
}
