/* AnimeFights - Premium Retro Modern UI */
/* BlogXpress-inspired Editorial Design */

/* ========================================
   CSS Custom Properties - Design System
   ======================================== */

:root {
  /* Light Mode - Premium Vintage */
  --bg: #faf9f7;
  --bg-paper: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #f5f3ef;
  --bg-hover: #eeebe5;

  --text-primary: #1a1918;
  --text-secondary: #5c5a57;
  --text-muted: #9a9894;

  --border: #e0dcd4;
  --border-light: #ece8e1;
  --border-accent: #d4d0c8;

  /* Editorial Primary Colors */
  --primary: #b83c2a;
  --primary-hover: #9e3122;
  --primary-light: rgba(184, 60, 42, 0.1);
  --secondary: #3d6a8a;
  --secondary-hover: #2d5a7a;
  --accent: #c4933d;
  --accent-light: rgba(196, 147, 61, 0.15);
  --success: #3d8a4d;
  --danger: #c43d3d;

  /* Retro Gradients */
  --gradient-warm: linear-gradient(135deg, #faf9f7 0%, #f5f3ef 100%);
  --gradient-hero: linear-gradient(180deg, #ffffff 0%, #faf9f7 100%);
  --gradient-card: linear-gradient(145deg, #ffffff 0%, #faf9f7 100%);

  /* Typography */
  --font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Fira Code", monospace;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

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

  /* Shadows - Layered for depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.1);
  --shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --max-width: 1280px;
  --content-width: 900px;
  --header-height: 72px;
}

/* Dark Mode - Premium Vintage */
[data-theme="dark"] {
  --bg: #0d0d0d;
  --bg-paper: #161616;
  --bg-card: #1a1a1a;
  --bg-elevated: #222222;
  --bg-hover: #2a2a2a;

  --text-primary: #f5f3ef;
  --text-secondary: #a8a6a3;
  --text-muted: #6b6966;

  --border: #2d2d2d;
  --border-light: #3d3d3d;
  --border-accent: #4a4a4a;

  --primary: #d64d3a;
  --primary-hover: #e85d4a;
  --primary-light: rgba(214, 77, 58, 0.15);
  --secondary: #5a8abd;
  --secondary-hover: #6a9acd;
  --accent: #d4a34d;
  --accent-light: rgba(212, 163, 77, 0.2);
  --success: #4d9a5d;
  --danger: #d44d4d;

  --gradient-warm: linear-gradient(135deg, #161616 0%, #1a1a1a 100%);
  --gradient-hero: linear-gradient(180deg, #161616 0%, #0d0d0d 100%);
  --gradient-card: linear-gradient(145deg, #1a1a1a 0%, #161616 100%);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Base Styles
   ======================================== */

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

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

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

/* Background Texture - Subtle Paper Effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.015;
  pointer-events: none;
  z-index: -1;
}

/* Typography - Editorial Style */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1rem;
}

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

a:hover {
  color: var(--primary-hover);
}

/* Selection */
::selection {
  background: var(--primary);
  color: white;
}

/* Scrollbar - Editorial Style */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-accent);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-elevated);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Focus Styles */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 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;
}

/* ========================================
   Logo - Editorial Style
   ======================================== */

.logo {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  gap: 0.125rem;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.logo-subtitle {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  line-height: 1;
}

/* ========================================
   Navigation - Premium Header
   ======================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-paper);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .navbar {
  background-color: rgba(22, 22, 22, 0.95);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  margin-right: var(--space-md);
}

.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  position: relative;
  transition: var(--transition-base);
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition-base);
}

.hamburger::before {
  top: -8px;
}

.hamburger::after {
  bottom: -8px;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::after {
  bottom: 0;
  transform: rotate(-45deg);
}

nav .nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xl);
}

.nav-search {
  flex: 1;
  max-width: 360px;
}

.nav-search form {
  display: flex;
  gap: var(--space-sm);
}

.nav-search-input {
  flex: 1;
  padding: 0.625rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  transition: var(--transition-base);
}

.nav-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

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

.nav-search-btn {
  padding: 0.625rem 1.25rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-search-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

.nav-search {
  display: block;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition-base);
  transform: translateX(-50%);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link:hover::after {
  width: calc(100% - 1.5rem);
}

.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  width: calc(100% - 1.5rem);
}

/* Theme Toggle - Editorial Switch */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-full);
  transition: var(--transition-base);
  border: 1px solid var(--border);
  background: var(--bg);
}

.theme-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
}

.theme-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-base);
}

.theme-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: var(--transition-bounce);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-switch::before {
  left: 20px;
  background: var(--primary);
}

.theme-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  min-width: 36px;
}

/* ========================================
   Main Content Area
   ======================================== */

.main-content {
  min-height: calc(100vh - 200px);
  padding: var(--space-2xl) var(--space-xl);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ========================================
   Hero Section - Editorial Feature
   ======================================== */

.hero-section {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  background: var(--gradient-hero);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      circle at 20% 50%,
      var(--primary-light) 0%,
      transparent 50%
    ),
    radial-gradient(circle at 80% 50%, var(--accent-light) 0%, transparent 50%);
  opacity: 0.5;
  pointer-events: none;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero-highlight {
  color: var(--primary);
  position: relative;
  display: inline-block;
}

.hero-highlight::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: -4px;
  right: -4px;
  height: 10px;
  background: var(--accent);
  opacity: 0.25;
  z-index: -1;
  border-radius: var(--radius-sm);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto var(--space-lg);
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* Hero Stats */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-2xl);
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-light);
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.hero-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ========================================
   Section Titles
   ======================================== */

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: var(--space-xl);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xl);
}

/* ========================================
   Buttons - Premium Editorial
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-size: 0.8rem;
  font-family: var(--font-body);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: var(--transition-base);
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: white;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

.btn-ghost:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* Button Sizes */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 0.875rem;
}

/* ========================================
   Anime Grid - Editorial Layout
   ======================================== */

.animes-section {
  margin-bottom: var(--space-3xl);
}

.animes-section > .section-title {
  display: block;
  width: 100%;
}

.animes-section > .section-title::after {
  left: 0;
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-xl);
}

/* Anime Card - Editorial Retro Style */
.anime-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  transition: var(--transition-base);
  box-shadow: var(--shadow-xs);
  position: relative;
}

.anime-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
  opacity: 0;
  transition: var(--transition-base);
  z-index: 1;
  pointer-events: none;
}

.anime-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

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

.anime-image {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg-elevated);
  position: relative;
}

.anime-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-slow);
}

.anime-card:hover .anime-image img {
  transform: scale(1.05);
}

.anime-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-hover) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.anime-placeholder span {
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.25);
}

.anime-info {
  padding: var(--space-lg);
  position: relative;
  z-index: 2;
  background: var(--bg-card);
}

.anime-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.anime-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.character-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.character-count::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
}

.match-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.match-count::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.anime-card-badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
}

/* Versus Arena */
.versus-container {
  max-width: 1000px;
  margin: 0 auto;
}

.versus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.versus-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.versus-nav {
  display: flex;
  gap: 0.75rem;
}

.versus-arena {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  position: relative;
}

.versus-battle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.character-card {
  flex: 1;
  min-width: 240px;
  max-width: 340px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.character-card:hover:not(.voting) {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.character-card.selected {
  border-color: var(--success);
  animation: pulse-success 0.5s ease;
  z-index: 10;
}

@keyframes pulse-success {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.character-card.loser {
  opacity: 0.5;
  filter: grayscale(100%);
  transform: scale(0.95);
  transition: all 0.5s ease;
}

.character-card.voting {
  pointer-events: none;
}

.character-image-container {
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: var(--bg);
}

.character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.character-placeholder {
  width: 100%;
  height: 100%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-placeholder span {
  font-size: 3rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
}

.vote-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.character-card:hover:not(.voting) .vote-overlay {
  opacity: 1;
}

.vote-text {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  padding: 0.75rem 1.5rem;
  border: 2px solid white;
  border-radius: var(--radius-sm);
}

.character-info {
  padding: 1rem;
  text-align: center;
}

.character-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.character-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  font-size: 0.8rem;
}

.elo-badge {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

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

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

.vs-text {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Vote Result */
.vote-result {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  padding: 1.5rem 2.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: none;
}

.vote-result.show {
  display: block;
}

.winner-text {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 0.25rem;
}

.elo-change {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.skip-section {
  text-align: center;
  margin-top: 1.5rem;
}

.btn-skip {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

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

/* Leaderboard */
.leaderboard-container {
  max-width: 1000px;
  margin: 0 auto;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.leaderboard-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.leaderboard-nav {
  display: flex;
  gap: 0.75rem;
}

.leaderboard-search {
  margin-bottom: 1.5rem;
}

.leaderboard-search form {
  display: flex;
  justify-content: center;
}

.leaderboard-search .search-input-wrapper {
  max-width: 400px;
  width: 100%;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.leaderboard-search .search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.leaderboard-search .search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.leaderboard-search .search-btn {
  padding: 0.75rem 1rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: white;
}

.clear-search {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.375rem;
  font-size: 0.8rem;
  transition: var(--transition);
}

.clear-search:hover {
  color: var(--primary);
}

.leaderboard-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.top-three {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  flex-wrap: wrap;
}

.top-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  width: 180px;
  position: relative;
  transition: var(--transition);
}

.top-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-sm);
}

.top-card.rank-1 {
  border-color: #d4a03a;
}

.top-card.rank-2 {
  border-color: #a0a0a0;
}

.top-card.rank-3 {
  border-color: #b87333;
}

.rank-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  border: 2px solid;
}

.rank-1 .rank-badge {
  background: #d4a03a;
  color: white;
  border-color: #d4a03a;
}

.rank-2 .rank-badge {
  background: #a0a0a0;
  color: white;
  border-color: #a0a0a0;
}

.rank-3 .rank-badge {
  background: #b87333;
  color: white;
  border-color: #b87333;
}

.top-character-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 0.75rem;
  border: 2px solid var(--border);
}

.top-character-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.top-character-image .character-placeholder {
  width: 100%;
  height: 100%;
  background: var(--primary);
}

.top-character-image .character-placeholder span {
  font-size: 1.5rem;
}

.top-character-name {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.top-anime-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.top-character-stats {
  font-size: 0.75rem;
}

.top-character-stats .elo {
  color: var(--primary);
  font-weight: 600;
}

.top-character-stats .wins {
  color: var(--text-muted);
}

/* Table */
.table-header {
  display: grid;
  grid-template-columns: 60px 2fr 100px 100px 80px;
  padding: 0.875rem 1.25rem;
  background: var(--bg-elevated);
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-body {
  padding: 0.5rem;
}

.table-row {
  display: grid;
  grid-template-columns: 60px 2fr 100px 100px 80px;
  padding: 0.75rem 1rem;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 0.875rem;
}

.table-row:hover {
  background: var(--bg-elevated);
}

.character-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.character-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  border: 1px solid var(--border);
}

.character-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
}

.col-rank {
  font-weight: 600;
  color: var(--text-muted);
}

.col-elo {
  font-weight: 600;
  color: var(--primary);
}

.col-record,
.col-winrate {
  color: var(--text-secondary);
}

.col-anime {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* No Results */
.no-characters {
  text-align: center;
  padding: 3rem 1.5rem;
}

.no-characters p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.no-animes {
  text-align: center;
  padding: 3rem;
  grid-column: 1 / -1;
}

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

/* Character Detail */
.character-detail-container {
  max-width: 900px;
  margin: 0 auto;
}

.character-detail-header {
  margin-bottom: 1.5rem;
}

.character-profile {
  display: flex;
  gap: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.character-image-large {
  width: 180px;
  height: 230px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.character-image-large img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.character-placeholder-large {
  width: 100%;
  height: 100%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-placeholder-large span {
  font-size: 3rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
}

.character-details {
  flex: 1;
  min-width: 250px;
}

.character-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.character-anime {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 1rem;
}

.character-description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.character-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--primary);
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Matchups */
.character-matchups,
.recent-matches {
  margin-top: 1.5rem;
}

.matchups-list,
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.matchup-item,
.match-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
}

.matchup-item:hover,
.match-item:hover {
  background: var(--bg-elevated);
}

.match-opponent,
.matchup-opponent {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
}

.opponent-thumb,
.opponent-thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  border: 1px solid var(--border);
}

.opponent-thumb-placeholder {
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
}

.opponent-name {
  font-size: 0.9rem;
}

.matchup-record {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
}

.record-wins {
  color: var(--success);
}

.record-losses {
  color: var(--danger);
}

.matchup-win-rate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 80px;
}

.mini-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  background: var(--primary);
}

.win-rate-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 36px;
}

.match-result {
  min-width: 50px;
}

.result-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
}

.result-badge.win {
  background: var(--success);
  color: white;
}

.result-badge.loss {
  background: var(--danger);
  color: white;
}

.match-elo {
  min-width: 45px;
  text-align: right;
}

.elo-change {
  font-size: 0.8rem;
}

.elo-change.positive {
  color: var(--success);
}

.elo-change.negative {
  color: var(--danger);
}

.match-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

.match-item.won {
  border-left: 3px solid var(--success);
}

.match-item.lost {
  border-left: 3px solid var(--danger);
}

/* Search */
.search-container {
  max-width: 1000px;
  margin: 0 auto;
}

.search-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.search-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

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

.search-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.search-box .search-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.search-box .search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
}

.search-box .search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-box .search-btn {
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: white;
  font-weight: 500;
}

.search-box .search-btn:hover {
  background: var(--primary-hover);
}

.results-title {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.character-search-card {
  display: flex;
  gap: 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
}

.character-search-card:hover {
  background: var(--bg-elevated);
  border-color: var(--primary);
}

.character-search-image {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.character-search-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.character-search-info {
  flex: 1;
  min-width: 0;
}

.character-search-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.character-search-anime {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.375rem;
}

.character-search-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.character-search-stats .elo {
  color: var(--primary);
  font-weight: 500;
}

.character-search-stats .record {
  color: var(--text-muted);
}

.no-results {
  text-align: center;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.no-results p {
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.no-results .hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.search-suggestions {
  text-align: center;
  padding: 1.5rem;
}

.search-suggestions h3 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.suggestion-tag {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: var(--transition);
}

.suggestion-tag:hover {
  background: var(--bg-elevated);
  border-color: var(--primary);
}

/* ========================================
   Footer - Editorial Premium
   ======================================== */

.footer {
  background: var(--bg-paper);
  border-top: 1px solid var(--border-light);
  padding: var(--space-2xl) var(--space-xl);
  margin-top: var(--space-3xl);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-logo {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.footer-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
  list-style: none;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
  transition: var(--transition-fast);
}

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

.footer-social {
  display: flex;
  gap: var(--space-md);
}

.footer-social a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition-base);
}

.footer-social a:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}

.footer-bottom {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-lg);
}

.footer-bottom a {
  color: var(--primary);
}

/* Matchup Detail */
.matchup-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.matchup-character {
  text-align: center;
}

.matchup-character-image {
  width: 160px;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.matchup-character-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.matchup-character-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.matchup-character-elo {
  font-size: 0.8rem;
  color: var(--primary);
}

.matchup-vs-section {
  text-align: center;
}

.matchup-vs-text {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.matchup-total-matches {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.matchup-stats {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.stats-bar {
  display: flex;
  height: 32px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.stats-bar-left {
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-bar-right {
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

.stats-summary {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stats-card {
  text-align: center;
  padding: 0.875rem 1.5rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  min-width: 100px;
}

.stats-wins {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.stats-card:first-child .stats-wins {
  color: var(--primary);
}

.stats-card:last-child .stats-wins {
  color: var(--secondary);
}

.stats-total {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.stats-label-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
}

.history-item.char1-win {
  border-left: 3px solid var(--primary);
}

.history-item.char2-win {
  border-left: 3px solid var(--secondary);
}

.history-winner {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.winner-badge {
  font-weight: 600;
  font-size: 0.9rem;
}

.winner-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
}

.no-matches {
  text-align: center;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.no-matches p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
  :root {
    --max-width: 100%;
  }

  .main-content {
    padding: var(--space-xl) var(--space-lg);
  }

  .anime-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-lg);
  }
}

@media (max-width: 768px) {
  /* Navigation */
  .mobile-menu-toggle {
    display: block;
  }

  .nav-links.mobile-open,
  .nav-search.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-paper);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
  }

  .nav-search.mobile-open {
    position: absolute;
    top: 100%;
    order: -1;
  }

  .nav-links {
    display: none;
  }

  .nav-search {
    display: none;
  }

  .nav-container {
    padding: 0 var(--space-md);
    height: auto;
    min-height: var(--header-height);
    flex-wrap: wrap;
    gap: var(--space-md);
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
  }

  .nav-search {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .nav-search form {
    flex-direction: column;
  }

  .nav-search-input {
    width: 100%;
  }

  .nav-search-btn {
    width: 100%;
  }

  .nav-links {
    gap: var(--space-md);
  }

  /* Main content */
  .main-content {
    padding: var(--space-lg) var(--space-md);
  }

  /* Hero */
  .hero-section {
    padding: var(--space-xl) var(--space-md) var(--space-lg);
  }

  .hero-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .hero-cta .btn {
    width: 100%;
    max-width: 200px;
  }

  /* Anime Grid */
  .anime-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-md);
  }

  .anime-info {
    padding: var(--space-md);
  }

  .anime-name {
    font-size: 0.95rem;
  }

  .anime-meta {
    font-size: 0.8rem;
  }

  /* Versus Page */
  .versus-container {
    padding: 0 var(--space-md);
  }

  .versus-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .versus-title {
    font-size: 1.25rem;
  }

  .versus-nav {
    width: 100%;
    justify-content: stretch;
  }

  .versus-nav .btn {
    flex: 1;
    text-align: center;
  }

  .versus-arena {
    padding: var(--space-lg) var(--space-md);
  }

  .versus-battle {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .character-card {
    width: 100%;
    max-width: 100%;
    min-width: unset;
  }

  .character-image-container {
    height: 200px;
  }

  .versus-divider {
    transform: rotate(90deg);
    padding: var(--space-sm) 0;
  }

  /* Leaderboard */
  .leaderboard-container {
    padding: 0 var(--space-md);
  }

  .leaderboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .leaderboard-title {
    font-size: 1.25rem;
  }

  .leaderboard-nav {
    width: 100%;
    justify-content: stretch;
  }

  .leaderboard-nav .btn {
    flex: 1;
    text-align: center;
  }

  .leaderboard-search .search-input-wrapper {
    max-width: 100%;
  }

  .top-three {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .top-card {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .table-header,
  .table-row {
    grid-template-columns: 40px 1fr 70px;
    padding: var(--space-md);
    font-size: 0.9rem;
  }

  .col-record,
  .col-winrate {
    display: none;
  }

  .character-cell {
    gap: var(--space-sm);
  }

  .character-thumb {
    width: 36px;
    height: 36px;
  }

  /* Tournament */
  .tournament-container {
    padding: 0 var(--space-md);
  }

  .tournament-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .tournament-title {
    font-size: 1.25rem;
  }

  .tournament-nav {
    width: 100%;
    flex-wrap: wrap;
  }

  .tournament-nav .btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }

  .tournament-battle {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .tournament-bracket {
    overflow-x: auto;
    padding-bottom: var(--space-md);
  }

  .bracket-round {
    min-width: 150px;
  }

  .matchup-card {
    padding: var(--space-sm);
  }

  .matchup-card .character-name {
    font-size: 0.85rem;
  }

  /* Character Detail */
  .character-detail-container {
    padding: 0 var(--space-md);
  }

  .character-detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-lg);
  }

  .character-detail-image {
    width: 150px;
    height: 150px;
  }

  .character-detail-info h1 {
    font-size: 1.5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .matchup-grid {
    grid-template-columns: 1fr;
  }

  /* Matchup Detail */
  .matchup-detail-container {
    padding: 0 var(--space-md);
  }

  .matchup-header {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .matchup-characters {
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
  }

  .matchup-character {
    width: 100%;
    max-width: 250px;
  }

  .vs-divider {
    transform: rotate(0deg);
  }

  /* Footer */
  .footer-content {
    flex-direction: column;
    gap: var(--space-lg);
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Pagination */
  .pagination-container,
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }

  .pagination-pages {
    order: -1;
    width: 100%;
    justify-content: center;
    margin-bottom: var(--space-sm);
  }

  /* Modal */
  .modal-content {
    margin: var(--space-md);
    padding: var(--space-lg);
  }

  .tournament-options {
    gap: var(--space-sm);
  }
}

@media (max-width: 480px) {
  /* Extra small devices */
  :root {
    --header-height: 60px;
  }

  .logo-text {
    font-size: 1.25rem;
  }

  .logo-subtitle {
    font-size: 0.55rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.375rem 0.5rem;
  }

  .theme-toggle {
    padding: 0.25rem 0.5rem;
  }

  .theme-label {
    display: none;
  }

  /* Hero */
  .hero-title {
    font-size: 1.5rem;
  }

  .hero-stat {
    min-width: 80px;
  }

  .hero-stat-value {
    font-size: 1.5rem;
  }

  /* Anime Grid */
  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .anime-info {
    padding: var(--space-sm);
  }

  .anime-name {
    font-size: 0.85rem;
  }

  .anime-meta {
    font-size: 0.7rem;
  }

  /* Versus */
  .character-image-container {
    height: 180px;
  }

  .character-name {
    font-size: 0.9rem;
  }

  .character-stats {
    font-size: 0.8rem;
  }

  /* Leaderboard */
  .table-header,
  .table-row {
    grid-template-columns: 35px 1fr 60px;
    padding: var(--space-sm);
    font-size: 0.85rem;
  }

  .character-thumb {
    width: 30px;
    height: 30px;
  }

  .top-card {
    max-width: 200px;
  }

  .top-character-image {
    width: 80px;
    height: 80px;
  }

  /* Tournament */
  .tournament-title {
    font-size: 1.1rem;
  }

  .round-indicator {
    font-size: 0.9rem;
  }

  /* Stats Grid */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-value {
    font-size: 1.25rem;
  }

  /* Buttons */
  .btn {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
  }

  /* Forms */
  input[type="text"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .versus-battle,
  .tournament-battle {
    flex-direction: row;
    gap: var(--space-md);
  }

  .character-card {
    max-width: 45%;
  }

  .character-image-container {
    height: 150px;
  }

  .versus-divider {
    transform: none;
    writing-mode: vertical-rl;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .anime-card:hover {
    transform: none;
  }

  .character-card:hover:not(.voting) {
    transform: none;
  }

  .anime-card:active,
  .character-card:active {
    transform: scale(0.98);
  }

  /* Larger touch targets */
  .btn,
  .nav-link,
  .character-card,
  .anime-card {
    min-height: 44px;
  }

  /* Disable hover effects that don't work on touch */
  .vote-overlay {
    display: none;
  }
}

/* ========================================
   Toast Notifications
   ======================================== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: all 0.3s ease;
}

.toast.hiding {
  opacity: 0;
  transform: translateX(20px);
}

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

.toast-content {
  flex: 1;
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.25rem;
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-warning {
  border-left-color: var(--accent);
}
