/* ==========================================================================
   🇱🇦 🇹🇭 Fortune Lottery - NEXT-GEN MASTER DESIGN SYSTEM
   Theme: Celestial Lao Luxury & Cyber-Mystic Glassmorphism
   Full Mobile-First & Responsive Architecture
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-dark: #09071a;
  --bg-darker: #050410;
  --bg-surface: #15102b;
  --bg-card: rgba(22, 15, 48, 0.78);
  --bg-card-hover: rgba(39, 25, 76, 0.9);
  --bg-card-solid: #1a1238;
  --bg-glass-input: rgba(8, 6, 24, 0.8);

  /* Borders & Glows */
  --border-color: rgba(246, 211, 101, 0.24);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(246, 211, 101, 0.52);
  --border-emerald: rgba(16, 185, 129, 0.35);
  --border-indigo: rgba(155, 108, 255, 0.42);

  /* Gold Gradients & Accents */
  --gold-primary: #f6d365;
  --gold-light: #fff2ac;
  --gold-dark: #b7791f;
  --gold-gradient: linear-gradient(135deg, #fff2ac 0%, #f6d365 45%, #c58b2b 100%);
  --gold-gradient-subtle: linear-gradient(135deg, rgba(246,211,101,0.17) 0%, rgba(155,108,255,0.08) 100%);
  --gold-glow: 0 0 22px rgba(246, 211, 101, 0.34);
  --gold-glow-lg: 0 0 38px rgba(246, 211, 101, 0.5);

  /* Emerald Gradients & Accents */
  --emerald-primary: #22c7a5;
  --emerald-light: #67e8c7;
  --emerald-dark: #087f73;
  --emerald-gradient: linear-gradient(135deg, #67e8c7 0%, #22c7a5 50%, #087f73 100%);
  --emerald-glow: 0 0 22px rgba(34, 199, 165, 0.3);

  /* Cyber & Mystic Accents */
  --violet-primary: #a78bfa;
  --violet-gradient: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 55%, #5b21b6 100%);
  --cyan-primary: #06b6d4;
  --rose-primary: #f43f5e;
  --flame-gradient: linear-gradient(135deg, #ff4500 0%, #f59e0b 100%);
  --ice-gradient: linear-gradient(135deg, #38bdf8 0%, #3b82f6 100%);

  /* Text Colors */
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-gold: #f6d365;
  --text-emerald: #67e8c7;

  /* Typography */
  --font-main: 'Prompt', 'Outfit', 'Plus Jakarta Sans', 'Noto Sans Lao', system-ui, -apple-system, sans-serif;
  --font-numeric: 'Outfit', 'Plus Jakarta Sans', 'Prompt', monospace;
  --font-lao: 'Noto Sans Lao', 'Prompt', sans-serif;

  /* Geometry & Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  /* Shadows & Depth */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-card: 0 16px 36px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--border-color);
  --shadow-card-hover: 0 22px 48px -10px rgba(0, 0, 0, 0.78), 0 0 30px rgba(155, 108, 255, 0.2), 0 0 16px rgba(246, 211, 101, 0.12);
  --shadow-neon-emerald: 0 0 25px rgba(16, 185, 129, 0.25);
  
  /* Glassmorphism */
  --glass-blur: blur(18px);
  --glass-blur-heavy: blur(28px);
  --focus-ring: 0 0 0 3px rgba(245, 197, 24, 0.35);

  /* Safe Area Insets for Mobile Devices */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* Light Theme Variables */
html[data-theme="light"] {
  --bg-dark: #f7f3ff;
  --bg-darker: #eee8ff;
  --bg-surface: #fffaff;
  --bg-card: rgba(255, 250, 255, 0.92);
  --bg-card-hover: #ffffff;
  --bg-card-solid: #fffaff;
  --bg-glass-input: rgba(247, 241, 255, 0.92);

  --border-color: rgba(124, 58, 237, 0.2);
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-glow: rgba(124, 58, 237, 0.4);
  --border-emerald: rgba(8, 127, 115, 0.35);

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-gold: #8a5a00;
  --text-emerald: #087f73;

  --shadow-card: 0 12px 32px -6px rgba(15, 23, 42, 0.1), 0 0 0 1px var(--border-color);
  --shadow-card-hover: 0 20px 42px -8px rgba(15, 23, 42, 0.16), 0 0 20px rgba(217, 119, 6, 0.18);
  --gold-glow: 0 0 18px rgba(197, 139, 43, 0.25);
  --emerald-glow: 0 0 18px rgba(8, 127, 115, 0.2);
}

/* --------------------------------------------------------------------------
   2. Reset & Global Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  background-image: radial-gradient(circle at 12% 8%, rgba(155, 108, 255, .12) 0 1px, transparent 1.5px), radial-gradient(circle at 78% 18%, rgba(246, 211, 101, .1) 0 1px, transparent 1.5px), radial-gradient(circle at 42% 72%, rgba(103, 232, 199, .08) 0 1px, transparent 1.5px);
  background-size: 150px 150px, 190px 190px, 230px 230px;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient Background Glow Mesh */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
  opacity: 0.18;
  transition: all 0.5s ease;
}
.ambient-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #f6d365, #b7791f);
  top: -150px;
  right: -100px;
  animation: floatOrb 18s ease-in-out infinite alternate;
}
.ambient-glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #22c7a5, #087f73);
  bottom: 10%;
  left: -200px;
  animation: floatOrb 22s ease-in-out infinite alternate-reverse;
}
.ambient-glow-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #a78bfa, #5b21b6);
  top: 45%;
  right: -150px;
  opacity: 0.12;
  animation: floatOrb 26s ease-in-out infinite alternate;
}

html[data-theme="light"] .ambient-glow {
  opacity: 0.1;
  filter: blur(140px);
}
html[data-theme="light"] .fortune-first-panel {
  background: linear-gradient(120deg, rgba(237, 230, 255, .96), rgba(255, 249, 230, .96));
  border-color: rgba(124, 58, 237, .24);
}
html[data-theme="light"] .fortune-step { background: rgba(255, 255, 255, .72); }
html[data-theme="light"] .fortune-step.is-active { background: rgba(246, 211, 101, .18); }

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 60px) scale(1.1); }
  100% { transform: translate(-30px, -40px) scale(0.95); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(245, 197, 24, 0.25);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* Accessible Skip Link */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  transform: translateY(-180%);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: var(--gold-gradient);
  color: #070a12;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--gold-glow);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
}

/* New version notice, shown when the Service Worker has a fresh build ready. */
.app-update-banner {
  position: fixed;
  top: max(12px, calc(var(--safe-top) + 8px));
  left: 50%;
  z-index: 2000;
  width: min(672px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 14px;
  border: 1px solid rgba(93, 129, 238, 0.58);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(239, 245, 255, 0.98), rgba(224, 234, 252, 0.98));
  color: #17233e;
  box-shadow: 0 14px 34px rgba(22, 58, 123, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.app-update-banner[hidden] {
  display: none;
}
.app-update-banner:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.app-update-icon {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #dce7ff, #cddcff);
  color: #4565f5;
  flex-shrink: 0;
}
.app-update-sparkle {
  position: absolute;
  line-height: 1;
}
.app-update-sparkle-main {
  font-size: 1.75rem;
}
.app-update-sparkle-small {
  top: 8px;
  right: 8px;
  font-size: 0.82rem;
}
.app-update-copy {
  min-width: 0;
  line-height: 1.35;
}
.app-update-copy strong {
  display: block;
  color: #18233d;
  font-size: 0.98rem;
  font-weight: 800;
}
.app-update-copy p {
  margin-top: 2px;
  color: #60708d;
  font-size: 0.8rem;
  line-height: 1.45;
}
.app-update-action {
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #4c69fa, #2e55ea);
  color: #fff;
  box-shadow: 0 5px 14px rgba(56, 91, 237, 0.27);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.app-update-action:hover {
  filter: brightness(1.06);
  box-shadow: 0 7px 18px rgba(56, 91, 237, 0.36);
  transform: translateY(-1px);
}
.app-update-action:disabled {
  cursor: wait;
  opacity: 0.7;
}

@media (max-width: 600px) {
  .app-update-banner {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px 12px;
    padding: 10px;
  }
  .app-update-icon {
    width: 40px;
    height: 40px;
  }
  .app-update-copy strong {
    font-size: 0.88rem;
  }
  .app-update-copy p {
    font-size: 0.74rem;
  }
  .app-update-action {
    grid-column: 2;
    justify-self: start;
    min-height: 34px;
    padding: 7px 12px;
    font-size: 0.76rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-update-banner,
  .app-update-action {
    transition: none;
  }
}

/* Focus Rings */
:where(button, a, input, textarea, select):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

button, a, input, textarea, select {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* Inputs on Mobile - min 16px to prevent iOS Safari auto-zoom */
input, textarea, select {
  font-size: 16px;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   3. Header & Floating Glass Navbar
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(7, 10, 18, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}

html[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 8px 0;
  gap: 12px;
}

/* Brand Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.brand:hover {
  transform: scale(1.02);
}

.brand-icon {
  font-size: 1.5rem;
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #064e3b 100%);
  border: 2px solid var(--gold-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--gold-glow);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-icon::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: skewX(-25deg);
  animation: shineBrand 4s infinite;
}
@keyframes shineBrand {
  0%, 75% { left: -100%; }
  100% { left: 200%; }
}

.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.3px;
  line-height: 1.25;
}
.brand-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* Nav Menu Items */
.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 4px;
}

.nav-item {
  position: relative;
}

.nav-item a,
.nav-group-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-item a:hover,
.nav-group-label:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active a,
.nav-item.active .nav-group-label {
  color: #070a12;
  background: var(--gold-gradient);
  font-weight: 700;
  box-shadow: var(--gold-glow);
}

html[data-theme="light"] .nav-item.active a,
html[data-theme="light"] .nav-item.active .nav-group-label {
  color: #ffffff;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.nav-item-primary a {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-weight: 600;
}
.nav-item-primary a:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #fff;
}

/* Nav Submenu Dropdown */
.nav-menu-group {
  position: relative;
}
.nav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  z-index: 1050;
}
.nav-menu-group:hover .nav-submenu,
.nav-menu-group:focus-within .nav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-submenu a {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.84rem;
}

/* Nav Actions (Buttons, Bell, Wallet, Lang, Theme) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  position: relative;
}

/* Buttons System */
.btn-gold,
.btn-primary {
  background: var(--gold-gradient);
  color: #070a12;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--gold-glow);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 38px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-gold:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--gold-glow-lg);
  filter: brightness(1.05);
}
.btn-gold:active,
.btn-primary:active {
  transform: translateY(0);
}

.btn-emerald {
  background: var(--emerald-gradient);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-neon-emerald);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 38px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-emerald:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.45);
  filter: brightness(1.08);
}
.btn-emerald:active {
  transform: translateY(0);
}

.btn-ghost,
.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  min-height: 38px;
  text-decoration: none;
}
.btn-ghost:hover,
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-sm-page {
  background: rgba(245, 197, 24, 0.12);
  color: var(--gold-primary);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  min-height: 34px;
}
.btn-sm-page:hover {
  background: rgba(245, 197, 24, 0.25);
  transform: translateY(-1px);
}

.btn-sm-del {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 34px;
}
.btn-sm-del:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* Notification Bell & Popover */
.notif-bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.notif-bell-btn:hover {
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--border-color);
  transform: scale(1.05);
}
.notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: pulseBadge 2s infinite;
}
@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.notif-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, calc(100vw - 32px));
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  display: none;
  flex-direction: column;
  z-index: 1100;
  overflow: hidden;
}
.notif-popover.open,
.notif-popover.show {
  display: flex;
  animation: popoverFade 0.2s ease;
}
@keyframes popoverFade {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.notif-popover-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.notif-popover-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.notif-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  transition: all 0.2s ease;
}
.notif-item.unread {
  background: rgba(245, 197, 24, 0.08);
  border-color: rgba(245, 197, 24, 0.3);
}

/* Language Switcher */
.lang-switcher {
  position: relative;
  display: inline-block;
}
/* The native select is retained for legacy/i18n compatibility. The styled
   language button is the visible control, so the fallback must not consume
   layout space or create horizontal overflow. */
.lang-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.language-dropdown-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
}
.language-dropdown-button:hover {
  border-color: var(--border-color);
  background: rgba(255, 255, 255, 0.1);
}
.language-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 90px;
  z-index: 1050;
}
.language-dropdown-menu.open,
.language-dropdown-menu.show {
  display: flex;
}
.language-option {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.language-option:hover,
.language-option[aria-selected="true"] {
  background: var(--gold-gradient);
  color: #070a12;
}

/* Theme Toggle Button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 36px;
  padding: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
}
.theme-toggle:hover {
  border-color: var(--border-color);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}
.theme-icon {
  font-size: 0.9rem;
}

/* The theme control is intentionally icon-only; keep the text label in the
   DOM for localization/accessibility tooling while exposing the aria-label. */
.theme-label {
  display: none;
}

/* User Wallet Badge */
.won-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(245, 197, 24, 0.18) 0%, rgba(217, 119, 6, 0.1) 100%);
  border: 1px solid rgba(245, 197, 24, 0.4);
  color: var(--gold-primary);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
  transition: all 0.2s ease;
  min-height: 36px;
  white-space: nowrap;
}
.won-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--gold-glow);
}

.home-account-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 820px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: var(--radius-md);
  background: rgba(16, 24, 42, 0.78);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.home-account-summary > div:first-child {
  display: grid;
  gap: 3px;
}

.home-account-summary > div:first-child strong {
  color: var(--text-main);
  font-size: 0.88rem;
}

.home-account-summary .won-pill {
  flex-shrink: 0;
}
.account-summary-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.account-summary-actions button { white-space: nowrap; }
.account-summary-buy { display: inline-flex; }
.account-summary-buy a { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid rgba(52, 211, 153, .35); background: rgba(16, 185, 129, .15); color: #34d399; font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.account-summary-buy a:hover, .account-summary-buy.active a { background: var(--gold-gradient); border-color: var(--gold-primary); color: #070a12; }
.account-summary-account { width: 100%; min-height: 34px; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid rgba(148, 163, 184, .35); background: rgba(148, 163, 184, .1); color: var(--text-main); font-size: .82rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.account-summary-account:hover, .account-summary-buy.active .account-summary-account { border-color: var(--gold-primary); background: var(--gold-gradient); color: #070a12; }
.profile-dropdown { position: absolute; top: calc(100% + 10px); right: 0; z-index: 1200; width: 260px; padding: 14px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-card-hover); }
.profile-dropdown-heading { display: grid; gap: 3px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); }
.profile-dropdown-heading strong { color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-dropdown-heading small { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-dropdown-balances { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.profile-dropdown-balances span { padding: 8px; border-radius: var(--radius-sm); background: rgba(245, 197, 24, .08); color: var(--gold-primary); font-size: .75rem; }
.profile-dropdown-balances b { display: block; color: var(--text-main); font-size: .95rem; }
.profile-dropdown-balances small { color: var(--text-muted); font-size: .68rem; }
.profile-dropdown-action { width: 100%; margin-top: 6px; padding: 9px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: transparent; color: var(--text-main); text-align: left; cursor: pointer; }
.profile-dropdown-action:hover { border-color: var(--gold-primary); background: rgba(245, 197, 24, .08); }
.profile-dropdown-action.is-danger { color: #f87171; }

.ui-state-retry {
  margin-left: auto;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   4. Hero & Latest Result Showcase (Home Section)
   -------------------------------------------------------------------------- */
.app-section {
  padding: 24px 0 60px 0;
  animation: sectionEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sectionEntrance {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-hero-copy {
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold-primary);
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.seo-primary-heading {
  font-size: clamp(1.4rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.25;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 40%, #f5c518 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}

html[data-theme="light"] .seo-primary-heading {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-hero-copy p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 680px;
  line-height: 1.5;
}

.home-hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.fortune-first-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr);
  gap: 24px;
  align-items: center;
  padding: 26px 28px;
  border: 1px solid rgba(245, 197, 24, .28);
  border-radius: var(--radius-xl);
  background: linear-gradient(120deg, rgba(92, 52, 145, .34), rgba(16, 24, 42, .86));
  box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
  position: relative;
  overflow: hidden;
}
.fortune-first-panel::after {
  content: '✦';
  position: absolute;
  right: 28%;
  top: -28px;
  font-size: 9rem;
  color: rgba(245, 197, 24, .06);
  pointer-events: none;
}
.fortune-first-copy { position: relative; z-index: 1; }
.fortune-first-copy h2 { margin: 12px 0 8px; color: var(--text-main); font-size: clamp(1.25rem, 3vw, 1.8rem); }
.fortune-first-copy p { color: var(--text-secondary); max-width: 650px; line-height: 1.65; }
.fortune-first-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 18px; }
.fortune-first-next { color: var(--text-muted); font-size: .82rem; }
.fortune-first-steps { display: grid; gap: 10px; position: relative; z-index: 1; }
.fortune-step { display: grid; grid-template-columns: 42px 1fr; column-gap: 12px; align-items: center; padding: 11px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: rgba(15, 23, 42, .42); }
.fortune-step b { grid-row: span 2; color: var(--gold-primary); font-size: .82rem; }
.fortune-step span { color: var(--text-main); font-weight: 800; }
.fortune-step small { color: var(--text-muted); font-size: .74rem; }
.fortune-step.is-active { border-color: rgba(245, 197, 24, .55); background: rgba(245, 197, 24, .1); }
.fortune-next-step { margin-top: 28px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 20px 24px; border-radius: var(--radius-lg); border: 1px solid rgba(52, 211, 153, .28); background: rgba(16, 185, 129, .08); }
.fortune-next-step > div { display: grid; gap: 5px; }
.fortune-next-step strong { color: var(--text-main); font-size: 1.05rem; }
.fortune-next-step small { color: var(--text-muted); }
.seo-faq { margin-top: 26px; padding: 26px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-card); }
.seo-faq h2 { margin: 12px 0 16px; color: var(--text-main); font-size: 1.25rem; }
.seo-faq-list { display: grid; gap: 10px; }
.seo-faq details { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px 14px; background: rgba(15, 23, 42, .28); }
.seo-faq summary { cursor: pointer; color: var(--text-main); font-weight: 700; }
.seo-faq details p { color: var(--text-secondary); margin: 10px 0 2px; line-height: 1.6; }
.responsible-play-note { color: var(--gold-primary) !important; opacity: .9; }
.fortune-result-summary { margin-top: 12px; padding: 12px; border: 1px solid rgba(245, 197, 24, .25); border-radius: var(--radius-md); background: rgba(245, 197, 24, .06); }
.fortune-result-summary > strong { display: block; color: var(--gold-primary); margin-bottom: 8px; }
.fortune-number-groups { display: flex; flex-wrap: wrap; gap: 8px; }
.fortune-number-groups span { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: var(--radius-full); background: rgba(15, 23, 42, .55); }
.fortune-number-groups small { color: var(--text-muted); font-size: .7rem; }
.fortune-number-groups strong { color: var(--text-main); letter-spacing: .8px; }
.fortune-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fortune-result-actions button { border: 1px solid var(--border-color); border-radius: var(--radius-full); padding: 6px 10px; color: var(--text-main); background: rgba(15, 23, 42, .7); cursor: pointer; font-size: .76rem; }
.fortune-result-actions button:hover { border-color: var(--gold-primary); color: var(--gold-primary); }
.favorite-numbers-panel { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-color); }
.favorite-numbers-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.favorite-numbers-heading strong { color: var(--gold-primary); }
.favorite-numbers-heading small { color: var(--text-muted); font-size: .75rem; }
.favorite-numbers-list { display: flex; flex-wrap: wrap; gap: 8px; }
.favorite-number-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 11px; border: 1px solid rgba(245, 197, 24, .28); border-radius: var(--radius-md); background: rgba(245, 197, 24, .06); color: var(--text-main); cursor: pointer; }
.favorite-number-chip:hover { border-color: var(--gold-primary); transform: translateY(-1px); }
.favorite-number-chip strong { color: var(--gold-primary); letter-spacing: 1px; }
.favorite-number-chip small { color: var(--text-muted); font-size: .68rem; }
.analytics-trend-card { margin-bottom: 30px; padding: 24px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-card); }
.analytics-trend-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.analytics-trend-heading h3 { color: var(--text-main); margin-bottom: 5px; }
.analytics-trend-heading p { color: var(--text-muted); font-size: .8rem; }
@media (max-width: 680px) { .analytics-trend-heading { flex-direction: column; } }
.saved-number-form { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(160px, .8fr) auto; gap: 10px; padding: 18px; margin-bottom: 16px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-card); }
.saved-number-form input { min-width: 0; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: #0b0f19; color: var(--text-main); }
.saved-number-warning { padding: 10px 14px; margin-bottom: 16px; border: 1px solid rgba(248, 113, 113, .45); border-radius: var(--radius-md); color: #fecaca; background: rgba(127, 29, 29, .2); }
.saved-number-overview { display: grid; grid-template-columns: repeat(2, minmax(120px, .3fr)) minmax(240px, 1fr); gap: 12px; align-items: center; margin-bottom: 18px; }
.saved-number-overview > div { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: rgba(15, 23, 42, .3); }
.saved-number-overview small { color: var(--text-muted); }
.saved-number-overview strong { color: var(--gold-primary); font-size: 1.35rem; }
.saved-number-overview p { color: var(--text-muted); font-size: .78rem; line-height: 1.5; }
.saved-number-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.saved-number-card { padding: 17px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-card); }
.saved-number-card.has-duplicate { border-color: rgba(248, 113, 113, .55); }
.source-check-pill { display: inline-block; margin: 2px 0; padding: 3px 7px; border-radius: var(--radius-full); font-size: .68rem; border: 1px solid var(--border-subtle); color: var(--text-muted); }
.source-check-pill.match { color: #86efac; border-color: rgba(52,211,153,.4); background: rgba(16,185,129,.1); }
.source-check-pill.mismatch { color: #fca5a5; border-color: rgba(248,113,113,.4); background: rgba(127,29,29,.12); }
.source-check-pill.pending, .source-check-pill.unavailable { color: #fde68a; border-color: rgba(245,197,24,.35); background: rgba(245,197,24,.08); }
.saved-number-card-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.saved-number-card-heading strong, .saved-number-card-heading small { display: block; }
.saved-number-card-heading strong { color: var(--text-main); }
.saved-number-card-heading small, .saved-number-meta { color: var(--text-muted); font-size: .76rem; margin-top: 4px; }
.saved-number-match { color: #34d399; font-size: .75rem; white-space: nowrap; }
.saved-number-values { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 10px; }
.saved-number-values span { min-width: 42px; padding: 8px 10px; border: 1px solid rgba(245,197,24,.35); border-radius: var(--radius-full); color: var(--gold-primary); text-align: center; font-weight: 800; letter-spacing: 1px; background: rgba(245,197,24,.07); }
.saved-number-actions { display: flex; gap: 8px; margin-top: 14px; }
@media (max-width: 680px) { .saved-number-form, .saved-number-overview { grid-template-columns: 1fr; } .saved-number-form button { width: 100%; justify-content: center; } }
.fortune-onboarding { max-width: 520px; text-align: center; padding: 34px 30px; }
.fortune-onboarding-icon { font-size: 3rem; margin-bottom: 12px; }
.fortune-onboarding h2 { color: var(--text-main); margin: 14px 0 8px; }
.fortune-onboarding > p { color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }
.onboarding-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 22px; }
.onboarding-steps > div { display: grid; gap: 3px; padding: 12px 7px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: rgba(15, 23, 42, .42); }
.onboarding-steps b { color: var(--gold-primary); font-size: .75rem; }
.onboarding-steps strong { color: var(--text-main); font-size: .83rem; }
.onboarding-steps small { color: var(--text-muted); font-size: .68rem; }
@media (max-width: 520px) { .fortune-onboarding { padding: 28px 18px; } .onboarding-steps { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .fortune-first-panel { grid-template-columns: 1fr; padding: 22px 18px; }
  .fortune-next-step { align-items: stretch; flex-direction: column; }
  .fortune-next-step button { width: 100%; justify-content: center; }
}

/* Master Latest Result Card (3D Luxury Showcase) */
.result-card-luxury {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.result-card-luxury::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #f5c518, #8b5cf6, #10b981);
  background-size: 300% 100%;
  animation: borderAurora 8s linear infinite;
}
@keyframes borderAurora {
  0% { background-position: 0% 0%; }
  100% { background-position: 300% 0%; }
}

.result-card-luxury:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-glow);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}

.draw-meta h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}
.draw-meta p {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.data-freshness {
  font-size: 0.76rem;
  color: var(--emerald-light);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.data-freshness::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulseDot 1.5s infinite;
}
.source-badge { display: inline-flex; width: fit-content; margin-top: 6px; padding: 3px 8px; border-radius: var(--radius-full); background: rgba(167, 139, 250, .12); border: 1px solid rgba(167, 139, 250, .28); color: var(--violet-primary); font-size: .7rem; font-weight: 700; }
.prob-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.prob-box { min-width: 0; padding: 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.035); }
.prob-box h4 { margin: 0 0 12px; color: var(--text-main); font-size: .95rem; }
.prob-balls, .prob-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.prob-balls .lotto-ball.mini { width: 48px; height: 48px; font-size: 1.4rem; }
.prob-tag { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; padding: 7px 10px; border-radius: var(--radius-sm); background: rgba(34, 199, 165, .12); border: 1px solid var(--border-emerald); color: var(--emerald-light); font-family: var(--font-numeric); font-weight: 800; }
.prob-tag.gold { background: rgba(246, 211, 101, .12); border-color: var(--border-color); color: var(--gold-light); }
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 6 Golden 3D Metallic Balls Grid */
.ball-grid-6 {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: nowrap;
  width: 100%;
}

.lotto-ball {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-family: var(--font-numeric);
  font-size: 2rem;
  font-weight: 900;
  color: #0d131a;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #fffbe6 0%, #fde047 25%, #f59e0b 60%, #b45309 95%, #78350f 100%);
  box-shadow: 
    inset -3px -4px 8px rgba(0, 0, 0, 0.45),
    inset 3px 3px 6px rgba(255, 255, 255, 0.9),
    0 10px 24px -2px rgba(245, 158, 11, 0.45),
    0 4px 8px rgba(0, 0, 0, 0.5);
  position: relative;
  cursor: default;
  user-select: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.lotto-ball:hover {
  transform: translateY(-6px) scale(1.06);
  box-shadow: 
    inset -3px -4px 8px rgba(0, 0, 0, 0.45),
    inset 3px 3px 6px rgba(255, 255, 255, 0.9),
    0 16px 28px rgba(245, 158, 11, 0.6),
    0 6px 12px rgba(0, 0, 0, 0.6);
}

/* Sub Prizes Grid */
.prizes-sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.sub-prize-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.25s ease;
}
.sub-prize-box:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color);
  transform: translateY(-2px);
}
.sub-prize-box span {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.sub-prize-box strong {
  font-family: var(--font-numeric);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 1px;
}

/* Animals Display */
.animals-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.animal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.08) 100%);
  border: 1px solid var(--border-emerald);
  color: #34d399;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
  transition: all 0.2s ease;
}
.animal-badge:hover {
  transform: scale(1.04);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
}

/* Quick Ticket Checker Form */
.checker-hero-bar {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 5px 6px 5px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}
.checker-hero-bar:focus-within {
  border-color: var(--gold-primary);
  box-shadow: var(--gold-glow);
}
.checker-hero-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.98rem;
  font-weight: 600;
  outline: none;
  min-width: 0;
}
.checker-hero-bar input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.9rem;
}
.checker-hero-bar button {
  border-radius: var(--radius-full);
  padding: 8px 18px;
  flex-shrink: 0;
}

.ticket-check-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.ticket-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

/* Countdown Box */
.countdown-box {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 78px;
  padding: 12px 14px;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.countdown-num {
  font-family: var(--font-numeric);
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold-primary);
  line-height: 1;
  text-shadow: var(--gold-glow);
}
.countdown-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Quick Navigation Shortcuts */
.home-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.home-shortcut {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}
.home-shortcut:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.home-shortcut-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(245, 197, 24, 0.12);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.home-shortcut span {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.home-shortcut strong {
  font-size: 0.95rem;
  font-weight: 700;
}
.home-shortcut small {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-shortcut b {
  color: var(--gold-primary);
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}
.home-shortcut:hover b {
  transform: translateX(4px);
}

/* Insight Grid */
.home-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.home-insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: var(--glass-blur);
}
.home-insight-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.home-insight-heading h2 {
  font-size: 1.1rem;
  font-weight: 700;
}
.text-link {
  background: transparent;
  border: none;
  color: var(--gold-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.text-link:hover {
  text-decoration: underline;
}

/* SEO Cards Section */
.seo-intro {
  margin-top: 32px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.seo-intro h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 6px 0;
  color: var(--text-main);
}
.seo-intro p {
  color: var(--text-secondary);
  font-size: 0.92rem;
}
.seo-intro-points {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.seo-intro-points span {
  font-size: 0.8rem;
  color: var(--emerald-light);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.seo-landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.seo-landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.seo-landing-card h2 {
  font-size: 1rem;
  font-weight: 700;
}
.seo-landing-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  flex: 1;
}
.seo-section-link {
  color: var(--gold-primary);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   5. Section: Simulated Betting (Buy Lottery Tickets)
   -------------------------------------------------------------------------- */
.section-heading {
  margin-bottom: 24px;
}
.section-heading h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  background: linear-gradient(135deg, #fff 0%, #f5c518 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme="light"] .section-heading h2 {
  background: linear-gradient(135deg, #0f172a 0%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-heading p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.simulation-notice {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Form Input & Select Styling */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
textarea,
select {
  background: var(--bg-glass-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 16px;
  transition: all 0.2s ease;
  outline: none;
  width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold-primary);
  box-shadow: var(--focus-ring);
}
select option {
  background: var(--bg-surface);
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   6. Section: History & Data Table
   -------------------------------------------------------------------------- */
.tab-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tab-pill:hover,
.tab-pill.active {
  background: var(--gold-gradient);
  color: #070a12;
  border-color: transparent;
  font-weight: 700;
  box-shadow: var(--gold-glow);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

.luxury-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}
.luxury-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 700;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.luxury-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  transition: background 0.15s ease;
  white-space: nowrap;
}
.luxury-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* History Mobile Cards List */
.history-mobile-list {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.history-mobile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.history-mobile-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}
.history-mobile-card-head strong {
  color: var(--gold-primary);
  font-size: 0.95rem;
}
.history-mobile-main-number {
  font-family: var(--font-numeric);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-main);
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.history-mobile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.history-mobile-grid span {
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-mobile-grid b {
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: var(--font-numeric);
}

/* --------------------------------------------------------------------------
   7. Section: Analytics & Charts
   -------------------------------------------------------------------------- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
}

/* Hot and Cold 2D Lists */
#hot2DList, #cold2DList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.hot-num-chip {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(245, 158, 11, 0.15) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  text-align: center;
  color: #fbbf24;
  font-family: var(--font-numeric);
  font-weight: 800;
  font-size: 1.15rem;
}
.cold-num-chip {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(6, 182, 212, 0.15) 100%);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  text-align: center;
  color: #60a5fa;
  font-family: var(--font-numeric);
  font-weight: 800;
  font-size: 1.15rem;
}

/* --------------------------------------------------------------------------
   8. Section: AI Fortune Oracle & Dreams
   -------------------------------------------------------------------------- */
.ai-oracle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 26px 20px;
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ai-credit-purchase-panel {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ai-chips-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.ai-chip-prompt {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.ai-chip-prompt:hover {
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--border-color);
  color: var(--gold-primary);
  transform: translateY(-1px);
}

.chat-history-window {
  min-height: 260px;
  max-height: 440px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  -webkit-overflow-scrolling: touch;
}

.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 88%;
}
.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--violet-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}
.chat-msg.user .chat-avatar {
  background: var(--emerald-gradient);
  box-shadow: var(--shadow-neon-emerald);
}
.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}
.chat-msg.ai .chat-bubble {
  border-top-left-radius: 4px;
  background: rgba(22, 33, 58, 0.7);
  border-color: rgba(99, 102, 241, 0.25);
}
.chat-msg.user .chat-bubble {
  border-top-right-radius: 4px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  border: none;
}

/* Dream Dictionary Cards */
.dream-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}
.dream-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.dream-library-intro {
  color: var(--text-muted);
  margin: -6px 0 14px;
  font-size: 0.9rem;
}
.dream-library-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.dream-library-filter-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.dream-library-toolbar select {
  min-width: 170px;
  color: var(--text-primary);
  background: var(--bg-card);
}
.dream-library-count {
  margin-left: auto;
  color: var(--gold-primary);
  font-size: 0.85rem;
  font-weight: 700;
}
.dream-library-disclaimer {
  text-align: left;
  margin: 5px 0 16px;
}
.dream-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.dream-card-item:hover {
  border-color: var(--gold-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.dream-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.dream-card-header h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.05rem;
  line-height: 1.45;
}
.dream-card-item .category-pill {
  flex-shrink: 0;
  color: var(--gold-primary);
  background: rgba(245, 197, 24, 0.12);
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.72rem;
}
.dream-desc {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 0.9rem;
}
.dream-lucky-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dream-lucky-row .lucky-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.76rem;
}
.dream-lucky-row .lucky-group strong {
  color: var(--text-main);
  font-family: var(--font-numeric);
  letter-spacing: 0.04em;
}
.dream-lucky-row .lucky-group strong.gold {
  color: var(--gold-primary);
}
.dream-lucky-row .btn-sm-save {
  grid-column: 1 / -1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  color: var(--gold-primary);
  background: rgba(245, 197, 24, 0.08);
  cursor: pointer;
}
.dream-lucky-row .btn-sm-save:hover {
  background: rgba(245, 197, 24, 0.16);
}
.dream-related-animal {
  color: var(--text-dim);
  font-size: 0.76rem;
}
.dream-related-animal strong {
  color: var(--gold-primary);
}

@media (max-width: 560px) {
  .dream-library-count {
    width: 100%;
    margin-left: 0;
  }
  .dream-card-header {
    flex-direction: column;
  }
  .dream-lucky-row {
    grid-template-columns: 1fr;
  }
  .dream-lucky-row .btn-sm-save {
    grid-column: auto;
  }
}

/* --------------------------------------------------------------------------
   9. Section: 40 Lao Animals Chart (ตำรานามสัตว์)
   -------------------------------------------------------------------------- */
.animal-grid-40 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}

.animal-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.animal-card-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-primary);
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-card-hover);
}

.animal-num-badge {
  font-family: var(--font-numeric);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold-primary);
  background: rgba(245, 197, 24, 0.12);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
.animal-card-icon {
  font-size: 2rem;
  margin: 2px 0;
}
.animal-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}
.animal-card-lao {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   10. Section: Fortune Tools (Siamsi, Wheel, Horoscope, Colors)
   -------------------------------------------------------------------------- */
.tools-grid-dual {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

#siamsiCylinder {
  display: inline-block;
  cursor: pointer;
  transition: transform 0.15s ease;
  user-select: none;
}
.siamsi-shaking {
  animation: shakeSiamsi 0.6s infinite ease-in-out;
}
@keyframes shakeSiamsi {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-15deg) translateY(-8px) scale(1.08); }
  75% { transform: rotate(15deg) translateY(-8px) scale(1.08); }
}

.wheel-wrapper {
  position: relative;
  display: inline-block;
  margin: 15px auto;
  max-width: 100%;
}
#luckyWheelCanvas {
  max-width: 100%;
  height: auto;
}

.color-guidance-section,
.belief-guidance-section,
.auspicious-times-section {
  margin-top: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
}
.color-guidance-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 8px;
}
.color-guidance-heading h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-primary);
}
.auspicious-colors-grid,
.belief-guidance-grid,
.auspicious-times-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.belief-disclaimer {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 12px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   11. Section: Community, Feed & Leaderboard
   -------------------------------------------------------------------------- */
.community-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}
.community-post-card:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-card-hover);
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   12. Section: Admin Back-office Dashboard
   -------------------------------------------------------------------------- */
.admin-ops-grid,
.admin-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.admin-ops-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-ops-card span {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.admin-ops-card strong {
  font-size: 1.3rem;
  color: var(--gold-primary);
}
.admin-control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.admin-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-user-filters,
.admin-audit-filters,
.admin-news-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   13. Modals & Overlays
   -------------------------------------------------------------------------- */
.modal-backdrop,
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 6, 10, 0.8);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.2s ease;
}
.modal-backdrop.open,
.modal-overlay.open,
.modal-backdrop.show,
.modal-overlay.show,
.modal-backdrop[style*="display: block"],
.modal-backdrop[style*="display: flex"] {
  display: flex !important;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content-luxury,
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  width: 100%;
  max-width: 500px;
  position: relative;
  box-shadow: var(--shadow-card);
  animation: scaleUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes scaleUpModal {
  from { opacity: 0; transform: scale(0.94) translateY(14px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close-btn,
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.modal-close-btn:hover,
.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  transform: rotate(90deg);
}

.deposit-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.deposit-chip {
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}
.deposit-chip:hover,
.deposit-chip.active {
  background: var(--gold-gradient);
  color: #070a12;
  border-color: transparent;
  box-shadow: var(--gold-glow);
}

/* --------------------------------------------------------------------------
   14. Mobile Bottom Navigation Dock
   -------------------------------------------------------------------------- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: max(10px, env(safe-area-inset-bottom, 10px));
  left: 14px;
  right: 14px;
  background: rgba(14, 20, 36, 0.92);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(245, 197, 24, 0.15);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
}

html[data-theme="light"] .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 15px rgba(217, 119, 6, 0.15);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 52px;
}
.mobile-nav-item span {
  font-size: 1.2rem;
  line-height: 1;
}
.mobile-nav-item.active {
  color: var(--gold-primary);
  font-weight: 700;
}
.mobile-nav-primary {
  background: var(--gold-gradient);
  color: #070a12 !important;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  margin-top: -18px;
  box-shadow: var(--gold-glow-lg);
  justify-content: center;
  border: 2px solid #070a12;
}
html[data-theme="light"] .mobile-nav-primary {
  border-color: #ffffff;
}
.mobile-nav-primary small {
  display: none;
}

/* --------------------------------------------------------------------------
   15. Footer
   -------------------------------------------------------------------------- */
.luxury-footer {
  margin-top: 50px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 32px 0;
  text-align: center;
}
.footer-bottom p {
  color: var(--text-muted);
  font-size: 0.84rem;
}
.footer-legal-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.footer-legal-links button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.2s ease;
}
.footer-legal-links button:hover {
  color: var(--gold-primary);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   16. Comprehensive Responsive Media Queries (Mobile & Tablet)
   -------------------------------------------------------------------------- */

/* Tablet & Mobile Screens (<= 1024px) */
@media (max-width: 1024px) {
  .nav-menu {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  body {
    padding-bottom: max(78px, calc(64px + env(safe-area-inset-bottom, 0px)));
  }
  .tools-grid-dual {
    grid-template-columns: 1fr;
  }
}

/* Compact laptop/medium-desktop header. The full desktop menu and all utility
   actions do not fit reliably beside the long Thai brand at these widths. */
@media (min-width: 1025px) and (max-width: 1600px) {
  .brand {
    max-width: 270px;
    min-width: 0;
    flex: 0 1 270px;
  }
  .brand-text {
    min-width: 0;
  }
  .brand-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-item a,
  .nav-group-label {
    padding-left: 7px;
    padding-right: 7px;
    font-size: 0.8rem;
  }
  .nav-menu {
    gap: 2px;
    min-width: 0;
  }
  .nav-actions {
    gap: 4px;
  }
  #btnNavDeposit,
  #btnNavDailyCheckin {
    padding-left: 8px !important;
    padding-right: 8px !important;
    font-size: 0.76rem !important;
  }
  .theme-label {
    display: none;
  }
}

/* Mobile Screens (<= 768px) */
@media (max-width: 768px) {
  .prob-grid { grid-template-columns: 1fr; }
  .container {
    padding: 0 14px;
  }
  .nav-container {
    min-height: 60px;
    padding: 6px 0;
  }
  .brand {
    min-width: 0;
    flex: 1 1 auto;
  }
  .brand-text {
    min-width: 0;
  }
  .brand-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-icon {
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
  }
  .brand-title {
    font-size: 0.98rem;
  }
  .brand-text span {
    font-size: 0.65rem;
  }

  /* Keep utility actions out of the narrow header; they remain available
     through the page controls and mobile bottom navigation. */
  #btnNavInstallPWA,
  #navUserWrapper {
    display: none !important;
  }
  .nav-actions {
    flex: 0 0 auto;
    gap: 4px;
  }
  .notif-bell-btn,
  .language-dropdown-button,
  .theme-toggle {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  .theme-label {
    display: none;
  }
  #btnNavLogin { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .won-pill {
    padding: 4px 10px;
    font-size: 0.75rem;
    min-height: 32px;
  }

  .home-account-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
  }

  .home-account-summary .won-pill {
    width: 100%;
    justify-content: center;
  }

  .account-summary-actions { width: 100%; justify-content: stretch; }
  .account-summary-actions button, .account-summary-buy { flex: 1 1 0; }
  .account-summary-actions button, .account-summary-buy a { width: 100%; justify-content: center; }

  /* 6-Balls Display on Mobile */
  .ball-grid-6 {
    gap: 6px;
    margin: 18px 0;
  }
  .lotto-ball {
    width: clamp(42px, 12vw, 56px);
    height: clamp(42px, 12vw, 56px);
    font-size: clamp(1.3rem, 4.5vw, 1.8rem);
  }

  /* Sub Prizes on Mobile: 2x2 Grid */
  .prizes-sub-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .sub-prize-box {
    padding: 10px 8px;
  }
  .sub-prize-box strong {
    font-size: 1.3rem;
  }

  /* Countdown Pods on Mobile: 4 in a row */
  .countdown-box {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 360px;
    margin: 12px auto 0 auto;
  }
  .countdown-unit {
    min-width: 0;
    padding: 10px 6px;
  }
  .countdown-num {
    font-size: 1.5rem;
  }
  .countdown-label {
    font-size: 0.68rem;
  }

  /* Table on Mobile: Switch to Cards */
  .luxury-table {
    display: none;
  }
  .table-responsive {
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }
  .history-mobile-list {
    display: flex;
  }

  /* 40 Lao Animals Grid on Mobile: 3 to 4 columns */
  .animal-grid-40 {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
  }
  .animal-card-item {
    padding: 10px 6px;
  }
  .animal-num-badge {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  .animal-card-icon {
    font-size: 1.6rem;
  }
  .animal-card-name {
    font-size: 0.78rem;
  }

  /* Community Layout on Mobile */
  #sectionCommunity > div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  /* Betting Shop Layout on Mobile */
  #sectionBuy > div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  /* Chat form on mobile */
  #aiChatForm {
    flex-direction: column !important;
    gap: 8px !important;
  }
  #aiBirthDaySelect {
    max-width: 100% !important;
  }

  /* Modals on Mobile: Bottom-sheet feel */
  .modal-backdrop,
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }
  .modal-content-luxury,
  .modal-content {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 90vh;
    padding: 24px 18px;
  }
}
@media (max-width: 480px) {
  .brand-title { max-width: 150px; font-size: .78rem; letter-spacing: 0; }
  .brand-text span { display: none; }
  .nav-container { gap: 6px; }
  .nav-actions { gap: 2px; }
  .notif-bell-btn, .language-dropdown-button, .theme-toggle { padding-left: 5px; padding-right: 5px; }
  #btnNavLogin { max-width: 92px; padding-left: 8px; padding-right: 8px; font-size: .72rem; }
  .profile-dropdown { right: -4px; width: min(260px, calc(100vw - 28px)); }
  .seo-faq { padding: 20px 16px; }
}

/* Small Smartphone Screens (<= 400px) */
@media (max-width: 400px) {
  .mobile-bottom-nav {
    left: 6px;
    right: 6px;
    padding-left: 4px;
    padding-right: 4px;
    gap: 0;
  }
  .mobile-nav-item {
    min-width: 0;
    flex: 1 1 0;
    padding-left: 2px;
    padding-right: 2px;
  }
  .mobile-nav-primary {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }
  .brand-text span {
    display: none;
  }
  .lotto-ball {
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
  }
  .home-hero-actions {
    flex-direction: column;
    width: 100%;
  }
  .home-hero-actions button {
    width: 100%;
  }
  .checker-hero-bar {
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: 8px 12px;
  }
  .checker-hero-bar input {
    padding: 8px 0;
  }
  .checker-hero-bar button {
    width: 100%;
  }
}
