:root {
    --bg-color: #050510;
    --accent-primary: #a044ff;
    --accent-secondary: #00d2ff;
    --accent-tertiary: #ff00c8;
    --text-main: #f0f0f5;
    --glass-bg: rgba(15, 15, 25, 0.75);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glow-purple: 0 0 30px rgba(160, 68, 255, 0.4);
    --glow-cyan: 0 0 30px rgba(0, 210, 255, 0.4);
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-color);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(160, 68, 255, 0.1), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 210, 255, 0.1), transparent 40%);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('assets/background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.4;
    z-index: -2;
}

#star-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

#game-container {
    display: grid;
    grid-template-areas:
        "header header"
        "main shop";
    grid-template-columns: 1fr 600px;
    grid-template-rows: auto 1fr;
    height: 100vh;
}

header {
    grid-area: header;
    padding: 20px 40px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

#stats {
    display: flex;
    gap: 40px;
    justify-content: center;
}

.stat-box {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--glow-purple);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    min-width: 250px;
}

.stat-box:hover {
    transform: translateY(-2px);
    border-color: var(--accent-secondary);
    box-shadow: var(--glow-cyan);
}

.stat-box .label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-secondary);
}

.stat-box .value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

main {
    grid-area: main;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#crystal-area {
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}

#crystal-area:active {
    transform: scale(0.95);
}

#main-crystal {
    width: 380px;
    filter: drop-shadow(0 0 40px rgba(160, 68, 255, 0.6)) contrast(1.1);
    animation: float 5s ease-in-out infinite;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0) 75%);
    mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0) 75%);
    user-select: none;
}

#crystal-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle,
            rgba(160, 68, 255, 0.3) 0%,
            rgba(0, 210, 255, 0.15) 30%,
            transparent 70%);
    opacity: 0.6;
    filter: blur(80px);
    z-index: -1;
    animation: pulse 6s ease-in-out infinite;
    pointer-events: none;
}

#shop {
    grid-area: shop;
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    margin: 20px;
    border-radius: 25px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    height: calc(100vh - 160px);
    min-height: 0;
}

#shop .shop-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 20px;
}

#shop h2 {
    margin-bottom: 0;
    letter-spacing: 1px;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.multiplier-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.mult-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 4px 6px;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    min-width: 35px;
}

.mult-btn.active {
    background: var(--accent-primary);
    color: white;
}

#shop-items {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
}

#shop-items::-webkit-scrollbar {
    width: 6px;
}

#shop-items::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}

.shop-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--accent-primary);
    transition: height 0.3s;
}

.tab-btn.active::before {
    height: 60%;
}

.tab-btn.active {
    background: var(--accent-primary);
    box-shadow: var(--glow-purple);
}

#shop-items {
    flex: 1;
    overflow-y: auto;
}

.shop-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    padding: 18px;
    margin-bottom: 15px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: item-appear 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

@keyframes item-appear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.shop-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-secondary);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.shop-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.item-icon {
    width: 48px;
    height: 48px;
    background-size: 540% 435%;
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    background-repeat: no-repeat;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    display: block;
}

.item-cost {
    font-size: 0.9rem;
    color: var(--accent-secondary);
}

.item-benefit {
    font-size: 0.8rem;
    color: #888;
}

.item-tooltip {
    font-size: 0.75rem;
    color: var(--accent-secondary);
    margin-top: 4px;
    opacity: 0.7;
}

.item-count {
    font-weight: 800;
    opacity: 0.5;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

.particle {
    position: absolute;
    pointer-events: none;
    color: var(--accent-secondary);
    font-weight: 800;
    animation: particle-fly 1s ease-out forwards;
    z-index: 100;
}

@keyframes particle-fly {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }

    100% {
        transform: translate(calc(var(--tx, 0) * 1px), calc(var(--ty, -100) * 1px));
        opacity: 0;
    }
}

#event-banner {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-primary);
    padding: 10px 30px;
    border-radius: 15px;
    font-weight: 800;
    letter-spacing: 2px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.5s;
    text-shadow: 0 0 10px var(--accent-primary);
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#event-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

#event-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    box-shadow: 0 0 10px var(--accent-secondary);
    transition: width 0.1s linear;
}

#event-banner.active {
    opacity: 1;
    top: -40px;
    animation: banner-pulse 2s infinite;
}

@keyframes banner-pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        text-shadow: 0 0 10px var(--accent-primary);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
        text-shadow: 0 0 20px var(--accent-secondary);
    }
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}

/* Ascension Tab Styles */
.ascension-card {
    background: rgba(40, 30, 60, 0.6);
    border: 2px solid #ffd700;
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

.ascension-card h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.shard-reward {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffd700;
    margin: 20px 0;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.warning {
    color: #ff4444;
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.ascension-info {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    font-size: 0.85rem;
    border-left: 3px solid #ffd700;
}

.ascension-info p {
    margin: 5px 0;
    opacity: 0.9;
}

.highlight {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1rem;
}

.save-controls {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.save-controls button {
    font-size: 0.75rem;
}

.ascend-action-btn {
    background: linear-gradient(45deg, #ffd700, #ffa500);
    border: none;
    color: #000;
    padding: 15px 30px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.ascend-action-btn:hover:not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px #ffd700;
}

.ascend-action-btn.disabled {
    background: #444;
    color: #888;
    cursor: default;
    opacity: 0.5;
}

/* Notifications */
#notifications {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.notification {
    background: var(--glass-bg);
    border: 1px solid var(--accent-primary);
    padding: 12px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slide-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    transition: all 0.3s;
}

/* Achievement Styles */
.achievements-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s;
}

.achievement-item.unlocked {
    background: rgba(160, 68, 255, 0.1);
    border-color: var(--accent-primary);
}

.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.achievement-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
}

.achievement-desc {
    display: block;
    font-size: 0.8rem;
    color: #888;
}

@keyframes slide-in {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Combo Styles */
#combo-container {
    position: absolute;
    top: 20%;
    right: -100px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: scale(0.8);
}

#combo-container.active {
    opacity: 1;
    transform: scale(1);
    animation: combo-pulse 0.5s ease-out;
}

#combo-text {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent-secondary);
    letter-spacing: 3px;
}

#combo-value {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff, var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--accent-primary));
}

@keyframes combo-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}