/* Disable all transitions to prevent Safari flicker */
*, *::before, *::after {
  /* Completely disable transitions for Safari stability */
  transition: none !important;
  animation: none !important;
  /* Keep hardware acceleration but no transitions */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Allow pseudo-elements to work properly */
.card::before, .card::after {
  transform: none !important;
  -webkit-transform: none !important;
  backface-visibility: visible !important;
  -webkit-backface-visibility: visible !important;
}

/* Safari-optimized hover - no transitions that cause flicker */
.btn:hover {
  /* Simple static color change - no animations */
  background-color: var(--fifa-blue) !important;
  /* Remove all transition-causing properties */
  box-shadow: none !important;
  transform: none !important;
}

.card:hover,
.card-link:hover .card {
  /* Minimal hover feedback without transitions */
  border-color: rgba(255, 215, 0, 0.4) !important;
  /* Remove shadow and transform that cause flicker */
  box-shadow: none !important;
  transform: none !important;
}

/* Safe cursor for interactive elements */
a, button, .btn {
  cursor: pointer;
}

/* Mobile-First World Cup Affiliate Site - Optimized for iPhone Safari */
:root {
  /* Seattle + World Cup Color Palette */
  --seattle-navy: #002244;
  --seattle-blue: #0066cc;
  --emerald: #007a4d;
  --pitch-green: #2d8b3a;
  --accent-gold: #ffd700;
  --surface: #f8fafc;
  --surface-dark: #1a202c;
  --text-primary: #2d3748;
  --text-light: #718096;
  
  /* World Cup Theme Colors */
  --fifa-blue: #0066cc;
  --fifa-red: #e60000;
  --fifa-gold: #ffd700;
  --field-green: #228b22;
  --soccer-white: #ffffff;
  --pitch-dark: #1a5d1a;
  --trophy-gold: #ffb347;
  
  /* Mobile-optimized effects */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
  --world-cup-gradient: linear-gradient(135deg, var(--fifa-blue), var(--field-green), var(--fifa-gold));
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--soccer-white);
  line-height: 1.6;
  font-weight: 400;
  position: relative;
  /* Back to original background */
  background: #002244;
  /* background: linear-gradient(135deg, var(--seattle-navy) 0%, var(--pitch-green) 30%, var(--fifa-blue) 70%, var(--emerald) 100%); */
  min-height: 100vh;
}

/* Subtle field pattern - simplified for mobile */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 48px,
    rgba(255, 255, 255, 0.02) 50px,
    rgba(255, 255, 255, 0.02) 52px
  );
  pointer-events: none;
  z-index: -1;
}

/* Side Navigation - Mobile First */
.sidenav {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, 
    rgba(0, 34, 68, 0.95) 0%, 
    rgba(34, 139, 34, 0.9) 50%, 
    rgba(255, 215, 0, 0.9) 100%);
  border-right: 2px solid var(--fifa-gold);
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.2);
  /* Remove backdrop-filter for better iOS performance */
}

.sidenav-header {
  padding: 2rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 215, 0, 0.3);
  text-align: center;
}

.sidenav-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--soccer-white);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.world-cup-logo {
  display: inline-block;
  margin-right: 0.5rem;
  /* animation: trophy-pulse 3s ease-in-out infinite; */
}

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

.sidenav-menu {
  padding: 1rem 0;
}

.sidenav-item {
  margin: 0.5rem 1rem;
}

.sidenav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  color: var(--soccer-white);
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.2s ease;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

.sidenav-link:hover,
.sidenav-link:active {
  background: rgba(255, 215, 0, 0.2);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

.sidenav-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

/* Header - Mobile optimized */
header {
  background: rgba(0, 34, 68, 0.9);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 1.5rem;
  margin-left: 280px;
  /* Remove backdrop-filter for iOS performance */
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.skyline {
  height: 40px;
  width: auto;
}

.brand-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--soccer-white);
  letter-spacing: -0.025em;
}

.brand-text a {
  color: inherit;
  text-decoration: none;
}

.trophy {
  display: inline-block;
  /* animation: trophy-pulse 3s ease-in-out infinite; */
}

header nav a {
  color: var(--soccer-white);
  text-decoration: none;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

header nav a:hover {
  color: var(--accent-gold);
}

.logout-btn {
  background: var(--fifa-red);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.logout-btn:hover {
  background: #cc0000;
  transform: translateY(-1px);
}

/* Breadcrumb - Simplified for mobile */
.breadcrumb {
  background: rgba(34, 139, 34, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 25px;
  padding: 0.75rem 1.25rem;
  margin: 1rem 1.5rem;
  margin-left: 300px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  /* Mobile improvements */
  overflow: hidden;
  max-width: calc(100vw - 3rem);
  box-sizing: border-box;
}

.breadcrumb a {
  color: var(--fifa-gold);
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
  /* Mobile text handling */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.breadcrumb .current {
  color: var(--soccer-white);
  font-weight: 600;
  /* Mobile text handling */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.breadcrumb a:hover {
  background: rgba(255, 215, 0, 0.15);
  color: var(--soccer-white);
}

.breadcrumb .separator {
  color: var(--text-light);
  font-size: 1rem;
  flex-shrink: 0; /* Prevent separators from shrinking */
}

.breadcrumb .current {
  color: var(--soccer-white);
  font-weight: 600;
}

/* Main content */
main {
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  /* Remove fixed left margin for mobile */
}

/* Cards and content - Better CSS for many cards without Safari flicker */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  /* Optimize for Safari performance */
  contain: layout style;
  transform: translateZ(0); /* Force hardware acceleration */
  -webkit-transform: translateZ(0);
  will-change: contents;
}

.cards-grid .card {
  /* Prevent individual cards from causing reflow */
  contain: layout style paint;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Fixed dimensions to prevent layout calculations */
  min-height: 200px;
  width: 100%;
}

/* Specific fix for first card flicker in Safari */
.cards-grid .card:first-child {
  /* Extra stability for the first grid item */
  position: relative;
  z-index: 1;
  /* Ensure it's fully rendered before display */
  opacity: 1;
  /* Force complete composite layer */
  will-change: auto;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

/* Progressive layout for different screen sizes */
@media (max-width: 640px) {
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 1201px) {
  .cards-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow);
  /* Remove gradient attempts, keep it simple */
  position: relative;
  z-index: 0;
}

/* Removed pseudo-element approach, using border-image instead */

/* Make entire card clickable */
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:hover {
  text-decoration: none;
  color: inherit;
}

.card-link .card {
  /* Inherit card hover effects */
  cursor: pointer;
}

.card:hover {
  /* Remove transform to prevent grid recalculation */
  /* transform: translateY(-4px); */
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 215, 0, 0.3);
}

/* Add gradient background to card headers for visual appeal */
.card-header {
  background: var(--world-cup-gradient);
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  padding: 1rem 1.5rem;
  border-radius: 15px 15px 0 0;
}

.card-header h3 {
  color: white;
  margin-bottom: 0;
  font-size: 1.2rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.card-content p {
  color: var(--soccer-white);
  margin-bottom: 1rem;
  opacity: 0.9;
}

.card-content {
  text-align: center;
}

.subcategory-description {
  color: var(--soccer-white);
  margin-bottom: 1rem;
  font-style: italic;
  opacity: 0.9;
  text-align: left;
}

.link-count {
  color: var(--fifa-gold);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  margin-top: 0.5rem;
  opacity: 0.8;
}

.view-subcategory {
  margin-top: 1rem;
  text-align: center;
}

.view-all-link {
  color: var(--fifa-gold);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.view-all-link:hover {
  border-bottom-color: var(--fifa-gold);
}

/* Link descriptions for subcategory pages */
.link-card .link-description {
  color: var(--soccer-white);
  opacity: 0.85;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 1rem;
  text-align: left;
  font-style: italic;
}

.btn-center {
  display: block;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--world-cup-gradient);
  color: var(--soccer-white);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: box-shadow 0.2s ease, filter 0.2s ease, background 0.2s ease;
  border: none;
  /* cursor: pointer; */
  -webkit-tap-highlight-color: transparent;
  /* Aggressive override to prevent any browser defaults */
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* Completely disable hover effects to test flicker */
/* .btn:hover, .btn:active { } */

.btn:hover .btn-svg,
.btn:active .btn-svg {
  transform: none;
}

.btn-primary {
  background: var(--world-cup-gradient);
}

.btn-goal {
  background: var(--world-cup-gradient);
  border: 2px solid var(--fifa-gold);
}

.btn-center {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
}

/* Links section */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.link-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--fifa-gold);
}

.link-card img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.football-card {
  border-color: rgba(34, 139, 34, 0.3);
}

.football-card:hover {
  border-color: var(--field-green);
  background: rgba(34, 139, 34, 0.1);
}

/* About page features */
.world-cup-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  /* iPhone Safari grid fixes */
  width: 100%;
  box-sizing: border-box;
}

.feature-card {
  /* iPhone Safari fallbacks */
  background: rgba(0, 34, 68, 0.7);
  background: var(--glass-bg);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  /* iPhone Safari performance */
  will-change: transform;
  backface-visibility: hidden;
  /* Ensure text is readable on iPhone */
  color: #ffffff;
}

.feature-card:hover {
  transform: translateY(-6px);
  border-color: var(--fifa-gold);
  box-shadow: 0 12px 24px rgba(255, 215, 0, 0.2);
}

.feature-card h3 {
  color: #ffd700; /* iPhone Safari fallback */
  color: var(--fifa-gold);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.pitch-panel {
  /* iPhone Safari fallbacks */
  background: rgba(0, 34, 68, 0.8);
  background: var(--glass-bg);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
  /* Ensure text is readable */
  color: #ffffff;
}

.pitch-panel h2 {
  color: #ffd700; /* iPhone Safari fallback */
  color: var(--fifa-gold);
  margin-bottom: 1.5rem;
}

/* Menu toggle - hidden by default on desktop */
.menu-toggle {
  display: none;
}

/* Overlay - hidden by default */
.sidenav-overlay {
  display: none;
}

/* Desktop styles - sidebar always visible */
@media (min-width: 769px) {
  main {
    margin-left: 300px; /* Account for sidebar width */
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  /* Fix iPhone Safari viewport issues */
  body {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
  }

  main {
    padding: 1rem;
    margin: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Show menu toggle on mobile */
  .menu-toggle {
    display: flex;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--world-cup-gradient);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    /* cursor: pointer; */
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--soccer-white);
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    -webkit-tap-highlight-color: transparent;
  }

  .menu-toggle:active {
    transform: scale(0.95);
  }

  /* Hide sidebar by default on mobile */
  .sidenav {
    left: -280px;
    transition: left 0.3s ease;
  }

  .sidenav.open {
    left: 0;
  }

  /* Show overlay when sidebar is open */
  .sidenav-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

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

  /* Reset content margins on mobile */
  header {
    margin-left: 0;
    padding: 1rem;
  }

  .breadcrumb {
    margin: 1rem;
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    /* Enhanced mobile handling */
    max-width: calc(100vw - 2rem);
    gap: 0.3rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .breadcrumb::-webkit-scrollbar {
    display: none;
  }

  .breadcrumb a, .breadcrumb .current {
    max-width: 120px;
    font-size: 0.75rem;
  }

  main {
    margin-left: 0;
    padding: 2rem 1rem;
  }

  /* Responsive text sizes */
  .brand-text {
    font-size: 1.1rem;
  }

  .sidenav-title {
    font-size: 1.2rem;
  }

  /* Grid adjustments */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .world-cup-features {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
  }

  .links {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Better mobile card sizing */
  .link-card, .feature-card {
    padding: 1rem;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    /* iPhone Safari specific */
    transform: translateZ(0); /* Force hardware acceleration */
    backface-visibility: hidden; /* Improve rendering */
  }

  /* iPhone Safari specific fixes */
  .pitch-panel {
    margin: 1rem 0;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
    /* Force GPU acceleration for smoother scrolling */
    transform: translateZ(0);
    will-change: transform;
    /* iPhone Safari color fallbacks */
    background: rgba(0, 34, 68, 0.9) !important;
    color: #ffffff !important;
  }

  /* Breadcrumb iPhone Safari fixes */
  .breadcrumb {
    background: rgba(0, 34, 68, 0.8) !important;
    color: #ffffff !important;
    border: 1px solid #ffd700 !important;
    /* Ensure horizontal scrolling works */
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }

  .breadcrumb a {
    color: #ffd700 !important;
    flex-shrink: 0;
  }

  .breadcrumb .current {
    color: #ffffff !important;
    flex-shrink: 0;
  }

  .breadcrumb .separator {
    color: #ffffff !important;
    flex-shrink: 0;
  }

  /* About page specific iPhone fixes */
  .world-cup-features .feature-card {
    /* Prevent layout shifting on iPhone */
    min-height: auto;
    overflow: hidden;
    /* Better touch response */
    touch-action: manipulation;
    /* Force readable colors */
    background: rgba(0, 34, 68, 0.8) !important;
    color: #ffffff !important;
  }

  .feature-card h3 {
    /* Prevent text overflow on small screens */
    word-wrap: break-word;
    hyphens: auto;
    /* Force readable color */
    color: #ffd700 !important;
  }

  .pitch-panel h2 {
    color: #ffd700 !important;
  }

  .feature-card p, .pitch-panel p {
    color: #ffffff !important;
  }

  /* Ensure no horizontal overflow */
  * {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Fix button and link sizing */
  .btn, .sidenav-link {
    width: 100%;
    text-align: center;
    word-wrap: break-word;
  }

  /* Touch-friendly sizing */
  .btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }

  .sidenav-link {
    padding: 1rem 1.25rem;
  }

  /* Improve header layout on mobile */
  .header-left {
    flex: 1;
    gap: 0.75rem;
  }

  .skyline {
    height: 32px;
  }

  header nav {
    font-size: 0.9rem;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .breadcrumb {
    flex-direction: row; /* Keep horizontal on very small screens */
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.8rem;
    overflow-x: auto;
    white-space: nowrap;
  }

  .breadcrumb a, .breadcrumb .current {
    max-width: 100px;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  .breadcrumb .separator {
    font-size: 0.8rem;
  }

  .feature-card,
  .card,
  .pitch-panel {
    padding: 1.5rem;
  }

  main {
    padding: 1.5rem 0.75rem;
  }

  .brand-text {
    font-size: 1rem;
  }
}

/* iPhone Safari specific fixes - additional */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
  /* Force readable colors on iPhone Safari */
  body {
    background: #002244 !important;
    color: #ffffff !important;
  }

  .pitch-panel {
    background: rgba(0, 34, 68, 0.9) !important;
    color: #ffffff !important;
    border: 2px solid #ffd700 !important;
  }

  .feature-card {
    background: rgba(0, 34, 68, 0.8) !important;
    color: #ffffff !important;
    border: 1px solid #ffd700 !important;
  }

  .feature-card h3 {
    color: #ffd700 !important;
  }

  .pitch-panel h2 {
    color: #ffd700 !important;
  }

  .feature-card p {
    color: #ffffff !important;
  }

  .pitch-panel p {
    color: #ffffff !important;
  }

  /* Specific to iPhone with retina display */
  .world-cup-features {
    /* Prevent sub-pixel rendering issues */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  .feature-card {
    /* Improve rendering performance */
    will-change: transform;
    /* Fix blurry text on retina */
    -webkit-font-smoothing: subpixel-antialiased;
  }

  .pitch-panel {
    /* Prevent content jumping */
    min-height: auto;
    overflow: hidden;
  }

  /* Fix grid layout issues on iPhone */
  .world-cup-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .feature-card {
    flex: none;
    width: 100%;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix for iOS Safari viewport units */
  body {
    min-height: -webkit-fill-available;
  }

  /* Improve scroll performance */
  .sidenav {
    -webkit-overflow-scrolling: touch;
  }

  /* iPhone Safari about page optimizations */
  .world-cup-features {
    /* Force proper layout calculation */
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    contain: layout;
  }

  .feature-card {
    /* Prevent rendering glitches */
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Fix tap highlighting */
    -webkit-tap-highlight-color: transparent;
    /* Ensure proper stacking */
    position: relative;
    z-index: 1;
  }

  .pitch-panel {
    /* Prevent layout shifts */
    contain: layout style;
    /* Force repaint optimization */
    transform: translateZ(0);
  }

  /* Fix iOS Safari text rendering */
  .feature-card h3,
  .feature-card p {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* =================================
   ICON SYSTEM STYLING
   ================================= */

/* Base icon styling - Optimized for all devices including iPhone Safari */
.sidenav-icon,
.card h3 > span:first-child,
.btn > span:first-child {
  display: inline-block;
  font-size: 1.2em;
  line-height: 1;
  vertical-align: middle;
  margin-right: 0.5rem;
  /* iPhone Safari emoji optimization */
  font-feature-settings: "liga", "kern";
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent layout shifts */
  min-width: 1.2em;
  text-align: center;
}

/* SVG Icon Styling */
.sidenav-svg,
.card-svg,
.btn-svg,
.page-title-svg {
  width: 1.2em;
  height: 1.2em;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
  /* Color SVGs to match current text color */
  filter: brightness(0) saturate(100%) invert(84%) sepia(11%) saturate(190%) hue-rotate(180deg) brightness(98%) contrast(89%);
  /* Prevent flicker */
  opacity: 1;
  transition: opacity 0.1s ease-in-out;
  /* Ensure space is reserved during load */
  min-width: 1.2em;
  min-height: 1.2em;
  /* Prevent layout shift */
  flex-shrink: 0;
  /* Prevent transform inheritance from parent buttons */
  transform: none !important;
  backface-visibility: hidden;
}

/* Specific sizing for different contexts */
.sidenav-svg {
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.75rem;
}

.card-svg {
  width: 1.3em;
  height: 1.3em;
  margin-right: 0.5rem;
}

.btn-svg {
  width: 1.1em;
  height: 1.1em;
  margin-left: 0.5rem;
  margin-right: 0;
  /* Prevent flicker during button hover */
  transform: none !important;
  transition: none !important;
  will-change: auto;
  backface-visibility: hidden;
}

.page-title-svg {
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.5rem;
  /* Prevent layout shift in title */
  position: relative;
  top: -1px;
}

/* Ensure SVGs work in light/dark mode */
@media (prefers-color-scheme: dark) {
  .sidenav-svg,
  .card-svg,
  .btn-svg,
  .page-title-svg {
    /* Invert colors for dark mode */
    filter: brightness(0) saturate(100%) invert(100%);
  }
}

/* High contrast support for SVGs */
@media (prefers-contrast: high) {
  .sidenav-svg,
  .card-svg,
  .btn-svg,
  .page-title-svg {
    filter: brightness(0) saturate(100%) contrast(200%);
  }
}

/* Sidenav icons */
.sidenav-icon {
  font-size: 1.1em;
  margin-right: 0.75rem;
  flex-shrink: 0;
  /* Ensure consistent alignment */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
}

/* Card header icons */
.card-header h3 {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  line-height: 1.4;
}

.card-header h3 > span:first-child {
  margin-right: 0.5rem;
  font-size: 1.3em;
  flex-shrink: 0;
}

/* Button icons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn > span:first-child,
.btn-goal > span:first-child {
  font-size: 1.1em;
  line-height: 1;
}

/* Page title icons */
main h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  line-height: 1.3;
  /* Prevent flicker by ensuring stable layout */
  min-height: 2.5rem;
  opacity: 1;
}

main h2 > span:first-child {
  font-size: 1.2em;
  flex-shrink: 0;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  /* Slightly smaller icons on mobile for better space usage */
  .sidenav-icon {
    font-size: 1em;
    width: 1.3em;
    height: 1.3em;
  }
  
  .card-header h3 > span:first-child {
    font-size: 1.2em;
  }
  
  main h2 > span:first-child {
    font-size: 1.1em;
  }
  
  /* Ensure icons don't break on very small screens */
  .btn > span:first-child {
    font-size: 1em;
  }
}

/* iPhone Safari specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
  .sidenav-icon,
  .card-header h3 > span:first-child,
  .btn > span:first-child,
  main h2 > span:first-child {
    /* Force emoji rendering optimization */
    transform: translateZ(0);
    backface-visibility: hidden;
    /* Prevent emoji scaling issues */
    font-variant-emoji: emoji;
    /* Improve rendering on retina displays */
    -webkit-font-feature-settings: "liga", "kern";
    font-feature-settings: "liga", "kern";
  }
}

/* Dark mode icon adjustments */
@media (prefers-color-scheme: dark) {
  .sidenav-icon,
  .card-header h3 > span:first-child,
  .btn > span:first-child,
  main h2 > span:first-child {
    /* Ensure good contrast in dark mode */
    filter: brightness(1.1);
  }
}

/* High contrast mode icon support */
@media (prefers-contrast: high) {
  .sidenav-icon,
  .card-header h3 > span:first-child,
  .btn > span:first-child,
  main h2 > span:first-child {
    /* Increase emoji visibility in high contrast */
    filter: contrast(1.2);
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
  }
}

/* Accessibility improvements */
.sidenav-icon,
.card-header h3 > span:first-child,
.btn > span:first-child,
main h2 > span:first-child {
  /* Improve screen reader compatibility and prevent text selection */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Print styles - hide decorative icons */
@media print {
  .sidenav-icon,
  .btn > span:first-child {
    display: none;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --glass-bg: rgba(255, 255, 255, 0.2);
    --glass-border: rgba(255, 255, 255, 0.4);
  }
}