:root {
    --bg-dark: #21033a;
    --bg-mid: #4a195e;
    --accent: #5cf2e5;
    --card-bg: linear-gradient(180deg, #4249a5 0%, #1e287a 100%);
    --card-border: #6a74da;
    --card-border-alt: #36c5b5;
    --bar-bg: rgba(0,0,0,0.5);
    --gold: #f4d03f;
    --heart: #d85a8a;
}

body, html {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    background-color: #000;
    font-family: 'Rajdhani', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    max-width: 500px;
    max-height: 900px;
    position: relative;
    background: radial-gradient(circle at 50% 50%, var(--bg-mid) 0%, var(--bg-dark) 100%);
    box-shadow: 0 0 50px rgba(92, 242, 229, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

#game-canvas {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1; /* Below UI */
}

/* TOP UI */
.top-bar {
    position: absolute;
    top: 15px; left: 15px; right: 15px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
}

.resource-pill {
    background: var(--bar-bg);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 5px 10px 5px 5px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    font-size: 14px;
    min-width: 65px;
}

.icon {
    display: inline-block;
    width: 20px; height: 20px;
    background: #fff;
    color: #000;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
}

.icon.gold { background: var(--gold); }
.icon.drop { background: transparent; color: #4fc3f7; border: 1px solid #4fc3f7; }
.icon.gem { background: transparent; color: #e040fb; border: 1px solid #e040fb; }

.wave-bar {
    position: absolute;
    top: 60px; left: 60px; right: 60px;
    z-index: 10;
}

.progress-bg {
    background: var(--bar-bg);
    height: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: var(--accent);
    height: 100%;
    box-shadow: 0 0 10px var(--accent);
}

.wave-text {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    margin-top: 4px;
}

/* BOTTOM PANELS */
.upgrade-panel {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(0deg, #000 0%, #15092a 100%);
    border-top: 2px solid rgba(255,255,255,0.1);
    z-index: 10;
    padding: 0 10px 10px 10px;
}

.core-health-bar {
    background: #d35400;
    margin: -15px 10px 10px 10px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid #e67e22;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: skew(-15deg);
    box-shadow: 0 0 10px rgba(211, 84, 0, 0.5);
}

.core-health-bar .heart {
    position: absolute; left: -10px; top: -5px;
    font-size: 24px; color: var(--heart);
    transform: skew(15deg);
    text-shadow: 0 0 5px var(--heart);
}

.health-text {
    transform: skew(15deg); /* Correct text skew */
    font-weight: bold;
    font-size: 15px;
}

.core-stats {
    display: flex;
    gap: 15px;
    padding-left: 20px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #cbd5e1;
}

.upgrade-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 15px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 4px;
    cursor: pointer;
    box-shadow: inset 0 2px rgba(255,255,255,0.1), 0 4px 6px rgba(0,0,0,0.5);
    transition: transform 0.1s, border-color 0.1s;
}

.card:hover { transform: translateY(-2px); border-color: #fff; }
.card:active { transform: translateY(2px); }

.card:nth-child(even) {
    border-color: var(--card-border-alt);
}

.card .title { font-size: 12px; height: 30px; display: flex; align-items: center; color: #a5b4fc; line-height: 1.1; }
.card .val { font-size: 22px; font-weight: bold; margin: 4px 0; font-family: 'Teko', sans-serif; letter-spacing: 1px; color: #fff; }
.card .cost { font-size: 12px; background: rgba(0,0,0,0.3); padding: 2px 8px; border-radius: 10px; width: 80%; display: flex; justify-content: center; gap: 4px; align-items: center; color: #94a3b8; }

.footer-icons {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}

.hex-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
}

.hex-icon.act {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(92, 242, 229, 0.1);
    box-shadow: inset 0 0 10px rgba(92, 242, 229, 0.3);
}

/* START SCREEN */
.start-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, rgba(33,3,58,0.95), rgba(0,0,0,1));
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.start-content {
    text-align: center;
}

.start-content .logo {
    font-family: 'Teko', sans-serif;
    font-size: 60px;
    margin: 0 0 30px 0;
    color: #fff;
    text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
}

.cyber-btn {
    background: rgba(92, 242, 229, 0.1);
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    font-family: 'Rajdhani', sans-serif;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(92,242,229,0.2), 0 0 15px rgba(92,242,229,0.3);
}

.cyber-btn:hover {
    background: var(--accent);
    color: #000;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.5), 0 0 30px var(--accent);
}

.cyber-btn:active {
    transform: scale(0.95);
}

/* Animations */
.glow-text {
    animation: glowText 2s ease-in-out infinite alternate;
}

@keyframes glowText {
    from { text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px var(--accent), 0 0 30px var(--accent); }
    to { text-shadow: 0 0 2px #fff, 0 0 5px #fff, 0 0 10px var(--accent), 0 0 15px var(--accent); }
}
