/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Jua', sans-serif;
    background: #1a1a2e;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ===== GAME CONTAINER ===== */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #d4e6f1 0%, #e8f0fe 40%, #f0f4f8 100%);
}

/* ===== STATS HUD ===== */
#stats-hud {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.stat-item {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    font-size: 18px;
    color: #2c3e50;
    min-width: 160px;
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateX(-4px);
}

.stat-icon {
    font-size: 22px;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-left: 2px;
}

#money-display, #produced-display, #speed-display {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
}

/* ===== UPGRADE TOGGLE ===== */
#upgrade-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 10px 18px;
    cursor: pointer;
    font-family: 'Jua', sans-serif;
    font-size: 16px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    z-index: 11;
}

#upgrade-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.toggle-label {
    font-size: 14px;
}

/* ===== UPGRADE PANEL ===== */
#upgrade-panel {
    position: absolute;
    top: 70px;
    left: 20px;
    width: 320px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 10;
    animation: slideIn 0.3s ease-out;
}

#upgrade-panel.hidden {
    display: none;
}

#upgrade-panel h2 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}

.upgrade-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.upgrade-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: rgba(52, 152, 219, 0.3);
}

.upgrade-card.affordable {
    border-color: rgba(46, 204, 113, 0.4);
    background: rgba(46, 204, 113, 0.08);
}

.upgrade-card.affordable:hover {
    background: rgba(46, 204, 113, 0.15);
    box-shadow: 0 4px 16px rgba(46, 204, 113, 0.2);
}

.upgrade-card.max-level {
    opacity: 0.5;
    cursor: default;
}

.upgrade-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.upgrade-icon {
    font-size: 28px;
}

.upgrade-name {
    font-size: 16px;
    color: #2c3e50;
    flex: 1;
}

.upgrade-level {
    font-size: 12px;
    color: #95a5a6;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 8px;
}

.upgrade-desc {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 8px;
    line-height: 1.4;
}

.upgrade-cost {
    font-size: 15px;
    color: #e67e22;
    font-weight: bold;
}

/* ===== RICE CAKE SELECTOR ===== */
#ricecake-selector {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.selector-title {
    font-size: 14px;
    color: #7f8c8d;
    white-space: nowrap;
}

#ricecake-types {
    display: flex;
    gap: 8px;
}

.ricecake-type-btn {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
}

.ricecake-type-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ricecake-type-btn.active {
    border-color: #e67e22;
    background: rgba(230, 126, 34, 0.1);
    box-shadow: 0 2px 10px rgba(230, 126, 34, 0.2);
}

.ricecake-type-btn.locked {
    opacity: 0.4;
    cursor: default;
    filter: grayscale(1);
}

.ricecake-type-btn .type-name {
    font-size: 9px;
    color: #7f8c8d;
    margin-top: 2px;
    font-family: 'Jua', sans-serif;
}

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 14px 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    font-size: 16px;
    color: #2c3e50;
    animation: toastIn 0.4s ease-out, toastOut 0.4s ease-in 2s forwards;
    pointer-events: none;
}

/* ===== SCROLLBAR ===== */
#upgrade-panel::-webkit-scrollbar {
    width: 6px;
}

#upgrade-panel::-webkit-scrollbar-track {
    background: transparent;
}

#upgrade-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #upgrade-panel {
        width: 280px;
    }

    .stat-item {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 130px;
    }

    #money-display, #produced-display, #speed-display {
        font-size: 18px;
    }

    #ricecake-selector {
        padding: 8px 14px;
    }

    .ricecake-type-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}
