/* =========================================
   MIDNIGHT EMBER v1 — Dark Luxe Design
   Complete visual transformation
   ========================================= */

:root {
  /* Dark charcoal base */
  --ember-void: #0d0d0d;
  --ember-deep: #141418;
  --ember-mid: #1c1c24;
  --ember-surface: #26262f;
  
  /* Warm amber & gold accents */
  --amber-primary: #e8a838;
  --amber-light: #f2c566;
  --amber-glow: #d4922a;
  --gold-bright: #ffd700;
  
  /* Rose & magenta highlights */
  --rose-primary: #e84393;
  --rose-light: #fd79a8;
  --rose-soft: #fab1c4;
  
  /* Deep purple accents */
  --purple-deep: #6c5ce7;
  --purple-light: #a29bfe;
  --purple-soft: #c4b4fe;
  
  /* Neutral surfaces */
  --surface-1: rgba(255, 255, 255, 0.95);
  --surface-2: rgba(255, 255, 255, 0.04);
  --surface-3: rgba(255, 255, 255, 0.08);
  
  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(232, 168, 56, 0.3);
  
  /* Text colors */
  --text-primary: #f0ece2;
  --text-secondary: rgba(240, 236, 226, 0.7);
  --text-tertiary: rgba(240, 236, 226, 0.45);
  --text-dark: #1a1a2e;
  
  /* Typography - Modern geometric */
  --font-heading: 'Space Grotesk', 'Outfit', system-ui, -apple-system, sans-serif;
  --font-body: 'Sora', 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Spacing system */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  
  /* Border radius - angular with slight softening */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Shadows - sharp and warm */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow-amber: 0 0 30px rgba(232, 168, 56, 0.25);
  --shadow-glow-rose: 0 0 30px rgba(232, 67, 147, 0.25);
  --shadow-glow-purple: 0 0 30px rgba(108, 92, 231, 0.25);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Header */
  --header-height: 72px;
  --container-max: 1280px;
  
  /* Legacy aliases for compatibility */
  --ui-bg: var(--ember-void);
  --ui-surface: var(--surface-2);
  --ui-surface-2: var(--surface-3);
  --ui-border: var(--border-medium);
  --ui-border-soft: var(--border-subtle);
  --ui-text: var(--text-primary);
  --ui-muted: var(--text-secondary);
  --ui-faint: var(--text-tertiary);
  --ui-accent: var(--amber-primary);
  --ui-accent-2: var(--rose-primary);
  --ui-accent-3: var(--purple-deep);
  --ui-accent-ink: var(--ember-void);
  --ui-glow-accent: var(--shadow-glow-amber);
  --ui-glow-cyan: var(--shadow-glow-rose);
  --clr-primary: var(--amber-primary);
  --clr-secondary: var(--rose-primary);
  --clr-bg: var(--ember-void);
  --clr-muted: var(--text-secondary);
  --clr-border: var(--border-subtle);
  --primary-color: var(--amber-primary);
  --border-color: var(--border-subtle);
  --bg-card: var(--surface-2);
  --text-main: var(--text-primary);
  --text-muted: var(--text-secondary);
  --bg-dark: var(--ember-void);
  --bg-pane: var(--surface-2);
  --bg-pane-hover: var(--surface-3);
  --border-light: var(--border-subtle);
  --border-hover: var(--border-medium);
  --glow-primary: var(--shadow-glow-amber);
  --clr-primary-glow: rgba(232, 168, 56, 0.3);
  --clr-secondary-glow: rgba(232, 67, 147, 0.3);
  --header-bg: rgba(13, 13, 13, 0.85);
  /* Remap old ocean vars to ember */
  --ocean-deep: var(--ember-void);
  --ocean-mid: var(--ember-mid);
  --coral-primary: var(--amber-primary);
  --coral-light: var(--amber-light);
  --aqua-bright: var(--rose-primary);
  --aqua-soft: var(--rose-light);
  --teal-deep: var(--purple-deep);
  --teal-light: var(--purple-light);
  --sand-gold: var(--gold-bright);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--ember-void);
  background-image:
    radial-gradient(ellipse 50% 50% at 50% 0%, rgba(108, 92, 231, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(232, 67, 147, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Subtle noise-grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* Warm diagonal accent line */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(135deg, rgba(232, 168, 56, 0.03) 0%, transparent 30%),
    linear-gradient(315deg, rgba(108, 92, 231, 0.03) 0%, transparent 30%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-base);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ember-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--amber-primary);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--amber-light);
}

.container {
  width: min(90%, var(--container-max));
  margin: 0 auto;
}

/* Ambient background for list/show/news pages */
.ambient-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.ambient-background .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
}

.orb-1 {
  width: 400px;
  height: 400px;
  top: -100px;
  left: -100px;
  background: rgba(232, 168, 56, 0.2);
  animation: orb-drift 35s ease-in-out infinite;
}

.orb-2 {
  width: 350px;
  height: 350px;
  top: 20%;
  right: -50px;
  background: rgba(232, 67, 147, 0.15);
  animation: orb-drift 28s ease-in-out infinite reverse;
}

.orb-3 {
  width: 300px;
  height: 300px;
  bottom: 10%;
  left: 30%;
  background: rgba(108, 92, 231, 0.15);
  animation: orb-drift 40s ease-in-out infinite;
}

@keyframes orb-drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 25px); }
}

/* Header */
header, #main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  display: flex;
  align-items: center;
  z-index: 1000;
  background: rgba(13, 13, 13, 0.7);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-base);
}

header.scrolled {
  background: rgba(13, 13, 13, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.header-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
}

.logo img {
  height: 40px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.nav-list ul {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.nav-list a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 0.5rem 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: var(--font-heading);
}

.nav-list a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--amber-primary);
  transition: width var(--transition-base);
}

.nav-list a:hover,
.nav-list li.active a {
  color: var(--amber-primary);
}

.nav-list a:hover::after {
  width: 100%;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Buttons */
.btn-login {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-heading);
}

.btn-login:hover {
  background: var(--surface-3);
  border-color: var(--amber-primary);
  color: var(--amber-primary);
  transform: translateY(-2px);
}

.btn-signup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--amber-primary);
  color: var(--ember-void);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-signup:hover {
  background: var(--amber-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-amber);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.mobile-menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--amber-primary);
  border-radius: 0;
  transition: all var(--transition-base);
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(12px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

body.no-scroll {
  overflow: hidden;
}

/* Section utilities */
.section-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin-bottom: var(--space-md);
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.section-prefix {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--amber-primary);
  margin-bottom: var(--space-sm);
  text-align: center;
  font-family: var(--font-heading);
  position: relative;
  padding-left: 20px;
}

.section-prefix::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 2px;
  background: var(--amber-primary);
}

.gradient-text {
  background: linear-gradient(135deg, var(--amber-primary) 0%, var(--rose-primary) 50%, var(--purple-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Footer */
footer, #main-footer {
  background: var(--ember-deep);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-2xl) 0 var(--space-lg);
  margin-top: var(--space-2xl);
  position: relative;
}

footer::before, #main-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber-primary), var(--rose-primary), transparent);
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-brand p,
.footer-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: var(--space-sm);
  max-width: 320px;
  line-height: 1.7;
}

.footer-nav h4,
.footer-contact h4 {
  font-size: 1rem;
  margin-bottom: var(--space-md);
  color: var(--amber-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-heading);
}

.footer-nav ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.footer-nav a:hover {
  color: var(--amber-primary);
  padding-left: 8px;
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  gap: var(--space-md);
}

.footer-links a {
  color: var(--amber-primary);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.footer-links a:hover {
  color: var(--rose-primary);
}

/* Utility classes */
.text-white { color: var(--text-primary) !important; }
.text-center { text-align: center !important; }
.d-flex { display: flex !important; }
.gap-3 { gap: 1rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.mt-3 { margin-top: 1rem !important; }
.pt-3 { padding-top: 1rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.border-top-dark { border-top: 1px solid var(--border-subtle) !important; }
.text-muted-light { color: var(--text-secondary) !important; }

/* Glass nav helper */
.glass-nav {
  border-radius: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

/* Mobile bottom bar */
.mobile-bottom-bar {
  display: none;
}

/* Touch-friendly interactive elements */
@media (max-width: 768px) {
  .btn-login,
  .btn-signup,
  .btn-primary,
  .btn-secondary,
  .btn-play-game,
  .faq-question,
  .read-more,
  .mobile-bottom-bar a,
  .news-list-item,
  .tournament-card,
  .game-card-large,
  .step-card,
  .trust-card-v2,
  .testimonial-card,
  .vip-tier-item,
  .why-card,
  .winner-testimonial,
  .news-preview-card {
    min-height: 44px;
  }

  .faq-question {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .btn-primary,
  .btn-secondary,
  .btn-login,
  .btn-signup,
  .mobile-bottom-bar a {
    min-height: 48px;
    min-width: 48px;
  }
}

/* Extra small breakpoint for phones */
@media (max-width: 480px) {
  :root {
    --space-xs: 0.375rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --header-height: 64px;
  }

  .section-title {
    font-size: clamp(1.5rem, 8vw, 2rem);
    line-height: 1.2;
  }

  .section-prefix {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
  }

  .container {
    width: min(95%, var(--container-max));
  }

  .logo img {
    height: 34px;
  }

  .badge {
    font-size: 0.7rem;
    padding: 8px 14px;
  }

  .gradient-text {
    word-break: break-word;
  }
}

/* Safe area support for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    body {
      padding-top: env(safe-area-inset-top);
      padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    #main-header {
      padding-top: env(safe-area-inset-top);
      height: calc(var(--header-height) + env(safe-area-inset-top));
    }

    .nav-list {
      top: calc(var(--header-height) + env(safe-area-inset-top));
      height: calc(100vh - var(--header-height) - env(safe-area-inset-top));
    }

    .mobile-bottom-bar {
      padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .footer-register-banner {
      padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom));
    }
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .nav-list {
    position: fixed;
    top: var(--header-height);
    right: -100%;
    width: min(320px, 85%);
    height: calc(100vh - var(--header-height));
    background: rgba(13, 13, 13, 0.98);
    border-left: 1px solid var(--border-subtle);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    transition: right var(--transition-base);
    z-index: 999;
    overflow-y: auto;
  }

  .nav-list.active {
    right: 0;
  }

  .nav-list ul {
    flex-direction: column;
    gap: var(--space-md);
    align-items: flex-start;
  }

  .nav-list a {
    font-size: 1rem;
    padding: 0.75rem 0;
    display: block;
    width: 100%;
  }

  .header-auth .btn-signup {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }

  .footer-nav h4,
  .footer-contact h4 {
    font-size: 0.95rem;
  }

  .footer-nav a,
  .footer-desc {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .footer-top {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(13, 13, 13, 0.98);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--amber-primary);
    display: flex;
    padding: 10px 12px;
    gap: 10px;
    z-index: 1000;
  }

  .mobile-bottom-bar a {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .mobile-bottom-bar .btn-login {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
  }

  .mobile-bottom-bar .btn-register {
    background: var(--amber-primary);
    color: var(--ember-void);
    border: none;
  }

  body {
    padding-bottom: 80px;
  }
}
