/* ╔══════════════════════════════════════════════════════════════════════════════╗
   ║  Huayapp — Production Theme System                                         ║
   ║  Version: 8.0                                                              ║
   ║  Light Theme with Hi-Tech Glassmorphism Design                        ║
   ║  Default: Light Theme                                                      ║
   ╚══════════════════════════════════════════════════════════════════════════════╝ */

/* ═══════════════════════════════════════════════════════════════════════════════
   LAYER ORDER — defines cascade priority
   ═══════════════════════════════════════════════════════════════════════════════ */
@layer reset, tokens, base, components, utilities;

/* ═══════════════════════════════════════════════════════════════════════════════
   PHASE 1 — DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════════════════ */
@layer tokens {

  /* ─────────────────────────────────────────────────
     Tier 1: Literal Color Palette
     ───────────────────────────────────────────────── */
  :root {
    /* ── Crimson / Blood Red (Brand) ── */
    --crimson-50:  #fef2f2;
    --crimson-100: #fee2e2;
    --crimson-200: #fecaca;
    --crimson-300: #fca5a5;
    --crimson-400: #f87171;
    --crimson-500: #ef4444;
    --crimson-600: #dc2626;
    --crimson-700: #b91c1c;
    --crimson-800: #991b1b;
    --crimson-900: #7f1d1d;

    /* ── Legacy Orange (mapped to Crimson for compat) ── */
    --orange-50:  #fef2f2;
    --orange-100: #fee2e2;
    --orange-200: #fecaca;
    --orange-300: #fca5a5;
    --orange-400: #f87171;
    --orange-500: #ef4444;
    --orange-600: #dc2626;
    --orange-700: #b91c1c;
    --orange-800: #991b1b;
    --orange-900: #7f1d1d;

    /* ── Gold (Fortune Accent) ── */
    --gold-300: #fcd34d;
    --gold-400: #fbbf24;
    --gold-500: #d4a017;
    --gold-600: #b8860b;

    /* ── Amber (mapped to Gold) ── */
    --amber-300: #fcd34d;
    --amber-400: #fbbf24;
    --amber-500: #d4a017;
    --amber-600: #b8860b;

    /* ── Slate (Neutral) ── */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    --navy-900:  #0a0508;
    --navy-800:  #150a0d;
    --navy-700:  #1f1015;
    --navy-600:  #28141a;
    --navy-500:  #351c23;

    /* ── Emerald (Success) ── */
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;

    /* ── Red (Error — same as brand for this theme) ── */
    --red-400: #f87171;
    --red-500: #ef4444;
    --red-600: #dc2626;

    /* ── Amber/Yellow (Warning) ── */
    --yellow-400: #facc15;
    --yellow-500: #eab308;

    /* ── Sky (Info) ── */
    --sky-400: #38bdf8;
    --sky-500: #0ea5e9;

    /* ── Purple (Code/Accent) ── */
    --purple-400: #c084fc;
    --purple-500: #a855f7;

    /* ── Pink ── */
    --pink-400: #f472b6;
    --pink-500: #ec4899;
  }

  /* ─────────────────────────────────────────────────
     Tier 2–3: Semantic & UI Tokens — LIGHT THEME (Default)
     ───────────────────────────────────────────────── */
  :root {
    /* ── Backgrounds ── */
    --bg-primary:   #ffffff;
    --bg-secondary: #ffffff;
    --bg-tertiary:  #fef2f0;
    --bg-elevated:  #ffffff;

    /* ── Surfaces (Glass) ── */
    --surface:          rgba(255, 255, 255, 0.82);
    --surface-hover:    rgba(255, 255, 255, 0.92);
    --surface-glass:    rgba(255, 255, 255, 0.65);
    --surface-glass-hover: rgba(255, 255, 255, 0.80);
    --surface-inset:    rgba(185, 28, 28, 0.04);
    --surface-code:     #1a0a0e;

    /* ── Text ── */
    --text-primary:   var(--slate-900);
    --text-secondary: var(--slate-600);
    --text-muted:     var(--slate-400);
    --text-inverse:   #ffffff;
    --text-on-brand:  #ffffff;

    /* ── Borders ── */
    --border:       rgba(185, 28, 28, 0.08);
    --border-hover: rgba(185, 28, 28, 0.16);
    --border-focus: var(--crimson-500);
    --border-subtle: rgba(185, 28, 28, 0.04);

    /* ── Shadows ── */
    --shadow-xs:  0 1px 2px rgba(69, 10, 10, 0.06);
    --shadow-sm:  0 1px 3px rgba(69, 10, 10, 0.08), 0 1px 2px rgba(69, 10, 10, 0.06);
    --shadow-md:  0 4px 6px -1px rgba(69, 10, 10, 0.10), 0 2px 4px -2px rgba(69, 10, 10, 0.06);
    --shadow-lg:  0 10px 15px -3px rgba(69, 10, 10, 0.10), 0 4px 6px -4px rgba(69, 10, 10, 0.06);
    --shadow-xl:  0 20px 25px -5px rgba(69, 10, 10, 0.12), 0 8px 10px -6px rgba(69, 10, 10, 0.06);
    --shadow-glow: 0 0 20px rgba(185, 28, 28, 0.12);
    --shadow-glow-strong: 0 0 40px rgba(185, 28, 28, 0.22);

    /* ── Semantic Colors ── */
    --success:   var(--emerald-500);
    --error:     var(--red-500);
    --warning:   var(--yellow-500);
    --info:      var(--sky-500);

    --success-bg: rgba(16, 185, 129, 0.10);
    --error-bg:   rgba(185, 28, 28, 0.10);
    --warning-bg: rgba(234, 179, 8, 0.10);
    --info-bg:    rgba(14, 165, 233, 0.10);

    --success-border: rgba(16, 185, 129, 0.20);
    --error-border:   rgba(185, 28, 28, 0.20);
    --warning-border: rgba(234, 179, 8, 0.20);
    --info-border:    rgba(14, 165, 233, 0.20);

    /* ── Brand Gradients (Blood Red + Gold) ── */
    --gradient-brand:       var(--crimson-600);
    --gradient-brand-hover: linear-gradient(135deg, var(--crimson-700), var(--crimson-800));
    --gradient-brand-soft:  linear-gradient(135deg, rgba(185,28,28,0.10), rgba(212,160,23,0.06));
    --gradient-accent-line: linear-gradient(90deg, var(--crimson-600), var(--gold-500));
    --gradient-glass-shine: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 60%);

    /* ── Glassmorphism ── */
    --glass-blur:     blur(20px);
    --glass-blur-sm:  blur(12px);
    --glass-saturate: saturate(180%);

    /* ── Radii ── */
    --radius-xs:  4px;
    --radius-sm:  6px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* ── Spacing ── */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* ── Transitions ── */
    --ease-out:  cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* ── Z-Index Scale ── */
    --z-background: -1;
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 500;
    --z-modal: 1000;
    --z-toast: 2000;

    /* ── Particle System (Blood Red) ── */
    --particle-color: rgba(185, 28, 28, 0.30);
    --line-color: rgba(185, 28, 28, 0.06);

    /* ── Background Mesh ── */
    --blob-opacity: 0.15;
  }

  /* ─────────────────────────────────────────────────
     ───────────────────────────────────────────────── */
  
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PHASE 2 — RESET & BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */
@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    color-scheme: light;
  }

  body {
    line-height: 1.6;
    min-height: 100dvh;
  }

  img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
  }

  input, button, textarea, select {
    font: inherit;
    color: inherit;
  }

  button {
    cursor: pointer;
    border: none;
    background: none;
  }

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

  ul, ol {
    list-style: none;
  }

  table {
    border-collapse: collapse;
    width: 100%;
  }
}

@layer base {
  body {
    font-family: 'Kanit', sans-serif;
    font-size: clamp(0.875rem, 0.84rem + 0.18vw, 1rem);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    transition: background-color var(--duration-slow) var(--ease-out),
                color var(--duration-slow) var(--ease-out);
  }

  ::selection {
    background: rgba(185, 28, 28, 0.25);
    color: var(--text-primary);
  }

  :focus-visible {
    outline: 2px solid var(--crimson-500);
    outline-offset: 2px;
  }

  /* Scrollbar (non-macOS) */
  :root {
    scrollbar-color: var(--slate-300) transparent;
    scrollbar-width: thin;
  }

  
}


/* ═══════════════════════════════════════════════════════════════════════════════
   PHASE 3 — BACKGROUND & PARTICLE SYSTEM
   ═══════════════════════════════════════════════════════════════════════════════ */
@layer components {

  /* ── Particle Canvas ── */
  #particle-canvas {
    position: fixed;
    inset: 0;
    z-index: var(--z-background);
    pointer-events: none;
    width: 100%;
    height: 100%;
  }

  /* ── Background Mesh ── */
  .bg-mesh {
    position: fixed;
    inset: 0;
    z-index: var(--z-background);
    overflow: hidden;
    pointer-events: none;
  }

  .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: var(--blob-opacity);
    will-change: transform;
    transition: opacity var(--duration-slow) var(--ease-out);
  }

  .blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--crimson-400), transparent 70%);
    top: -10%;
    right: -5%;
    animation: blob-drift-1 45s ease-in-out infinite alternate;
  }

  .blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--gold-400), transparent 70%);
    bottom: -15%;
    left: -8%;
    animation: blob-drift-2 55s ease-in-out infinite alternate;
  }

  .blob-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--crimson-300), transparent 70%);
    top: 40%;
    left: 50%;
    animation: blob-drift-3 50s ease-in-out infinite alternate;
  }

  .blob-4 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--gold-300), transparent 70%);
    top: 20%;
    left: 15%;
    animation: blob-drift-4 60s ease-in-out infinite alternate;
  }

  @keyframes blob-drift-1 {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(-80px, 60px) scale(1.1); }
    66%  { transform: translate(40px, -40px) scale(0.95); }
    100% { transform: translate(-30px, 80px) scale(1.05); }
  }

  @keyframes blob-drift-2 {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(70px, -50px) scale(1.08); }
    66%  { transform: translate(-60px, 30px) scale(0.92); }
    100% { transform: translate(50px, -70px) scale(1.03); }
  }

  @keyframes blob-drift-3 {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-100px, 60px) scale(1.12); }
    100% { transform: translate(60px, -80px) scale(0.96); }
  }

  @keyframes blob-drift-4 {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(80px, 40px) scale(1.06); }
    100% { transform: translate(-40px, -60px) scale(0.94); }
  }


  /* ═══════════════════════════════════════════════════════════════════════════
     PHASE 4 — HOMEPAGE COMPONENTS
     ═══════════════════════════════════════════════════════════════════════════ */

  /* ─── Layout ─── */
  .container {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--space-5);
  }

  /* ─── Navbar ─── */
  .navbar {
    position: sticky;
    top: 0;
    z-index: var(--z-modal);
    border-bottom: 1px solid var(--border);
    transition: border-color var(--duration-normal) var(--ease-out);
  }

  /* Glass effect on ::before so backdrop-filter doesn't create a
     containing block that traps fixed-position overlays */
  .navbar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--surface-glass);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    z-index: -1;
    transition: background var(--duration-normal) var(--ease-out);
  }

  .nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: var(--space-4);
  }

  /* ─── Logo ─── */
  .logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: 800;
    font-size: 1.25rem;
    transition: opacity var(--duration-fast) var(--ease-out);
  }

  .logo:hover {
    opacity: 0.85;
  }

 .logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  /* เพิ่ม 2 บรรทัดนี้เข้าไปครับ */
  border-radius: 24%; /* ปรับเปอร์เซ็นต์ให้โค้งมนพอดีกับขอบสีเขียว */
  overflow: hidden;   /* ซ่อนส่วนสีขาวที่เกินขอบโค้งออกมา */

  transition: transform var(--duration-normal) var(--ease-spring),
              box-shadow var(--duration-normal) var(--ease-out);
}

.logo:hover .logo-icon {
  transform: scale(1.05) rotate(-3deg);
  filter: drop-shadow(0 4px 14px rgba(185, 28, 28, 0.35));
}

  .text-gradient {
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  /* ─── Nav Actions ─── */
  .nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .nav-link-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    white-space: nowrap;
  }

  .nav-link-btn:hover {
    color: var(--text-primary);
    background: var(--surface-inset);
  }

  .nav-link-btn.active {
    color: var(--crimson-600);
    background: var(--gradient-brand-soft);
    font-weight: 600;
  }

  

  .nav-link-btn i {
    font-size: 0.8rem;
  }

  /* ─── Theme Toggle ─── */
  .theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: all var(--duration-normal) var(--ease-out);
    flex-shrink: 0;
  }

  .theme-toggle:hover {
    border-color: var(--crimson-500);
    color: var(--crimson-500);
    background: var(--gradient-brand-soft);
    box-shadow: var(--shadow-glow);
  }

  /* ─── Mobile Menu ─── */
  .mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: background var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
  }

  .mobile-menu-btn:hover {
    background: var(--surface-inset);
  }

  /* ── Mobile Drawer Header (inside drawer, hidden on desktop) ── */
  .mobile-drawer-header {
    display: none;
  }

  /* ── Mobile Drawer Overlay (shared by both drawers) ── */
  /* NOTE: backdrop-filter removed — causes persistent blur on iOS Safari */
  .mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9000;
    pointer-events: auto;
  }

  .mobile-drawer-overlay.open {
    display: block;
  }

  /* Body scroll lock when any drawer is open */
  body.drawer-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }



  /* ─── Hero Section ─── */
  .hero {
    text-align: center;
    padding: var(--space-16) var(--space-4) var(--space-12);
  }

  .hero h1 {
    font-size: clamp(1.75rem, 1.2rem + 2.5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-wrap: balance;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
  }

  .hero p {
    font-size: clamp(0.9rem, 0.85rem + 0.25vw, 1.1rem);
    color: var(--text-secondary);
    max-width: 560px;
    margin-inline: auto;
    line-height: 1.7;
    text-wrap: pretty;
  }


  /* ─── Section Title ─── */
  .section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-5);
    padding-left: var(--space-4);
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-wrap: balance;
  }

  .section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    border-radius: var(--radius-full);
    background: var(--gradient-accent-line);
  }


  /* ─── Card Grid ─── */
  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-10);
  }

  .grid--yeekee {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-10);
  }
  @media (min-width: 1200px) {
    .grid--yeekee {
      grid-template-columns: repeat(4, 1fr);
    }
  }


  /* ═══════════════════════════════════════════════════════════════
     LOTTO CARD — Homepage Result Cards
     ═══════════════════════════════════════════════════════════════ */

  .thai-lotto-container {
    max-width: 600px;
    margin: 0 auto var(--space-8) auto;
  }
  .lotto-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-secondary);
    border: none;
    box-shadow: var(--shadow-md), 0 0 12px rgba(185, 28, 28, 0.05), 0 0 0 1px rgba(0,0,0,0.06);
    cursor: context-menu;
    transition: transform var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                border-color var(--duration-normal) var(--ease-out),
                background var(--duration-slow) var(--ease-out);
  }
  /* ── Card Body (empty state wrapper) ── */
  .lotto-card-body {
    padding: var(--space-8);
  }

  /* ── Card Header — iOS Red 3D ── */
  .lotto-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(180deg, #f06060 0%, #dc3030 49%, #bd1515 51%, #a00b0b 100%);
    box-shadow: inset 0 1px 0 rgba(255, 150, 150, 0.4);
    border-bottom: 1px solid #7a0000;
    color: #ffffff;
    gap: var(--space-3);
    position: relative;
    overflow: hidden;
  }

  /* golden shimmer effect */
  .lotto-card-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: header-shimmer 4s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes header-shimmer {
    0%   { left: -100%; }
    50%  { left: 150%; }
    100% { left: 150%; }
  }

  .lotto-card-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
    color: #ffffff;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.6);
  }

  .lotto-card-name i {
    font-size: 0.85rem;
    opacity: 0.9;
    color: #fcd34d;
  }

  /* ── Country Flag Icon (round image) ── */
  .lotto-card-flag {

    width: 28px;
    height: 28px;
    border-radius: 50%;
        margin-right: 5px;
    object-fit: cover;
    border: 1px solid #fff;
    box-shadow: 0 1.5px 6px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    transform: scale(1.35);
    transform-origin: center;
    transition: transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
  }

.lotto-card-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    letter-spacing: 0.03em;
    color: #ffffff;
    text-shadow: none;
    font-variant-numeric: tabular-nums;
}

.button-after-result,
.button-calculation {
    flex: 1;
    border: none;
    background: linear-gradient(180deg, #f06060 0%, #dc3030 49%, #bd1515 51%, #a00b0b 100%);
    color: #ffffff;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.6);
    padding: var(--space-3) var(--space-5);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-top: 1px solid #e26161;
    box-shadow: inset 0 1px 0 rgba(255, 150, 150, 0.4);
    transition: background 0.1s, box-shadow 0.1s;
}

.button-after-result {
    border-right: 1px solid #8e0a0a;
}

.button-after-result:hover,
.button-calculation:hover {
    background: linear-gradient(180deg, #f87878 0%, #e64545 49%, #cc2121 51%, #b31414 100%);
}

.button-after-result:active,
.button-calculation:active {
    background: linear-gradient(180deg, #aa0e0e 0%, #7a0000 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}


  
  /* ══════════════════════════════════════════════
     LOTTO RESULTS GRID
     ══════════════════════════════════════════════ */

  /* ── Gap-as-border: parent bg shows through 1px gap as clean grid lines ── */
  .lotto-results {
    display: grid;
    gap: 1px;
    background: var(--border);
  }

  /* ── Thai Lottery: 3 rows ──
     Row 1: first prize (full width, featured)
     Row 2: เลขหน้า 3 ตัว | เลขท้าย 3 ตัว
     Row 3: เลขท้าย 2 ตัว (full width) */
  .lotto-results--thai {
    grid-template-columns: 1fr 1fr;
  }

  .lotto-results--thai .lotto-cell:first-child {
    grid-column: 1 / -1;
  }

  .lotto-results--thai .lotto-cell:last-child {
    grid-column: 1 / -1;
  }

  /* ── Normal Lottery: 1 row, 2 columns ── */
  .lotto-results--normal {
    grid-template-columns: 1fr 1fr;
  }

  /* ── Yeekee: 2 rows ── */
  .lotto-results--yeekee {
    grid-template-columns: 1fr 1fr;
  }

  .lotto-results--yeekee .lotto-cell:first-child {
    grid-column: 1 / -1;
  }


  /* ══════════════════════════════════════════════
     LOTTO CELL — Individual Result
     ══════════════════════════════════════════════ */

  .lotto-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-3) var(--space-3);
    background: var(--bg-secondary);
    position: relative;
    transition: background var(--duration-fast) var(--ease-out);
  }


  /* ── Featured Cell (first prize) ── */
  .lotto-cell--featured {
    padding: var(--space-6) var(--space-4);
    background: var(--gradient-brand-soft);
  }

  .lotto-cell--featured:hover {
    background: var(--gradient-brand-soft);
  }

  .lotto-cell--featured .lotto-cell-value {
    font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  /* ── Cell Label ── */
  .lotto-cell-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: var(--space-1);
    letter-spacing: 0.02em;
    text-transform: none;
  }

  .lotto-cell--featured .lotto-cell-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
  }

  /* ── Cell Value — Crimson & Gold Hero Numbers ── */
  .lotto-cell-value {
    font-family: 'Kanit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    background: var(--crimson-600);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.3;
  }

  .lotto-cell-value--blue {
    background: linear-gradient(135deg, var(--crimson-500), #dc2626);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  

  


  /* ── Card Footer ── */
  .lotto-card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--surface-inset);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--emerald-500);
    letter-spacing: 0.02em;
  }

  .lotto-card-footer i {
    font-size: 0.68rem;
  }

  



  .glass-panel {
    background: var(--surface-glass);
    backdrop-filter: var(--glass-blur-sm) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur-sm) var(--glass-saturate);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                border-color var(--duration-normal) var(--ease-out),
                background var(--duration-slow) var(--ease-out);
    position: relative;
  }

  /* subtle shine overlay */
  .glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-glass-shine);
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
  }

  .glass-panel:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--border-hover);
  }

  /* ─── Card Inner Elements ─── */
  .card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    z-index: 2;
    gap: var(--space-3);
  }

  .card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
  }

  .card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
    font-weight: 400;
  }

  /* ─── Badges ─── */
  .badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--success-bg);
    color: var(--emerald-500);
    border: 1px solid var(--success-border);
    white-space: nowrap;
    letter-spacing: 0.02em;
    flex-shrink: 0;
  }

  .badge-info {
    background: var(--info-bg);
    color: var(--sky-500);
    border-color: var(--info-border);
  }

  

  


  /* ─── Results ─── */
  .results-container {
    padding: var(--space-3) var(--space-5) var(--space-5);
    position: relative;
    z-index: 2;
  }

  .result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
    gap: var(--space-3);
  }

  .result-row:not(:last-child) {
    border-bottom: 1px dashed var(--border-subtle);
  }

  .result-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .result-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--orange-500);
    letter-spacing: 0.06em;
    text-align: right;
    flex-shrink: 0;
  }

  .result-value-blue {
    color: var(--sky-500);
  }

  

  


  /* ─── Empty Text ─── */
 .empty-text {
    color: #ff0000;
    font-size: 2rem;
    text-align: center;
    padding: var(--space-4);
  }


  /* ─── Footer ─── */
  .footer {
    border-top: 1px solid var(--border);
    padding: var(--space-8) 0;
    margin-top: var(--space-12);
    text-align: center;
    transition: border-color var(--duration-slow) var(--ease-out);
  }

  .footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.01em;
  }


  /* ═══════════════════════════════════════════════════════════════════════════
     PHASE 5 — API DOCS COMPONENTS
     ═══════════════════════════════════════════════════════════════════════════ */

  /* ─── API Header ─── */
  .header-api {
    position: sticky;
    top: 0;
    z-index: var(--z-modal);
    border-bottom: 1px solid var(--border);
    transition: border-color var(--duration-normal) var(--ease-out);
  }

  /* Glass effect on ::before — same reason as .navbar */
  .header-api::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--surface-glass);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    z-index: -1;
    transition: background var(--duration-normal) var(--ease-out);
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1440px;
    margin-inline: auto;
    padding: 0 var(--space-5);
    height: 70px;
    gap: var(--space-4);
  }

  .header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
  }

  .header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--gradient-brand);
    color: #ffffff;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
  }

  .header-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
  }

.header-version {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 1rem;
    margin-top: 0px;
    font-weight: 700;
    border-radius: var(--radius-full);
    background: var(--gradient-brand-soft);
    color: var(--orange-600);
    letter-spacing: 0.04em;
    border: 1px solid rgba(249, 115, 22, 0.15);
}
  

  /* ─── Header Nav ─── */
  .header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-normal) var(--ease-out);
    cursor: pointer;
    white-space: nowrap;
  }

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

  .nav-link.active {
    color: var(--orange-600);
    background: var(--gradient-brand-soft);
    font-weight: 600;
  }

  

  .nav-link span {
    display: inline-flex;
    font-size: 0.78rem;
  }

  /* ─── API Mobile Menu Button ─── */
 .api-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: background var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
}

  .api-mobile-menu-btn:hover {
    background: var(--surface-inset);
  }


  /* ─── Console & Doc Sections ─── */
  .console-section,
  .doc-section {
    display: none;
  }

  .console-section.active,
  .doc-section.active {
    display: block;
  }


  /* ─── Main Layout ─── */
  .main-container {
    max-width: 1440px;
    margin-inline: auto;
    padding: var(--space-5);
  }

  .layout-grid {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: var(--space-5);
    align-items: start;
  }


  /* ─── Sidebar ─── */
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    position: sticky;
    top: 78px;
  }


  /* ─── Request Section (Main Content) ─── */
  .request-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-width: 0;
  }


  /* ─── Panel (Reusable Card) ─── */
  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: background var(--duration-slow) var(--ease-out),
                border-color var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out);
  }

  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #f06060 0%, #dc3030 49%, #bd1515 51%, #a00b0b 100%);
    box-shadow: inset 0 1px 0 rgba(255, 150, 150, 0.4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid #7a0000;
    gap: var(--space-3);
  }

  .panel-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.6);
  }

  .panel-title .icon {
    color: #fcd34d;
    font-size: 0.82rem;
  }

  

  .panel-body {
    padding: var(--space-4);
  }


  /* ─── Panel Glow (accent line at top) ─── */
  .panel-glow {
    height: 2px;
    background: var(--gradient-accent-line);
    opacity: 0.7;
  }

  .network-info-panel {
    position: relative;
    overflow: hidden;
  }


  /* ─── IP Display ─── */
  .ip-display-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    gap: var(--space-2);
    transition: border-color var(--duration-normal) var(--ease-out),
                background var(--duration-slow) var(--ease-out);
  }

  .ip-display-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.03em;
  }

  .ip-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.78rem;
    transition: all var(--duration-normal) var(--ease-out);
    flex-shrink: 0;
  }

  .ip-copy-btn:hover {
    color: var(--orange-500);
    background: var(--gradient-brand-soft);
  }

  .ip-warning-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: var(--space-2);
  }

  .ip-warning-text i {
    color: var(--yellow-500);
    margin-right: 2px;
  }


  /* ─── Endpoint List ─── */
  .endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .endpoint-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    border-left: 3px solid transparent;
  }

  .endpoint-item:hover {
    background: var(--surface-inset);
  }

  .endpoint-item.active {
    background: linear-gradient(180deg, #6b9ee0 0%, #2f69cb 49%, #1f57b6 51%, #14408e 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0,0,0,0.2);
    border-color: #0c2a63;
  }

  .endpoint-item.active .endpoint-path {
    color: #ffffff;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.6);
  }

  .endpoint-item.active .endpoint-desc {
    color: rgba(255, 255, 255, 0.9);
  }

  .endpoint-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: var(--radius-xs);
    background: var(--success-bg);
    color: var(--emerald-500);
    border: 1px solid var(--success-border);
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }

  

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

  .endpoint-path {
    font-size: 0.72rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .endpoint-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
  }


  /* ─── History List ─── */
  .history-list {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .history-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
    border-bottom: 1px solid var(--border-subtle);
  }

  .history-item:hover {
    background: var(--surface-inset);
  }

  .history-item:last-child {
    border-bottom: none;
  }

  .history-status {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
  }

  .history-status.success {
    background: var(--emerald-500);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.40);
  }

  .history-status.error {
    background: var(--red-500);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.40);
  }

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

  .history-endpoint {
    font-size: 0.68rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .history-time {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 2px;
  }

  .history-empty {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
  }


  /* ─── URL Bar ─── */
  .url-bar {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
    transition: border-color var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                background var(--duration-slow) var(--ease-out);
  }

  .url-bar:focus-within {
    border-color: var(--orange-500);
    box-shadow: var(--shadow-sm), 0 0 0 3px rgba(249, 115, 22, 0.10);
  }

.url-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0 var(--space-4);
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    background: #0d5000;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    letter-spacing: 0.05em;
}

  

  .url-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--space-3) var(--space-4);
    font-size: 0.78rem;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
  }

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

  /* ─── Send Button ─── */
  .btn-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    margin: 5px;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #f06060 0%, #dc3030 49%, #bd1515 51%, #a00b0b 100%);
    box-shadow: inset 0 1px 0 rgba(255, 150, 150, 0.4), 0 1px 2px rgba(0,0,0,0.2);
    border: 1px solid #7a0000;
    color: #ffffff;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.6);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.1s;
    min-height: 36px;
    position: relative;
    overflow: hidden;
  }

  .btn-send:hover:not(:disabled) {
    background: linear-gradient(180deg, #f47a7a 0%, #e24242 49%, #c91919 51%, #b30f0f 100%);
  }

  .btn-send:active:not(:disabled) {
    background: linear-gradient(180deg, #a00b0b 0%, #bd1515 49%, #dc3030 51%, #f06060 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
  }

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

  .send-text,
  .spinner {
    position: relative;
    z-index: 1;
  }

  .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: var(--radius-full);
    animation: spin 0.7s linear infinite;
  }

  .btn-send.loading .send-text {
    display: none;
  }

  .btn-send.loading .spinner {
    display: block;
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }


  /* ─── Button Icon (small utility button) ─── */
  .btn-icon {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--duration-normal) var(--ease-out);
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .btn-icon:hover {
    color: var(--orange-500);
    border-color: var(--orange-500);
    background: var(--gradient-brand-soft);
  }

  .btn-icon.copied {
    color: var(--emerald-500);
    border-color: var(--emerald-500);
  }
  .btn-ios-red {
    background: linear-gradient(180deg, #f06060 0%, #dc3030 49%, #bd1515 51%, #a00b0b 100%);
    border: 1px solid #7a0000 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0,0,0,0.2) !important;
    color: #ffffff !important;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.5);
  }

  .btn-ios-green {
    background: linear-gradient(180deg, #a4e473 0%, #51c41a 49%, #3eb60c 51%, #35980b 100%);
    border: 1px solid #236506 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0,0,0,0.2) !important;
    color: #ffffff !important;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.5);
  }
  .btn-ios-green:hover {
    background: linear-gradient(180deg, #b5f584 0%, #62d52b 49%, #4fc71d 51%, #46a91c 100%);
    border-color: #236506 !important;
    color: #ffffff !important;
  }
  .btn-ios-green:active {
    background: linear-gradient(180deg, #35980b 0%, #3eb60c 49%, #51c41a 51%, #a4e473 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4) !important;
  }

  .btn-ios-blue {
    background: linear-gradient(180deg, #6b9ee0 0%, #2f69cb 49%, #1f57b6 51%, #14408e 100%);
    border: 1px solid #0c2a63 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0,0,0,0.2) !important;
    color: #ffffff !important;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.5);
  }
  .btn-ios-blue:hover {
    background: linear-gradient(180deg, #7caeff 0%, #407ada 49%, #3068c7 51%, #25519f 100%);
    border-color: #0c2a63 !important;
    color: #ffffff !important;
  }
  .btn-ios-blue:active {
    background: linear-gradient(180deg, #14408e 0%, #1f57b6 49%, #2f69cb 51%, #6b9ee0 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4) !important;
  }


  /* ─── Tabs ─── */
  .tabs-container {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-4);
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs-container::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    padding: var(--space-3) var(--space-4);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all var(--duration-normal) var(--ease-out);
    white-space: nowrap;
    margin-bottom: -1px;
  }

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

  .tab-btn.active {
    color: var(--orange-500);
    border-bottom-color: var(--orange-500);
    font-weight: 600;
  }

  

  .tab-content {
    display: none;
  }

  .tab-content.active {
    display: block;
  }


  /* ─── Params Form ─── */
  .params-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .param-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .param-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }

  .required {
    color: var(--red-500);
    font-weight: 700;
  }

  .param-input {
    padding: var(--space-2) var(--space-3);
    border: 1px solid;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.82rem;
    outline: none;
    transition: border-color var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                background var(--duration-slow) var(--ease-out);
    min-height: 50px;
  }

  .param-input:focus {
    border-color: var(--orange-500);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.10);
  }

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

  /* Select styling */
  select.param-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
  }

  .param-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
    padding-left: 2px;
  }


  /* ─── Response Panel ─── */
  .response-panel {
    display: flex;
    flex-direction: column;
  }

  .response-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
  }

  .response-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
  }

  .response-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
  }

  .response-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: currentColor;
    flex-shrink: 0;
  }

.response-badge.status-success {
        background: #fff;
    color: #228B22;
    border: 1px solid rgb(255 255 255 / 20%);
}

  .response-badge.status-warning {
        background: #fff;
    color: var(--yellow-500);
    border: 1px solid var(--warning-border);
  }

  .response-badge.status-error {
       background: #fff;
    color: var(--red-500);
    border: 1px solid var(--error-border);
  }

  .response-badge.time {
       background: #fff;
    color: #000000;
    border: 1px solid rgb(255 255 255 / 20%);
  }

  
  


  /* ─── JSON Output ─── */
  .response-body {
    flex: 1;
  }

  .json-output {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
    padding: var(--space-4);
    background: var(--surface-code);
    color: var(--slate-300);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    min-height: 200px;
    max-height: 1000px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--slate-600) transparent;
  }

  /* ── JSON Syntax Highlighting ── */
  .json-key     { color: #89b4fa; }
  .json-string  { color: #a6e3a1; }
  .json-number  { color: #fab387; }
  .json-boolean { color: #f38ba8; }
  .json-null    { color: #6c7086; font-style: italic; }


  /* ─── Empty State ─── */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-4);
    text-align: center;
  }

  .empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    background: var(--gradient-brand-soft);
    color: var(--orange-500);
    font-size: 1.3rem;
    margin-bottom: var(--space-4);
  }

  

  .empty-state-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #04ff05;
    margin-bottom: var(--space-2);
  }

  .empty-state-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
  }


  /* ═══════════════════════════════════════════════════════════════
     DOCUMENTATION SECTION
     ═══════════════════════════════════════════════════════════════ */

  .doc-section {
    max-width: 1200px;
    margin-inline: auto;
    padding: var(--space-8) var(--space-5);
  }

  .doc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }

  .doc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                background var(--duration-slow) var(--ease-out);
  }

  .doc-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
  }

  .doc-full {
    grid-column: 1 / -1;
  }

  .doc-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(180deg, #f06060 0%, #dc3030 49%, #bd1515 51%, #a00b0b 100%);
    box-shadow: inset 0 1px 0 rgba(255, 150, 150, 0.4);
    border-bottom: 1px solid #7a0000;
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.6);
  }

  .doc-card-header i {
    color: #fcd34d;
    font-size: 0.85rem;
  }

  

  .doc-card-body {
    padding: var(--space-5);
  }


  /* ─── Doc Table ─── */
  .doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
  }

  .doc-table th {
    text-align: left;
    font-weight: 650;
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    border-bottom: 2px solid var(--border);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .doc-table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: top;
  }

  .doc-table tr:last-child td {
    border-bottom: none;
  }

  .doc-table tr:hover td {
    background: var(--surface-inset);
  }

  .doc-table code {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    background: var(--surface-inset);
    border: 1px solid var(--border);
    color: var(--orange-500);
  }

  


  /* ─── Doc Code Block ─── */
  .doc-code-block {
    font-size: 0.76rem;
    line-height: 1.7;
    padding: var(--space-5);
    background: var(--surface-code);
    color: var(--slate-300);
    border-radius: var(--radius-md);
    overflow-x: auto;
    white-space: pre;
    scrollbar-width: thin;
    scrollbar-color: var(--slate-600) transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }


  /* ─── Status Badges (Doc) ─── */
  .badge-required {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--error-bg);
    color: var(--red-500);
    border: 1px solid var(--error-border);
    letter-spacing: 0.03em;
  }

  .badge-optional {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--surface-inset);
    color: var(--text-muted);
    border: 1px solid var(--border);
    letter-spacing: 0.03em;
  }

  


  /* ─── Status Dots (Response Codes Table) ─── */
  .status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    margin-right: 6px;
    vertical-align: middle;
  }

  .status-dot.green {
    background: var(--emerald-500);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.40);
  }

  .status-dot.red {
    background: var(--red-500);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.40);
  }

  .status-dot.yellow {
    background: var(--yellow-500);
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.40);
  }


  /* ═══════════════════════════════════════════════════════════════
     TOAST
     ═══════════════════════════════════════════════════════════════ */
div:where(.swal2-container) {
  backdrop-filter: blur(5px);
}
body.swal2-toast-shown .swal2-container.swal2-top {
  backdrop-filter: none !important;
}

.swal2-toast.swal2-show {
  transform-origin: center !important;
  animation: toast-gentle-expand 0.7s ease-out !important;
}

.swal2-toast.swal2-hide {
  transform-origin: center !important;
  animation: toast-gentle-collapse 0.6s ease-in forwards !important;
}

@keyframes toast-gentle-expand {
  0% {
    transform: scale(0.3) translateY(20px);
    opacity: 0;
    filter: brightness(1.5) blur(8px);
  }
  25% {
    transform: scale(1.05) translateY(-5px);
    opacity: 0.7;
    filter: brightness(1.2) blur(3px);
  }
  50% {
    transform: scale(0.97) translateY(2px);
    opacity: 0.9;
    filter: brightness(1) blur(1px);
  }
  75% {
    transform: scale(1.01) translateY(0);
    opacity: 1;
    filter: brightness(1) blur(0);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
    filter: brightness(1) blur(0);
  }
}

@keyframes toast-gentle-collapse {
  0% {
    transform: scale(1) translateY(0);
    opacity: 1;
    filter: brightness(1) blur(0);
  }
  20% {
    transform: scale(1.05) translateY(-8px);
    opacity: 0.9;
    filter: brightness(1.1) blur(2px);
  }
  50% {
    transform: scale(0.6) translateY(15px);
    opacity: 0.5;
    filter: brightness(1.3) blur(5px);
  }
  80% {
    transform: scale(0.2) translateY(30px);
    opacity: 0.2;
    filter: brightness(1.5) blur(8px);
  }
  100% {
    transform: scale(0) translateY(40px);
    opacity: 0;
    filter: brightness(2) blur(10px);
  }
}

body.swal2-toast-shown .swal2-container.swal2-top {
  margin-top: 80px;
}
.swal2-toast h2:where(.swal2-title) {
  margin: 0.5em 0.5em !important;
}
body.swal2-toast-shown div:where(.swal2-icon) {
  border-color: transparent !important;
}
.toast-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
div:where(.swal2-icon).swal2-success .swal2-success-ring {
  border-color: #00b600 !important;
}

div:where(.swal2-icon).swal2-success [class^='swal2-success-line'] {
  background-color: #00b600 !important;
}

div:where(.swal2-icon).swal2-error [class^='swal2-x-mark-line'] {
  background-color: #ff0000 !important;
}

div:where(.swal2-icon).swal2-warning {
  border-color: #ff9800 !important;
  color: #ff9800 !important;
}
div:where(.swal2-icon).swal2-info {
  border-color: #2196f3 !important;
  color: #2196f3 !important;
}
div:where(.swal2-icon).swal2-question {
  border-color: #9c27b0 !important;
  color: #9c27b0 !important;
}

body.swal2-toast-shown div:where(.swal2-container) h2:where(.swal2-title) {
  padding-top: 2px;
  font-size: 1rem !important;
  font-weight: 600 !important;
  text-transform: none;
  overflow-wrap: break-word;
  cursor: grab;
}

.swal2-toast {
  width: auto !important;
  max-width: none !important;
  box-sizing: border-box;
  grid-column: 1 / 4 !important;
  grid-row: 1 / 4 !important;
  grid-template-columns: min-content auto min-content;
  padding: 0.5rem 0.5rem 0.5rem 1rem !important;
  overflow-y: hidden;
  pointer-events: all;

  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0.35)
  ) !important;
  backdrop-filter: blur(18px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(180%) !important;
  border-radius: 18px !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  color: rgba(0, 0, 0, 0.85) !important;
}

.swal2-toast .swal2-icon {
    grid-column: 1;
    grid-row: 1 / 99;
    align-self: center;
    width: 2em;
    min-width: 2em;
    height: 2em;
    margin: 0px !important;
}

body.swal2-toast-shown .swal2-container {
  width: auto !important;
}
@media (max-width: 576px) {
  body.swal2-toast-shown .swal2-container {
    width: 100% !important;
  }
}

div:where(.swal2-container) div:where(.swal2-popup) {
  color: #000000 !important;
  border-radius: 15px !important;
}

div:where(.swal2-container) h2:where(.swal2-title) {
  font-size: 1.3em !important;
  font-weight: 600;
  text-align: center;
  text-transform: none;
  overflow-wrap: break-word;
  cursor: initial;
}

div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm) {
  border-radius: var(--swal2-confirm-button-border-radius);
  background: initial;
  background-color: #e32321 !important;
  box-shadow: var(--swal2-confirm-button-box-shadow);
  color: var(--swal2-confirm-button-color);
  font-size: 1em;
  border-radius: 20px !important;
}

div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel) {
  border-radius: var(--swal2-cancel-button-border-radius);
  background: initial;
  background-color: var(--swal2-cancel-button-background-color);
  box-shadow: var(--swal2-cancel-button-box-shadow);
  color: var(--swal2-cancel-button-color);
  font-size: 1em;
  border-radius: 20px !important;
}

div:where(.swal2-container)
  button:where(.swal2-styled):where(.swal2-confirm):hover {
  background-color: #c11e1c !important;
}

} /* end @layer components */


/* ═══════════════════════════════════════════════════════════════════════════════
   PHASE 6 — MICRO-ANIMATIONS & POLISH
   ═══════════════════════════════════════════════════════════════════════════════ */
@layer utilities {

  /* ─── Reduced Motion ─── */
  @media (prefers-reduced-motion: reduce) {
    *:not(.loader):not(.loader-container):not(.modal-overlay):not(.modal-content):not(.fa-spin):not(.fa-spinner), *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }

    .blob { animation: none !important; opacity: var(--blob-opacity); }
  }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   PHASE 7 — RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────
   XL Desktop (≥ 1280px)
   ───────────────────────────────── */
@media (min-width: 1280px) {
  .layout-grid {
    grid-template-columns: 310px 1fr;
    gap: var(--space-6);
  }
}


/* ─────────────────────────────────
   Tablet & Below (≤ 1024px)
   ───────────────────────────────── */
@media (max-width: 1024px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
  }

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

  .doc-full {
    grid-column: 1;
  }
}


/* ─────────────────────────────────
   Mobile (≤ 768px)
   ───────────────────────────────── */
@media (max-width: 768px) {

  /* ── Navbar: not sticky on mobile (prevents floating over content) ── */
  /* Also elevate z-index above overlay (9000) so drawers inside are clickable */
  .navbar,
  .header-api {
    position: relative;
    z-index: 9002;
  }

  /* Remove glass blur on mobile — causes iOS rendering issues with fixed drawers */
  .navbar::before,
  .header-api::before {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg-primary);
  }

  /* ── Mobile Drawer Shared ── */
  .mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
  }

  .mobile-drawer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
  }

  .mobile-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--surface-inset);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background var(--duration-fast) var(--ease-out),
                color var(--duration-fast) var(--ease-out);
  }

  .mobile-drawer-close:hover,
  .mobile-drawer-close:active {
    background: var(--gradient-brand-soft);
    color: var(--orange-500);
  }

  /* ── Homepage Navbar ── */
  .mobile-menu-btn {
    display: flex;
  }

  .nav-actions {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100dvh;
    background: var(--bg-primary);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-5);
    gap: var(--space-2);
    z-index: 9001;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-actions.open {
    transform: translateX(0);
  }

  .nav-link-btn {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    justify-content: flex-start;
  }

  .theme-toggle {
    align-self: flex-start;
    margin-top: var(--space-4);
  }

  /* ── API Page Header Nav ── */
  .api-mobile-menu-btn {
    display: flex;
  }

  .header-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100dvh;
    background: var(--bg-primary);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-5);
    gap: var(--space-2);
    z-index: 9001;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .header-nav.open {
    transform: translateX(0);
  }

  .nav-link {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    justify-content: flex-start;
  }

  /* ── Hero ── */
  .hero {
    padding: var(--space-10) var(--space-4) var(--space-8);
  }

  /* ── Grid ── */
  .grid,
  .grid--yeekee {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* ── Layout ── */
  .main-container {
    padding: var(--space-4);
  }

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

  /* ── URL Bar ── */
  .url-bar {
    flex-wrap: wrap;
  }

  .url-method {
    border-right: none;
    border-bottom: 1px solid var(--border);
    width: 100%;
    justify-content: center;
    padding: var(--space-2);
  }

  .url-input {
    width: 100%;
    font-size: 0.72rem;
  }

  .btn-send {
    width: 100%;
    margin: var(--space-1);
    justify-content: center;
  }

  /* ── Tabs ── */
  .tabs-container {
    padding: 0 var(--space-3);
  }

  /* ── Doc Section ── */
  .doc-section {
    padding: var(--space-5) var(--space-4);
  }

  .doc-grid {
    gap: var(--space-4);
  }

  .doc-card-header {
    padding: var(--space-3) var(--space-4);
    font-size: 0.82rem;
  }

  .doc-card-body {
    padding: var(--space-3) var(--space-4);
  }

  .doc-table {
    font-size: 0.72rem;
  }

  .doc-table th,
  .doc-table td {
    padding: var(--space-2);
  }

  /* ── Doc Table Responsive Scroll ── */
  .doc-card-body:has(.doc-table) {
    overflow-x: auto;
  }

  .doc-code-block {
    font-size: 0.68rem;
    padding: var(--space-3) var(--space-4);
  }

  /* ── JSON Output ── */
  .json-output {
    font-size: 0.68rem;
    max-height: 1000px;
    padding: var(--space-3);
  }

  /* ── Toast ── */
  .toast {
    left: var(--space-4);
    right: var(--space-4);
    transform: translateY(20px);
    text-align: center;
    font-size: 0.78rem;
    white-space: normal;
  }

  .toast.show {
    transform: translateY(0);
  }

  /* ── Response badges wrap ── */
  .response-meta {
    gap: var(--space-1);
  }

  .panel-header {
    flex-wrap: wrap;
  }

  /* ── Performance: disable heavy animations on mobile ── */
  #particle-canvas {
    display: none;
  }

  .blob {
    animation: none !important;
    filter: blur(80px);
    opacity: 0.15;
  }
}


/* ─────────────────────────────────
   Small Mobile (≤ 480px)
   ───────────────────────────────── */
@media (max-width: 480px) {
  .nav-inner {
    height: 70px;
  }

  .header-inner {
    height: 70px;
    padding: 0 var(--space-3);
  }

  .logo {
    font-size: 1.1rem;
    gap: var(--space-2);
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .header-logo {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }

  .header-title {
    font-size: 1.5rem;
  }

  .hero h1 {
    font-size: clamp(1.4rem, 1rem + 2vw, 2rem);
  }

  .hero p {
    font-size: 0.85rem;
  }

  .glass-panel {
    border-radius: var(--radius-lg);
  }

  .card-header {
    padding: var(--space-4);
  }

  .results-container {
    padding: var(--space-2) var(--space-4) var(--space-4);
  }

  .result-value {
    font-size: 0.92rem;
  }

  /* ── Lotto Card Small Mobile ── */
  .lotto-card {
    border-radius: var(--radius-lg);
  }

  .lotto-card-header,
  .panel-header {
    padding: var(--space-2) var(--space-4);
  }

  .button-after-result,
  .button-calculation {
    padding: var(--space-2) var(--space-4);
  }

  .lotto-card-name {
    font-size: 1rem;
  }

  .lotto-card-flag {
    width: 20px;
    height: 20px;
    transform: scale(1.35);
  }

  .lotto-card-badge {
    font-size: 0.8rem;
    padding: 2px 7px;
  }

  .lotto-cell {
    padding: var(--space-4) var(--space-3);
  }

  .lotto-cell--featured {
    padding: var(--space-5) var(--space-3);
  }

  .lotto-cell-value {
    font-size: 1.35rem;
  }

  .container {
    padding-inline: var(--space-4);
  }

  .nav-actions,
  .header-nav {
    width: 100vw;
    max-width: 280px;
  }
}

/* ── SPA Page View Transitions ── */
.page-view {
  display: none;
  animation: fadeIn 0.4s var(--ease-out) forwards;
}
.page-view.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}



/* ================================ */
/*    Loader Animation       */
/* ================================ */

/* เพิ่ม Container เพื่อจัดกลุ่มและจัดกึ่งกลาง */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    height: 0px;
    margin: 15px;
}

.loader {
  width: 3px;
  height: 20px;
  border-radius: 1px; /* ปรับให้โค้งมนเท่ากัน */
  background-color: rgb(255, 0, 0);
  display: inline-block;
  animation: loader-bounce 1s ease-in-out infinite;
}

/* ใส่ delay ให้แต่ละเส้นเต้นสลับกัน */
.l1 { animation-delay: 0s; }
.l2 { animation-delay: 0.1s; }
.l3 { animation-delay: 0.2s; }
.l4 { animation-delay: 0.3s; }
.l5 { animation-delay: 0.4s; }
.l6 { animation-delay: 0.5s; }
.l7 { animation-delay: 0.6s; }


@keyframes loader-bounce {
  0%, 100% {
    transform: scaleY(1);
    background-color: rgb(235, 29, 29);
  }
  50% {
    transform: scaleY(0.15);
    background-color: rgba(235, 29, 29, 0.15);
  }
}


/* ========================================================== */
/* ========================================================== */

/* Neon Shimmer for headers instead of gold */


@keyframes neon-shimmer {
  0%   { left: -100%; opacity: 0; }
  50%  { left: 50%; opacity: 1; box-shadow: 0 0 20px rgba(255, 26, 53, 0.5); }
  100% { left: 150%; opacity: 0; }
}

/* Subtle neon breathing for badges */


@keyframes neon-pulse {
  0% {
    box-shadow: inset 0 0 10px rgba(255, 26, 53, 0.1), 0 0 2px rgba(255, 26, 53, 0.1);
  }
  100% {
    box-shadow: inset 0 0 15px rgba(255, 26, 53, 0.25), 0 0 10px rgba(255, 26, 53, 0.4);
  }
}

/* ========================================================== */
/*    LOTTERY CHECKER UI                                      */
/* ========================================================== */

.lotto-check-panel {
  width: 100%;
  min-width: 0;
}

.lotto-check-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  min-width: 0;
}

.input-group-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  width: 100%;
  min-width: 0;
}

.lotto-input {
    flex: 1 1 0%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    text-align: center;
    font-size: 1.7rem;
    font-weight: 700;
    padding: 0 var(--space-3);
    height: 48px;
    color: var(--crimson-600);
        border: 1px solid;
}

@media (min-width: 480px) {
    .lotto-input {
        min-width: 140px;
    }
}



.lotto-input:placeholder-shown {
    font-size: 0.95rem;
    font-weight: 500;
}

.lotto-input::placeholder {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--slate-500);
}






.check-summary-box {
  background: var(--surface-inset);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  margin-bottom: var(--space-5);
  border: 1px solid var(--border-subtle);
}

.check-summary-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.check-summary-amount {
  font-size: 1.25rem;
  font-weight: 800;
}

.check-summary-amount.text-success {
  color: var(--emerald-600);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}



.check-ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--space-4);
}

.check-ticket-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast);
  overflow: hidden;
  min-width: 0;
}

.check-ticket-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.check-ticket-card.won {
  border-color: var(--emerald-500);
  background: rgba(16, 185, 129, 0.05);
}

.check-ticket-card.lost {
  opacity: 0.8;
}

.ticket-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ticket-status {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--text-muted);
}

.check-ticket-card.won .ticket-status {
  color: var(--emerald-600);
}



.ticket-prizes {
  border-top: 1px dashed var(--border-subtle);
  padding-top: var(--space-2);
  margin-top: var(--space-2);
}

.prize-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 0.9rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-2);
}

.prize-item:last-child {
  border-bottom: none;
}

.prize-details {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.draw-date-name {
  font-size: 0.75rem;
  font-weight: 400;
  color: red;
}

.prize-name {
  color: var(--text-primary);
}

.prize-amount {
  font-weight: 700;
  color: var(--emerald-600);
  flex-shrink: 0;
  white-space: nowrap;
}



/* ========================================================== */
/*    MODAL SYSTEM                                            */
/* ========================================================== */

@keyframes modalOverlayIn {
  0% {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

@keyframes modalOverlayOut {
  from {
    opacity: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  to {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
}

@keyframes modalContentIn {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(15px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalContentOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.95) translateY(15px);
  }
}

.modal-overlay {
  display: flex;
  visibility: hidden;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  padding: var(--space-4);
  overscroll-behavior: contain;
}

.modal-overlay.open {
  visibility: visible;
  pointer-events: auto;
  animation: modalOverlayIn 0.3s ease-out forwards;
}

.modal-overlay.closing {
  animation: modalOverlayOut 0.2s ease-in forwards;
}

.modal-content {
  background: var(--bg-primary);
  border: none;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.1);
  transform: scale(0.95) translateY(15px);
  opacity: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.modal-overlay.open .modal-content {
  animation: modalContentIn 0.3s ease-out forwards;
}

.modal-overlay.closing .modal-content {
  animation: modalContentOut 0.2s ease-in forwards;
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid #7a0000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #f06060 0%, #dc3030 49%, #bd1515 51%, #a00b0b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 150, 150, 0.4);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 -1px 1px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  line-height: 1.2;
}

.modal-title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform: translateY(-2px);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--duration-fast);
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.modal-close-btn:hover {
  background: transparent;
  opacity: 0.7;
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overscroll-behavior: contain;
}

/* Customize scrollbar inside modal body */
.modal-body::-webkit-scrollbar {
  width: 8px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}

.top-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-10);
}

.lotto-100-container {
    grid-column: 1 / -2;
}

@media (max-width: 768px) {
    .lotto-100-container {
        grid-column: 1 / -1;
    }
}
/* ═════════ Backward Modal UI Improvements ═════════ */
.bw-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.bw-card-header {
    font-weight: 800;
    color: var(--crimson-600);
    font-size: 1.1rem;
    margin-bottom: var(--space-3);
    border-bottom: 2px solid var(--surface-inset);
    padding-bottom: var(--space-2);
}
.bw-prize-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.bw-prize-badge {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    display: inline-flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.bw-prize-badge.primary {
    background: rgba(225, 29, 72, 0.04);
    border-color: rgba(225, 29, 72, 0.2);
}
.bw-prize-badge.primary .bw-prize-label {
    color: var(--crimson-600);
    font-weight: 600;
}
.bw-prize-badge.primary .bw-prize-val {
    color: var(--crimson-700);
}
.bw-prize-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}
.bw-prize-val {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
    letter-spacing: 1px;
}
.bw-yk-round-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-subtle);
}
.bw-yk-round-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.bw-yk-round-label {
    width: 65px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-secondary);
    background: var(--surface-inset);
    text-align: center;
    padding: 6px 0;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.bw-yk-prize-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-grow: 1;
}
.bw-thai-prize-group {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.bw-thai-prize-group-header {
    background: var(--surface-inset);
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 700;
    border-bottom: 1px solid var(--border-subtle);
}
.bw-thai-prize-group-body {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.8;
    letter-spacing: 1.5px;
    word-break: normal;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
}

/* Force lock body scroll on mobile */
body[style*="overflow: hidden"] {
    touch-action: none !important;
    overscroll-behavior: none !important;
}

body[style*="overflow: hidden"] .modal-body {
    touch-action: auto !important;
    overscroll-behavior: contain !important;
}
