/* Fonts preloaded in header.php for high performance */
:root {
    --card-radius: 16px;
    --control-radius: 12px;
    --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Theme-agnostic fallbacks used by the admin panel (admin.css only overrides
       brand/surface/ink colors, not these semantic/shadow tokens). */
    --danger-text: #b91c1c;
    --danger-border: #fca5a5;
    --lose-bg: #fee2e2;
    --gold: #d97706;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --input-bg: #ffffff;
    --disabled-bg: #e5e7eb;
    --disabled-text: #9ca3af;
}

/* ---------- Player theme: Bharatt Quiz corporate navy + slate ---------- */
body.player-theme {
    --brand: #1b366e;
    --brand-dark: #142954;
    --brand-light: #bfdbfe;
    --brand-rgb: 27, 54, 110;
    --accent-orange: #f58220;
    --cream: #f8fafc;
    --surface: #ffffff;
    --sidebar-bg: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --win: #15803d;
    --win-bg: #f0fdf4;
    --lose-bg: #fef2f2;
    --gold: #d97706;
    --gold-dark: #b45309;
    --danger-text: #b91c1c;
    --danger-border: #fca5a5;
    --accent-soft: #eff6ff;
    --accent-soft-rgb: 27, 54, 110;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --input-bg: #ffffff;
    --disabled-bg: #e2e8f0;
    --disabled-text: #94a3b8;
}

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    background: var(--cream);
    color: var(--ink);
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
    overscroll-behavior-y: contain;
}

h1, h2, h3 { font-family: 'Sora', 'Inter', sans-serif; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }

a { color: inherit; text-decoration: none; }

button, .btn, input, select, textarea { font-family: inherit; }

.icon { width: 20px; height: 20px; flex-shrink: 0; vertical-align: -4px; }
.glyph-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0; font-style: normal; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- Top bar ---------- */
.topbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--ink);
    min-height: 62px;
    padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
@supports not (backdrop-filter: blur(12px)) {
    .topbar { background: var(--surface); }
}
.topbar .brand {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.topbar-brand-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    border-radius: 8px;
}
.topbar-logo { height: 32px; width: auto; max-width: 44vw; display: block; object-fit: contain; }
.topbar-name { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; color: var(--ink); }
.topbar-page-title {
    display: none;
    font-family: 'Sora', sans-serif;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
}

.menu-btn, .sidebar-toggle-btn {
    background: #f1f5f9;
    border: 1px solid transparent;
    color: #334155;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.menu-btn:hover, .sidebar-toggle-btn:hover { background: #e2e8f0; color: var(--ink); }
.menu-btn:active, .sidebar-toggle-btn:active { background: #cbd5e1; }
.menu-btn .icon, .sidebar-toggle-btn .icon { width: 19px; height: 19px; }
.sidebar-toggle-btn { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    background: #f8fafc;
    border: 1px solid var(--border);
    color: #334155;
    flex-shrink: 0;
    transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
}
.topbar-icon-btn:hover { background: #f1f5f9; border-color: #cbd5e1; color: var(--ink); }
.topbar-icon-btn .icon { width: 18px; height: 18px; }

.topbar-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: #f8fafc;
    overflow: hidden;
    flex-shrink: 0;
}
.topbar-avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

.points-pill {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--ink);
    height: 40px;
    padding: 0 14px 0 6px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.points-pill:hover { background: #f1f5f9; border-color: #cbd5e1; }
.points-pill-icon {
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.points-pill-icon .glyph-icon { font-size: 14px; color: var(--gold); }
.points-pill-val { font-weight: 700; color: var(--ink); }
.topbar-signin-link { min-height: 38px; padding: 7px 16px; border-radius: 9999px; font-size: 13.5px; }

/* ---------- Accessible Mobile Drawer (<dialog> + scroll-snap swipe) ---------- */
.app-drawer {
    --drawer-width: min(296px, 82dvw, 100dvw - 24px);
    --drawer-backdrop: 0;
    inset: 0;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    overflow: visible;
}
.app-drawer::backdrop {
    background: rgba(15, 23, 42, 1);
    opacity: calc(var(--drawer-backdrop) * 0.48);
}

.app-drawer-scroller {
    position: relative;
    display: grid;
    grid-template-columns: var(--drawer-width) 100%;
    overflow-x: scroll;
    overscroll-behavior: none;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
}
.app-drawer-scroller::-webkit-scrollbar { display: none; }
.app-drawer-scroller::after {
    content: '';
    scroll-snap-align: end;
    scroll-initial-target: nearest;
}

@media (prefers-reduced-motion: no-preference) {
    .app-drawer-scroller { scroll-behavior: smooth; }
}

@supports (animation-timeline: scroll()) {
    .app-drawer {
        timeline-scope: --drawer-fade;
        animation: fade-drawer-backdrop linear both;
        animation-timeline: --drawer-fade;
    }
    .app-drawer-scroller {
        scroll-timeline: --drawer-fade x;
    }
    @property --drawer-backdrop {
        syntax: '<number>';
        inherits: true;
        initial-value: 0;
    }
    @keyframes fade-drawer-backdrop {
        0% { --drawer-backdrop: 1; }
        100% { --drawer-backdrop: 0; }
    }
}

.app-drawer-sheet {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100svh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    scroll-snap-align: start;
    scrollbar-width: none;
}

.drawer-header {
    padding: calc(14px + env(safe-area-inset-top)) 14px 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.drawer-user-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    flex: 1;
    padding: 4px;
    border-radius: 8px;
}
.drawer-user-link:hover { background: var(--cream); }
.drawer-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--cream);
    flex-shrink: 0;
    object-fit: cover;
}
.drawer-user-meta { min-width: 0; }
.drawer-name {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drawer-viewprofile { font-size: 12px; color: var(--muted); }
.drawer-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.drawer-close-btn:hover { background: var(--cream); color: var(--ink); }
.drawer-close-btn .icon { width: 18px; height: 18px; }

.drawer-nav { padding: 10px 10px 20px; display: flex; flex-direction: column; gap: 2px; }
.drawer-divider { height: 1px; background: var(--border); margin: 8px 6px; }

/* Shared clean navigation item styling (sidebar + drawer) */
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.75px;
    font-weight: 500;
    color: #334155;
    min-height: 40px;
    transition: background-color 130ms var(--ease), color 130ms var(--ease);
}
.nav-item .icon,
.nav-item .glyph-icon {
    width: 18px;
    height: 18px;
    font-size: 17px;
    color: var(--muted);
    flex-shrink: 0;
}
.nav-item:hover {
    background: #f1f5f9;
    color: var(--ink);
}
.nav-item:hover .icon,
.nav-item:hover .glyph-icon {
    color: #334155;
}
.nav-item.is-active,
.nav-item[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--brand);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--brand);
}
.nav-item.is-active .icon,
.nav-item.is-active .glyph-icon,
.nav-item[aria-current="page"] .icon,
.nav-item[aria-current="page"] .glyph-icon {
    color: var(--brand);
}

.page-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--brand);
    border: 1px solid #dbeafe;
}
.page-hero-icon .icon { width: 24px; height: 24px; color: var(--brand); }
.topbar h1 { font-size: 17px; margin: 0; color: var(--ink); font-weight: 700; }

.container { padding: 18px 16px 28px; max-width: 720px; margin: 0 auto; }

/* ---------- Desktop app shell: persistent clean sidebar ---------- */
.main-content { min-width: 0; }

.sidebar { display: none; }
.sidebar-brand {
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    min-height: 60px;
}
.sidebar-brand-link {
    display: inline-flex;
    align-items: center;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
    border-radius: 6px;
}
.sidebar-brand img { max-height: 30px; max-width: 100%; display: block; }

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 12px 4px;
    padding: 10px 12px;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.sidebar-profile:hover { border-color: #cbd5e1; background: #f1f5f9; }
.sidebar-profile[aria-current="page"] { border-color: #bfdbfe; background: var(--accent-soft); }
.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    object-fit: cover;
    flex-shrink: 0;
}
.sidebar-profile-meta { min-width: 0; flex: 1; }
.sidebar-profile-chevron { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.sidebar-nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-spacer { flex: 1; }
.sidebar-divider { height: 1px; background: var(--border); margin: 4px 16px; }
.sidebar-nav--account { padding-bottom: 14px; }

/* ---------- Home promo carousel ---------- */
.home-carousel {
    margin-bottom: 18px;
}
.home-carousel-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    touch-action: manipulation;
    scrollbar-width: none;
    border-radius: 12px;
}
.home-carousel-track::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) {
    .home-carousel-track { scroll-behavior: smooth; }
}
.home-carousel-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
}
.home-carousel-slide img {
    width: 100%;
    aspect-ratio: 16 / 7;
    object-fit: cover;
    display: block;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.home-carousel-caption {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}
.home-carousel-markers {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
}
.home-carousel-dot {
    width: 24px;
    height: 24px;
    padding: 9px 6px;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.home-carousel-dot::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: width 180ms var(--ease), background-color 180ms var(--ease);
}
.home-carousel-dot[aria-current="true"]::before {
    width: 18px;
    background: var(--brand);
}

/* ---------- Cards ---------- */
.market-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.market-card:hover { border-color: #cbd5e1; box-shadow: var(--shadow-md); }

.market-card .name { font-family: 'Sora', sans-serif; font-weight: 600; color: var(--ink); font-size: 15.5px; }
.market-card .digits { color: var(--muted); font-size: 14px; margin: 4px 0; font-variant-numeric: tabular-nums; letter-spacing: 0.4px; }
.market-card .times { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.market-card .countdown { font-size: 12px; color: var(--gold-dark); font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.market-card .times .icon { width: 13px; height: 13px; }

/* ---------- Quiz gameplay ---------- */
.quiz-play-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.quiz-close-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(var(--brand-rgb), 0.14);
    transition: background-color 150ms var(--ease), transform 100ms var(--ease);
}
.quiz-close-btn:hover { background: #d7f5e2; }
.quiz-close-btn:active { transform: scale(0.92); }
.quiz-close-btn .icon { width: 16px; height: 16px; }

.quiz-timer-wrap { position: relative; width: 108px; height: 108px; margin: 0 auto 20px; }
.quiz-timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.quiz-timer-track { fill: none; stroke: var(--border); stroke-width: 8; }
.quiz-timer-progress {
    fill: none;
    stroke: var(--gold);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 200ms var(--ease);
}
.quiz-timer-progress.quiz-timer-low { stroke: var(--danger-text); }
.quiz-timer-label {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Sora', sans-serif; font-weight: 700; font-size: 22px; color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.quiz-score-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.quiz-score-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--ink);
}
.quiz-score-chip .icon { width: 14px; height: 14px; }
.quiz-score-chip.correct { color: var(--win); }
.quiz-score-chip.wrong { color: var(--danger-text); }
.quiz-score-chip.current { color: var(--gold); }

.quiz-question-card { text-align: center; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; padding-top: 34px; }
.quiz-question-card .badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); }
.quiz-question-text { font-family: 'Sora', sans-serif; font-weight: 600; font-size: 17px; color: var(--ink); line-height: 1.5; margin: 8px 0 22px; }
.quiz-options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
.quiz-option-btn {
    background: var(--cream);
    border: 1.5px solid var(--border);
    border-radius: var(--control-radius);
    padding: 14px 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 150ms var(--ease), background-color 150ms var(--ease), transform 100ms var(--ease);
}
.quiz-option-btn:hover:not(:disabled) { border-color: var(--brand); }
.quiz-option-btn:active:not(:disabled) { transform: scale(0.97); }
.quiz-option-btn:disabled { cursor: default; }
.quiz-option-btn.is-correct { background: var(--win-bg); border-color: var(--win); color: var(--win); }
.quiz-option-btn.is-wrong { background: var(--lose-bg); border-color: var(--danger-text); color: var(--danger-text); }

.quiz-reward-card, .quiz-claimed-card { text-align: center; padding: 32px 24px; }
.quiz-reward-coin, .quiz-claimed-icon {
    width: 76px; height: 76px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    box-shadow: 0 10px 24px rgba(227, 160, 8, 0.35);
    animation: quizRewardPop 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.quiz-reward-coin .icon, .quiz-claimed-icon .icon { width: 34px; height: 34px; color: #fff; }
@keyframes quizRewardPop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}
.quiz-reward-total { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 32px; color: var(--gold); margin-bottom: 18px; }
.quiz-reward-breakdown { background: var(--cream); border: 1px solid var(--border); border-radius: var(--control-radius); padding: 12px 16px; text-align: left; }
.quiz-reward-breakdown .row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 5px 0; color: var(--muted); }
.quiz-reward-breakdown .row .plus { color: var(--win); font-weight: 700; }
.quiz-reward-breakdown .row .minus { color: var(--danger-text); font-weight: 700; }
.quiz-claimed-amount { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 40px; color: var(--gold); margin-bottom: 22px; }
.quiz-tips { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.quiz-tip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--control-radius); padding: 12px 14px; font-size: 13px; color: var(--muted); }
.quiz-tip-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quiz-tip-icon .icon { width: 15px; height: 15px; }

.quiz-cat-card {
    cursor: pointer;
    align-items: center;
    margin-bottom: 0;
}
.quiz-cat-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.quiz-cat-meta .badge { font-size: 11px; }
.quiz-cat-arrow {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--cream);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.quiz-cat-arrow .icon { width: 16px; height: 16px; }
.quiz-cat-card:hover .quiz-cat-arrow { background: var(--brand); border-color: var(--brand); color: #ffffff; }

.badge {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.badge.open { background: var(--win-bg); color: var(--win); border: 1px solid #bbf7d0; }
.badge.closed { background: var(--lose-bg); color: var(--danger-text); border: 1px solid #fecaca; }
.badge.pending { background: #f1f5f9; color: var(--muted); border: 1px solid var(--border); }

/* ---------- Home toolbar, action strip & market grid ---------- */
.page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.page-head h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}
.page-head-sub {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.home-toolbar {
    margin-bottom: 16px;
}
.home-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}
.home-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 18px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: background-color 140ms var(--ease), border-color 140ms var(--ease), transform 100ms var(--ease), box-shadow 140ms var(--ease);
}
.home-action-btn:active { transform: scale(0.985); }
.home-action-btn .icon,
.home-action-btn .glyph-icon { width: 17px; height: 17px; font-size: 17px; flex-shrink: 0; }
.home-action-btn.is-primary {
    background: var(--brand);
    color: #ffffff;
    border: 1px solid var(--brand);
}
.home-action-btn.is-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    box-shadow: var(--shadow-md);
}
.home-action-btn.is-secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid #cbd5e1;
}
.home-action-btn.is-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.home-action-btn.is-support {
    grid-column: 1 / -1;
    background: #15803d;
    color: #ffffff;
    border: 1px solid #15803d;
}
.home-action-btn.is-support .glyph-icon,
.home-action-btn.is-support .icon { color: #ffffff; }
.home-action-btn.is-support:hover {
    background: #166534;
    border-color: #166534;
    box-shadow: var(--shadow-md);
}

.markets-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

/* ---------- Market card: clean, minimal corporate layout ---------- */
.game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.game-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.game-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.game-card-name {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--ink);
    margin: 0;
    line-height: 1.3;
}
.game-card-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    flex-shrink: 0;
}
.game-card-status.is-open {
    background: var(--win-bg);
    color: var(--win);
    border: 1px solid #bbf7d0;
}
.game-card-status.is-open::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--win);
}
.game-card-status.is-closed {
    background: #f1f5f9;
    color: var(--muted);
    border: 1px solid var(--border);
}

.game-card-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--cream);
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 12px 0;
}
.game-card-digits {
    font-family: 'Sora', sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
    color: var(--brand);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
}
.game-card-countdown {
    font-size: 12px;
    color: var(--gold-dark);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.game-card-closed-note {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.game-card-times {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 14px;
}
.game-card-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.game-card-time strong {
    color: var(--ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.game-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
}
.game-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.game-card-action .icon { width: 15px; height: 15px; }
.game-card-action.chart-action {
    background: var(--surface);
    color: #334155;
    border: 1px solid #cbd5e1;
}
.game-card-action.chart-action:hover {
    background: var(--cream);
    border-color: #94a3b8;
    color: var(--ink);
}
.game-card-action.play-action {
    background: var(--brand);
    color: #ffffff;
    border: 1px solid var(--brand);
}
.game-card-action.play-action:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}
.game-card.is-closed .game-card-action.play-action {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid var(--border);
}
.game-card.is-closed .game-card-action.play-action:hover {
    background: #e2e8f0;
    color: var(--ink);
}

.market-card-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.circle-actions { display: flex; gap: 8px; }
.circle-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    flex-shrink: 0;
    transition: background-color 140ms var(--ease);
}
.circle-btn .icon { width: 17px; height: 17px; }
.circle-btn:hover { background: var(--brand-dark); }
.circle-btn.secondary { background: var(--accent-soft); color: var(--brand); border: 1px solid #dbeafe; }
.circle-btn.secondary:hover { background: var(--brand); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    padding: 10px 20px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    min-height: 44px;
    transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid #cbd5e1; }
.btn.secondary:hover { background: var(--cream); border-color: #94a3b8; }
.btn.win { background: var(--win); border-color: var(--win); }
.btn.win:hover { background: #166534; }

/* ---------- Cards / panels ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.card h2 { font-size: 18px; }

/* ---------- Auth pages: corporate split-screen shell ---------- */
.auth-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 10px 22px rgba(var(--brand-rgb), 0.35);
    animation: badgeFloat 3.4s ease-in-out infinite;
}
@keyframes badgeFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.auth-badge .icon { width: 28px; height: 28px; color: #fff; }
.auth-badge img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.auth-badge:has(img) { background: #ffffff; border: 1px solid var(--border); box-shadow: 0 10px 22px rgba(27, 54, 110, 0.14); }

.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

body.auth-page {
    --auth-navy: #1b366e;
    --auth-navy-hover: #142954;
    --auth-bg: #f8fafc;
    --auth-ink: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #cbd5e1;
    --auth-border-hover: #94a3b8;
    --auth-error: #b91c1c;
    --auth-error-bg: #fef2f2;
    --auth-success: #15803d;
    background: var(--auth-bg);
    color: var(--auth-ink);
    padding-bottom: 0;
}

body.auth-page .app-progress-bar {
    background: var(--auth-navy);
    box-shadow: none;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    background: var(--auth-bg);
}

.auth-card {
    width: 100%;
    max-width: 396px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 32px 26px 28px;
    box-shadow:
        0 4px 24px rgba(15, 23, 42, 0.06),
        0 1px 2px rgba(15, 23, 42, 0.04);
}

.auth-brand-logo {
    display: block;
    height: 38px;
    width: auto;
    max-width: 100%;
    margin: 0 auto 22px;
    object-fit: contain;
}

.auth-brand-wordmark {
    text-align: center;
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--auth-navy);
    margin: 0 auto 22px;
}

.auth-title {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--auth-ink);
    text-align: center;
    margin: 0 0 20px;
    line-height: 1.3;
}

.auth-title--with-sub {
    margin-bottom: 6px;
}

.auth-subtitle {
    margin: 0 0 20px;
    font-size: 0.875rem;
    color: var(--auth-muted);
    text-align: center;
    line-height: 1.45;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.45;
    margin-bottom: 16px;
}
.auth-alert .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}
.auth-alert--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.auth-alert--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}
.auth-alert--info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}

.field-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.auth-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--auth-muted);
    margin: -2px 0 6px;
    line-height: 1.4;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    font: inherit;
    font-size: max(1rem, 1em);
    line-height: 1.4;
    color: var(--auth-ink);
    background: #ffffff;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    margin: 0;
    transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.auth-input::placeholder {
    color: #94a3b8;
}
.auth-input:hover {
    border-color: var(--auth-border-hover);
}
.auth-input:focus {
    outline: none;
    border-color: var(--auth-navy);
    box-shadow: 0 0 0 3px rgba(27, 54, 110, 0.12);
}
.auth-input:focus-visible {
    outline: 2px solid var(--auth-navy);
    outline-offset: 2px;
    border-color: var(--auth-navy);
}
.auth-input--pw {
    padding-right: 46px;
}
.auth-input--otp {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: max(1.25rem, 1em);
    font-weight: 700;
    letter-spacing: 0.35em;
    text-align: center;
}

.auth-input:is(:autofill, :-webkit-autofill) {
    box-shadow: inset 0 0 0 2px var(--auth-navy), inset 0 0 0 100vmax #eef4ff;
    border-color: var(--auth-navy);
    -webkit-text-fill-color: var(--auth-ink);
    caret-color: var(--auth-ink);
}
.auth-input:is(:autofill, :-webkit-autofill):focus-visible {
    outline: 2.5px solid var(--auth-navy);
    outline-offset: 2px;
}

.auth-input:is(:user-invalid, .user-invalid-fallback) {
    border-color: var(--auth-error);
    background-color: var(--auth-error-bg);
}
.auth-input:is(:user-valid, .user-valid-fallback) {
    border-color: var(--auth-success);
}

.pw-toggle {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
}
.pw-toggle:hover {
    color: var(--auth-ink);
}
.pw-toggle:focus-visible {
    outline: 2px solid var(--auth-navy);
    outline-offset: -2px;
}
.pw-toggle .icon {
    width: 18px;
    height: 18px;
}
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.is-visible .icon-eye { display: none; }
.pw-toggle.is-visible .icon-eye-off { display: block; }

.field-error {
    display: none;
    align-items: flex-start;
    gap: 5px;
    color: var(--auth-error);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 5px;
    line-height: 1.35;
}
.field-error-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}
.auth-input:is(:user-invalid, .user-invalid-fallback) ~ .field-error,
.field-group:has(.auth-input:is(:user-invalid, .user-invalid-fallback)) .field-error {
    display: flex;
}

.auth-submit-btn {
    width: 100%;
    min-height: 46px;
    padding: 11px 18px;
    border: none;
    border-radius: 8px;
    background: var(--auth-navy);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    transition: background-color 140ms var(--ease);
}
.auth-submit-btn:hover {
    background: var(--auth-navy-hover);
}
.auth-submit-btn:active {
    transform: translateY(1px);
}
.auth-submit-btn:focus-visible {
    outline: 2.5px solid var(--auth-navy);
    outline-offset: 2px;
}
.auth-submit-btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.auth-secondary-btn {
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--auth-ink);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.auth-secondary-btn:hover {
    background: #f8fafc;
    border-color: var(--auth-border-hover);
}
.auth-secondary-btn:focus-visible {
    outline: 2px solid var(--auth-navy);
    outline-offset: 2px;
}

.auth-text-btn {
    width: 100%;
    min-height: 40px;
    background: transparent;
    border: none;
    color: var(--auth-muted);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    padding: 6px 10px;
}
.auth-text-btn:hover {
    color: var(--auth-ink);
    background: #f1f5f9;
}
.auth-text-btn:focus-visible {
    outline: 2px solid var(--auth-navy);
    outline-offset: 1px;
}

.auth-footer-link {
    margin: 20px 0 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--auth-muted);
}
.auth-footer-link a {
    color: var(--auth-navy);
    font-weight: 600;
}
.auth-footer-link a:hover {
    text-decoration: underline;
}

.auth-outside-footer {
    margin-top: 16px;
    text-align: center;
    font-size: 0.78rem;
    color: #94a3b8;
}
.auth-outside-footer a {
    color: #64748b;
    font-weight: 500;
}
.auth-outside-footer a:hover {
    color: #334155;
    text-decoration: underline;
}

@media (pointer: coarse) {
    body.auth-page .auth-input,
    body.auth-page .auth-submit-btn,
    body.auth-page .auth-secondary-btn {
        min-height: 48px;
    }
    body.auth-page .pw-toggle {
        min-height: 46px;
        width: 44px;
    }
}

@media (min-width: 480px) {
    .auth-card {
        padding: 36px 32px 30px;
    }
}

@media (forced-colors: active) {
    .auth-input:focus-visible,
    .auth-submit-btn:focus-visible,
    .auth-secondary-btn:focus-visible,
    .pw-toggle:focus-visible {
        outline: 2px solid Highlight;
    }
}

/* ---------- Game type chooser (2-column icon tile grid, mirrors the original app's layout) ---------- */
.game-tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.game-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 26px 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 150ms var(--ease), transform 150ms var(--ease);
}
.game-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.game-tile-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--tile-color);
    color: #fff;
    position: relative;
}
.game-tile-icon .icon { width: 26px; height: 26px; }
.game-tile-icon::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    border-radius: 2px;
    background: var(--tile-color);
}
.game-tile-label { font-family: 'Sora', sans-serif; font-weight: 600; font-size: 14.5px; color: var(--ink); text-align: center; }
.game-tile-rate { font-size: 12px; font-weight: 700; color: var(--muted); }

.tile-1 { --tile-color: #2563eb; }
.tile-j { --tile-color: #4f46e5; }
.tile-sp { --tile-color: #7c3aed; }
.tile-dp { --tile-color: #d97706; }
.tile-tp { --tile-color: #db2777; }
.tile-hs { --tile-color: #0891b2; }
.tile-fs { --tile-color: #dc2626; }
.badge-1 { background: #2563eb; }
.badge-j { background: #4f46e5; }
.badge-sp { background: #7c3aed; }
.badge-dp { background: #d97706; }
.badge-tp { background: #db2777; }
.badge-hs { background: #0891b2; }
.badge-fs { background: #dc2626; }

/* ---------- Basket-style bid entry ---------- */
.basket-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.basket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.basket-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.basket-item .n { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 15px; color: var(--ink); }
.basket-item input { width: 84px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 13px; text-align: right; background: var(--input-bg); color: var(--ink); }
.basket-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-md);
}
.basket-footer .totals { display: flex; gap: 24px; }
.basket-footer .totals .label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.basket-footer .totals .val { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); }
.basket-footer .btn { width: auto; padding: 12px 28px; }

.digit-toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; margin-bottom: 16px; }
.digit-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    padding: 14px;
    text-align: center;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
}
.digit-toggle.selected { background: var(--brand); color: #fff; border-color: var(--brand); }

.field-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 7px;
    margin-top: 16px;
}
.field-label:first-child { margin-top: 0; }
.field-label .icon { width: 13px; height: 13px; color: var(--muted); }

.form-input {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--control-radius);
    margin-bottom: 4px;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--ink);
    transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.form-input::placeholder { color: var(--muted); }
.form-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12);
    outline: none;
}

.helper-text { color: var(--muted); font-size: 13px; margin: -2px 0 14px; }

.msg { padding: 11px 14px; border-radius: var(--control-radius); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.msg.error { background: var(--lose-bg); color: var(--danger-text); }
.msg.success { background: var(--win-bg); color: var(--win); }

/* ---------- Bottom nav: docked clean tab bar ---------- */
.bottom-nav-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
}
.bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}
.bottom-nav.is-quiz {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 480px;
}
.bottom-nav a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    padding: 8px 4px 7px;
    min-height: 54px;
    transition: color 130ms var(--ease);
}
.bottom-nav a .icon { width: 19px; height: 19px; }
.bottom-nav a .glyph-icon { font-size: 18px; }
.bottom-nav a:hover { color: var(--ink); }
.bottom-nav a.is-active,
.bottom-nav a[aria-current="page"] {
    color: var(--brand);
    font-weight: 600;
}
.bottom-nav a.is-active::before,
.bottom-nav a[aria-current="page"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 2.5px;
    border-radius: 0 0 3px 3px;
    background: var(--brand);
}

/* ---------- Native-app feel: no long-press callouts / text selection on chrome ---------- */
.bottom-nav a,
.sidebar-nav a,
.drawer-nav a,
.topbar,
.menu-btn,
.sidebar-toggle-btn,
.sidebar-brand,
.sidebar-profile,
.drawer-header {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ---------- Rates ---------- */
.rate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.rate-row:hover { border-color: #cbd5e1; box-shadow: var(--shadow-sm); }
.rate-row .rate-name { font-family: 'Sora', sans-serif; font-weight: 600; font-size: 15px; }
.rate-row .rate-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.rate-row .mult { font-size: 20px; font-weight: 700; color: var(--brand); font-family: 'Sora', sans-serif; }

/* ---------- Disclaimer ---------- */
.disclaimer-box {
    background: var(--lose-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    padding: 12px 15px;
    border-radius: var(--control-radius);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.disclaimer-box .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ---------- Preset amount chips (deposit page) ---------- */
.amount-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.amount-preset-btn {
    border: 1px solid #cbd5e1;
    background: var(--surface);
    color: var(--ink);
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 6px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.amount-preset-btn:hover,
.amount-preset-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ---------- Notice box ---------- */
.notice-box {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.notice-box-title {
    background: var(--brand);
    color: #fff;
    text-align: center;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 15px;
    padding: 11px;
}
.notice-box-body {
    background: var(--surface);
    padding: 18px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.6;
}
.notice-box-body p { margin: 0 0 14px; }
.notice-box-body p:last-child { margin-bottom: 0; }

/* ---------- Balance panel ---------- */
.balance-panel { text-align: center; padding: 18px 20px; }
.balance-panel .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.balance-panel .amount {
    font-family: 'Sora', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 4px 0 0;
    font-variant-numeric: tabular-nums;
}
.balance-panel .amount .icon { width: 22px; height: 22px; color: var(--gold); }
.balance-panel .amount .glyph-icon { font-size: 24px; color: var(--gold); }

/* ---------- Chart table ---------- */
table.chart-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
table.chart-table th, table.chart-table td { padding: 11px; text-align: center; font-size: 13.5px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
table.chart-table th { background: var(--brand); color: #fff; font-weight: 600; }
table.chart-table tr:last-child td { border-bottom: none; }

/* ---------- Weekly panel chart ---------- */
.panel-chart-wrap { overflow-x: auto; border-radius: 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
table.panel-chart { width: 100%; border-collapse: collapse; background: var(--surface); min-width: 560px; }
table.panel-chart th {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 12.5px;
    padding: 10px 6px;
    text-align: center;
}
table.panel-chart td {
    border: 1px solid var(--border);
    text-align: center;
    padding: 6px 4px;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}
table.panel-chart .week-label { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; padding: 6px 10px; }
table.panel-chart .panel-cell.today { background: var(--accent-soft); }
table.panel-chart .panel-cell .open,
table.panel-chart .panel-cell .close { font-size: 12px; color: var(--muted); line-height: 1.3; }
table.panel-chart .panel-cell .jodi { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 17px; color: var(--brand); line-height: 1.3; }
table.panel-chart .panel-cell .off { color: var(--disabled-text); font-size: 13px; }
table.panel-chart .panel-cell .pending { color: var(--disabled-text); font-size: 13px; }

.chart-nav { display: flex; justify-content: space-between; margin-top: 14px; gap: 10px; }
.chart-nav .btn { width: auto; padding: 10px 18px; }

/* ---------- Empty states ---------- */
.empty-state {
    text-align: center;
    padding: 44px 20px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}
.empty-state .icon { width: 36px; height: 36px; color: #94a3b8; margin-bottom: 10px; }
.empty-state .glyph-icon { font-size: 36px; margin-bottom: 10px; color: #94a3b8; }
.empty-state .title { font-family: 'Sora', sans-serif; font-weight: 600; color: var(--ink); font-size: 15.5px; margin-bottom: 4px; }
.empty-state .subtitle { font-size: 13.5px; }

.market-card:active { opacity: 0.96; }
.game-tile { cursor: pointer; }
.game-tile:active { opacity: 0.94; }
.game-tile-icon { transition: transform 160ms var(--ease); }

.form-input { transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease); }
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12); outline: none; }

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Responsive layout & Desktop app shell ---------- */
@media (min-width: 680px) {
    .home-actions {
        gap: 12px;
    }
    .home-action-btn {
        min-height: 46px;
        padding: 10px 20px;
    }
    .markets-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }
    .home-carousel-slide img {
        aspect-ratio: 21 / 7;
    }
}

.app-layout { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

@media (min-width: 1024px) {
    body { padding-bottom: 0; }
    .menu-btn { display: none; }
    .bottom-nav-wrap { display: none; }

    .sidebar {
        display: flex;
        flex-direction: column;
        width: 248px;
        flex-shrink: 0;
        background: var(--sidebar-bg);
        border-right: 1px solid var(--border);
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
    .sidebar-toggle-btn { display: inline-flex; }
    .sidebar ~ .main-col .topbar-brand-link { display: none; }
    .sidebar ~ .main-col .topbar-page-title { display: inline-block; }
    .container { width: 92%; max-width: 1060px; padding: 28px 0 40px; margin: 0 auto; }

    body.sidebar-collapsed .sidebar { display: none; }
    body.sidebar-collapsed .sidebar ~ .main-col .topbar-brand-link { display: inline-flex; }
    body.sidebar-collapsed .sidebar ~ .main-col .topbar-page-title { display: none; }
}

@media (forced-colors: active) {
    .nav-item[aria-current="page"],
    .bottom-nav a[aria-current="page"] {
        outline: 2px solid Highlight;
    }
}

/* ---------- UPI Checkout Modal & Buttons ---------- */
.upi-checkout-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.upi-header {
    text-align: center;
    padding: 8px 0 16px;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 16px;
}
.upi-header .upi-amount-title {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.upi-header .upi-amount-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--brand);
    margin: 4px 0;
}
.upi-app-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}
.upi-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    font-weight: 700;
    font-size: 15.5px;
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
    transition: transform 120ms ease, box-shadow 120ms ease;
    cursor: pointer;
    border: none;
}
.upi-btn-primary:active { transform: scale(0.98); }
.upi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 14px 0;
}
.upi-app-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--ink);
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 700;
    transition: background-color 150ms ease, transform 120ms ease;
    cursor: pointer;
}
.upi-app-chip:active { transform: scale(0.96); }
.upi-vpa-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    margin: 12px 0;
    font-size: 13px;
    font-weight: 600;
}
.upi-copy-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    cursor: pointer;
}

/* ========================================================
   Frontend UX Performance: Top Progress Bar & Loading States
   ======================================================== */

/* 1. Global Top Progress Bar */
.app-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--brand) 0%, #22c55e 60%, #eab308 100%);
    box-shadow: 0 0 10px rgba(22, 163, 74, 0.6);
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: width 350ms cubic-bezier(0.1, 0.5, 0.1, 1), opacity 200ms ease;
}
.app-progress-bar.is-loading {
    opacity: 1;
    width: 78%;
}
.app-progress-bar.is-done {
    width: 100%;
    opacity: 0;
    transition: width 150ms ease, opacity 250ms ease 100ms;
}

/* 2. Button Loading State & Double-Submit Lock */
.btn.is-loading {
    pointer-events: none !important;
    opacity: 0.85;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2.2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
    flex-shrink: 0;
}
.btn.secondary .btn-spinner {
    border-color: rgba(22, 163, 74, 0.25);
    border-top-color: var(--brand);
}
@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* 3. Mobile Touch Feedback (:active tactile micro-interactions) */
.game-card:active,
.market-card:active,
.game-tile:active,
.digit-toggle:active,
.amount-preset-btn:active,
.bottom-nav a:active,
.home-quick-btn:active,
.btn:active {
    transform: scale(0.975);
    opacity: 0.9;
    transition: transform 60ms ease, opacity 60ms ease;
}

/* 4. Respect Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .btn-spinner { animation-duration: 2s; }
    .app-progress-bar { transition: none; }
    .app-toast[popover="manual"] {
        transition: none;
        transform: none;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-toast-region {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.app-toast[popover="manual"] {
    position: static;
    inset: auto;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 4px solid var(--brand);
    border-radius: 12px;
    padding: 12px 14px;
    background: #142a1c;
    color: #ffffff;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.25);
    font-size: 13.5px;
    line-height: 1.45;
    pointer-events: auto;
    align-items: flex-start;
    gap: 10px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 180ms ease, transform 180ms ease, overlay 180ms ease, display 180ms ease;
    transition-behavior: allow-discrete;
}

[popover].app-toast:is(:popover-open, .\:popover-open) {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

@starting-style {
    [popover].app-toast:is(:popover-open, .\:popover-open) {
        opacity: 0;
        transform: translateY(-8px);
    }
}

@supports not selector(:popover-open) {
    [popover].app-toast:not(.\:popover-open) {
        display: none;
    }
}

.app-toast.is-success { border-left-color: #16a34a; }
.app-toast.is-error { border-left-color: #dc2626; }
.app-toast.is-info { border-left-color: #0ea5e9; }

.app-toast-msg {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.app-toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
    flex-shrink: 0;
}
.app-toast-close:hover,
.app-toast-close:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
}


