/* =============================================
   Yui — Global Design System
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Boldonse&family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #1A1416;
  --bg-secondary: #241B1E;
  --bg-surface:   #241B1E;
  --bg-border:    #3D2F33;
  --bg-card: rgba(245, 239, 228, 0.04);
  --bg-card-hover: rgba(245, 239, 228, 0.08);
  --bg-glass: rgba(245, 239, 228, 0.05);
  --bg-glass-border: rgba(245, 239, 228, 0.10);

  /* Brand colors */
  --accent-primary: #FF5A6E;        /* coral — CTAs */
  --accent-coral:   #FF5A6E;
  --accent-crimson: #C8253A;
  --accent-teal: #1F6B5C;
  --accent-electric: #2D6BFF;
  --accent-lime: #D4FF3F;           /* acid lime — accent */
  --accent-violet: #8B4DFF;
  --accent-plum: #3D1F3A;

  /* Backward-compat aliases */
  --accent-rose: #C8253A;
  --accent-rose-light: #FF4D6F;
  --accent-rose-dark: #8C1A2F;
  --accent-coral: #FF2D55;
  --accent-lavender: #2D6BFF;
  --accent-lavender-light: #5588FF;
  --accent-peach: #FF2D55;
  --accent-terracotta: #FF2D55;
  --accent-amber: #D4FF3F;
  --accent-rose-sunset: #C8253A;
  --accent-cream: #F5EFE4;
  --accent-mint: #1F6B5C;
  --accent-sky: #2D6BFF;

  /* Text */
  --text-primary: #FAF3E8;
  --text-secondary: #A89098;
  --text-muted: #7A7480;
  --cream:        #FAF3E8;
  --mauve:        #A89098;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #8C1A2F 0%, #FF3040 100%);
  --gradient-warm: linear-gradient(135deg, #8C1A2F 0%, #5C0F1E 100%);
  --gradient-cool: linear-gradient(135deg, #1F6B5C 0%, #0D3D34 100%);
  --gradient-bg: radial-gradient(ellipse at 15% 80%, rgba(140, 26, 47, 0.10) 0%, transparent 50%),
                 radial-gradient(ellipse at 85% 15%, rgba(31, 107, 92, 0.08) 0%, transparent 45%);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows — warm ink tones */
  --shadow-sm: 0 2px 8px rgba(26, 16, 20, 0.08);
  --shadow-md: 0 8px 24px rgba(26, 16, 20, 0.12);
  --shadow-lg: 0 16px 48px rgba(26, 16, 20, 0.18);
  --shadow-glow-rose: 0 8px 24px rgba(140, 26, 47, 0.22);
  --shadow-glow-lavender: 0 8px 24px rgba(31, 107, 92, 0.18);
  --shadow-glow-mixed: 0 8px 32px rgba(140, 26, 47, 0.18);
  --shadow-glow-terracotta: 0 8px 24px rgba(255, 48, 64, 0.22);
  --shadow-glow-amber: 0 8px 24px rgba(200, 120, 42, 0.18);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Typography */
  --font-display: 'Boldonse', 'Times New Roman', serif;
  --font-logo:    'Bagel Fat One', cursive;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background gradient overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-bg);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-rose);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-rose-light);
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Typography ---------- */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
}

h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-secondary {
  color: var(--text-secondary);
}

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

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-mixed);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-glow-rose);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 30px rgba(255, 107, 157, 0.4), 0 0 80px rgba(192, 132, 252, 0.2);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

/* Shimmer effect */
.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: skewX(-25deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { left: -60%; }
  100% { left: 160%; }
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--bg-glass-border);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-rose);
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 1.2em;
}

/* ---------- Form Inputs ---------- */
.input-field {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all var(--transition-normal);
  outline: none;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--accent-rose);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

.input-label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* ---------- Particle Canvas ---------- */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Layout Containers ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  position: relative;
  z-index: 1;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.animate-scale-in {
  animation: scaleIn 0.4s var(--transition-spring) forwards;
}

.animate-shake {
  animation: shake 0.5s ease;
}

/* Staggered delays */
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
.delay-5 { animation-delay: 0.5s; opacity: 0; }
.delay-6 { animation-delay: 0.6s; opacity: 0; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-rose {
  background: rgba(255, 107, 157, 0.15);
  color: var(--accent-rose-light);
  border: 1px solid rgba(255, 107, 157, 0.25);
}

.badge-lavender {
  background: rgba(192, 132, 252, 0.15);
  color: var(--accent-lavender-light);
  border: 1px solid rgba(192, 132, 252, 0.25);
}

.badge-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(255, 107, 157, 0.3);
  color: white;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }
}

/* =============================================
   APP SHELL — persistent top nav (v3)
   Used on every page: sticky, glassy, active-state
   ============================================= */

.app-shell {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(237, 229, 219, 0.92);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--bg-glass-border);
}

.app-shell-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.shell-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.shell-logo .logo-icon { font-size: 1.4rem; line-height: 1; }
.shell-logo .logo-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shell-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.shell-nav-link {
  position: relative;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  border: 1px solid transparent;
  transition: color var(--transition-normal), background var(--transition-normal), border-color var(--transition-normal);
}
.shell-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}
.shell-nav-link.shell-nav-disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
  padding-right: 36px;
}
.shell-nav-link.shell-nav-disabled::after {
  content: 'soon';
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg-glass);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--bg-glass-border);
}

/* Active section */
body[data-section="cards"] .shell-nav-link[data-section="cards"],
body[data-section="quiz"]  .shell-nav-link[data-section="quiz"],
body[data-section="games"] .shell-nav-link[data-section="games"] {
  color: var(--text-primary);
  background: rgba(255, 90, 110, 0.15);
  border-color: rgba(255, 90, 110, 0.35);
}

.shell-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Mobile shell */
@media (max-width: 640px) {
  .app-shell-inner {
    padding: 10px 14px;
    gap: var(--space-sm);
  }
  .shell-logo .logo-text { display: none; }
  .shell-logo .logo-icon { font-size: 1.6rem; }
  .shell-nav { gap: 2px; flex: 1; justify-content: flex-end; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .shell-nav::-webkit-scrollbar { display: none; }
  .shell-nav-link { padding: 6px 11px; font-size: 0.85rem; white-space: nowrap; }
  .shell-nav-link.shell-nav-disabled { padding-right: 32px; }
  .shell-nav-link.shell-nav-disabled::after { font-size: 0.55rem; right: 6px; }
}
