/*
Theme Name: Aemeath Wuthering Waves Theme
Theme URI: 
Author: An
Description: Giao diện fanmade cho Aemeath - Wuthering Waves.
Version: 1.0
*/


/* ==========================================================================
   AEMEATH FAN WEBSITE — style.css
   Author: An © 2026 | Wuthering Waves Fan
   Structure: Design System → Base → Layout → Components → Sections → Responsive
   ========================================================================== */

/* ==========================================================================
   1. DESIGN SYSTEM — CSS Custom Properties
   ========================================================================== */
:root {
  /* --- 1. HỆ THỐNG MÀU ĐỔI THEO CẢM XÚC (THAY THẾ PHẦN ĐẦU) --- */
  --bg-main:         #f8f7fc;
  --bg-soft:         #f1eefc;
  --bg-card:         #ffffff;
  --primary:         #a78bfa;
  --primary-dark:    #7c3aed;
  --accent:          #c4b5fd;
  --accent-light:    #ede9fe;
  --aemeath-glow:    rgba(167, 139, 250, 0.22);
  
  /* Các màu cố định khác */
  --text-main:       #1f2937;
  --text-sub:        #6b7280;
  --text-muted:      #9ca3af;
  --border:          #e5e7eb;
  --border-soft:     #f3f0fc;

  /* --- 2. GIỮ LẠI CÁC THÔNG SỐ KỸ THUẬT (KHÔNG ĐƯỢC XÓA) --- */
  --aemeath-primary:   #a78bfa;
  --aemeath-glow-md:   rgba(167, 139, 250, 0.38);
  --aemeath-gradient:  linear-gradient(135deg, #f8f7fc 0%, #ede9fe 100%);
  --aemeath-hero:      linear-gradient(160deg, #faf8ff 0%, #ede9fe 55%, #ddd6fe 100%);

  --shadow-sm:    0 2px 8px rgba(0,0,0,0.06);
  --shadow:       0 10px 30px rgba(0,0,0,0.08);
  --shadow-md:    0 14px 40px rgba(0,0,0,0.12);
  --shadow-glow:  0 0 32px var(--aemeath-glow);
  --shadow-card:  0 4px 20px rgba(130, 90, 250, 0.10);

  --radius:       14px;
  --radius-sm:    8px;
  --radius-lg:    24px;
  --radius-full:  9999px;
  --max-width:    1200px;
  --container-px: clamp(1.25rem, 5vw, 2.5rem);

  --sp-1:  0.25rem; --sp-2:  0.5rem; --sp-3:  0.75rem; --sp-4:  1rem;
  --sp-5:  1.25rem; --sp-6:  1.5rem; --sp-8:  2rem; --sp-10: 2.5rem;
  --sp-12: 3rem; --sp-16: 4rem; --sp-20: 5rem; --sp-24: 6rem;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Poppins', system-ui, sans-serif;
  --font-size-xs: 0.75rem; --font-size-sm: 0.875rem; --font-size-base: 1rem;
  --font-size-lg: 1.125rem; --font-size-xl: 1.25rem; --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem; --font-size-4xl: 2.75rem; --font-size-5xl: 3.75rem;

  --transition-fast: 0.2s ease; --transition-base: 0.4s ease;
  --transition-slow: 0.8s ease; --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  --z-base: 1; --z-float: 10; --z-nav: 100; --z-modal: 200; --z-toast: 300; --z-cursor: 400;

  /* Hiệu ứng chuyển màu mượt mà */
  transition: background 0.8s ease, --primary 0.8s ease, --aemeath-glow 0.8s ease;
}

/* --- 3. ĐỊNH NGHĨA CÁC LỚP CẢM XÚC (DƯỚI ROOT) --- */
/* --- TRẠNG THÁI CẢM XÚC CỰC MẠNH --- */

/* --- TRẠNG THÁI THỰC THỂ CHIẾM HỮU --- */

/* 1. KHI BUỒN: Hố đen nuốt chửng */
body.mood-sad {
  --bg-main: #000;
  transition: all 2s cubic-bezier(0.4, 0, 0.2, 1);
}
body.mood-sad main {
  filter: blur(10px) grayscale(1) brightness(0.3); /* Làm mờ mịt mọi thứ */
  transform: scale(0.95);
  pointer-events: none; /* Khóa toàn bộ tương tác web, chỉ cho nhìn Aemeath */
}
body.mood-sad::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, transparent 10%, #000 80%);
  z-index: 9998;
  pointer-events: none;
}

/* 2. KHI VUI (HAPPY): Rực rỡ ánh bình minh hồng rạng rỡ */
body.mood-happy {
  --bg-main: linear-gradient(135deg, #fff1f2 0%, #fae8ff 100%);
  --primary: #f472b6;
  --aemeath-glow: rgba(244, 114, 182, 0.5);
}
body.mood-happy .hero__aura {
  background: radial-gradient(circle, rgba(244, 114, 182, 0.4) 0%, transparent 70%);
  animation: auraPulse 2s ease-in-out infinite;
}

/* 2. KHI CHÓNG MẶT/GLITCH: RGB Split + Bẻ cong màn hình */
body.mood-dizzy {
  overflow: hidden;
}
body.mood-dizzy main {
  animation: realityBreak 0.2s infinite;
  filter: hue-rotate(90deg);
}

@keyframes realityBreak {
  0% { transform: translate(0) skew(0); }
  25% { transform: translate(-10px, 5px) skew(5deg); filter: drop-shadow(5px 0 red); }
  75% { transform: translate(10px, -5px) skew(-5deg); filter: drop-shadow(-5px 0 blue); }
  100% { transform: translate(0); }
}


/* 3. KHI GIẬT MÌNH: Flashbang (Mù mắt) */
body.mood-surprise::after {
  content: "";
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 10000;
  animation: flashBang 0.8s ease-out forwards;
}

@keyframes flashBang {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- ANIMATIONS HỖ TRỢ --- */
@keyframes snowFall {
  from { background-position: 0 0; }
  to { background-position: 500px 1000px; }
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

/* --- 4. GIỮ LẠI HIỆU ỨNG NHIỄU HẠT --- */
body::before {
  content: ""; position: fixed; inset: 0;
  background-image: url('https://grainy-gradients.vercel.app/noise.svg');
  opacity: 0.05; pointer-events: none; z-index: 9999;
}


.memory-card {
  transform: rotate(calc(var(--random-deg, 1) * 1deg)); /* Cần thêm JS để random deg */
  padding: 10px 10px 30px 10px;
  background: #fff;
  border-radius: 0; /* Bỏ bo góc của AI đi */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* ==========================================================================
   2. BASE — Reset & Typography
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--text-main);
  background-color: var(--bg-main);
  line-height: 1.7;
  overflow-x: hidden;
  cursor: none; /* replaced by custom cursor */
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: none; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--text-main);
}

/* Selection */
::selection {
  background: var(--aemeath-glow-md);
  color: var(--primary-dark);
}

/* ==========================================================================
   3. LAYOUT — Container, Grid helpers
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--container-px);
}

.section {
  padding-block: var(--sp-24);
  position: relative;
}

.grid {
  display: grid;
  gap: var(--sp-6);
}

/* ==========================================================================
   4. COMPONENTS
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--font-size-sm);
  border: 2px solid transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
  cursor: none;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--aemeath-glow);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 6px 24px var(--aemeath-glow-md);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--accent-light);
  box-shadow: 0 4px 16px var(--aemeath-glow);
  transform: translateY(-2px);
}

.btn--sm   { padding: 0.45rem 1rem; font-size: var(--font-size-xs); }
.btn--full { width: 100%; justify-content: center; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-sub);
  transition: color var(--transition-fast);
}
.btn-icon:hover { color: var(--primary); }

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  cursor: none;
}

/* ---- Tags ---- */
.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  background: var(--accent-light);
  color: var(--primary-dark);
  border: 1px solid var(--border-soft);
}

.tag--accent {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tag--soft {
  background: var(--bg-soft);
  color: var(--text-sub);
  border-color: var(--border);
}

/* ---- Cards (base) ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.card__title { font-size: var(--font-size-xl); margin-bottom: var(--sp-2); }
.card__desc  { color: var(--text-sub); font-size: var(--font-size-sm); }

/* ---- Section header ---- */
.section__header {
  text-align: center;
  margin-bottom: var(--sp-12);
}

.section__eyebrow {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--sp-3);
}

.section__title {
  font-size: clamp(var(--font-size-2xl), 4vw, var(--font-size-4xl));
  font-family: var(--font-display);
  color: var(--text-main);
  margin-bottom: var(--sp-3);
}

.section__title--center { text-align: center; }

.section__sub {
  color: var(--text-sub);
  font-size: var(--font-size-lg);
  max-width: 560px;
  margin-inline: auto;
}

/* ---- Form elements ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.form-group label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  background: var(--bg-soft);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--aemeath-primary);
  box-shadow: 0 0 0 3px var(--aemeath-glow);
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  top: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.75rem 1.25rem;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  pointer-events: all;
  animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  max-width: 320px;
}

.toast--success { border-left-color: #10b981; }
.toast--error   { border-left-color: #ef4444; }

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast i { color: var(--primary); font-size: 1rem; }
.toast--success i { color: #10b981; }
.toast--error   i { color: #ef4444; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(120%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(120%); }
}

/* ---- Hidden utility ---- */
.hidden { display: none !important; }

/* ==========================================================================
   5. CURSOR ORB (Signature element)
   ========================================================================== */
.cursor-orb {
  position: fixed;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, background 0.3s, opacity 0.3s;
  mix-blend-mode: multiply;
}

.cursor-trail {
  position: fixed;
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--aemeath-glow-md);
  border-radius: 50%;
  pointer-events: none;
  z-index: calc(var(--z-cursor) - 1);
  transform: translate(-50%, -50%);
  transition: left 0.12s ease, top 0.12s ease, width 0.3s, height 0.3s, opacity 0.3s;
}

body:has(a:hover) .cursor-orb,
body:has(button:hover) .cursor-orb {
  width: 36px;
  height: 36px;
  background: var(--accent);
  opacity: 0.6;
}

/* ==========================================================================
   6. SOUND TOGGLE
   ========================================================================== */
.sound-toggle {
  position: fixed;
  bottom: var(--sp-8);
  right: var(--sp-6);
  z-index: var(--z-float);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  box-shadow: var(--shadow-sm);
  transition: color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-spring);
  font-size: 1rem;
}

.sound-toggle:hover {
  color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: scale(1.1);
}

.sound-toggle.active {
  background: var(--accent-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   7. NAVBAR
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: rgba(248, 247, 252, 0.85);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.site-header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 24px rgba(130, 90, 250, 0.08);
  background: rgba(248, 247, 252, 0.96);
}

.navbar {
  display: flex;
  align-items: center;
  height: 68px;
  gap: var(--sp-8);
}

/* Logo */
.navbar__logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--font-size-xl);
  color: var(--primary-dark);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.navbar__logo-icon {
  color: var(--primary);
  font-size: 1.4rem;
  animation: logoSpin 8s linear infinite;
}

@keyframes logoSpin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Menu */
.navbar__menu {
  display: flex;
  gap: var(--sp-1);
  flex: 1;
}

.navbar__link {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-sub);
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}

.navbar__link:hover,
.navbar__link.active {
  color: var(--primary-dark);
  background: var(--accent-light);
}

/* Actions */
.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
}

.navbar__icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  font-size: 0.95rem;
  transition: color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.navbar__icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--aemeath-glow);
}

/* Login dropdown */
.navbar__login-wrap {
  position: relative;
}

.navbar__dropdown {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 170px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: var(--z-float);
}

.navbar__dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.navbar__dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 0.7rem 1.1rem;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--text-main);
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.navbar__dropdown-item:hover {
  background: var(--accent-light);
  color: var(--primary-dark);
}

/* Hamburger */
.navbar__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: none;
  border: none;
  padding: 6px;
}

.navbar__hamburger span {
  display: block;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: transform var(--transition-base), opacity var(--transition-fast);
}

.navbar__hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar__hamburger.open span:nth-child(2) { opacity: 0; }
.navbar__hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  inset: 68px 0 0 0;
  background: rgba(248, 247, 252, 0.97);
  backdrop-filter: blur(16px);
  z-index: calc(var(--z-nav) - 1);
  padding: var(--sp-8) var(--container-px);
  flex-direction: column;
  gap: var(--sp-2);
  border-top: 1px solid var(--border);
  transform: translateY(-100%);
  transition: transform var(--transition-base);
}

.mobile-drawer.open {
  transform: translateY(0);
}

.mobile-drawer ul {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.mobile-drawer .navbar__link {
  font-size: var(--font-size-base);
  padding: 0.75rem 1rem;
  display: block;
}

/* ==========================================================================
   8. HERO SECTION
   ========================================================================== */
.section--hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: var(--aemeath-hero);
  overflow: hidden;
  padding-block: 0;
}

/* Blobs */
.hero__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
}

.hero__blob--1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #c4b5fd 0%, transparent 70%);
  top: -10%;
  right: -8%;
  animation: blobFloat 12s ease-in-out infinite;
}

.hero__blob--2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #ddd6fe 0%, transparent 70%);
  bottom: 10%;
  left: -5%;
  animation: blobFloat 15s ease-in-out infinite reverse;
}

.hero__blob--3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, #f0abfc 0%, transparent 70%);
  top: 40%;
  left: 35%;
  animation: blobFloat 10s ease-in-out infinite 2s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.05); }
  66%       { transform: translate(-15px, 20px) scale(0.97); }
}

/* Particles */
.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  animation: particleDrift var(--dur, 8s) ease-in-out var(--d, 0s) infinite;
}

@keyframes particleDrift {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-10vh) scale(1.2); opacity: 0; }
}

/* Hero layout */
.hero__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-12);
  min-height: 100vh;
  padding-block: var(--sp-20);
}

.hero__content {
  max-width: 580px;
}

.hero__eyebrow {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--sp-4);
}

.hero__title {
  font-size: clamp(var(--font-size-4xl), 7vw, var(--font-size-5xl));
  font-family: var(--font-display);
  line-height: 1.1;
  color: var(--text-main);
  margin-bottom: var(--sp-5);
}

.hero__title em {
  font-style: italic;
  color: var(--primary);
  font-size: 0.7em;
  display: block;
  margin-top: var(--sp-2);
}

.hero__sub {
  color: var(--text-sub);
  font-size: var(--font-size-lg);
  line-height: 1.7;
  margin-bottom: var(--sp-8);
  max-width: 480px;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-10);
}

/* Floating badges */
.hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.hero__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.75rem 1.1rem;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  min-width: 80px;
  animation: badgeFloat 4s ease-in-out infinite;
  box-shadow: var(--shadow-sm);
}

.hero__badge:nth-child(2) { animation-delay: 1.2s; }
.hero__badge:nth-child(3) { animation-delay: 2.4s; }

@keyframes badgeFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.hero__badge i      { color: var(--primary); font-size: 1.1rem; }
.hero__badge-val    { font-weight: 700; font-size: var(--font-size-sm); color: var(--text-main); }
.hero__badge-label  { font-size: var(--font-size-xs); color: var(--text-sub); }

/* Hero image */
.hero__image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero__aura {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--aemeath-glow-md) 0%, transparent 70%);
  animation: auraPulse 4s ease-in-out infinite;
  pointer-events: none;
}

.hero__ring {
  position: absolute;
  width: 490px;
  height: 490px;
  border-radius: 50%;
  border: 1px solid var(--aemeath-glow-md);
  animation: ringRotate 20s linear infinite;
  pointer-events: none;
}

.hero__ring::after {
  content: '✦';
  position: absolute;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--primary);
  font-size: 1.4rem;
}

@keyframes auraPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50%       { transform: scale(1.08); opacity: 1; }
}

@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.hero__image {
  position: relative;
  z-index: 2;
  width: clamp(280px, 35vw, 460px);
  height: auto;
  border-radius: var(--radius-lg);
  object-fit: cover;
  filter: drop-shadow(0 20px 40px rgba(130, 90, 250, 0.3));
  transition: transform var(--transition-base), filter var(--transition-base);
}

.hero__image-wrap:hover .hero__image {
  transform: scale(1.02) translateY(-4px);
  filter: drop-shadow(0 28px 50px rgba(130, 90, 250, 0.4));
}

/* Mouse parallax target */
.hero__image-wrap[data-parallax] {
  transition: transform 0.1s linear;
}

/* Scroll hint */
.hero__scroll-hint {
  position: absolute;
  bottom: var(--sp-8);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__scroll-hint span {
  width: 24px;
  height: 40px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  display: block;
  position: relative;
}

.hero__scroll-hint span::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: var(--primary);
  border-radius: 2px;
  animation: scrollDot 2s ease-in-out infinite;
}

@keyframes scrollDot {
  0%   { top: 6px; opacity: 1; }
  80%  { top: 22px; opacity: 0.2; }
  100% { top: 6px; opacity: 1; }
}

/* ==========================================================================
   9. CHARACTER INTRO
   ========================================================================== */
.section--intro {
  background: var(--bg-main);
}

.intro__grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-16);
  align-items: start;
  margin-bottom: var(--sp-20);
}

/* Avatar */
.intro__avatar-col { display: flex; justify-content: center; }

.intro__avatar-frame {
  position: relative;
  transform: rotate(-2.5deg);
}

.intro__avatar-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--aemeath-glow-md) 0%, transparent 70%);
  animation: auraPulse 5s ease-in-out infinite;
}

.intro__avatar {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: 0 0 0 3px var(--accent), var(--shadow-md);
  position: relative;
  z-index: 1;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.intro__avatar-frame:hover .intro__avatar {
  transform: scale(1.04) rotate(2.5deg);
  box-shadow: 0 0 0 4px var(--primary), var(--shadow-glow);
}

.intro__avatar-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 3px solid white;
  z-index: 2;
  animation: badgeFloat 3s ease-in-out infinite 0.5s;
}

/* Info */
.intro__info-col { padding-top: var(--sp-4); }
.intro__desc {
  color: var(--text-sub);
  font-size: var(--font-size-lg);
  margin-bottom: var(--sp-4);
  line-height: 1.8;
}

.intro__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-8);
  margin-top: var(--sp-4);
}

/* Stats */
.intro__stats { display: flex; flex-direction: column; gap: var(--sp-4); }

.intro__stat {
  display: grid;
  grid-template-columns: 90px 1fr 36px;
  align-items: center;
  gap: var(--sp-3);
}

.intro__stat-label { font-size: var(--font-size-sm); color: var(--text-sub); }
.intro__stat-val   { font-size: var(--font-size-sm); font-weight: 600; color: var(--primary-dark); text-align: right; }

.intro__stat-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.intro__stat-fill {
  height: 100%;
  width: var(--pct, 0%);
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-full);
  transition: width 1.2s cubic-bezier(0.25, 1, 0.5, 1);
  width: 0; /* animated on view */
}

.intro__stat-fill.animated { width: var(--pct); }

/* ==========================================================================
   10. PREVIEW CARDS (homepage)
   ========================================================================== */
.preview-row {
  padding-top: var(--sp-8);
}

.preview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
  margin-top: var(--sp-8);
}

.preview-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  border: 1px solid var(--border-soft);
}

.preview-card--story {
  background: linear-gradient(145deg, #faf8ff 0%, #ede9fe 100%);
}

.preview-card--quest {
  background: linear-gradient(145deg, #f8f7fc 0%, #e0e7ff 100%);
  transform: translateY(12px); /* intentional offset */
}

.preview-card--rewards {
  background: linear-gradient(145deg, #fef3f2 0%, #fde8ff 100%);
}

.preview-card__bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: var(--aemeath-glow);
  transition: opacity var(--transition-base);
}

.preview-card:hover .preview-card__bg { opacity: 1; }

.preview-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card), 0 0 30px var(--aemeath-glow);
}

.preview-card--quest:hover { transform: translateY(6px); }

.preview-card__icon {
  font-size: 2rem;
  color: var(--primary);
  position: relative;
  z-index: 1;
}

.preview-card__title {
  font-size: var(--font-size-xl);
  font-family: var(--font-display);
  position: relative;
  z-index: 1;
}

.preview-card__sub {
  font-size: var(--font-size-sm);
  color: var(--text-sub);
  position: relative;
  z-index: 1;
  flex: 1;
}

.preview-card__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--primary-dark);
  position: relative;
  z-index: 1;
  transition: gap var(--transition-fast);
}

.preview-card:hover .preview-card__cta { gap: var(--sp-3); }

/* ==========================================================================
   11. CHAT SECTION
   ========================================================================== */
.section--chat {
  background: var(--bg-soft);
}

.chat-window {
  max-width: 720px;
  margin-inline: auto;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  height: 560px;
  overflow: hidden;
}

.chat-window__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: rgba(248, 247, 252, 0.8);
}

.chat-window__avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.chat-window__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
}

.chat-window__status {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid white;
}

.chat-window__info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.chat-window__info strong {
  font-family: var(--font-display);
  font-size: var(--font-size-base);
}

.chat-window__info span {
  font-size: var(--font-size-xs);
  color: #10b981;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  scroll-behavior: smooth;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  text-align: center;
  padding: var(--sp-8);
}

.chat-empty i { font-size: 2.5rem; color: var(--accent); }
.chat-empty p { line-height: 1.7; }

/* Message bubbles */
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  animation: msgAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-msg--user {
  flex-direction: row-reverse;
}

.chat-msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.chat-msg__bubble {
  max-width: 70%;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}

.chat-msg--aemeath .chat-msg__bubble {
  background: var(--accent-light);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.chat-msg--user .chat-msg__bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-msg__time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: var(--sp-1);
  display: block;
  text-align: right;
}

.chat-msg--aemeath .chat-msg__time { text-align: left; }

@keyframes msgAppear {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.3rem 0;
}

.chat-typing__dots {
  display: flex;
  gap: 4px;
}

.chat-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.chat-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* Input row */
.chat-input-row {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: rgba(248, 247, 252, 0.6);
}

.chat-input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  background: white;
  outline: none;
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--aemeath-primary);
  box-shadow: 0 0 0 3px var(--aemeath-glow);
}

.chat-send {
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ==========================================================================
   12. STORY SECTION
   ========================================================================== */
.section--story {
  background: var(--bg-main);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: auto;
  gap: var(--sp-6);
}

/* Featured card (full width top) */
.story-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-height: 380px;
}

.story-card--featured .story-card__img-wrap {
  height: 100%;
}

.story-card--featured .story-card__img {
  height: 100%;
  object-fit: cover;
}

/* Wide card (full width bottom) */
.story-card--wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  max-height: 280px;
}

.story-card--wide .story-card__img-wrap {
  height: 100%;
}

/* Offset card — slight transform for personality */
.story-card--offset {
  transform: translateY(10px);
}

/* Base story card */
.story-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.story-card:hover {
  box-shadow: var(--shadow-card);
}

.story-card:not(.story-card--featured):not(.story-card--wide):hover {
  transform: translateY(-5px) rotate(0.5deg);
}

.story-card--offset:hover {
  transform: translateY(5px) rotate(-0.3deg);
}

.story-card__img-wrap {
  position: relative;
  overflow: hidden;
}

.story-card__img {
  width: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.story-card:hover .story-card__img { transform: scale(1.04); }

.story-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(15, 10, 30, 0.3) 100%);
}

.story-card__body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.story-card__title {
  font-size: var(--font-size-xl);
  font-family: var(--font-display);
  line-height: 1.3;
}

.story-card__desc {
  font-size: var(--font-size-sm);
  color: var(--text-sub);
  line-height: 1.7;
  flex: 1;
}

/* Progress */
.story-card__progress {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: auto;
}

.story-card__progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.story-card__btn {
  align-self: flex-start;
  margin-top: var(--sp-2);
}

/* ==========================================================================
   13. QUEST SECTION
   ========================================================================== */
.section--quest {
  background: var(--bg-soft);
}

.quest-tabs {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-8);
}

.quest-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: white;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-sub);
  transition: all var(--transition-fast);
}

.quest-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.quest-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--aemeath-glow);
}

.quest-panel {
  display: flex;
  flex-direction: column;
}

.quest-panel:not(.active) { display: none; }

.quest-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.quest-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-fast);
}

.quest-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-card);
  border-color: var(--accent);
}

.quest-item.completed {
  opacity: 0.65;
  background: var(--bg-soft);
}

.quest-item.completed .quest-item__btn {
  background: #10b981;
  border-color: #10b981;
}

.quest-item__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.quest-item__icon--chat    { background: #ede9fe; color: var(--primary); }
.quest-item__icon--story   { background: #e0f2fe; color: #0284c7; }
.quest-item__icon--star    { background: #fef9c3; color: #ca8a04; }
.quest-item__icon--moon    { background: #f1f5f9; color: #475569; }
.quest-item__icon--wind    { background: #ecfdf5; color: #059669; }
.quest-item__icon--heart   { background: #fce7f3; color: #db2777; }

.quest-item__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.quest-item__title {
  font-size: var(--font-size-base);
  font-family: var(--font-display);
}

.quest-item__desc {
  font-size: var(--font-size-sm);
  color: var(--text-sub);
  line-height: 1.5;
}

.quest-item__reward {
  font-size: var(--font-size-xs);
  color: var(--primary-dark);
  font-weight: 500;
  margin-top: var(--sp-1);
}

.quest-item__btn { flex-shrink: 0; }

/* ==========================================================================
   14. REWARDS SECTION
   ========================================================================== */
.section--rewards {
  background: var(--bg-main);
}

.rewards-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-8);
}

.rewards-filter {
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: white;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-sub);
  transition: all var(--transition-fast);
}

.rewards-filter:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.rewards-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.rewards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
}

/* Asymmetric sizing */
.reward-card:nth-child(3n+1) { transform: rotate(-1deg); }
.reward-card:nth-child(3n+2) { transform: rotate(0.5deg); margin-top: 12px; }
.reward-card:nth-child(3n)   { transform: rotate(-0.5deg); }

.reward-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.reward-card:hover {
  transform: translateY(-6px) rotate(0deg) !important;
  box-shadow: var(--shadow-card), 0 0 30px var(--aemeath-glow);
}

.reward-card__inner {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-align: center;
  min-height: 200px;
  overflow: hidden;
}

.reward-card.locked .reward-card__inner {
  filter: blur(2px);
  user-select: none;
  pointer-events: none;
}

.reward-card__icon {
  font-size: 2.2rem;
  color: var(--primary);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reward-card__img-wrap { border-radius: var(--radius-sm); overflow: hidden; }
.reward-card__img { width: 100%; height: 120px; object-fit: cover; }

.reward-card__name {
  font-size: var(--font-size-base);
  font-family: var(--font-display);
}

.reward-card__hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* Lock overlay */
.reward-card__lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 247, 252, 0.75);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-lg);
  font-size: 1.8rem;
  color: var(--text-sub);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.reward-card:hover .reward-card__lock {
  color: var(--primary);
  background: rgba(248, 247, 252, 0.6);
}

.reward-card.unlocked .reward-card__lock { display: none; }
.reward-card.unlocked .reward-card__inner { filter: none; }

.rewards-empty {
  text-align: center;
  padding: var(--sp-16) var(--sp-8);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
}

.rewards-empty i { font-size: 3rem; color: var(--accent); }

/* ==========================================================================
   15. MEMORIES SECTION
   ========================================================================== */
.section--memories {
  background: var(--bg-soft);
}

.memories-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--sp-8);
}

.memories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

/* Masonry-like feel */
.memory-card:nth-child(3n+2) { margin-top: var(--sp-6); }

.memory-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  animation: memAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.memory-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card);
}

@keyframes memAppear {
  from { opacity: 0; transform: scale(0.9) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.memory-card__img-wrap {
  overflow: hidden;
  height: 160px;
}

.memory-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.memory-card:hover .memory-card__img { transform: scale(1.06); }

.memory-card__body {
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.memory-card__caption {
  font-family: var(--font-display);
  font-size: var(--font-size-base);
  line-height: 1.3;
}

.memory-card__date {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.memory-card__actions {
  display: flex;
  justify-content: flex-end;
}

.memory-card__del {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.memory-card__del:hover { color: #ef4444; }

/* Empty state */
.memories-empty {
  text-align: center;
  padding: var(--sp-20) var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  color: var(--text-sub);
}

.memories-empty__icon {
  font-size: 3rem;
  color: var(--accent);
  animation: badgeFloat 3s ease-in-out infinite;
}

.memories-empty h3 {
  font-size: var(--font-size-2xl);
  font-family: var(--font-display);
}

/* ==========================================================================
   16. FOOTER
   ========================================================================== */
.site-footer {
  background: var(--bg-main);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-10);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.site-footer__logo {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.site-footer__logo span { color: var(--primary); }

.site-footer__copy {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.site-footer__links {
  display: flex;
  gap: var(--sp-4);
}

.site-footer__links a {
  color: var(--text-sub);
  font-size: var(--font-size-lg);
  transition: color var(--transition-fast), transform var(--transition-fast);
  display: inline-block;
}

.site-footer__links a:hover {
  color: var(--primary);
  transform: translateY(-2px);
}

/* ==========================================================================
   17. MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 50, 0.55);
  backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  animation: overlayFadeIn 0.3s ease;
}

.modal-overlay[hidden] { display: none !important; }

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--sp-10) var(--sp-8);
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: var(--shadow-md);
  animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal--memory {
  max-width: 420px;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__close {
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-5);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.modal__close:hover {
  color: var(--primary);
  background: var(--accent-light);
}

.modal__title {
  font-size: var(--font-size-2xl);
  font-family: var(--font-display);
  margin-bottom: var(--sp-2);
}

.modal__sub {
  font-size: var(--font-size-sm);
  color: var(--text-sub);
  margin-bottom: var(--sp-8);
}

.modal__switch {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-sub);
  margin-top: var(--sp-5);
}

/* ==========================================================================
   18. FADE-IN ANIMATIONS (Intersection Observer)
   ========================================================================== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease var(--delay, 0s), transform 0.8s ease var(--delay, 0s);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   19. RESPONSIVE — 1024px
   ========================================================================== */
@media (max-width: 1024px) {
  .navbar__menu { gap: 0; }
  .navbar__link { padding: 0.35rem 0.65rem; }

  .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
    padding-block: var(--sp-20) var(--sp-16);
  }

  .hero__image-wrap {
    order: -1;
    margin-bottom: var(--sp-6);
  }

  .hero__content { max-width: 600px; }
  .hero__sub { margin-inline: auto; }
  .hero__cta { justify-content: center; }
  .hero__badges { justify-content: center; }

  .hero__aura, .hero__ring { width: 380px; height: 380px; }

  .intro__grid {
    grid-template-columns: 1fr;
    gap: var(--sp-8);
    text-align: center;
  }

  .intro__tags { justify-content: center; }
  .intro__stat { grid-template-columns: 80px 1fr 32px; }

  .preview-cards {
    grid-template-columns: 1fr 1fr;
  }

  .preview-card--quest { transform: none; }

  .story-card--featured,
  .story-card--wide {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .story-card--featured .story-card__img,
  .story-card--wide .story-card__img {
    height: 220px;
  }

  .rewards-grid { grid-template-columns: repeat(2, 1fr); }
  .memories-grid { grid-template-columns: repeat(2, 1fr); }
  .memory-card:nth-child(3n+2) { margin-top: 0; }
}

/* ==========================================================================
   20. RESPONSIVE — 768px
   ========================================================================== */
@media (max-width: 768px) {
  .navbar__menu { display: none; }
  .navbar__hamburger { display: flex; }
  .mobile-drawer { display: flex; }

  .hero__image { width: clamp(220px, 70vw, 320px); }
  .hero__aura, .hero__ring { width: 300px; height: 300px; }

  .preview-cards { grid-template-columns: 1fr; gap: var(--sp-4); }

  .story-grid {
    grid-template-columns: 1fr;
  }

  .story-card--featured,
  .story-card--wide {
    grid-column: 1;
  }

  .story-card--offset { transform: none; }

  .quest-item {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .quest-item__btn {
    grid-column: 2;
    justify-self: start;
  }

  .rewards-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
  .reward-card:nth-child(3n+1),
  .reward-card:nth-child(3n+2),
  .reward-card:nth-child(3n) { transform: none; margin-top: 0; }

  .memories-grid { grid-template-columns: 1fr; }

  .site-footer__inner {
    flex-direction: column;
    text-align: center;
  }

  .modal { padding: var(--sp-8) var(--sp-6); }

  .cursor-orb, .cursor-trail { display: none; }
  body { cursor: auto; }
  button { cursor: pointer; }
}

/* Nâng cấp ảnh nhân vật chính */
.hero__image {
  position: relative;
  z-index: 2;
  /* Hiệu ứng mờ ảo và sắc nét kết hợp */
  filter: drop-shadow(0 0 20px var(--aemeath-glow-md)) contrast(1.05);
  animation: heroImageFloat 6s ease-in-out infinite;
  transition: filter 0.5s ease, transform 0.5s ease;
}

.hero__image:hover {
  filter: drop-shadow(0 0 40px var(--primary)) brightness(1.1);
}

@keyframes heroImageFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-15px) scale(1.02); }
}

/* Thêm lớp phủ lấp lánh nhẹ lên ảnh */
.hero__image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  z-index: 3;
  pointer-events: none;
  border-radius: var(--radius-lg);
}
/* Hiệu ứng ảnh trong phần Story */
.story-card__img-wrap {
  overflow: hidden;
  position: relative;
}

.story-card__img {
  transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1), filter 0.5s ease;
  filter: grayscale(20%) brightness(0.9); /* Hơi tối và xám nhẹ lúc đầu để tạo vẻ cổ điển */
}

.story-card:hover .story-card__img {
  transform: scale(1.1);
  filter: grayscale(0%) brightness(1.1);
}

/* Hiệu ứng ánh sáng quét qua khi hover */
.story-card__img-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
  transform: skewX(-25deg);
  z-index: 2;
  transition: 0.7s;
}

.story-card:hover .story-card__img-wrap::before {
  left: 150%;
}
/* Nâng cấp thẻ ảnh Memory */
.memory-card {
  background: #fff;
  padding: 12px 12px 40px 12px; /* Tạo lề dưới rộng để viết caption như ảnh Polaroid */
  border: 1px solid rgba(0,0,0,0.05);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.memory-card__img {
  filter: sepia(20%) contrast(1.1); /* Màu ảnh hơi cũ một chút */
  border: 1px solid #eee;
}

.memory-card:hover {
  transform: translateY(-10px) rotate(0deg) scale(1.05) !important;
  z-index: 10;
  box-shadow: 0 15px 35px rgba(130, 90, 250, 0.2);
}

/* Hiệu ứng "băng dính" dán ở góc ảnh */
.memory-card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 25px;
  background: rgba(167, 139, 250, 0.3); /* Màu primary nhạt */
  backdrop-filter: blur(2px);
  z-index: 2;
}
/* Hiệu ứng ảnh phần thưởng */
.reward-card__img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.reward-card.locked .reward-card__img {
  filter: grayscale(1) blur(4px);
  opacity: 0.5;
}

.reward-card.unlocked .reward-card__img {
  animation: unlockGlow 1.5s ease-out;
}

@keyframes unlockGlow {
  0% { filter: brightness(5) blur(10px); }
  100% { filter: brightness(1) blur(0); }
}

/* ==========================================================================
   PRESENCE LAYER — HOLOGRAPHIC & GLASSMORPHISM DESIGN (NÂNG CẤP)
   ========================================================================== */
:root {
  --holo-primary: rgba(167, 139, 250, 0.9); /* Tím neon chủ đạo */
  --holo-accent: rgba(196, 181, 253, 0.6);  /* Tím nhạt */
  --holo-bg: rgba(20, 15, 40, 0.7);          /* Nền tối kính mờ */
  --holo-border: rgba(167, 139, 250, 0.4);   /* Viền sáng */
  --holo-glow: 0 0 15px rgba(167, 139, 250, 0.5); /* Hào quang tím */
}

.presence-layer {
  position: fixed;
  top: 90px;
  right: 25px;
  z-index: 2000; /* Đảm bảo luôn nằm trên cùng */
  pointer-events: none;
  opacity: 0;
  transform: translateY(-20px) rotateX(10deg); /* Hiệu ứng nghiêng nhẹ */
  transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1); /* Hiệu ứng xuất hiện mượt mà */
}

.presence-layer.visible {
  opacity: 1;
  transform: translateY(0) rotateX(0);
}

.presence-bubble {
  position: relative;
  background: var(--holo-bg);
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  border: 1px solid var(--holo-border);
  border-radius: 24px; /* Bo góc cực mềm */
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 350px;
  box-shadow: 
    var(--holo-glow), /* Hào quang bên ngoài */
    inset 0 0 10px rgba(167, 139, 250, 0.2); /* Hào quang bên trong */
  overflow: hidden; /* Cho hiệu ứng Shine */
  animation: heartBeat 3s ease-in-out infinite;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); box-shadow: 0 0 15px var(--holo-primary); }
  50% { transform: scale(1.02); box-shadow: 0 0 30px var(--holo-primary); }
}

/* Avatar Nâng Cấp: Hiệu ứng hình chiếu */
.presence-avatar-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--holo-primary);
  box-shadow: 0 0 15px var(--holo-primary);
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
}

/* Thêm lớp nhiễu nhẹ cho Avatar giống hình chiếu */
.presence-avatar-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
}

.presence-avatar { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  filter: contrast(1.1) brightness(1.1);
}

.presence-content { 
  display: flex; 
  flex-direction: column; 
  gap: 3px;
  flex: 1;
}

/* Author: Kiểu chữ neon nhấp nháy */
.presence-author { 
  font-weight: 800; 
  color: #fff; 
  font-size: 11px; 
  text-transform: uppercase; 
  letter-spacing: 2px; 
  margin: 0; 
  display: block; 
  text-shadow: 0 0 8px #fff, 0 0 12px var(--holo-primary);
  animation: holoFlash 4s infinite;
}

/* Thoại: Dễ đọc và thanh lịch */
.presence-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  line-height: 1.5;
  font-family: var(--font-body);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  
  /* --- PHẦN QUAN TRỌNG ĐỂ XUỐNG DÒNG --- */
  white-space: normal;       /* Cho phép xuống dòng tự nhiên */
  word-wrap: break-word;     /* Bẻ từ nếu quá dài */
  display: block;            /* Đảm bảo nó chiếm không gian khối */
  width: 100%;               /* Chiếm hết chiều rộng khung content */
}

/* Đảm bảo khung chứa text có thể giãn nở theo chiều cao */
.presence-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0; /* Tránh việc content bị đẩy ra ngoài do flexbox */
}

/* Điều chỉnh độ rộng khung thoại để cân đối hơn */
.presence-bubble {
  /* ... giữ nguyên các phần cũ ... */
  min-width: 280px;
  max-width: 380px; /* Tăng max-width lên một chút cho dễ xuống dòng */
  height: auto;     /* Để chiều cao tự động theo nội dung */
  align-items: flex-start; /* Để avatar nằm ở đỉnh khi thoại dài */
}
@keyframes typing { from { width: 0 } to { width: 100% } }
@keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: var(--primary); } }

/* Hiệu ứng Shine (Ánh sáng quét qua) */
.presence-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  transform: skewX(-25deg);
  transition: all 0.7s;
}

.presence-layer.visible .presence-shine {
  animation: holoShine 3s infinite 1s;
}

/* Animations */
@keyframes holoFlash {
  0%, 90%, 100% { opacity: 1; }
  92% { opacity: 0.8; }
  95% { opacity: 1; }
  98% { opacity: 0.9; }
}

@keyframes holoShine {
  100% { left: 150%; }
}

/* Cooldown Animation cho text khi ẩn */
.presence-layer.removing {
  transform: translateY(-20px) rotateX(-10deg);
  opacity: 0;
}
.cursor-orb {
  background: var(--primary); /* Tự động đổi màu theo biến primary */
  box-shadow: 0 0 20px var(--aemeath-glow);
  transition: background 0.5s ease, box-shadow 0.5s ease;
}
/* Khung chat rung bần bật khi nhận tin nhắn "ám ảnh" */
.chat-window.disturbed {
  animation: chatShake 0.3s infinite;
  border-color: var(--primary) !important;
  box-shadow: 0 0 40px var(--aemeath-glow-md) !important;
}

@keyframes chatShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-0.5deg); }
  75% { transform: translateX(2px) rotate(0.5deg); }
}
