/* GameRoom — Trust Wallet depth + Stripe dashboard refinement */
:root {
    --font-sans: "Inter", system-ui, -apple-system, sans-serif;
    --font-display: "Plus Jakarta Sans", var(--font-sans);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.32, 0.72, 0, 1);
    --shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.12);
    --shadow-stripe: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
    --transition: 0.2s var(--ease-smooth);
    --transition-slow: 0.35s var(--ease-out-expo);
}

[data-theme="dark"] {
    --bg0: #090b10;
    --bg1: #0c0f15;
    --bg2: #12161f;
    --bg-elevated: #161b26;
    --text: #f4f6fb;
    --muted: #949ba8;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.11);
    --glass: rgba(18, 22, 32, 0.82);
    --glass-border: rgba(255, 255, 255, 0.09);
    --accent: #3b82f6;
    --accent-bright: #60a5fa;
    --accent-stripe: #6366f1;
    --teal: #2dd4bf;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #fb7185;
    --card: rgba(255, 255, 255, 0.035);
    --card-hover: rgba(255, 255, 255, 0.055);
    --glow: rgba(59, 130, 246, 0.15);
    --mesh-1: rgba(51, 119, 255, 0.14);
    --mesh-2: rgba(99, 102, 241, 0.12);
    --mesh-3: rgba(45, 212, 191, 0.08);
    --analytics-map-water: var(--bg0);
    --analytics-map-land-low: var(--bg2);
}

[data-theme="light"] {
    --bg0: #f6f9fc;
    --bg1: #ffffff;
    --bg2: #ffffff;
    --bg-elevated: #ffffff;
    --text: #0a2540;
    --muted: #697386;
    --line: rgba(10, 37, 64, 0.08);
    --line-strong: rgba(10, 37, 64, 0.12);
    --glass: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(10, 37, 64, 0.06);
    --accent: #2563eb;
    --accent-bright: #3b82f6;
    --accent-stripe: #5b5bd6;
    --teal: #0d9488;
    --success: #059669;
    --warning: #d97706;
    --danger: #e11d48;
    --card: #ffffff;
    --card-hover: #f8fafc;
    --glow: rgba(37, 99, 235, 0.08);
    --mesh-1: rgba(37, 99, 235, 0.06);
    --mesh-2: rgba(91, 91, 214, 0.05);
    --mesh-3: rgba(13, 148, 136, 0.04);
    /* Map: separate “ocean” vs low-traffic land so light UI isn’t a black hole */
    --analytics-map-water: #bcd3ea;
    --analytics-map-land-low: #e9f1fa;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    font-family: var(--font-sans);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    color: var(--text);
    line-height: 1.55;
    letter-spacing: -0.011em;
    background-color: var(--bg0);
    background-image:
        radial-gradient(1000px 520px at 85% -15%, var(--mesh-2), transparent 55%),
        radial-gradient(900px 480px at 5% 0%, var(--mesh-1), transparent 50%),
        radial-gradient(700px 400px at 50% 100%, var(--mesh-3), transparent 45%),
        linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 100%);
    transition: background-color var(--transition-slow), color var(--transition);
}

/* Subtle mesh drift (Trust-style atmosphere) */
body.app-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, var(--mesh-1), transparent),
        radial-gradient(ellipse 60% 40% at 80% 60%, var(--mesh-2), transparent);
    animation: meshDrift 18s ease-in-out infinite alternate;
}

@keyframes meshDrift {
    0% { transform: translate(0, 0) scale(1); opacity: 0.45; }
    100% { transform: translate(-2%, 1%) scale(1.03); opacity: 0.6; }
}

.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.2;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.page-title-row h1 {
    font-size: clamp(1.28rem, 4.2vw, 1.85rem);
    line-height: 1.18;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent-bright);
    text-decoration: none;
    transition: color var(--transition), opacity var(--transition);
}
[data-theme="light"] a { color: var(--accent); }
a:hover {
    color: var(--accent-stripe);
    opacity: 0.92;
}

/* —— Glass / surfaces (Stripe-clean + TW depth) —— */
.glass {
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(1.15);
    -webkit-backdrop-filter: blur(20px) saturate(1.15);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-stripe), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color var(--transition), box-shadow var(--transition);
}

[data-theme="light"] .glass {
    box-shadow: var(--shadow-stripe);
}

/* —— Sidebar —— */
.sidebar {
    width: 268px;
    padding: 1.35rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
    border-right: 1px solid var(--line);
    transition: transform var(--transition-slow), box-shadow var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.5rem 0.85rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.125rem;
    letter-spacing: -0.04em;
}

.logo-dot {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, #3377ff 0%, #6366f1 45%, #2dd4bf 100%);
    background-size: 200% 200%;
    animation: logoGradient 5s ease infinite;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12) inset,
        0 4px 16px rgba(51, 119, 255, 0.35),
        0 0 28px rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

.logo-dot.admin {
    background: linear-gradient(135deg, #f59e0b 0%, #fb7185 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 4px 16px rgba(245, 158, 11, 0.3);
    animation: logoGradient 6s ease infinite;
}

@keyframes logoGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.68rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
    transition:
        color var(--transition),
        background var(--transition),
        transform 0.2s var(--ease-spring);
}

.nav-item .nav-ico {
    font-size: 1rem;
    opacity: 0.85;
    transition: transform 0.25s var(--ease-spring);
}

.nav-item:hover {
    color: var(--text);
    background: var(--card);
    transform: translateX(3px);
}

.nav-item:hover .nav-ico {
    transform: scale(1.08);
}

.nav-item.active {
    color: var(--text);
    background: linear-gradient(90deg, var(--glow), transparent 88%);
    font-weight: 600;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--accent-bright), var(--accent-stripe));
    animation: navBarIn 0.35s var(--ease-out-expo) forwards;
}

@keyframes navBarIn {
    to { transform: translateY(-50%) scaleY(1); }
}

.nav-item.subtle {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 500;
}

.sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.85rem;
    margin-top: auto;
    border-top: 1px solid var(--line);
}

.badge-support {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(59, 130, 246, 0.12));
    color: var(--success);
    border: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    animation: badgePulse 3s ease-in-out infinite;
}

.badge-support::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: liveDot 1.5s ease-in-out infinite;
}

@keyframes liveDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset; }
    50% { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 0 20px rgba(52, 211, 153, 0.12); }
}

/* —— Main / topbar —— */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem 1.35rem;
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 0.85rem;
    border-bottom: 1px solid var(--line);
    transition: border-color var(--transition);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
}

.balance-pill {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: -0.03em;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-pill);
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s var(--ease-spring), border-color var(--transition), box-shadow var(--transition);
}

.balance-pill:hover {
    transform: scale(1.02);
    border-color: var(--line-strong);
    box-shadow: 0 4px 16px var(--glow);
}

.user-name {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.theme-toggle,
.icon-btn {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    transition:
        transform 0.2s var(--ease-spring),
        border-color var(--transition),
        box-shadow var(--transition),
        background var(--transition);
}

.theme-toggle:hover,
.icon-btn:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft), 0 0 0 3px var(--glow);
}

.theme-toggle:active,
.icon-btn:active,
.btn:active {
    transform: scale(0.97);
}

.theme-toggle.theme-toggle--spin {
    animation: themeSpin 0.55s var(--ease-spring);
}

@keyframes themeSpin {
    from { transform: rotate(0deg) scale(1); }
    to { transform: rotate(180deg) scale(1); }
}

/* —— Page enter stagger (Stripe polish) —— */
.page-content {
    padding: 1.15rem 1.35rem 3rem;
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
}

.page-content.page-enter > * {
    animation: enterUp 0.55s var(--ease-out-expo) backwards;
}

.page-content.page-enter > *:nth-child(1) { animation-delay: 0.03s; }
.page-content.page-enter > *:nth-child(2) { animation-delay: 0.07s; }
.page-content.page-enter > *:nth-child(3) { animation-delay: 0.11s; }
.page-content.page-enter > *:nth-child(4) { animation-delay: 0.15s; }
.page-content.page-enter > *:nth-child(5) { animation-delay: 0.19s; }
.page-content.page-enter > *:nth-child(6) { animation-delay: 0.23s; }
.page-content.page-enter > *:nth-child(7) { animation-delay: 0.27s; }
.page-content.page-enter > *:nth-child(8) { animation-delay: 0.31s; }
.page-content.page-enter > *:nth-child(9) { animation-delay: 0.35s; }
.page-content.page-enter > *:nth-child(10) { animation-delay: 0.39s; }
.page-content.page-enter > *:nth-child(11) { animation-delay: 0.43s; }
.page-content.page-enter > *:nth-child(12) { animation-delay: 0.47s; }

@keyframes enterUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .grid-3 { grid-template-columns: 1fr; }
}

/* Support tickets: single column on phones/tablets; two columns from md breakpoint up */
.tickets-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.tickets-split > .panel {
    min-width: 0;
}

.tickets-split .table-wrap {
    min-width: 0;
}

@media (min-width: 768px) {
    .tickets-split {
        grid-template-columns: 1fr 1fr;
        gap: 1.1rem;
    }
}

/* —— Stat cards —— */
.stat-card {
    padding: 1.25rem 1.35rem;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-stripe);
    transition:
        transform 0.35s var(--ease-out-expo),
        border-color var(--transition),
        box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft), 0 0 0 1px rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .stat-card:hover {
    box-shadow: var(--shadow), 0 0 40px -8px var(--glow);
}

a.stat-card {
    cursor: pointer;
    text-align: left;
}

a.stat-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-value {
    font-size: clamp(1.35rem, 3.8vw, 1.75rem);
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-top: 0.45rem;
    color: var(--text);
}

[data-theme="dark"] .stat-value {
    color: #f8fafc;
    text-shadow: 0 0 40px rgba(59, 130, 246, 0.15);
}

.panel {
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 1.35rem;
    margin-top: 1.35rem;
    backdrop-filter: blur(16px);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.panel:hover {
    border-color: var(--line-strong);
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    transition: border-color var(--transition);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    transition: background var(--transition);
}

.data-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg2);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--card-hover);
}

/* —— Buttons —— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    font-size: 0.895rem;
    font-family: var(--font-sans);
    letter-spacing: -0.015em;
    cursor: pointer;
    transition:
        transform 0.2s var(--ease-spring),
        box-shadow var(--transition),
        filter var(--transition),
        opacity var(--transition);
}

/* Use .btn.btn-primary so label color beats [data-theme="light"] a { color: … } on <a class="btn btn-primary"> */
.btn.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-stripe) 100%);
    color: #fff;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(59, 130, 246, 0.35);
    position: relative;
    overflow: hidden;
}

.btn.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.2) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s var(--ease-out-expo);
}

.btn.btn-primary:hover {
    color: #fff;
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 12px 32px rgba(99, 102, 241, 0.35);
}

.btn.btn-primary:hover::after {
    transform: translateX(100%);
}

.btn-ghost {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-ghost:hover {
    background: var(--card-hover);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.btn.btn-danger {
    background: linear-gradient(135deg, var(--danger), #be123c);
    color: #fff;
}

.btn.btn-danger:hover {
    color: #fff;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
}

.form-row { margin-bottom: 1rem; }

.form-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    max-width: 420px;
    padding: 0.72rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg2);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9375rem;
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        transform 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--glow);
    transform: translateY(-1px);
}

/* —— Auth / landing —— */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.25rem;
    border-radius: var(--radius);
    animation: enterUp 0.65s var(--ease-out-expo) backwards;
}

.auth-card h1 { margin-bottom: 0.35rem; }

.auth-sub {
    color: var(--muted);
    margin-bottom: 1.65rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.landing-hero {
    text-align: center;
    padding: clamp(3rem, 12vw, 6rem) 1rem 4rem;
    position: relative;
    z-index: 1;
    animation: enterUp 0.8s var(--ease-out-expo) backwards;
}

.landing-hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--text);
}

[data-theme="dark"] .landing-hero h1 {
    color: #fff;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.landing-actions {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.85rem;
}

/* —— Game / market cards —— */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 272px), 1fr));
    gap: 1.1rem;
    align-items: start;
}

.game-card {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--card);
    padding: 1.2rem;
    display: flex;
    flex-direction: row;
    gap: 1.1rem;
    align-items: flex-start;
    align-self: start;
    min-height: 0;
    box-shadow: var(--shadow-stripe);
    transition:
        transform 0.35s var(--ease-out-expo),
        border-color var(--transition),
        box-shadow var(--transition);
}

/* Game Points cards: icon only beside the title — forms use full card width (no dead left column). */
.game-card--games {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}

.game-card--games .game-card__header {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.1rem;
}

.game-card--games .game-card__headline {
    flex: 1;
    min-width: 0;
}

.game-card--games .game-card__body {
    flex: none;
    width: 100%;
    min-width: 0;
}

.game-card--games .game-card__body > :first-child {
    margin-top: 0;
}

.game-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.game-card__title {
    font-size: 1.05rem;
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.game-card__rate {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.game-card__links {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
}

.game-card__hint {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0.75rem 0 0;
    line-height: 1.45;
}

.game-card__hint--tight {
    margin-top: 0.5rem;
}

.game-card__add-account {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.game-card .refill-details {
    margin-top: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg-elevated);
    padding: 0.55rem 0.7rem;
    transition: border-color var(--transition);
}

[data-theme="light"] .game-card .refill-details {
    background: var(--card-hover);
}

.game-card .refill-details[open] {
    border-color: var(--line-strong);
}

.game-card .refill-details summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.game-card .refill-details summary::-webkit-details-marker {
    display: none;
}

.game-card .refill-details .account-refill-form {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--line);
}

.game-card .account-order-form {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.game-card--games .game-card__submit {
    width: 100%;
    margin-top: 0.25rem;
}

.game-card:hover {
    transform: translateY(-5px) scale(1.01);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft), 0 0 0 1px var(--glow);
}

.game-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    transition: transform 0.4s var(--ease-out-expo), box-shadow var(--transition);
}

.game-card:hover .game-icon {
    transform: scale(1.06) rotate(-2deg);
    box-shadow: 0 8px 20px var(--glow);
}

.pill {
    display: inline-block;
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: transform 0.2s var(--ease-spring);
}

.pill-ok {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.pill-warn {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.22);
}

.pill-muted {
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--line);
}

/* —— Chat —— */
.chat-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg2);
    min-height: 320px;
    max-height: 480px;
    overflow-y: auto;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.75rem 0.95rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: bubbleIn 0.35s var(--ease-out-expo) backwards;
}

@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.chat-bubble.me {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-stripe) 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.chat-bubble.them {
    align-self: flex-start;
    background: var(--card);
    border: 1px solid var(--line);
}

.chat-meta {
    font-size: 0.7rem;
    opacity: 0.82;
    margin-top: 0.4rem;
    font-weight: 500;
}

.chat-input-row {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.chat-input-row input { flex: 1; max-width: none; min-width: 0; }

@media (max-width: 640px) {
    .chat-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-input-row .btn {
        width: 100%;
    }
}

/* —— Skeleton —— */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--card) 0%,
        var(--line) 50%,
        var(--card) 100%
    );
    background-size: 200% 100%;
    animation: sk 1.4s ease infinite;
    border-radius: 10px;
    height: 14px;
}

@keyframes sk {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* —— Toast —— */
.toast-host {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    font-size: 0.895rem;
    font-weight: 500;
    animation: toastIn 0.4s var(--ease-out-expo);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* —— Confirm modal (replaces native confirm) —— */
html.gr-confirm-open {
    overflow: hidden;
}

.gr-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-sizing: border-box;
    z-index: 20000;
    /* Full viewport on mobile (address bar / notches) */
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    display: grid;
    place-items: center;
    align-content: center;
    padding: max(0.75rem, env(safe-area-inset-top, 0px))
        max(0.75rem, env(safe-area-inset-right, 0px))
        max(0.75rem, env(safe-area-inset-bottom, 0px))
        max(0.75rem, env(safe-area-inset-left, 0px));
    background: rgba(5, 8, 14, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s var(--ease-smooth), visibility 0.22s;
    overscroll-behavior: contain;
}

.gr-confirm-overlay.gr-confirm-overlay--open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.gr-confirm-dialog {
    box-sizing: border-box;
    position: relative;
    width: min(26rem, calc(100% - 1.5rem));
    max-width: 100%;
    max-height: min(85vh, calc(100dvh - 2rem));
    max-height: min(85svh, calc(100dvh - 2rem));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    margin: 0;
    padding: 1.35rem 1.35rem 1.15rem;
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transform: scale(0.96) translateY(12px);
    transform-origin: center center;
    opacity: 0;
    transition:
        transform 0.28s var(--ease-out-expo),
        opacity 0.22s var(--ease-smooth);
}

.gr-confirm-overlay.gr-confirm-overlay--open .gr-confirm-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .gr-confirm-dialog {
        transform: none;
        transition: opacity 0.15s ease;
    }
    .gr-confirm-overlay.gr-confirm-overlay--open .gr-confirm-dialog {
        transform: none;
    }
}

.gr-confirm-title {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2.8vw, 1.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.gr-confirm-message {
    margin: 0 0 1.25rem;
    font-size: clamp(0.88rem, 2.5vw, 0.94rem);
    line-height: 1.55;
    color: var(--muted);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.gr-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
    align-items: stretch;
}

.gr-confirm-actions .btn {
    min-width: 6.5rem;
    justify-content: center;
}

@media (max-width: 480px) {
    .gr-confirm-actions {
        flex-direction: column-reverse;
    }
    .gr-confirm-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

.mobile-only { display: none; }

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-102%);
        width: min(268px, 92vw);
        height: 100%;
        height: 100dvh;
        max-height: -webkit-fill-available;
        padding: max(1.35rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) max(1.35rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.35);
    }
    .mobile-only { display: inline-flex; }
    .page-content { padding: 0.95rem 1rem 2.5rem; }

    .topbar {
        flex-wrap: wrap;
        padding: 0.65rem max(0.75rem, env(safe-area-inset-right, 0px)) 0.65rem max(0.75rem, env(safe-area-inset-left, 0px));
        padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
        gap: 0.5rem;
    }

    .topbar-user {
        flex-wrap: wrap;
        justify-content: flex-end;
        row-gap: 0.45rem;
        min-width: 0;
    }

    .user-name {
        max-width: min(42vw, 12rem);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .balance-pill {
        font-size: clamp(0.78rem, 2.6vw, 0.875rem);
        padding: 0.4rem 0.75rem;
    }

    .btn:not(.btn-sm) {
        min-height: 44px;
        box-sizing: border-box;
    }

    .btn-sm {
        min-height: 40px;
        box-sizing: border-box;
    }

    .nav-item {
        min-height: 44px;
        box-sizing: border-box;
    }

    .icon-btn,
    .theme-toggle {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    input[type="search"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px;
        max-width: 100%;
    }

    .panel {
        padding: clamp(1rem, 3vw, 1.35rem);
    }
}

@media (max-width: 380px) {
    .page-content {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    .auth-card {
        padding: clamp(1.35rem, 5vw, 2.25rem);
    }
}

@media (min-width: 1440px) {
    .page-content {
        padding-left: clamp(1.35rem, 2vw, 2rem);
        padding-right: clamp(1.35rem, 2vw, 2rem);
    }
}

@media (min-width: 1920px) {
    .admin-body .page-content {
        max-width: min(1420px, 92vw);
    }

    body:not(.admin-body) .page-content {
        max-width: min(1180px, 92vw);
    }
}

.admin-body .page-content { max-width: 1420px; }

.copy-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.mono {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.84rem;
    word-break: break-all;
}

.wallet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 248px), 1fr));
    gap: 1rem;
}

.wallet-card {
    padding: 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow-stripe);
    transition: transform 0.3s var(--ease-out-expo), border-color var(--transition);
}

.wallet-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
}

.flash {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    animation: enterUp 0.4s var(--ease-out-expo) backwards;
}

.flash-error {
    background: rgba(251, 113, 133, 0.12);
    border: 1px solid rgba(251, 113, 133, 0.3);
    color: var(--danger);
}

.flash-success {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.28);
    color: var(--success);
}

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 0.35rem;
}

hr.divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 1.35rem 0;
}

/* —— Order ops / workflow UI —— */
.order-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
    gap: 1rem;
}

.timeline-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.timeline-list li { margin-bottom: 0.35rem; }

/* —— Crypto receive (Trust-style QR + address) —— */
.crypto-receive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1.25rem;
    margin: 1.25rem 0;
}

.crypto-receive-card {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--card);
    padding: 1.15rem 1.2rem 1.25rem;
    box-shadow: var(--shadow-stripe);
}

.crypto-receive-warn {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.65rem;
    margin-bottom: 1rem;
}

[data-theme="light"] .crypto-receive-warn {
    color: #b45309;
}

.crypto-receive-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.crypto-receive-symbol {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.crypto-qr-frame {
    background: #fff;
    border-radius: 20px;
    padding: 1rem 1rem 0.85rem;
    margin: 0 auto;
    max-width: 260px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.crypto-qr-frame img {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

.crypto-qr-address {
    margin-top: 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
    word-break: break-all;
    line-height: 1.35;
    font-family: ui-monospace, monospace;
}

.crypto-receive-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.crypto-receive-memo {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
    margin-top: 0.65rem;
}

.account-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.account-package {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.15rem;
    background: var(--card);
    box-shadow: var(--shadow-stripe);
    transition: transform 0.3s var(--ease-out-expo), border-color var(--transition);
}

.account-package:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
}

.account-package-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.account-package-actions {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.refill-details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--accent-bright);
}

.notif-dropdown {
    position: relative;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-height: min(420px, 70vh);
    display: flex;
    flex-direction: column;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(1.15);
    -webkit-backdrop-filter: blur(20px) saturate(1.15);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 200;
    overflow: hidden;
}

[data-theme="light"] .notif-panel {
    /* Softer elevation on light backgrounds (global --shadow is tuned for dark UI) */
    box-shadow:
        0 12px 40px -10px rgba(10, 37, 64, 0.14),
        0 4px 14px rgba(10, 37, 64, 0.08);
}

/* display:flex above overrides native [hidden]; keep panel actually hidden when closed */
.notif-panel[hidden] {
    display: none !important;
}

.notif-panel-head {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

.notif-panel-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 0;
}

.notif-empty {
    margin: 0;
    padding: 1rem 1.25rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.notif-item {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--line);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.notif-item-body {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
    word-break: break-word;
}

.notif-panel-foot {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
}

.notif-bell {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--danger), #be123c);
    color: #fff;
    font-size: 0.65rem;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Notification dropdown + toasts: fit narrow viewports (avoid right-anchored overflow) */
@media (max-width: 900px) {
    .notif-panel {
        position: fixed;
        left: max(0.75rem, env(safe-area-inset-left, 0px));
        right: max(0.75rem, env(safe-area-inset-right, 0px));
        top: max(4.65rem, calc(env(safe-area-inset-top, 0px) + 3.6rem));
        width: auto;
        max-height: min(62vh, 26rem);
        z-index: 80;
        border-radius: 14px;
    }

    .notif-panel-head {
        padding: 0.85rem 1rem;
        font-size: 1rem;
    }

    .notif-item {
        padding: 0.85rem 1rem;
    }

    .notif-item-title {
        font-size: 0.95rem;
    }

    .notif-item-body {
        font-size: 0.875rem;
        line-height: 1.45;
    }

    .notif-empty {
        padding: 1.15rem 1.25rem;
        font-size: 0.9rem;
    }

    .notif-panel-foot {
        padding: 0.65rem 0.85rem;
    }

    .notif-panel-foot .btn {
        min-height: 44px;
        padding-inline: 1rem;
    }

    .toast-host {
        left: max(0.65rem, env(safe-area-inset-left, 0px));
        right: max(0.65rem, env(safe-area-inset-right, 0px));
        bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
        align-items: stretch;
    }

    .toast {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 0.875rem;
        padding: 0.8rem 1rem;
        line-height: 1.45;
    }
}

/* —— Admin analytics (map + charts) —— */
.analytics-top-stats {
    margin-bottom: 1.25rem;
}

.analytics-map-panel {
    --analytics-map-canvas: var(--analytics-map-water);
}

.analytics-world-map {
    width: 100%;
    min-height: min(420px, 55vh);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--analytics-map-canvas);
}

.analytics-map-panel .jsvmap-container {
    min-height: min(420px, 55vh);
    background: var(--analytics-map-canvas) !important;
}

.analytics-map-panel .jsvmap-container svg {
    background-color: var(--analytics-map-canvas);
}

.analytics-world-map .jsvmap-container {
    background: var(--analytics-map-canvas) !important;
}

.analytics-map-section {
    margin-top: 1.25rem;
    margin-bottom: 1.35rem;
}

.analytics-map-hint {
    margin-bottom: 1rem !important;
}

.analytics-map-tip,
.jsvmap-tooltip {
    font-size: 0.82rem;
    line-height: 1.45;
    max-width: 220px;
}

.jsvmap-tooltip {
    background: var(--glass) !important;
    color: var(--text) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-soft) !important;
    padding: 0.5rem 0.65rem !important;
}

.analytics-charts-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    margin-top: 0;
}

@media (min-width: 960px) {
    .analytics-charts-row {
        grid-template-columns: 1.65fr 1fr;
        align-items: stretch;
    }
}

.analytics-chart-wrap {
    position: relative;
    height: min(320px, 45vh);
    width: 100%;
}

.analytics-chart-wrap--traffic {
    height: min(340px, 48vh);
    min-height: 260px;
}

.analytics-chart-wrap--pie {
    height: min(300px, 42vh);
    max-width: 100%;
    margin: 0 auto;
}

.analytics-period-stats {
    margin-top: 1.35rem;
}

.analytics-period-stats .stat-card {
    padding: 0.8rem 1rem;
}

.analytics-period-stats .stat-label {
    margin-bottom: 0.2rem;
}

.analytics-period-stats .stat-value {
    font-size: 1.15rem !important;
}

/* —— Respect user motion preferences —— */
@media (prefers-reduced-motion: reduce) {
    body.app-body::before,
    .logo-dot,
    .badge-support,
    .badge-support::before,
    .page-content.page-enter > *,
    .auth-card,
    .landing-hero,
    .flash,
    .chat-bubble,
    .toast,
    .theme-toggle.theme-toggle--spin {
        animation: none !important;
    }

    .nav-item,
    .nav-item .nav-ico,
    .stat-card,
    .game-card,
    .game-icon,
    .btn.btn-primary::after {
        transition-duration: 0.01ms !important;
    }
}
