﻿/* ═══════════════════════════════════════════════════════════════
   BHUTAN LOTTERY LTD. — Design System & Component Library
   Version: 2.1.0 | Updated: 2026-05-21
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS CUSTOM PROPERTIES (Design Tokens) ─── */
:root {
    --primary: #22963f;
    --primary-light: #34b85a;
    --primary-dim: rgba(34, 150, 63, 0.09);
    --primary-hover: #1c7d34;
    --primary-glow: rgba(34, 150, 63, 0.28);
    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.12);
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --info: #3b82f6;
    --info-dim: rgba(59, 130, 246, 0.12);
    --accent: #f97316;
    --accent-light: #fb923c;
    --accent-dark: #c2530a;
    --accent-dim: rgba(249, 115, 22, 0.18);
    --accent-mid: rgba(249, 115, 22, 0.35);
    --accent-glow: rgba(249, 115, 22, 0.40);
    --text: #111827;
    --text-secondary: #374151;
    --muted: #6b7280;
    --muted2: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --surface: #ffffff;
    --surface2: #f9fafb;
    --surface3: #f3f4f6;
    --surface-elevated: #ffffff;
    --font-sans: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', 'SF Mono', 'Consolas', monospace;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.02);
    --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
    --shadow-xl: 0 16px 48px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.06);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-base: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --max-content-width: 1400px;
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-sidebar: 250;
    --z-backdrop: 240;
    --z-drawer: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #f9fafb;
        --text-secondary: #e5e7eb;
        --muted: #9ca3af;
        --muted2: #6b7280;
        --border: #374151;
        --border-light: #4b5563;
        --surface: #111827;
        --surface2: #1f2937;
        --surface3: #374151;
        --surface-elevated: #1f2937;
        --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
        --shadow-md: 0 4px 12px rgba(0,0,0,.4);
        --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
    }
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text);
    background: var(--surface2);
    overflow-x: hidden;
}

    body.sidebar-open {
        overflow: hidden;
    }

.skip-link {
    position: absolute;
    top: -48px;
    left: var(--space-4);
    background: var(--primary);
    color: white;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    z-index: 10000;
    transition: top var(--transition-base);
    text-decoration: none;
    box-shadow: var(--shadow-lg);
}

    .skip-link:focus {
        top: var(--space-4);
        outline: 2px solid white;
        outline-offset: 2px;
    }

.app {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow: hidden;
}

.nav {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #132e1c 0%, #1e4a2b 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

    .nav::-webkit-scrollbar {
        width: 4px;
    }

    .nav::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.15);
        border-radius: var(--radius-full);
    }

.nav-close {
    display: none;
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: rgba(255,255,255,.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    z-index: 1;
    flex-shrink: 0;
}

    .nav-close:hover {
        background: rgba(255,255,255,.2);
    }

.nav-logo {
    padding: var(--space-6) var(--space-5) var(--space-5);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav-logo-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: white;
}

.nav-logo-dot {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: var(--radius-full);
    box-shadow: 0 0 8px rgba(34,185,79,.7);
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .7;
        transform: scale(.85);
    }
}

.nav-logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,.5);
    margin-top: var(--space-1);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.nav-section {
    padding: var(--space-5) var(--space-5) var(--space-2);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,.4);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    margin: 2px var(--space-3);
    border-radius: var(--radius-md);
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    user-select: none;
}

    .nav-item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        opacity: 0.7;
        transition: opacity var(--transition-fast);
    }

    .nav-item:hover {
        background: rgba(255,255,255,.06);
        color: white;
    }

        .nav-item:hover svg {
            opacity: 1;
        }

    .nav-item:focus-visible {
        outline: 2px solid var(--success);
        outline-offset: 2px;
    }

    .nav-item.active {
        background: linear-gradient(90deg, rgba(249,115,22,.15) 0%, rgba(255,255,255,.05) 100%);
        color: white;
        font-weight: 600;
        border-left: 3px solid var(--accent);
        margin-left: var(--space-3);
        padding-left: calc(var(--space-5) - 3px);
    }

        .nav-item.active::before {
            display: none;
        }

        .nav-item.active svg {
            opacity: 1;
            color: var(--accent-light);
        }

.nav-badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 22px;
    text-align: center;
}

.nav-footer {
    margin-top: auto;
    padding: var(--space-4) var(--space-5);
    border-top: none;
    background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.35) 100%);
    position: relative;
}

    .nav-footer::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, transparent 0%, rgba(249,115,22,.9) 40%, rgba(249,115,22,.9) 60%, transparent 100%);
    }

    .nav-footer::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(249,115,22,.07) 0%, transparent 65%);
        pointer-events: none;
    }

.nav-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(249,115,22,.25), 0 2px 10px var(--accent-glow);
}

.profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(249,115,22,.20), 0 4px 16px var(--accent-glow);
    user-select: none;
}

.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 769px) {
    .nav {
        width: var(--sidebar-width);
        right: auto;
        overflow: hidden;
    }

    .content {
        margin-left: var(--sidebar-width);
    }
}

.topbar {
    height: var(--topbar-height);
    background: rgba(255,255,255,.92);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 var(--border), inset 0 -2px 0 0 transparent;
}

    .topbar::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 30%, var(--accent) 70%, transparent 100%);
        opacity: 0.85;
    }

@media (prefers-color-scheme: dark) {
    .topbar {
        background: rgba(17,24,39,.92);
    }
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1.2;
}

.ib {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

    .ib:hover {
        background: var(--surface2);
        border-color: var(--muted2);
        color: var(--text);
        transform: translateY(-1px);
    }

    .ib:active {
        transform: translateY(0);
    }

    .ib:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    .ib svg {
        width: 20px;
        height: 20px;
    }

.icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm);
    pointer-events: none;
}

.cart-badge {
    background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding: var(--space-3) var(--space-4) var(--space-6);
    background: var(--surface2);
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

    .page.active {
        display: block;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

    .card:hover {
        box-shadow: var(--shadow-md);
    }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.card-hint {
    font-size: 13px;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 55%, var(--accent-dark) 100%);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: none;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px var(--accent-glow), 0 1px 2px rgba(0,0,0,.08);
}

.card-body {
    padding: var(--space-6);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

    .stat::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--primary) 0%, var(--accent-light) 60%, var(--accent-dark) 100%);
        opacity: 0;
        transition: opacity var(--transition-base);
    }

    .stat:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lg);
    }

        .stat:hover::before {
            opacity: 1;
        }

    .stat::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--primary) 0%, var(--accent-light) 60%, var(--accent-dark) 100%);
        opacity: 0.45;
        transition: opacity var(--transition-base);
    }

    .stat:hover::after {
        opacity: 1;
    }

.stat-icon {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

    .stat-icon.green {
        background: var(--primary-dim);
        color: var(--primary);
    }

    .stat-icon.orange {
        background: var(--accent-dim);
        color: var(--accent);
    }

    .stat-icon.blue {
        background: var(--info-dim);
        color: var(--info);
    }

.stat-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.stat-val {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

    .stat-val.green {
        color: var(--primary);
    }

    .stat-val.blue {
        color: var(--info);
    }

    .stat-val.gold {
        color: var(--warning);
    }

    .stat-val.orange {
        color: var(--accent-dark);
    }

.stat-sub {
    font-size: 14px;
    color: var(--muted);
    margin-top: var(--space-2);
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

    .btn::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(255,255,255,.15) 0%, transparent 100%);
        opacity: 0;
        transition: opacity var(--transition-fast);
        pointer-events: none;
    }

    .btn:hover::after {
        opacity: 1;
    }

    .btn:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    .btn:disabled, .btn.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none !important;
        box-shadow: none !important;
    }

    .btn svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(26,122,60,.2);
}

    .btn-primary:hover:not(:disabled) {
        background: var(--primary-hover);
        border-color: var(--primary-hover);
        box-shadow: 0 4px 16px rgba(34,150,63,.35);
        transform: translateY(-1px);
    }

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
    box-shadow: 0 1px 3px rgba(34,197,94,.2);
}

    .btn-success:hover:not(:disabled) {
        background: #16a34a;
        border-color: #16a34a;
        box-shadow: 0 4px 16px rgba(34,197,94,.35);
        transform: translateY(-1px);
    }

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

    .btn-danger:hover:not(:disabled) {
        background: #dc2626;
        border-color: #dc2626;
        box-shadow: 0 4px 16px rgba(239,68,68,.35);
        transform: translateY(-1px);
    }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

    .btn-ghost:hover:not(:disabled) {
        background: var(--surface2);
        border-color: var(--muted2);
        color: var(--text);
    }

.btn-outline {
    background: linear-gradient(135deg, rgba(255,248,243,1) 0%, rgba(255,240,230,1) 100%);
    color: var(--accent-dark);
    border-color: var(--accent);
    border-width: 1.5px;
    box-shadow: 0 1px 4px rgba(249,115,22,.12);
}

    .btn-outline:hover:not(:disabled) {
        background: var(--accent);
        color: white;
        border-color: var(--accent-dark);
        box-shadow: 0 4px 16px var(--accent-glow);
        transform: translateY(-1px);
    }

#btnAddFunds {
    gap: 5px;
    min-width: 0;
    max-width: 160px;
    overflow: hidden;
    position: relative;
}

.funds-btn-label {
    display: flex;
    align-items: center;
    gap: 2px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: -0.01em;
    transition: opacity var(--transition-fast);
}

#btnAddFunds::before {
    content: 'Add Funds';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: white;
    background: var(--accent);
    border-radius: calc(var(--radius-md) - 1px);
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
    letter-spacing: 0.01em;
}

#btnAddFunds:hover::before {
    opacity: 1;
}

#btnAddFunds:hover .funds-btn-label {
    opacity: 0;
}

#btnAddFunds:hover svg {
    opacity: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

    .btn-sm svg {
        width: 14px;
        height: 14px;
    }

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

.btn-full {
    width: 100%;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5) var(--space-5);
    padding: var(--space-5);
    padding-bottom: 220px;
    overflow: visible;
}

.game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    min-height: 160px;
    background-size: cover;
    background-position: center;
}

    .game-card::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.15) 100%);
        border-radius: inherit;
        z-index: 0;
    }

    .game-card::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 3px;
        background: repeating-linear-gradient(to bottom, transparent 0, transparent 8px, rgba(255,255,255,0.25) 8px, rgba(255,255,255,0.25) 14px);
        z-index: 1;
    }

    .game-card > * {
        position: relative;
        z-index: 2;
    }

    .game-card:hover {
        border-color: rgba(255,255,255,0.3);
        box-shadow: 0 8px 32px rgba(0,0,0,0.3);
        transform: translateY(-3px);
    }

    .game-card:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

.game-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.game-draw {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    font-family: var(--font-mono);
    font-weight: 500;
}

.game-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px 12px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: var(--space-4);
    backdrop-filter: blur(4px);
}

    .game-badge::before {
        content: '';
        width: 6px;
        height: 6px;
        background: var(--success);
        border-radius: var(--radius-full);
        animation: pulse-dot 2s ease-in-out infinite;
    }

.game-prize-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    transform: translateY(-6px);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    padding: 14px 16px;
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

    .game-prize-tooltip::after {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 32px;
        border: 7px solid transparent;
        border-bottom-color: var(--border);
    }

    .game-prize-tooltip::before {
        content: '';
        position: absolute;
        bottom: calc(100% - 1px);
        left: 32px;
        border: 7px solid transparent;
        border-bottom-color: var(--surface);
        z-index: 1;
    }

    .game-card:hover .game-prize-tooltip, .game-card:focus-within .game-prize-tooltip, .game-prize-tooltip.prize-visible {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

.prize-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 10px var(--space-5);
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

    .prize-row:last-child {
        border-bottom: none;
    }

.prize-tooltip-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 12px var(--space-5) 8px;
    border-bottom: 1px solid var(--border-light);
}

.prize-rank {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.prize-rank-badge {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

    .prize-rank-badge.r1 {
        background: #fff3cd;
        color: #92610a;
    }

    .prize-rank-badge.r2 {
        background: #f0f0f0;
        color: #555;
    }

    .prize-rank-badge.r3 {
        background: #fde8e0;
        color: #b44;
    }

    .prize-rank-badge.rx {
        background: var(--surface2);
        color: var(--muted);
    }

.prize-amount {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.prize-winners {
    font-size: 11px;
    color: var(--muted2);
    white-space: nowrap;
}

.prize-kind {
    color: var(--accent-dark) !important;
    font-size: 12px !important;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: normal;
    text-align: right;
    max-width: 160px;
}

.prize-tooltip-loading {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    padding: 8px 0;
}

@media (max-width: 640px) {
    .game-prize-tooltip {
        left: 0;
        right: 0;
        max-width: 100%;
    }
}

.tickets-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.bundle-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}

.bundle-btn {
    padding: 8px 16px;
    background: var(--surface3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .bundle-btn svg {
        flex-shrink: 0;
        transition: transform var(--transition-fast);
    }

    .bundle-btn:hover svg {
        transform: rotate(180deg);
    }

    .bundle-btn:hover {
        background: var(--accent);
        border-color: var(--accent-dark);
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px var(--accent-glow);
    }

    .bundle-btn:active {
        transform: translateY(0);
    }

    .bundle-btn:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    width: 100%;
}

    .tickets-grid .empty-state, .tickets-grid > div[style*="grid-column"] {
        grid-column: 1 / -1;
        width: 100%;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 24px;
    }

.ticket-btn {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    padding: var(--space-1);
}

    .ticket-btn:hover:not(.sold):not(.selected):not(.processing) {
        border-color: var(--primary-light);
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
        color: var(--primary);
    }

    .ticket-btn:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    .ticket-btn.selected {
        background: var(--primary);
        border-color: var(--primary);
        color: white;
        box-shadow: 0 4px 16px rgba(26,122,60,.35);
        transform: translateY(-2px);
    }

        .ticket-btn.selected small {
            color: rgba(255,255,255,.85);
        }

    .ticket-btn.sold {
        background: var(--surface3);
        border-color: var(--border-light);
        color: var(--muted);
        cursor: not-allowed;
        opacity: 0.6;
    }

        .ticket-btn.sold::after {
            content: '';
            position: absolute;
            inset: 0;
            background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0,0,0,.04) 5px, rgba(0,0,0,.04) 10px);
            border-radius: inherit;
            pointer-events: none;
        }

    .ticket-btn.processing {
        opacity: 0.5;
        pointer-events: none;
    }

        .ticket-btn.processing::after {
            content: '';
            position: absolute;
            width: 20px;
            height: 20px;
            border: 2px solid transparent;
            border-top-color: currentColor;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

    .ticket-btn.just-sold {
        background: var(--danger) !important;
        color: #fff !important;
        border-color: var(--danger) !important;
        cursor: not-allowed;
        pointer-events: none;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.04em;
        animation: sold-appear 0.3s ease;
    }

@keyframes sold-appear {
    0% {
        transform: scale(1.08);
        opacity: 0.6;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes sold-flash {
    0% {
        background: var(--danger);
        color: #fff;
        border-color: var(--danger);
        transform: scale(1.05);
    }

    50% {
        opacity: .6;
    }

    100% {
        opacity: 0;
    }
}

.ticket-sold-flash {
    animation: sold-flash .5s ease-out forwards;
    pointer-events: none;
}

.ticket-btn small {
    font-size: 9px;
    font-weight: 500;
    opacity: 0.75;
    margin-top: 2px;
    font-family: var(--font-sans);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.cart-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-drawer);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

    .cart-drawer-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 90vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
}

    .cart-drawer.open {
        transform: translateX(0);
    }

@media (max-width: 768px) {
    .cart-drawer {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        max-height: 60vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform var(--transition-slow);
        box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    }

        .cart-drawer.open {
            transform: translateY(0);
        }

    .cart-drawer-header::before {
        content: '';
        display: block;
        width: 32px;
        height: 3px;
        background: var(--border);
        border-radius: 2px;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
    }

    .cart-drawer-header {
        padding-top: 22px;
        padding-bottom: var(--space-3);
        position: relative;
    }

    .cart-drawer-title {
        font-size: 15px;
    }

    .cart-drawer-body {
        padding: var(--space-3);
    }

    .cart-drawer-item {
        padding: 8px 10px;
    }
}

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cart-drawer-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.cart-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

    .cart-drawer-close:hover {
        background: var(--surface3);
        color: var(--text);
    }

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    -webkit-overflow-scrolling: touch;
}

.cart-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
    padding: var(--space-10);
    gap: var(--space-2);
}

.cart-empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

.cart-item-remove {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

    .cart-item-remove:hover {
        background: var(--danger-dim);
        color: var(--danger);
    }

    .cart-item-remove:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

.cart-drawer-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 8px var(--space-3);
    background: var(--surface2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    transition: all var(--transition-fast);
}

    .cart-drawer-item:hover {
        border-color: var(--border);
        background: var(--surface3);
    }

.cart-drawer-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.cart-drawer-item-no {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.cart-drawer-item-game {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    margin-left: auto;
}

.cart-drawer-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
    margin-top: 4px;
}

    .cart-drawer-total span:first-child {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-secondary);
    }

.cart-drawer-total-amt {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

    .overlay.open {
        opacity: 1;
        visibility: visible;
    }

.mbox {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-slow);
}

.overlay.open .mbox {
    transform: scale(1) translateY(0);
}

.mbox.wide {
    max-width: 520px;
}

    .mbox.wide .mbody {
        padding: var(--space-4);
    }

.mhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.mtitle {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.mclose {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    line-height: 1;
}

    .mclose:hover {
        background: var(--surface3);
        color: var(--text);
    }

    .mclose:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

.mbody {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.mfoot {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-6) var(--space-6);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

    .mfoot .btn {
        min-width: 100px;
    }

.pr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-light);
}

    .pr-row:last-child {
        border-bottom: none;
    }

.pr-k {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.pr-v {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

.flabel {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.finput {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    transition: all var(--transition-fast);
}

    .finput:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--accent-dim);
    }

    .finput::placeholder {
        color: var(--muted2);
    }

.ferr {
    margin-top: var(--space-2);
    font-size: 13px;
    color: var(--danger);
    font-weight: 500;
    min-height: 20px;
}

.pay-opt {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-3);
    background: var(--surface);
}

    .pay-opt:hover {
        border-color: var(--accent);
        background: var(--accent-dim);
        transform: translateX(4px);
        box-shadow: -3px 0 0 var(--accent);
    }

    .pay-opt:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

.pay-ico {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(249,115,22,.22), rgba(194,83,10,.25));
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    font-family: var(--font-mono);
}

.pay-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.pay-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.pay-arr {
    margin-left: auto;
    color: var(--muted2);
    font-size: 18px;
    transition: transform var(--transition-fast);
}

.pay-opt:hover .pay-arr {
    transform: translateX(4px);
    color: var(--accent);
}

.ctable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

    .ctable thead th {
        padding: 5px var(--space-4);
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--muted);
        border-bottom: 2px solid var(--border);
        text-align: left;
    }

        .ctable thead th:last-child {
            text-align: right;
        }

    .ctable tbody td {
        padding: 6px var(--space-4);
        border-bottom: 1px solid var(--border-light);
        font-family: var(--font-mono);
        font-weight: 500;
        font-size: 13px;
    }

        .ctable tbody td:last-child {
            text-align: right;
            color: var(--primary);
            font-weight: 600;
        }

    .ctable tbody tr:last-child td {
        border-bottom: 2px solid var(--border);
    }

#toastStack {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
    max-width: 400px;
}

.loading-state, .empty-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    font-size: 14px;
    text-align: center;
    gap: var(--space-4);
}

.loading-state {
    color: var(--muted);
}

.empty-state {
    color: var(--muted);
}

.error-state {
    color: var(--danger);
}

.loading-state::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: var(--space-2);
    vertical-align: middle;
}

.skeleton {
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

    .nav-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 768px) {
    .nav {
        transform: translateX(-100%);
        width: 72%;
        max-width: 280px;
    }

        .nav.open {
            transform: translateX(0);
        }

    .nav-close {
        display: flex;
    }

    .content {
        margin-left: 0;
    }

    #toggleSidebar {
        position: relative;
        z-index: 201;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .tickets-grid {
        grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
        gap: var(--space-2);
    }

    .topbar {
        padding: 0 var(--space-4);
    }

    .scroll-area {
        padding: var(--space-4);
    }

    .cart-drawer {
        width: 100%;
        max-width: 100%;
    }

    .mbox {
        margin: var(--space-4);
        max-height: calc(100vh - var(--space-8));
    }

    #toastStack {
        left: var(--space-4);
        right: var(--space-4);
        max-width: none;
    }
}

@media (pointer: coarse) {
    .ticket-btn, .btn, .nav-item, .ib, .bundle-btn {
        min-height: 44px;
    }

    .game-card {
        padding: var(--space-5);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .page {
        animation: none;
    }
}

.notif-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
    cursor: default;
    position: relative;
    align-items: flex-start;
    flex-wrap: nowrap;
}

    .notif-item:last-child {
        border-bottom: none;
    }

    .notif-item:hover {
        background: var(--surface2);
    }

    .notif-item.unread {
        background: var(--accent-dim);
    }

        .notif-item.unread::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: var(--accent);
            border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
        }

    .notif-item.purchase .notif-icon {
        background: var(--primary-dim);
        color: var(--primary);
    }

    .notif-item.withdrawal .notif-icon {
        background: var(--accent-dim);
        color: var(--accent-dark);
    }

    .notif-item.system .notif-icon {
        background: var(--info-dim);
        color: var(--info);
    }

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.notif-body {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.notif-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.notif-msg {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px;
    line-height: 1.4;
}

.notif-time {
    font-size: 11px;
    color: var(--muted2);
    margin-top: 5px;
}

.notif-amount {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--warning);
    white-space: nowrap;
    align-self: flex-start;
    padding-top: 2px;
    flex-shrink: 0;
    max-width: 90px;
    text-align: right;
}

@media (max-width: 480px) {
    .notif-item {
        flex-wrap: wrap;
    }

    .notif-amount {
        width: 100%;
        max-width: 100%;
        text-align: left;
        padding: 4px 0 0 46px;
    }
}

.wd-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

    .wd-item:last-child {
        border-bottom: none;
    }

    .wd-item:hover {
        background: var(--surface2);
    }

.wd-info {
    min-width: 0;
}

.wd-ref {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.wd-bank {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.wd-date {
    font-size: 11px;
    color: var(--muted2);
    margin-top: 2px;
}

.wd-amount {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.wd-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

    .wd-status.pending {
        background: var(--warning-dim);
        color: var(--warning);
    }

    .wd-status.approved {
        background: var(--success-dim);
        color: var(--success);
    }

    .wd-status.rejected {
        background: var(--danger-dim);
        color: var(--danger);
    }

    .wd-status.held {
        background: var(--info-dim);
        color: var(--info);
    }

.wd-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    background: var(--surface2);
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.wd-summary-total {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}

.checkout-summary {
    margin-top: var(--space-3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.checkout-summary--warning {
    border-color: var(--danger);
    background: var(--danger-dim);
}

.checkout-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
}

    .checkout-summary-row + .checkout-summary-row {
        border-top: 1px solid var(--border-light);
    }

.checkout-summary-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

    .checkout-summary-label svg {
        flex-shrink: 0;
    }

.checkout-summary-val {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

    .checkout-summary-val.green {
        color: var(--primary);
    }

    .checkout-summary-val.red {
        color: var(--danger);
    }

.checkout-summary-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.checkout-summary-remaining {
    background: var(--surface2);
    padding: 8px 12px;
}

    .checkout-summary-remaining .checkout-summary-label {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
    }

    .checkout-summary-remaining .checkout-summary-val {
        font-size: 15px;
    }

.promo-row {
    padding: 4px 0 2px;
    margin: var(--space-2) 0 var(--space-3);
}

.promo-msg {
    font-size: 13px;
    font-weight: 500;
    min-height: 20px;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

    .promo-msg:empty {
        display: none;
    }

    .promo-msg.promo-ok {
        color: var(--primary);
    }

    .promo-msg.promo-err {
        color: var(--danger);
    }

.checkout-discount-row {
    background: rgba(249,115,22,.04);
}

.discount-val {
    color: var(--accent-dark) !important;
    font-weight: 700 !important;
}

.promo-remove {
    background: none;
    border: none;
    color: var(--muted2);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 0 0 4px;
    transition: color var(--transition-fast);
}

    .promo-remove:hover {
        color: var(--danger);
    }

.nav-item--withdraw {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid rgba(255,255,255,.08);
    color: rgba(255,255,255,.9);
}

    .nav-item--withdraw svg {
        color: var(--accent-light);
        opacity: 1;
    }

    .nav-item--withdraw:hover {
        background: rgba(249,115,22,.18);
        color: white;
    }

        .nav-item--withdraw:hover svg {
            color: var(--accent);
        }

.wd-autofetch-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--primary-dim);
    color: var(--primary);
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.wd-amount-input {
    font-size: 18px;
    font-family: var(--font-mono);
    font-weight: 600;
    text-align: center;
    padding: 14px 16px;
    letter-spacing: -0.01em;
    color: var(--primary);
}

    .wd-amount-input::placeholder {
        font-size: 14px;
        font-family: var(--font-sans);
        font-weight: 400;
        color: var(--muted2);
        letter-spacing: 0;
    }

@media (max-width: 480px) {
    .wd-amount-input {
        font-size: 16px;
        padding: 12px 14px;
    }
}

.wd-range-hint {
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.wd-certify-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    cursor: pointer;
    margin-top: var(--space-4);
}

    .wd-certify-label input[type="checkbox"] {
        flex-shrink: 0;
        width: 18px;
        height: 18px;
        margin-top: 1px;
        accent-color: var(--primary);
        cursor: pointer;
    }

@keyframes luckyPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(26,122,60,0.5);
        transform: translateY(-3px) scale(1.08);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(26,122,60,0.1);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(26,122,60,0);
        transform: translateY(-3px) scale(1.08);
    }
}

.ticket-btn.lucky-highlight {
    animation: luckyPulse 0.7s ease 4;
    border-color: var(--primary) !important;
    background: var(--primary-dim) !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 4px 16px rgba(26,122,60,.3);
}

.ticket-btn.lucky-injected {
    order: -1;
}

.lucky-search-row {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.lucky-search-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    position: relative;
}

.lucky-search-icon {
    position: absolute;
    left: 12px;
    color: var(--muted2);
    pointer-events: none;
    flex-shrink: 0;
}

.lucky-search-input {
    flex: 1;
    padding: 9px 12px 9px 34px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition-fast);
    outline: none;
    -moz-appearance: textfield;
}

    .lucky-search-input::-webkit-outer-spin-button, .lucky-search-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
    }

    .lucky-search-input:focus {
        border-color: var(--primary);
    }

    .lucky-search-input::placeholder {
        font-family: var(--font-sans);
        font-weight: 400;
        color: var(--muted2);
    }

.lucky-avail {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
}

.lucky-unavail {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--danger);
}

.history-group {
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 0;
}

    .history-group:last-child {
        border-bottom: none;
    }

.history-group-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 12px var(--space-5);
    background: linear-gradient(135deg, var(--primary-dim) 0%, rgba(249,115,22,.04) 100%);
    border-bottom: 1px solid var(--border-light);
}

    .history-group-header:hover {
        background: var(--surface2);
    }

.hg-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.hg-chevron {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform .2s ease;
}

[aria-expanded="true"] .hg-chevron {
    transform: rotate(0deg);
}

[aria-expanded="false"] .hg-chevron {
    transform: rotate(-90deg);
}

.hg-body {
    overflow: hidden;
}

.history-group-info {
    flex: 1;
    min-width: 0;
}

.history-group-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-group-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.history-group-total {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.history-ticket {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
    gap: 8px;
    min-height: 32px;
}

    .history-ticket:hover {
        background: var(--surface2);
    }

    .history-ticket:last-child {
        border-bottom: none;
    }

.history-no {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.2;
}

.history-date {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
    line-height: 1.2;
}

.notif-load-more {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-light);
    text-align: center;
}

#notifLoadMoreBtn {
    width: 100%;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
}

    #notifLoadMoreBtn:hover {
        background: var(--primary-dim);
        color: var(--primary);
    }

.notif-remaining {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    margin-left: 4px;
}

.wd-modal {
    max-width: 400px;
    width: calc(100vw - 32px);
}

.wd-mbody {
    padding: var(--space-4) var(--space-5) !important;
}

.wd-step-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: var(--info-dim, rgba(59,130,246,.06));
    border-radius: var(--radius-md);
    border-left: 3px solid var(--info, #3b82f6);
}

.wd-review-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 12px;
}

.wd-review-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    color: var(--muted);
    gap: var(--space-4);
}

    .wd-review-row:last-child {
        border-bottom: none;
    }

    .wd-review-row strong {
        color: var(--text);
        font-weight: 600;
    }

.wd-review-amount {
    background: var(--primary-dim);
    padding: 10px 14px;
}

    .wd-review-amount strong {
        font-family: var(--font-mono);
        font-size: 16px;
        font-weight: 700;
        color: var(--primary);
    }

.wd-certify-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    cursor: pointer;
}

    .wd-certify-label input[type="checkbox"] {
        flex-shrink: 0;
        width: 16px;
        height: 16px;
        margin-top: 1px;
        accent-color: var(--primary);
        cursor: pointer;
    }

.wd-modal .wd-amount-input {
    font-size: 20px;
    padding: 12px 14px;
}

@media print {
    .nav, .topbar, .cart-drawer, .cart-drawer-backdrop, .overlay, #toastStack {
        display: none !important;
    }

    .content {
        margin-left: 0;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

.draw-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.draw-status--open {
    background: var(--warning-dim, #fef3c7);
    color: #b45309;
}

.draw-status--closed {
    background: var(--primary-dim);
    color: var(--primary);
}

.check-win-btn {
    background: var(--primary-dim);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px !important;
}

    .check-win-btn:hover {
        background: var(--primary);
        color: #fff;
    }

    .check-win-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.history-ticket-result {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .history-ticket-result {
        flex-shrink: 1;
        min-width: 0;
    }

    .history-ticket {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .win-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .redeem-btn {
        font-size: 10px !important;
        padding: 2px 6px !important;
    }
}

.win-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    background: var(--warning-dim, #fef3c7);
    color: #b45309;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.no-win-badge {
    font-size: 10px;
    color: var(--muted);
    font-style: italic;
}

/* ── My Tickets — larger fonts ── */
.history-group-name {
    font-size: 15px !important;
    font-weight: 700;
}

.history-group-meta {
    font-size: 13px !important;
}

.history-group-total {
    font-size: 15px !important;
    font-weight: 700;
}

.history-no {
    font-size: 14px !important;
    font-weight: 600;
}

.history-date {
    font-size: 12px !important;
}

.win-badge {
    font-size: 12px !important;
    font-weight: 600;
    padding: 2px 9px !important;
}

.no-win-badge {
    font-size: 12px !important;
}

.draw-status {
    font-size: 11px !important;
}

.check-win-btn {
    font-size: 12px !important;
    padding: 5px 12px !important;
}

.redeem-btn {
    font-size: 11px !important;
    padding: 4px 10px !important;
}

.history-ticket {
    padding: 8px 16px !important;
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .page-title {
        font-size: 16px;
        font-weight: 700;
    }

    .topbar {
        padding: 10px 12px;
    }

    .stat-label {
        font-size: 12px;
    }

    .stat-val {
        font-size: 28px;
    }

    .stat-sub {
        font-size: 13px;
    }

    .card {
        border-radius: 14px;
        margin-bottom: 14px;
    }

    .card-title {
        font-size: 15px;
        font-weight: 700;
    }

    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }

    .btn-sm {
        font-size: 13px;
        padding: 7px 12px;
    }

    .nav-item {
        font-size: 14px;
        padding: 12px 20px;
    }

    .game-card {
        border-radius: 14px;
        min-height: 160px;
    }

    .game-name {
        font-size: 17px;
    }

    .ticket-btn {
        font-size: 14px;
        font-weight: 700;
        padding: 12px 8px;
        border-radius: 10px;
    }

    #toastStack {
        bottom: 80px;
    }
}

/* ── Clickable stat cards ── */
.stat-clickable {
    cursor: pointer;
}

    .stat-clickable:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--border);
    }

    .stat-clickable:active {
        transform: translateY(-1px);
    }

    .stat-clickable:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

.stat-tap-hint {
    font-size: 13px;
    color: var(--primary);
    margin-top: var(--space-3);
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color var(--transition-fast);
}

.stat-clickable:hover .stat-tap-hint {
    color: var(--primary-hover);
}

/* ── Deposit history rows ── */
.deposit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    transition: background var(--transition-fast);
}

    .deposit-item:last-child {
        border-bottom: none;
    }

    .deposit-item:hover {
        background: var(--surface2);
    }

.deposit-ref {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.deposit-date {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.deposit-method {
    font-size: 11px;
    color: var(--muted2);
    margin-top: 1px;
}

.deposit-amt {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.deposit-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

    .deposit-status.completed {
        background: var(--success-dim);
        color: #15803d;
    }

    .deposit-status.pending {
        background: var(--warning-dim);
        color: #b45309;
    }

    .deposit-status.failed {
        background: var(--danger-dim);
        color: var(--danger);
    }


/* ── Help & FAQ ─────────────────────────────────────────── */
.faq-category {
    margin-bottom: 4px;
}

.faq-cat-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 14px 16px 6px;
    display: block;
}

.faq-item {
    border-bottom: 1px solid var(--border);
}

    .faq-item:last-child {
        border-bottom: none;
    }

.faq-q {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    line-height: 1.4;
    transition: background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

    .faq-q:hover {
        background: var(--surface2) !important;
    }

    .faq-q:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: -2px;
    }

.faq-chevron {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.2s ease;
    min-width: 14px;
}

.faq-a {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7;
    padding: 0 16px 14px 16px;
    display: none;
}
