:root {
  --night-deep: #060b16;
  --night-mid: #0e1b33;
  --night-blue: #1a2f52;
  --moon-silver: #eef6ff;
  --moon-glow: #a8d4ff;
  --butterfly-cyan: #4be1ff;
  --butterfly-blue: #2f9bff;
  --forget-blue: #6eb5ff;
  --glass-bg: rgba(10, 19, 36, 0.76);
  --glass-border: rgba(158, 210, 255, 0.36);
  --glass-highlight: rgba(255, 255, 255, 0.12);
  --text-primary: #eef5ff;
  --text-secondary: #b4cae8;
  --text-muted: #7894b8;
  --font-serif: 'Cormorant Garamond', 'Playfair Display', 'Noto Serif JP', 'Noto Serif SC', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif SC', serif;
}

html[data-lang="zh"] {
  --accent-glow: rgba(110, 181, 255, 0.55);
}
html[data-lang="ja"] {
  --accent-glow: rgba(75, 225, 255, 0.6);
}
html[data-lang="en"] {
  --accent-glow: rgba(148, 163, 255, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--night-deep);
  color: var(--text-primary);
  font-family: var(--font-serif);
  user-select: none;
}

/* Main Moonlit Sanctuary Viewport */
.sanctuary-viewport {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: radial-gradient(circle at 24% 24%, #264573 0%, #101f3a 42%, #070d1a 85%, #040710 100%);
}

/* Fine Gothic Vignette & Silver Inner Frame */
.sanctuary-viewport::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(168, 212, 255, 0.22);
  border-radius: 6px;
  pointer-events: none;
  z-index: 40;
  box-shadow: inset 0 0 80px rgba(3, 6, 14, 0.75);
}

/* Background Moonlit Cemetery SVG */
.cemetery-bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 1;
}

/* Drifting Ground Mist Layers */
.mist-layer {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 280px;
  bottom: 0;
  background: radial-gradient(ellipse at 50% 60%, rgba(120, 175, 235, 0.14) 0%, rgba(18, 35, 64, 0.05) 60%, transparent 80%);
  filter: blur(22px);
  pointer-events: none;
  z-index: 6;
  animation: mistDrift 14s ease-in-out infinite alternate;
}

@keyframes mistDrift {
  0% { transform: translateX(-3%) translateY(0); opacity: 0.7; }
  100% { transform: translateX(3%) translateY(-10px); opacity: 1; }
}

/* Ambient Glowing Butterflies Layer */
.butterflies-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 18;
}

.glowing-butterfly {
  position: absolute;
  filter:
    drop-shadow(0 0 6px rgba(75, 225, 255, 0.9))
    drop-shadow(0 0 14px rgba(47, 155, 255, 0.65));
  animation: butterflyFloat 7s ease-in-out infinite;
}

.glowing-butterfly .wing-l,
.glowing-butterfly .wing-r {
  transform-origin: center;
  animation: wingFlap 1.8s ease-in-out infinite;
}

@keyframes butterflyFloat {
  0%, 100% { transform: translate(0, 0) rotate(-6deg); }
  50% { transform: translate(10px, -16px) rotate(6deg); }
}

@keyframes wingFlap {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(0.72); }
}

/* ==================== TOP HEADER BAR ==================== */
.top-vn-header {
  position: relative;
  z-index: 35;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 34px 48px 12px 48px;
  gap: 20px;
}

.brand-title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-domain-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.domain-logo-text {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 4vw, 3.7rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f4f9ff;
  line-height: 1;
  text-shadow:
    0 0 18px rgba(130, 195, 255, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.75);
}

.domain-logo-text .dot-cyan {
  color: var(--butterfly-cyan);
  text-shadow: 0 0 14px var(--butterfly-cyan);
}

.brand-subtitle-line {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  padding-left: 2px;
}

/* Top-Right Language Switcher & Galgame System Buttons */
.top-right-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Weekly Tombstone Overgrowth Badge (UTC+8 Sunday 10:00 AM Easter Egg) */
.grave-cycle-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(11, 26, 46, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(104, 181, 176, 0.48);
  border-radius: 999px;
  padding: 6px 14px;
  color: #cfeee8;
  font-family: var(--font-serif);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(72, 168, 160, 0.14);
  transition: all 0.25s ease;
}

.grave-cycle-badge:hover {
  border-color: var(--butterfly-cyan);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(75, 225, 255, 0.38);
}

.lang-glass-bar {
  display: inline-flex;
  align-items: center;
  background: rgba(11, 22, 42, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 5px 10px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    inset 0 0 12px rgba(120, 190, 255, 0.1);
  gap: 4px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.lang-btn:hover {
  color: #ffffff;
  background: rgba(75, 225, 255, 0.14);
}

.lang-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(75, 225, 255, 0.28) 0%, rgba(47, 155, 255, 0.38) 100%);
  box-shadow: 0 0 12px rgba(75, 225, 255, 0.35);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.lang-slash {
  color: rgba(158, 210, 255, 0.35);
  font-size: 0.85rem;
  pointer-events: none;
}

/* Galgame Utility Square Buttons */
.vn-icon-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vn-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: rgba(11, 22, 42, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
}

.vn-icon-btn:hover,
.vn-icon-btn.active {
  color: var(--butterfly-cyan);
  border-color: var(--butterfly-cyan);
  box-shadow: 0 0 14px rgba(75, 225, 255, 0.4);
  transform: translateY(-1px);
}

/* ==================== MAIN VISUAL NOVEL STAGE ==================== */
.vn-stage-grid {
  position: relative;
  z-index: 20;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(310px, 410px) 1fr auto;
  align-items: end;
  padding: 0 38px 10px 38px;
  gap: 12px;
}

/* Bottom-Left Translucent Epitaph Dialog Box (Matches alice_rip_anime_maid_1.jpg) */
.epitaph-dialog-box {
  position: relative;
  z-index: 28;
  background: linear-gradient(160deg, rgba(14, 26, 48, 0.84) 0%, rgba(7, 14, 28, 0.9) 100%);
  backdrop-filter: blur(14px);
  border: 1.5px solid rgba(168, 214, 255, 0.45);
  border-radius: 18px;
  padding: 26px 30px 24px 30px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    0 0 28px rgba(75, 225, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.epitaph-dialog-box:hover {
  border-color: rgba(110, 215, 255, 0.72);
}

/* Inner Corner Filigree Lines */
.epitaph-dialog-box::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 13px;
  border: 1px solid rgba(158, 210, 255, 0.16);
  pointer-events: none;
}

.epitaph-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.epitaph-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.epitaph-title-text {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #dff0ff;
  text-shadow: 0 0 10px rgba(75, 225, 255, 0.45);
}

.chapter-indicator {
  font-size: 0.76rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.2s ease;
}

.chapter-indicator:hover {
  color: var(--butterfly-cyan);
}

.epitaph-body-lines {
  font-size: 1.02rem;
  line-height: 2.05;
  letter-spacing: 0.08em;
  color: #e6f2ff;
  margin-bottom: 22px;
  min-height: 130px;
  cursor: pointer;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.epitaph-body-lines .highlight-end {
  color: var(--butterfly-cyan);
  text-shadow: 0 0 10px rgba(75, 225, 255, 0.55);
  font-weight: 700;
}

.epitaph-botanical-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #8ccac4;
  background: rgba(14, 34, 52, 0.62);
  border: 1px dashed rgba(104, 181, 176, 0.38);
  border-radius: 9px;
  padding: 6px 12px;
  margin-bottom: 16px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.22s ease;
}

.epitaph-botanical-note:hover {
  border-color: var(--butterfly-cyan);
  color: #d8f8f5;
  background: rgba(20, 48, 74, 0.75);
}

.epitaph-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Offer Flowers Pill Button (Matches "❀ 花を手向ける >" in mockup) */
.offer-flower-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(32, 64, 108, 0.88) 0%, rgba(18, 38, 72, 0.95) 100%);
  border: 1.5px solid rgba(135, 206, 255, 0.65);
  border-radius: 999px;
  padding: 10px 24px;
  color: #f0f8ff;
  font-family: var(--font-serif);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.5),
    0 0 16px rgba(75, 225, 255, 0.25),
    inset 0 0 12px rgba(120, 200, 255, 0.2);
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.offer-flower-btn:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: var(--butterfly-cyan);
  background: linear-gradient(135deg, rgba(45, 92, 152, 0.92) 0%, rgba(24, 52, 98, 0.98) 100%);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.6),
    0 0 24px rgba(75, 225, 255, 0.55);
}

.offer-flower-btn:active {
  transform: translateY(1px) scale(0.98);
}

.flower-tribute-counter {
  font-size: 0.82rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==================== CENTERPIECE: ALICE & TOMBSTONE VECTOR SVG ==================== */
.centerpiece-grave-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  min-height: 540px;
}

/* Soft Moonlight Backlight Halo behind Alice & Gravestone */
.moonlight-Aura {
  position: absolute;
  width: 520px;
  height: 520px;
  bottom: 40px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(142, 204, 255, 0.26) 0%,
    rgba(68, 138, 218, 0.12) 48%,
    transparent 74%
  );
  filter: blur(12px);
  pointer-events: none;
  z-index: 2;
}

.alice-tombstone-wrapper {
  position: relative;
  z-index: 12;
  width: clamp(360px, 44vw, 640px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  /* Moonlight rim glow & deep cemetery grounding shadow */
  filter:
    drop-shadow(0 -2px 10px rgba(175, 222, 255, 0.35))
    drop-shadow(0 18px 36px rgba(2, 5, 12, 0.88));
  transition: filter 0.4s ease, transform 0.4s ease;
}

/* Stacked AI-Illustrated & Vector-Traced Overgrowth Stage SVGs */
.stage-base-svg {
  position: relative;
  z-index: 12;
}

.stage-overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 13;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease, clip-path 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.alice-tombstone-wrapper:hover {
  filter:
    drop-shadow(0 -2px 16px rgba(110, 215, 255, 0.55))
    drop-shadow(0 20px 42px rgba(2, 5, 12, 0.92));
}

.alice-tombstone-svg {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  /* Subtle cool moonlight color grading so the white-background vector blends seamlessly into night */
  filter: brightness(0.93) contrast(1.04) saturate(0.96);
}

/* Floating & Fallen Black Spades Playing Cards around Alice */
.spade-card-prop {
  position: absolute;
  z-index: 16;
  cursor: pointer;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.75));
  transition: transform 0.35s ease;
}

.spade-card-prop:hover {
  transform: translateY(-8px) rotate(8deg) scale(1.1) !important;
}

.card-floating-left {
  top: 26%;
  left: 4%;
  width: 74px;
  height: 98px;
  animation: cardDriftA 6s ease-in-out infinite;
}

.card-floating-top-right {
  top: 14%;
  right: 12%;
  width: 64px;
  height: 86px;
  animation: cardDriftB 5.4s ease-in-out infinite 1.2s;
}

.card-ground-center {
  bottom: 8px;
  left: 46%;
  width: 78px;
  height: 54px;
  z-index: 15;
}

.card-ground-right {
  bottom: 18px;
  right: 8%;
  width: 72px;
  height: 50px;
  z-index: 15;
}

@keyframes cardDriftA {
  0%, 100% { transform: translateY(0) rotate(-18deg); }
  50% { transform: translateY(-14px) rotate(-8deg); }
}

@keyframes cardDriftB {
  0%, 100% { transform: translateY(0) rotate(22deg); }
  50% { transform: translateY(-12px) rotate(12deg); }
}

/* ==================== FAR-RIGHT VERTICAL CHARACTER BIO & POETIC QUOTE ==================== */
.right-vertical-bio {
  position: relative;
  z-index: 28;
  height: 100%;
  min-height: 460px;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 18px;
  padding-top: 24px;
  padding-bottom: 36px;
}

.vertical-char-header {
  writing-mode: vertical-rl;
  text-orientation: upright;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f0f7ff;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-shadow: 0 0 14px rgba(75, 225, 255, 0.55);
  border-left: 1px solid rgba(158, 210, 255, 0.3);
  padding-left: 12px;
}

.vertical-cv-tag {
  writing-mode: vertical-rl;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-top: 8px;
}

.vertical-quote-line {
  writing-mode: vertical-rl;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.9;
  color: #d6e9ff;
  text-shadow:
    0 0 12px rgba(75, 225, 255, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.9);
  max-height: 420px;
}

/* ==================== BOTTOM FOOTER BAR ==================== */
.sanctuary-footer {
  position: relative;
  z-index: 32;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 48px 24px 48px;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.footer-left-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.twin-gift-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a8d4ff;
  text-decoration: none;
  background: rgba(16, 34, 62, 0.72);
  border: 1px solid rgba(135, 206, 255, 0.35);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  transition: all 0.25s ease;
}

.twin-gift-link:hover {
  background: rgba(255, 126, 179, 0.22);
  border-color: #ff9ec6;
  color: #ffe6f0;
  box-shadow: 0 0 14px rgba(255, 126, 179, 0.35);
}

/* ==================== MEMORIAL FLOWER TRIBUTE MODAL ==================== */
.tribute-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 16, 0.74);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tribute-modal-backdrop.open {
  display: flex;
  animation: modalFade 0.3s ease;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tribute-modal-card {
  position: relative;
  width: 100%;
  max-width: 490px;
  background: linear-gradient(165deg, rgba(14, 28, 54, 0.96) 0%, rgba(6, 13, 26, 0.98) 100%);
  border: 1.5px solid rgba(135, 206, 255, 0.55);
  border-radius: 22px;
  padding: 34px 32px 28px 32px;
  text-align: center;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.85),
    0 0 36px rgba(75, 225, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.tribute-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(158, 210, 255, 0.35);
  background: rgba(15, 30, 56, 0.8);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tribute-close-btn:hover {
  color: #ffffff;
  border-color: var(--butterfly-cyan);
  background: rgba(75, 225, 255, 0.25);
}

.tribute-svg-art {
  width: 130px;
  height: 130px;
  margin: 0 auto 14px auto;
  filter: drop-shadow(0 0 16px rgba(75, 225, 255, 0.55));
}

.tribute-eyebrow {
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  color: var(--butterfly-cyan);
  margin-bottom: 8px;
}

.tribute-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f2f8ff;
  margin-bottom: 12px;
  letter-spacing: 0.06em;
}

.tribute-message {
  font-size: 0.96rem;
  line-height: 1.85;
  color: var(--text-secondary);
  background: rgba(8, 16, 32, 0.65);
  border: 1px solid rgba(135, 206, 255, 0.24);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 22px;
}

.tribute-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.tribute-btn-primary {
  background: linear-gradient(135deg, #2b6cb0 0%, #1e4e8c 100%);
  border: 1px solid #7cc4ff;
  color: #ffffff;
  border-radius: 999px;
  padding: 10px 24px;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(75, 225, 255, 0.35);
  transition: all 0.2s ease;
}

.tribute-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(75, 225, 255, 0.6);
}

/* Floating Particle Burst Container */
.night-particles-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 120;
  overflow: hidden;
}

.night-particle {
  position: absolute;
  will-change: transform, opacity;
  animation: nightParticleRise 2.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes nightParticleRise {
  0% {
    transform: translate(0, 0) scale(0.4) rotate(0deg);
    opacity: 0.95;
  }
  70% {
    opacity: 0.9;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(1.15) rotate(var(--rot));
    opacity: 0;
  }
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */
@media (max-width: 720px) {
  .vn-stage-grid {
    grid-template-columns: 1fr;
    padding: 0 28px 18px 28px;
  }
  .centerpiece-grave-stage {
    order: 1;
    min-height: 430px;
  }
  .epitaph-dialog-box {
    order: 2;
    max-width: 560px;
    margin: 0 auto 14px auto;
  }
  .right-vertical-bio {
    display: none;
  }
}

@media (max-width: 680px) {
  .top-vn-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 20px 10px 20px;
  }
  .sanctuary-footer {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 10px 20px 20px 20px;
  }
}
