/* ==========================================================================
   SNAKE EVOLUTION - Phase 3 Glassmorphism Stylesheet
   CrazyGames & Shared Hosting Ready
   ========================================================================== */

:root {
    --bg-dark: #080911;
    --card-bg: rgba(18, 22, 36, 0.92);
    --primary-neon: #00ff88;
    --secondary-neon: #00e5ff;
    --accent-gold: #ffd700;
    --accent-red: #ff0055;
    --accent-purple: #9c27b0;
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: #ffffff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    touch-action: none;
}

canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
}

/* ==========================================================================
   DOM HEADER HUD (Wallet & XP Bar)
   ========================================================================== */
.hud-header-bar {
    position: fixed;
    top: 10px;
    left: 12px;
    right: 12px;
    height: 50px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.hud-pill {
    background: rgba(18, 22, 36, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 20px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.hud-pill.wallet {
    color: var(--accent-gold);
    border-color: rgba(255, 215, 0, 0.4);
}

.hud-xp-box {
    display: flex;
    flex-direction: column;
    width: 120px;
}

.hud-xp-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.hud-xp-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff88, #00e5ff);
    transition: width 0.3s ease;
}

/* ==========================================================================
   MODAL OVERLAY SYSTEM
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 9, 17, 0.85);
    backdrop-filter: blur(12px);
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    width: 92%;
    max-width: 780px;
    max-height: 85vh;
    background: var(--card-bg);
    border: 1.5px solid rgba(0, 255, 136, 0.4);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 255, 136, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 900;
    color: var(--primary-neon);
    letter-spacing: 1px;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255, 0, 85, 0.8);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}

/* Tabs */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    background: rgba(24, 32, 51, 0.8);
    border: 1px solid rgba(0, 255, 136, 0.2);
    color: #8a99ad;
    padding: 8px 16px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary-neon);
    color: #080911;
    border-color: var(--primary-neon);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

/* ==========================================================================
   SHOP GRID
   ========================================================================== */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.shop-card {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s, border-color 0.2s;
}

.shop-card:hover {
    transform: translateY(-3px);
    border-color: var(--secondary-neon);
}

.shop-card.is-equipped {
    border-color: var(--primary-neon);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.shop-preview {
    width: 100%;
    height: 90px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.shop-preview-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.shop-info {
    width: 100%;
    text-align: center;
}

.shop-item-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

.shop-item-desc {
    font-size: 11px;
    color: #8a99ad;
    margin-bottom: 10px;
    min-height: 28px;
}

.shop-item-btn {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.shop-item-btn.buy {
    background: var(--accent-gold);
    color: #080911;
}

.shop-item-btn.equip {
    background: var(--secondary-neon);
    color: #080911;
}

.shop-item-btn.equipped {
    background: rgba(0, 255, 136, 0.2);
    color: var(--primary-neon);
    border: 1px solid var(--primary-neon);
    cursor: default;
}

/* ==========================================================================
   DAILY REWARD CALENDAR
   ========================================================================== */
.daily-reward-subtitle {
    font-size: 13px;
    color: #8a99ad;
    margin-bottom: 16px;
    text-align: center;
}

.daily-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.daily-card {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    position: relative;
}

.daily-card.current {
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.daily-day-label {
    font-family: var(--font-heading);
    font-size: 11px;
    color: var(--secondary-neon);
    margin-bottom: 6px;
}

.daily-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.daily-amount {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.claim-btn {
    background: var(--primary-neon);
    color: #080911;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 900;
    cursor: pointer;
    width: 100%;
}

.claim-btn.pulsing {
    animation: pulseBtn 1s infinite alternate;
}

@keyframes pulseBtn {
    from { transform: scale(1); box-shadow: 0 0 5px var(--primary-neon); }
    to { transform: scale(1.05); box-shadow: 0 0 15px var(--primary-neon); }
}

.claimed-badge {
    font-size: 11px;
    color: var(--primary-neon);
    font-weight: 700;
}

.locked-badge {
    font-size: 11px;
    color: #8a99ad;
}

/* ==========================================================================
   MISSIONS
   ========================================================================== */
.mission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mission-card {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mission-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}

.mission-desc {
    font-size: 12px;
    color: #8a99ad;
    margin-bottom: 6px;
}

.mission-progress-bar {
    width: 160px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.mission-progress-fill {
    height: 100%;
    background: var(--primary-neon);
}

.mission-progress-text {
    font-size: 10px;
    color: #8a99ad;
}

.mission-reward-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.reward-tag {
    font-family: var(--font-heading);
    font-size: 11px;
    color: var(--accent-gold);
}

/* ==========================================================================
   ACHIEVEMENTS
   ========================================================================== */
.achievement-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievement-card {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.achievement-card.unlocked {
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
}

.ach-icon {
    font-size: 32px;
}

.ach-details {
    flex: 1;
}

.ach-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}

.ach-desc {
    font-size: 12px;
    color: #8a99ad;
}

.ach-rewards {
    font-size: 11px;
    color: var(--accent-gold);
    margin-top: 2px;
}

.ach-badge.unlocked {
    color: var(--primary-neon);
    font-weight: 800;
    font-size: 12px;
}

.ach-badge.locked {
    color: #8a99ad;
    font-size: 12px;
}

/* ==========================================================================
   LEADERBOARD
   ========================================================================== */
.leaderboard-subtitle {
    font-size: 12px;
    color: #8a99ad;
    margin-bottom: 12px;
}

.leaderboard-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lb-header, .lb-row {
    display: flex;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.lb-header {
    background: rgba(24, 32, 51, 0.8);
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--secondary-neon);
}

.lb-row {
    background: rgba(13, 17, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.lb-row.rank-1 { border-color: var(--accent-gold); color: var(--accent-gold); }
.lb-row.rank-2 { border-color: #c0c0c0; color: #c0c0c0; }
.lb-row.rank-3 { border-color: #cd7f32; color: #cd7f32; }

.lb-col-rank { width: 60px; font-weight: 800; }
.lb-col-name { flex: 1; font-weight: 600; }
.lb-col-level { width: 80px; }
.lb-col-score { width: 100px; text-align: right; font-family: var(--font-heading); font-weight: 800; }

/* ==========================================================================
   STATISTICS & PROFILE
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 900;
    color: var(--primary-neon);
}

.stat-label {
    font-size: 11px;
    color: #8a99ad;
}

.chart-container-card {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
}

.chart-title {
    font-family: var(--font-heading);
    font-size: 12px;
    color: var(--secondary-neon);
    margin-bottom: 12px;
}

.bar-chart-placeholder {
    height: 100px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 12px;
    padding-top: 10px;
}

.bar-col {
    background: linear-gradient(180deg, var(--primary-neon), var(--secondary-neon));
    width: 40px;
    border-radius: 6px 6px 0 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.bar-val { font-size: 10px; font-weight: 800; color: #080911; }
.bar-lbl { font-size: 10px; color: #fff; margin-bottom: -18px; }

/* Profile Header */
.profile-header-card {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.current-avatar {
    font-size: 36px;
}

.avatar-selector {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.avatar-opt {
    cursor: pointer;
    font-size: 16px;
}

.profile-info-box {
    flex: 1;
}

.profile-name-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.profile-name-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    padding: 6px 12px;
    font-family: var(--font-heading);
    font-size: 14px;
}

.save-name-btn {
    background: var(--primary-neon);
    color: #080911;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-family: var(--font-heading);
    font-weight: 800;
    cursor: pointer;
}

.profile-level-badge {
    font-family: var(--font-heading);
    font-size: 12px;
    color: var(--accent-gold);
    margin-bottom: 4px;
}

.profile-xp-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.profile-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00e5ff);
}

.profile-xp-text {
    font-size: 10px;
    color: #8a99ad;
    margin-top: 2px;
}

.profile-stats-summary {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.p-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #8a99ad;
}
.p-stat strong { color: #fff; }

/* Settings */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.setting-row {
    background: rgba(13, 17, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-btn {
    padding: 6px 16px;
    border-radius: 8px;
    border: none;
    font-family: var(--font-heading);
    font-weight: 800;
    cursor: pointer;
}
.toggle-btn.on { background: var(--primary-neon); color: #080911; }
.toggle-btn.off { background: rgba(255, 255, 255, 0.1); color: #8a99ad; }

.reset-btn {
    background: var(--accent-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-family: var(--font-heading);
    font-weight: 800;
    cursor: pointer;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-card {
    background: rgba(18, 22, 36, 0.95);
    border: 1.5px solid var(--accent-gold);
    border-radius: 14px;
    padding: 12px 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    animation: toastIn 0.3s ease;
}

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

.toast-card.fade-out {
    animation: toastOut 0.4s ease forwards;
}

@keyframes toastOut {
    to { transform: translateX(50px); opacity: 0; }
}

.toast-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 900;
    color: var(--accent-gold);
}

.toast-msg {
    font-size: 12px;
    color: #fff;
}
