:root {
    --gh-bg: #070a0f;
    --gh-panel: #0d131b;
    --gh-panel-2: #111923;
    --gh-line: rgba(148, 163, 184, .15);
    --gh-line-strong: rgba(245, 184, 31, .30);
    --gh-gold: #f6bd2a;
    --gh-gold-2: #ffd75a;
    --gh-green: #24d892;
    --gh-red: #ff5d70;
    --gh-blue: #4ca8ff;
    --gh-text: #f4f7fb;
    --gh-muted: #8994a5;
    --gh-radius: 18px;
    --gh-shadow: 0 18px 55px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html {
    color-scheme: dark;
    scroll-behavior: smooth;
    background: var(--gh-bg);
}

body {
    min-width: 320px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body::selection { background: rgba(246, 189, 42, .28); color: #fff; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--gh-gold);
    outline-offset: 3px;
}

:where(button, a, input, select, textarea) {
    -webkit-tap-highlight-color: transparent;
}

:where(button, input, select, textarea) { font: inherit; }

button:not(:disabled), [role="button"]:not([aria-disabled="true"]), summary { cursor: pointer; }

button:disabled, [aria-disabled="true"] {
    cursor: not-allowed !important;
    opacity: .52;
    filter: saturate(.55);
}

:where(input, select, textarea) {
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

:where(input, select, textarea):focus {
    border-color: rgba(246, 189, 42, .65) !important;
    box-shadow: 0 0 0 3px rgba(246, 189, 42, .11) !important;
}

:where(button, a[class*="button"], a[class*="btn"], a[class*="action"]) {
    transition: transform .16s ease, border-color .16s ease, background-color .16s ease,
        color .16s ease, box-shadow .16s ease, opacity .16s ease;
}

@media (hover:hover) {
    :where(button, a[class*="button"], a[class*="btn"], a[class*="action"]):not(:disabled):hover {
        transform: translateY(-1px);
    }
}

img { max-width: 100%; }

/* Consistent page progress bar */
.gh-page-progress {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100000;
    height: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--gh-gold), var(--gh-gold-2), transparent);
    transform: translateX(-105%);
    opacity: 0;
}

.gh-page-progress.is-loading {
    opacity: 1;
    animation: gh-progress 1.1s ease-in-out infinite;
}

@keyframes gh-progress {
    0% { transform: translateX(-100%); }
    65% { transform: translateX(35%); }
    100% { transform: translateX(105%); }
}

/* Toast notifications shared by every page */
.gh-toast-stack {
    position: fixed;
    z-index: 99999;
    top: 20px;
    right: 20px;
    display: grid;
    width: min(390px, calc(100vw - 32px));
    gap: 10px;
    pointer-events: none;
}

.gh-toast {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 11px;
    padding: 13px 14px;
    border: 1px solid var(--gh-line);
    border-radius: 14px;
    color: var(--gh-text);
    background: rgba(13, 19, 27, .96);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .38);
    backdrop-filter: blur(18px);
    pointer-events: auto;
    animation: gh-toast-in .25s ease both;
}

.gh-toast.is-leaving { animation: gh-toast-out .2s ease both; }
.gh-toast.success { border-color: rgba(36, 216, 146, .34); }
.gh-toast.error { border-color: rgba(255, 93, 112, .38); }
.gh-toast.warning { border-color: rgba(246, 189, 42, .38); }

.gh-toast-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: var(--gh-gold);
    background: rgba(246, 189, 42, .1);
    font-weight: 900;
}
.gh-toast.success .gh-toast-icon { color: var(--gh-green); background: rgba(36,216,146,.10); }
.gh-toast.error .gh-toast-icon { color: var(--gh-red); background: rgba(255,93,112,.11); }
.gh-toast-copy { min-width: 0; }
.gh-toast-copy b { display: block; margin-bottom: 2px; font-size: 13px; }
.gh-toast-copy span { display: block; color: var(--gh-muted); font-size: 12px; line-height: 1.4; }
.gh-toast-close { border: 0; padding: 6px; color: var(--gh-muted); background: none; }

@keyframes gh-toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes gh-toast-out { to { opacity: 0; transform: translateX(18px) scale(.98); } }

/* Consistent custom confirmation dialog */
.gh-confirm-backdrop {
    position: fixed;
    z-index: 99998;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(1, 3, 7, .76);
    backdrop-filter: blur(9px);
    animation: gh-fade .18s ease both;
}

.gh-confirm-dialog {
    width: min(440px, 100%);
    padding: 24px;
    border: 1px solid var(--gh-line-strong);
    border-radius: 20px;
    color: var(--gh-text);
    background: linear-gradient(145deg, #111923, #0a0f16);
    box-shadow: var(--gh-shadow);
}

.gh-confirm-symbol {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    border-radius: 14px;
    color: #151000;
    background: linear-gradient(135deg, var(--gh-gold-2), var(--gh-gold));
    font-size: 23px;
    font-weight: 900;
}

.gh-confirm-dialog h2 { margin: 0 0 8px; font-size: 21px; }
.gh-confirm-dialog p { margin: 0; color: var(--gh-muted); line-height: 1.55; }
.gh-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.gh-confirm-actions button { min-height: 46px; border-radius: 12px; font-weight: 800; }
.gh-confirm-cancel { border: 1px solid var(--gh-line); color: var(--gh-text); background: #111821; }
.gh-confirm-ok { border: 1px solid var(--gh-gold); color: #171100; background: linear-gradient(135deg, var(--gh-gold-2), var(--gh-gold)); }

@keyframes gh-fade { from { opacity: 0; } }

/* Loading state for submitted forms */
form.gh-is-submitting { pointer-events: none; }
form.gh-is-submitting button[type="submit"] { position: relative; color: transparent !important; }
form.gh-is-submitting button[type="submit"]::after {
    content: "";
    position: absolute;
    left: 50%; top: 50%;
    width: 18px; height: 18px;
    margin: -9px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-right-color: rgba(0,0,0,.28);
    border-radius: 50%;
    animation: gh-spin .7s linear infinite;
}
@keyframes gh-spin { to { transform: rotate(360deg); } }

/* Common empty-state polish */
:where([class*="empty"]):not(:empty) {
    border-radius: 16px;
}

/* Accessible horizontal tables on narrow screens */
:where(.table-wrap, .affiliate-table-wrap) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #080c12; }
::-webkit-scrollbar-thumb { border: 2px solid #080c12; border-radius: 999px; background: #293240; }
::-webkit-scrollbar-thumb:hover { background: #3a4657; }

@media (max-width: 720px) {
    .gh-toast-stack { top: 12px; right: 12px; width: calc(100vw - 24px); }
    .gh-confirm-dialog { padding: 20px; }
    .gh-confirm-actions { grid-template-columns: 1fr; }
    table { min-width: 680px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Shared navigation language across legacy sections */
:where(.topbar, .shop-head, .gh-boxes-header, .inventory-topbar, .ally-head) {
    border-bottom-color: var(--gh-line) !important;
    box-shadow: 0 10px 34px rgba(0, 0, 0, .16);
}

:where(.topbar, .shop-head, .gh-boxes-header, .inventory-topbar, .ally-head) nav a[aria-current="page"] {
    color: var(--gh-gold) !important;
    background: rgba(246, 189, 42, .09) !important;
}

.gh-release-mobile-nav { display: none; }

@media (max-width: 760px) {
    body:has(.gh-release-mobile-nav) { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    .gh-release-mobile-nav {
        position: fixed;
        z-index: 9000;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        min-height: 68px;
        padding-bottom: env(safe-area-inset-bottom);
        border-top: 1px solid var(--gh-line);
        background: rgba(7, 11, 16, .96);
        box-shadow: 0 -12px 32px rgba(0, 0, 0, .34);
        backdrop-filter: blur(18px);
    }
    .gh-release-mobile-nav a {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
        color: var(--gh-muted);
        text-decoration: none;
    }
    .gh-release-mobile-nav a span { font-size: 17px; line-height: 1; }
    .gh-release-mobile-nav a b { overflow: hidden; max-width: 100%; font-size: 9px; text-overflow: ellipsis; }
    .gh-release-mobile-nav a[aria-current="page"] { color: var(--gh-gold); }
}

/* A single navigation bar for every administrator screen */
.gh-release-admin-nav {
    position: sticky;
    z-index: 9500;
    top: 0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 28px;
    min-height: 72px;
    padding: 10px max(22px, calc((100vw - 1500px) / 2));
    border-bottom: 1px solid var(--gh-line);
    background: rgba(7, 11, 16, .96);
    box-shadow: 0 12px 38px rgba(0, 0, 0, .24);
    backdrop-filter: blur(18px);
}
.gh-release-admin-brand { display: flex; align-items: center; gap: 10px; color: var(--gh-text); text-decoration: none; }
.gh-release-admin-brand i {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    color: #241800; background: linear-gradient(135deg, var(--gh-gold-2), var(--gh-gold));
    font-style: normal; font-weight: 950;
}
.gh-release-admin-brand b, .gh-release-admin-brand small { display: block; }
.gh-release-admin-brand b { font-size: 12px; letter-spacing: .11em; }
.gh-release-admin-brand small { margin-top: 3px; color: var(--gh-muted); font-size: 9px; }
.gh-release-admin-nav nav { display: flex; justify-content: center; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.gh-release-admin-nav nav::-webkit-scrollbar { display: none; }
.gh-release-admin-nav nav a, .gh-release-admin-site {
    flex: 0 0 auto; padding: 10px 11px; border-radius: 9px; color: var(--gh-muted);
    text-decoration: none; font-size: 11px; font-weight: 800;
}
.gh-release-admin-nav nav a:hover, .gh-release-admin-nav nav a[aria-current="page"] {
    color: var(--gh-gold); background: rgba(246, 189, 42, .09);
}
.gh-release-admin-site { border: 1px solid var(--gh-line); color: var(--gh-text); }

/* Empty content should look intentional rather than unfinished */
[class*="empty"][data-gh-enhanced="true"] {
    display: grid;
    place-items: center;
    min-height: 150px;
    padding: 28px !important;
    border: 1px dashed rgba(148, 163, 184, .22) !important;
    color: var(--gh-muted) !important;
    text-align: center;
    background: rgba(12, 18, 26, .66) !important;
}
[class*="empty"][data-gh-enhanced="true"]::before {
    content: "GH";
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 10px;
    border: 1px solid var(--gh-line-strong);
    border-radius: 14px;
    color: var(--gh-gold);
    background: rgba(246, 189, 42, .07);
    font-size: 12px;
    font-weight: 950;
}

@media (max-width: 1000px) {
    .gh-release-admin-nav { grid-template-columns: auto 1fr; gap: 16px; }
    .gh-release-admin-nav nav { justify-content: flex-start; }
    .gh-release-admin-site { display: none; }
}
@media (max-width: 650px) {
    .gh-release-admin-nav { position: relative; grid-template-columns: 1fr; padding: 12px 14px; }
    .gh-release-admin-nav nav { justify-content: flex-start; width: 100%; padding-bottom: 2px; }
    .gh-release-admin-brand small { display: none; }
}

/* High-value interaction polish */
:where(.shop-product, .inventory-card, .admin-menu-card, .ally-card, .ally-match-row, .gh-market-case) {
    box-shadow: 0 12px 35px rgba(0, 0, 0, .12);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease !important;
}
@media (hover:hover) {
    :where(.shop-product, .inventory-card, .admin-menu-card, .ally-card, .ally-match-row, .gh-market-case):hover {
        transform: translateY(-3px);
        border-color: rgba(246, 189, 42, .32) !important;
        box-shadow: 0 18px 45px rgba(0, 0, 0, .25), 0 0 0 1px rgba(246, 189, 42, .04);
    }
}

.auth-card {
    position: relative;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .42) !important;
}
.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gh-gold), transparent);
}

.telegram-connect-copy {
    margin: 18px 0 20px;
    color: #aeb7c4;
    text-align: center;
    line-height: 1.6;
}

.telegram-connect-warning {
    margin: 18px 0;
    padding: 14px;
    border: 1px solid rgba(255, 190, 31, .35);
    border-radius: 12px;
    background: rgba(255, 190, 31, .08);
    color: #ffd66f;
    text-align: center;
}

.telegram-connect-security {
    display: grid;
    gap: 5px;
    margin: 15px 0 20px;
    padding: 14px;
    border: 1px solid #26313c;
    border-radius: 12px;
    background: #0a1118;
}

.telegram-connect-security strong { color: #52dea7; }
.telegram-connect-security span { color: #8793a2; font-size: 12px; line-height: 1.5; }
.telegram-account-details { color: #dce4ed !important; font-weight: 750; }
.telegram-sync-status { color: #52dea7 !important; font-size: 11px !important; }

:where(.shop-alert, .ally-alert, .profile-promo-alert, .flash, .admin-withdraw-alert) {
    box-shadow: 0 10px 32px rgba(0, 0, 0, .18);
}

@media (max-width: 600px) {
    :where(input, select, textarea) { font-size: 16px !important; }
    :where(button, a[class*="button"], a[class*="btn"]) { min-height: 42px; }
    .shop-products { grid-template-columns: 1fr !important; }
    .admin-menu-grid { grid-template-columns: 1fr !important; }
}

/* Named case-key economy */
.shop-product-visual img[src*="goldhunt-case-key"] {
    width: 92% !important;
    height: 92% !important;
    object-fit: contain !important;
    filter: drop-shadow(0 18px 24px rgba(0,0,0,.42));
}
.shop-product:has(img[src*="goldhunt-case-key"]) .shop-product-visual {
    background:
        radial-gradient(circle at 50% 50%, rgba(246,189,42,.18), transparent 58%),
        linear-gradient(145deg, #101721, #080c12) !important;
}
.gh-market-case-body > strong {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 6px 9px;
    border: 1px solid rgba(246,189,42,.22);
    border-radius: 8px;
    color: var(--gh-gold) !important;
    background: rgba(246,189,42,.06);
    font-size: 11px !important;
}
.game-resources-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
@media (max-width: 900px) { .game-resources-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 520px) { .game-resources-grid { grid-template-columns: 1fr !important; } }

.gh-key-wallet {
    display: grid;
    grid-template-columns: 1.35fr repeat(5, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 14px;
    padding: 10px;
    border: 1px solid var(--gh-line);
    border-radius: 16px;
    background: rgba(10, 15, 22, .88);
}
.gh-key-wallet-title { display: flex; justify-content: center; flex-direction: column; padding: 8px 12px; }
.gh-key-wallet-title span { color: var(--gh-gold); font-size: 10px; font-weight: 950; letter-spacing: .16em; }
.gh-key-wallet-title b { margin-top: 5px; color: var(--gh-muted); font-size: 11px; line-height: 1.35; }
.gh-key-wallet > a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(148,163,184,.11);
    border-radius: 11px;
    color: var(--gh-text);
    background: #0d141c;
    text-decoration: none;
}
.gh-key-wallet > a:hover { border-color: var(--gh-line-strong); transform: translateY(-1px); }
.gh-key-wallet img { width: 42px; height: 32px; flex: 0 0 auto; object-fit: contain; }
.gh-key-wallet a span, .gh-key-wallet a small { display: block; min-width: 0; }
.gh-key-wallet a span { overflow: hidden; font-size: 11px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.gh-key-wallet a small { margin-top: 4px; color: var(--gh-gold); font-size: 9px; }
@media (max-width: 1100px) {
    .gh-key-wallet { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; }
    .gh-key-wallet-title { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .gh-key-wallet { display: flex; align-items: stretch; overflow-x: auto; }
    .gh-key-wallet-title { min-width: 190px; }
    .gh-key-wallet > a { min-width: 135px; }
}

.gh2-trust-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin: 16px 0 0;
    overflow: hidden;
    border: 1px solid var(--gh-line);
    border-radius: 16px;
    background: var(--gh-line);
}
.gh2-trust-strip > div {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 17px 20px;
    background: #0b1118;
}
.gh2-trust-strip i {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    border-radius: 11px;
    color: var(--gh-green);
    background: rgba(36, 216, 146, .09);
    font-style: normal;
}
.gh2-trust-strip span, .gh2-trust-strip b, .gh2-trust-strip small { display: block; }
.gh2-trust-strip b { font-size: 13px; }
.gh2-trust-strip small { margin-top: 3px; color: var(--gh-muted); font-size: 11px; }

.admin-release-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.admin-release-actions a {
    padding: 11px 15px;
    border: 1px solid var(--gh-line);
    border-radius: 10px;
    color: var(--gh-text);
    background: rgba(255,255,255,.025);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
}
.admin-release-actions a:hover { color: var(--gh-gold); border-color: var(--gh-line-strong); }

.gh-release-footer {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 24px 50px;
    width: min(1500px, calc(100% - 56px));
    margin: 50px auto 0;
    padding: 30px 0 38px;
    border-top: 1px solid var(--gh-line);
    color: var(--gh-muted);
}
.gh-release-footer-brand { display: flex; align-items: center; gap: 10px; color: var(--gh-text); text-decoration: none; }
.gh-release-footer-brand i {
    display: grid; place-items: center; width: 40px; height: 40px;
    border-radius: 50%; color: #3b2800; background: linear-gradient(135deg,var(--gh-gold-2),var(--gh-gold));
    font-style: normal; font-weight: 950;
}
.gh-release-footer-brand b, .gh-release-footer-brand small { display: block; }
.gh-release-footer-brand small { margin-top: 2px; color: var(--gh-muted); font-size: 10px; }
.gh-release-footer nav { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px 22px; }
.gh-release-footer nav a { color: var(--gh-muted); text-decoration: none; font-size: 12px; font-weight: 700; }
.gh-release-footer nav a:hover { color: var(--gh-gold); }
.gh-release-footer > p { grid-column: 1 / -1; margin: 0; font-size: 11px; line-height: 1.55; }

@media (max-width: 760px) {
    .gh2-trust-strip { grid-template-columns: 1fr; }
    .gh2-trust-strip > div { padding: 14px 16px; }
    .gh-release-footer { grid-template-columns: 1fr; width: calc(100% - 28px); margin-top: 28px; padding-bottom: 20px; }
    .gh-release-footer nav { justify-content: flex-start; }
}
