/* ============================================================
   Game Coinz — light storefront theme (pipobazar-style)
   ============================================================ */
:root {
    --bg: #f6f1ee;
    --card: #ffffff;
    --border: #ecdfd8;
    --text: #2b1d18;
    --muted: #7d6b64;
    --primary: #d16a47;
    --primary-dark: #b5502f;
    --primary-soft: #fbeee8;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #16a34a;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(43, 29, 24, .08);
}

/* Dark theme — toggled via <html data-theme="dark">, persisted in localStorage */
:root[data-theme="dark"] {
    --bg: #16110e;
    --card: #211915;
    --border: #3b2d26;
    --text: #f1e7e1;
    --muted: #b09c92;
    --primary: #e07a52;
    --primary-dark: #d16a47;
    --primary-soft: #38261e;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
:root[data-theme="dark"] .site-header { background: #1d1512; border-bottom-color: #3b2d26; }
:root[data-theme="dark"] .site-footer { background: #1d1512; border-top-color: #3b2d26; }
:root[data-theme="dark"] .admin-shell::before { background: #1d1512; border-right-color: #3b2d26; }
:root[data-theme="dark"] .carousel-btn { background: rgba(20, 14, 11, .8); color: #f1e7e1; }
:root[data-theme="dark"] .chart-bar .val { background: #f1e7e1; color: #211915; }
:root[data-theme="dark"] .popup-overlay { background: rgba(0, 0, 0, .65); }
:root[data-theme="dark"] .alert-success { background: rgba(22, 163, 74, .16); color: #86efac; }
:root[data-theme="dark"] .alert-error { background: rgba(239, 68, 68, .16); color: #fca5a5; }
:root[data-theme="dark"] .alert-info { background: rgba(209, 106, 71, .16); color: #f0b9a4; }
:root[data-theme="dark"] .table tr:hover td { background: #2a211c; }
:root[data-theme="dark"] .pill-pending { background: rgba(245, 158, 11, .18); color: #fcd34d; }
:root[data-theme="dark"] .pill-processing { background: rgba(99, 102, 241, .18); color: #a5b4fc; }
:root[data-theme="dark"] .pill-completed { background: rgba(22, 163, 74, .18); color: #86efac; }
:root[data-theme="dark"] .pill-failed { background: rgba(239, 68, 68, .18); color: #fca5a5; }
:root[data-theme="dark"] .pill-refunded { background: rgba(148, 163, 184, .18); color: #cbd5e1; }
:root[data-theme="dark"] .stat-ico.green { background: rgba(22, 163, 74, .18); color: #4ade80; }
:root[data-theme="dark"] .stat-ico.amber { background: rgba(245, 158, 11, .18); color: #fbbf24; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
    background: #2b1d18;
    border-bottom: 1px solid #4a332b;
    position: sticky; top: 0; z-index: 50;
}
.site-header .brand { color: #fff; }
.nav-wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { font-size: 1.3rem; font-weight: 800; color: var(--text); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.site-footer .brand img { height: 30px; }
.brand-diamond { color: var(--primary); }
.header-search { flex: 1; display: flex; }
.header-search input {
    flex: 1; padding: 9px 14px; border: 1px solid var(--primary);
    border-right: none; border-radius: 6px 0 0 6px; font-size: .95rem; background: var(--card); color: var(--text);
}
.header-search input:focus { outline: none; box-shadow: 0 0 0 3px rgba(209, 106, 71, .18); }
.header-search button {
    background: var(--primary); color: #fff; border: 1px solid var(--primary);
    padding: 9px 20px; border-radius: 0 6px 6px 0; font-weight: 600; cursor: pointer;
}
.header-search button:hover { background: var(--primary-dark); }
.main-nav { display: flex; gap: 16px; align-items: center; white-space: nowrap; }
.main-nav a { color: #d9c4ba; font-weight: 600; font-size: .95rem; }
.main-nav a:hover, .main-nav a.active { color: #fff; text-decoration: none; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
    width: 38px; height: 38px; border-radius: 50%; flex: none; cursor: pointer;
    border: 1px solid var(--border); background: var(--card); color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    transition: border-color .15s, color .15s;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: inline; }
.site-header .theme-toggle { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff; }
.site-header .theme-toggle:hover { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- Popup banner ---------- */
.popup-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.popup-overlay[hidden] { display: none; }
.popup-box {
    background: var(--card); border-radius: 12px; max-width: 460px; width: 100%;
    display: flex; flex-direction: column; overflow: hidden; position: relative;
    max-height: calc(100vh - 40px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.popup-art {
    width: 100%; display: flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary); padding: 18px;
}
.popup-art img { width: auto; max-width: 120px; height: auto; }
.popup-art.has-img { padding: 0; }
.popup-art.has-img img { width: 100%; max-width: none; max-height: 280px; object-fit: cover; display: block; }
.popup-text { padding: 22px 24px 24px; font-size: .98rem; }
.popup-title { margin: 0 0 8px; font-size: 1.3rem; line-height: 1.25; }
.popup-text p { margin: 0 0 14px; }
.popup-text p:last-child { margin-bottom: 0; }
.popup-cta { margin-top: 4px; }
.popup-close {
    position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 50%;
    border: none; background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer;
    font-size: 1rem; line-height: 1; color: var(--text);
}

/* ---------- Banner carousel ---------- */
.carousel { position: relative; margin: 22px 0; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.carousel-track { display: flex; transition: transform .45s ease; }
.carousel-slide {
    min-width: 100%; min-height: 260px; padding: 40px 72px;
    display: flex; flex-direction: column; justify-content: center; color: #fff;
}
.carousel-slide .tag {
    align-self: flex-start; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
    padding: 3px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: 1px;
}
.carousel-slide h2 { font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 800; margin: 12px 0 6px; }
.carousel-slide p { opacity: .92; max-width: 520px; }
.carousel-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.85); color: #333; font-size: 1.1rem;
}
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; }
.carousel-dots button { width: 9px; height: 9px; border-radius: 50%; border: none; background: rgba(255,255,255,.5); cursor: pointer; padding: 0; }
.carousel-dots button.on { background: #fff; }
@media (max-width: 700px) {
    .carousel-slide { padding: 32px 52px; }
    .carousel-btn { width: 32px; height: 32px; font-size: .95rem; }
    .carousel-btn.prev { left: 8px; }
    .carousel-btn.next { right: 8px; }
    /* Stack the search bar onto its own row so brand + nav + theme toggle fit */
    .nav-wrap { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px 12px; }
    .header-search { order: 3; flex-basis: 100%; }
    .main-nav { order: 4; flex-basis: 100%; justify-content: center; gap: 18px; }
    .theme-toggle { order: 2; margin-left: auto; width: 34px; height: 34px; }
}

/* ---------- Section titles ---------- */
.section { padding: 26px 0; }
.section-title { font-size: 1.5rem; font-weight: 800; text-align: center; color: var(--text); }
.section-title span { color: var(--primary); }
.section-sub { color: var(--muted); margin: 6px 0 22px; text-align: center; }

/* ---------- Game grid ---------- */
.grid { display: grid; gap: 16px; }
.grid-games { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.game-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
    transition: transform .15s, box-shadow .15s;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(30,42,58,.14); text-decoration: none; }
.game-thumb {
    height: 130px; display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, #64748b, #334155);
}
.game-thumb.ff { background: linear-gradient(135deg, #ff512f, #dd2476); }
.game-thumb.pubg { background: linear-gradient(135deg, #f7971e, #b45309); }
.game-thumb.ml { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
.game-thumb.cod { background: linear-gradient(135deg, #434343, #000000); }
.game-name {
    padding: 10px 12px; text-align: center; font-weight: 600; font-size: .92rem;
    border-top: 1px solid var(--border); color: var(--text); background: var(--card);
}

/* ---------- Step panels (top-up page) ---------- */
.step-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; box-shadow: var(--shadow); }
.step-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.step-badge {
    width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex: none;
}
.step-head h2 { font-size: 1.02rem; color: var(--primary); font-weight: 700; }
.step-body { padding: 18px 16px; }

/* ---------- Package cards ---------- */
.pkg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pkg {
    position: relative; border: 1px solid var(--border); border-radius: 6px; background: var(--card);
    padding: 14px 10px; text-align: center; cursor: pointer; transition: border-color .12s, background .12s;
}
.pkg:hover { border-color: var(--primary); }
.pkg input { position: absolute; opacity: 0; }
.pkg .title { font-weight: 600; font-size: .92rem; color: var(--text); }
.pkg .price { color: var(--primary); font-size: .82rem; margin-top: 4px; font-weight: 600; }
.pkg .bonus { color: var(--success); font-size: .78rem; font-weight: 700; }
.pkg.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.pkg.selected::after {
    content: "✓"; position: absolute; top: -8px; left: -8px; width: 20px; height: 20px;
    background: var(--primary); color: #fff; border-radius: 50%; font-size: .7rem;
    display: flex; align-items: center; justify-content: center;
}
.pkg .popular {
    position: absolute; top: -9px; right: 8px; background: var(--accent); color: #fff;
    font-size: .64rem; font-weight: 800; padding: 2px 8px; border-radius: 999px;
}
.pkg .oos {
    position: absolute; top: -9px; right: 8px; background: var(--accent); color: #fff;
    font-size: .64rem; font-weight: 800; padding: 2px 8px; border-radius: 999px;
}
.pkg.out { opacity: .55; cursor: not-allowed; background: var(--bg); }
.pkg.out .popular { display: none; }

/* ---------- Payment cards ---------- */
.pay-list { display: flex; gap: 14px; flex-wrap: wrap; }
.pay {
    position: relative; width: 150px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--card); padding: 14px 10px; text-align: center; cursor: pointer;
}
.pay input { position: absolute; opacity: 0; }
.pay .logo { font-size: 1.5rem; }
.pay .name { font-weight: 700; font-size: .85rem; margin-top: 4px; }
.pay .sub { color: var(--muted); font-size: .75rem; }
.pay.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.pay.selected::before {
    content: "✓"; position: absolute; top: 6px; left: 6px; width: 18px; height: 18px;
    background: var(--primary); color: #fff; border-radius: 4px; font-size: .68rem;
    display: flex; align-items: center; justify-content: center;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block; border: none; cursor: pointer;
    background: var(--primary); color: #fff; font-weight: 700; padding: 10px 26px;
    border-radius: 999px; font-size: .95rem; transition: background .12s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { padding: 6px 16px; font-size: .85rem; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); }
.action-row { display: flex; gap: 12px; justify-content: flex-end; margin-top: 6px; }
.action-row { flex-wrap: wrap; }
.login-note { margin: 12px 0 8px; padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); color: var(--text); font-size: .9rem; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; color: var(--muted); }
.field label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); font-size: .95rem; }
.field label.check input { width: auto; margin: 0; }
.field input, .field select, .field textarea {
    width: 100%; padding: 10px 14px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: .95rem;
}
.field textarea { border-radius: 10px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(209, 106, 71, .18);
}
.hint { color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* ---------- Summary / rules ---------- */
[hidden] { display: none !important; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: .95rem; }
.summary-row.total { font-size: 1.15rem; font-weight: 800; border: none; color: var(--primary); }
.rules-list { list-style: none; }
.rules-list li { padding: 6px 0 6px 26px; position: relative; font-size: .92rem; }
.rules-list li::before { content: "✔"; position: absolute; left: 0; color: var(--primary); font-size: .8rem; top: 9px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; font-size: .92rem; }
.alert-success { background: #e8f8ee; border: 1px solid var(--success); color: #14532d; }
.alert-error { background: #fdecec; border: 1px solid var(--danger); color: #7f1d1d; }
.alert-info { background: var(--primary-soft); border: 1px solid var(--primary); color: #065f52; }

/* ---------- Status pills ---------- */
.pill { padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.pill-pending { background: #fef3c7; color: #92400e; }
.pill-processing { background: #e0e7ff; color: #3730a3; }
.pill-completed { background: #dcfce7; color: #166534; }
.pill-failed { background: #fee2e2; color: #991b1b; }
.pill-refunded { background: #e2e8f0; color: #475569; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; }
.table tr:hover td { background: #f8fafc; }

/* ---------- Cards (generic, admin + summary) ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.15rem; margin-bottom: 4px; }
.topup-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .topup-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { margin-top: auto; background: #2b1d18; color: #e7d7cf; padding: 36px 0 18px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.footer-grid h4 { margin-bottom: 10px; color: #fff; }
.footer-grid a { color: #e7d7cf; }
.footer-grid a:hover { color: #fff; }
.site-footer .brand { color: #fff; }
.copyright { text-align: center; font-size: .82rem; margin-top: 26px; padding-top: 16px; border-top: 1px solid #4a332b; color: #c4a99d; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none; }

/* ============================================================
   Admin shell (Monetra-style sidebar layout)
   ============================================================ */
.admin-shell { display: flex; min-height: 100vh; background: var(--bg); position: relative; }
/* Full-height dark gutter so the sidebar column covers the whole page,
   while the nav itself stays sticky inside it. */
.admin-shell::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 232px;
    background: #2b1d18; border-right: 1px solid #4a332b;
}

.admin-sidebar {
    width: 232px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
    background: transparent; color: #e7d7cf; display: flex; flex-direction: column;
}
.admin-logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px; color: #fff; font-weight: 800; letter-spacing: .5px; font-size: .95rem; }
.admin-logo img { width: 30px; height: 30px; border-radius: 8px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; flex: 1; }
.admin-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: 10px; color: #c4a99d; font-weight: 600; font-size: .9rem;
    transition: background .15s, color .15s;
}
.admin-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.admin-nav a:hover { background: #3a2a23; color: #fff; }
.admin-nav a.active { background: var(--primary); color: #fff; }
.admin-side-foot { padding: 12px; border-top: 1px solid #4a332b; display: flex; flex-direction: column; gap: 4px; }
.admin-side-foot a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c4a99d; font-weight: 600; font-size: .88rem; }
.admin-side-foot a svg { width: 20px; height: 20px; flex-shrink: 0; }
.admin-side-foot a:hover { background: #3a2a23; color: #fff; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 14px 26px;
}
.admin-topbar h1 { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.admin-user { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .9rem; color: var(--text); }
.admin-user .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem;
}
.admin-content { padding: 26px; flex: 1; }
.admin-content .section-title { text-align: left; }
.admin-content .section-title::after { display: none; }

/* ---------- Greeting ---------- */
.greeting { margin-bottom: 22px; }
.greeting h2 { font-size: 1.45rem; font-weight: 800; color: var(--text); }
.greeting p { color: var(--muted); font-size: .92rem; margin-top: 4px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px;
    display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow);
}
.stat-ico {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary);
}
.stat-ico svg { width: 22px; height: 22px; }
.stat-ico.green { background: #e8f8ee; color: #16a34a; }
.stat-ico.amber { background: #fef3c7; color: #d97706; }
.stat-ico.cocoa { background: var(--primary-soft); color: var(--text); }
.stat-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); margin: 4px 0 2px; }
.delta { font-size: .78rem; font-weight: 700; }
.delta.up { color: #16a34a; }
.delta.down { color: #dc2626; }
.delta.flat { color: var(--muted); }

/* ---------- Dashboard grid ---------- */
.dash-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
.dash-grid > * { min-width: 0; }
@media (max-width: 1020px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------- Revenue chart ---------- */
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); overflow-x: auto; }
.chart-card h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 2px; }
.chart-card .sub { color: var(--muted); font-size: .84rem; margin-bottom: 18px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 190px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.chart-bar {
    width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: var(--border);
    position: relative; transition: background .15s; min-height: 4px;
}
.chart-bar.on { background: var(--primary); }
.chart-col:hover .chart-bar { background: var(--primary-dark); }
.chart-bar .val {
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: #2b1d18; color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 8px;
    border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.chart-col:hover .chart-bar .val, .chart-bar.on .val { opacity: 1; }
.chart-lab { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }

/* ---------- Quick actions ---------- */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qa {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 10px;
    font-weight: 700; font-size: .82rem; color: var(--text); transition: border-color .15s, transform .15s;
}
.qa:hover { border-color: var(--primary); transform: translateY(-2px); }
.qa .qa-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.qa .qa-ico svg { width: 19px; height: 19px; }

/* ---------- Responsive sidebar ---------- */
@media (max-width: 700px) {
    .admin-sidebar { width: 64px; }
    .admin-shell::before { width: 64px; }
    .admin-logo span, .admin-nav a span, .admin-side-foot a span { display: none; }
    .admin-logo { justify-content: center; padding: 18px 0; }
    .admin-nav a, .admin-side-foot a { justify-content: center; padding: 12px 0; }
    .admin-content { padding: 16px; }
    .qa-grid { grid-template-columns: 1fr; }
}

/* ---------- Customer account: header menu ---------- */
.user-area { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-wrap .theme-toggle { margin-left: 4px; }
.user-menu { position: relative; }
.user-menu summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-weight: 700; font-size: .9rem;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.user-menu .uname { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.user-menu[open] .chev { transform: rotate(180deg); }
.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 80;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 6px;
}
.user-dropdown a, .user-dropdown button {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 8px;
    background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--primary-soft); text-decoration: none; }
.user-dropdown svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.user-dropdown .bal { margin-left: auto; font-size: .8rem; color: var(--primary); font-weight: 800; }
.user-dropdown form { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
@media (max-width: 640px) { .user-menu .uname { display: none; } .user-area .btn-sm { padding: 6px 12px; } }

/* ---------- Customer account: pages ---------- */
.auth-wrap { max-width: 440px; margin: 28px auto; }
.auth-wrap h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 16px 0; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px 16px; border-radius: 999px; background: #fff; color: #3c4043; border: 1px solid #dadce0; font-weight: 700; }
.btn-google:hover { background: #f7f8f8; text-decoration: none; }
.acct-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 16px; }
.acct-tabs a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 700; font-size: .9rem; }
.acct-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.acct-tabs a:hover { text-decoration: none; border-color: var(--primary); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); font-weight: 600; }
.balance-card { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-radius: 16px; padding: 22px; margin-bottom: 16px; }
.balance-card .lbl { opacity: .85; font-weight: 600; font-size: .9rem; }
.balance-card .amt { font-size: 2rem; font-weight: 800; line-height: 1.2; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset-row button { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--primary); background: var(--card); color: var(--primary); font-weight: 700; cursor: pointer; }
.preset-row button:hover { background: var(--primary-soft); }
.amt-plus { color: var(--success); font-weight: 800; }
.amt-minus { color: var(--danger); font-weight: 800; }
.table-wrap { overflow-x: auto; }

/* =====================================================================
   UI/UX + accessibility refinements. Brand colours, logo, fonts and layout
   concept are unchanged: only focus, spacing, states and contrast fixes.
   ===================================================================== */
:root { --link: #b5502f; }                       /* orange link text on light surfaces: 3.58:1 -> 5.06:1 */
:root[data-theme="dark"] { --link: var(--primary); }
a { color: var(--link); }
.btn-ghost { color: var(--link); }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.h2-size { font-size: 1.5em; }                   /* keeps the look of headings that became the page's H1 */
main:focus { outline: none; }

/* Skip link + visible keyboard focus everywhere */
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 100; background: #2b1d18; color: #fff; padding: 10px 16px; border-radius: 8px; border: 2px solid var(--primary); font-weight: 700; }
.skip-link:focus { top: 10px; text-decoration: none; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.header-search input:focus-visible { outline: none; }
input, select, textarea, button { font-family: inherit; }
::placeholder { color: var(--muted); opacity: 1; }

/* Buttons: one height, clear hover / active / disabled */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; line-height: 1.2; transition: background .15s, transform .08s, box-shadow .15s; }
.btn-sm { min-height: 36px; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-light { background: #fff; color: #2b1d18; }
.btn-light:hover { background: #f1e7e1; }
.field input:disabled, .field select:disabled, .field textarea:disabled { opacity: .6; cursor: not-allowed; }

/* Header: aligned heights, clear active/hover states */
.header-search input, .header-search button { min-height: 40px; }
.header-search input { -webkit-appearance: none; appearance: none; }
.header-search button { transition: background .15s; }
.main-nav a { padding: 6px 2px; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.main-nav a:hover { border-bottom-color: rgba(255, 255, 255, .35); }
.main-nav a.active { border-bottom-color: var(--primary); }
.brand img { height: 34px; width: auto; }
.user-area .btn { min-height: 36px; }

/* Hero / carousel */
.carousel-slide { min-height: 280px; justify-content: center; }
.carousel-slide .slide-title { font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.2; margin: 12px 0 6px; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.carousel-slide p { line-height: 1.5; }
.carousel-cta { align-self: flex-start; margin-top: 18px; }
.carousel-btn { width: 40px; height: 40px; line-height: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); transition: background .15s, transform .15s; }
.carousel-btn:hover { background: #fff; }
.carousel :focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px rgba(0, 0, 0, .55); }
.carousel-dots { bottom: 6px; }
.carousel-dots button { width: 24px; height: 24px; padding: 7px; background-color: rgba(255, 255, 255, .5); background-clip: content-box; }
.carousel-dots button.on { background-color: #fff; background-clip: content-box; }
.carousel-pause { position: absolute; left: 12px; bottom: 10px; width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(0, 0, 0, .4); color: #fff; font-size: .65rem; cursor: pointer; }
.carousel-pause:hover { background: rgba(0, 0, 0, .6); }

/* Game cards: clearly clickable, equal height, brand-coloured accent */
.game-card { color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.game-card:hover { border-color: var(--primary); box-shadow: 0 8px 22px rgba(43, 29, 24, .18); }
.game-card:active { transform: translateY(-1px); }
.game-card:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary), 0 8px 22px rgba(43, 29, 24, .18); }
.game-thumb { text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.game-name { min-height: 3.1em; display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.3; }
.game-name::after { content: "→"; content: "→" / ""; color: var(--primary); font-weight: 700; transition: transform .15s; }
.game-card:hover .game-name::after { transform: translateX(3px); }

/* Homepage "how it works" (real steps of the existing order flow) */
.how-steps { list-style: none; counter-reset: how; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 18px 0 0; padding: 0; }
.how-steps li { counter-increment: how; position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 16px 58px; }
.how-steps li::before { content: counter(how); position: absolute; left: 16px; top: 16px; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.how-steps strong { display: block; margin-bottom: 2px; }
.how-links { text-align: center; margin-top: 16px; color: var(--muted); }

/* Footer: same content, better rhythm, readable links, comfortable tap targets */
.footer-tag { color: #c4a99d; }
.footer-grid { gap: 28px; }
.footer-grid .footer-title { margin-bottom: 10px; color: #fff; font-size: 1rem; font-weight: 700; }
.footer-grid p { margin-bottom: 6px; }
.footer-grid a { display: inline-block; padding: 2px 0; text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color .15s, color .15s; }
.footer-grid a:hover, .footer-grid a:focus-visible { color: #fff; text-decoration-color: currentColor; }

/* Phones: header toggle/user area alignment, 2-column game grid, bigger touch targets */
@media (max-width: 700px) {
    .theme-toggle { margin-left: 0; width: 40px; height: 40px; }
    .user-area { margin-left: auto; }
    .carousel-slide { min-height: 240px; }
    .carousel-btn { width: 40px; height: 40px; }
    .main-nav a { padding: 10px 4px; }
}
@media (max-width: 480px) {
    .grid-games { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .game-thumb { height: 100px; font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-track, .game-card, .game-name::after, .btn, .carousel-btn { transition: none; }
    .game-card:hover, .game-card:active { transform: none; }
}

/* Header wraps from tablet width down, so brand + search + nav + account + theme toggle never overflow */
@media (max-width: 960px) {
    .nav-wrap { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px 12px; }
    .header-search { order: 3; flex-basis: 100%; }
    .main-nav { order: 4; flex-basis: 100%; justify-content: center; gap: 18px; }
    .nav-wrap .theme-toggle { order: 2; margin-left: 0; }
    .user-area { margin-left: auto; }
}
/* Phones: row 1 = logo + theme toggle, row 2 = search, row 3 = navigation + account buttons */
@media (max-width: 480px) {
    .nav-wrap { gap: 8px 12px; }
    .nav-wrap .theme-toggle { margin-left: auto; }
    .main-nav { flex-basis: auto; justify-content: flex-start; gap: 14px; }
    .user-area { order: 4; margin-left: auto; }
    .user-area .btn-sm { padding: 6px 12px; }
}

/* The full-width dots row must not swallow clicks meant for the pause button */
.carousel-dots { pointer-events: none; }
.carousel-dots button { pointer-events: auto; }
.carousel-pause { z-index: 2; }

.footer-tag { margin-top: 10px; }

/* Search bar may shrink inside narrow screens; compact nav + account buttons on phones */
.header-search { min-width: 0; }
.header-search input { min-width: 0; }
@media (max-width: 480px) {
    .main-nav { gap: 12px; }
    .main-nav a { padding: 10px 2px; }
    .user-area { gap: 6px; }
    .user-area .btn-sm { padding: 6px 10px; }
}
@media (max-width: 380px) {
    .main-nav { gap: 8px; }
    .user-area .btn-sm { padding: 6px 9px; }
}

/* Game images (uploaded in Admin -> Games) */
.game-thumb.has-img { background: var(--card); padding: 0; overflow: hidden; }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-head { display: flex; align-items: center; gap: 14px; }
.game-head-img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; border: 1px solid var(--border); flex: none; }

/* Audit remediation: maintain readable contrast for primary text and controls. */
:root:not([data-theme="dark"]) {
    --primary: #b5502f;
}
:root,
:root[data-theme="dark"] {
    --accessible-primary: #b5502f;
    --accessible-primary-hover: #923d24;
}
.header-search button,
.btn:not(.btn-light):not(.btn-ghost):not(.btn-danger):not(.btn-success) {
    background-color: var(--accessible-primary);
    border-color: var(--accessible-primary);
    color: #fff;
}
.header-search button:hover,
.btn:not(.btn-light):not(.btn-ghost):not(.btn-danger):not(.btn-success):hover {
    background-color: var(--accessible-primary-hover);
    border-color: var(--accessible-primary-hover);
    color: #fff;
}
.step-badge,
.pay.selected::before,
.admin-nav a.active,
.admin-user .avatar,
.user-menu .avatar,
.acct-tabs a.active,
.how-steps li::before {
    background-color: var(--accessible-primary);
    border-color: var(--accessible-primary);
    color: #fff;
}

