@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #090D16;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #F8FAFC;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Glassmorphism Common Overlay */
.overlay-screen, .modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(9, 13, 22, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.overlay-screen.active, .modal.active {
    opacity: 1;
    pointer-events: auto;
}

/* In-Game Minimal HUD */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.hud-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
}

.hud-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #94A3B8;
}

.hud-value {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFFFFF, #60A5FA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hud-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
}

.hud-bottom-left {
    position: absolute;
    bottom: 24px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
}

.coin-icon {
    width: 20px;
    height: 20px;
    background: #F59E0B;
    border-radius: 50%;
    border: 2px solid #FDE047;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    color: #FFF;
}

.hud-center-combo {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 42px;
    font-weight: 900;
    color: #F59E0B;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
    display: none;
}

.hud-center-combo.pulse {
    animation: comboPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes comboPulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
}

.hud-top-center-pause {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
}

/* Main Menu Box */
.menu-box {
    width: 90%;
    max-width: 440px;
    text-align: center;
    padding: 36px 24px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.game-title {
    font-size: 44px;
    font-weight: 900;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #38BDF8, #6366F1, #EC4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.game-subtitle {
    font-size: 14px;
    color: #94A3B8;
    margin-bottom: 24px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    padding: 12px 8px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-card .val {
    font-size: 20px;
    font-weight: 800;
    color: #F8FAFC;
}

.stat-card .lbl {
    font-size: 11px;
    color: #64748B;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Buttons */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-row {
    display: flex;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, #6366F1, #3B82F6);
    color: #FFF;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-gold {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #FFF;
    box-shadow: 0 10px 20px -5px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #E2E8F0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 14px;
}

.btn-disabled {
    background: rgba(255, 255, 255, 0.05);
    color: #64748B;
    cursor: not-allowed;
}

/* Modals & Shop */
.modal-content {
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 800;
}

.btn-close {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 24px;
    cursor: pointer;
}

.shop-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: #94A3B8;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border-radius: 10px;
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818CF8;
}

.shop-scroll-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.shop-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    gap: 12px;
}

.shop-card.active-item {
    border-color: #6366F1;
    background: rgba(99, 102, 241, 0.08);
}

.shop-card-preview {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.shop-card-info {
    flex: 1;
}

.shop-card-info h4 {
    font-size: 15px;
    font-weight: 700;
}

.shop-card-info p {
    font-size: 12px;
    color: #94A3B8;
}

.shop-card-action {
    width: 110px;
}

/* Toast Container */
#toast-container {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: #FFF;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.3s ease;
}

.toast-warning {
    border-color: rgba(239, 68, 68, 0.6);
    color: #FCA5A5;
}

.toast-achievement {
    border-color: rgba(245, 158, 11, 0.8);
    background: rgba(120, 53, 15, 0.9);
    color: #FDE047;
}

.toast.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .menu-box, .modal-content {
        padding: 24px 16px;
    }
    .game-title {
        font-size: 34px;
    }
}
