:root {
  --bg: #0b0818;
  --panel: rgba(18, 12, 36, 0.9);
  --border: #ff8ec6;
  --cyan: #67f0ff;
  --gold: #ffe066;
  --pink: #ff629c;
  --violet: #b98aff;
  --text: #fff7fc;
  --muted: #b9aad6;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #070511;
  color: var(--text);
  font-family: "Consolas", "PingFang SC", "Microsoft YaHei", monospace;
}

#app {
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

#gl-canvas, #game-canvas {
  touch-action: none;
}

/* Unified Single-Frame Game + Live Portrait & RPG Equipment Interface */
.game-frame {
  position: relative;
  width: min(100%, 1540px);
  height: min(100%, 920px);
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 3px solid rgba(255, 148, 206, 0.72);
  box-shadow: 0 0 0 3px #140c29, 0 0 42px rgba(180, 92, 255, 0.28);
  background: var(--bg);
  overflow: hidden;
}

#game-shell {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

/* Integrated Live Character Portrait & RPG Equipment Wing (seamlessly fused inside unified game frame!) */
.portrait-dock {
  width: clamp(340px, 28vw, 420px);
  flex: 0 0 clamp(340px, 28vw, 420px);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1.5px solid rgba(255, 168, 220, 0.32);
  background: linear-gradient(180deg, rgba(24, 14, 46, 0.96) 0%, #090616 42%, #05030c 100%);
  box-shadow: inset 1px 0 22px rgba(103, 210, 255, 0.12);
  overflow: hidden;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.portrait-dock.is-3d {
  border-left-color: rgba(255, 112, 216, 0.65);
  box-shadow: inset 0 0 28px rgba(255, 112, 216, 0.18);
}
.portrait-dock.is-smug {
  border-left-color: #ff6eb4;
  box-shadow: inset 0 0 32px rgba(255, 110, 180, 0.30);
}
.portrait-dock.is-happy {
  border-left-color: #5cf2a9;
  box-shadow: inset 0 0 30px rgba(92, 242, 169, 0.26);
}
.portrait-dock.is-low {
  border-left-color: #fb923c;
  box-shadow: inset 0 0 28px rgba(251, 146, 60, 0.26);
}
.portrait-dock.is-skill {
  border-left-color: var(--gold);
  box-shadow: inset 0 0 34px rgba(255, 224, 102, 0.34);
}
.portrait-dock.is-hit {
  border-left-color: #ff2e63;
  box-shadow: inset 0 0 36px rgba(255, 46, 99, 0.44);
}
.portrait-dock.is-changing {
  border-left-color: #ff8ec6;
  box-shadow: inset 0 0 32px rgba(255, 142, 198, 0.32);
}
.portrait-dock.is-wasabi {
  border-left-color: #84ff3b;
  box-shadow: inset 0 0 32px rgba(132, 255, 59, 0.30);
}
.ds-atk.is-wasabi {
  border-color: #84ff3b;
  background: rgba(54, 118, 16, 0.38);
}
.ds-atk.is-wasabi b { color: #b4ff5c; }
.badge-atk.is-wasabi {
  color: #b4ff5c;
  border-color: #84ff3b;
  background: rgba(32, 82, 12, 0.9);
}

/* Integrated RPG Equipment Panel around Qiqi's Live Standing Portrait! */
.dock-top-rack {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}
.dock-subweapon-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  pointer-events: auto;
}
.sub-slot {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
  background: rgba(13, 9, 28, 0.84);
  border: 1.5px solid rgba(185, 138, 255, 0.28);
  color: rgba(205, 192, 232, 0.52);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}
.sub-slot .sub-ic { width: 22px; height: 22px; object-fit: contain; filter: grayscale(0.85) opacity(0.5); }
.sub-slot .sub-lv { font-size: 9.5px; font-weight: 900; }
.sub-slot.active {
  background: rgba(24, 16, 54, 0.92);
  border-color: rgba(103, 240, 255, 0.8);
  color: var(--cyan);
  box-shadow: inset 0 0 8px rgba(103, 240, 255, 0.18);
}
.sub-slot.active .sub-ic { filter: none; }
.sub-slot.maxed {
  background: rgba(58, 28, 48, 0.94);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 10px rgba(255, 224, 102, 0.32);
}
.sub-slot.maxed .sub-ic { filter: none; }
.si-wep-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.si-wep-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 7px;
  background: radial-gradient(circle, rgba(255, 224, 150, 0.18), rgba(10, 6, 24, 0.9));
  border: 1px solid rgba(255, 224, 138, 0.4);
  padding: 2px;
  flex-shrink: 0;
}
.px-skill-btn.charging {
  border-color: #ff70d8;
  background: linear-gradient(135deg, rgba(168, 24, 92, 0.95), rgba(56, 22, 118, 0.95));
  box-shadow: 0 0 16px rgba(255, 112, 216, 0.65);
}
.dock-buff-bar {
  padding: 4px 7px 5px;
  background: rgba(18, 44, 10, 0.92);
  border: 1.5px solid #84ff3b;
  box-shadow: 0 0 14px rgba(132, 255, 59, 0.35);
}
.buff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  font-weight: 900;
  color: #d4ff99;
  margin-bottom: 3px;
}
.buff-track {
  height: 5px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(163, 255, 77, 0.45);
  overflow: hidden;
}
.buff-fill {
  height: 100%;
  background: linear-gradient(90deg, #65e61c, #bef264, #ffe066);
  transition: width 0.08s linear;
}
.dock-equip-col {
  position: absolute;
  top: 54%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: auto;
}
.dock-equip-col.left { left: 7px; }
.dock-equip-col.right { right: 7px; }
.rpg-slot {
  width: 50px;
  height: 54px;
  padding: 3px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(22, 14, 46, 0.88) 0%, rgba(11, 7, 24, 0.92) 100%);
  border: 1.5px solid rgba(185, 138, 255, 0.62);
  box-shadow: inset 0 0 10px rgba(103, 210, 255, 0.14), 0 3px 8px rgba(0, 0, 0, 0.55);
  color: #fff;
  text-align: center;
  line-height: 1.05;
  transition: border-color 0.14s, transform 0.12s, box-shadow 0.14s;
}
.rpg-slot.clickable { cursor: pointer; }
.rpg-slot.clickable:hover {
  border-color: var(--gold);
  transform: scale(1.06);
  box-shadow: 0 0 12px rgba(255, 224, 102, 0.42);
}
.rpg-slot.empty {
  border-style: dashed;
  border-color: rgba(185, 138, 255, 0.34);
  background: rgba(12, 8, 26, 0.58);
  color: rgba(190, 178, 222, 0.48);
}
.rpg-slot.equipped {
  border-color: var(--cyan);
  box-shadow: inset 0 0 10px rgba(103, 240, 255, 0.24), 0 0 10px rgba(103, 240, 255, 0.22);
}
.rpg-slot.maxed {
  border-color: var(--gold);
  box-shadow: inset 0 0 10px rgba(255, 224, 102, 0.28), 0 0 12px rgba(255, 224, 102, 0.32);
}
.rpg-slot-tag {
  font-size: 8.5px;
  font-weight: 900;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.rpg-slot.equipped .rpg-slot-tag { color: var(--cyan); }
.rpg-slot.maxed .rpg-slot-tag { color: var(--gold); }
.rpg-slot-ic { font-size: 18px; line-height: 1; }
.rpg-slot.empty .rpg-slot-ic { font-size: 15px; opacity: 0.38; filter: grayscale(0.7); }
.rpg-slot-val {
  font-size: 9px;
  font-weight: 900;
  color: #fff6d6;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rpg-slot.empty .rpg-slot-val { color: rgba(185, 172, 215, 0.45); font-weight: 700; }
.dock-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: linear-gradient(180deg, rgba(16, 10, 34, 0.92), rgba(16, 10, 34, 0.55));
  border-bottom: 1px solid rgba(255, 168, 220, 0.22);
}
.dock-title { font-size: 12px; font-weight: 900; color: var(--cyan); letter-spacing: 0.06em; }
.dock-close-btn {
  width: 22px; height: 22px; background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 190, 230, 0.4); color: #fff; font-size: 11px; cursor: pointer;
}
.dock-close-btn:hover { border-color: var(--gold); color: var(--gold); }
.dock-art-stage {
  position: relative;
  flex: 1 1 0%;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.dock-paperdoll {
  position: relative;
  width: 100%;
  height: 100%;
  animation: dockFloat 4.2s ease-in-out infinite;
  transition: transform 0.14s ease-out;
}
.dock-paperdoll-zoom {
  position: absolute;
  inset: -6px -18px -6px;
}
.dock-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  opacity: 0;
  pointer-events: none;
}
.dock-portrait-img { mix-blend-mode: lighten; z-index: 1; }
.dock-weapon-img { z-index: 2; opacity: 0; transition: opacity 0.14s ease-out; }
.dock-weapon-img.active { opacity: 1; }
.dock-outfit-img { z-index: 3; transition: opacity 0.14s ease-out; }
.dock-acc-img { z-index: 4; opacity: 0; transition: opacity 0.14s ease-out; }
.dock-acc-img.active { opacity: 1; }
.dock-layer.active { opacity: 1; }
.dock-paperdoll.is-solar-aura .dock-outfit-img.active {
  filter: drop-shadow(0 0 12px rgba(255, 224, 102, 0.78)) saturate(1.14) brightness(1.06);
}
.portrait-dock.is-skill .dock-paperdoll { transform: scale(1.05); }
.portrait-dock.is-hit .dock-paperdoll { transform: translateX(-5px) scale(0.97); filter: brightness(1.16); }
/* Shrine Fitting-Room Curtain Animation (~2.0s Draw -> Change Behind Curtain -> Open Reveal!) */
.fitting-curtain {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  overflow: hidden;
  visibility: hidden;
}
.fitting-curtain.is-active {
  visibility: visible;
}
.curtain-rod {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 11px;
  z-index: 4;
  background: linear-gradient(180deg, #5e2414 0%, #9b4b22 45%, #3d140a 100%);
  border-bottom: 2px solid #ffd466;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  opacity: 0;
  transform: translateY(-100%);
  transition: transform 0.22s ease-out, opacity 0.22s ease-out;
}
.fitting-curtain.is-active .curtain-rod {
  opacity: 1;
  transform: translateY(0);
}
.curtain-ring {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #ffe066;
  background: #421226;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.curtain-panel {
  position: absolute;
  top: 8px;
  bottom: 0;
  width: 52%;
  z-index: 2;
  background:
    repeating-linear-gradient(
      90deg,
      #3b0a1f 0px,
      #6e1639 11px,
      #96244f 20px,
      #59112f 29px,
      #2d0717 38px
    );
  box-shadow: inset 0 14px 26px rgba(0, 0, 0, 0.52), 0 0 22px rgba(0, 0, 0, 0.72);
  will-change: transform;
  transition: transform 0.44s cubic-bezier(0.24, 0.85, 0.34, 1);
}
.curtain-left {
  left: 0;
  border-right: 2.5px solid #ffd466;
  transform: translateX(-106%);
}
.curtain-right {
  right: 0;
  border-left: 2.5px solid #ffd466;
  transform: translateX(106%);
}
.curtain-hem {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  height: 16px;
  border-top: 2px solid rgba(255, 224, 102, 0.78);
  border-bottom: 2px solid rgba(255, 224, 102, 0.78);
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 224, 102, 0.24) 0px,
    rgba(255, 224, 102, 0.24) 6px,
    transparent 6px,
    transparent 12px
  );
}
.fitting-curtain.phase-close .curtain-left,
.fitting-curtain.phase-change .curtain-left {
  transform: translateX(0%);
}
.fitting-curtain.phase-close .curtain-right,
.fitting-curtain.phase-change .curtain-right {
  transform: translateX(0%);
}
.fitting-curtain.phase-change .curtain-left {
  animation: curtainRustleL 0.46s ease-in-out infinite alternate;
}
.fitting-curtain.phase-change .curtain-right {
  animation: curtainRustleR 0.46s ease-in-out infinite alternate;
}
.fitting-curtain.phase-open .curtain-left {
  transform: translateX(-106%);
  transition: transform 0.50s cubic-bezier(0.55, 0.08, 0.32, 1);
}
.fitting-curtain.phase-open .curtain-right {
  transform: translateX(106%);
  transition: transform 0.50s cubic-bezier(0.55, 0.08, 0.32, 1);
}
@keyframes curtainRustleL {
  0% { transform: translateX(0%) skewX(0deg); }
  50% { transform: translateX(-1.5%) skewX(-1.1deg); }
  100% { transform: translateX(0.6%) skewX(0.8deg); }
}
@keyframes curtainRustleR {
  0% { transform: translateX(0%) skewX(0deg); }
  50% { transform: translateX(1.5%) skewX(1.1deg); }
  100% { transform: translateX(-0.6%) skewX(-0.8deg); }
}
.curtain-sign {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  transform: translate(-50%, -50%) scale(0.75);
  min-width: 152px;
  padding: 10px 14px;
  text-align: center;
  background: linear-gradient(180deg, rgba(30, 11, 42, 0.95), rgba(16, 7, 26, 0.96));
  border: 2px solid #ffe066;
  box-shadow: 0 0 0 3px #400d24, 0 8px 24px rgba(0, 0, 0, 0.72);
  opacity: 0;
  transition: opacity 0.22s ease-out, transform 0.24s cubic-bezier(0.22, 1.35, 0.36, 1);
}
.fitting-curtain.phase-change .curtain-sign {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: signFloat 0.72s ease-in-out infinite alternate;
}
@keyframes signFloat {
  0% { transform: translate(-50%, -50%) rotate(-1.5deg) scale(1); }
  100% { transform: translate(-50%, -53%) rotate(1.5deg) scale(1.03); }
}
.curtain-sign-icon { font-size: 22px; line-height: 1.1; margin-bottom: 3px; }
.curtain-sign-title { font-size: 12px; font-weight: 900; color: #ffe066; letter-spacing: 0.08em; }
.curtain-sign-sub { font-size: 10.5px; font-weight: 800; color: #ffb8dc; margin-top: 3px; }
.curtain-reveal-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: radial-gradient(circle at 50% 48%, rgba(255, 246, 196, 0.72) 0%, rgba(255, 138, 198, 0.28) 45%, transparent 74%);
  opacity: 0;
  pointer-events: none;
}
.fitting-curtain.phase-open .curtain-reveal-flash {
  animation: revealBloom 0.56s ease-out forwards;
}
@keyframes revealBloom {
  0% { opacity: 0.95; transform: scale(0.86); }
  100% { opacity: 0; transform: scale(1.18); }
}
.dock-bubble {
  position: absolute;
  top: 52px;
  right: 10px;
  z-index: 7;
  max-width: calc(100% - 20px);
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #24092c;
  background: #fff9fd;
  border: 2.5px solid #ff5c9c;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 110, 180, 0.45);
  pointer-events: none;
}
.dock-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 24px;
  border-width: 8px 7px 0 7px;
  border-style: solid;
  border-color: #ff5c9c transparent transparent transparent;
}
.dock-bubble.is-smug {
  background: linear-gradient(135deg, #fff2f8, #ffd6ec);
  border-color: #ff3b8d;
  color: #b80f5a;
}
.dock-bubble.is-happy {
  background: linear-gradient(135deg, #f2fffb, #d2f6ff);
  border-color: #22d3ee;
  color: #0e4c75;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.5), 0 0 14px rgba(103, 240, 255, 0.45);
}
.dock-bubble.is-happy::after { border-color: #22d3ee transparent transparent transparent; }
.dock-bubble.pop { animation: bubblePop 0.26s cubic-bezier(0.22, 1.45, 0.36, 1) both; }
@keyframes bubblePop {
  0% { opacity: 0; transform: scale(0.55) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes dockFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.dock-footer {
  flex-shrink: 0;
  padding: 7px 9px 8px;
  background: rgba(12, 8, 28, 0.94);
  border-top: 2px solid rgba(103, 210, 255, 0.35);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.dock-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.dock-outfit { font-size: 12px; font-weight: 900; color: var(--gold); }
.dock-pill { font-size: 10px; font-weight: 800; padding: 1px 5px; color: var(--cyan); border: 1px solid rgba(103, 240, 255, 0.55); background: rgba(16, 46, 72, 0.72); }
.portrait-dock.is-3d .dock-pill { color: #ffc7f4; border-color: #ff70d8; background: rgba(88, 18, 72, 0.8); }
.dock-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.ds-cell {
  display: flex;
  flex-direction: column;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.16);
  line-height: 1.2;
}
.ds-cell span { font-size: 9.5px; color: var(--muted); }
.ds-cell b { font-size: 11px; font-weight: 900; }
.ds-hp { border-color: rgba(255, 96, 152, 0.5); }
.ds-hp b { color: #ff8fb8; }
.ds-atk { border-color: rgba(255, 212, 71, 0.55); }
.ds-atk b { color: var(--gold); }
.ds-shd { border-color: rgba(103, 240, 255, 0.45); }
.ds-shd b { color: var(--cyan); }
.portrait-dock.is-preview .ds-cell { background: rgba(255, 224, 102, 0.12); border-color: rgba(255, 224, 102, 0.65); }
.dock-dialogue { font-size: 11px; color: #f2e8ff; line-height: 1.4; min-height: 28px; }

#gl-canvas, #game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#gl-canvas {
  z-index: 1;
  pointer-events: none;
}

#game-canvas {
  z-index: 2;
  touch-action: none;
  cursor: crosshair;
}

.mono { font-family: ui-monospace, "Consolas", monospace; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.hud-layer { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 10; }

/* Top HUD */
#hud-top {
  top: 0;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  background: linear-gradient(180deg, rgba(10, 6, 22, 0.86) 0%, rgba(10, 6, 22, 0) 100%);
}

.hud-left-wrap { display: flex; align-items: flex-start; gap: 8px; }
.avatar-frame {
  width: 56px; height: 56px; flex-shrink: 0;
  background: rgba(18, 10, 38, 0.9);
  border: 2px solid var(--border);
  box-shadow: 0 0 0 2px #120826, 0 4px 14px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: border-color 0.12s, transform 0.1s;
}
.avatar-frame.hit { border-color: #ff2e63; transform: scale(0.92); }
#hud-avatar { width: 100%; height: 100%; display: block; object-fit: cover; }
.hud-left { display: flex; flex-direction: column; gap: 4px; }
.score-row { display: flex; align-items: baseline; gap: 7px; }
.px-label { font-size: 10px; color: var(--muted); letter-spacing: 0.12em; }
.px-score { font-size: 20px; font-weight: 900; color: #fff; text-shadow: 2px 2px 0 #38144a; }
.px-points { font-size: 16px; font-weight: 900; color: var(--gold); text-shadow: 2px 2px 0 #38144a; }
.stage-tag { border-color: var(--cyan); color: var(--cyan); background: rgba(14, 42, 62, 0.88); }
.score-mini { font-size: 10px; color: var(--muted); text-align: right; letter-spacing: 0.06em; }

.xp-line { display: flex; align-items: center; gap: 6px; }
.px-tag { font-size: 10px; font-weight: 900; padding: 1px 5px; border: 1.5px solid var(--gold); color: var(--gold); background: rgba(44, 24, 10, 0.8); }
.xp-track { width: 132px; height: 8px; }
.xp-num { font-size: 10px; color: var(--gold); }

.meta-row { display: flex; flex-wrap: wrap; gap: 5px; }
.px-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  background: rgba(20, 12, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.badge-biome { color: #ffb8d6; border-color: rgba(255, 160, 205, 0.6); }
.badge-outfit { color: var(--gold); border-color: rgba(255, 224, 102, 0.65); }
.badge-view { color: var(--cyan); border-color: rgba(103, 240, 255, 0.65); }
.badge-view.is-3d { color: #ffc7f4; background: rgba(88, 18, 72, 0.9); border-color: #ff70d8; }
.badge-combo { color: #fff; background: #c9266d; border-color: #ffe066; }
.badge-fire { color: #e2d5fa; border-color: rgba(255, 255, 255, 0.3); }
.badge-fire.is-auto { color: #5cf2a9; border-color: rgba(92, 242, 169, 0.7); background: rgba(16, 62, 46, 0.85); }
.badge-diff-play { color: #5cf2a9; border-color: rgba(92, 242, 169, 0.72); background: rgba(16, 62, 46, 0.85); }
.badge-diff-real { color: #ff85a8; border-color: #ff477e; background: rgba(78, 12, 36, 0.9); }

.hud-right { display: flex; align-items: flex-start; gap: 7px; }
.bars-stack { display: flex; flex-direction: column; gap: 4px; width: 136px; }
.bar-line { display: flex; align-items: center; gap: 5px; }
.bar-tag { font-size: 10px; font-weight: 900; width: 24px; text-align: right; }
.hp-tag { color: #ff7ba8; }
.sh-tag { color: var(--cyan); }

.px-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(12, 8, 24, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.px-bar-fill { height: 100%; transition: width 0.1s linear; }
.hp-fill { background: #ff477e; }
.sh-fill { background: #4be8ff; }
.xp-fill { background: #ffd447; }
.boss-fill { background: linear-gradient(90deg, #ff2a6d, #ff85b3, #ffe066); }

.mini-btns { display: flex; gap: 4px; pointer-events: auto; }
.px-icon-btn {
  width: 28px; height: 28px;
  background: rgba(22, 14, 46, 0.9);
  border: 2px solid rgba(255, 190, 230, 0.45);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.px-icon-btn:hover { border-color: var(--gold); background: rgba(54, 28, 92, 0.95); }

/* Active Build Strip */
#build-strip {
  top: 72px;
  left: 10px;
  right: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 310px;
}
.build-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  background: rgba(16, 10, 34, 0.82);
  border: 1.5px solid rgba(185, 138, 255, 0.55);
  color: #f3e8ff;
}
.build-pill.maxed { border-color: var(--gold); color: var(--gold); }

/* Boss HUD */
#boss-hud {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  width: min(86%, 430px);
  z-index: 12;
  pointer-events: none;
  background: rgba(28, 8, 36, 0.88);
  border: 2px solid #ff5784;
  padding: 6px 9px;
}
.tutorial-hud {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 500px);
  z-index: 13;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(36, 12, 46, 0.92), rgba(16, 8, 32, 0.92));
  border: 2px solid #ffe066;
  box-shadow: 0 0 0 2px #4a1030, 0 8px 24px rgba(0, 0, 0, 0.65);
  padding: 8px 12px;
  text-align: left;
}
.tut-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 4px;
}
.tut-badge {
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(255, 71, 126, 0.25);
  border: 1px solid #ff5c9c;
  color: #ffb8d6;
}
.tut-body {
  font-size: 11px;
  color: #f3e8ff;
  line-height: 1.55;
}
.tut-body b { color: var(--cyan); }
.tut-body em { color: #ffe066; font-style: normal; font-weight: 900; }
.boss-header { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 900; margin-bottom: 4px; }
#boss-name { color: #ffb3cc; }
.boss-res { color: var(--cyan); font-size: 10.5px; }
.boss-res.mode-3d { color: #ffa6f0; }
.boss-track { height: 9px; }

/* Banner */
#banner-toast {
  position: absolute;
  top: 25%;
  left: 0;
  right: 0;
  z-index: 15;
  pointer-events: none;
  text-align: center;
  padding: 10px 14px;
  background: rgba(24, 10, 44, 0.88);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--cyan);
}
#banner-toast.warn { background: rgba(58, 10, 28, 0.92); border-color: #ff477e; }
#banner-title { font-size: 20px; font-weight: 900; letter-spacing: 0.12em; color: #fff; text-shadow: 2px 2px 0 #260936; }
#banner-toast.warn #banner-title { color: #ff85a8; }
#banner-sub { font-size: 12px; color: #f1e3ff; margin-top: 2px; }

/* Bottom Controls */
#hud-bottom {
  bottom: 0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(0deg, rgba(10, 6, 22, 0.88) 0%, rgba(10, 6, 22, 0) 100%);
}

.dim-switcher {
  display: flex;
  gap: 5px;
  pointer-events: auto;
  background: rgba(16, 10, 34, 0.9);
  border: 2px solid rgba(255, 160, 215, 0.4);
  padding: 3px;
}
.px-switch-btn {
  background: transparent;
  border: 2px solid transparent;
  color: var(--muted);
  padding: 4px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
.px-switch-btn:hover { color: #fff; }
.sw-title { font-size: 12px; font-weight: 900; }
.sw-sub { font-size: 9.5px; opacity: 0.85; }
.px-switch-btn.active[data-mode="0"] { background: rgba(75, 232, 255, 0.22); border-color: var(--cyan); color: #fff; }
.px-switch-btn.active[data-mode="1"] { background: rgba(255, 98, 156, 0.25); border-color: #ff70d8; color: #fff; }

.bottom-right-actions { display: flex; gap: 6px; pointer-events: auto; }
.px-act-btn, .px-bomb-btn, .px-skill-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  border: 2px solid rgba(185, 138, 255, 0.7);
  background: rgba(34, 18, 68, 0.9);
}
.px-skill-btn { border-color: var(--cyan); background: linear-gradient(135deg, rgba(16, 76, 108, 0.95), rgba(88, 20, 102, 0.95)); color: #fff; }
.px-skill-btn.ready { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 224, 102, 0.45); }
.px-skill-btn.locked-2d, .px-skill-btn.cooldown { opacity: 0.58; border-color: rgba(180, 165, 210, 0.4); background: rgba(20, 12, 42, 0.88); }
.skill-ic { color: var(--gold); font-size: 14px; }
.px-bomb-btn { border-color: var(--gold); background: rgba(82, 24, 58, 0.9); }
.px-act-btn:hover, .px-bomb-btn:hover, .px-skill-btn:hover { filter: brightness(1.18); }
.bomb-ic { color: var(--gold); font-size: 15px; }
.bomb-num { padding: 0 5px; background: rgba(255, 224, 102, 0.25); color: var(--gold); }

/* Modals */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(8, 5, 18, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.px-modal {
  width: 100%;
  max-width: 560px;
  background: #140c2b;
  border: 3px solid var(--border);
  box-shadow: 0 0 0 3px #090514, 0 18px 46px rgba(0, 0, 0, 0.8);
  padding: 18px 16px;
  text-align: center;
}
.px-modal.compact { max-width: 400px; }
.px-modal.upgrade-modal { max-width: 650px; border-color: var(--gold); }
.px-modal.title-modal {
  max-width: 740px;
  display: grid;
  grid-template-columns: 205px 1fr;
  gap: 14px;
  align-items: stretch;
  padding: 15px 14px;
}
.title-hero-showcase {
  position: relative;
  border: 2px solid rgba(103, 224, 255, 0.55);
  background: radial-gradient(ellipse at 50% 24%, rgba(88, 178, 255, 0.22) 0%, #05030c 68%);
  overflow: hidden;
  min-height: 360px;
  box-shadow: inset 0 0 26px rgba(103, 210, 255, 0.16);
}
.title-paperdoll {
  position: absolute;
  inset: 2px 2px 22px;
}
.title-hero-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
}
.title-hero-img { mix-blend-mode: lighten; z-index: 1; }
.title-outfit-img { z-index: 3; opacity: 0; transition: opacity 0.14s ease-out; }
.title-outfit-img.active { opacity: 1; }
.title-acc-img { z-index: 4; opacity: 0; transition: opacity 0.14s ease-out; }
.title-acc-img.active { opacity: 1; }
.title-paperdoll.is-solar-aura .title-outfit-img.active {
  filter: drop-shadow(0 0 10px rgba(255, 224, 102, 0.8)) saturate(1.15);
}
.title-hero-caption {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 5;
  padding: 3px 6px;
  font-size: 10.5px;
  font-weight: 900;
  color: var(--gold);
  background: rgba(10, 6, 24, 0.88);
  border: 1px solid rgba(103, 240, 255, 0.45);
  text-align: center;
}
.title-main-col { display: flex; flex-direction: column; justify-content: center; }

.px-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border: 1.5px solid var(--cyan);
  color: var(--cyan);
  background: rgba(103, 240, 255, 0.12);
  margin-bottom: 8px;
}
.px-chip.gold { border-color: var(--gold); color: var(--gold); background: rgba(255, 224, 102, 0.14); }
.px-chip.danger { border-color: #ff5784; color: #ff8fb1; background: rgba(255, 87, 132, 0.16); }

.px-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 3px 3px 0 #d93879, -2px -2px 0 #3888ff;
  line-height: 1.15;
}
.px-subtitle { font-size: 12px; color: var(--muted); margin: 4px 0 10px; letter-spacing: 0.12em; }
.modal-heading { font-size: 20px; font-weight: 900; margin-bottom: 12px; color: #fff; }
.modal-tip { font-size: 12.5px; color: #dfd4f5; line-height: 1.75; margin-bottom: 16px; text-align: left; }

.outfit-picker { margin-bottom: 10px; }
.picker-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.picker-heading { font-size: 11px; color: var(--gold); font-weight: 800; }
.trial-toggles-wrap { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.trial-toggle {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800;
  color: #5cf2a9; background: rgba(16, 62, 46, 0.65); border: 1px solid rgba(92, 242, 169, 0.55);
  padding: 2px 6px; cursor: pointer;
}
.trial-toggle input { accent-color: #5cf2a9; cursor: pointer; }
.trial-toggle.acc-toggle {
  color: #ffb0cf; background: rgba(92, 16, 46, 0.72); border-color: rgba(255, 118, 174, 0.7);
}
.trial-toggle.acc-toggle input { accent-color: #ff5c9c; }
.outfit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.outfit-card[data-outfit="miko"] { grid-column: 1 / -1; padding: 5px 8px; }

.outfit-card {
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.18);
  padding: 7px 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.outfit-card:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 224, 102, 0.6); }
.outfit-card.active { border-color: var(--gold); background: rgba(255, 198, 92, 0.16); box-shadow: 0 0 12px rgba(255, 224, 102, 0.25); }
.outfit-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: 12px; }
.outfit-cost { font-size: 10px; font-weight: 900; color: var(--cyan); }
.outfit-card.active .outfit-cost { color: var(--gold); }
.outfit-desc { font-size: 10px; color: #d6c8ed; line-height: 1.32; }

/* Explicit Armor Stat Pills (HP / ATK / SHD / DEF) */
.si-stats { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0; }
.stat-pill {
  font-size: 10px; font-weight: 900; padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(10, 6, 24, 0.72);
}
.stat-hp { color: #ff8fb8; border-color: rgba(255, 102, 158, 0.65); background: rgba(88, 16, 48, 0.55); }
.stat-hp-down { color: #ff5c7c; border-color: #ff2e63; background: rgba(128, 12, 42, 0.78); }
.ds-hp.is-down { border-color: #ff2e63; background: rgba(128, 12, 42, 0.42); }
.ds-hp.is-down b { color: #ff5c7c; }
.stat-atk { color: var(--gold); border-color: rgba(255, 224, 102, 0.7); background: rgba(82, 54, 10, 0.55); }
.stat-shd { color: var(--cyan); border-color: rgba(103, 240, 255, 0.6); background: rgba(12, 48, 74, 0.55); }
.stat-def { color: #c4b5fd; border-color: rgba(196, 181, 253, 0.6); background: rgba(54, 24, 92, 0.55); }
.badge-atk { color: var(--gold); border-color: rgba(255, 224, 102, 0.75); background: rgba(68, 42, 10, 0.85); }
.bar-with-num { position: relative; height: 12px; }
.bar-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 900; color: #fff; text-shadow: 1px 1px 0 #140826; pointer-events: none;
}

.diff-picker { margin-bottom: 8px; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.diff-btn {
  text-align: left;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.diff-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(103, 240, 255, 0.55); }
.diff-btn.active[data-diff="play"] {
  border-color: #5cf2a9;
  background: rgba(18, 64, 48, 0.55);
  box-shadow: 0 0 12px rgba(92, 242, 169, 0.22);
}
.diff-btn.active[data-diff="real"] {
  border-color: #ff477e;
  background: rgba(82, 14, 40, 0.62);
  box-shadow: 0 0 12px rgba(255, 71, 126, 0.28);
}
.diff-top { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 900; }
.diff-tag { font-size: 9.5px; font-weight: 900; padding: 1px 5px; border: 1px solid rgba(255, 255, 255, 0.28); }
.diff-btn[data-diff="play"] .diff-tag { color: #5cf2a9; border-color: rgba(92, 242, 169, 0.65); }
.diff-btn[data-diff="real"] .diff-tag { color: #ff85a8; border-color: rgba(255, 71, 126, 0.72); }
.diff-sub { font-size: 9.8px; color: #d9cbed; line-height: 1.32; }

.stage-picker { margin-bottom: 10px; }
.stage-pills { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.stage-pill {
  padding: 5px 4px; font-size: 10.5px; font-weight: 800; color: #d6c8ed;
  background: rgba(255, 255, 255, 0.04); border: 1.5px solid rgba(255, 255, 255, 0.16); cursor: pointer;
}
.stage-pill:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.stage-pill.active { border-color: var(--cyan); background: rgba(75, 232, 255, 0.22); color: #fff; }

.controls-box {
  background: rgba(7, 4, 18, 0.78);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  padding: 8px 10px;
  font-size: 11.5px;
  color: #dfd4f5;
  line-height: 1.82;
  margin-bottom: 13px;
}

kbd {
  display: inline-block;
  padding: 0 5px;
  font-size: 10.5px;
  font-weight: 900;
  color: #fff;
  background: rgba(255, 110, 175, 0.25);
  border: 1.5px solid rgba(255, 165, 215, 0.55);
}

.start-actions { display: flex; flex-direction: column; gap: 8px; }
.px-primary-btn, .px-secondary-btn {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: 0.06em;
}
.px-primary-btn {
  background: linear-gradient(90deg, #ff5e9c, #ffb3d9, #67f0ff);
  color: #160622;
  border: 2px solid #ffffff;
}
.px-primary-btn:hover { filter: brightness(1.08); }
.px-secondary-btn {
  background: rgba(154, 100, 255, 0.2);
  color: #fff;
  border: 2px solid #b98aff;
}
.px-secondary-btn:hover { background: rgba(154, 100, 255, 0.34); }

.highscore-line { margin-top: 10px; font-size: 12px; color: var(--gold); }

/* Post-Stage 3-Tab Shop Modal (2-Column JRPG Full-Body 商人边苔熵 Showcase!) */
.px-modal.shop-modal {
  max-width: 920px;
  max-height: 92%;
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 14px;
  border-color: var(--gold);
  padding: 14px;
  text-align: left;
  overflow: hidden;
}
.shop-main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.shop-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 9px; }
.shop-title { font-size: 17px; font-weight: 900; color: #fff; margin-top: 2px; }
.shop-wallet {
  background: rgba(54, 30, 12, 0.85);
  border: 2px solid var(--gold);
  padding: 5px 12px;
  text-align: right;
  flex-shrink: 0;
}
.wallet-label { font-size: 10px; color: #f6dca2; }
.wallet-num { font-size: 18px; font-weight: 900; color: var(--gold); }

/* 商人边苔熵 Full-Body Standing Showcase Column */
.shop-merchant-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: radial-gradient(ellipse at 50% 35%, rgba(255, 224, 150, 0.16) 0%, rgba(42, 16, 56, 0.88) 58%, rgba(15, 8, 30, 0.96) 100%);
  border: 2px solid rgba(255, 186, 128, 0.62);
  box-shadow: inset 0 0 24px rgba(255, 148, 198, 0.16);
  overflow: hidden;
}
.merchant-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 295px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px 6px 4px;
  background: radial-gradient(ellipse at 50% 62%, rgba(255, 224, 175, 0.24) 0%, rgba(255, 130, 180, 0.08) 48%, transparent 76%);
  border-bottom: 1.5px solid rgba(255, 212, 120, 0.35);
  overflow: hidden;
}
.merchant-body-stack {
  position: absolute;
  inset: 8px 6px 4px;
  animation: merchantBob 2.8s ease-in-out infinite;
}
.shop-merchant-col.deal-pop .merchant-body-stack { animation: merchantJump 0.44s ease-out; }
.merchant-body-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.58));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease-out;
}
.merchant-body-img.active { opacity: 1; }
@keyframes merchantBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes merchantJump { 0% { transform: scale(1); } 40% { transform: translateY(-10px) scale(1.06); } 100% { transform: translateY(0) scale(1); } }
.merchant-dialog-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px;
  background: rgba(12, 7, 28, 0.88);
  border: 1.5px solid rgba(255, 148, 198, 0.5);
}
.merchant-name-row { display: flex; align-items: center; justify-content: space-between; gap: 5px; flex-wrap: wrap; }
.merchant-name { font-size: 12.5px; font-weight: 900; color: var(--gold); }
.merchant-mood-tag {
  font-size: 9.5px; font-weight: 900; padding: 1px 6px; border-radius: 99px;
  color: #3a0b1d; background: #ffd6e8; border: 1.5px solid #ff5c9c;
}
.merchant-speech { font-size: 11.5px; color: #fff4fa; line-height: 1.46; min-height: 48px; }
.merchant-expr-sticker {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 4;
  width: 56px;
  height: 48px;
  background: #fff9fa;
  border: 2px dashed #9d2440;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.merchant-expr-img {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.12s;
}
.merchant-expr-img.active { opacity: 1; }

.shop-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.shop-tab {
  flex: 1; padding: 7px 8px; font-size: 12.5px; font-weight: 900; color: var(--muted);
  background: rgba(255, 255, 255, 0.05); border: 2px solid rgba(255, 255, 255, 0.16); cursor: pointer;
}
.shop-tab:hover { color: #fff; }
.shop-tab.active { color: #fff; border-color: var(--cyan); background: rgba(75, 232, 255, 0.18); }

.shop-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  overflow-y: auto; flex: 1 1 auto; max-height: 390px; padding-right: 3px; margin-bottom: 10px;
}
.shop-item {
  display: flex; flex-direction: column; gap: 4px; padding: 9px 10px;
  background: #1b1138; border: 2px solid rgba(185, 138, 255, 0.45); color: var(--text); text-align: left;
}
.shop-item.equipped { border-color: #5cf2a9; background: rgba(18, 56, 46, 0.72); }
.shop-item.owned { border-color: var(--cyan); }
.shop-item.maxed { border-color: var(--gold); background: rgba(56, 30, 62, 0.75); }
.si-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.si-name { font-size: 13px; font-weight: 900; color: #fff; }
.si-lv { font-size: 10.5px; font-weight: 800; color: var(--gold); white-space: nowrap; }
.si-desc { font-size: 11px; color: #d6c9eb; line-height: 1.42; flex: 1; }
.si-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; gap: 6px; }
.si-tag { font-size: 10px; color: var(--cyan); font-weight: 800; }
.si-btn {
  padding: 4px 10px; font-size: 11.5px; font-weight: 900; cursor: pointer;
  border: 1.5px solid var(--gold); background: rgba(255, 212, 71, 0.2); color: var(--gold);
}
.si-btn:hover:not(:disabled) { background: rgba(255, 212, 71, 0.36); color: #fff; }
.si-btn.equip-btn { border-color: var(--cyan); background: rgba(103, 240, 255, 0.18); color: var(--cyan); }
.si-btn.active-btn { border-color: #5cf2a9; background: rgba(92, 242, 169, 0.22); color: #5cf2a9; }
.si-btn:disabled { opacity: 0.42; cursor: not-allowed; border-color: rgba(255, 255, 255, 0.2); color: #9c8fb8; background: transparent; }

.shop-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-top: 1.5px solid rgba(255, 255, 255, 0.16); padding-top: 10px;
}
.next-preview { font-size: 11.5px; color: #f1e3ff; line-height: 1.4; }
.shop-go-btn { width: auto; min-width: 175px; padding: 9px 16px; font-size: 13px; }
.px-chip.win { border-color: #5cf2a9; color: #5cf2a9; background: rgba(92, 242, 169, 0.16); }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 16px; }
.sum-cell {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sum-cell span { font-size: 11px; color: var(--muted); }
.sum-cell b { font-size: 17px; }
.c-gold { color: var(--gold); }

@media (max-width: 1024px) {
  .portrait-dock {
    width: clamp(256px, 33vw, 340px);
    flex: 0 0 clamp(256px, 33vw, 340px);
  }
  .rpg-slot { width: 42px; height: 48px; }
  .rpg-slot-ic { font-size: 15px; }
}
@media (max-width: 740px) {
  .px-modal.title-modal, .px-modal.shop-modal { grid-template-columns: 1fr; max-height: 94%; overflow-y: auto; }
  .title-hero-showcase { min-height: 240px; height: 255px; }
  .merchant-stage { min-height: 170px; max-height: 185px; }
  .title-hero-img { object-position: 50% 10%; }
}
@media (max-width: 580px) {
  #app { padding: 0; }
  .game-frame { width: 100%; height: 100%; border: none; box-shadow: none; }
  .outfit-grid, .shop-grid { grid-template-columns: 1fr; }
  .shop-footer { flex-direction: column; align-items: stretch; }
  .sw-sub { display: none; }
}


/* ==================== V19.0 SPLASH SCREEN, SEAMLESS IMAGE1->IMAGE2 TWIST & MAIN MENU ==================== */
.game-frame {
  position: relative;
}

.global-overlay {
  z-index: 95;
}

.px-ghost-btn {
  padding: 10px 14px;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 224, 150, 0.4);
  background: rgba(24, 14, 48, 0.72);
  color: #ffe8c8;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.15s ease, background 0.15s ease;
}
.px-ghost-btn:hover {
  transform: translateY(-1px);
  border-color: #ffe066;
  background: rgba(45, 24, 82, 0.9);
}

.px-danger-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 92, 130, 0.65);
  background: linear-gradient(180deg, rgba(160, 26, 62, 0.85), rgba(98, 14, 38, 0.92));
  color: #ffe4ec;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.14s ease;
}
.px-danger-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.14);
}
.px-danger-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.splash-screen {
  position: absolute;
  inset: 0;
  z-index: 65;
  overflow: hidden;
  border-radius: inherit;
  background: #140a28;
  transition: opacity 0.32s ease, transform 0.32s ease;
}
.splash-screen.hidden {
  display: none;
}

.splash-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform-origin: 50% 48%;
  will-change: transform;
}

.splash-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  user-select: none;
  pointer-events: none;
}

.splash-bg-1 {
  z-index: 1;
}

.splash-bg-2 {
  z-index: 2;
  opacity: 0;
  clip-path: polygon(112% 0, 125% 0, 112% 100%, 100% 100%);
  will-change: clip-path, opacity;
}

.splash-screen.twisting .splash-stage {
  animation: splashStageTwist 0.88s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.splash-screen.twisting .splash-bg-2 {
  opacity: 1;
  animation: splashBg2Reveal 0.48s cubic-bezier(0.16, 1, 0.3, 1) 0.12s forwards;
}

.splash-screen.revealed .splash-bg-2 {
  opacity: 1;
  clip-path: polygon(-5% 0, 105% 0, 105% 100%, -5% 100%);
}

@keyframes splashStageTwist {
  0%   { transform: scale(1) translate(0, 0) rotate(0deg); }
  16%  { transform: scale(1.036) translate(0, -2px) rotate(-0.15deg); }
  26%  { transform: scale(1.055) translate(-8px, 4px) rotate(-0.65deg); }
  34%  { transform: scale(1.052) translate(9px, -5px) rotate(0.6deg); }
  44%  { transform: scale(1.044) translate(-6px, 3px) rotate(-0.4deg); }
  54%  { transform: scale(1.032) translate(4px, -2px) rotate(0.25deg); }
  72%  { transform: scale(1.012) translate(-2px, 1px) rotate(-0.08deg); }
  100% { transform: scale(1) translate(0, 0) rotate(0deg); }
}

@keyframes splashBg2Reveal {
  0%   { clip-path: polygon(114% 0, 128% 0, 114% 100%, 100% 100%); }
  100% { clip-path: polygon(-6% 0, 118% 0, 106% 100%, -18% 100%); }
}

.splash-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 220, 245, 0) 48%, rgba(16, 7, 36, 0.56) 100%),
    linear-gradient(180deg, rgba(16, 8, 36, 0.28) 0%, rgba(16, 8, 36, 0) 18%, rgba(16, 8, 36, 0) 64%, rgba(14, 6, 30, 0.62) 100%);
}

.splash-petals {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.splash-petal {
  position: absolute;
  top: -18px;
  width: 11px;
  height: 7px;
  border-radius: 70% 30% 70% 30% / 60% 40% 60% 40%;
  background: linear-gradient(135deg, #ffd1e8, #ff7eb8);
  box-shadow: 0 0 6px rgba(255, 162, 212, 0.6);
  opacity: 0.85;
  animation: splashPetalFall var(--dur, 7.5s) linear var(--delay, 0s) infinite;
}

@keyframes splashPetalFall {
  0% {
    transform: translate3d(0, -10px, 0) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.88; }
  90% { opacity: 0.78; }
  100% {
    transform: translate3d(var(--drift, -130px), 108vh, 0) rotate(540deg);
    opacity: 0;
  }
}

.splash-slash {
  position: absolute;
  top: -20%;
  bottom: -20%;
  right: -35%;
  width: 26%;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transform: skewX(-18deg);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 130, 200, 0.65) 35%,
    rgba(255, 248, 220, 0.96) 52%,
    rgba(255, 224, 102, 0.72) 68%,
    rgba(255, 255, 255, 0) 100%
  );
  filter: blur(2px);
}

.splash-screen.twisting .splash-slash {
  animation: splashSlashSweep 0.52s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

@keyframes splashSlashSweep {
  0%   { right: -28%; opacity: 0; }
  18%  { opacity: 1; }
  85%  { opacity: 0.95; }
  100% { right: 122%; opacity: 0; }
}

.splash-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 68% 36%, rgba(255, 252, 232, 0.92), rgba(255, 130, 196, 0.45) 55%, rgba(255, 255, 255, 0) 85%);
}

.splash-screen.twisting .splash-flash {
  animation: splashFlashPop 0.56s ease-out 0.18s forwards;
}

@keyframes splashFlashPop {
  0%   { opacity: 0; }
  22%  { opacity: 0.86; }
  100% { opacity: 0; }
}

.splash-ui {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 26px 26px;
  pointer-events: none;
}

.splash-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
}

.splash-ver-badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(18, 10, 38, 0.84);
  border: 1px solid rgba(255, 224, 138, 0.42);
  color: #ffe8a8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.splash-mute-btn {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 210, 235, 0.45);
  background: rgba(20, 10, 42, 0.86);
  color: #fff0f8;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.splash-mute-btn:hover {
  border-color: #ffe066;
  transform: translateY(-1px);
}

.splash-bottom-right {
  align-self: flex-end;
  width: min(390px, 44vw);
  min-width: 280px;
  margin-right: 12px;
  margin-bottom: 6px;
  pointer-events: auto;
}

/* Phase 1: Loader */
.splash-loader {
  background: rgba(16, 8, 36, 0.90);
  border: 1.5px solid rgba(255, 216, 132, 0.55);
  border-radius: 12px;
  padding: 13px 16px;
  box-shadow: 0 10px 28px rgba(8, 2, 24, 0.55);
}
.splash-loader.hidden { display: none; }

.splash-loader-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #ffeac2;
  margin-bottom: 8px;
}

.splash-loader-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  border: 1px solid rgba(255, 220, 150, 0.25);
}

.splash-loader-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff6ea8, #ffe066, #fff2b2);
  box-shadow: 0 0 12px rgba(255, 214, 102, 0.75);
  transition: width 0.12s linear;
}

/* Phase 2: Press Start Button */
.splash-press-wrap {
  display: flex;
  justify-content: flex-end;
}
.splash-press-wrap.hidden { display: none; }

.splash-start-btn {
  position: relative;
  width: 100%;
  padding: 15px 22px;
  border-radius: 14px;
  border: 2px solid #ffe066;
  background: linear-gradient(135deg, rgba(168, 28, 92, 0.92), rgba(74, 20, 112, 0.92));
  color: #fff9e6;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  box-shadow: 0 10px 30px rgba(255, 92, 156, 0.42), 0 0 22px rgba(255, 224, 102, 0.35);
  animation: splashStartPulse 2.1s ease-in-out infinite;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.splash-start-btn:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.1);
}
.splash-start-btn:active {
  transform: scale(0.98);
}

.ssb-main {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 8px rgba(32, 4, 34, 0.85);
}
.ssb-sub {
  font-size: 11px;
  font-weight: 700;
  color: #ffe49c;
  letter-spacing: 0.08em;
}

@keyframes splashStartPulse {
  0%, 100% { box-shadow: 0 10px 28px rgba(255, 92, 156, 0.38), 0 0 16px rgba(255, 224, 102, 0.28); }
  50%      { box-shadow: 0 12px 34px rgba(255, 92, 156, 0.62), 0 0 28px rgba(255, 224, 102, 0.62); }
}

/* Phase 3: 4-Option JRPG Main Menu */
.splash-menu {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.splash-menu.hidden { display: none; }

.menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 214, 138, 0.45);
  background: linear-gradient(135deg, rgba(24, 12, 48, 0.92), rgba(44, 18, 72, 0.90));
  color: #fff5fb;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(10, 4, 28, 0.48);
  opacity: 0;
  transform: translateX(26px);
  animation: menuBtnSlideIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--mi, 0) * 75ms) forwards;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.menu-btn-primary {
  border-color: #ffe066;
  background: linear-gradient(135deg, rgba(168, 28, 92, 0.92), rgba(84, 22, 118, 0.9));
  box-shadow: 0 8px 24px rgba(255, 92, 156, 0.38);
}

.menu-btn:hover:not(:disabled) {
  transform: translateX(-4px) scale(1.015);
  border-color: #ffe066;
  background: linear-gradient(135deg, rgba(140, 30, 96, 0.94), rgba(66, 22, 106, 0.92));
  box-shadow: 0 8px 24px rgba(255, 118, 180, 0.4);
}

.menu-btn:disabled {
  opacity: 0.48 !important;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.mb-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.mb-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.mb-text b {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fffaf0;
}
.mb-text small {
  font-size: 11px;
  color: #e6cce4;
}

.mb-arrow {
  font-size: 12px;
  color: #ffe066;
  opacity: 0.8;
}

@keyframes menuBtnSlideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== SETTINGS & CODEX MODALS ==================== */
.modal-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-x-btn {
  padding: 7px 13px;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 210, 230, 0.4);
  background: rgba(32, 16, 62, 0.85);
  color: #ffeaf5;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.modal-x-btn:hover {
  border-color: #ffe066;
  color: #ffe066;
}

.settings-modal {
  width: min(580px, 92vw);
  padding: 20px 22px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 214, 238, 0.16);
}

.setting-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.setting-label b {
  font-size: 13px;
  color: #fff4fa;
}
.setting-label small {
  font-size: 11px;
  color: #cbb5d9;
}

.setting-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.setting-ctrl input[type="range"] {
  width: 130px;
  accent-color: #ff7ab8;
  cursor: pointer;
}

.setting-val {
  min-width: 38px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: #ffe066;
}

.setting-seg {
  gap: 6px;
}

.seg-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 214, 238, 0.25);
  background: rgba(24, 12, 46, 0.8);
  color: #dfcce8;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.seg-btn.active {
  border-color: #ffe066;
  background: rgba(168, 32, 96, 0.85);
  color: #fff9e8;
}

.credits-box {
  margin-top: 14px;
  padding: 10px 13px;
  border-radius: 9px;
  background: rgba(255, 224, 102, 0.08);
  border: 1px solid rgba(255, 224, 102, 0.28);
  font-size: 11.5px;
  color: #f3dfb0;
  line-height: 1.5;
}

/* Codex Modal */
.codex-modal {
  width: min(820px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  padding: 18px 22px;
}

.codex-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.codex-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 210, 235, 0.25);
  background: rgba(26, 14, 52, 0.78);
  color: #e4d2ee;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.codex-tab.active {
  border-color: #ffe066;
  background: linear-gradient(135deg, rgba(160, 32, 94, 0.9), rgba(74, 22, 108, 0.9));
  color: #fff9ec;
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 58vh;
}

.codex-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 11px;
  background: rgba(24, 12, 46, 0.85);
  border: 1.5px solid rgba(255, 214, 238, 0.22);
}

.codex-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.codex-thumb {
  width: 58px;
  height: 58px;
  border-radius: 9px;
  background: radial-gradient(circle, rgba(255, 198, 232, 0.2), rgba(14, 6, 30, 0.9));
  border: 1px solid rgba(255, 224, 138, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 26px;
}
.codex-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.codex-thumb.hd-art img {
  object-fit: cover;
  object-position: top center;
  image-rendering: auto;
}
.codex-thumb.is-paperdoll {
  position: relative;
  width: 64px;
  height: 88px;
  background: radial-gradient(ellipse at 50% 30%, rgba(110, 175, 255, 0.22), #070412 78%);
}
.codex-thumb.is-paperdoll img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: auto;
}
.codex-thumb.is-paperdoll .codex-doll-base {
  mix-blend-mode: lighten;
  z-index: 1;
}
.codex-thumb.is-paperdoll .codex-doll-ov {
  z-index: 2;
}
.codex-thumb.is-paperdoll.is-solar-aura .codex-doll-ov {
  filter: drop-shadow(0 0 6px rgba(255, 224, 102, 0.85)) saturate(1.15);
}

/* Defeat Screen Full-Bleed Crying Qiqi Backdrop (left-aligned modal leaves Qiqi on right unobstructed!) */
.go-defeat-bg,
.go-defeat-scrim {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#overlay-gameover.is-defeat {
  justify-content: flex-start;
  padding-left: clamp(16px, 5vw, 72px);
  background: #120822;
}
#overlay-gameover.is-defeat .go-defeat-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  z-index: 0;
}
#overlay-gameover.is-defeat .go-defeat-scrim {
  display: block;
  z-index: 1;
  background: linear-gradient(90deg, rgba(16, 7, 30, 0.86) 0%, rgba(20, 10, 38, 0.62) 42%, rgba(20, 10, 38, 0.14) 68%, rgba(20, 10, 38, 0.03) 100%);
}
#overlay-gameover.is-defeat .go-modal-card {
  position: relative;
  z-index: 2;
  background: rgba(18, 10, 36, 0.82);
  border-color: rgba(255, 168, 212, 0.52);
  max-width: min(430px, 88vw);
  box-shadow: 0 12px 36px rgba(8, 3, 20, 0.72);
}
#overlay-gameover.is-defeat .start-actions {
  flex-direction: column;
  gap: 8px;
}
#overlay-gameover.is-defeat .start-actions button {
  width: 100%;
}

.codex-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.codex-name {
  font-size: 13.5px;
  font-weight: 900;
  color: #fff6fb;
}
.codex-tag {
  font-size: 11px;
  font-weight: 800;
  color: #ffe066;
}

.codex-desc {
  font-size: 11.5px;
  line-height: 1.48;
  color: #dfd0eb;
}

.setting-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 214, 238, 0.35);
  background: rgba(24, 12, 46, 0.92);
  color: #fff4fa;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.setting-select:focus {
  outline: none;
  border-color: #ffe066;
}
.setting-checks {
  gap: 10px;
}
.setting-chk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  color: #ffeaf5;
  cursor: pointer;
}
.setting-chk input {
  accent-color: #ff7ab8;
  cursor: pointer;
}

/* ==================== V20.0 DIFFICULTY SELECT MODAL & DEBUFF HUD ==================== */
.diff-select-modal {
  width: min(680px, 92vw);
  padding: 20px 24px 22px;
}

.diff-pick-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.diff-pick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 2px solid rgba(255, 214, 238, 0.35);
  background: linear-gradient(150deg, rgba(28, 14, 56, 0.92), rgba(50, 20, 82, 0.9));
  color: #fff6fb;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.diff-pick-card.play-card:hover {
  transform: translateY(-3px);
  border-color: #67f0ff;
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.32);
}

.diff-pick-card.real-card {
  border-color: rgba(255, 114, 152, 0.55);
  background: linear-gradient(150deg, rgba(58, 14, 42, 0.92), rgba(32, 12, 54, 0.92));
}
.diff-pick-card.real-card:hover {
  transform: translateY(-3px);
  border-color: #ffe066;
  box-shadow: 0 12px 28px rgba(255, 92, 142, 0.38);
}

.dpc-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.12);
  color: #ffe8a8;
}
.dpc-title {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
}
.dpc-pill {
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 800;
  background: rgba(103, 240, 255, 0.16);
  color: #a8f3ff;
}
.real-card .dpc-pill {
  background: rgba(255, 92, 138, 0.22);
  color: #ffc2d6;
}
.dpc-desc {
  font-size: 12px;
  line-height: 1.5;
  color: #e4d4f0;
  flex: 1;
}
.dpc-go {
  margin-top: 6px;
  width: 100%;
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 900;
  background: rgba(255, 224, 102, 0.16);
  border: 1px solid rgba(255, 224, 102, 0.5);
  color: #ffe89e;
}

.debuff-hud {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.debuff-hud.hidden {
  display: none;
}
.debuff-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(8, 2, 22, 0.55);
  animation: debuffPulse 0.9s ease-in-out infinite;
}
.debuff-pill.is-slow {
  background: rgba(14, 92, 148, 0.88);
  border: 1.5px solid #67f0ff;
}
.debuff-pill.is-poison {
  background: rgba(34, 98, 26, 0.88);
  border: 1.5px solid #a3ff47;
}
.debuff-pill.is-bind {
  background: rgba(126, 22, 110, 0.92);
  border: 1.5px solid #ffe066;
}
@keyframes debuffPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ==================== V21.0 LEFT-SIDE NEW HTS DISCOVERY TOAST & CODEX SKILL HIGHLIGHT ==================== */
.hts-discovery-toast {
  position: absolute;
  left: 14px;
  top: 132px;
  z-index: 34;
  width: min(304px, 42vw);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid #ffe066;
  background: linear-gradient(135deg, rgba(24, 10, 48, 0.94), rgba(68, 18, 72, 0.92));
  box-shadow: 0 10px 26px rgba(8, 2, 24, 0.62), 0 0 18px rgba(255, 224, 102, 0.28);
  cursor: pointer;
  pointer-events: auto;
  animation: hdtSlideIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.hts-discovery-toast:hover {
  transform: translateX(4px);
  filter: brightness(1.08);
}
.hts-discovery-toast.hidden {
  display: none;
}
@keyframes hdtSlideIn {
  from { opacity: 0; transform: translateX(-34px); }
  to   { opacity: 1; transform: translateX(0); }
}

.hdt-thumb {
  width: 56px;
  height: 56px;
  border-radius: 9px;
  background: radial-gradient(circle, rgba(255, 214, 240, 0.25), rgba(14, 6, 30, 0.92));
  border: 1.5px solid rgba(255, 224, 138, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.hdt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.hdt-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.hdt-badge {
  font-size: 10px;
  font-weight: 900;
  color: #ffe066;
  letter-spacing: 0.04em;
}
.hdt-name {
  font-size: 14px;
  font-weight: 900;
  color: #ffffff;
}
.hdt-skill {
  font-size: 11px;
  line-height: 1.35;
  color: #f0d8f8;
}
.hdt-cta {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 800;
  color: #67f0ff;
}

.codex-card.is-highlighted {
  border-color: #ffe066;
  box-shadow: 0 0 18px rgba(255, 224, 102, 0.35);
  background: linear-gradient(145deg, rgba(64, 18, 86, 0.94), rgba(26, 12, 52, 0.94));
}
.codex-card.is-discovered .codex-tag::after {
  content: " · ✓ 已遭遇";
  color: #5cf2a9;
}
.codex-skill-box {
  margin-top: 2px;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(255, 224, 102, 0.09);
  border: 1px solid rgba(255, 224, 102, 0.28);
  font-size: 11px;
  line-height: 1.45;
  color: #ffeec2;
}

/* ==================== V22.0 UNIFIED TUTORIAL CHECKLIST & BURN DEBUFF ==================== */
.tut-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tut-skip-btn {
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(255, 224, 138, 0.55);
  background: rgba(56, 22, 86, 0.88);
  color: #ffe8a8;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.tut-skip-btn:hover {
  border-color: #ffe066;
  background: rgba(140, 32, 92, 0.92);
}
.tut-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.tut-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 214, 238, 0.25);
  color: #f4e6ff;
}
.tut-item.done {
  background: rgba(22, 118, 76, 0.45);
  border-color: #5cf2a9;
  color: #b4ffdb;
}
.tut-hint {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: #ffe2f2;
}
.debuff-pill.is-burn {
  background: rgba(168, 42, 16, 0.92);
  border: 1.5px solid #ff9f43;
}
.demo-clear-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(92, 242, 169, 0.12);
  border: 1.5px solid rgba(92, 242, 169, 0.45);
  font-size: 11.5px;
  line-height: 1.55;
  color: #e6fff2;
  text-align: left;
}
.demo-clear-note b {
  color: #ffe066;
}

/* ==================== V26.1 MOBILE TOUCH CONTROLS & RESPONSIVE PHONE LAYOUT ==================== */
.px-modal, .shop-grid, .codex-grid, .settings-body {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.mobile-controls {
  position: absolute;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  touch-action: none;
  display: none;
}
body.is-touch .mobile-controls:not(.hidden) {
  display: block;
}
body.is-touch #hud-bottom {
  display: none;
}
body.is-touch #btn-lock {
  display: none;
}
body.is-touch #debuff-hud {
  bottom: 164px;
}

/* Left Virtual Joystick */
.touch-joy-zone {
  position: absolute;
  left: max(8px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: 168px;
  height: 168px;
  pointer-events: auto;
  touch-action: none;
}
.touch-joy-base {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118px;
  height: 118px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(103, 240, 255, 0.14) 0%, rgba(18, 10, 40, 0.56) 72%, rgba(255, 142, 198, 0.22) 100%);
  border: 2px solid rgba(255, 174, 224, 0.55);
  box-shadow: 0 0 22px rgba(103, 240, 255, 0.22), inset 0 0 18px rgba(255, 112, 216, 0.18);
  pointer-events: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.touch-joy-base.is-active {
  border-color: #67f0ff;
  box-shadow: 0 0 26px rgba(103, 240, 255, 0.45), inset 0 0 20px rgba(103, 240, 255, 0.26);
}
.joy-tick {
  position: absolute;
  font-size: 9px;
  color: rgba(255, 224, 246, 0.42);
  pointer-events: none;
}
.joy-up { top: 6px; left: 50%; transform: translateX(-50%); }
.joy-down { bottom: 6px; left: 50%; transform: translateX(-50%); }
.joy-left { left: 7px; top: 50%; transform: translateY(-50%); }
.joy-right { right: 7px; top: 50%; transform: translateY(-50%); }
.touch-joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #ffffff 0%, #ffd0ec 28%, #ff629c 72%, #8a2470 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 4px 16px rgba(255, 98, 156, 0.58), 0 0 10px rgba(255, 255, 255, 0.4);
  pointer-events: none;
  will-change: transform;
}

/* Right Action Buttons Cluster */
.touch-actions {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  touch-action: none;
}
.touch-sub-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  pointer-events: auto;
}
.touch-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 212, 238, 0.52);
  background: rgba(18, 10, 42, 0.80);
  color: #f4e6ff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 12px rgba(6, 2, 18, 0.55);
  touch-action: none;
  cursor: pointer;
}
.touch-pill.active {
  border-color: #5cf2a9;
  background: rgba(18, 86, 62, 0.88);
  color: #d8ffec;
  box-shadow: 0 0 12px rgba(92, 242, 169, 0.38);
}
.touch-pill.is-3d {
  border-color: #ff70d8;
  background: rgba(110, 22, 92, 0.88);
  color: #ffe2f8;
}
.touch-pill:active {
  transform: scale(0.94);
}
.touch-main-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}
.touch-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid rgba(255, 220, 242, 0.72);
  background: rgba(20, 11, 44, 0.82);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 4px 16px rgba(6, 2, 20, 0.62);
  touch-action: none;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.1s ease;
}
.touch-circle:active,
.touch-circle.is-pressed {
  transform: scale(0.91);
  filter: brightness(1.18);
}
.touch-circle .tc-ic {
  font-size: 19px;
  line-height: 1;
}
.touch-circle .tc-lbl {
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
.touch-ult {
  border-color: #67f0ff;
  background: radial-gradient(circle at 35% 30%, rgba(56, 189, 248, 0.56), rgba(14, 34, 72, 0.88));
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.38);
}
.touch-ult.is-reimu {
  border-color: #ff5c8a;
  background: radial-gradient(circle at 35% 30%, rgba(255, 42, 85, 0.62), rgba(74, 12, 36, 0.9));
  box-shadow: 0 0 16px rgba(255, 42, 85, 0.42);
}
.touch-ult.charging {
  border-color: #ffe066;
  box-shadow: 0 0 22px rgba(255, 224, 102, 0.78);
}
.touch-ult.cooldown {
  opacity: 0.52;
  filter: grayscale(0.45);
}
.touch-bomb {
  border-color: #ffe066;
  background: radial-gradient(circle at 35% 30%, rgba(255, 196, 62, 0.45), rgba(62, 28, 16, 0.88));
  box-shadow: 0 0 14px rgba(255, 224, 102, 0.34);
}
.touch-bomb.is-empty {
  opacity: 0.42;
  filter: grayscale(0.75);
}
.touch-fire {
  width: 74px;
  height: 74px;
  border-width: 2.5px;
  border-color: #ff9fd0;
  background: radial-gradient(circle at 35% 30%, rgba(255, 98, 156, 0.78), rgba(108, 18, 72, 0.92));
  box-shadow: 0 0 22px rgba(255, 98, 156, 0.52);
}
.touch-fire .tc-ic {
  font-size: 24px;
}
.touch-fire .tc-lbl {
  font-size: 11px;
}

/* Mobile / Narrow / Touch Slide-Over Portrait Drawer & Full-Bleed Frame */
@media (max-width: 960px), (pointer: coarse) and (max-width: 1180px) {
  #app { padding: 0; }
  .game-frame {
    width: 100%;
    height: 100%;
    border: none;
    box-shadow: none;
  }
  .portrait-dock {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 48;
    width: min(304px, 84vw);
    flex: none;
    height: 100%;
    box-shadow: -10px 0 34px rgba(0, 0, 0, 0.82);
  }
  .portrait-dock.hidden {
    display: none;
  }
}

/* Narrow Portrait Phones (e.g. 360px - 680px wide) */
@media (max-width: 680px) {
  #hud-top {
    padding: max(6px, env(safe-area-inset-top)) 7px 4px;
    gap: 6px;
  }
  .avatar-frame {
    width: 44px;
    height: 44px;
  }
  .hud-left-wrap {
    gap: 6px;
  }
  .score-row {
    gap: 4px;
    flex-wrap: nowrap;
  }
  .px-tag.stage-tag {
    font-size: 10px;
    padding: 2px 5px;
  }
  .px-points {
    font-size: 11.5px;
  }
  .xp-line {
    gap: 4px;
  }
  .px-label {
    display: none;
  }
  .xp-track {
    width: 72px;
    height: 7px;
  }
  .xp-num {
    font-size: 10px;
  }
  .meta-row {
    gap: 3px;
  }
  #ui-biome, #ui-outfit-tag, #ui-autofire-tag, #ui-diff-tag {
    display: none;
  }
  .px-badge {
    font-size: 9.5px;
    padding: 1px 5px;
  }
  .hud-right {
    gap: 5px;
  }
  .bars-stack {
    width: 104px;
    gap: 3px;
  }
  .bar-tag {
    font-size: 9px;
    width: 24px;
  }
  .bar-with-num {
    height: 12px;
  }
  .bar-num {
    font-size: 9px;
  }
  .score-mini {
    font-size: 9.5px;
  }
  .mini-btns {
    gap: 3px;
  }
  .px-icon-btn {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  #boss-hud {
    top: 74px;
    width: min(320px, 88vw);
  }
  .tutorial-hud {
    top: 72px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    transform: none;
    padding: 7px 9px;
  }
  .tut-head {
    flex-wrap: wrap;
    gap: 4px;
  }
  #tut-badge {
    display: none;
  }
  .tut-item {
    font-size: 10px;
    padding: 3px 6px;
  }
  .tut-hint {
    font-size: 10.5px;
  }
  .hts-discovery-toast {
    top: 76px;
    left: 8px;
    width: min(256px, calc(100vw - 16px));
    padding: 7px 9px;
    gap: 8px;
  }
  .hdt-thumb {
    width: 44px;
    height: 44px;
  }
  .hdt-name {
    font-size: 12.5px;
  }
  .hdt-skill {
    font-size: 10.5px;
  }

  /* Splash Screen & Main Menu on Portrait Phones */
  .splash-bg {
    object-position: 54% center;
  }
  .splash-ui {
    padding: max(12px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }
  .splash-ver-badge {
    font-size: 10.5px;
    padding: 4px 9px;
  }
  .splash-mute-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
  .splash-bottom-right {
    align-self: center;
    width: min(360px, 100%);
    min-width: 0;
    margin-right: 0;
    margin-bottom: 4px;
  }
  .splash-menu-title {
    font-size: 20px;
  }
  .splash-menu-btn {
    padding: 10px 12px;
    font-size: 13.5px;
  }

  /* Difficulty Select / Shop / Codex / Settings / Defeat on Portrait Phones */
  .diff-select-modal {
    width: calc(100vw - 20px);
    max-height: 90dvh;
    overflow-y: auto;
    padding: 14px;
  }
  .diff-pick-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .diff-pick-card {
    padding: 12px 14px;
  }
  .dpc-title {
    font-size: 18px;
  }
  .px-modal.shop-modal {
    width: calc(100vw - 14px);
    max-height: 92dvh;
    padding: 10px;
    gap: 10px;
    overflow-y: auto;
  }
  .shop-merchant-col {
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
  }
  .merchant-stage {
    width: 88px;
    min-height: 96px;
    max-height: 104px;
    flex: 0 0 88px;
    border-bottom: none;
    border-right: 1px solid rgba(255, 212, 120, 0.3);
  }
  .merchant-expr-sticker {
    display: none;
  }
  .merchant-dialog-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }
  .merchant-speech {
    min-height: 0;
    font-size: 11px;
  }
  .shop-grid {
    max-height: 44dvh;
  }
  .codex-modal {
    width: calc(100vw - 16px);
    max-height: 90dvh;
    padding: 12px;
  }
  .codex-grid {
    grid-template-columns: 1fr;
    max-height: 64dvh;
  }
  .settings-modal {
    width: calc(100vw - 16px);
    max-height: 90dvh;
    overflow-y: auto;
    padding: 14px;
  }
  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  #overlay-gameover.is-defeat {
    justify-content: center;
    align-items: flex-end;
    padding: 12px 12px max(18px, env(safe-area-inset-bottom));
  }
  #overlay-gameover.is-defeat .go-defeat-bg {
    object-position: 78% 22%;
  }
  #overlay-gameover.is-defeat .go-defeat-scrim {
    background: linear-gradient(180deg, rgba(16, 7, 30, 0.08) 0%, rgba(16, 7, 30, 0.38) 44%, rgba(14, 6, 28, 0.88) 76%, rgba(14, 6, 28, 0.94) 100%);
  }
  #overlay-gameover.is-defeat .go-modal-card {
    width: 100%;
    max-width: 390px;
    padding: 14px;
  }
  .touch-joy-zone {
    width: 146px;
    height: 146px;
  }
  .touch-joy-base {
    width: 104px;
    height: 104px;
  }
  .touch-joy-knob {
    width: 44px;
    height: 44px;
    margin-left: -22px;
    margin-top: -22px;
  }
  .touch-circle {
    width: 54px;
    height: 54px;
  }
  .touch-fire {
    width: 68px;
    height: 68px;
  }
}

/* Short Landscape Phones (e.g. 844x390) */
@media (max-height: 500px) and (pointer: coarse) {
  #hud-top {
    padding: 4px 8px;
  }
  .avatar-frame {
    width: 42px;
    height: 42px;
  }
  #ui-biome, #ui-outfit-tag, #ui-autofire-tag {
    display: none;
  }
  .tutorial-hud {
    top: 56px;
    padding: 5px 8px;
  }
  .tut-hint {
    font-size: 10px;
  }
  .touch-joy-zone {
    width: 136px;
    height: 136px;
    bottom: max(6px, env(safe-area-inset-bottom));
  }
  .touch-joy-base {
    width: 96px;
    height: 96px;
  }
  .touch-joy-knob {
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
  }
  .touch-actions {
    bottom: max(8px, env(safe-area-inset-bottom));
    gap: 6px;
  }
  .touch-circle {
    width: 50px;
    height: 50px;
  }
  .touch-fire {
    width: 64px;
    height: 64px;
  }
  .splash-bottom-right {
    width: min(320px, 46vw);
  }
  .splash-menu-btn {
    padding: 7px 10px;
    font-size: 12.5px;
  }
  .diff-select-modal, .codex-modal, .px-modal.shop-modal {
    max-height: 94dvh;
    overflow-y: auto;
  }
}
