/* 五宗靈甲 — 視覺系統(Jony spec:墨黑鎏金 × 五行靈光,仙俠賽博) */
:root {
  --bg-deep: #070a10;
  --neon-cyan: #3df2ff;
  --neon-magenta: #ff3df0;
  --neon-violet: #8b5cff;
  --neon-gold: #e8c36a;
  --neon-green: #57ffa0;
  --neon-red: #ff4d3a;
  --neon-orange: #ff9f40;
  --ink-gold: #e8c36a;
  --ink-gold-dim: rgba(232, 195, 106, 0.32);
  --sect-ice: #a8e4ff;
  --sect-wind: #69e8a0;
  --sect-fire: #ff7a45;
  --sect-water: #5aa7e8;
  --sect-thunder: #b08be8;
  --glass: rgba(10, 13, 22, 0.8);
  --glass-border: rgba(232, 195, 106, 0.26);
  --text: #ece6d8;
  --text-dim: rgba(236, 230, 216, 0.55);
  --font-display: 'Songti TC', 'Noto Serif TC', 'Source Han Serif TC', 'PMingLiU', serif;
  --font-en: 'Orbitron', 'Avenir Next Condensed', ui-monospace, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  touch-action: none;                    /* 禁捲動/縮放手勢,遊戲全權接管 */
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  height: 100dvh;                         /* iOS 動態工具列 */
  display: block;
}

/* —— 虛擬搖桿(觸控浮動)—— */
#joy {
  position: fixed;
  width: 116px; height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  border: 2px solid rgba(61, 242, 255, 0.35);
  background: rgba(10, 16, 32, 0.3);
  z-index: 7; pointer-events: none;
}
#joy-knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(61, 242, 255, 0.85), rgba(61, 242, 255, 0.35));
  box-shadow: 0 0 18px rgba(61, 242, 255, 0.55);
}

/* —— 手機暫停鍵(HUD 層,可點)—— */
#btn-pause-hud {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  top: calc(86px + env(safe-area-inset-top));
  width: 46px; height: 46px;
  border-radius: 50%;
  font-size: 17px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  z-index: 7;
  cursor: pointer;
}

/* —— 全屏特效疊層(不擋滑鼠)—— */
#fx-vignette, #fx-hurt, #fx-flash {
  position: fixed; inset: 0; pointer-events: none;
}
#fx-vignette {
  background: radial-gradient(ellipse at center, transparent 52%, rgba(2, 3, 9, 0.55) 100%);
  z-index: 3;
}
#fx-hurt {
  background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 30, 60, 0.5) 100%);
  opacity: 0; transition: opacity 0.25s ease-out;
  z-index: 4;
}
#fx-flash {
  background: #fff; opacity: 0; z-index: 5;
}

.hidden { display: none !important; }

/* —— 玻璃面板 —— */
.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* —— 按鈕 —— */
.btn {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
  background: linear-gradient(135deg, rgba(61, 242, 255, 0.12), rgba(139, 92, 255, 0.14));
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 13px 44px;
  min-width: 230px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s, border-color 0.18s;
}
.btn:hover {
  transform: translateY(-2px);
  border-color: rgba(61, 242, 255, 0.65);
  box-shadow: 0 0 22px rgba(61, 242, 255, 0.25), 0 6px 18px rgba(0, 0, 0, 0.4);
}
.btn:active { transform: translateY(0) scale(0.985); }
.btn.primary {
  background: linear-gradient(135deg, rgba(61, 242, 255, 0.32), rgba(139, 92, 255, 0.38));
  border-color: rgba(61, 242, 255, 0.55);
  box-shadow: 0 0 26px rgba(61, 242, 255, 0.22);
  text-shadow: 0 0 12px rgba(61, 242, 255, 0.8);
}
.btn.small { min-width: 0; padding: 8px 18px; font-size: 13px; }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn:disabled:hover { transform: none; box-shadow: none; border-color: var(--glass-border); }

/* —— 全屏畫面 —— */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px;
  z-index: 10;
  animation: screenIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes screenIn {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}
/* 不用 backdrop-blur:疊在 WebGL canvas 上合成成本過高(選單會掉到 ~40fps) */
.screen.dim { background: rgba(3, 5, 12, 0.78); }

/* —— 標題畫面(attract mode 戰鬥跑在後面,中央柔性暗化保可讀)—— */
#screen-title {
  background: radial-gradient(ellipse 62% 56% at center, rgba(3, 5, 12, 0.66) 30%, rgba(3, 5, 12, 0.28) 62%, transparent 100%);
}
.title-coins {
  position: absolute; top: 18px; right: 20px;
  font-family: var(--font-display); font-size: 17px; font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--neon-gold); text-shadow: 0 0 14px rgba(255, 216, 74, 0.6);
  padding: 8px 18px;
  background: var(--glass);
  border: 1px solid rgba(255, 216, 74, 0.3);
  border-radius: 999px;
}
.menu-row { display: flex; gap: 12px; }
.btn.half {
  min-width: 0; flex: 1; padding: 11px 18px; position: relative;
  white-space: nowrap; letter-spacing: 0.1em; font-size: 15px;
}
.btn .dot {
  position: absolute; top: -4px; right: -4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--neon-red);
  box-shadow: 0 0 10px rgba(255, 77, 109, 0.9);
  animation: dotPulse 1.4s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}
.btn.cta {
  font-size: 20px;
  padding: 17px 56px;
  letter-spacing: 0.22em;
  animation: ctaBreath 2.4s ease-in-out infinite;
}
@keyframes ctaBreath {
  0%, 100% { box-shadow: 0 0 26px rgba(61, 242, 255, 0.22); }
  50% { box-shadow: 0 0 44px rgba(61, 242, 255, 0.5), 0 0 80px rgba(139, 92, 255, 0.25); }
}
.title-logo { text-align: center; position: relative; animation: logoFloat 5s ease-in-out infinite; }
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.title-img {
  display: block;
  width: min(86vw, 880px);
  filter: drop-shadow(0 0 26px rgba(232, 195, 106, 0.35)) drop-shadow(0 2px 18px rgba(0, 0, 0, 0.8));
  animation: logoPulse 3.2s ease-in-out infinite;
}
.sect-seal img {
  width: 46px; height: 46px;
  display: block;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--sc) 45%, transparent));
}
.title-zh {
  font-family: var(--font-display);
  font-size: clamp(64px, 12vw, 132px);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  background: linear-gradient(175deg, #fff4d6 8%, var(--ink-gold) 38%, #b8884a 62%, #f5e3b0 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(232, 195, 106, 0.4)) drop-shadow(0 2px 18px rgba(0, 0, 0, 0.8));
  animation: logoPulse 3.2s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 26px rgba(232, 195, 106, 0.4)) drop-shadow(0 2px 18px rgba(0, 0, 0, 0.8)); }
  50% { filter: drop-shadow(0 0 42px rgba(232, 195, 106, 0.65)) drop-shadow(0 2px 18px rgba(0, 0, 0, 0.8)); }
}
.title-en {
  margin-top: 8px;
  font-family: var(--font-en);
  font-size: clamp(12px, 1.6vw, 17px);
  font-weight: 700;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: var(--text-dim);
}
.title-sub {
  font-size: 15px;
  letter-spacing: 0.4em;
  color: var(--ink-gold);
  opacity: 0.85;
  font-family: var(--font-display);
}
/* 五宗印章列 */
.sect-row { display: flex; gap: 14px; margin-top: 2px; }
.sect-seal {
  --sc: #fff;
  position: relative;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 900;
  color: var(--sc);
  text-shadow: 0 0 10px var(--sc);
}
/* 純文字回退時補框(美術徽章自帶外框) */
.sect-seal:not(:has(img)) {
  border: 1.6px solid color-mix(in srgb, var(--sc) 65%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--sc) 8%, rgba(7, 10, 16, 0.7));
  box-shadow: 0 0 14px color-mix(in srgb, var(--sc) 30%, transparent), inset 0 0 10px color-mix(in srgb, var(--sc) 12%, transparent);
}
.sect-seal i {
  position: absolute; bottom: -17px; left: 50%; transform: translateX(-50%);
  font-style: normal; font-size: 10px; letter-spacing: 0.2em;
  color: var(--text-dim); white-space: nowrap;
}
.menu { display: flex; flex-direction: column; gap: 14px; align-items: center; }
#best-stats {
  display: flex; gap: 0;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  overflow: hidden;
}
#best-stats:empty { display: none; }
#best-stats .stat {
  padding: 9px 20px;
  display: flex; align-items: center; gap: 7px;
  border-right: 1px solid rgba(61, 242, 255, 0.14);
}
#best-stats .stat:last-child { border-right: none; }
#best-stats b { color: var(--neon-gold); font-weight: 700; }
.controls-hint {
  position: absolute; bottom: 4vh;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
.ver-tag { position: absolute; bottom: 1.2vh; right: 16px; font-size: 11px; color: rgba(232,244,255,0.25); letter-spacing: 0.1em; }

/* —— HUD —— */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#xpbar {
  position: absolute; top: 0; left: 0; right: 0; height: 7px;
  background: rgba(8, 12, 26, 0.8);
  border-bottom: 1px solid rgba(87, 255, 160, 0.18);
}
#xpfill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #2bd97e, var(--neon-green));
  box-shadow: 0 0 14px rgba(87, 255, 160, 0.8);
  transition: width 0.18s ease-out;
}
#hud-top {
  position: absolute; top: 15px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
}
#hud-left { padding: 10px 14px; display: flex; align-items: center; gap: 12px; }
#lv-badge {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: var(--neon-green); text-shadow: 0 0 10px rgba(87, 255, 160, 0.7);
  white-space: nowrap;
}
#hpbar {
  position: relative; width: 190px; height: 16px;
  background: rgba(255, 77, 109, 0.13);
  border: 1px solid rgba(255, 77, 109, 0.4);
  border-radius: 8px; overflow: hidden;
}
#hpfill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff2d55, #ff7a5c);
  box-shadow: 0 0 12px rgba(255, 77, 109, 0.8);
  transition: width 0.15s ease-out;
}
#hptext {
  position: absolute; inset: 0;
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
#hud-center { position: absolute; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
#timer {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  padding: 6px 22px; letter-spacing: 0.1em;
  color: var(--text); text-shadow: 0 0 14px rgba(61, 242, 255, 0.5);
}
#bossbar-wrap { width: min(46vw, 560px); text-align: center; }
#bossname {
  font-size: 12px; letter-spacing: 0.35em; color: var(--neon-red);
  text-shadow: 0 0 10px rgba(255, 77, 109, 0.8); margin-bottom: 4px;
}
#bossbar {
  height: 10px; border-radius: 5px; overflow: hidden;
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.45);
}
#bossfill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff2d55, var(--neon-red));
  box-shadow: 0 0 14px rgba(255, 77, 109, 0.9);
  transition: width 0.12s ease-out;
}
#hud-right { padding: 10px 16px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
#kills, #coins {
  font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: 0.08em;
}
#kills { color: var(--text); }
#coins { color: var(--neon-gold); text-shadow: 0 0 10px rgba(255, 216, 74, 0.6); }

#combo {
  position: absolute; right: 3vw; top: 38vh;
  font-family: var(--font-display); font-weight: 900;
  color: var(--neon-gold);
  text-shadow: 0 0 18px rgba(255, 216, 74, 0.8), 0 2px 6px rgba(0,0,0,0.6);
  transform-origin: center;
}
#combo .combo-label { display: block; font-size: 11px; letter-spacing: 0.3em; color: var(--text-dim); text-align: right; }

#hud-bottom {
  position: absolute; bottom: 14px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: flex-end;
}
#weapon-icons, #passive-icons {
  display: flex; gap: 8px; padding: 8px 10px;
}
.slot-icon {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 9px;
  border: 1px solid var(--glass-border);
  background: rgba(61, 242, 255, 0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px currentColor;
}
.slot-icon.passive { color: var(--neon-violet); }
.slot-icon.maxed { color: var(--neon-gold); border-color: rgba(255, 216, 74, 0.6); box-shadow: 0 0 12px rgba(255, 216, 74, 0.3); }
.slot-icon.fusion { color: var(--neon-magenta); border-color: rgba(255, 61, 240, 0.55); }
.slot-icon.fusion.maxed { color: var(--neon-gold); }
.slot-icon .pips {
  position: absolute; bottom: 2px; left: 0; right: 0;
  display: flex; gap: 2px; justify-content: center;
}
.slot-icon .pips i {
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(232, 244, 255, 0.25);
}
.slot-icon .pips i.on { background: currentColor; box-shadow: 0 0 4px currentColor; }

#fps-meter {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-display); font-size: 11px;
  color: var(--text-dim); letter-spacing: 0.1em;
}

/* —— 升級畫面 —— */
#screen-levelup { gap: 30px; }
.levelup-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 40px); font-weight: 900; letter-spacing: 0.2em;
  color: var(--neon-green);
  text-shadow: 0 0 24px rgba(87, 255, 160, 0.8);
  animation: levelupBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes levelupBounce {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
#cards { display: flex; gap: 20px; }
.card {
  width: 212px; min-height: 264px;
  padding: 24px 18px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border-radius: 14px;
  cursor: pointer;
  background: var(--glass);
  border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s, border-color 0.18s;
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  position: relative;
  overflow: hidden;
}
.card:nth-child(2) { animation-delay: 0.07s; }
.card:nth-child(3) { animation-delay: 0.14s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(36px); }
  to { opacity: 1; transform: translateY(0); }
}
.card:hover { transform: translateY(-8px) scale(1.03); }
.card.new { border-color: rgba(61, 242, 255, 0.7); }
.card.new:hover { box-shadow: 0 0 34px rgba(61, 242, 255, 0.35), 0 14px 40px rgba(0, 0, 0, 0.5); }
.card.up { border-color: rgba(139, 92, 255, 0.7); }
.card.up:hover { box-shadow: 0 0 34px rgba(139, 92, 255, 0.4), 0 14px 40px rgba(0, 0, 0, 0.5); }
.card.max { border-color: rgba(255, 216, 74, 0.85); }
.card.max:hover { box-shadow: 0 0 38px rgba(255, 216, 74, 0.45), 0 14px 40px rgba(0, 0, 0, 0.5); }
.card.fusion {
  border-color: rgba(255, 61, 240, 0.85);
  box-shadow: 0 0 30px rgba(255, 61, 240, 0.3), 0 10px 36px rgba(0, 0, 0, 0.5);
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards, fusionPulse 1.6s ease-in-out infinite;
}
@keyframes fusionPulse {
  0%, 100% { box-shadow: 0 0 26px rgba(255, 61, 240, 0.3), 0 10px 36px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 44px rgba(255, 61, 240, 0.55), 0 0 60px rgba(255, 216, 74, 0.25), 0 10px 36px rgba(0, 0, 0, 0.5); }
}
.card.fusion .tag { color: #ff3df0; border: 1px solid rgba(255, 61, 240, 0.6); }
.card.fusion .glyph { color: #ff3df0; }
.card.fusion:hover { box-shadow: 0 0 50px rgba(255, 61, 240, 0.55), 0 14px 40px rgba(0, 0, 0, 0.5); }
.card::after { /* 掃光 */
  content: '';
  position: absolute; top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.09), transparent);
  transform: skewX(-20deg);
  animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -80%; } 100% { left: 160%; } }
.card .key-hint {
  position: absolute; top: 10px; left: 12px;
  font-family: var(--font-display); font-size: 12px;
  color: var(--text-dim);
  border: 1px solid rgba(232, 244, 255, 0.2);
  border-radius: 5px; padding: 1px 7px;
}
.card .tag {
  position: absolute; top: 10px; right: 12px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em;
  padding: 2px 8px; border-radius: 5px;
}
.card.new .tag { color: var(--neon-cyan); border: 1px solid rgba(61, 242, 255, 0.5); }
.card.up .tag { color: var(--neon-violet); border: 1px solid rgba(139, 92, 255, 0.5); }
.card.max .tag { color: var(--neon-gold); border: 1px solid rgba(255, 216, 74, 0.6); }
.card .glyph {
  font-size: 52px; line-height: 1.25; margin-top: 16px;
  text-shadow: 0 0 22px currentColor;
}
.card.new .glyph { color: var(--neon-cyan); }
.card.up .glyph { color: var(--neon-violet); }
.card.max .glyph { color: var(--neon-gold); }
.card .cname { font-size: 19px; font-weight: 800; letter-spacing: 0.1em; }
.card .clv {
  font-family: var(--font-display); font-size: 12px;
  color: var(--text-dim); letter-spacing: 0.15em;
}
.card .cdesc {
  font-size: 13px; line-height: 1.55; color: var(--text-dim);
  text-align: center; min-height: 3.2em;
}
.levelup-hint { font-size: 13px; letter-spacing: 0.25em; color: var(--text-dim); }
/* 融合配方提示 */
.fuse-hint {
  font-size: 12px; line-height: 1.5;
  color: rgba(232, 244, 255, 0.45);
  border-top: 1px dashed rgba(61, 242, 255, 0.18);
  padding-top: 6px; margin-top: 2px;
  width: 100%; text-align: center;
}
.fuse-hint.partner {
  color: #ffb0f6;
  font-size: 13px; font-weight: 700;
  background: rgba(255, 61, 240, 0.12);
  border: 1px solid rgba(255, 61, 240, 0.4);
  border-radius: 8px;
  padding: 7px 8px; margin-top: 6px;
  text-shadow: 0 0 10px rgba(255, 61, 240, 0.45);
}
/* 羈絆夥伴卡:頂部緞帶 + 邊框呼吸光(選它 = 朝融合技邁進) */
.card.bondmate { border-color: rgba(255, 61, 240, 0.6); }
.card.bondmate:not(.fusion) {
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards, bondBreath 1.5s ease-in-out infinite;
}
@keyframes bondBreath {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 61, 240, 0.22), 0 10px 36px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 32px rgba(255, 61, 240, 0.55), 0 0 48px rgba(255, 216, 74, 0.18), 0 10px 36px rgba(0, 0, 0, 0.5); }
}
.bond-ribbon {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  padding: 2.5px 12px;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.22em; text-indent: 0.22em;
  white-space: nowrap;
  color: #14060f;
  background: linear-gradient(90deg, #ff3df0, #ffd84a);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(255, 61, 240, 0.55);
}
/* 門派籤 */
.sect-chip {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  font-family: var(--font-display);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-dim);
}
.sect-chip.bond { color: var(--ink-gold); border-color: var(--ink-gold-dim); }
/* 靈甲閣宗門標頭 */
.sect-head {
  flex-basis: 100%;
  display: flex; align-items: center; gap: 8px;
  margin: 6px 2px 2px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  letter-spacing: 0.3em;
}
.sect-head .sect-em {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border: 1.2px solid; border-radius: 5px;
  font-size: 13px;
}
/* —— 神尊技鈕(雙槽圖騰環 + CD 掃描;#btn-ult = 第一尊,#btn-ult2 疊其上方) —— */
.ult-btn {
  --uc: #e8c36a;
  --p: 0%;
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 72px));
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 2px dashed color-mix(in srgb, var(--uc) 60%, transparent);
  background:
    url('../art/ui/totem_ult_button.svg') center / 92% no-repeat,
    conic-gradient(color-mix(in srgb, var(--uc) 26%, transparent) var(--p), rgba(10, 13, 22, 0.72) var(--p));
  color: var(--uc);
  cursor: pointer;
  z-index: 7;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 16px color-mix(in srgb, var(--uc) 24%, transparent), inset 0 0 14px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
#btn-ult2 { bottom: max(168px, calc(env(safe-area-inset-bottom) + 156px)); }
.ult-btn i {
  font-style: normal;
  font-family: var(--font-display);
  font-size: 30px; font-weight: 900;
  text-shadow: 0 0 12px var(--uc);
}
.ult-btn .ult-key {
  position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  font-size: 8.5px; letter-spacing: 0.2em;
  color: var(--text-dim);
}
.ult-btn.ready {
  border-style: solid;
  animation: ultReady 1.6s ease-in-out infinite;
}
.ult-btn.ready:hover { transform: scale(1.08); }
.ult-btn:not(.ready) { opacity: 0.75; cursor: default; }
@keyframes ultReady {
  0%, 100% { box-shadow: 0 0 14px color-mix(in srgb, var(--uc) 35%, transparent), inset 0 0 14px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 30px color-mix(in srgb, var(--uc) 75%, transparent), inset 0 0 14px rgba(0, 0, 0, 0.4); }
}
@media (max-width: 700px) {
  .ult-btn { width: 62px; height: 62px; bottom: max(96px, calc(env(safe-area-inset-bottom) + 84px)); }
  #btn-ult2 { bottom: max(172px, calc(env(safe-area-inset-bottom) + 160px)); }
}

/* 標題 logo 背後的淡金圖騰環 */
.title-logo::before {
  content: '';
  position: absolute;
  left: 50%; top: 42%;
  width: 460px; height: 460px;
  transform: translate(-50%, -50%);
  border: 1.6px dashed rgba(232, 195, 106, 0.16);
  border-radius: 50%;
  animation: totemSpin 60s linear infinite;
  pointer-events: none;
}
.title-logo::after {
  content: '';
  position: absolute;
  left: 50%; top: 42%;
  width: 380px; height: 380px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(232, 195, 106, 0.1);
  border-radius: 50%;
  animation: totemSpin 90s linear infinite reverse;
  pointer-events: none;
}
@keyframes totemSpin {
  from { transform: translate(-50%, -50%) rotate(0); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* —— 功法閣 —— */
#skills-body {
  width: min(94vw, 1080px);
  max-height: 72vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 4px 10px;
  scrollbar-width: thin;
}
.sk-sect {
  --sc: #fff;
  border: 1px solid color-mix(in srgb, var(--sc) 30%, transparent);
  border-radius: 14px;
  background: var(--glass);
  padding: 12px 14px;
}
.sk-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 9px;
  font-family: var(--font-display);
}
.sk-head .sect-em {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; align-self: center;
  border: 1.4px solid color-mix(in srgb, var(--sc) 70%, transparent);
  border-radius: 6px;
  color: var(--sc); font-size: 15px; font-weight: 900;
  text-shadow: 0 0 8px var(--sc);
}
.sk-head .sk-name { color: var(--sc); font-size: 17px; font-weight: 800; letter-spacing: 0.2em; }
.sk-head .sk-motto { color: var(--text-dim); font-size: 11.5px; letter-spacing: 0.1em; }
.sk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: 7px;
}
.sk-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  border: 1px solid rgba(236, 230, 216, 0.1);
  border-radius: 9px;
  background: rgba(7, 10, 16, 0.5);
}
.sk-chip .sk-glyph {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 900;
  color: var(--sc);
  text-shadow: 0 0 9px color-mix(in srgb, var(--sc) 70%, transparent);
}
.sk-chip.passive .sk-glyph { opacity: 0.8; filter: saturate(0.7); }
.sk-chip .sk-info { min-width: 0; flex: 1; }
.sk-chip .sk-info b { display: block; font-size: 12.5px; letter-spacing: 0.06em; }
.sk-chip .sk-info i {
  display: block; font-style: normal;
  font-size: 10.5px; line-height: 1.35;
  color: var(--text-dim);
}
.sk-chip .sk-kind {
  flex-shrink: 0; align-self: flex-start;
  font-size: 9.5px; letter-spacing: 0.15em;
  color: var(--text-dim);
  border: 1px solid rgba(236, 230, 216, 0.16);
  border-radius: 999px;
  padding: 1.5px 7px;
}
.sk-chip.passive .sk-kind { color: var(--ink-gold); border-color: var(--ink-gold-dim); }
/* 羈絆譜 */
.bond-list { display: flex; flex-direction: column; gap: 5px; }
.bond-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 9px;
  border: 1px solid rgba(232, 195, 106, 0.14);
  border-radius: 9px;
  background: rgba(7, 10, 16, 0.5);
  font-size: 12.5px;
}
.bond-row .bond-p { font-weight: 700; white-space: nowrap; }
.bond-row .bond-x { color: var(--text-dim); }
.bond-row .bond-arrow { color: var(--ink-gold); }
.bond-row .bond-f {
  font-family: var(--font-display);
  font-weight: 900; letter-spacing: 0.08em;
  color: var(--ink-gold);
  text-shadow: 0 0 10px rgba(232, 195, 106, 0.5);
  white-space: nowrap;
}
.bond-row .bond-desc {
  flex-basis: 100%;
  font-style: normal; font-size: 10.5px;
  color: var(--text-dim);
  padding-left: 2px;
}
@media (max-width: 700px) {
  #skills-body { max-height: 66vh; }
  .sk-grid { grid-template-columns: 1fr 1fr; }
  .sk-chip .sk-info i { display: none; }
  .bond-row .bond-desc { display: none; }
}

/* —— 神尊殿 —— */
.sov-intro {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--ink-gold);
  opacity: 0.8;
  margin: -6px 0 4px;
}
#sov-body, #zones-body {
  width: min(94vw, 1120px);
  max-height: 64vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
  padding: 8px 10px;
  scrollbar-width: thin;
}
.sov-card {
  --sc: #e8c36a;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 16px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--sc) 32%, transparent);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--sc) 9%, transparent), transparent 62%),
    var(--glass);
  overflow: hidden;
}
.sov-totem {
  position: relative;
  width: 84px; height: 84px;
  display: flex; align-items: center; justify-content: center;
}
.sov-totem::before, .sov-totem::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  pointer-events: none;
}
.sov-totem::before {
  border: 1.6px dashed color-mix(in srgb, var(--sc) 60%, transparent);
  animation: sovSpin 14s linear infinite;
}
.sov-totem::after {
  inset: 9px;
  border: 1px solid color-mix(in srgb, var(--sc) 35%, transparent);
  animation: sovSpin 22s linear infinite reverse;
}
@keyframes sovSpin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}
.sov-em {
  font-family: var(--font-display);
  font-size: 40px; font-weight: 900;
  color: var(--sc);
  text-shadow: 0 0 18px var(--sc), 0 0 40px color-mix(in srgb, var(--sc) 55%, transparent);
}
.sov-name {
  font-family: var(--font-display);
  font-size: 16.5px; font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ink-gold);
}
.sov-ult {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.08em;
}
.sov-ult .sov-type {
  font-size: 9.5px; font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--sc);
  border: 1px solid color-mix(in srgb, var(--sc) 45%, transparent);
  border-radius: 999px;
  padding: 1px 7px;
}
.sov-desc {
  font-size: 10.5px; line-height: 1.4;
  color: var(--text-dim);
  text-align: center;
  min-height: 29px;
}
.sov-src {
  margin-top: 2px;
  padding-top: 7px;
  border-top: 1px solid rgba(232, 195, 106, 0.12);
  width: 100%;
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
}
.sov-src i { display: block; font-style: normal; margin-top: 2px; letter-spacing: 0.1em; }
.sov-hint {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.sov-hint b { color: var(--ink-gold); }
.sov-card { cursor: pointer; transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s; }
.sov-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 26px color-mix(in srgb, var(--sc) 28%, transparent);
}
/* —— 單尊專頁 —— */
#sov-detail, #zone-detail {
  display: flex; gap: 16px;
  align-items: stretch;
  width: min(94vw, 1080px);
}
#sov-detail.hidden, #zone-detail.hidden { display: none; }
#sov-stagewrap, #zone-stagewrap {
  position: relative;
  border: 1px solid var(--ink-gold-dim);
  border-radius: 14px;
  overflow: hidden;
  background: #070a10;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(232, 195, 106, 0.08);
  flex-shrink: 0;
}
#sov-sim, #zone-sim { display: block; width: 660px; height: 430px; max-width: 60vw; }
#sov-info, #zone-info {
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 18px 14px;
  text-align: left;
}
#sov-info .sd-ult, #zone-info .sd-ult {
  --sc: #e8c36a;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-size: 24px; font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--sc);
  text-shadow: 0 0 14px color-mix(in srgb, var(--sc) 60%, transparent);
}
#sov-info .sd-desc, #zone-info .sd-desc { font-size: 13px; color: var(--text); opacity: 0.9; line-height: 1.5; }
#sov-info .sd-row, #zone-info .sd-row {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px;
  padding-top: 9px;
  border-top: 1px solid rgba(232, 195, 106, 0.1);
}
#sov-info .sd-label, #zone-info .sd-label {
  flex-shrink: 0;
  font-size: 10px; letter-spacing: 0.2em;
  color: var(--text-dim);
  border: 1px solid rgba(236, 230, 216, 0.16);
  border-radius: 999px;
  padding: 2px 8px;
}
#sov-info .sd-x, #zone-info .sd-x { font-style: normal; color: var(--text-dim); padding: 0 2px; }
#sov-info .sd-hintline, #zone-info .sd-hintline {
  margin-top: auto;
  font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--ink-gold);
  opacity: 0.75;
}
/* —— 陣法閣(M12):陣紋卡 —— */
.zone-artwrap {
  position: relative;
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
}
.zone-art {
  width: 96px; height: 96px;
  animation: sovSpin 26s linear infinite;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--sc) 55%, transparent));
}
.zone-card:hover .zone-art { animation-duration: 9s; }
.zone-card .sov-src i { color: color-mix(in srgb, var(--sc) 72%, white); }
#zone-info .sd-note {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
@media (max-width: 900px) {
  #sov-detail, #zone-detail { flex-direction: column; align-items: center; }
  #sov-sim, #zone-sim { width: 88vw; height: auto; max-width: 88vw; aspect-ratio: 660/430; }
  #sov-info, #zone-info { width: 88vw; }
}
@media (max-width: 700px) {
  #sov-body, #zones-body { grid-template-columns: 1fr 1fr; max-height: 60vh; }
  .sov-desc { display: none; }
  .menu-row { flex-wrap: wrap; justify-content: center; }
}

/* —— 美術框換裝(Claude Design)—— */
.card.fusion {
  border: 16px solid transparent;
  border-image: url('../art/ui/card_frame_gold.png') 64 / 16px stretch;
  border-radius: 0;
  background: rgba(12, 10, 6, 0.88);
}
#sov-info, #hangar-spec {
  border: 14px solid transparent;
  border-image: url('../art/ui/card_frame_normal.png') 64 / 14px stretch;
  border-radius: 0;
  background: rgba(8, 10, 16, 0.85);
}
#boss-banner .bb-scroll {
  border: 24px solid transparent;
  border-image: url('../art/ui/sovereign_banner_frame.png') 100 40 / 24px 10px stretch;
  border-radius: 0;
  background: rgba(10, 8, 8, 0.9);
  box-shadow: 0 0 30px color-mix(in srgb, var(--bcol) 40%, transparent);
}

/* Boss 登場直幅(書法卷軸) */
#boss-banner {
  --bcol: #ff4d3a;
  position: fixed;
  right: 7vw; top: 50%;
  transform: translateY(-50%);
  z-index: 8; pointer-events: none;
  animation: bannerIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
#boss-banner.out { animation: bannerOut 0.6s ease forwards; }
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-50%) translateX(46px); }
  to { opacity: 1; transform: translateY(-50%) translateX(0); }
}
@keyframes bannerOut {
  to { opacity: 0; transform: translateY(-50%) translateX(30px); }
}
#boss-banner .bb-scroll {
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, rgba(12, 8, 8, 0.92), rgba(20, 10, 10, 0.88));
  border: 1.6px solid var(--bcol);
  border-radius: 6px;
  box-shadow: 0 0 30px color-mix(in srgb, var(--bcol) 45%, transparent), inset 0 0 24px rgba(0, 0, 0, 0.6);
  text-align: center;
}
#boss-banner .bb-name {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 900;
  line-height: 1.18;
  color: var(--bcol);
  text-shadow: 0 0 16px var(--bcol);
}
#boss-banner .bb-sub {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--bcol) 40%, transparent);
  font-size: 11px; letter-spacing: 0.3em; text-indent: 0.3em;
  color: var(--text-dim);
}
.fuse-hint.ready {
  color: var(--neon-gold);
  text-shadow: 0 0 8px rgba(255, 216, 74, 0.5);
  animation: dotPulse 1.4s ease-in-out infinite;
}
#levelup-tools { display: flex; gap: 12px; }
#levelup-tools .btn:disabled { opacity: 0.3; }
#screen-levelup.banishing .card { border-color: rgba(255, 77, 109, 0.75) !important; }
#screen-levelup.banishing .card:hover { box-shadow: 0 0 34px rgba(255, 77, 109, 0.5), 0 14px 40px rgba(0, 0, 0, 0.5) !important; }
#btn-banish.armed { color: var(--neon-red); border-color: rgba(255, 77, 109, 0.7); }

/* 結算:武器傷害佔比 */
#over-dmg {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 22px;
  width: min(88vw, 420px);
  border-radius: 12px;
}
#over-dmg:empty { display: none; }
.dmg-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.dmg-row .dglyph { width: 20px; text-align: center; color: var(--neon-cyan); text-shadow: 0 0 8px currentColor; }
.dmg-row .dname { width: 86px; color: var(--text-dim); white-space: nowrap; overflow: hidden; }
.dmg-row .dbar { flex: 1; height: 8px; border-radius: 4px; background: rgba(61, 242, 255, 0.08); overflow: hidden; display: block; }
.dmg-row .dfill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  border-radius: 4px;
}
.dmg-row .dval { width: 64px; text-align: right; font-family: var(--font-display); font-size: 11.5px; color: var(--text); }

/* —— 暫停/結算 —— */
.pause-title, .over-title, .shop-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 52px); font-weight: 900; letter-spacing: 0.25em;
  text-shadow: 0 0 26px rgba(61, 242, 255, 0.5);
}
.over-title.win { color: var(--neon-gold); text-shadow: 0 0 30px rgba(255, 216, 74, 0.65); }
.over-title.lose { color: var(--neon-red); text-shadow: 0 0 30px rgba(255, 77, 109, 0.6); }
.overstats {
  display: grid; grid-template-columns: auto auto; gap: 8px 34px;
  padding: 20px 34px;
  font-size: 15px;
}
.overstats .k { color: var(--text-dim); letter-spacing: 0.15em; }
.overstats .v { font-family: var(--font-display); font-weight: 700; text-align: right; }
#over-coins {
  font-family: var(--font-display); font-size: 23px; font-weight: 900;
  color: var(--neon-gold); text-shadow: 0 0 18px rgba(255, 216, 74, 0.7);
  letter-spacing: 0.1em;
}
.audio-toggles { display: flex; gap: 12px; }

/* 暫停:當前 build 總覽 */
#pause-build {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 26px; border-radius: 14px;
}
#pause-build:empty { display: none; }
.pb-ship { font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 0.08em; }
.pb-row { display: flex; gap: 8px; min-height: 10px; }
.pb-item {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  color: var(--neon-cyan); text-shadow: 0 0 9px currentColor;
  border: 1px solid var(--glass-border); border-radius: 8px;
}
.pb-item.passive { color: var(--neon-violet); }
.pb-item.fusion { color: var(--neon-magenta); }
.pb-item i {
  position: absolute; bottom: -5px; right: -5px;
  font-style: normal; font-family: var(--font-display);
  font-size: 9.5px; font-weight: 700;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 6px; padding: 0 4px;
  color: var(--text);
}
.pb-meta { font-size: 11.5px; letter-spacing: 0.12em; color: var(--text-dim); }

/* —— 商店 —— */
#shop-coins {
  font-family: var(--font-display); font-size: 21px; font-weight: 900;
  color: var(--neon-gold); text-shadow: 0 0 16px rgba(255, 216, 74, 0.6);
  letter-spacing: 0.12em;
}
#shop-items {
  display: flex; flex-direction: column; gap: 10px;
  width: min(92vw, 560px);
  max-height: 52vh; overflow-y: auto;
  padding: 4px;
}
.shop-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
}
.shop-item .glyph {
  font-size: 25px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  color: var(--neon-violet); text-shadow: 0 0 12px currentColor;
  border: 1px solid rgba(139, 92, 255, 0.35); border-radius: 9px;
  flex-shrink: 0;
}
.shop-item .info { flex: 1; min-width: 0; }
.shop-item .sname { font-size: 15px; font-weight: 800; letter-spacing: 0.08em; }
.shop-item .sdesc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.shop-item .spips { display: flex; gap: 3px; margin-top: 5px; }
.shop-item .spips i {
  width: 14px; height: 5px; border-radius: 2px;
  background: rgba(232, 244, 255, 0.15);
}
.shop-item .spips i.on { background: var(--neon-violet); box-shadow: 0 0 6px rgba(139, 92, 255, 0.8); }
.shop-item .buy {
  min-width: 104px; padding: 9px 12px; font-size: 14px;
  font-family: var(--font-display);
}
.shop-item .buy.afford { color: var(--neon-gold); border-color: rgba(255, 216, 74, 0.5); }
.shop-item .buy.maxed { color: var(--neon-green); }

/* —— 機庫 2.0 —— */
#screen-hangar { gap: 14px; }
.hangar-head { display: flex; align-items: center; gap: 26px; }
#hangar-coins {
  font-family: var(--font-display); font-size: 19px; font-weight: 900;
  color: var(--neon-gold); text-shadow: 0 0 16px rgba(255, 216, 74, 0.6);
  letter-spacing: 0.12em;
}
#hangar-main {
  display: flex; gap: 22px; align-items: stretch;
  width: min(94vw, 940px);
}
#hangar-stage {
  flex: 1.25; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
#hangar-preview { width: 100%; max-width: min(480px, 58vh); aspect-ratio: 4/3; }
@media (max-height: 640px) {
  #screen-hangar { gap: 8px; }
  #hangar-spec { padding: 14px 16px; gap: 7px; }
  .ship-thumb canvas { width: 44px; height: 44px; }
}
#hangar-spec {
  flex: 1; min-width: 0;
  padding: 22px 24px;
  display: flex; flex-direction: column; gap: 11px;
  border-radius: 16px;
}
#spec-name {
  font-family: var(--font-display); font-size: 23px; font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow: 0 0 18px rgba(61, 242, 255, 0.4);
}
#spec-lore {
  font-size: 13px; line-height: 1.7; color: var(--text-dim);
  font-style: italic;
  border-left: 2px solid var(--glass-border);
  padding-left: 12px;
  min-height: 3em;
}
#spec-weapon {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px;
}
#spec-weapon .wglyph {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--neon-cyan); text-shadow: 0 0 10px currentColor;
  border: 1px solid var(--glass-border); border-radius: 8px;
}
#spec-weapon .wlabel { color: var(--text-dim); font-size: 11.5px; letter-spacing: 0.15em; }
#spec-stats { display: flex; flex-direction: column; gap: 7px; }
.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-row .sk {
  width: 44px; font-size: 12px; letter-spacing: 0.18em; color: var(--text-dim);
  flex-shrink: 0;
}
.stat-row .sbar {
  display: block;
  flex: 1; height: 9px; border-radius: 5px;
  background: rgba(61, 242, 255, 0.08);
  border: 1px solid rgba(61, 242, 255, 0.15);
  overflow: hidden;
}
.stat-row .sfill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-violet));
  box-shadow: 0 0 10px rgba(61, 242, 255, 0.6);
  border-radius: 5px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-row.gold .sfill { background: linear-gradient(90deg, var(--neon-gold), #ff9f40); box-shadow: 0 0 10px rgba(255, 216, 74, 0.6); }
#spec-tags { display: flex; gap: 8px; flex-wrap: wrap; min-height: 24px; }
.spec-tag {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em;
  padding: 4px 12px; border-radius: 999px;
  color: var(--neon-gold);
  border: 1px solid rgba(255, 216, 74, 0.45);
}
#btn-ship-action { min-width: 0; margin-top: auto; }
#btn-ship-action.poor { opacity: 0.45; }
#hangar-thumbs {
  display: flex; gap: 12px;
  align-items: center;
  max-width: 96vw;
  overflow-x: auto;
  padding: 4px 12px;
  scrollbar-width: none;
}
#hangar-thumbs::-webkit-scrollbar { display: none; }
#hangar-thumbs .sect-head {
  flex-basis: auto;
  flex-shrink: 0;
  writing-mode: vertical-rl;
  letter-spacing: 0.18em;
  margin: 0 2px;
  font-size: 13px;
}
#hangar-thumbs .sect-head .sect-em { writing-mode: horizontal-tb; margin-bottom: 6px; }
.ship-thumb {
  width: 92px;
  padding: 10px 6px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: 12px; cursor: pointer;
  background: var(--glass);
  border: 1.5px solid var(--glass-border);
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.16s, box-shadow 0.16s;
}
.ship-thumb:hover { transform: translateY(-4px); }
.ship-thumb.viewing { border-color: rgba(61, 242, 255, 0.7); box-shadow: 0 0 18px rgba(61, 242, 255, 0.25); }
.ship-thumb.equipped { border-color: rgba(255, 216, 74, 0.8); box-shadow: 0 0 18px rgba(255, 216, 74, 0.25); }
.ship-thumb canvas { width: 56px; height: 56px; }
.ship-thumb .tname {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; color: var(--text-dim);
}
.ship-thumb.locked canvas { filter: grayscale(0.55) brightness(0.6); }
.ship-thumb .tlock {
  font-family: var(--font-display); font-size: 10px;
  color: var(--neon-gold);
}
@media (max-width: 820px) {
  #hangar-main { flex-direction: column; }
  #hangar-preview { max-width: 320px; }
}

/* —— Toast / 橫幅 —— */
#toasts {
  position: fixed; bottom: 13vh; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 8px;
  z-index: 8; pointer-events: none;
  align-items: center;
}
.toast {
  padding: 9px 22px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.12em;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.4s ease-in 2.2s forwards;
  white-space: nowrap;
}
.toast.gold { color: var(--neon-gold); border-color: rgba(255, 216, 74, 0.45); }
.toast.danger {
  color: var(--neon-red); border-color: rgba(255, 77, 109, 0.55);
  font-family: var(--font-display); font-size: 17px; letter-spacing: 0.3em;
  box-shadow: 0 0 30px rgba(255, 77, 109, 0.35);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* —— 動態偏好 —— */
@media (prefers-reduced-motion: reduce) {
  .card::after { animation: none; }
  .title-en { animation: none; }
  .screen { animation: none; }
}

/* —— 窄屏 / 手機 —— */
@media (max-width: 760px) {
  #cards { flex-direction: column; gap: 8px; }
  .card { width: min(86vw, 330px); min-height: 0; padding: 12px 16px; }
  .card .glyph { font-size: 30px; margin-top: 8px; }
  .card .cdesc { min-height: 0; font-size: 12px; }
  .levelup-title { font-size: 22px; }
  #hpbar { width: 78px; height: 14px; }
  #hud-top { top: calc(10px + env(safe-area-inset-top)); left: 8px; right: 8px; }
  #hud-left { padding: 6px 8px; gap: 6px; }
  #hptext { font-size: 9.5px; }
  #lv-badge { font-size: 12.5px; }
  #timer { font-size: 19px; padding: 5px 14px; }
  #hud-right { padding: 7px 10px; }
  #kills, #coins { font-size: 12.5px; }
  #hud-bottom {
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 8px; right: 8px;
  }
  .slot-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 7px; }
  #combo { right: 2vw; top: 30vh; }
  #combo #combo-num { font-size: 26px !important; }
  #bossbar-wrap { width: 72vw; }
  .btn { min-width: 200px; padding: 12px 30px; font-size: 15px; }
  .menu-row { flex-wrap: wrap; justify-content: center; max-width: 92vw; }
  .menu-row .btn.half { min-width: 0; flex: 1 1 40%; padding: 11px 8px; }
  .title-zh { font-size: clamp(52px, 16vw, 80px); }
  .title-en { font-size: 10px; letter-spacing: 0.34em; text-indent: 0.34em; }
  .title-logo::before { width: 320px; height: 320px; }
  .title-logo::after { width: 264px; height: 264px; }
  .controls-hint { font-size: 11px; bottom: calc(2vh + env(safe-area-inset-bottom)); padding: 0 16px; text-align: center; }
  #levelup-tools .btn.small { padding: 9px 14px; }
  .overstats { gap: 6px 22px; padding: 14px 22px; font-size: 13.5px; }
  #over-dmg { padding: 10px 14px; }
  #hangar-main { flex-direction: column; gap: 10px; }
  #hangar-preview { max-width: min(300px, 34vh); }
  .ship-thumb { width: 72px; padding: 7px 4px 6px; }
  .ship-thumb canvas { width: 42px; height: 42px; }
}

/* ═══════════ M16-P1:登錄 / 道號 / 階段甦醒 ═══════════ */
/* 登錄覆蓋層 */
#screen-login { z-index: 40; display: flex; align-items: center; justify-content: center; }
#screen-login.hidden { display: none; }
.login-box {
  width: min(90vw, 380px);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 34px 28px 28px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: 0 20px 70px rgba(0,0,0,0.6), inset 0 0 50px rgba(232,195,106,0.05);
  backdrop-filter: blur(8px);
}
.login-seal {
  width: 60px; height: 60px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 26px; font-weight: 900; color: var(--ink-gold);
  border: 2px solid var(--ink-gold); border-radius: 50%;
  text-shadow: 0 0 16px rgba(232,195,106,0.6); box-shadow: 0 0 24px rgba(232,195,106,0.25);
}
.login-title { font-family: var(--font-display); font-size: 24px; font-weight: 900; letter-spacing: 0.3em; text-indent: 0.3em; color: var(--ink-gold); }
.login-sub { font-size: 12px; letter-spacing: 0.08em; color: var(--text-dim); text-align: center; }
#login-name {
  width: 100%; padding: 13px 16px; text-align: center;
  font-family: var(--font-display); font-size: 18px; letter-spacing: 0.1em;
  color: #fff; background: rgba(0,0,0,0.4);
  border: 1px solid var(--glass-border); border-radius: 10px; outline: none;
}
#login-name:focus { border-color: var(--ink-gold); box-shadow: 0 0 0 3px rgba(232,195,106,0.18); }
.login-box .btn.primary { width: 100%; }
.login-hint { font-size: 11px; color: var(--neon-red, #ff6b6b); min-height: 14px; }
/* 標題道號條 */
.title-name {
  position: absolute; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  font-size: 12.5px; letter-spacing: 0.1em; color: var(--text-dim); white-space: nowrap;
}
.title-name b { color: var(--ink-gold); font-weight: 700; }
.title-name .tn-phase { color: var(--text-dim); opacity: 0.85; }
/* 機庫未甦醒提示 */
.sect-head.locked-head { color: var(--text-dim); opacity: 0.7; }
.hangar-locktip { flex-basis: 100%; font-size: 11px; color: var(--text-dim); opacity: 0.6; padding: 2px 4px 8px; letter-spacing: 0.06em; }
/* 甦醒儀式覆蓋層 */
.awaken-overlay {
  --ac: #e8c36a;
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,6,14,0.82); backdrop-filter: blur(6px);
  animation: awakenFade 0.4s ease;
}
@keyframes awakenFade { from { opacity: 0; } to { opacity: 1; } }
.awaken-box {
  width: min(88vw, 420px); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 40px 30px 30px;
  background: radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--ac) 14%, transparent), transparent 60%), var(--glass);
  border: 1px solid color-mix(in srgb, var(--ac) 45%, transparent); border-radius: 20px;
  box-shadow: 0 0 60px color-mix(in srgb, var(--ac) 30%, transparent);
  animation: awakenRise 0.5s cubic-bezier(0.16,1,0.3,1);
}
@keyframes awakenRise { from { transform: translateY(30px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.awaken-em {
  width: 86px; height: 86px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 46px; font-weight: 900; color: var(--ac);
  border: 2px dashed color-mix(in srgb, var(--ac) 60%, transparent); border-radius: 50%;
  text-shadow: 0 0 20px var(--ac), 0 0 44px color-mix(in srgb, var(--ac) 55%, transparent);
  animation: sovSpin 18s linear infinite;
}
.awaken-kicker { font-size: 12px; letter-spacing: 0.3em; text-indent: 0.3em; color: var(--text-dim); }
.awaken-title { font-family: var(--font-display); font-size: 30px; font-weight: 900; letter-spacing: 0.2em; text-indent: 0.2em; color: var(--ac); text-shadow: 0 0 18px color-mix(in srgb, var(--ac) 55%, transparent); }
.awaken-sub { font-size: 13px; line-height: 1.6; color: var(--text); opacity: 0.9; }
.awaken-ok { margin-top: 8px; min-width: 140px; }

/* ═══════════ M16-P2/P3:元素志 ═══════════ */
.elem-codex .elem-codex-body {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  padding: 10px 6px 4px;
}
.elem-wheel-img {
  width: min(260px, 38vw); height: auto;
  filter: drop-shadow(0 0 18px rgba(232, 195, 106, 0.18));
}
.elem-legend { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 7px; }
.el-rule { font-size: 12.5px; color: var(--text-dim); display: flex; gap: 8px; align-items: baseline; }
.el-rule b { flex-shrink: 0; min-width: 64px; font-weight: 800; }
.el-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.el-chip {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 900;
  border: 1.4px solid; border-radius: 8px;
  text-shadow: 0 0 10px currentColor;
}
@media (max-width: 700px) {
  .elem-codex .elem-codex-body { gap: 12px; }
  .elem-wheel-img { width: min(200px, 60vw); margin: 0 auto; }
}
