/* ========================================================================== 
   Variables
   ========================================================================== */
:root {
  /* Colors */
  --color-bg: #050611; /* deep black with slight blue tint */
  --color-bg-elevated: #0b0f1f;
  --color-bg-soft: #11172b;
  --color-text: #f5f7ff;
  --color-muted: #9ea4c7;

  --color-primary: #00d5ff; /* neon cyan */
  --color-primary-soft: rgba(0, 213, 255, 0.12);

  --color-accent-red: #ff2345; /* crimson */
  --color-accent-yellow: #ffd447; /* bright yellow */

  --color-success: #29e38a;
  --color-warning: #ffb347;
  --color-danger: #ff4b6b;

  --color-border-subtle: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(0, 213, 255, 0.7);

  --color-neutral-50: #f9fafb;
  --color-neutral-100: #f3f4f6;
  --color-neutral-200: #e5e7eb;
  --color-neutral-300: #d1d5db;
  --color-neutral-400: #9ca3af;
  --color-neutral-500: #6b7280;
  --color-neutral-600: #4b5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1f2933;
  --color-neutral-900: #111827;

  /* Typography */
  --font-sans: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-display: "Bebas Neue", "Anton", system-ui, sans-serif;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-md: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */
  --font-size-5xl: 3rem;     /* 48px */

  --line-height-tight: 1.1;
  --line-height-snug: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Shadows (cinematic / glowing) */
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.85);
  --shadow-neon-primary: 0 0 20px rgba(0, 213, 255, 0.65),
    0 0 40px rgba(0, 213, 255, 0.45);
  --shadow-neon-danger: 0 0 18px rgba(255, 35, 69, 0.7);

  /* Transitions & Motion */
  --transition-fast: 120ms ease-out;
  --transition-normal: 220ms ease-out;
  --transition-slow: 380ms ease-out;

  /* Layout */
  --container-max-width: 1200px;
  --container-padding-x: 1.5rem;
}

@media (min-width: 768px) {
  :root {
    --container-padding-x: 2rem;
  }
}

/* ========================================================================== 
   Reset / Normalize
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
}

img,
video,
canvas,
svg,
picture {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Prefer-reduced-motion: limit non-essential animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================================================== 
   Base Styles
   ========================================================================== */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Headings: strong, cinematic, anime hero style */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-5xl);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--font-size-4xl);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--font-size-3xl);
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-2);
}

h5 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-normal);
  margin-bottom: var(--space-2);
}

h6 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-normal);
  margin-bottom: var(--space-1);
}

p {
  margin-bottom: var(--space-3);
  color: var(--color-muted);
}

strong,
b {
  font-weight: 700;
}

em {
  font-style: italic;
}

/* Links: glowing and energetic */
a {
  color: var(--color-primary);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-normal),
    text-shadow var(--transition-normal);
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.15em;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-red));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform var(--transition-normal);
}

a:hover {
  color: #e6fbff;
  text-shadow: 0 0 12px rgba(0, 213, 255, 0.8);
}

a:hover::after {
  transform: scaleX(1);
}

/* ========================================================================== 
   Accessibility
   ========================================================================== */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

[tabindex="-1"]:focus {
  outline: none !important;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================================================== 
   Utilities
   ========================================================================== */
/* Layout helpers */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding-x);
}

.section {
  padding-block: var(--space-12);
}

.section--tight {
  padding-block: var(--space-8);
}

/* Flex */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

/* Grid */
.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Text alignment */
.text-center {
  text-align: center;
}

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

/* Heroic gradient text */
.text-gradient-hero {
  background: linear-gradient(120deg, var(--color-primary), var(--color-accent-yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Badge-like label (e.g., ranking / rarity) */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(
    135deg,
    rgba(0, 213, 255, 0.16),
    rgba(255, 35, 69, 0.2)
  );
}

/* Background glow utility for anime key art blocks */
.bg-glow-primary {
  background: radial-gradient(circle at top, rgba(0, 213, 255, 0.35), transparent 55%),
    radial-gradient(circle at bottom, rgba(255, 35, 69, 0.25), transparent 55%),
    var(--color-bg-elevated);
}

/* ========================================================================== 
   Components
   ========================================================================== */
/* Buttons: energetic, neon, mobile-friendly */
.button {
  --btn-bg: var(--color-primary);
  --btn-bg-hover: #40e4ff;
  --btn-color: #050611;
  --btn-border: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.6rem;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--btn-border);
  background: linear-gradient(135deg, var(--btn-bg), #ffffff);
  background-size: 200% 200%;
  color: var(--btn-color) !important;
  cursor: pointer;
  box-shadow: var(--shadow-neon-primary);
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-position var(--transition-normal),
    filter var(--transition-fast),
    opacity var(--transition-fast);
}

.button:hover {
  background-position: 100% 0;
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.02);
}

.button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-soft);
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.button--ghost {
  --btn-bg: transparent;
  --btn-bg-hover: transparent;
  --btn-color: var(--color-text);
  --btn-border: rgba(0, 213, 255, 0.7);

  background: radial-gradient(circle at top left, rgba(0, 213, 255, 0.15), transparent 60%);
  box-shadow: 0 0 0 1px rgba(0, 213, 255, 0.35);
}

.button--danger {
  --btn-bg: var(--color-accent-red);
  --btn-bg-hover: #ff4f6e;
  --btn-color: #050611;
}

/* Inputs: consistent and futuristic */
.input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: rgba(5, 6, 17, 0.85);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  outline: none;
  transition: border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    background-color var(--transition-normal);
}

.input::placeholder,
textarea::placeholder {
  color: var(--color-muted);
}

.input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-border-strong);
  box-shadow: 0 0 0 1px rgba(0, 213, 255, 0.8),
    0 0 18px rgba(0, 213, 255, 0.4);
  background-color: rgba(9, 14, 34, 0.95);
}

.input--error {
  border-color: rgba(255, 75, 107, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 75, 107, 0.8);
}

/* Card: used for heroes, arenas, missions, rankings */
.card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: radial-gradient(circle at top, rgba(0, 213, 255, 0.08), transparent 60%),
    radial-gradient(circle at bottom, rgba(255, 35, 69, 0.09), transparent 55%),
    linear-gradient(145deg, #060712, #0c101f);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-border-subtle);
  overflow: hidden;
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal),
    background-position var(--transition-normal);
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, rgba(0, 213, 255, 0.3), rgba(255, 35, 69, 0.3));
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.card-inner {
  position: relative;
  z-index: 1;
}

.card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-strong);
  border-color: rgba(0, 213, 255, 0.6);
}

.card:hover::before {
  opacity: 1;
}

/* Mini statistic chips (e.g., ATK, DEF, RANK) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  background-color: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.chip--success {
  border-color: rgba(41, 227, 138, 0.7);
  color: #bbf7d0;
}

.chip--danger {
  border-color: rgba(255, 75, 107, 0.8);
  color: #fecaca;
}

/* Cinematic overlay gradient for hero key art */
.hero-overlay-gradient {
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(5, 6, 17, 0.88) 30%,
    rgba(5, 6, 17, 0.3) 60%,
    transparent 100%
  );
}

/* Floating animated pulse (for call-to-action or special abilities) */
@keyframes pulse-glow {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(0, 213, 255, 0.6);
  }
  70% {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 35px 10px rgba(0, 213, 255, 0);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(0, 213, 255, 0);
  }
}

.btn-pulse {
  animation: pulse-glow 2.3s infinite;
}

@media (prefers-reduced-motion: reduce) {
  .btn-pulse {
    animation: none;
  }
}
