/* ==========================================================================
   Lô Tô Tết 2026 - Liquid Glass + Vietnamese Tết Theme
   ========================================================================== */

/* --------------------------------
   CSS Variables
   -------------------------------- */
:root {
  /* Tết Colors */
  --loto-red-50: #fef2f2;
  --loto-red-100: #fee2e2;
  --loto-red-200: #fecaca;
  --loto-red-300: #fca5a5;
  --loto-red-400: #f87171;
  --loto-red-500: #ef4444;
  --loto-red-600: #dc2626;
  --loto-red-700: #b91c1c;
  --loto-red-800: #991b1b;
  --loto-red-900: #7f1d1d;

  --loto-gold-50: #fffbeb;
  --loto-gold-100: #fef3c7;
  --loto-gold-200: #fde68a;
  --loto-gold-300: #fcd34d;
  --loto-gold-400: #fbbf24;
  --loto-gold-500: #f59e0b;
  --loto-gold-600: #d97706;
  --loto-gold-700: #b45309;
  --loto-gold-800: #92400e;
  --loto-gold-900: #78350f;

  --loto-cream: #fef3c7;
  --loto-teal: #14b8a6;

  /* Glass Effect */
  --loto-glass-bg: rgba(255, 255, 255, 0.08);
  --loto-glass-bg-hover: rgba(255, 255, 255, 0.12);
  --loto-glass-border: rgba(255, 255, 255, 0.15);
  --loto-glass-blur: 24px;
  --loto-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  /* Typography */
  --loto-font-display: 'Outfit', sans-serif;
  --loto-font-body: 'Inter', sans-serif;

  /* Spacing */
  --loto-radius-sm: 8px;
  --loto-radius-md: 16px;
  --loto-radius-lg: 24px;
  --loto-radius-xl: 32px;
  --loto-radius-full: 9999px;
}

/* --------------------------------
   Base Layout
   -------------------------------- */
.loto-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #991b1b 0%, #450a0a 50%, #1a0505 100%);
  background-attachment: fixed;
  font-family: var(--loto-font-body);
  color: white;
  position: relative;
  overflow-x: hidden;
}

.loto-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(251, 191, 36, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(239, 68, 68, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(20, 184, 166, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Decorative Tet images */
.loto-page::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.1;
}

.loto-decoration {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

.loto-decoration--mai-left {
  bottom: 0;
  left: 0;
  width: 200px;
  height: auto;
  transform: scaleX(-1);
}

.loto-decoration--mai-right {
  bottom: 0;
  right: 0;
  width: 200px;
  height: auto;
}

.loto-decoration--horse {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: auto;
  opacity: 0.3;
}

.loto-decoration--than-tai {
  top: 100px;
  right: 20px;
  width: 150px;
  height: auto;
  opacity: 0.4;
  animation: lotoThanTaiFloat 4s ease-in-out infinite;
}

@keyframes lotoThanTaiFloat {

  0%,
  100% {
    transform: translateY(0) rotate(-5deg);
  }

  50% {
    transform: translateY(-15px) rotate(5deg);
  }
}

/* Tet Title decoration */
.loto-tet-title {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--loto-font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--loto-gold-400);
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
  z-index: 1;
  opacity: 0.6;
  pointer-events: none;
  white-space: nowrap;
}

.loto-decoration--horse {
  width: 80px;
}


/* --------------------------------
   New Game Layout (Optimized for Dò & Quay)
   -------------------------------- */
.loto-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.loto-game-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.loto-tickets-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 1024px) {
  .loto-game-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    /* Sidebar fixed, Tickets fluid */
    gap: 2rem;
    align-items: start;
    /* Both columns share the page scroll. */
    min-height: calc(100dvh - 4rem);
  }

  .loto-game-sidebar {
    position: relative;
    /* Keep controls in the same document flow as tickets. */
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: auto;
    padding-right: 0.5rem;
  }

  .loto-tickets-container {
    height: auto;
    padding-right: 0.5rem;
    padding-bottom: 2rem;
    /* Bottom padding for scroll content */
  }

  /* Scrollbar styling for sidebar & main */
  .loto-game-sidebar::-webkit-scrollbar,
  .loto-tickets-container::-webkit-scrollbar {
    width: 6px;
  }

  .loto-game-sidebar::-webkit-scrollbar-track,
  .loto-tickets-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
  }

  .loto-game-sidebar::-webkit-scrollbar-thumb,
  .loto-tickets-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
  }

  .loto-tickets-grid {
    display: grid;
    /* Try to put tickets side-by-side if they fit, else 1 col */
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* --------------------------------
   Liquid Glass Components
   -------------------------------- */
.loto-glass {
  background: var(--loto-glass-bg);
  backdrop-filter: blur(var(--loto-glass-blur));
  -webkit-backdrop-filter: blur(var(--loto-glass-blur));
  border: 1px solid var(--loto-glass-border);
  box-shadow: var(--loto-glass-shadow);
  border-radius: var(--loto-radius-lg);
}

.loto-glass-sm {
  border-radius: var(--loto-radius-sm);
}

.loto-glass-md {
  border-radius: var(--loto-radius-md);
}

.loto-glass-hover {
  transition: all 0.3s ease;
}

.loto-glass-hover:hover {
  background: var(--loto-glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* --------------------------------
   Number Ball (Liquid Glass Style)
   -------------------------------- */
.loto-number-ball {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--loto-font-display);
  font-size: 1.25rem;
  font-weight: 700;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.loto-number-ball::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.1) 40%,
      transparent 60%);
  pointer-events: none;
}

/* Number ball color variants based on column */
.loto-number-ball--col-0 {
  background: linear-gradient(145deg, #f87171, #dc2626);
}

.loto-number-ball--col-1 {
  background: linear-gradient(145deg, #fb923c, #ea580c);
}

.loto-number-ball--col-2 {
  background: linear-gradient(145deg, #fbbf24, #d97706);
}

.loto-number-ball--col-3 {
  background: linear-gradient(145deg, #a3e635, #65a30d);
}

.loto-number-ball--col-4 {
  background: linear-gradient(145deg, #34d399, #059669);
}

.loto-number-ball--col-5 {
  background: linear-gradient(145deg, #22d3ee, #0891b2);
}

.loto-number-ball--col-6 {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
}

.loto-number-ball--col-7 {
  background: linear-gradient(145deg, #a78bfa, #7c3aed);
}

.loto-number-ball--col-8 {
  background: linear-gradient(145deg, #f472b6, #db2777);
}

.loto-number-ball--marked {
  transform: scale(1.1);
  box-shadow:
    0 0 0 4px rgba(251, 191, 36, 0.5),
    0 0 20px rgba(251, 191, 36, 0.4);
}

.loto-number-ball--marked::after {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--loto-gold-500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.loto-number-ball--empty {
  background: var(--loto-glass-bg);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  cursor: default;
}

/* Big drawn number display */
.loto-drawn-number {
  width: min(240px, 50vw);
  height: min(240px, 50vw);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--loto-font-display);
  font-size: min(100px, 20vw);
  font-weight: 800;
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  position: relative;
  box-shadow:
    0 0 0 8px rgba(251, 191, 36, 0.3),
    0 0 60px rgba(251, 191, 36, 0.4),
    inset 0 -10px 30px rgba(0, 0, 0, 0.2);
  user-select: none;
}

.loto-drawn-number::before {
  content: '';
  position: absolute;
  top: 8%;
  left: 20%;
  width: 30%;
  height: 20%;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.6) 0%,
      transparent 100%);
  border-radius: 50%;
  filter: blur(8px);
  pointer-events: none;
}

/* Glow effect behind the ball */
.loto-drawn-number__glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.4) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Placeholder state */
.loto-drawn-number--placeholder {
  font-size: min(80px, 18vw);
  background: var(--loto-glass-bg);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.1),
    0 0 30px rgba(255, 255, 255, 0.1),
    inset 0 -10px 30px rgba(0, 0, 0, 0.2);
}

/* Drawing animation state */
.loto-drawn-number--drawing {
  box-shadow:
    0 0 0 12px rgba(251, 191, 36, 0.5),
    0 0 80px rgba(251, 191, 36, 0.6),
    inset 0 -10px 30px rgba(0, 0, 0, 0.2);
}

@keyframes lotoNumberPulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 8px rgba(251, 191, 36, 0.3),
      0 0 60px rgba(251, 191, 36, 0.4),
      inset 0 -10px 30px rgba(0, 0, 0, 0.2);
  }

  50% {
    transform: scale(1.02);
    box-shadow:
      0 0 0 12px rgba(251, 191, 36, 0.4),
      0 0 80px rgba(251, 191, 36, 0.5),
      inset 0 -10px 30px rgba(0, 0, 0, 0.2);
  }
}

/* --------------------------------
   Generic Card (Standardized)
   -------------------------------- */
.loto-card {
  padding: 1.5rem;
  background: var(--loto-glass-bg);
  backdrop-filter: blur(var(--loto-glass-blur));
  border: 1px solid var(--loto-glass-border);
  border-radius: var(--loto-radius-xl);
  box-shadow: var(--loto-glass-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  /* Ensure cards sit above background elements */
  /* output overflow: hidden; REMOVED TO FIX CLIP */
}

.loto-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--loto-glass-border);
}

.loto-card__title {
  font-family: var(--loto-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --------------------------------
   Ticket Grid
   -------------------------------- */
.loto-ticket {
  padding: 1.5rem;
  background: var(--loto-glass-bg);
  backdrop-filter: blur(var(--loto-glass-blur));
  border: 1px solid var(--loto-glass-border);
  border-radius: var(--loto-radius-xl);
}

.loto-ticket__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--loto-glass-border);
}

.loto-ticket__title {
  font-family: var(--loto-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.loto-ticket__title::before {
  content: '🎟️';
  font-size: 1.5rem;
}

.loto-ticket__grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Row container */
.loto-ticket__row {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.25rem;
}

.loto-ticket__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--loto-radius-md);
  font-family: var(--loto-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  min-width: 40px;
  min-height: 40px;
}

.loto-ticket__cell--number {
  background: var(--loto-glass-bg);
  border: 1px solid var(--loto-glass-border);
}

.loto-ticket__cell--number:hover:not(.loto-ticket__cell--marked) {
  background: var(--loto-glass-bg-hover);
  transform: scale(1.05);
}

.loto-ticket__cell--empty {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: default;
  opacity: 0.5;
}

/* Default marked style (fallback - used by framer motion) */
.loto-ticket__cell--marked {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.4);
  border-color: var(--loto-gold-500);
}

/* Shine effect on selected cells */
.loto-ticket__cell--marked::before,
.loto-ticket__cell--matched::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: calc(var(--loto-radius-md) - 2px);
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.35) 0%,
      transparent 50%);
  pointer-events: none;
}

/* --------------------------------
   Buttons
   -------------------------------- */
.loto-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-family: var(--loto-font-display);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--loto-radius-full);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.loto-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.2) 0%,
      transparent 50%);
  pointer-events: none;
}

.loto-btn--primary {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
}

.loto-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(251, 191, 36, 0.5);
}

.loto-btn--secondary {
  background: var(--loto-glass-bg);
  backdrop-filter: blur(var(--loto-glass-blur));
  border: 1px solid var(--loto-glass-border);
  color: white;
}

.loto-btn--secondary:hover {
  background: var(--loto-glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.3);
}

.loto-btn--danger {
  background: linear-gradient(145deg, var(--loto-red-500), var(--loto-red-700));
  color: white;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.loto-btn--lg {
  padding: 1.125rem 2rem;
  font-size: 1.125rem;
}

.loto-btn--sm {
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
}

.loto-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --------------------------------
   Input Fields
   -------------------------------- */
.loto-input {
  width: 100%;
  padding: 0.875rem 1.25rem;
  font-family: var(--loto-font-body);
  font-size: 1rem;
  background: var(--loto-glass-bg);
  backdrop-filter: blur(var(--loto-glass-blur));
  border: 1px solid var(--loto-glass-border);
  border-radius: var(--loto-radius-md);
  color: white;
  outline: none;
  transition: all 0.3s ease;
}

.loto-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.loto-input:focus {
  border-color: var(--loto-gold-500);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.loto-input:focus::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.loto-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
}

/* --------------------------------
   Players List
   -------------------------------- */
.loto-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.loto-player {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  background: var(--loto-glass-bg);
  border: 1px solid var(--loto-glass-border);
  border-radius: var(--loto-radius-full);
}

.loto-player__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--loto-red-900);
  font-size: 0.875rem;
}

.loto-player__name {
  font-weight: 500;
}

.loto-player--host .loto-player__name::after {
  content: ' 👑';
}

/* --------------------------------
   Drawn Numbers History
   -------------------------------- */
.loto-history {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem;
}

.loto-history__number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--loto-font-display);
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--loto-glass-bg);
  border: 1px solid var(--loto-glass-border);
}

.loto-history__number--recent {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  animation: lotoRecentNumber 0.5s ease;
}

@keyframes lotoRecentNumber {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* --------------------------------
   Win Celebration
   -------------------------------- */
.loto-win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: lotoFadeIn 0.3s ease;
}

@keyframes lotoFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.loto-win-modal {
  background: linear-gradient(135deg, var(--loto-red-800), var(--loto-red-900));
  border: 2px solid var(--loto-gold-500);
  border-radius: var(--loto-radius-xl);
  padding: 2.5rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow:
    0 0 60px rgba(251, 191, 36, 0.3),
    inset 0 0 60px rgba(251, 191, 36, 0.1);
  animation: lotoWinModalIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lotoWinModalIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.loto-win-modal__icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: lotoWinBounce 1s ease infinite;
}

@keyframes lotoWinBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.loto-win-modal__title {
  font-family: var(--loto-font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--loto-gold-400);
  margin-bottom: 0.5rem;
}

.loto-win-modal__subtitle {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1.5rem;
}

.loto-win-modal__name {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

/* --------------------------------
   Theme Selector
   -------------------------------- */
.loto-themes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.loto-theme-card {
  padding: 1.25rem;
  border-radius: var(--loto-radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.loto-theme-card:hover {
  transform: translateY(-4px);
}

.loto-theme-card--active {
  border-color: var(--loto-gold-500);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.loto-theme-card__icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.loto-theme-card__name {
  font-family: var(--loto-font-display);
  font-weight: 600;
}

/* --------------------------------
   QR Code
   -------------------------------- */
.loto-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
}

.loto-qr__code {
  background: white;
  padding: 1rem;
  border-radius: var(--loto-radius-md);
}

.loto-qr__label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
}

.loto-qr__url {
  font-family: monospace;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  background: var(--loto-glass-bg);
  border-radius: var(--loto-radius-sm);
  word-break: break-all;
}

/* --------------------------------
   Responsive
   -------------------------------- */
@media (max-width: 768px) {
  .loto-container {
    padding: 0.75rem;
  }

  .loto-ticket {
    padding: 1rem;
  }

  .loto-ticket__grid {
    gap: 0.25rem;
  }

  .loto-ticket__row {
    gap: 0.25rem;
  }

  .loto-ticket__cell {
    font-size: 1.75rem;
    min-width: 48px;
    min-height: 48px;
    border-radius: var(--loto-radius-sm);
  }

  .loto-drawn-number {
    width: min(200px, 50vw);
    height: min(200px, 50vw);
    font-size: min(80px, 20vw);
  }

  .loto-number-ball {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .loto-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }
}

/* --------------------------------
   Utilities
   -------------------------------- */
.loto-text-gradient {
  background: linear-gradient(135deg, var(--loto-gold-400), var(--loto-gold-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

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

.loto-gap-xs {
  gap: 0.25rem;
}

.loto-gap-sm {
  gap: 0.5rem;
}

.loto-gap-md {
  gap: 1rem;
}

.loto-gap-lg {
  gap: 1.5rem;
}

.loto-gap-xl {
  gap: 2rem;
}

.loto-mb-xs {
  margin-bottom: 0.25rem;
}

.loto-mb-sm {
  margin-bottom: 0.5rem;
}

.loto-mb-md {
  margin-bottom: 1rem;
}

.loto-mb-lg {
  margin-bottom: 1.5rem;
}

.loto-mb-xl {
  margin-bottom: 2rem;
}

/* --------------------------------
   Game Style Card (No borders, soft gradients)
   -------------------------------- */
.loto-game-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--loto-radius-xl);
  padding: 1.25rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Tab Switcher - Game Style */
.loto-tab-switcher {
  display: flex;
  gap: 0.5rem;
  padding: 0.375rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--loto-radius-lg);
  margin-bottom: 1rem;
}

.loto-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: var(--loto-font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--loto-radius-md);
  cursor: pointer;
  transition: all 0.25s ease;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
}

.loto-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}

.loto-tab--active {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

/* Form Styles - Compact Game Style */
.loto-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.loto-form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.loto-form-row--settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
}

.loto-form-field {
  flex: 1;
  min-width: 120px;
}

.loto-form-field--grow {
  flex: 1.5;
}

.loto-form-field--compact {
  flex: 1;
  min-width: auto;
}

.loto-form-section {
  margin-bottom: 0.25rem;
}

.loto-form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: rgba(255, 255, 255, 0.7);
}

.loto-form-label-sm {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: rgba(255, 255, 255, 0.5);
}

.loto-form-input {
  width: 100%;
  height: 44px;
  padding: 0 0.875rem;
  font-family: var(--loto-font-body);
  font-size: 0.9375rem;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: var(--loto-radius-md);
  color: white;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loto-form-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.loto-form-input:focus {
  background: rgba(0, 0, 0, 0.4);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 2px rgba(251, 191, 36, 0.3);
}

.loto-form-input--code {
  text-transform: uppercase;
  font-family: monospace;
  font-size: 1.25rem;
  text-align: center;
  letter-spacing: 0.3em;
  padding: 0 0.5rem;
}

.loto-form-select {
  width: 100%;
  height: 44px;
  padding: 0 0.75rem;
  font-family: var(--loto-font-display);
  font-size: 0.875rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: var(--loto-radius-sm);
  color: white;
  cursor: pointer;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loto-form-select:focus {
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 2px rgba(251, 191, 36, 0.3);
}

/* Theme Buttons - Compact */
.loto-themes-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.loto-theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--loto-radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  min-width: 80px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.loto-theme-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.loto-theme-btn--active {
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.4),
    0 0 0 3px rgba(251, 191, 36, 0.6),
    0 0 20px rgba(251, 191, 36, 0.3);
  transform: translateY(-2px);
}

.loto-theme-btn__icon {
  font-size: 1.5rem;
}

.loto-theme-btn__name {
  font-size: 0.6875rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Mode Buttons - Compact Horizontal */
.loto-modes-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.loto-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  border-radius: var(--loto-radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.loto-mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.loto-mode-btn--active {
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.25), rgba(251, 191, 36, 0.1));
  box-shadow:
    inset 0 1px 0 rgba(251, 191, 36, 0.3),
    0 0 15px rgba(251, 191, 36, 0.15);
}

.loto-mode-btn__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.loto-mode-btn__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.loto-mode-btn__name {
  font-size: 0.8125rem;
  font-weight: 600;
}

.loto-mode-btn__desc {
  font-size: 0.6875rem;
  opacity: 0.6;
}

/* Game Style Buttons */
.loto-btn-game {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 44px;
  padding: 0 1.25rem;
  font-family: var(--loto-font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--loto-radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.loto-btn-game--primary {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.loto-btn-game--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
}

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

.loto-btn-game--join {
  align-self: flex-end;
  margin-bottom: 0.125rem;
}

/* Responsive adjustments for compact form */
@media (max-width: 600px) {
  .loto-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .loto-form-row--settings {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .loto-form-field--compact {
    flex: 1;
    min-width: 60px;
  }

  .loto-btn-game {
    width: 100%;
    margin-top: 0.5rem;
  }

  .loto-btn-game--join {
    margin-top: 0;
  }

  .loto-themes-compact {
    justify-content: center;
  }

  .loto-theme-btn {
    flex: 1;
    min-width: 70px;
  }
}


/* --------------------------------
   Ticket Cell States (Manual Select)
   -------------------------------- */
.loto-ticket__cell--clickable {
  cursor: pointer;
}

.loto-ticket__cell--clickable:hover {
  background: var(--loto-glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* Pending = User selected but not yet drawn */
.loto-ticket__cell--pending {
  background: rgba(251, 191, 36, 0.15);
  border: 2px dashed var(--loto-gold-400);
  color: var(--loto-gold-400);
}

/* Matched = User selected AND number was drawn */
.loto-ticket__cell--matched {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600)) !important;
  color: var(--loto-red-900) !important;
  border: 2px solid var(--loto-gold-500) !important;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.5);
  animation: lotoMatchPulse 0.5s ease;
}

@keyframes lotoMatchPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

.loto-ticket__cell-check {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--loto-teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Ticket Legend */
.loto-ticket__legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--loto-glass-border);
  font-size: 0.75rem;
  opacity: 0.7;
}

.loto-ticket__legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.loto-ticket__legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.loto-ticket__legend-dot--pending {
  background: rgba(251, 191, 36, 0.15);
  border: 2px dashed var(--loto-gold-400);
}

.loto-ticket__legend-dot--matched {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
}

/* --------------------------------
   Drawn Numbers Grid
   -------------------------------- */
.loto-drawn-numbers-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.loto-drawn-number-chip {
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--loto-radius-sm);
  font-family: var(--loto-font-display);
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--loto-glass-bg);
  border: 1px solid var(--loto-glass-border);
  transition: all 0.2s ease;
}

.loto-drawn-number-chip--on-ticket {
  background: rgba(251, 191, 36, 0.15);
  border: 2px solid var(--loto-gold-400);
  color: var(--loto-gold-400);
}

.loto-drawn-number-chip--marked {
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  border-color: var(--loto-gold-500);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

/* --------------------------------
   Bingo/Kinh Celebration Modal
   -------------------------------- */
.loto-bingo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: lotoFadeIn 0.3s ease;
  padding: 1rem;
  overflow-y: auto;
}

.loto-bingo-modal {
  background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 50%, #991b1b 100%);
  border: 3px solid var(--loto-gold-500);
  border-radius: var(--loto-radius-xl);
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  width: 100%;
  position: relative;
  box-shadow:
    0 0 100px rgba(251, 191, 36, 0.4),
    0 0 200px rgba(251, 191, 36, 0.2),
    inset 0 0 60px rgba(251, 191, 36, 0.1);
  animation: lotoBingoModalIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lotoBingoModalIn {
  from {
    opacity: 0;
    transform: scale(0.5) rotateY(180deg);
  }

  to {
    opacity: 1;
    transform: scale(1) rotateY(0);
  }
}

.loto-bingo-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.loto-bingo-confetti-item {
  position: absolute;
  top: 0;
  font-size: 2rem;
  animation: lotoBingoConfetti 2.5s ease-in-out infinite;
}

@keyframes lotoBingoConfetti {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  100% {
    transform: translateY(400px) rotate(720deg);
    opacity: 0;
  }
}

.loto-bingo-icon {
  font-size: 5rem;
  margin-bottom: 0.5rem;
  animation: lotoBingoShake 0.5s ease-in-out infinite;
}

@keyframes lotoBingoShake {

  0%,
  100% {
    transform: rotate(-5deg) scale(1);
  }

  50% {
    transform: rotate(5deg) scale(1.1);
  }
}

.loto-bingo-title {
  font-family: var(--loto-font-display);
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--loto-gold-300), var(--loto-gold-500), var(--loto-gold-300));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: lotoGoldShine 2s linear infinite;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.5);
}

@keyframes lotoGoldShine {
  0% {
    background-position: 0% center;
  }

  100% {
    background-position: 200% center;
  }
}

.loto-bingo-subtitle {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
}

.loto-bingo-winner {
  font-family: var(--loto-font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--loto-gold-400);
  margin-bottom: 1.5rem;
}

.loto-bingo-ticket {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--loto-radius-lg);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.loto-bingo-numbers {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--loto-radius-md);
  padding: 1rem;
}

.loto-bingo-numbers h4 {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
}

.loto-bingo-numbers-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.loto-bingo-number {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--loto-gold-400), var(--loto-gold-600));
  color: var(--loto-red-900);
  border-radius: 50%;
  font-family: var(--loto-font-display);
  font-weight: 700;
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .loto-bingo-modal {
    padding: 1.5rem;
  }

  .loto-bingo-title {
    font-size: 2.5rem;
  }

  .loto-bingo-icon {
    font-size: 4rem;
  }

  .loto-bingo-winner {
    font-size: 1.5rem;
  }
}

/* --------------------------------
   Prize Modal (Lì Xì)
   -------------------------------- */
.loto-prize-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 1rem;
  overflow: hidden;
}

.loto-prize-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.loto-prize-confetti-item {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
}

.loto-prize-modal {
  background: linear-gradient(145deg, #450a0a 0%, #7f1d1d 50%, #991b1b 100%);
  border: 3px solid var(--loto-gold-500);
  border-radius: var(--loto-radius-xl);
  padding: 2rem;
  max-width: 450px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 100px rgba(251, 191, 36, 0.4),
    0 0 200px rgba(251, 191, 36, 0.2),
    inset 0 0 60px rgba(251, 191, 36, 0.1);
}

.loto-prize-winner-badge {
  font-family: var(--loto-font-display);
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--loto-gold-300), var(--loto-gold-500), var(--loto-gold-300));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: lotoGoldShine 2s linear infinite;
  margin-bottom: 0.5rem;
}

.loto-prize-winner-name {
  font-family: var(--loto-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1.5rem;
}

.loto-prize-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Lì Xì Envelope */
.loto-li-xi {
  width: 200px;
  height: 280px;
  margin: 0 auto;
  perspective: 1000px;
}

.loto-li-xi-closed {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.loto-li-xi-front {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 40%, #991b1b 100%);
  border-radius: var(--loto-radius-lg);
  border: 3px solid var(--loto-gold-500);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 -20px 40px rgba(0, 0, 0, 0.2),
    inset 0 20px 40px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.loto-li-xi-front::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: var(--loto-gold-500);
  border-radius: 50%;
  opacity: 0.3;
}

.loto-li-xi-decoration {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.loto-li-xi-text {
  font-family: var(--loto-font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--loto-gold-400);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.loto-li-xi-subtext {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.5rem;
  animation: lotoPulse 1.5s ease-in-out infinite;
}

@keyframes lotoPulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

.loto-li-xi-opened {
  width: 100%;
  transform-style: preserve-3d;
}

.loto-li-xi-content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: var(--loto-radius-lg);
  padding: 1.5rem;
  border: 2px solid var(--loto-gold-500);
}

.loto-li-xi-prize-title {
  font-family: var(--loto-font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--loto-gold-400);
  margin-bottom: 1rem;
}

/* Momo QR Section */
.loto-momo-section {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--loto-radius-md);
  padding: 1rem;
  text-align: center;
}

.loto-momo-number {
  font-family: monospace;
  font-size: 1.125rem;
  color: var(--loto-gold-400);
  margin-top: 0.75rem;
  letter-spacing: 0.1em;
}

/* QR Code Wrapper */
.loto-qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.loto-qr-wrapper--momo .loto-qr-code {
  border: 3px solid #a50064;
  border-radius: 12px;
  padding: 4px;
  background: white;
}

.loto-qr-label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
}

.loto-momo-badge {
  background: linear-gradient(135deg, #a50064, #d4266b);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--loto-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --------------------------------
   Join Room QR Section
   -------------------------------- */
.loto-join-qr {
  background: var(--loto-glass-bg);
  border: 1px solid var(--loto-glass-border);
  border-radius: var(--loto-radius-lg);
  padding: 1.5rem;
  text-align: center;
}

.loto-join-qr__title {
  font-family: var(--loto-font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.loto-join-qr__url {
  font-family: monospace;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: var(--loto-radius-sm);
  word-break: break-all;
  margin-top: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

/* --------------------------------
   Lose Modal (Kinh bị thúi)
   -------------------------------- */
.loto-lose-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.loto-lose-modal {
  background: linear-gradient(145deg, #1f1f1f, #2d2d2d);
  border: 2px solid #666;
  border-radius: var(--loto-radius-xl);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
  animation: lotoLoseShake 0.5s ease-in-out;
}

@keyframes lotoLoseShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

.loto-lose-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.loto-lose-title {
  font-family: var(--loto-font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: #999;
  margin-bottom: 0.5rem;
}

.loto-lose-subtitle {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1.5rem;
}

/* --------------------------------
   Sound Button
   -------------------------------- */
.loto-sound-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--loto-glass-bg);
  border: 1px solid var(--loto-glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 50;
  transition: all 0.3s ease;
}

.loto-sound-btn:hover {
  background: var(--loto-glass-bg-hover);
  transform: scale(1.1);
}

.loto-sound-btn--muted {
  opacity: 0.5;
}

/* --------------------------------
   Falling Flower Animation (Hoa Mai Rơi) - Like gaucongnghe.com
   -------------------------------- */
.loto-flower {
  position: fixed;
  top: -10%;
  user-select: none;
  cursor: default;
  pointer-events: none;
  z-index: 999;
  animation-name: lotoFlowerFall, lotoFlowerShake, lotoFlowerSpin;
  animation-timing-function: linear, ease-in-out, linear;
  animation-iteration-count: infinite, infinite, infinite;
  animation-play-state: running, running, running;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.loto-flower svg {
  width: 100%;
  height: 100%;
}

@keyframes lotoFlowerFall {
  0% {
    top: -10%;
    opacity: 1;
  }

  85% {
    opacity: 1;
  }

  100% {
    top: 105%;
    opacity: 0;
  }
}

@keyframes lotoFlowerShake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(50px);
  }

  50% {
    transform: translateX(100px);
  }

  75% {
    transform: translateX(50px);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes lotoFlowerSpin {
  0% {
    rotate: 0deg;
  }

  100% {
    rotate: 360deg;
  }
}

/* --------------------------------
   Sparkles (Lấp lánh)
   -------------------------------- */
.loto-sparkle {
  position: fixed;
  top: -5%;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 998;
  animation: lotoSparkleFall 8s linear infinite, lotoSparkleGlow 1s ease-in-out infinite alternate;
}

@keyframes lotoSparkleFall {
  0% {
    top: -5%;
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    top: 105%;
    opacity: 0;
  }
}

@keyframes lotoSparkleGlow {
  0% {
    transform: scale(0.5);
    box-shadow: 0 0 4px 2px rgba(255, 255, 255, 0.8);
  }

  100% {
    transform: scale(1.5);
    box-shadow: 0 0 8px 4px rgba(255, 255, 255, 0.4);
  }
}

/* --------------------------------
   Red Envelopes (Bao Lì Xì)
   -------------------------------- */
.loto-envelope {
  position: fixed;
  top: -15%;
  user-select: none;
  cursor: default;
  pointer-events: none;
  z-index: 997;
  animation-name: lotoEnvelopeFall, lotoEnvelopeSwing, lotoEnvelopePulse;
  animation-timing-function: linear, ease-in-out, ease-in-out;
  animation-iteration-count: infinite, infinite, infinite;
  animation-play-state: running, running, running;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.loto-envelope svg {
  width: 100%;
  height: 100%;
}

@keyframes lotoEnvelopeFall {
  0% {
    top: -15%;
    opacity: 0;
  }

  5% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    top: 105%;
    opacity: 0;
  }
}

@keyframes lotoEnvelopeSwing {
  0% {
    transform: translateX(0) rotate(-8deg);
  }

  25% {
    transform: translateX(40px) rotate(8deg);
  }

  50% {
    transform: translateX(80px) rotate(-8deg);
  }

  75% {
    transform: translateX(40px) rotate(8deg);
  }

  100% {
    transform: translateX(0) rotate(-8deg);
  }
}

@keyframes lotoEnvelopePulse {

  0%,
  100% {
    scale: 1;
  }

  50% {
    scale: 1.08;
  }
}

/* --------------------------------
   GIF Decorations (New Year Theme)
   -------------------------------- */
.loto-gif-decoration {
  position: fixed;
  pointer-events: none;
  z-index: 10;
}

.loto-gif-decoration--left {
  top: 60px;
  left: 0;
  width: clamp(100px, 15vw, 200px);
  animation: lotoGifFloat 3s ease-in-out infinite;
}

.loto-gif-decoration--right {
  top: 40px;
  right: 0;
  width: clamp(120px, 18vw, 250px);
  animation: lotoGifFloat 3.5s ease-in-out infinite;
  animation-delay: 0.5s;
}

@keyframes lotoGifFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Hide decorations on very small screens */
@media (max-width: 480px) {

  .loto-gif-decoration--left,
  .loto-gif-decoration--right {
    display: none;
  }

  .loto-flower {
    animation-duration: 6s, 2s, 3s;
  }

  .loto-envelope {
    animation-duration: 8s, 3s, 5s;
  }
}


/* KINH BUTTON STYLE */
.loto-btn-kinh {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 280px;
  padding: 0.75rem 1.5rem;
  border-radius: var(--loto-radius-lg);
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #fbbf24, #d97706);
  color: #7f1d1d;
  box-shadow:
    0 3px 0 #b45309,
    0 6px 16px rgba(0, 0, 0, 0.25),
    0 0 0 3px rgba(251, 191, 36, 0.3);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.loto-btn-kinh:disabled {
  filter: grayscale(1);
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

.loto-btn-kinh:hover:not(:disabled) {
  transform: translateY(-4px);
  background: linear-gradient(145deg, #fcd34d, #f59e0b);
  box-shadow:
    0 6px 0 #b45309,
    0 12px 30px rgba(0, 0, 0, 0.4),
    0 0 0 6px rgba(251, 191, 36, 0.4);
}

.loto-btn-kinh:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    0 0 0 #b45309,
    0 4px 10px rgba(0, 0, 0, 0.2),
    0 0 0 4px rgba(251, 191, 36, 0.3);
}

.loto-btn-kinh::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
      transparent 0%,
      rgba(255, 255, 255, 0.4) 50%,
      transparent 100%);
  transform: rotate(45deg) translateY(-100%);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    transform: rotate(45deg) translateY(-100%);
  }

  20% {
    transform: rotate(45deg) translateY(100%);
  }

  100% {
    transform: rotate(45deg) translateY(100%);
  }
}


/* Sparkle Animation for Drawing */
.loto-sparkles {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, transparent 60%, rgba(255, 230, 0, 0.5) 100%);
  animation: lotoSpin 1s linear infinite;
  opacity: 0.5;
}

@keyframes lotoSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ================================
   MOBILE RESPONSIVE FIXES
   ================================ */
@media (max-width: 480px) {

  /* Reduce container padding on mobile */
  .loto-container {
    padding: 0.5rem;
  }

  /* Reduce header padding and gaps */
  .loto-glass {
    padding: 0.75rem !important;
  }

  /* Smaller title on mobile */
  .loto-tet-title {
    font-size: 0.7rem;
    top: 5px;
  }

  /* Reduce game layout gaps */
  .loto-game-layout {
    gap: 0.5rem;
  }

  /* Smaller drawn number display */
  .loto-drawn-number {
    width: min(140px, 40vw);
    height: min(140px, 40vw);
    font-size: min(50px, 14vw);
  }

  /* Smaller history balls */
  .loto-number-ball {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  /* Compact ticket cells */
  .loto-ticket__cell {
    font-size: 1.25rem;
    min-width: 36px;
    min-height: 36px;
    padding: 0.25rem;
  }

  /* Smaller buttons */
  .loto-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }

  .loto-btn--sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }

  /* Tighter modal padding */
  .loto-modal {
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
  }

  .loto-modal-body {
    padding: 0.75rem;
  }

  .loto-modal-header,
  .loto-modal-footer {
    padding: 0.75rem;
  }

  /* Compact header text */
  .loto-page h1 {
    font-size: 1rem !important;
  }

  /* Reduce margin top */
  .loto-glass[style*="marginTop"] {
    margin-top: 1rem !important;
  }

  /* Compact ticket spacing */
  .loto-tickets-grid {
    gap: 0.5rem;
  }

  .loto-ticket {
    padding: 0.75rem;
  }

  .loto-ticket__grid {
    gap: 0.2rem;
  }

  .loto-ticket__row {
    gap: 0.2rem;
  }

  /* Smaller Kinh button on mobile */
  .loto-btn-kinh {
    padding: 1rem;
    max-width: 280px;
  }

  .loto-btn-kinh__icon {
    font-size: 2.5rem;
  }

  .loto-btn-kinh__text {
    font-size: 1rem;
  }
}

/* Extra small devices (< 360px) */
@media (max-width: 360px) {
  .loto-container {
    padding: 0.25rem;
  }

  .loto-ticket__cell {
    font-size: 1rem;
    min-width: 28px;
    min-height: 28px;
  }

  .loto-drawn-number {
    width: 100px;
    height: 100px;
    font-size: 40px;
  }

  .loto-number-ball {
    width: 26px;
    height: 26px;
    font-size: 0.625rem;
  }

  .loto-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* --------------------------------
   MISSING MODAL STYLES (ADDED)
   -------------------------------- */
.loto-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.loto-modal {
  background: var(--loto-glass-bg);
  backdrop-filter: blur(var(--loto-glass-blur));
  border: 1px solid var(--loto-glass-border);
  border-radius: var(--loto-radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.loto-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--loto-glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.loto-modal-header h2 {
  font-family: var(--loto-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.loto-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.loto-modal-footer {
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--loto-glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}
