/* =========================================================
   GUARDIAN OF THE MIRACULOUSES — CANONICAL DESIGN & 3D CSS
   Dark Celestial Obsidian, Lacquered Rosewood & Metallic Gold
   ========================================================= */

:root {
  --g-bg-dark: #07050d;
  --g-bg-card: rgba(18, 14, 28, 0.78);
  --g-border-card: rgba(225, 29, 72, 0.22);
  --g-gold: #ffd700;
  --g-gold-glow: rgba(255, 215, 0, 0.35);
  --g-crimson: #e11d48;
  --g-crimson-glow: rgba(225, 29, 72, 0.4);
  --g-rosewood-dark: #23060a;
  --g-rosewood-mid: #431018;
  --g-text-main: #f8fafc;
  --g-text-muted: #94a3b8;
}

html[data-page="guardian"] {
  --g-bg-dark: #07050d;
  --g-bg-card: rgba(18, 14, 28, 0.78);
  --g-border-card: rgba(225, 29, 72, 0.22);
}

html[data-page="guardian"][data-theme="light"] {
  --g-bg-dark: #f8fafc;
  --g-bg-card: rgba(255, 255, 255, 0.88);
  --g-border-card: rgba(225, 29, 72, 0.18);
  --g-text-main: #0f172a;
  --g-text-muted: #64748b;
}

/* Background Atmosphere */
.guardian-page-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  background: 
    radial-gradient(circle at 50% 15%, rgba(225, 29, 72, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 85% 65%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 15% 75%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
}

.guardian-container {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 10px 80px;
  z-index: 1;
}

/* =========================================
   1. REIGNING GUARDIAN SHRINE & 3D BOX
   ========================================= */
.shrine-section {
  position: relative;
  margin-bottom: 40px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.15);
  background: linear-gradient(180deg, rgba(30, 20, 40, 0.65) 0%, rgba(12, 9, 20, 0.85) 100%);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 60px rgba(225, 29, 72, 0.08);
}

.shrine-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
  padding: 40px 30px;
  gap: 40px;
  flex-wrap: wrap;
}

/* 3D Miracle Box Model */
.shrine-box-showcase {
  flex: 1;
  min-width: 320px;
  max-width: 460px;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1200px;
}

.miracle-box-3d {
  width: min(415px, 92vw);
  height: min(415px, 92vw);
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg) scale(1.04);
  transition: transform 0.4s ease, filter 0.4s ease;
  filter: drop-shadow(0 25px 40px rgba(0, 0, 0, 0.92)) 
          drop-shadow(0 0 38px rgba(225, 29, 72, 0.38)) 
          drop-shadow(0 0 25px rgba(255, 215, 0, 0.25));
}

.miracle-box-3d:hover {
  transform: rotateX(0deg) rotateY(0deg) scale(1.04);
  filter: drop-shadow(0 28px 45px rgba(0, 0, 0, 0.96)) 
          drop-shadow(0 0 46px rgba(225, 29, 72, 0.45)) 
          drop-shadow(0 0 32px rgba(255, 215, 0, 0.32));
}

/* Master Vector Miracle Box SVG */
.miracle-box-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  user-select: none;
}

/* Rotating Floor Bagua Array */
.box-floor-bagua {
  transform-box: view-box;
  transform-origin: 250px 240px;
  animation: rotateFloorBagua 70s linear infinite;
  pointer-events: none;
}

@keyframes rotateFloorBagua {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 3D Plinth Depth */
.box-3d-base {
  pointer-events: none;
}

/* Main Octagonal Lid Group */
.box-main-octagonal-lid {
  transform-box: view-box;
  transform-origin: 250px 240px;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.8s ease;
}

/* 12 Zodiac Side Drawers */
.box-drawers-layer {
  pointer-events: auto;
}

.zodiac-drawer {
  cursor: pointer;
  outline: none;
}

.zodiac-drawer-body {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.35s ease;
}

.zodiac-drawer:hover .zodiac-drawer-body,
.zodiac-drawer:focus-visible .zodiac-drawer-body {
  transform: scale(1.24);
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.95)) drop-shadow(0 0 16px rgba(225, 29, 72, 0.6));
}

.zodiac-drawer.opened .zodiac-drawer-body {
  transform: scale(1.14);
  filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.7));
  animation: drawerRadiantBreathe 3s ease-in-out infinite alternate;
}

@keyframes drawerRadiantBreathe {
  0% { filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5)); }
  100% { filter: drop-shadow(0 0 7px rgba(255, 215, 0, 0.8)); }
}

.zodiac-drawer.opened .drawer-emoji {
  animation: drawerEmojiPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes drawerEmojiPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1.08); }
}

/* 5 Lotus Petal Compartments */
.lotus-petals-layer {
  pointer-events: auto;
}

.lotus-petal {
  cursor: pointer;
  outline: none;
}

.lotus-petal-body {
  transition: filter 0.35s ease;
}

.lotus-petal:hover .lotus-petal-body,
.lotus-petal:focus-visible .lotus-petal-body {
  filter: drop-shadow(0 0 14px var(--petal-glow, #ffd700)) drop-shadow(0 0 26px var(--petal-glow, #ffd700));
}

.petal-jewel-socket {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lotus-petal:hover .petal-jewel-socket,
.lotus-petal:focus-visible .petal-jewel-socket {
  transform: scale(1.15);
}

/* Central Taijitu Core (Ladybug & Cat Noir) */
.central-taijitu-core {
  cursor: pointer;
  outline: none;
}

.taijitu-body {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.35s ease;
}

.central-taijitu-core:hover .taijitu-body,
.central-taijitu-core:focus-visible .taijitu-body {
  transform: scale(1.06);
  filter: drop-shadow(0 0 18px rgba(225, 29, 72, 0.85)) drop-shadow(0 0 25px rgba(34, 197, 94, 0.7));
}

.petal-jewel-socket.activated {
  animation: jewelPulse 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes jewelPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 4px #ffd700); }
  50% { transform: scale(1.28); filter: drop-shadow(0 0 24px #ffd700) drop-shadow(0 0 35px #ffffff); }
  100% { transform: scale(1); }
}

.taijitu-body.cosmic-pulse {
  animation: cosmicBurst 0.85s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cosmicBurst {
  0% { transform: scale(1); }
  45% { transform: scale(1.15); filter: drop-shadow(0 0 32px #e11d48) drop-shadow(0 0 36px #22c55e); }
  100% { transform: scale(1); }
}

/* Miracle Box Emoji Styling & Font Stack */
.petal-emoji,
.taijitu-emoji,
.drawer-emoji {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Android Emoji', sans-serif;
  user-select: none;
  pointer-events: none;
  text-rendering: geometricPrecision;
  transform-box: fill-box;
  transform-origin: center;
}

.petal-emoji {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lotus-petal:hover .petal-emoji {
  transform: scale(1.12);
}

.taijitu-emoji {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.central-taijitu-core:hover .taijitu-emoji {
  transform: scale(1.08);
}

/* Shrine Right Card */
.shrine-card {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.shrine-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--g-gold);
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.shrine-avatar-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
}

.shrine-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--g-gold);
  box-shadow: 0 0 25px var(--g-gold-glow);
}

.shrine-turtle-avatar {
  background: radial-gradient(circle at 35% 35%, #1b4d3e 0%, #0d2820 60%, #061510 100%);
  border: 3px solid var(--g-gold);
  box-shadow: 0 0 25px rgba(46, 204, 113, 0.45), 0 0 15px var(--g-gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.shrine-turtle-emoji {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  animation: gentleTurtleFloat 4s ease-in-out infinite;
}

@keyframes gentleTurtleFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.05);
  }
}

.shrine-crown {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 34px;
  filter: drop-shadow(0 4px 10px rgba(255, 215, 0, 0.45));
  animation: floatCrown 3s ease-in-out infinite;
}

@keyframes floatCrown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

.shrine-aura-ring {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 215, 0, 0.5);
  animation: spinAura 30s linear infinite;
}

@keyframes spinAura {
  100% { transform: rotate(360deg); }
}

.shrine-name {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 0 4px;
  color: #fff;
  letter-spacing: 0.5px;
}

.shrine-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--g-crimson);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.shrine-quote-bubble {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 24px;
  max-width: 440px;
  margin-bottom: 24px;
}

.shrine-quote-text {
  margin: 0;
  font-size: 0.95rem;
  font-style: italic;
  color: #e2e8f0;
  line-height: 1.5;
}

.quote-mark {
  position: absolute;
  font-size: 28px;
  color: var(--g-gold);
  opacity: 0.5;
  top: 4px;
  left: 8px;
}
.quote-mark.right {
  top: auto;
  bottom: -4px;
  left: auto;
  right: 8px;
}

.shrine-ceremony-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.shrine-ceremony-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(225, 29, 72, 0.6);
}

/* =========================================
   2. ELECTION STATUS BANNER & COUNTDOWN
   ========================================= */
.election-status-section {
  margin-bottom: 40px;
}

.status-banner {
  background: var(--g-bg-card);
  border: 1px solid var(--g-border-card);
  border-radius: 20px;
  padding: 26px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}

.banner-left {
  flex: 1;
  min-width: 280px;
}

.phase-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--g-crimson);
  box-shadow: 0 0 12px var(--g-crimson);
  animation: pulseLight 1.8s infinite;
}

.candidacy-open .pulse-dot {
  background: #f59e0b;
  box-shadow: 0 0 12px #f59e0b;
}

@keyframes pulseLight {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.phase-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.cycle-tag {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--g-gold);
}

.phase-desc {
  font-size: 0.95rem;
  color: var(--g-text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.status-stats-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.stat-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-num {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.stat-lbl {
  font-size: 0.8rem;
  color: var(--g-text-muted);
}

.leading-chip {
  border-color: rgba(255, 215, 0, 0.25);
  background: rgba(255, 215, 0, 0.06);
}

.stat-chip.feather-chip {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.stat-chip.feather-chip .stat-icon {
  font-size: 15px;
}

.stat-chip.vote-allowance-chip {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.stat-chip.vote-allowance-chip .stat-icon {
  font-size: 15px;
}

.banner-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.countdown-card {
  text-align: right;
}

.countdown-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--g-text-muted);
  margin-bottom: 6px;
}

.countdown-digits {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-block {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 54px;
  text-align: center;
}

.t-val {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--g-gold);
  font-family: monospace;
}

.t-unit {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--g-text-muted);
}

.t-sep {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--g-gold);
}

.candidacy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  transition: all 0.2s;
}

.candidacy-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.candidacy-btn.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

.candidacy-btn.registered {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--g-gold);
}

.candidacy-btn.disabled {
  background: rgba(255, 255, 255, 0.04);
  color: var(--g-text-muted);
  cursor: not-allowed;
}

/* =========================================
   3. CANDIDATE ARENA & LIVE BALLOT
   ========================================= */
.candidates-section {
  margin-bottom: 50px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 4px;
  color: #fff;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--g-text-muted);
  margin: 0;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.candidate-card {
  background: var(--g-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 20px;
  position: relative;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
}

.candidate-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 215, 0, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.candidate-card.rank-gold {
  border-color: rgba(255, 215, 0, 0.4);
  background: linear-gradient(180deg, rgba(35, 28, 15, 0.75) 0%, rgba(18, 14, 28, 0.85) 100%);
}

.candidate-card.voted-target {
  border-color: #22c55e;
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.2);
}

.cand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.rank-crown {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
}
.rank-crown.gold { background: rgba(255, 215, 0, 0.15); color: #ffd700; border: 1px solid rgba(255, 215, 0, 0.3); }
.rank-crown.silver { background: rgba(226, 232, 240, 0.12); color: #e2e8f0; border: 1px solid rgba(226, 232, 240, 0.2); }
.rank-crown.bronze { background: rgba(217, 119, 6, 0.15); color: #f59e0b; border: 1px solid rgba(217, 119, 6, 0.3); }
.rank-crown.normal { background: rgba(255, 255, 255, 0.05); color: var(--g-text-muted); }

.cand-percentage-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--g-gold);
}

.cand-body {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.cand-avatar-wrap {
  width: 58px;
  height: 58px;
  position: relative;
  flex-shrink: 0;
}

.cand-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.cand-avatar-border {
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.cand-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: #fff;
}

.cand-votes-line {
  font-size: 0.85rem;
  color: var(--g-text-muted);
}

.cand-vote-count {
  font-weight: 800;
  color: #fff;
  font-size: 1rem;
}

.cand-promise-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.promise-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.promise-text {
  margin: 0;
  font-size: 0.88rem;
  color: #cbd5e1;
  font-style: italic;
  line-height: 1.45;
  word-break: break-word;
}

/* Progress Bar */
.cand-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.cand-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #e11d48 0%, #f59e0b 100%);
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.5);
}

/* Action Button */
.vote-btn {
  width: 100%;
  padding: 10px 0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  text-decoration: none;
}

.vote-btn.active {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.3);
}

.vote-btn.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.5);
}

.vote-btn.disabled,
.vote-btn.locked {
  background: rgba(255, 255, 255, 0.05);
  color: var(--g-text-muted);
  cursor: not-allowed;
}

.vote-btn.vote-feather-btn {
  background: linear-gradient(135deg, #d97706 0%, #b45309 50%, #78350f 100%);
  color: #fff;
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.35);
}

.vote-btn.vote-feather-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #92400e 100%);
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.55);
}

.vote-btn.dev-infinite-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #4c1d95 100%);
  color: #fff;
  border: 1px solid rgba(167, 139, 250, 0.45);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.vote-btn.dev-infinite-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #5b21b6 100%);
  box-shadow: 0 8px 22px rgba(139, 92, 246, 0.6);
}

.voted-stamp.dev-vote-stamp {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(167, 139, 250, 0.45);
  color: #c084fc;
}

.cand-action-dual {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.vote-btn.login-required {
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.35);
  color: #5865f2;
}

.voted-stamp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  padding: 8px 0;
  color: #22c55e;
  font-size: 0.9rem;
  font-weight: 700;
}

.voted-stamp.double-vote {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.45);
  color: #fbbf24;
}

.voted-stamp.feather-stamp {
  background: rgba(217, 119, 6, 0.15);
  border-color: rgba(217, 119, 6, 0.45);
  color: #f59e0b;
}

.voted-stamp.single-vote {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #22c55e;
}

/* Empty State Card */
.empty-candidates-card {
  grid-column: 1 / -1;
  background: var(--g-bg-card);
  border: 1px dashed rgba(255, 215, 0, 0.25);
  border-radius: 20px;
  padding: 50px 20px;
  text-align: center;
}

.empty-box-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-cta-btn {
  margin-top: 18px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  font-weight: 700;
  border-radius: 12px;
  border: 0;
  padding: 12px 28px;
  cursor: pointer;
}

/* =========================================
   4. HALL OF GUARDIANS (HISTORICAL ARCHIVE)
   ========================================= */
.history-section {
  margin-bottom: 50px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.empty-history-notice {
  grid-column: 1 / -1;
  background: var(--g-bg-card);
  border: 1px dashed rgba(255, 215, 0, 0.25);
  border-radius: 20px;
  padding: 44px 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.empty-history-notice .empty-box-icon {
  font-size: 44px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px rgba(225, 29, 72, 0.4));
}

.empty-history-notice h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}

.empty-history-notice p {
  color: var(--g-text-muted);
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.95rem;
  line-height: 1.5;
}

.history-card {
  background: var(--g-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.history-cycle-pill {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(255, 215, 0, 0.1);
  color: var(--g-gold);
  border-radius: 10px;
  padding: 2px 8px;
  margin-bottom: 10px;
}

.history-avatar-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--g-gold);
  margin-bottom: 10px;
}

.history-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 2px;
  color: #fff;
}

.history-date {
  font-size: 0.75rem;
  color: var(--g-text-muted);
}

.history-votes {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--g-crimson);
  margin-top: 4px;
}

.history-promise {
  font-size: 0.8rem;
  font-style: italic;
  color: #94a3b8;
  margin-top: 10px;
  line-height: 1.4;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
  width: 100%;
}

/* =========================================
   5. CANDIDACY MODAL OVERLAY
   ========================================= */
.guardian-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.guardian-modal-overlay.active {
  display: flex;
}

.guardian-modal-box {
  background: #151020;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  padding: 28px;
  position: relative;
  box-sizing: border-box;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 0;
  color: var(--g-text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.modal-box-icon {
  font-size: 36px;
  margin-bottom: 6px;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
}

.modal-subtitle {
  font-size: 0.88rem;
  color: var(--g-text-muted);
  margin: 0;
}

.modal-user-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.preview-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.preview-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
}

.preview-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-radius: 6px;
  padding: 2px 8px;
}

.candidacy-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.candidacy-textarea:focus {
  border-color: var(--g-gold);
}

.char-count-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.78rem;
}

.sample-prompt {
  color: var(--g-gold);
  cursor: pointer;
  text-decoration: underline;
}

.char-counter {
  color: var(--g-text-muted);
}

.form-error-msg {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 10px;
  min-height: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.btn-modal-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--g-text-muted);
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
}

.btn-modal-submit {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  border: 0;
  border-radius: 10px;
  padding: 10px 24px;
  font-weight: 700;
  cursor: pointer;
}

/* =========================================
   6. CINEMATIC HANDOVER CEREMONY OVERLAY
   ========================================= */
.ceremony-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
}

.ceremony-container.active {
  display: block;
}

.ceremony-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  background: #030206;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cinematic-bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 6vh;
  background: #000;
  z-index: 100;
}
.cinematic-bar.top {
  top: 0;
  animation: cinematicBarDown 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.cinematic-bar.bottom {
  bottom: 0;
  animation: cinematicBarUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cinematicBarDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
@keyframes cinematicBarUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Phase Progress Indicator Pill (Top Center) */
.ceremony-progress-pill {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 10, 22, 0.85);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 30px;
  padding: 6px 16px;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7), 0 0 20px rgba(225, 29, 72, 0.2);
}

.ceremony-progress-step {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 12px;
  transition: all 0.25s ease;
}

.ceremony-progress-step:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
}

.ceremony-progress-step .step-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.ceremony-progress-step.completed {
  color: rgba(255, 215, 0, 0.9);
}

.ceremony-progress-step.completed .step-dot {
  background: var(--g-gold);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
}

.ceremony-progress-step.active {
  color: #fff;
}

.ceremony-progress-step.active .step-dot {
  background: #e11d48;
  box-shadow: 0 0 10px #e11d48, 0 0 18px rgba(225, 29, 72, 0.8);
  transform: scale(1.35);
  animation: stepDotPulse 1.6s infinite ease-in-out;
}

@keyframes stepDotPulse {
  0%, 100% { transform: scale(1.35); box-shadow: 0 0 8px #e11d48; }
  50% { transform: scale(1.7); box-shadow: 0 0 16px #e11d48, 0 0 22px rgba(255, 215, 0, 0.85); }
}

.ceremony-progress-sep {
  width: 14px;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.ceremony-top-controls {
  position: absolute;
  top: 20px;
  right: 25px;
  z-index: 150;
  display: flex;
  gap: 10px;
}

.ceremony-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: #fff;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.ceremony-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 215, 0, 0.5);
  transform: translateY(-1px);
}

.ceremony-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Bagua Sacred Seal Floor with 8 Trigrams */
.sacred-bagua-seal {
  position: absolute;
  width: 580px;
  height: 580px;
  border-radius: 50%;
  transform: rotateX(72deg) translateY(60px);
  opacity: 0.35;
  transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1), transform 1.5s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sacred-bagua-seal.glowing {
  opacity: 0.6;
  filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.35)) drop-shadow(0 0 18px rgba(225, 29, 72, 0.2));
}

.sacred-bagua-seal.glowing .bagua-ring.outer {
  animation: rotateBaguaSlow 32s linear infinite;
  box-shadow: 0 0 25px rgba(225, 29, 72, 0.3), inset 0 0 18px rgba(255, 215, 0, 0.18);
}

.sacred-bagua-seal.glowing .bagua-ring.inner {
  animation: rotateBaguaReverse 20s linear infinite reverse;
}

/* Awakening Stage Atmospheric Burst & Shockwave Ring */
.awakening-celestial-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  width: min(380px, 75vw);
  height: min(380px, 75vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.12) 0%, rgba(225, 29, 72, 0.06) 40%, transparent 68%);
  filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  z-index: 18;
  transition: opacity 1.2s ease, transform 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.awakening-celestial-burst.active {
  opacity: 0.28;
  transform: translate(-50%, -50%) scale(1.02);
  animation: celestialAuraPulse 3.8s ease-in-out infinite alternate;
}

@keyframes celestialAuraPulse {
  0% { transform: translate(-50%, -50%) scale(0.96); opacity: 0.18; filter: blur(12px); }
  50% { transform: translate(-50%, -50%) scale(1.04); opacity: 0.32; filter: blur(16px); }
  100% { transform: translate(-50%, -50%) scale(1.0); opacity: 0.24; filter: blur(14px); }
}

.awakening-shockwave-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.15);
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4), 0 0 18px rgba(225, 29, 72, 0.2);
  opacity: 0;
  pointer-events: none;
  z-index: 19;
}

.awakening-shockwave-ring.active {
  animation: shockwaveExpand 1.6s cubic-bezier(0.1, 0.85, 0.25, 1) forwards;
}

@keyframes shockwaveExpand {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0.65; border-width: 2px; }
  50% { opacity: 0.35; }
  100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; border-width: 0.8px; }
}

.bagua-ring.outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 215, 0, 0.55);
  box-shadow: 0 0 60px rgba(225, 29, 72, 0.4), inset 0 0 40px rgba(255, 215, 0, 0.2);
  animation: rotateBaguaSlow 60s linear infinite;
}

.bagua-ring.runes {
  position: absolute;
  inset: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rotateBaguaSlow 45s linear infinite;
}

.bagua-rune-item {
  position: absolute;
  font-size: 24px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.9), 0 0 24px rgba(225, 29, 72, 0.6);
  user-select: none;
}

.bagua-ring.inner {
  position: absolute;
  inset: 95px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 215, 0, 0.65);
  animation: rotateBaguaReverse 35s linear infinite reverse;
}

.bagua-glow-core {
  position: absolute;
  inset: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(225, 29, 72, 0.16) 0%, rgba(255, 215, 0, 0.08) 50%, transparent 75%);
  filter: blur(8px);
}

@keyframes rotateBaguaSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rotateBaguaReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* Dual Layer Canvases */
.kwami-trail-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 22;
}

/* Ceremony Box Wrap */
.ceremony-box-wrap {
  position: relative;
  z-index: 25;
  width: min(320px, 68vw);
  height: min(320px, 68vw);
  transform: translateY(-24px);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 1.2s ease;
}

.ceremony-box-wrap .miracle-box-3d {
  width: 100%;
  height: 100%;
}

.ceremony-box-wrap.levitating {
  animation: levitateCeremonyBox 3.5s ease-in-out infinite alternate;
}

.ceremony-box-wrap.unlocked .box-main-octagonal-lid {
  animation: octagonalLidAwaken 3.2s ease-in-out infinite alternate;
}

@keyframes octagonalLidAwaken {
  0% {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.45)) drop-shadow(0 0 14px rgba(225, 29, 72, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.65)) drop-shadow(0 0 20px rgba(225, 29, 72, 0.3));
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)) drop-shadow(0 0 16px rgba(225, 29, 72, 0.22));
  }
}

/* Radiant Lotus Petal Awakening (Scoped to inner elements so SVG translate/rotate is NEVER overridden) */
.ceremony-box-wrap.unlocked .lotus-petal.awakened .lotus-petal-body {
  animation: lotusBodyAwaken 2.4s ease-in-out infinite alternate;
}

.ceremony-box-wrap.unlocked .lotus-petal.awakened .petal-jewel-socket {
  animation: jewelSocketAwaken 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, jewelSocketPulse 2.4s ease-in-out 0.75s infinite alternate;
}

.ceremony-box-wrap.unlocked .lotus-petal.awakened .petal-emoji {
  animation: petalEmojiAwaken 2.4s ease-in-out infinite alternate;
}

@keyframes lotusBodyAwaken {
  0% { filter: drop-shadow(0 0 3px var(--petal-glow)); }
  50% { filter: drop-shadow(0 0 7px var(--petal-glow)); }
  100% { filter: drop-shadow(0 0 4px var(--petal-glow)); }
}

@keyframes jewelSocketAwaken {
  0% { transform: scale(0.96); filter: drop-shadow(0 0 3px var(--petal-glow, #ffd700)); }
  60% { transform: scale(1.14); filter: drop-shadow(0 0 9px var(--petal-glow, #ffd700)); }
  100% { transform: scale(1.08); filter: drop-shadow(0 0 5px var(--petal-glow, #ffd700)); }
}

@keyframes jewelSocketPulse {
  0% { transform: scale(1.03); filter: drop-shadow(0 0 4px var(--petal-glow, #ffd700)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 7px var(--petal-glow, #ffd700)); }
}

@keyframes petalEmojiAwaken {
  0% { transform: scale(1); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)); }
  100% { transform: scale(1.08); filter: drop-shadow(0 0 4px var(--petal-glow, #ffd700)); }
}

/* Central Taijitu Radiance & Dual Power */
.ceremony-box-wrap.unlocked .central-taijitu-core .taijitu-body {
  animation: taijituBodyRadiate 2.6s ease-in-out infinite alternate;
}

.ceremony-box-wrap.unlocked .central-taijitu-core .taijitu-body.cosmic-pulse {
  animation: taijituCosmicBurst 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards, taijituBodyRadiate 2.6s ease-in-out 0.9s infinite alternate;
}

@keyframes taijituCosmicBurst {
  0% { transform: scale(0.98); filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5)); }
  45% { transform: scale(1.08); filter: drop-shadow(0 0 12px #e11d48) drop-shadow(0 0 14px #22c55e); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 8px rgba(225, 29, 72, 0.6)) drop-shadow(0 0 10px rgba(34, 197, 94, 0.5)); }
}

@keyframes taijituBodyRadiate {
  0% { transform: scale(1.02); filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.35)) drop-shadow(0 0 8px rgba(225, 29, 72, 0.35)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 10px rgba(225, 29, 72, 0.55)) drop-shadow(0 0 12px rgba(34, 197, 94, 0.45)); }
  100% { transform: scale(1.03); filter: drop-shadow(0 0 8px rgba(225, 29, 72, 0.4)) drop-shadow(0 0 9px rgba(34, 197, 94, 0.38)); }
}

.ceremony-box-wrap.unlocked .central-taijitu-core .ladybug-symbol {
  animation: ladybugRadiantThrob 2.6s ease-in-out infinite alternate;
}

@keyframes ladybugRadiantThrob {
  0% { filter: drop-shadow(0 0 3px rgba(225, 29, 72, 0.5)); }
  100% { filter: drop-shadow(0 0 7px rgba(225, 29, 72, 0.8)); }
}

.ceremony-box-wrap.unlocked .central-taijitu-core .catnoir-symbol {
  animation: catnoirRadiantThrob 2.6s ease-in-out infinite alternate;
}

@keyframes catnoirRadiantThrob {
  0% { filter: drop-shadow(0 0 3px rgba(34, 197, 94, 0.5)); }
  100% { filter: drop-shadow(0 0 7px rgba(34, 197, 94, 0.8)); }
}

@keyframes levitateCeremonyBox {
  0% { transform: translateY(-24px); }
  100% { transform: translateY(-38px); }
}

/* Spirits on Left and Right */
.spirits-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 70px;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 30;
}

.spirit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s, transform 1s;
}

.spirit-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.spirit-card.fading {
  opacity: 0.65;
  filter: blur(1px);
}

.spirit-card.crowned .spirit-crown {
  opacity: 1;
  animation: crownDescend 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes crownDescend {
  0% { transform: translateX(-50%) translateY(-40px) scale(0.6); opacity: 0; filter: drop-shadow(0 0 0 transparent); }
  60% { transform: translateX(-50%) translateY(4px) scale(1.15); opacity: 1; filter: drop-shadow(0 0 20px #ffd700); }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; filter: drop-shadow(0 0 16px #ffd700); }
}

.spirit-avatar-wrap {
  width: 110px;
  height: 110px;
  position: relative;
  border-radius: 50%;
  margin-bottom: 12px;
}

.spirit-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--g-gold);
}

.spirit-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, #5b121f 0%, #20040a 100%);
  border: 3px solid var(--g-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.45);
}

.turtle-avatar-spirit {
  background: radial-gradient(circle at 35% 35%, #1b4d3e 0%, #0d2820 60%, #061510 100%);
  border: 3px solid var(--g-gold);
  box-shadow: 0 0 30px rgba(46, 204, 113, 0.5), 0 0 15px var(--g-gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.turtle-avatar-spirit .turtle-emoji {
  font-size: 58px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.65));
  animation: gentleTurtleFloat 4s ease-in-out infinite;
}

.spirit-aura.red {
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border-radius: 50%;
  box-shadow: 0 0 35px var(--g-crimson);
}

.spirit-aura.gold {
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border-radius: 50%;
  box-shadow: 0 0 45px var(--g-gold);
}

.spirit-crown {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  font-size: 34px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.65));
  transition: opacity 0.6s, transform 0.6s;
}

.spirit-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--g-gold);
  margin-bottom: 2px;
}

.spirit-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

/* Cinematic Dialog Box */
.cinematic-dialog {
  position: absolute;
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 740px;
  background: rgba(14, 10, 22, 0.9);
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 20px;
  padding: 22px 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.85), 0 0 35px rgba(225, 29, 72, 0.25);
  backdrop-filter: blur(16px);
  z-index: 110;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.cinematic-dialog:hover {
  border-color: rgba(255, 215, 0, 0.7);
  box-shadow: 0 10px 45px rgba(0,0,0,0.9), 0 0 45px rgba(225, 29, 72, 0.35);
}

.dialog-speaker {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--g-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.dialog-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.55;
  min-height: 52px;
}

.dialog-subtext {
  font-size: 0.82rem;
  color: #94a3b8;
  font-style: italic;
  margin-top: 8px;
}

.dialog-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.dialog-next-btn {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(225, 29, 72, 0.35));
  border: 1px solid rgba(255, 215, 0, 0.6);
  border-radius: 20px;
  color: #ffd700;
  padding: 6px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dialog-next-btn:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(225, 29, 72, 0.55));
  border-color: #ffd700;
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}

.dialog-hint {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.5px;
}

/* =========================================
   RESPONSIVE OPTIMIZATIONS (TABLET & MOBILE)
   ========================================= */

@media (max-width: 900px) {
  .ceremony-progress-pill {
    top: 14px;
    left: 14px;
    transform: none;
    padding: 5px 12px;
    gap: 4px;
  }
  .ceremony-progress-step .step-label {
    display: none;
  }
  .ceremony-progress-sep {
    width: 8px;
  }
  .ceremony-top-controls {
    top: 14px;
    right: 14px;
    gap: 6px;
  }
  .ceremony-ctrl-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .ceremony-ctrl-btn span:first-child {
    display: none;
  }
  .spirits-container {
    padding: 0 20px;
    align-items: flex-start;
    top: 80px;
  }
  .spirit-card {
    transform: scale(0.85);
  }
  .spirit-card.visible {
    transform: scale(0.85) translateY(0);
  }
  .ceremony-box-wrap {
    width: min(280px, 62vw);
    height: min(280px, 62vw);
    transform: translateY(-24px);
  }
  @keyframes levitateCeremonyBox {
    0% { transform: translateY(-24px); }
    100% { transform: translateY(-38px); }
  }
}

@media (max-width: 768px) {
  .guardian-container {
    padding: 8px 10px 60px;
  }

  /* Shrine Mobile Layout */
  .shrine-section {
    border-radius: 20px;
    margin-bottom: 24px;
  }
  .shrine-content {
    flex-direction: column;
    padding: 28px 16px;
    gap: 24px;
  }
  .shrine-box-showcase {
    min-width: 0;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }
  .miracle-box-3d {
    width: min(290px, 82vw);
    height: min(290px, 82vw);
  }
  .shrine-card {
    min-width: 0;
    width: 100%;
  }
  .shrine-name {
    font-size: 1.5rem;
    word-break: break-word;
  }
  .shrine-title {
    font-size: 0.88rem;
    margin-bottom: 12px;
  }
  .shrine-quote-bubble {
    width: 100%;
    max-width: 100%;
    padding: 12px 18px;
    margin-bottom: 18px;
    box-sizing: border-box;
  }
  .shrine-quote-text {
    font-size: 0.88rem;
  }
  .shrine-ceremony-btn {
    width: 100%;
    max-width: 320px;
    justify-content: center;
    padding: 12px 20px;
    font-size: 0.92rem;
  }

  /* Status Banner Mobile Layout */
  .status-banner {
    padding: 20px 16px;
    border-radius: 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  .banner-left {
    min-width: 0;
    width: 100%;
  }
  .phase-title {
    font-size: 1.05rem;
  }
  .phase-desc {
    font-size: 0.88rem;
    margin-bottom: 12px;
  }
  .status-stats-row {
    gap: 8px;
  }
  .stat-chip {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .banner-right {
    align-items: stretch;
    width: 100%;
    gap: 12px;
  }
  .countdown-card {
    text-align: center;
    width: 100%;
  }
  .countdown-label {
    text-align: center;
    font-size: 0.72rem;
  }
  .countdown-digits {
    justify-content: center;
    gap: 6px;
  }
  .time-block {
    min-width: 46px;
    padding: 6px 10px;
  }
  .t-val {
    font-size: 1.25rem;
  }
  .banner-candidacy-action {
    width: 100%;
  }
  .candidacy-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 12px;
    font-size: 0.92rem;
  }

  /* Candidate Grid Mobile */
  .candidate-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .candidate-card {
    padding: 16px 14px;
    border-radius: 16px;
  }
  .cand-name {
    font-size: 1.05rem;
    word-break: break-word;
  }
  .cand-vote-btn {
    padding: 12px 14px;
    font-size: 0.92rem;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 16px;
  }
  .section-title {
    font-size: 1.35rem;
  }
  .section-subtitle {
    font-size: 0.88rem;
  }

  /* Hall of Guardians Mobile */
  .history-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .history-card {
    padding: 14px;
    border-radius: 14px;
  }
  .history-promise {
    word-break: break-word;
    font-size: 0.84rem;
  }
}

@media (max-width: 600px) {
  /* Ceremony Container Mobile Fullscreen */
  .ceremony-container {
    height: 100dvh;
    min-height: 100vh;
  }
  .cinematic-bar {
    height: 2.5vh;
  }

  .ceremony-progress-pill {
    top: max(10px, env(safe-area-inset-top, 10px));
    left: 10px;
    padding: 4px 10px;
    gap: 3px;
  }
  .ceremony-progress-step {
    padding: 2px 4px;
  }
  .ceremony-progress-step .step-dot {
    width: 6px;
    height: 6px;
  }
  .ceremony-progress-sep {
    width: 6px;
  }

  .ceremony-top-controls {
    top: max(10px, env(safe-area-inset-top, 10px));
    right: 10px;
    gap: 4px;
  }
  .ceremony-ctrl-btn {
    padding: 6px 8px;
    font-size: 0.74rem;
    border-radius: 8px;
  }

  /* Spirit Cards Mobile */
  .spirits-container {
    padding: 0 10px;
    top: max(55px, calc(env(safe-area-inset-top, 0px) + 50px));
    align-items: flex-start;
  }
  .spirit-card {
    transform: scale(0.72);
  }
  .spirit-card.visible {
    transform: scale(0.72) translateY(0);
  }
  .spirit-avatar-wrap {
    width: 76px;
    height: 76px;
    margin-bottom: 6px;
  }
  .spirit-crown {
    top: -20px;
    font-size: 28px;
  }
  .turtle-avatar-spirit .turtle-emoji {
    font-size: 40px;
  }
  .shrine-turtle-emoji {
    font-size: 48px;
  }
  .spirit-title {
    font-size: 0.68rem;
    letter-spacing: 0.5px;
  }
  .spirit-name {
    font-size: 0.88rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Ceremony Box Mobile */
  .ceremony-box-wrap {
    width: min(180px, 48vw);
    height: min(180px, 48vw);
    transform: translateY(-16px);
  }
  @keyframes levitateCeremonyBox {
    0% { transform: translateY(-16px); }
    100% { transform: translateY(-28px); }
  }

  /* Ceremony Dialog Mobile */
  .cinematic-dialog {
    width: 94%;
    max-width: 94%;
    bottom: max(14px, env(safe-area-inset-bottom, 14px));
    padding: 14px 16px;
    border-radius: 16px;
  }
  .dialog-speaker {
    font-size: 0.78rem;
    margin-bottom: 4px;
  }
  .dialog-text {
    font-size: 0.95rem;
    line-height: 1.45;
    min-height: 48px;
  }
  .dialog-subtext {
    font-size: 0.74rem;
    margin-top: 4px;
  }
  .dialog-actions {
    margin-top: 10px;
  }
  .dialog-next-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
  }
  .dialog-hint {
    display: none;
  }

  /* Candidacy Modal Mobile */
  .guardian-modal-overlay {
    padding: 12px;
  }
  .guardian-modal-box {
    padding: 20px 14px;
    border-radius: 16px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-title {
    font-size: 1.15rem;
  }
  .modal-subtitle {
    font-size: 0.82rem;
  }
  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .btn-modal-cancel, .btn-modal-submit {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 12px;
  }
}

@media (max-width: 380px) {
  .shrine-content {
    padding: 20px 10px;
  }
  .miracle-box-3d {
    width: 250px;
    height: 250px;
  }
  .shrine-name {
    font-size: 1.3rem;
  }
  .time-block {
    min-width: 38px;
    padding: 5px 6px;
  }
  .t-val {
    font-size: 1.1rem;
  }
  .spirit-name {
    max-width: 95px;
    font-size: 0.82rem;
  }
}
