/* ==========================================
   MARCO365 — PREMIUM GAMING DESIGN SYSTEM
   Colors extracted from colors.css
   ========================================== */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color tokens (surfaces, primary, accents, text, borders, VIP, leaderboard)
       are defined in theme.css — the single source of truth curated from the
       Stake design system. Only non-color design tokens live below. */

    /* Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-medium: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.2), 0 2px 4px -1px rgba(0,0,0,0.12);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.2), 0 4px 6px -2px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.2), 0 10px 10px -5px rgba(0,0,0,0.08);
    --shadow-glow-primary: 0 0 40px rgba(20, 117, 225, 0.2);
    --shadow-glow-green: 0 0 40px rgba(3, 230, 37, 0.15);
    --shadow-glow-gold: 0 0 40px rgba(255, 169, 31, 0.15);

    /* Stake layout tokens */
    --header-height: 60px;
    --mobile-footer-height: 92px;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--surface-lowest);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--primary); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface-lowest); }
::-webkit-scrollbar-thumb {
    background: var(--surface-highest);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== STAKE ICONS (mask — same SVGs as Stake) ===== */
.stake-icon {
    display: inline-block;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}

.stake-icon--xs { width: 16px; height: 16px; }
.stake-icon--sm { width: 18px; height: 18px; }

.stake-icon--search { -webkit-mask-image: url('../img/icons/nav/search.svg'); mask-image: url('../img/icons/nav/search.svg'); }
.stake-icon--wallet { -webkit-mask-image: url('../img/icons/nav/wallet.svg'); mask-image: url('../img/icons/nav/wallet.svg'); }
.stake-icon--person { -webkit-mask-image: url('../img/icons/nav/person.svg'); mask-image: url('../img/icons/nav/person.svg'); }
.stake-icon--notification { -webkit-mask-image: url('../img/icons/nav/notificationon.svg'); mask-image: url('../img/icons/nav/notificationon.svg'); }
.stake-icon--betslip { -webkit-mask-image: url('../img/icons/nav/betslip.svg'); mask-image: url('../img/icons/nav/betslip.svg'); }
.stake-icon--chat { -webkit-mask-image: url('../img/icons/nav/chat.svg'); mask-image: url('../img/icons/nav/chat.svg'); }
.stake-icon--chevron-down { -webkit-mask-image: url('../img/icons/nav/chevron-down.svg'); mask-image: url('../img/icons/nav/chevron-down.svg'); }
.stake-icon--chevron-right { -webkit-mask-image: url('../img/icons/nav/chevronright.svg'); mask-image: url('../img/icons/nav/chevronright.svg'); }
.stake-icon--info { -webkit-mask-image: url('../img/icons/nav/info.svg'); mask-image: url('../img/icons/nav/info.svg'); }
.stake-icon--trophy { -webkit-mask-image: url('../img/icons/nav/trophy.svg'); mask-image: url('../img/icons/nav/trophy.svg'); }
.stake-icon--affiliate { -webkit-mask-image: url('../img/icons/nav/affiliate.svg'); mask-image: url('../img/icons/nav/affiliate.svg'); }
.stake-icon--settings { -webkit-mask-image: url('../img/icons/nav/settings.svg'); mask-image: url('../img/icons/nav/settings.svg'); }
.stake-icon--protection { -webkit-mask-image: url('../img/icons/nav/protection.svg'); mask-image: url('../img/icons/nav/protection.svg'); }
.stake-icon--support { -webkit-mask-image: url('../img/icons/nav/support.svg'); mask-image: url('../img/icons/nav/support.svg'); }
.stake-icon--vault { -webkit-mask-image: url('../img/icons/nav/vault.svg'); mask-image: url('../img/icons/nav/vault.svg'); }
.stake-icon--trending { -webkit-mask-image: url('../img/icons/nav/trending.svg'); mask-image: url('../img/icons/nav/trending.svg'); }
.stake-icon--coupon { -webkit-mask-image: url('../img/icons/nav/coupon.svg'); mask-image: url('../img/icons/nav/coupon.svg'); }
.stake-icon--logout { -webkit-mask-image: url('../img/icons/nav/logout.svg'); mask-image: url('../img/icons/nav/logout.svg'); }
.stake-icon--external { -webkit-mask-image: url('../img/icons/nav/external.svg'); mask-image: url('../img/icons/nav/external.svg'); }

.stake-header-btn.is-active {
    color: var(--text-primary);
}

.stake-dropdown-wrap {
    position: relative;
}

.stake-dropdown-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.stake-dropdown-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.stake-dropdown {
    position: fixed;
    top: calc(var(--header-height) + 4px);
    right: 8px;
    left: 8px;
    max-width: 420px;
    margin-left: auto;
    background: var(--surface-highest);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    z-index: 1200;
    overflow: hidden;
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.stake-dropdown.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.stake-dropdown[hidden] {
    display: block;
    visibility: hidden;
}
.stake-dropdown.is-open[hidden] {
    visibility: visible;
}

.stake-profile-menu {
    max-height: calc(100vh - var(--header-height) - 24px);
    overflow-y: auto;
}

.stake-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-subtle);
}
.stake-menu-item:last-child {
    border-bottom: none;
}
.stake-menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}
.stake-menu-item .stake-icon {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
    flex-shrink: 0;
}
.stake-menu-item--logout {
    color: var(--text-primary);
}

.stake-notify-panel {
    min-height: 180px;
    max-height: min(70vh, 420px);
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100vw - 24px));
}

.stake-notify-head {
    padding: 14px 18px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.stake-notify-clear {
    border: none;
    background: transparent;
    color: var(--primary-light, #64b2fa);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0;
}

.stake-notify-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--red, #ff4d5e);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
}

.stake-header-btn {
    position: relative;
}

.stake-notify-list {
    overflow-y: auto;
    flex: 1;
}

.stake-notify-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    align-items: flex-start;
}

.stake-notify-item.is-unread {
    background: rgba(20, 117, 225, 0.08);
}

.stake-notify-item-body {
    flex: 1;
    min-width: 0;
}

.stake-notify-item-title {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.stake-notify-item-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 6px;
    line-height: 1.35;
}

.stake-notify-item-time {
    font-size: 0.6875rem;
    color: var(--text-dim, #6b7c8a);
    font-weight: 600;
}

.stake-notify-dismiss {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    flex-shrink: 0;
}

.stake-notify-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px 36px;
    gap: 8px;
}
.stake-notify-empty[hidden],
.stake-notify-list:empty + .stake-notify-empty:not([hidden]) {
    /* kept for clarity */
}
.stake-notify-empty-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.stake-notify-empty p {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.stake-notify-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.stake-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--surface-lowest);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    touch-action: none;
}

.stake-header-inner {
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stake-header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.stake-logo {
    display: block;
    object-fit: contain;
    mix-blend-mode: screen;
}
.stake-logo--desktop {
    height: 40px;
    width: auto;
    max-width: 170px;
}
.stake-logo--mobile {
    display: none;
    width: 40px;
    height: 40px;
}

.stake-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
    max-width: 280px;
    margin: 0 auto;
}

.balance-toggle {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 240px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.balance-chip {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 14px;
    background: var(--surface-sunken);
    border: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    transition: background var(--transition-fast);
}
.balance-chip:hover {
    color: var(--text-primary);
    background: var(--surface-highest);
}

.balance-chip .header-balance-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 14ch;
}

.balance-wallet-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    text-decoration: none;
    transition: background var(--transition-fast);
}
.balance-wallet-btn:hover {
    background: var(--primary-dark);
    color: #fff;
}
.balance-wallet-btn .stake-icon {
    color: #fff;
}

.stake-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.stake-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}
.stake-header-btn:hover {
    color: var(--text-secondary);
}

@media (min-width: 769px) {
    .stake-dropdown {
        left: auto;
        right: 16px;
        width: 320px;
    }
    .stake-notify-panel {
        width: 340px;
    }
}

/* ===== STAKE MOBILE NAV (fixed bottom bar) ===== */
.stake-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-footer-height);
    background: var(--surface-default);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

.stake-mobile-nav__inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 0 8px;
}

.stake-mobile-nav__link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: color var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.stake-mobile-nav__link:hover {
    color: var(--text-secondary);
}

.stake-mobile-nav__link.active {
    color: var(--text-primary);
}

.stake-mobile-nav__link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    min-width: 28px;
    max-width: 40px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 0 0 4px 4px;
}

.stake-mobile-nav__icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
}

.stake-mobile-nav__link .stake-icon {
    width: 22px;
    height: 22px;
}

.stake-mobile-nav__icon-wrap--img {
    position: relative;
}

.footer-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}
.footer-img--active {
    display: none;
}
.stake-mobile-nav__link.active .footer-img--default {
    display: none;
}
.stake-mobile-nav__link.active .footer-img--active {
    display: block;
}

.stake-mobile-nav__label {
    font-size: 0.6875rem;
    font-weight: 700;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    min-height: 100vh;
}
.main-content.has-header {
    padding-top: var(--header-height);
}
.main-content.has-mobile-nav {
    padding-bottom: var(--mobile-footer-height);
}

/* ===== CARDS ===== */
.glass-card {
    background: rgba(32, 55, 67, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-medium);
}
.glass-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.solid-card {
    background: var(--surface-default);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-medium);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
    box-shadow: 0 6px 25px var(--primary-glow);
    transform: translateY(-1px);
    color: white;
}

.btn-green {
    background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
    color: white;
    box-shadow: 0 4px 15px var(--green-glow);
}
.btn-green:hover {
    box-shadow: 0 6px 25px var(--green-glow);
    transform: translateY(-1px);
    color: white;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--ds-color-on-base-caution);
    box-shadow: 0 4px 15px var(--gold-glow);
}
.btn-gold:hover {
    box-shadow: 0 6px 25px var(--gold-glow);
    transform: translateY(-1px);
    color: var(--ds-color-on-base-caution);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}
.btn-outline:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border-strong);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red-dark), var(--ds-color-red-700));
    color: white;
    box-shadow: 0 4px 15px var(--red-glow);
}

.btn-sm { padding: 8px 18px; font-size: 0.8rem; }
.btn-lg { padding: 16px 36px; font-size: 1rem; }
.btn-full { width: 100%; }

/* ===== FORM INPUTS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(19, 35, 45, 0.8);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    outline: none;
}
.form-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}
.form-input:hover {
    border-color: var(--border-strong);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(19, 35, 45, 1);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239fbed0' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 01.708 0L8 10.293l5.646-5.647a.5.5 0 01.708.708l-6 6a.5.5 0 01-.708 0l-6-6a.5.5 0 010-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ===== UTILITIES ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-padding {
    padding: 32px 20px;
}

.text-center { text-align: center; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.text-primary { color: var(--primary-light); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.font-gaming {
    font-family: var(--font-display);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-light), var(--orchid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 24px 0;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
    50% { box-shadow: 0 0 40px var(--primary-glow), 0 0 60px rgba(20, 117, 225, 0.1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fadeInUp { animation: fadeInUp 0.6s var(--transition-medium) both; }
.animate-fadeIn { animation: fadeIn 0.5s ease both; }
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .stake-mobile-nav { display: block; }

    .stake-header-inner { padding: 0 12px; gap: 8px; }
    .stake-logo--mobile { display: block; }
    .stake-logo--desktop { display: none; }

    .stake-header-center { max-width: none; }
    .balance-toggle { max-width: 200px; }
    .balance-chip { padding: 10px 10px; font-size: 0.8125rem; }
    .balance-wallet-btn { width: 44px; }
    .balance-chip .header-balance-text { max-width: 10ch; }

    .stake-header-btn { width: 40px; height: 40px; padding: 10px; }

    .page-padding { padding: 20px 16px; }
    .glass-card, .solid-card { padding: 18px; }
}

@media (max-width: 380px) {
    .stake-header-btn:last-child { display: none; }
    .balance-toggle { max-width: 170px; }
    .balance-chip .header-balance-text { max-width: 8ch; }
}

@media (min-width: 769px) {
    .stake-mobile-nav { display: none; }
    .stake-header-center { max-width: 320px; }
    .balance-toggle { max-width: 280px; }
}
