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

/* ==========================================================================
   DESIGN SYSTEM CUSTOM PROPERTIES
   ========================================================================== */
:root {
  /* Colors */
  --bg-primary: #0A0E27;
  --bg-secondary: #101535;
  --bg-card: rgba(16, 22, 58, 0.45);
  --bg-card-hover: rgba(22, 30, 75, 0.6);
  --accent: #00D26A;
  --accent-hover: #00F57C;
  --accent-glow: rgba(0, 210, 106, 0.25);
  --highlight: #FFD700;
  --highlight-glow: rgba(255, 215, 0, 0.2);
  --danger: #FF334B;
  --danger-glow: rgba(255, 51, 75, 0.25);
  --text-primary: #FFFFFF;
  --text-secondary: #A0A5C0;
  --text-muted: #626784;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(0, 210, 106, 0.4);

  /* Layout & Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2.5rem;
  --spacing-xxl: 4rem;

  /* Typography */
  --font-family: 'Inter', sans-serif;
  
  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-speed: 0.2s;
  --transition-ease: ease;
  --transition-base: all var(--transition-speed) var(--transition-ease);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 50% 0%, #161C42 0%, var(--bg-primary) 70%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

input, select, button {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Display & Flex/Grid */
.d-flex { display: flex; }
.d-grid { display: grid; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* Spacing Helpers */
.m-0 { margin: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }

/* Text Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent); }
.text-highlight { color: var(--highlight); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-bold { font-weight: 700; }
.text-medium { font-weight: 500; }
.text-lg { font-size: 1.25rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* Grid Systems (Mobile First) */
.grid-1-2 {
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}
@media (min-width: 768px) {
  .grid-1-2 { grid-template-columns: repeat(2, 1fr); }
}

.grid-1-3 {
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}
@media (min-width: 768px) {
  .grid-1-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-1-3 { grid-template-columns: repeat(3, 1fr); }
}

.grid-1-4 {
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}
@media (min-width: 576px) {
  .grid-1-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
  .grid-1-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================================
   LAYOUT: HEADER & FOOTER
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  background: rgba(10, 14, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  transition: var(--transition-base);
}

.header-container {
  height: 80px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.logo-subtitle {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--bg-primary);
  box-shadow: 0 0 15px var(--accent-glow);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  list-style: none;
}

.nav-link {
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: var(--spacing-sm) 0;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: var(--transition-base);
}
.nav-link.active::after, .nav-link:hover::after {
  width: 100%;
}

.hamburger {
  display: none;
  cursor: pointer;
  background: none;
  border: none;
  flex-direction: column;
  gap: 6px;
}
.hamburger span {
  width: 25px;
  height: 2px;
  background-color: var(--text-primary);
  transition: var(--transition-base);
}

@media (max-width: 991px) {
  .hamburger { display: flex; }
  nav {
    position: absolute;
    width: 0;
    height: 0;
    overflow: visible;
  }
  .nav-menu {
    position: fixed;
    top: 80px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 80px);
    background: var(--bg-primary);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--spacing-xl);
    gap: var(--spacing-lg);
    transition: 0.3s ease-in-out;
    border-top: 1px solid var(--border-color);
  }
  .nav-menu.open {
    left: 0;
  }
}

.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-xxl) 0 var(--spacing-lg);
  margin-top: var(--spacing-xxl);
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

/* Glass Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: var(--transition-base);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
.card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 32px 0 rgba(0, 210, 106, 0.05);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-base);
  gap: var(--spacing-sm);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 4px 14px var(--accent-glow);
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(0, 210, 106, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(0, 210, 106, 0.05);
}

.btn-ghost {
  color: var(--text-secondary);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-group {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-live {
  background: var(--danger-glow);
  color: var(--danger);
  border: 1px solid rgba(255, 51, 75, 0.2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-live::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--danger);
  border-radius: var(--radius-full);
  animation: pulse-dot 1.2s infinite;
}

.badge-correct {
  background: rgba(0, 210, 106, 0.15);
  color: var(--accent);
}

.badge-incorrect {
  background: rgba(255, 51, 75, 0.15);
  color: var(--danger);
}

/* Team Flags (Styled Placeholder / CSS Circles) */
.team-flag {
  width: 30px;
  height: 20px;
  background: #252a4e;
  border-radius: 2px;
  display: inline-block;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.team-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Standalone Flag Icon */
.flag-icon {
  width: 30px;
  height: 20px;
  object-fit: cover;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  margin-right: 4px;
}

/* Form elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}
.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  transition: var(--transition-base);
}
.form-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   PAGE: HOME / DASHBOARD
   ========================================================================== */
.hero-section {
  padding: var(--spacing-xxl) 0;
  text-align: center;
  position: relative;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
}
@media (min-width: 768px) {
  .hero-title { font-size: 4.5rem; }
}

.animated-gradient {
  background: linear-gradient(-45deg, #00D26A, #FFD700, #0074F9, #FF334B);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-flow 8s ease infinite;
}

/* ==========================================================================
   PAGE: SCHEDULE
   ========================================================================== */
.schedule-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  background: var(--bg-card);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: var(--spacing-xl);
}

.filter-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 150px;
}
.filter-select:focus {
  border-color: var(--accent);
}

.match-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-md);
}

.match-info-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.match-teams {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--spacing-md);
  text-align: center;
}

.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}
@media (min-width: 576px) {
  .match-team {
    flex-direction: row;
  }
  .match-team.away {
    flex-direction: row-reverse;
  }
}

.match-score-section {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1.5rem;
  font-weight: 700;
}

.score-box {
  width: 45px;
  height: 45px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
}

.vs-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* ==========================================================================
   PAGE: PREDICT
   ========================================================================== */
.predict-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}
.predict-tab {
  padding: 1rem 1.5rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-base);
}
.predict-tab.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* Group Standings Predictor */
.predict-group-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xl);
}
@media (min-width: 992px) {
  .predict-group-stage {
    grid-template-columns: repeat(2, 1fr);
  }
}

.group-predict-card {
  padding: var(--spacing-md);
}

.group-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-md);
  text-align: left;
  font-size: 0.875rem;
}
.group-table th, .group-table td {
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
}
.group-table th {
  color: var(--text-secondary);
  font-weight: 500;
}

.group-table tr.qualifies-1st {
  background: rgba(0, 210, 106, 0.03);
}
.group-table tr.qualifies-2nd {
  background: rgba(0, 210, 106, 0.01);
}

.group-match-row, .group-match-prediction-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  gap: var(--spacing-sm);
}

.prediction-score-input {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-primary);
  font-weight: 700;
}
.prediction-score-input:focus {
  border-color: var(--accent);
}

/* Bracket Layout & Lines */
.bracket-wrapper {
  overflow-x: auto;
  padding: var(--spacing-lg) 0;
}

.bracket-container {
  display: flex;
  gap: 40px;
  min-width: 1400px;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 220px;
}

.bracket-match {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--spacing-md) 0;
}
.bracket-match:hover {
  border-color: var(--border-hover);
}

.bracket-team-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
}
.bracket-team-slot:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}
.bracket-team-slot.selected {
  background: rgba(0, 210, 106, 0.1);
  color: var(--accent);
}

.bracket-team-slot.winner-outcome {
  border-right: 3px solid var(--accent);
}

/* Bracket lines layout */
/* For connection from Round A to Round B */
.bracket-round:not(:last-child) .bracket-match::after {
  content: '';
  position: absolute;
  right: -21px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.bracket-round:not(:first-child) .bracket-match::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

/* Vertical connector lines */
.bracket-connector-vertical {
  position: absolute;
  right: -21px;
  background: var(--border-color);
  width: 2px;
  z-index: 1;
}

/* ==========================================================================
   PAGE: LIVE MATCH CENTER
   ========================================================================== */
.probability-bar-wrapper {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  height: 10px;
  overflow: hidden;
  display: flex;
}
.probability-bar-fill {
  height: 100%;
  transition: width 0.5s ease;
}
.prob-home { background: var(--accent); }
.prob-draw { background: var(--text-muted); }
.prob-away { background: #0074F9; }

/* ==========================================================================
   ANIMATIONS & EFFECTS
   ========================================================================== */

/* Pulsing Red Indicator */
@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.pulse-badge {
  animation: pulse-border 2s infinite;
}
@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(255, 51, 75, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(255, 51, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 51, 75, 0); }
}

/* Strike-through for Wrong Predictions */
.strike-through-container {
  position: relative;
  display: inline-block;
}

.strike-through-line {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--danger);
  transform: translateY(-50%);
  animation: strike-out 0.8s ease forwards;
}

@keyframes strike-out {
  to { width: 100%; }
}

.revealed-actual {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  opacity: 0;
  animation: fade-in 0.4s ease 0.6s forwards;
  margin-top: 2px;
}

/* Correct Checkmark Draw */
.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  stroke: var(--accent);
  fill: none;
  animation: stroke-draw 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-kick {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke: var(--accent);
  stroke-width: 3;
  animation: stroke-draw 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes stroke-draw {
  100% { stroke-dashoffset: 0; }
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* Hero Section Gradient Background Flow */
@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ==========================================================================
   TOAST NOTIFICATION COMPONENT
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.toast {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  opacity: 0;
  transform: translateY(20px);
  animation: toast-in 0.3s ease forwards;
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   RESULT REVEAL SYSTEM ANIMATIONS & STATES
   ========================================================================== */

/* Strikethrough line overlay */
.strikethrough-animate {
  position: relative;
  display: inline-block;
}
.strikethrough-animate::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 2px;
  background-color: var(--danger);
  transform: translateY(-50%);
  animation: strike-out-reveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes strike-out-reveal {
  to { width: 100%; }
}

/* Actual Winner Fade In */
.actual-winner-fade-in {
  opacity: 0;
  transform: translateY(4px);
  animation: fade-in-up-reveal 0.5s ease forwards;
}

@keyframes fade-in-up-reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Correct Gold Glow */
.correct-gold-glow {
  animation: gold-glow-pulse 2s infinite alternate;
}

@keyframes gold-glow-pulse {
  0% {
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.1);
  }
  100% {
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 0 0 18px rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
  }
}

/* Bounce Badge Entry */
.bounce-badge {
  animation: badge-bounce-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes badge-bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  70% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Confetti Burst Container */
.confetti-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 99;
}

/* Confetti particles - 12 colors and angles */
.confetti-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--color);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: confetti-explode 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes confetti-explode {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.5);
  }
}

/* Card States */
.prediction-card-correct {
  border-color: var(--accent) !important;
  box-shadow: 0 0 15px rgba(0, 210, 106, 0.2) !important;
}

.prediction-card-wrong {
  background: rgba(255, 51, 75, 0.04) !important;
  border-color: rgba(255, 51, 75, 0.15) !important;
  opacity: 0.6;
}

/* Layout Reveal Correct & Wrong classes */
.card-reveal-correct {
  border-color: var(--accent) !important;
  box-shadow: 0 0 15px rgba(0, 210, 106, 0.2) !important;
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

.card-reveal-wrong {
  background: rgba(255, 51, 75, 0.04) !important;
  border-color: rgba(255, 51, 75, 0.15) !important;
  opacity: 0.6;
  transition: background-color 0.5s ease, border-color 0.5s ease, opacity 0.5s ease;
}

/* ==========================================================================
   GLOBAL MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-card {
  width: 90%;
  max-width: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  overflow: hidden;
  position: relative;
}

.modal-header {
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: var(--spacing-lg);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-close-btn {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-base);
}
.modal-close-btn:hover {
  color: var(--danger);
}

/* ==========================================================================
   CUSTOM SWITCH TOGGLES (EMAIL PREFERENCES)
   ========================================================================== */
.switch-container {
  display: flex;
  align-items: center;
}
.switch-input {
  display: none !important;
}
.switch-label {
  display: inline-block;
  width: 44px;
  height: 22px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
  border: 1px solid var(--border-color);
}
.switch-label::after {
  content: '';
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease, background 0.3s ease;
}
.switch-input:checked + .switch-label {
  background: rgba(0, 210, 106, 0.2);
  border-color: var(--accent);
}
.switch-input:checked + .switch-label::after {
  transform: translateX(22px);
  background: var(--accent);
}

/* ==========================================================================
   MOBILE POLISH & RESPONSIVE LAYOUTS
   ========================================================================== */

/* Base Container Adjustments for small screens */
@media (max-width: 576px) {
  .container {
    padding: 0 var(--spacing-md);
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.4rem;
  }
}

/* Tap Target Sizes (Min 44x44px for touch readability) */
@media (max-width: 768px) {
  .btn, 
  .nav-link, 
  .star-btn, 
  .btn-rank-up, 
  .btn-rank-down, 
  .reset-group-btn, 
  .toggle-matches-btn, 
  .toggle-standings-btn,
  .share-match-btn,
  .modal-close-btn,
  .switch-label {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .bracket-team-slot {
    min-height: 44px;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  
  .prediction-score-input, 
  .form-input {
    min-height: 44px;
    min-width: 44px;
  }

  .star-rating .star-btn {
    padding: 8px;
    font-size: 1.2rem;
  }
  
  .hamburger {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    align-items: center;
  }
}

/* Score Incrementer Layout & Buttons */
.score-incrementer-wrapper {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 2px;
}

.btn-score-adjust {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: var(--transition-base);
  font-size: 0.8rem;
}

.btn-score-adjust:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.btn-score-adjust:active {
  transform: scale(0.9);
}

.score-incrementer-wrapper.disabled-wrapper {
  background: transparent !important;
  border-color: transparent !important;
  padding: 0 !important;
}

.score-incrementer-wrapper.disabled-wrapper .btn-score-adjust {
  display: none !important;
}

.score-incrementer-wrapper .prediction-score-input {
  border: none !important;
  background: transparent !important;
  width: 36px !important;
  height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1rem !important;
  color: var(--text-primary) !important;
}

@media (max-width: 768px) {
  .btn-score-adjust {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
  .score-incrementer-wrapper .prediction-score-input {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.15rem !important;
  }
}

/* Stacking Match Cards Vertically on Mobile */
@media (max-width: 576px) {
  .match-teams {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
  .match-team {
    flex-direction: column !important;
    gap: 4px;
  }
  .match-team.away {
    flex-direction: column !important;
  }
  .match-score-section {
    justify-content: center;
    margin: var(--spacing-xs) 0;
  }
}

/* Sliding Bottom Sheets for Modals and Drawers on Mobile */
@media (max-width: 576px) {
  /* Sharing Modals */
  .modal-overlay {
    align-items: flex-end;
  }
  
  .modal-card {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    animation: slide-up-sheet 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  }
  
  /* Auth Drawer Override */
  body .auth-drawer {
    top: auto !important;
    bottom: -100% !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: 85vh !important;
    border-left: none !important;
    border-top: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  }
  
  body .auth-drawer.open {
    bottom: 0 !important;
    right: 0 !important;
  }
}

@keyframes slide-up-sheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Bracket Mobile Slide Transitions */
@keyframes slide-in-round {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.bracket-round.mobile-active {
  display: flex !important;
  animation: slide-in-round 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* PWA Install Banner Mobile Styling */
@media (max-width: 576px) {
  #pwa-install-banner {
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    flex-direction: column;
    align-items: stretch !important;
    text-align: center;
  }
  #pwa-install-banner .d-flex {
    flex-direction: column;
    align-items: center;
  }
  #pwa-install-banner .d-flex.gap-sm {
    flex-direction: row;
    justify-content: center;
    margin-top: var(--spacing-sm);
  }
}



/* ==========================================================================
   LIGHT THEME OVERRIDES
   ========================================================================== */
[data-theme="light"] {
  --bg-primary:     #F0F2FA;
  --bg-secondary:   #FFFFFF;
  --bg-card:        rgba(255, 255, 255, 0.85);
  --bg-card-hover:  rgba(255, 255, 255, 0.95);
  --text-primary:   #0A0E27;
  --text-secondary: #3A4060;
  --text-muted:     #6B7296;
  --border-color:   rgba(10, 14, 39, 0.10);
  --border-hover:   rgba(0, 210, 106, 0.5);
  --accent:         #008C46;
  --accent-hover:   #006B35;
  --accent-glow:    rgba(0, 140, 70, 0.18);
}

[data-theme="light"] body {
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 50% 0%, #DDE4F5 0%, var(--bg-primary) 70%);
}

[data-theme="light"] .header {
  background: rgba(240, 242, 250, 0.90);
  border-bottom-color: rgba(10, 14, 39, 0.08);
}

[data-theme="light"] .card {
  background: var(--bg-card);
  border-color: rgba(10, 14, 39, 0.08);
}

[data-theme="light"] .footer {
  background: #E4E8F5;
}

[data-theme="light"] ::-webkit-scrollbar-track  { background: #E4E8F5; }
[data-theme="light"] ::-webkit-scrollbar-thumb  { background: #B8BFD8; }

/* Smooth theme transition (applied AFTER initial paint to avoid FOUC) */
html.theme-ready,
html.theme-ready *,
html.theme-ready *::before,
html.theme-ready *::after {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease !important;
}

/* ==========================================================================
   DARK / LIGHT MODE TOGGLE BUTTON
   ========================================================================== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: var(--transition-base);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--border-hover);
  transform: rotate(20deg);
}

/* ==========================================================================
   PRINT STYLES — Bracket Print View
   ========================================================================== */
@media print {
  /* Hide non-essential UI */
  .header, .footer, .theme-toggle, .hamburger,
  .auth-drawer, .drawer-overlay, #toast-container,
  #pwa-install-banner, .btn:not(.print-show),
  .share-section, .predictor-panel, nav { display: none !important; }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  .card {
    border: 1px solid #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
    break-inside: avoid;
    margin-bottom: 12pt;
  }

  .bracket-round { break-inside: avoid; }

  /* Show only prediction content */
  .container { max-width: 100% !important; padding: 0 !important; }

  h1, h2, h3 { color: #000 !important; }

  /* Print header */
  main::before {
    content: 'WC2026 Predictor — My Bracket';
    display: block;
    font-size: 18pt;
    font-weight: 900;
    text-align: center;
    margin-bottom: 16pt;
    border-bottom: 2pt solid #000;
    padding-bottom: 8pt;
  }

  /* Show URLs for links */
  a[href]::after { content: ' (' attr(href) ')'; font-size: 8pt; color: #555; }
  a.btn::after   { content: none; }

  /* Color overrides for prediction result badges */
  .result-badge-correct { background: #d4edda !important; color: #155724 !important; }
  .result-badge-wrong   { background: #f8d7da !important; color: #721c24 !important; }
}

/* ==========================================================================
   REFINE STYLING: SECTION SPACING, LIGHT MODE CONTRAST & CAROUSEL
   ========================================================================== */

/* Spacing between sections */
section:not(.hero-fullwidth):not(.sticky-filter-bar):not(.stats-bar-wrapper) {
  margin-top: 5rem !important;
  margin-bottom: 5rem !important;
}

/* Ensure light text on elements with hardcoded dark backgrounds on light theme */
[data-theme="light"] div[style*="rgba(16, 22, 58"],
[data-theme="light"] div[style*="rgba(16,22,58"],
[data-theme="light"] div[style*="rgba(10, 14, 39"],
[data-theme="light"] div[style*="rgba(10,14,39"],
[data-theme="light"] #user-rank-widget,
[data-theme="light"] #pwa-install-banner,
[data-theme="light"] .group-card-header,
[data-theme="light"] .hero-fullwidth {
  color: #FFFFFF !important;
}
[data-theme="light"] div[style*="rgba(16, 22, 58"] *,
[data-theme="light"] div[style*="rgba(16,22,58"] *,
[data-theme="light"] div[style*="rgba(10, 14, 39"] *,
[data-theme="light"] div[style*="rgba(10,14,39"] *,
[data-theme="light"] #user-rank-widget *,
[data-theme="light"] #pwa-install-banner *,
[data-theme="light"] .group-card-header *,
[data-theme="light"] .hero-fullwidth * {
  color: #FFFFFF !important;
}
[data-theme="light"] div[style*="rgba(16, 22, 58"] .text-secondary,
[data-theme="light"] div[style*="rgba(16,22,58"] .text-secondary,
[data-theme="light"] div[style*="rgba(10, 14, 39"] .text-secondary,
[data-theme="light"] div[style*="rgba(10,14,39"] .text-secondary,
[data-theme="light"] #user-rank-widget .text-secondary,
[data-theme="light"] #pwa-install-banner .text-secondary,
[data-theme="light"] .group-card-header .text-secondary,
[data-theme="light"] .hero-fullwidth .text-secondary {
  color: #B0B7D6 !important;
}
[data-theme="light"] div[style*="rgba(16, 22, 58"] .text-muted,
[data-theme="light"] div[style*="rgba(16,22,58"] .text-muted,
[data-theme="light"] div[style*="rgba(10, 14, 39"] .text-muted,
[data-theme="light"] div[style*="rgba(10,14,39"] .text-muted,
[data-theme="light"] #user-rank-widget .text-muted,
[data-theme="light"] #pwa-install-banner .text-muted,
[data-theme="light"] .group-card-header .text-muted,
[data-theme="light"] .hero-fullwidth .text-muted {
  color: #8A91B5 !important;
}
/* Ensure confidence stars are gold */
.group-card-header .star-rating .star-btn.active {
  color: var(--highlight) !important;
}
.group-card-header .star-rating .star-btn {
  color: rgba(255,255,255,0.4) !important;
}

/* Today's Matches Carousel Styles */
.carousel-wrapper {
  position: relative;
  width: 100%;
  /* Add horizontal padding so absolutely-positioned arrows are not clipped */
  padding: 10px 30px;
  /* Overflow visible so buttons outside the track area are not cut off */
  overflow: visible;
}
.carousel-track-container {
  overflow: hidden;  /* Only the track scrolls */
  width: 100%;
  position: relative;
}
.carousel-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  gap: var(--spacing-lg);
  width: 100%;
}
.carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
}
@media (min-width: 768px) {
  .carousel-slide {
    flex: 0 0 calc(50% - 0.75rem); /* Half width minus half gap */
  }
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: rgba(16, 22, 58, 0.9);
  border: 1px solid var(--border-color);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: var(--transition-base);
}
.carousel-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
}
.carousel-btn.prev {
  left: -4px;
}
.carousel-btn.next {
  right: -4px;
}
@media (max-width: 800px) {
  .carousel-btn.prev { left: 0px; }
  .carousel-btn.next { right: 0px; }
}

/* Next button in "end" state → becomes a schedule shortcut */
.carousel-btn.next.at-end {
  background: rgba(0, 210, 106, 0.12);
  border-color: rgba(0, 210, 106, 0.4);
  color: var(--accent);
  width: auto;
  padding: 0 14px;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(0, 210, 106, 0.15);
}
.carousel-btn.next.at-end:hover {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 20px var(--accent-glow);
}
.carousel-btn-label {
  display: none;
}
.carousel-btn.next.at-end .carousel-btn-label {
  display: inline;
}
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: var(--spacing-md);
}
.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--border-color);
  cursor: pointer;
  transition: var(--transition-base);
}
.carousel-dot.active {
  background: var(--accent);
  width: 20px;
}

/* ==========================================================================
   UI COMPONENTS: MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-card {
  width: 90%;
  max-width: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  overflow: hidden;
  position: relative;
  animation: modal-zoom 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-zoom {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: var(--spacing-lg);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-close-btn {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-base);
}
.modal-close-btn:hover {
  color: var(--danger);
}

/* Standings mobile truncation */
.group-team-item span:nth-child(2) {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


