/* ============================================================================
   ASTRAL LIBRARY - Cosmic Antique Gold Aesthetic
   ============================================================================ */
:root {
  --bg-deep: #090e1c;
  --bg-navy: #0d1326;
  --bg-panel: rgba(14, 21, 42, 0.86);
  --bg-card: rgba(20, 30, 58, 0.82);
  --bg-card-hover: rgba(29, 43, 82, 0.92);
  --gold: #d9b36c;
  --gold-bright: #f7df9c;
  --gold-dim: rgba(217, 179, 108, 0.34);
  --cyan: #8ce2ff;
  --cyan-dim: rgba(140, 226, 255, 0.25);
  --moon: #f5f0e6;
  --muted: #9aa7c7;
  --danger: #e26464;

  --attr-white: #f2e6c9;
  --attr-blue: #6ec4ff;
  --attr-red: #ff6e76;
  --attr-green: #6be0a6;

  --r-n: #a8b5cc;
  --r-r: #5eb8ff;
  --r-sr: #c484ff;
  --r-ssr: #ffcf66;

  --font-serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --font-sans: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --radius: 12px;
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--moon);
  font-family: var(--font-sans);
  overflow: hidden;
  user-select: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.hidden { display: none !important; }
.mt-sm { margin-top: 12px; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(9, 14, 28, 0.4); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.screen.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================================
   TITLE SCREEN
   ============================================================================ */
#title-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
}
.title-bg-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.title-video, #title-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.title-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(13, 19, 38, 0.15) 0%, rgba(9, 14, 28, 0.85) 100%);
}
.title-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px 48px;
}
.title-top-bar {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.version-badge {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(13, 19, 38, 0.65);
}
.lang-toggle {
  display: inline-flex;
  background: rgba(13, 19, 38, 0.78);
  border: 1px solid var(--gold-dim);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 99px;
  transition: all 0.2s;
}
.lang-btn.active {
  background: linear-gradient(135deg, #c69a4b, #f0d28b);
  color: #14100a;
}

.title-logo-wrap {
  text-align: center;
  max-width: 90vw;
}
.title-logo-img {
  max-width: min(86vw, 680px);
  max-height: 220px;
  filter: drop-shadow(0 6px 28px rgba(140, 226, 255, 0.35));
}
.title-logo-fallback {
  padding: 20px 30px;
}
.logo-sub {
  font-family: var(--font-serif);
  font-size: clamp(13px, 2vw, 18px);
  letter-spacing: 0.32em;
  color: var(--cyan);
  margin-bottom: 10px;
  text-shadow: 0 0 18px rgba(140, 226, 255, 0.6);
}
.logo-main {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 5.6vw, 64px);
  font-weight: 700;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, #fffaf0 0%, #f3d796 55%, #b88b4a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.8));
}
.logo-en {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: clamp(12px, 1.5vw, 16px);
  letter-spacing: 0.45em;
  color: var(--gold);
  opacity: 0.85;
}

.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.title-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn-gold-lg, .btn-gold-md, .btn-gold-sm, .btn-prism-md, .btn-outline-md, .btn-outline-sm, .btn-danger-sm {
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transition: transform 0.12s ease, filter 0.18s ease, box-shadow 0.2s ease;
}
.btn-gold-lg {
  padding: 15px 46px;
  font-family: var(--font-serif);
  font-size: 18px;
  color: #1a1309;
  border: 1px solid #fff0c2;
  background: linear-gradient(135deg, #f7df9c 0%, #d9b36c 55%, #b3833b 100%);
  box-shadow: 0 0 28px rgba(217, 179, 108, 0.45), inset 0 1px 0 rgba(255,255,255,0.6);
}
.btn-gold-md {
  padding: 10px 22px;
  font-size: 13px;
  color: #1a1309;
  border: 1px solid #f7df9c;
  background: linear-gradient(135deg, #f3d796, #c69647);
  box-shadow: 0 4px 16px rgba(217, 179, 108, 0.28);
}
.btn-gold-sm {
  padding: 7px 14px;
  font-size: 12px;
  color: #1a1309;
  border: 1px solid #f7df9c;
  background: linear-gradient(135deg, #f3d796, #c69647);
}
.btn-prism-md {
  padding: 10px 22px;
  font-size: 13px;
  color: #091322;
  border: 1px solid #d5f6ff;
  background: linear-gradient(135deg, #a6ecff 0%, #d9b8ff 50%, #ffdf8c 100%);
  box-shadow: 0 4px 20px rgba(140, 226, 255, 0.35);
}
.btn-outline-md {
  padding: 9px 18px;
  font-size: 13px;
  color: var(--moon);
  background: rgba(20, 30, 58, 0.72);
  border: 1px solid var(--gold-dim);
}
.btn-outline-sm {
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--moon);
  background: rgba(20, 30, 58, 0.72);
  border: 1px solid var(--gold-dim);
}
.btn-danger-sm {
  padding: 6px 12px;
  font-size: 11.5px;
  color: #ffd7d7;
  background: rgba(160, 40, 40, 0.5);
  border: 1px solid rgba(226, 100, 100, 0.6);
}
button:hover:not(:disabled) { filter: brightness(1.1); }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.42; cursor: not-allowed; filter: grayscale(0.35); }

/* ============================================================================
   GAME SCREEN LAYOUT
   ============================================================================ */
#game-screen {
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
}

/* Top HUD */
#hud-top {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(13, 19, 38, 0.96) 0%, rgba(10, 15, 31, 0.92) 100%);
  border-bottom: 1px solid var(--gold-dim);
  z-index: 20;
}
.hud-left, .hud-right, .hud-currencies {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hud-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0;
}
.stage-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(140, 226, 255, 0.12);
  border: 1px solid rgba(140, 226, 255, 0.35);
  padding: 3px 10px;
  border-radius: 99px;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 30, 58, 0.82);
  border: 1px solid var(--gold-dim);
  border-radius: 99px;
  padding: 4px 14px 4px 10px;
}
.currency-pill.starlight { border-color: rgba(140, 226, 255, 0.45); }
.currency-pill.memory { border-color: rgba(196, 132, 255, 0.45); }
.curr-icon { width: 22px; height: 22px; object-fit: contain; display: none; }
.curr-icon.loaded { display: block; }
.curr-icon.loaded + .curr-fallback { display: none; }
.curr-fallback { font-size: 16px; color: var(--gold-bright); }
.currency-pill.starlight .curr-fallback { color: var(--cyan); }
.currency-pill.memory .curr-fallback { color: #d59cff; }
.curr-text { display: flex; flex-direction: column; line-height: 1.1; }
.curr-label { font-size: 9.5px; color: var(--muted); }
.curr-val { font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--moon); }
.curr-rate { font-size: 11px; font-weight: 700; color: var(--attr-green); font-variant-numeric: tabular-nums; }

.btn-icon-pill {
  padding: 6px 13px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--gold-dim);
  color: var(--moon);
  font-size: 12px;
  font-weight: 700;
}

/* Main Grid */
#game-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 460px);
}

/* ============================================================================
   STAGE SECTION (LEFT/MAIN VIEWPORT)
   ============================================================================ */
#stage-section {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--gold-dim);
}
#stage-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: size;
  overflow: hidden;
  background: #0a1022;
}
.stage-bg-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: background-image 0.9s ease, filter 0.6s ease;
  z-index: 1;
}
.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#stage-bg-canvas { z-index: 2; }
#stage-fx-canvas { z-index: 5; pointer-events: auto; cursor: pointer; }

/* 5 Character Stage Layer */
.stage-party-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  --stage-slot-width: 53cqw;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 68px;
}
.stage-char-unit {
  position: absolute;
  bottom: 66px;
  width: var(--stage-slot-width);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  cursor: pointer;
  transition: left 0.5s ease, transform 0.25s ease;
}
.stage-char-unit:hover {
  filter: drop-shadow(0 0 18px rgba(247, 223, 156, 0.55));
}
.stage-char-sprite {
  height: clamp(220px, 44vh, 420px);
  width: auto;
  max-width: 30vw;
  object-fit: contain;
  animation: charBreathe 4.2s ease-in-out infinite;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.65));
}
.stage-char-unit.awake .stage-char-sprite {
  filter: drop-shadow(0 0 22px rgba(140, 226, 255, 0.55)) drop-shadow(0 12px 24px rgba(0,0,0,0.65));
}
.stage-char-unit.tapped .stage-char-sprite {
  animation: charHop 0.35s ease;
}

/* Fallback Tarot Card when PNG not yet placed */
.char-placeholder-card {
  width: clamp(110px, 14vw, 172px);
  height: clamp(175px, 31vh, 275px);
  border-radius: 14px;
  border: 2px solid var(--gold);
  background: linear-gradient(165deg, rgba(24, 36, 72, 0.92), rgba(10, 15, 32, 0.96));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), inset 0 0 24px rgba(217, 179, 108, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  text-align: center;
  position: relative;
  animation: charBreathe 4.2s ease-in-out infinite;
}
.char-placeholder-card.awake {
  border-color: var(--cyan);
  box-shadow: 0 0 26px rgba(140, 226, 255, 0.42), inset 0 0 30px rgba(140, 226, 255, 0.22);
}
.ph-rarity { font-size: 10px; font-weight: 900; letter-spacing: 0.16em; }
.ph-emblem {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 70%);
}
.ph-name { font-family: var(--font-serif); font-size: 14px; font-weight: 700; color: var(--moon); }
.ph-sub { font-size: 10px; color: var(--muted); }
.ph-file-hint { font-size: 9px; color: rgba(154, 167, 199, 0.65); font-family: monospace; }

@keyframes charBreathe {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-5px) scaleY(1.012); }
}
@keyframes charHop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-16px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

.stage-char-tag {
  margin-top: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(9, 14, 28, 0.78);
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
  white-space: nowrap;
}

/* Overlays on Stage */
.event-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(35, 22, 74, 0.92), rgba(114, 72, 26, 0.92));
  border: 1px solid var(--gold-bright);
  box-shadow: 0 0 24px rgba(247, 223, 156, 0.45);
  font-size: 13px;
  font-weight: 800;
  color: #fffaf0;
}
.event-timer { color: var(--cyan); font-variant-numeric: tabular-nums; }

.synergy-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 45%;
  pointer-events: none;
}
.synergy-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(13, 19, 38, 0.78);
  border: 1px solid rgba(140, 226, 255, 0.45);
  color: var(--cyan);
  backdrop-filter: blur(6px);
}

.speech-bubble {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  width: min(88%, 520px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(11, 17, 34, 0.92);
  border: 1px solid var(--gold);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.speech-speaker {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 4px;
}
.speech-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--moon);
}

.stage-bottom-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.meteor-btn {
  position: relative;
  overflow: hidden;
  width: 220px;
  height: 42px;
  border-radius: 99px;
  border: 1px solid var(--cyan);
  background: rgba(11, 18, 38, 0.85);
  color: var(--moon);
  font-size: 13px;
  font-weight: 800;
}
.meteor-btn.ready {
  box-shadow: 0 0 22px rgba(140, 226, 255, 0.65);
  animation: pulseReady 1.5s infinite;
}
@keyframes pulseReady {
  0%, 100% { box-shadow: 0 0 14px rgba(140, 226, 255, 0.5); }
  50% { box-shadow: 0 0 28px rgba(247, 223, 156, 0.85); }
}
.meteor-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(64, 150, 220, 0.65), rgba(140, 226, 255, 0.85));
  transition: width 0.2s linear;
}
.meteor-label {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.stage-evo-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 14px;
  border-radius: 99px;
  background: rgba(11, 18, 38, 0.86);
  border: 1px solid var(--gold-dim);
  backdrop-filter: blur(8px);
}
.stage-evo-info { display: flex; flex-direction: column; line-height: 1.2; }
.stage-evo-name { font-family: var(--font-serif); font-size: 12.5px; font-weight: 700; color: var(--gold-bright); }
.stage-evo-mult { font-size: 10.5px; color: var(--cyan); }

/* ============================================================================
   RIGHT MANAGEMENT PANEL
   ============================================================================ */
#panel-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
}
.panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--gold-dim);
  background: rgba(9, 14, 28, 0.72);
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  padding: 13px 6px;
  border-bottom: 2px solid transparent;
  transition: all 0.18s;
}
.tab-btn.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold-bright);
  background: rgba(217, 179, 108, 0.09);
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.pane-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14.5px;
  color: var(--gold-bright);
  letter-spacing: 0.05em;
}
.pane-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(140, 226, 255, 0.1);
  border: 1px solid var(--cyan-dim);
  padding: 2px 9px;
  border-radius: 99px;
}

.filter-group, .buy-mode-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.chip-btn {
  border: 1px solid var(--gold-dim);
  background: rgba(14, 21, 42, 0.7);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
}
.chip-btn.active {
  background: var(--gold);
  color: #14100a;
  border-color: var(--gold-bright);
}

/* Party Slots */
.party-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}
.party-slot {
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  border: 1.5px dashed var(--gold-dim);
  background: rgba(9, 14, 28, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}
.party-slot.filled {
  border-style: solid;
  border-color: var(--gold);
  background: var(--bg-card);
}
.party-slot:hover { border-color: var(--gold-bright); transform: translateY(-2px); }
.slot-thumb {
  width: 100%;
  height: 70%;
  object-fit: cover;
  object-position: top;
  border-radius: 6px;
}
.slot-name { font-size: 10px; font-weight: 700; color: var(--moon); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slot-lv { font-size: 9px; color: var(--gold-bright); }
.slot-empty-plus { font-size: 20px; color: var(--gold-dim); }

/* Roster Grid */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.roster-card {
  position: relative;
  display: flex;
  gap: 9px;
  padding: 9px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.roster-card:hover { background: var(--bg-card-hover); border-color: var(--gold); }
.roster-card.locked { opacity: 0.48; filter: grayscale(0.75); }
.roster-card.in-party { border-color: var(--cyan); box-shadow: inset 0 0 12px rgba(140, 226, 255, 0.14); }
.roster-thumb {
  width: 52px;
  height: 68px;
  border-radius: 8px;
  background: rgba(9, 14, 28, 0.8);
  border: 1px solid var(--gold-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 20px;
}
.roster-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.roster-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.roster-top { display: flex; align-items: center; gap: 4px; }
.rarity-tag { font-size: 9.5px; font-weight: 900; padding: 1px 5px; border-radius: 4px; color: #090e1c; }
.rarity-N { background: var(--r-n); }
.rarity-R { background: var(--r-r); }
.rarity-SR { background: var(--r-sr); }
.rarity-SSR { background: var(--r-ssr); }
.roster-name { font-family: var(--font-serif); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-sub { font-size: 10.5px; color: var(--muted); }
.roster-foot { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--gold-bright); }
.party-mark { font-size: 9.5px; color: var(--cyan); font-weight: 800; }

/* Gacha Tab */
.gacha-hero-card {
  position: relative;
  overflow: hidden;
  padding: 20px 16px;
  border-radius: 16px;
  background: radial-gradient(circle at top, rgba(40, 62, 118, 0.65), rgba(11, 17, 36, 0.92));
  border: 1px solid var(--gold);
  text-align: center;
}
.gacha-circle-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gacha-circle-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  animation: spinSlow 24s linear infinite;
}
.gacha-circle-img.loaded { display: block; }
.gacha-circle-img.loaded + .gacha-circle-css { display: none; }
.gacha-circle-css {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 2px dashed var(--gold-bright);
  box-shadow: 0 0 24px rgba(140, 226, 255, 0.35), inset 0 0 18px rgba(217, 179, 108, 0.3);
  animation: spinSlow 18s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.gacha-title { margin: 4px 0 6px; font-family: var(--font-serif); font-size: 20px; color: var(--gold-bright); }
.gacha-desc { margin: 0 0 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.gacha-rates { display: flex; justify-content: center; gap: 10px; font-size: 11px; font-weight: 800; margin-bottom: 8px; }
.r-ssr { color: var(--r-ssr); } .r-sr { color: var(--r-sr); } .r-r { color: var(--r-r); } .r-n { color: var(--r-n); }
.gacha-pity { font-size: 12px; color: var(--cyan); margin-bottom: 14px; }
.gacha-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.gacha-history { display: flex; flex-direction: column; gap: 5px; }
.gacha-hist-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(14, 21, 42, 0.65);
  border: 1px solid rgba(217, 179, 108, 0.16);
  font-size: 11.5px;
}

/* Facilities Tab */
.facility-list { display: flex; flex-direction: column; gap: 9px; }
.fac-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
}
.fac-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: rgba(9, 14, 28, 0.8);
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
  overflow: hidden;
}
.fac-icon-wrap img { width: 100%; height: 100%; object-fit: contain; }
.fac-info { flex: 1; min-width: 0; }
.fac-head { display: flex; align-items: baseline; gap: 6px; }
.fac-name { font-family: var(--font-serif); font-size: 13.5px; font-weight: 700; color: var(--moon); }
.fac-lv { font-size: 11px; color: var(--gold-bright); font-weight: 800; }
.fac-desc { font-size: 11px; color: var(--muted); margin: 2px 0; }
.fac-effect { font-size: 11px; color: var(--cyan); font-weight: 700; }

/* Rebirth & Star Chart */
.rebirth-card {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(155deg, rgba(34, 24, 68, 0.82), rgba(14, 21, 42, 0.92));
  border: 1px solid rgba(196, 132, 255, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rebirth-head { display: flex; justify-content: space-between; align-items: center; }
.rebirth-head h2 { margin: 0; font-family: var(--font-serif); font-size: 16px; color: #e2c2ff; }
.rebirth-desc { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.rebirth-gain-box { font-size: 13px; color: var(--moon); }
.rebirth-gain-box strong { color: #e2c2ff; font-size: 17px; }

.starchart-grid { display: flex; flex-direction: column; gap: 8px; }
.node-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(196, 132, 255, 0.28);
}
.node-name { font-family: var(--font-serif); font-size: 13px; font-weight: 700; color: var(--moon); }
.node-desc { font-size: 11px; color: var(--muted); }
.node-lv { font-size: 11px; color: #d59cff; font-weight: 800; }

/* ============================================================================
   MODALS (CHAR DETAIL / GACHA / ADV / OFFLINE / GALLERY / SETTINGS)
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 18, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  position: relative;
  width: min(94vw, 820px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px;
  background: linear-gradient(165deg, #131c38 0%, #0b1124 100%);
  border: 1px solid var(--gold);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: rgba(13, 19, 38, 0.85);
  color: var(--moon);
  font-size: 15px;
}
.modal-title { margin: 0 0 12px; font-family: var(--font-serif); font-size: 22px; color: var(--gold-bright); }

/* Character Detail Modal */
.char-detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
}
.char-detail-visual { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.detail-char-art {
  width: 100%;
  height: 390px;
  border-radius: 14px;
  background: radial-gradient(circle at center, rgba(44, 66, 122, 0.45), rgba(9, 14, 28, 0.9));
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.detail-char-art img { max-width: 100%; max-height: 100%; object-fit: contain; }
.detail-art-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.detail-badges { display: flex; gap: 6px; margin-bottom: 6px; }
.rarity-pill, .attr-pill, .role-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 99px;
  background: rgba(255,255,255,0.1);
}
.detail-name { margin: 0; font-family: var(--font-serif); font-size: 26px; color: var(--gold-bright); }
.detail-subtitle { margin: 2px 0 10px; font-size: 12.5px; color: var(--cyan); }
.detail-lore { margin: 0 0 14px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.detail-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-box {
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(9, 14, 28, 0.65);
  border: 1px solid var(--gold-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.stat-box strong { color: var(--gold-bright); font-size: 13.5px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-episodes h3 { margin: 0 0 8px; font-family: var(--font-serif); font-size: 14px; color: var(--gold-bright); }
.ep-list { display: flex; flex-direction: column; gap: 6px; }
.ep-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--gold-dim);
  background: rgba(20, 30, 58, 0.72);
  color: var(--moon);
  font-size: 12px;
  text-align: left;
}

/* Gacha Overlay */
.gacha-stage-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gacha-video, .gacha-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gacha-skip-btn { position: absolute; top: 20px; right: 20px; z-index: 5; }
.gacha-results-layer {
  position: relative;
  z-index: 6;
  width: min(94vw, 880px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 18px;
  background: rgba(10, 15, 32, 0.94);
  border: 1px solid var(--gold);
  text-align: center;
}
.gacha-res-title { margin: 0 0 16px; font-family: var(--font-serif); color: var(--gold-bright); }
.gacha-res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.gacha-res-card {
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--gold-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  animation: popIn 0.35s ease backwards;
}
.gacha-res-card.SSR { border-color: var(--r-ssr); box-shadow: 0 0 22px rgba(255, 207, 102, 0.45); }
.gacha-res-card.SR { border-color: var(--r-sr); box-shadow: 0 0 14px rgba(196, 132, 255, 0.35); }
.gacha-res-img { width: 84px; height: 106px; object-fit: cover; object-position: top; border-radius: 8px; }
@keyframes popIn { from { opacity: 0; transform: scale(0.85) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Mini-ADV Overlay */
.adv-container {
  position: relative;
  width: min(96vw, 1020px);
  height: min(88vh, 620px);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--gold);
  background: #090e1c;
  cursor: pointer;
}
.adv-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: brightness(0.75); }
.adv-char-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 120px;
}
.adv-char-layer img { max-height: 78%; max-width: 80%; object-fit: contain; filter: drop-shadow(0 8px 28px rgba(0,0,0,0.75)); }
.adv-top-controls {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 4;
}
.adv-ep-badge {
  padding: 5px 14px;
  border-radius: 99px;
  background: rgba(9, 14, 28, 0.8);
  border: 1px solid var(--gold-dim);
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--gold-bright);
}
.adv-dialogue-box {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  min-height: 130px;
  padding: 16px 22px;
  border-radius: 14px;
  background: rgba(10, 15, 32, 0.92);
  border: 1px solid var(--gold);
  z-index: 4;
}
.adv-speaker { font-family: var(--font-serif); font-size: 15px; font-weight: 700; color: var(--gold-bright); margin-bottom: 6px; }
.adv-text { font-size: 15px; line-height: 1.7; color: var(--moon); }
.adv-next-hint { position: absolute; right: 16px; bottom: 10px; color: var(--gold-bright); animation: blink 1.1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* Offline Modal */
.modal-offline-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  width: min(92vw, 620px);
  align-items: center;
}
.offline-char-art {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.offline-char-art img { max-height: 100%; max-width: 100%; object-fit: contain; }
.offline-quote { font-family: var(--font-serif); font-size: 14px; color: var(--cyan); margin: 0 0 8px; }
.offline-duration { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.offline-rewards { display: flex; gap: 10px; margin-bottom: 10px; }
.reward-chip {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  background: rgba(20, 30, 58, 0.85);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px;
}
.reward-chip.starlight { border-color: var(--cyan); color: var(--cyan); }
.offline-event-note { font-size: 11.5px; color: var(--muted); margin: 0 0 14px; }

/* Gallery */
.gallery-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.gallery-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gallery-display {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gallery-display img { max-width: 96%; max-height: 92%; object-fit: contain; border-radius: 10px; box-shadow: var(--shadow-lg); }
.gallery-ui {
  background: rgba(10, 15, 32, 0.92);
  border-top: 1px solid var(--gold-dim);
  padding: 12px 18px;
}
.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.gallery-header h2 { margin: 0; font-family: var(--font-serif); font-size: 16px; color: var(--gold-bright); }
.gallery-head-btns { display: flex; gap: 8px; align-items: center; }
.modal-close-inline { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--gold-dim); background: transparent; color: var(--moon); }
.gallery-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.gallery-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery-item-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  color: var(--moon);
  font-size: 12px;
}
.gallery-item-btn.active { border-color: var(--cyan); color: var(--cyan); }
.gallery-restore-btn { position: absolute; top: 18px; right: 18px; z-index: 10; }

/* Settings */
.modal-settings-card { width: min(94vw, 560px); }
.settings-section { padding: 12px 0; border-top: 1px solid rgba(217, 179, 108, 0.18); }
.settings-section h3 { margin: 0 0 8px; font-size: 13px; color: var(--gold-bright); }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.save-io-row { display: flex; gap: 8px; margin-bottom: 8px; }
.save-io-text {
  width: 100%;
  border-radius: 8px;
  background: rgba(9, 14, 28, 0.85);
  border: 1px solid var(--gold-dim);
  color: var(--moon);
  padding: 8px;
  font-family: monospace;
  font-size: 11px;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(13, 20, 42, 0.95);
  border: 1px solid var(--gold);
  color: var(--moon);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s ease;
}

/* ============================================================================
   RESPONSIVE (MOBILE / TABLET)
   ============================================================================ */
@media (max-width: 960px) {
  #hud-top { height: auto; flex-wrap: wrap; padding: 8px 10px; gap: 6px; }
  .hud-brand .brand-name { font-size: 14px; }
  #game-main { grid-template-columns: 1fr; grid-template-rows: 48vh 1fr; }
  #stage-section { border-right: none; border-bottom: 1px solid var(--gold-dim); }
  .stage-char-sprite { height: 32vh; }
  .char-detail-layout { grid-template-columns: 1fr; }
  .detail-char-art { height: 260px; }
  .modal-offline-card { grid-template-columns: 1fr; text-align: center; }
  .offline-char-art { height: 170px; }
}


/* === Pilot Visual Polish: Ground Contact Shadow & Night Ambient Integration === */
.stage-char-unit::before {
  content: "";
  position: absolute;
  bottom: calc(20px + min(2.5cqh, 1.4cqw));
  left: 50%;
  transform: translateX(-50%);
  width: 68%;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(4, 7, 18, 0.78) 0%, rgba(4, 7, 18, 0.35) 55%, rgba(4, 7, 18, 0) 100%);
  pointer-events: none;
  z-index: -1;
}
.stage-char-sprite {
  height: min(52cqh, calc(1.5 * var(--stage-slot-width)), 460px);
  max-width: 100%;
  object-position: center bottom;
  pointer-events: auto;
  filter: brightness(0.91) contrast(1.03) drop-shadow(0 12px 22px rgba(4, 7, 18, 0.75));
}
@media (max-width: 960px) {
  .stage-char-unit { bottom: 82px; }
  .stage-char-sprite { height: min(56cqh, calc(1.5 * var(--stage-slot-width)), 350px); }
  .stage-char-tag { font-size: 9px; padding: 2px 5px; }
  .synergy-bar { gap: 3px; }
  .synergy-chip { font-size: 9px; line-height: 1.2; padding: 3px 6px; }
  .stage-evo-name { overflow-wrap: anywhere; }
  .event-banner {
    left: auto;
    right: 10px;
    transform: none;
    max-width: 47%;
    padding: 6px 9px;
    font-size: 11px;
    line-height: 1.3;
  }
  #hud-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .hud-left { gap: 5px; }
  .hud-right { grid-column: 2; grid-row: 1; gap: 5px; }
  .hud-right .btn-icon-pill { padding: 5px 8px; }
  .hud-currencies { grid-column: 1 / -1; grid-row: 2; align-items: stretch; gap: 5px; }
  .currency-pill { flex: 1; gap: 4px; padding: 4px 7px; min-width: 0; }
  .currency-pill[data-tip="dust"] {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 1px 4px;
  }
  .currency-pill[data-tip="dust"] :is(.curr-icon, .curr-fallback) { grid-area: 1 / 1 / 3 / 2; }
  .currency-pill[data-tip="dust"] .curr-text { grid-area: 1 / 2 / 2 / 3; }
  .curr-icon { width: 16px; height: 16px; flex-shrink: 0; }
  .curr-val { font-size: 12px; white-space: nowrap; }
  .curr-rate { grid-area: 2 / 2 / 3 / 3; font-size: 9px; line-height: 1.1; overflow-wrap: anywhere; }
}

.stage-char-unit.awake .stage-char-sprite {
  filter: brightness(0.96) contrast(1.04) drop-shadow(0 0 22px rgba(140, 226, 255, 0.55)) drop-shadow(0 12px 22px rgba(4, 7, 18, 0.75));
}

/* === v2.0 Expansion: 10-Hour Volume, Cycle Visual Themes, Relics & Mobile Polish === */
.cycle-badge {
  border-color: rgba(247, 223, 156, 0.55);
  background: rgba(217, 179, 108, 0.16);
  color: var(--gold-bright);
}
.stage-bg-img.cycle-theme-2 {
  filter: hue-rotate(108deg) saturate(1.25) brightness(0.94);
}
.stage-bg-img.cycle-theme-3 {
  filter: hue-rotate(-73deg) saturate(1.21) brightness(0.98);
}
.stage-bg-img.cycle-theme-4 {
  filter: sepia(0.66) saturate(1.38) brightness(1.05) contrast(1.04);
}
.stage-bg-img.cycle-theme-4::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 24%, rgba(255, 191, 98, 0.31), rgba(216, 160, 79, 0.10) 54%, transparent 78%);
  mix-blend-mode: screen;
  pointer-events: none;
}
.relic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.relic-card {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(140, 226, 255, 0.22);
  opacity: 0.50;
  filter: grayscale(0.8);
}
.relic-card.owned {
  opacity: 1;
  filter: none;
  border-color: var(--cyan);
  background: linear-gradient(145deg, rgba(24, 42, 78, 0.9), rgba(14, 22, 44, 0.95));
}
.relic-name { font-family: var(--font-serif); font-size: 12px; font-weight: 700; color: var(--gold-bright); }
.relic-eff { font-size: 10.5px; color: var(--cyan); margin-top: 2px; }

@media (max-width: 960px) {
  .hud-brand { min-width: 0; }
  .hud-brand .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hud-left .stage-badge { flex-shrink: 0; padding: 2px 6px; font-size: 9px; }
}


.panel-tabs-5 { grid-template-columns: repeat(5, 1fr); }
.panel-tabs-5 .tab-btn { font-size: 11.5px; padding: 12px 2px; }
.attr-icon-inline { width: 15px; height: 15px; object-fit: contain; vertical-align: -2px; margin-right: 3px; }
.collection-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 10px; border-radius: 12px; background: var(--bg-card);
  border: 1px solid var(--gold-dim); text-align: center; font-size: 11px; color: var(--muted);
}
.collection-summary strong { display: block; margin-top: 2px; font-size: 14px; color: var(--gold-bright); }
.achieve-list { display: flex; flex-direction: column; gap: 7px; }
.ach-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 10px; background: var(--bg-card);
  border: 1px solid rgba(217, 179, 108, 0.22); opacity: 0.72;
}
.ach-card.done {
  opacity: 1; border-color: var(--gold);
  background: linear-gradient(135deg, rgba(35, 48, 86, 0.88), rgba(20, 30, 58, 0.92));
}
.ach-title { font-family: var(--font-serif); font-size: 13px; font-weight: 700; color: var(--moon); }
.ach-desc { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.ach-reward { font-size: 11px; font-weight: 800; color: var(--cyan); white-space: nowrap; }
.ach-card.done .ach-reward { color: var(--gold-bright); }
.modal-still-card { width: min(95vw, 920px); text-align: center; }
.still-badge {
  display: inline-block; font-size: 10.5px; font-weight: 900; letter-spacing: 0.18em;
  color: #14100a; background: linear-gradient(135deg, #a6ecff, #ffdf8c);
  padding: 3px 12px; border-radius: 99px; margin-bottom: 6px;
}
.still-modal-art {
  width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--gold); background: #080d1c;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.still-modal-art img { width: 100%; height: 100%; object-fit: cover; }
.still-caption { margin: 0; font-family: var(--font-serif); font-size: 13.5px; color: var(--cyan); }


.stage-char-unit.ex .stage-char-sprite {
  filter: brightness(0.98) drop-shadow(0 0 14px rgba(247, 223, 156, 0.44)) drop-shadow(0 12px 22px rgba(4, 7, 18, 0.75));
}

.rebirth-transition {
  z-index: 110;
  background: #070b18;
}
#rebirth-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.rebirth-transition-bar {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(12px, 3vw, 32px);
  background: linear-gradient(transparent, rgba(7, 11, 24, 0.95));
}
.rebirth-transition-bar h2 {
  margin: 0;
  color: var(--gold-bright);
  font: 700 clamp(15px, 2vw, 24px) var(--font-serif);
}

.intro-mission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(217, 179, 108, 0.55);
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(82, 61, 34, 0.54), rgba(18, 30, 57, 0.8));
}
.intro-step-count { color: var(--gold-bright); font-size: 11px; font-weight: 800; }
.intro-step-copy p { margin: 3px 0 0; font-size: 12px; }
.intro-mission button { flex-shrink: 0; }
.tab-btn.intro-highlight {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
  background: rgba(217, 179, 108, 0.20);
  box-shadow: inset 0 0 12px rgba(247, 223, 156, 0.34);
}
.roster-card.locked { cursor: default; }
.facility-reward-note { margin: -2px 0 10px; color: var(--cyan); font-size: 11px; }
.how-to-play summary { color: var(--gold-bright); font-size: 13px; font-weight: 800; cursor: pointer; }
.how-to-play ol { margin: 8px 0 0; padding-inline-start: 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.how-to-play li + li { margin-top: 4px; }

/* Party and character synergy status */
#btn-panel-collapse { display: none; }
.slot-traits {
  display: grid;
  font-size: 10px;
  line-height: 1.15;
  color: var(--moon);
  overflow-wrap: anywhere;
}
.party-slot.filled > :first-child { min-height: 0; flex-shrink: 1; }
.synergy-summary { margin: 12px 0; }
.synergy-summary h3 {
  margin: 0 0 6px;
  font: 700 14px var(--font-serif);
  color: var(--gold-bright);
}
.syn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.syn-entry {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--gold-dim);
  background: var(--bg-card);
  color: var(--moon);
  font-size: 12px;
  line-height: 1.3;
}
.syn-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.syn-state {
  flex: none;
  border-radius: 20px;
  padding: 1px 6px;
  color: var(--moon);
  background: rgba(255, 255, 255, 0.12);
}
.syn-state.active { color: #0b1421; background: var(--cyan); }
.syn-effect { color: var(--gold-bright); }
.syn-remaining { color: var(--cyan); }
.detail-trait-note { margin: 4px 0; font-size: 13px; color: var(--moon); }

@media (max-width: 960px) {
  #game-main { grid-template-rows: min(48dvh, 55%) minmax(0, 1fr); }
  #game-main:has(.panel-expanded) { grid-template-rows: clamp(78px, 9dvh, 98px) minmax(0, 1fr); }
  #game-main:has(.panel-expanded) :is(.stage-party-layer, .speech-bubble, .event-banner, .synergy-bar) {
    visibility: hidden;
  }
  .panel-expanded #btn-panel-collapse {
    display: block;
    min-height: 36px;
    border: 0;
    border-bottom: 1px solid var(--gold-dim);
    background: rgba(9, 14, 28, 0.8);
    color: var(--moon);
    font-size: 12px;
  }
  .panel-tabs-5 .tab-btn { min-height: 44px; }
  .panel-body { overscroll-behavior-y: contain; }
  #modal-char .modal-card { max-height: calc(100dvh - 24px); padding: 16px; }
  #modal-char .char-detail-info { grid-row: 1; }
  #modal-char .detail-badges { flex-wrap: wrap; padding-right: 40px; }
  .party-slots { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .party-slot { min-height: 78px; }
  .roster-sub { font-size: 12px; }
}

.party-swap-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(calc(100vw - 24px), 460px);
  max-height: min(90vh, calc(100dvh - 24px));
  padding: 18px;
  color: var(--moon);
}
.party-swap-dialog::backdrop { background: rgba(5, 8, 18, 0.8); }
.party-swap-dialog p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.party-swap-members { display: grid; gap: 6px; margin-bottom: 14px; }
.party-swap-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  flex-wrap: wrap;
  min-height: 44px;
  text-align: start;
}
.party-swap-member span { color: var(--muted); font-size: 12px; }
.party-swap-dialog form { display: flex; justify-content: flex-end; }
.party-swap-dialog form button { min-height: 44px; }

.how-to-synergy { margin-top: 14px; color: var(--moon); font-size: 13px; line-height: 1.55; }
.how-to-synergy h3 { margin: 0 0 6px; color: var(--gold-bright); font-size: 14px; }
.how-to-synergy p { margin: 0; }
.how-to-synergy ul { margin: 6px 0; padding-inline-start: 20px; }
