/* ===== CSS VARIABLES & DESIGN TOKENS ===== */
:root {
    /* Colors - Warm Sunset Palette */
    --primary: #FF6B35;
    --primary-dark: #E85A2A;
    --primary-light: #FF8F5C;
    --secondary: #2EC4B6;
    --secondary-dark: #25A99D;
    --accent: #FFD166;
    --accent-dark: #F0C14B;

    /* Background Gradients */
    --bg-gradient: linear-gradient(180deg, #87CEEB 0%, #98D8C8 30%, #F7DC6F 70%, #FF6B35 100%);
    --bg-menu: #c2996b;
    /* Base cork color */
    --bg-game: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-dark: #1a1a2e;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Font */
    --font-family: 'Fredoka', sans-serif;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: var(--bg-menu);
    color: var(--text-primary);
}

/* ===== SCREENS ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: calc(var(--vh, 1vh) * 100);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* ===== GLASS PANEL ===== */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

/* ===== MAIN MENU (BATTLE CATS STYLE) ===== */
.corkboard-theme {
    background-color: #bc936a;
    background-image:
        /* Layer 1: Micro-grain (very high frequency) */
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E"),
        /* Layer 2: Clumpy texture (mid frequency) */
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='clumps'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.4' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23clumps)'/%3E%3C/svg%3E"),
        /* Layer 3: Organic variations */
        radial-gradient(circle at 20% 30%, rgba(139, 69, 19, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(139, 69, 19, 0.1) 0%, transparent 40%),
        /* Vignette and depth */
        radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%);
    background-blend-mode: soft-light, overlay, multiply, multiply, normal;
    background-size: 100px 100px, 200px 200px, 100% 100%, 100% 100%, 100% 100%;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 200px rgba(0, 0, 0, 0.6);
    border: 20px solid #8b4513;
    /* Stronger wood frame */
    outline: 5px solid #5d2e0c;
    /* Frame shadow/edge */
    outline-offset: -20px;
}

/* Base screen styles are inherited from .screen, background handled by .corkboard-theme */

#menu-screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.1) 100%);
    z-index: 2;
    pointer-events: none;
}

/* Background Photos */
.background-photos {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.photo-frame {
    position: absolute;
    padding: 15px 15px 35px 15px;
    background: #fffcd1;
    /* Warm sticky note color */
    box-shadow:
        2px 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.05);
    transform: rotate(var(--rotation));
    z-index: 1;
    animation: fadeInPhoto 1s ease-out forwards;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom-right-radius: 20px 5px;
    /* Slight curl effect */
}

.photo-frame:nth-child(even) {
    background: #ffffff;
}

.pushpin {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 35% 35%, #ff4d4d, #b30000 80%, #660000);
    border-radius: 50%;
    box-shadow:
        1px 3px 5px rgba(0, 0, 0, 0.4),
        0 1px 1px rgba(255, 255, 255, 0.4) inset;
    z-index: 2;
}

/* The metallic pin bit */
.pushpin::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 8px;
    background: linear-gradient(to right, #ccc, #eee, #999);
    z-index: -1;
}

.photo-frame img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    background: transparent;
    border: none;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.note-label {
    font-family: 'Indie Flower', cursive;
    font-size: 1.1rem;
    color: #333;
    margin-top: 5px;
    font-weight: bold;
    letter-spacing: 1px;
}

@keyframes fadeInPhoto {
    from {
        opacity: 0;
        transform: rotate(var(--rotation)) scale(0.8);
    }

    to {
        opacity: 1;
        transform: rotate(var(--rotation)) scale(1);
    }
}

.photo-1 {
    top: 8%;
    left: 3%;
    --rotation: -12deg;
}

.photo-2 {
    top: 12%;
    right: 4%;
    --rotation: 15deg;
}

.photo-3 {
    bottom: 15%;
    left: 5%;
    --rotation: 20deg;
}

.photo-4 {
    bottom: 22%;
    right: 6%;
    --rotation: -18deg;
}

.photo-5 {
    top: 45%;
    left: 1%;
    --rotation: -25deg;
}

.photo-6 {
    top: 38%;
    right: 2%;
    --rotation: 10deg;
}

.photo-7 {
    bottom: 45%;
    left: 8%;
    --rotation: 5deg;
}

.photo-8 {
    bottom: 48%;
    right: 7%;
    --rotation: -8deg;
}

.photo-9 {
    top: 25%;
    right: 15%;
    --rotation: 5deg;
}

.photo-10 {
    bottom: 35%;
    right: 20%;
    --rotation: -12deg;
}

.photo-11 {
    top: 40%;
    left: 15%;
    --rotation: 8deg;
}

.photo-12 {
    bottom: 10%;
    right: 25%;
    --rotation: 15deg;
}

.photo-13 {
    top: 15%;
    right: 22%;
    --rotation: -5deg;
}

.photo-14 {
    bottom: 25%;
    left: 18%;
    --rotation: -10deg;
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    z-index: 20;
    padding: var(--spacing-xl);
    position: relative;
}

/* Battle Cats Styled Logo */
.battle-cats-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.15));
    margin-bottom: var(--spacing-lg);
    user-select: none;
    animation: logoWobble 4s ease-in-out infinite;
}

@keyframes logoWobble {

    0%,
    100% {
        transform: rotate(-2deg) scale(1);
    }

    50% {
        transform: rotate(2deg) scale(1.05);
    }
}

.logo-top {
    font-size: 1.5rem;
    font-weight: 900;
    color: #FF5EAB;
    -webkit-text-stroke: 1.5px white;
    text-shadow: 4px 4px 0 #000;
    margin-bottom: -15px;
    z-index: 2;
}

.logo-middle {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1;
}

.logo-word {
    font-size: 5rem;
    font-weight: 900;
    color: #FF5EAB;
    -webkit-text-stroke: 3px white;
    text-shadow: 6px 6px 0 #000;
    letter-spacing: -2px;
}

.logo-cat-head {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 4px solid black;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    transform: rotate(10deg);
    background: white;
    overflow: hidden;
}

.logo-cat-head img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.logo-bottom {
    font-size: 4rem;
    font-weight: 900;
    color: #4FB0FF;
    -webkit-text-stroke: 3px white;
    text-shadow: 6px 6px 0 #000;
    margin-top: -25px;
    letter-spacing: -1px;
}

/* Main Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 30;
    width: 340px;
    position: relative;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.btn-sub {
    display: block;
    font-size: 0.55rem;
    font-weight: 600;
    opacity: 0.7;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

.btn-primary {
    background: linear-gradient(135deg, #ff6b35, #f7b733);
}

.btn-secondary {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
}

.btn-sandbox {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

.btn-prestige {
    background: linear-gradient(135deg, #ffd700, #daa520);
    color: #4a3c00;
    text-shadow: none;
}

.btn-daily {
    background: linear-gradient(135deg, #e65c00, #f9d423);
}

.daily-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
    text-align: left;
}

.daily-detail {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
}

.daily-detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    margin-bottom: 4px;
}

.daily-detail-value {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.5;
}

.daily-detail-desc {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 2px;
}

.daily-loadout {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 6px;
    flex-wrap: wrap;
}

.daily-loadout-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 8px;
    min-width: 56px;
}

.daily-loadout-name {
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 2px;
}

/* Base Customization Screen */
.base-container {
    width: 90%;
    max-width: 600px;
    padding: var(--spacing-xl);
    max-height: 85vh;
    overflow-y: auto;
}

.base-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.base-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.base-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.base-theme-card {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.base-theme-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.25);
}

.base-theme-card.selected {
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.1);
}

.base-theme-preview {
    position: relative;
    width: 60px;
    height: 80px;
}

.base-preview-tower {
    width: 40px;
    height: 60px;
    border-radius: 6px 6px 0 0;
    margin: 20px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.base-preview-tower::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 15px solid;
    border-bottom-color: inherit;
}

.base-preview-emblem {
    font-size: 1.3rem;
}

.base-preview-flag {
    position: absolute;
    top: 2px;
    right: 5px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 12px solid #22C55E;
}

.base-theme-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.daily-completed-badge {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    font-size: 1rem;
}

/* Battle Stats Panel */
.battle-stats-panel {
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    margin: 8px 0;
    font-size: 0.8rem;
}

.battle-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-bottom: 8px;
}

.battle-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.battle-stat-label {
    color: rgba(255, 255, 255, 0.7);
}

.battle-stat-value {
    font-weight: 700;
    color: #FFD700;
}

.battle-stats-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 6px 0 4px;
}

.unit-stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-bottom: 2px;
    font-size: 0.75rem;
}

.unit-stat-row .unit-emoji {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.unit-stat-row .unit-name {
    flex: 1;
    color: rgba(255, 255, 255, 0.8);
}

.unit-stat-row .unit-kills {
    color: #FF6B6B;
    font-weight: 700;
}

.unit-stat-row .unit-dmg {
    color: #FFD700;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
}

.btn-icon {
    font-size: 1.1rem;
}

.menu-fog-layer {
    display: none;
}

/* Floating Characters */
.floating-capybara,
.floating-lion {
    position: absolute;
    font-size: 2.5rem;
    opacity: 0.9;
    animation: float 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.5));
}

.capy-1 {
    top: 12%;
    left: 8%;
    animation-delay: 0s;
}

.capy-2 {
    bottom: 15%;
    right: 10%;
    animation-delay: 2s;
}

.lion-1 {
    top: 20%;
    right: 8%;
    animation-delay: 1s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(-3deg);
    }

    50% {
        transform: translateY(-15px) rotate(3deg);
    }
}

/* ===== BUTTONS ===== */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 8px var(--spacing-xl);
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 220px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-normal);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-primary);
    box-shadow:
        0 4px 0 var(--primary-dark),
        0 6px 20px rgba(255, 107, 53, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 var(--primary-dark),
        0 10px 30px rgba(255, 107, 53, 0.5);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 0 var(--primary-dark),
        0 3px 10px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 2px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(1px);
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-icon-only {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.btn-icon-only.active {
    background: var(--secondary);
    color: white;
    box-shadow: 0 0 10px var(--secondary);
    border-color: white;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 4px 0 var(--primary-dark), 0 6px 20px rgba(255, 107, 53, 0.4);
    }

    50% {
        box-shadow: 0 4px 0 var(--primary-dark), 0 6px 40px rgba(255, 107, 53, 0.7);
    }
}

/* Endless Mode Button - Blue/Purple Gradient */
.btn-special {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    box-shadow:
        0 4px 0 #5a3d8a,
        0 6px 20px rgba(102, 126, 234, 0.4);
    animation: endlessGlow 3s ease-in-out infinite;
}

.btn-special:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 #5a3d8a,
        0 10px 30px rgba(102, 126, 234, 0.6);
}

@keyframes endlessGlow {

    0%,
    100% {
        box-shadow: 0 4px 0 #5a3d8a, 0 6px 20px rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 4px 0 #5a3d8a, 0 6px 35px rgba(118, 75, 162, 0.7);
    }
}

/* Prestige Button - Golden Gradient */
.btn-prestige {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF6B35 100%);
    color: #1a1a2e;
    font-weight: 700;
    box-shadow:
        0 4px 0 #cc8800,
        0 6px 20px rgba(255, 215, 0, 0.4);
    animation: prestigeShine 3s ease-in-out infinite;
}

.btn-prestige:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 #cc8800,
        0 10px 30px rgba(255, 215, 0, 0.6);
}

@keyframes prestigeShine {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
        filter: brightness(1.1);
    }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-footer {
    margin-top: var(--spacing-lg);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* ===== TUTORIAL SCREEN ===== */
#tutorial-screen {
    background: var(--bg-menu);
}

.tutorial-container {
    max-width: 400px;
    width: 90%;
    padding: var(--spacing-xl);
    text-align: center;
}

.tutorial-container h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
    color: var(--accent);
}

.tutorial-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.tutorial-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    text-align: left;
    padding: var(--spacing-sm);
}

.tutorial-icon {
    font-size: 2rem;
    min-width: 50px;
    text-align: center;
}

.tutorial-item p {
    font-size: 1rem;
    line-height: 1.4;
}

/* ===== GAME SCREEN ===== */
#game-screen {
    background: var(--bg-game);
    padding: 0;
}

#game-canvas {
    width: 100vw;
    height: 100vh;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* Game HUD */
#game-hud {
    position: absolute;
    top: var(--spacing-md);
    left: var(--spacing-md);
    right: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 100;
}

.hud-left,
.hud-center,
.hud-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.coin-display {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 1.3rem;
    font-weight: 600;
}

.coin-icon {
    font-size: 1.5rem;
    animation: coinSpin 3s linear infinite;
}

@keyframes coinSpin {

    0%,
    100% {
        transform: rotateY(0);
    }

    50% {
        transform: rotateY(180deg);
    }
}

.wave-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 600;
}

.wave-display span:first-child {
    font-size: 0.7rem;
    opacity: 0.8;
    letter-spacing: 2px;
}

.wave-display span:last-child {
    font-size: 1.5rem;
    color: var(--accent);
}

/* Deploy Bar */
#deploy-bar {
    position: absolute;
    bottom: var(--spacing-md);
    left: var(--spacing-md);
    right: var(--spacing-md);
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    z-index: 100;
}

/* Skills Bar */
.skills-bar {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--glass-border);
}

.skill-btn {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.skill-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.skill-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.skill-emoji {
    font-size: 1.2rem;
}

.skill-cost {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--accent);
}

.skill-cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: height 0.1s linear;
}

/* Active Skill Overlays */
.skill-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.war-cry-active .skill-overlay {
    background: radial-gradient(circle, transparent 40%, rgba(255, 107, 53, 0.2) 100%);
    opacity: 1;
}

.time-dilation-active .skill-overlay {
    background: radial-gradient(circle, transparent 40%, rgba(46, 196, 182, 0.2) 100%);
    opacity: 1;
}

.deploy-units {
    display: flex;
    justify-content: flex-start;
    /* Changed from space-around to allow scrolling */
    gap: var(--spacing-xs);
    overflow-x: auto;
    padding-bottom: 5px;
    /* Space for scrollbar */
    max-width: 100%;
}

/* Horizontal scrollbar for unit deploy bar */
.deploy-units::-webkit-scrollbar {
    height: 8px;
}

.deploy-units::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.deploy-units::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

/* Dismiss Hero Button */
.btn-danger {
    background: linear-gradient(to bottom, #ff4d4d, #cc0000);
    border: 2px solid #ffcccc;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 0 #990000;
}

.btn-danger:active {
    box-shadow: 0 2px 0 #990000;
    transform: translateY(2px);
}

.unit-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 60px;
    font-family: var(--font-family);
    position: relative;
    /* Base for overlay */
    overflow: hidden;
}

.cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    /* Will be controlled by JS */
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: height 0.1s linear;
}

.unit-btn:disabled .cooldown-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.unit-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
    transform: translateY(-4px);
}

.unit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.unit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.unit-btn.affordable {
    border-color: var(--secondary);
    box-shadow: 0 0 15px rgba(46, 196, 182, 0.4);
}

.unit-icon {
    font-size: 1.8rem;
}

.unit-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.unit-cost {
    font-size: 0.6rem;
    color: var(--accent);
    font-weight: 500;
}

/* ===== OVERLAYS ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--transition-normal);
}

.overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.overlay-content {
    padding: var(--spacing-xl);
    text-align: center;
    min-width: 280px;
    animation: slideUp var(--transition-normal);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-lg);
}

.overlay-content .btn {
    margin-top: var(--spacing-md);
    width: 100%;
}

/* Victory Screen */
.victory h2 {
    color: var(--accent);
    text-shadow: 0 0 20px rgba(255, 209, 102, 0.5);
}

.victory-stars {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    animation: starsAppear 0.5s ease-out;
}

@keyframes starsAppear {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.victory-message,
.defeat-message {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: var(--spacing-lg);
}

.victory-stats,
.defeat-stats {
    margin-bottom: var(--spacing-md);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

/* Defeat Screen */
.defeat h2 {
    color: #ff6b6b;
    animation: defeatShake 0.6s ease;
}

.defeat {
    animation: defeatFlash 0.5s ease;
}

@keyframes defeatFlash {

    0%,
    100% {
        background: var(--glass-bg);
    }

    50% {
        background: rgba(255, 0, 0, 0.2);
    }
}

@keyframes defeatShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.defeat-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    animation: heartBreak 0.8s ease-out;
}

@keyframes heartBreak {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.4) rotate(-5deg);
    }

    50% {
        transform: scale(0.8) rotate(5deg);
    }

    75% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Victory Screen Enhanced */
.victory {
    animation: victoryGlow 1s ease;
}

@keyframes victoryGlow {
    0% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0);
    }

    50% {
        box-shadow: 0 0 60px rgba(255, 215, 0, 0.5);
    }

    100% {
        box-shadow: var(--glass-shadow);
    }
}

.victory h2 {
    animation: victoryBounce 0.8s ease;
}

@keyframes victoryBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.3);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.victory-stars {
    animation: starsExplode 0.8s ease-out, starsSpin 2s linear infinite;
}

@keyframes starsExplode {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.5) rotate(180deg);
    }

    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

@keyframes starsSpin {
    from {
        filter: hue-rotate(0deg);
    }

    to {
        filter: hue-rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .title-main {
        font-size: 2.8rem;
    }

    .title-sub {
        font-size: 2rem;
    }

    .title-emoji {
        font-size: 2.2rem;
    }

    .btn {
        min-width: 180px;
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: 1rem;
    }

    .unit-btn {
        min-width: 50px;
        padding: var(--spacing-xs);
    }

    .unit-icon {
        font-size: 1.5rem;
    }

    .unit-name {
        font-size: 0.55rem;
    }

    .unit-cost {
        font-size: 0.5rem;
    }

    .floating-capybara,
    .floating-lion {
        font-size: 2.5rem;
    }
}

/* ===== GUIDE (ENCYCLOPEDIA) SCREEN ===== */
.guide-container {
    width: 95%;
    max-width: 1000px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 3px solid #333;
    padding-bottom: 10px;
}

.guide-header h2 {
    color: #fff;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.guide-content {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: 0;
    /* Important for flex child scrolling */
}

.guide-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 300px;
}

.guide-tabs {
    display: flex;
    gap: 10px;
}

.guide-tab {
    flex: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #555;
    color: #ccc;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.guide-tab.active {
    background: #ffaa00;
    border-color: #fff;
    color: #000;
}

.guide-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 2px solid #333;
}

.guide-item {
    aspect-ratio: 1;
    background: #444;
    border: 3px solid #666;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.guide-item:hover {
    transform: scale(1.05);
    border-color: #ffaa00;
}

.guide-item.active {
    background: #555;
    border-color: #ffaa00;
    box-shadow: 0 0 15px #ffaa00;
}

.guide-item.locked {
    filter: brightness(0.2) grayscale(1);
    cursor: not-allowed;
}

.guide-item .item-icon {
    font-size: 2.5rem;
}

.guide-item .item-name {
    font-size: 0.7rem;
    color: #fff;
    margin-top: 5px;
    text-align: center;
}

.item-info-prompt {
    position: absolute;
    bottom: -8px;
    background: #ffaa00;
    color: #000;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    opacity: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.guide-item:hover .item-info-prompt,
.guide-item.active .item-info-prompt {
    opacity: 1;
    bottom: 5px;
}

.guide-details {
    flex: 1.5;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    color: #333;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.guide-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    font-style: italic;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.detail-icon {
    font-size: 5rem;
    background: #f0f0f0;
    padding: 20px;
    border-radius: 20px;
    border: 3px solid #ddd;
}

.detail-info h3 {
    font-size: 2.2rem;
    margin: 0;
    color: #222;
}

.item-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 5px;
}

.badge-unit {
    background: #4ADE80;
    color: #064e3b;
}

.badge-enemy {
    background: #EF4444;
    color: #7f1d1d;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-box {
    background: #f8f8f8;
    padding: 10px 15px;
    border-radius: 12px;
    border-left: 5px solid #ffaa00;
}

.stat-label {
    font-size: 0.75rem;
    color: #777;
    margin-bottom: 3px;
    text-transform: uppercase;
    font-weight: bold;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.detail-description {
    background: #f0f0f0;
    padding: 20px;
    border-radius: 15px;
    line-height: 1.5;
    font-size: 1.1rem;
    flex: 1;
}

/* Custom Scrollbar for Guide */
.guide-grid::-webkit-scrollbar,
.guide-details::-webkit-scrollbar {
    width: 8px;
}

.guide-grid::-webkit-scrollbar-track,
.guide-details::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.guide-grid::-webkit-scrollbar-thumb,
.guide-details::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.guide-grid::-webkit-scrollbar-thumb:hover,
.guide-details::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}


@media (min-width: 768px) {
    .title-main {
        font-size: 5rem;
    }

    .title-sub {
        font-size: 3.5rem;
    }

    #deploy-bar {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }

    #game-hud {
        max-width: 700px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
}

/* ===== ANIMATIONS FOR GAME ELEMENTS ===== */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.pop {
    animation: pop 0.3s ease-out;
}

/* ===== EQUIP SCREEN ===== */
#equip-screen {
    background: var(--bg-menu);
}

.equip-container {
    width: 95%;
    max-width: 900px;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.equip-container h2 {
    color: var(--accent);
    font-size: 2.5rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.equip-layout {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-lg);
    width: 100%;
}

.loadout-section,
.inventory-section {
    background: rgba(0, 0, 0, 0.2);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.loadout-section h3,
.inventory-section h3 {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slots-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: var(--spacing-md);
    justify-items: center;
    width: 100%;
    margin: 0 auto;
}

#loadout-slots {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    max-width: 100%;
}

/* Slot Styling */
.slot-btn {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.slot-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.slot-btn.equipped {
    opacity: 0.5;
    cursor: default;
    filter: grayscale(1);
}

.slot-btn .slot-emoji {
    font-size: 2rem;
    margin-bottom: 2px;
}

.slot-btn .slot-cost {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
}

.slot-btn.empty-slot {
    border-style: dashed;
    opacity: 0.5;
}

/* Forced Sideways Layout */
.equip-layout {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-lg);
    width: 100%;
    align-items: flex-start;
}

.loadout-section {
    flex: 0 0 300px;
    /* Fixed width for loadout */
}

.inventory-section {
    flex: 1;
    /* Inventory takes remaining space */
}

@keyframes pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== LEVEL SELECTION ===== */
#level-screen {
    background: url('assets/map_bg.png') center center / cover no-repeat;
    background-color: #1a1a2e;
}

.level-container {
    width: 95%;
    max-width: 900px;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--spacing-md);
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.level-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.level-btn:hover:not(.locked) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.level-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
    background: rgba(0, 0, 0, 0.3);
}

.level-btn.current {
    border-color: var(--secondary);
    background: rgba(46, 196, 182, 0.2);
}

.level-num {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.level-name {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

.level-lock {
    font-size: 1.5rem;
}

.level-difficulty {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 500;
}

/* Music Selection Screen */
.music-layout {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: var(--spacing-lg);
    width: 100%;
    max-height: 60vh;
    padding: var(--spacing-md);
    align-items: flex-start;
}

.current-music-section {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.current-music-section h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin: 0;
    text-align: center;
}

.tracks-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    overflow: hidden;
    min-width: 0;
    /* Critical for flex child scrolling */
}

.tracks-section h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin: 0;
}

.music-grid,
#music-grid {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: var(--spacing-md);
    width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: var(--spacing-md) var(--spacing-sm);
    scroll-behavior: smooth;
    min-height: 160px;
    align-items: center;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
}

.music-btn {
    flex: 0 0 120px;
    width: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    aspect-ratio: 1;
    justify-content: center;
}

.music-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.music-btn.current {
    border-color: var(--secondary);
    background: rgba(46, 196, 182, 0.2);
}

.music-num {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.music-name {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.music-tempo {
    font-size: 0.65rem;
    color: var(--accent);
    font-weight: 500;
}

.music-playing {
    font-size: 0.65rem;
    color: var(--secondary);
    font-weight: 700;
    margin-top: 4px;
}

.current-music-slot {
    background: rgba(46, 196, 182, 0.2);
    border: 2px solid var(--secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    aspect-ratio: 1;
}

.current-music-slot .music-icon {
    font-size: 3rem;
}

.current-music-slot .music-name {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}

.current-music-slot .music-tempo {
    font-size: 0.9rem;
    color: var(--accent);
}

@media (max-width: 480px) {
    .level-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Cannon UI */
#cannon-hud {
    position: absolute;
    right: 30px;
    bottom: 25px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 110;
}

#game-screen.active #cannon-hud {
    display: flex;
}

.cannon-progress-container {
    width: 20px;
    height: 120px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 2px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
}

.cannon-progress-bar {
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, #00d2ff 0%, #3a7bd5 100%);
    border-radius: 8px;
    box-shadow: 0 0 15px #00d2ff, inset 0 0 8px rgba(255, 255, 255, 0.4);
    transition: height 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
    position: relative;
}

.cannon-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    background-size: 100% 200%;
    animation: energyFlow 2s linear infinite;
}

@keyframes energyFlow {
    0% {
        background-position: 0% 100%;
    }

    100% {
        background-position: 0% -100%;
    }
}

/* ===== CREDITS POST-IT ===== */
.siam-post-it {
    position: absolute;
    top: 20px;
    right: -130px;
    width: 120px;
    height: 120px;
    background: #FFEB3B;
    background: linear-gradient(135deg, #FFFDE7 0%, #FFEB3B 100%);
    box-shadow: 2px 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    font-family: 'Fredoka', cursive;
    font-size: 18px;
    color: #444;
    text-align: center;
    transform: rotate(3deg);
    z-index: 100;
    border-bottom-right-radius: 5px 40px;
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-normal);
}

.siam-post-it:hover {
    transform: rotate(0deg) scale(1.05);
}

.siam-post-it .pushpin {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: #F44336;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.siam-post-it .pushpin::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.cannon-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    background: radial-gradient(circle at 30% 30%, #2c2c2c 0%, #1a1a1a 100%);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.2);
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: default;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px 6px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.cannon-btn::before {
    content: '💣';
    position: absolute;
    top: 15px;
    font-size: 1.4rem;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.cannon-btn.ready {
    background: radial-gradient(circle at 30% 30%, #00d2ff 0%, #008080 100%);
    border-color: rgba(0, 255, 255, 0.6);
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    cursor: pointer;
    box-shadow:
        0 0 30px #00FFFF,
        inset 0 0 15px rgba(255, 255, 255, 0.4),
        0 10px 20px rgba(0, 0, 0, 0.4);
    animation: cannonReadyGlow 2s infinite alternate;
}

.cannon-btn.ready::before {
    opacity: 1;
    text-shadow: 0 0 10px #00FFFF;
    animation: bombBounce 0.5s infinite alternate;
}

.cannon-btn.ready:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 0 50px #00FFFF, inset 0 0 20px rgba(255, 255, 255, 0.6);
}

.cannon-btn.ready:active {
    transform: scale(0.95);
    filter: brightness(1.2);
}

@keyframes cannonReadyGlow {
    from {
        box-shadow: 0 0 15px #00FFFF, inset 0 0 10px rgba(255, 255, 255, 0.3), 0 5px 10px rgba(0, 0, 0, 0.3);
    }

    to {
        box-shadow: 0 0 45px #00FFFF, inset 0 0 25px rgba(255, 255, 255, 0.7), 0 15px 30px rgba(0, 0, 0, 0.5);
    }
}

@keyframes bombBounce {
    from {
        transform: translateY(0) rotate(-10deg);
    }

    to {
        transform: translateY(-5px) rotate(10deg);
    }
}

/* ===== LEADERBOARD SCREEN ===== */
#leaderboard-screen {
    display: none;
}

#leaderboard-screen.active {
    display: flex;
}

#leaderboard-screen .level-container {
    position: relative;
    z-index: 10;
}

.leaderboard-entry {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    transition: all var(--transition-fast);
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.leaderboard-rank {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.leaderboard-wave {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff6b35;
}

.leaderboard-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.empty-leaderboard {
    grid-column: 1 / -1;
    padding: var(--spacing-xl);
    text-align: center;
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Name Entry Styles */
.name-entry-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    width: 100%;
}

.name-entry-container label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.glass-input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: white;
    font-family: var(--font-family);
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
    max-width: 250px;
    transition: all var(--transition-fast);
}

.glass-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 209, 102, 0.3);
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.2s ease-in-out 0s 2;
    border-color: #ff6b6b !important;
}

/* ===== TUTORIAL PROMPT ===== */
#tutorial-prompt-overlay {
    z-index: 200;
}

.tutorial-prompt {
    padding: var(--spacing-xl);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: slideInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tutorial-prompt h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--accent);
    text-shadow: 2px 2px 0 var(--text-dark);
}

.tutorial-prompt p {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-xl);
    color: var(--text-primary);
}

.prompt-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.prompt-buttons .btn {
    flex: 1;
    padding: var(--spacing-md);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== TUTORIAL UI ===== */
.tutorial-message-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    animation: tutorialPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tutorial-message-container.active {
    display: block;
    pointer-events: all;
}

.tutorial-message-content {
    padding: var(--spacing-lg);
    text-align: center;
    border: 3px solid var(--accent);
    background: rgba(0, 0, 0, 0.85);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 209, 102, 0.2);
}

#tutorial-text {
    font-size: 1.25rem;
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    font-weight: 500;
}

.tutorial-next-hint {
    font-size: 0.9rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: blink 1.5s infinite;
}

.instruction-pointer {
    position: absolute;
    z-index: 1500;
    display: none;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.instruction-pointer.active {
    display: block;
}

.pointer-arrow {
    font-size: 3rem;
    animation: pointBounce 0.8s ease-in-out infinite alternate;
}

@keyframes tutorialPop {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes pointBounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-20px);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Highlight for UI elements during tutorial */
.tutorial-highlight {
    box-shadow: 0 0 0 4px var(--accent), 0 0 20px var(--accent) !important;
    z-index: 1600 !important;
    position: relative;
    border-radius: var(--radius-md);
}

/* Collin Button Wrapper */
.collin-wrapper {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 90;
    /* Below HUD but above game */
}

.collin-cost {
    font-family: 'Press Start 2P', cursive;
    color: #FFD700;
    font-size: 12px;
    margin-bottom: 5px;
    text-shadow: 2px 2px 0 #000;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 5px;
    border-radius: 4px;
}

/* Collin Button */
.collin-btn {
    position: relative;
    /* Wrapper handles position */
    bottom: auto;
    left: auto;
    width: 150px;
    /* Even larger size */
    height: 150px;
    /* Even larger size */
    border-radius: 12px;
    /* Square with rounded corners */
    background: #8B7355 url('assets/collin_portrait.png') no-repeat center center;
    background-size: cover;
    border: 4px solid #DAA520;
    /* Gold border */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, filter 0.2s;
    overflow: hidden;
}

.collin-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
    box-shadow: 0 6px 15px rgba(218, 165, 32, 0.6);
}

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

.collin-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    opacity: 0.8;
}

.collin-icon {
    display: none;
    /* Hide the emoji icon since we have a picture */
}

.collin-cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
    transition: height 0.1s linear;
}

/* Customization Screen */
.skin-container {
    width: 80%;
    max-width: 900px;
    padding: var(--spacing-xl);
}

.skin-unit-selector {
    width: 100%;
    margin-bottom: var(--spacing-lg);
}

.skin-unit-selector h3 {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.skin-unit-grid {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.skin-unit-btn {
    width: 60px;
    height: 60px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.skin-unit-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

.skin-unit-btn.active {
    background: var(--accent);
    border-color: #FFF;
    box-shadow: 0 0 15px var(--accent);
}

.skin-unit-btn .unit-icon {
    font-size: 2rem;
}

.skin-layout {
    display: flex;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
    height: 60vh;
}

.skin-preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
}

#skin-preview-canvas-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

#skin-unit-display {
    font-size: 8rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.skin-options-section {
    flex: 1.5;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    overflow-y: auto;
}

.skin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.skin-option {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.skin-option:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.skin-option.active {
    background: var(--primary);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--primary);
}

.skin-option-icon {
    font-size: 2.5rem;
}

.skin-option-name {
    font-size: 0.9rem;
    font-weight: bold;
}

.equip-actions {
    display: flex;
    gap: var(--spacing-md);
    width: 100%;
}

.equip-actions .btn {
    flex: 1;
}

/* Collection Screen */
.collection-container {
    width: 90%;
    max-width: 1000px;
    padding: var(--spacing-xl);
}

.collection-tabs {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: var(--spacing-sm) var(--spacing-xl);
    border-radius: var(--radius-full);
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
    background: var(--accent-gold);
    color: #333;
    border-color: var(--accent-gold);
}

.collection-layout {
    display: flex;
    gap: var(--spacing-xl);
    height: 55vh;
}

.collection-layout .inventory-grid {
    flex: 1.5;
    overflow-y: auto;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-md);
    align-content: flex-start;
}

.collection-item {
    aspect-ratio: 1;
    transition: all 0.2s;
}

.collection-item.active {
    background: #555;
    border-color: #ffaa00;
    box-shadow: 0 0 15px #ffaa00;
}

.item-details {
    flex: 1;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    border: 2px solid var(--glass-border);
}

.details-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.item-icon-large {
    font-size: 4rem;
    background: rgba(255, 255, 255, 0.1);
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
}

.details-name-container {
    flex: 1;
}

.item-name {
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin: 0;
}

.item-stats-compact {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: var(--spacing-xs);
}

.item-lore {
    font-style: italic;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-lg);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    flex: 1;
}

/* Battle Cry Bubble Styles (though drawn via Canvas, these are for reference or future HTML elements) */
.speech-bubble {
    position: absolute;
    background: white;
    border-radius: 8px;
    padding: 8px 12px;
    color: #333;
    font-weight: bold;
    font-size: 12px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* ===== PERMANENT TURTLE CURSOR ===== */
body {
    /* Custom Turtle Cursor - URL-encoded SVG for better browser compatibility */
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' style='font-size: 32px'%3E%3Ctext y='32'%3E🐢%3C/text%3E%3C/svg%3E"), auto;
}

.btn:hover,
button:hover,
a:hover {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' style='font-size: 32px'%3E%3Ctext y='32'%3E🐢%3C/text%3E%3C/svg%3E"), pointer;
}


/* ===== ACHIEVEMENT SCREEN ===== */
.achievement-container {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.2);
    border: 4px solid #8b4513;
    z-index: 10;
}

.achievement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px dashed #8b4513;
    padding-bottom: var(--spacing-md);
}

.achievement-header h2 {
    color: #8b4513;
    font-size: 2rem;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--spacing-md);
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.achievement-card {
    background: #fffcd1;
    border: 2px solid #8b4513;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    transition: transform 0.2s;
    filter: grayscale(1);
    opacity: 0.7;
}

.achievement-card.unlocked {
    filter: none;
    opacity: 1;
    background: #ffffff;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
}

.achievement-card.unlocked:hover {
    transform: translateY(-2px);
}

.achievement-icon {
    font-size: 2.5rem;
}

.achievement-info {
    display: flex;
    flex-direction: column;
}

.achievement-name {
    font-weight: bold;
    color: #1a1a2e;
    font-size: 1.1rem;
}

.achievement-desc {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.2;
}

/* ===== EVOLUTION SCREEN ===== */
.evolution-container {
    width: 90%;
    max-width: 900px;
    height: 85vh;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.2);
    border: 5px solid #2d3436;
    z-index: 10;
}

.evolution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    background: #2d3436;
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
}

.evo-coins {
    background: #fdcb6e;
    color: #2d3436;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.evolution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    overflow-y: auto;
    padding: var(--spacing-md);
}

.evolution-card {
    background: #f1f2f6;
    border: 3px solid #dfe4ea;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    transition: all 0.3s ease;
}

.evolution-card:hover {
    border-color: #74b9ff;
    transform: translateY(-5px);
}

.evo-card-top {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.evo-unit-emoji {
    font-size: 3rem;
    background: white;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid #ced6e0;
}

.evo-unit-info {
    flex: 1;
}

.evo-unit-name {
    font-weight: 800;
    font-size: 1.3rem;
    color: #2d3436;
}

.evo-tier-tag {
    display: inline-block;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: #ced6e0;
    font-weight: bold;
    text-transform: uppercase;
}

.evo-stats {
    background: white;
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    font-size: 0.9rem;
    color: #2d3436;
}

.evo-stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.evo-stat-value {
    color: #2ecc71;
    font-weight: bold;
}

.evo-btn {
    margin-top: var(--spacing-sm);
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #0984e3 0%, #6c5ce7 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-weight: 800;
    cursor: pointer;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(9, 132, 227, 0.45);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.evo-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #74b9ff 0%, #a29bfe 100%);
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.65);
    transform: translateY(-1px);
}

.evo-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(9, 132, 227, 0.45);
}

.evo-btn:disabled {
    background: rgba(99, 110, 114, 0.5);
    border-color: rgba(255,255,255,0.1);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

.evo-btn.maxed {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.45);
}

/* ===== UNLOCK OVERLAY ===== */
.unlock-panel {
    max-width: 600px;
    padding: var(--spacing-xl);
    text-align: center;
    animation: unlockPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes unlockPop {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.unlock-title {
    color: #FFD700;
    font-size: 2.5rem;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: var(--spacing-xl);
}

.unlock-units {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.unlock-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 250px;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.unlock-emoji {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    animation: float 3s ease-in-out infinite;
}

.unlock-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: var(--spacing-xs);
}

.unlock-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--spacing-sm);
}

.unlock-lore {
    font-style: italic;
    font-size: 0.8rem;
    color: #fdcb6e;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 5px;
}

.unlock-close-btn {
    background: #FFD700;
    color: #1a1a2e;
    font-weight: 800;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

/* ===== ACHIEVEMENT TOAST ===== */
.achievement-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid #FFD700;
    z-index: 9999;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 320px;
    pointer-events: none;
}

.achievement-toast.show {
    bottom: 30px;
}

.achievement-toast-icon {
    font-size: 2.5rem;
}

.achievement-toast-text {
    display: flex;
    flex-direction: column;
}

.achievement-toast-title {
    color: #FFD700;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-toast-name {
    font-size: 1.2rem;
    font-weight: 800;
}

.achievement-toast-desc {
    font-size: 0.85rem;
    opacity: 0.8;
}


/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {

    /* Main Menu */
    .battle-cats-logo {
        transform: scale(0.8);
        margin-bottom: 0;
    }

    .logo-top {
        font-size: 1.2rem;
    }

    .logo-middle .logo-word {
        font-size: 3rem;
    }

    .logo-cat-head img {
        width: 40px;
    }

    .logo-bottom {
        font-size: 2rem;
        transform: translateY(-10px);
    }

    .menu-buttons {
        width: 250px;
        gap: 10px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    /* Grids & Containers */
    .achievement-grid,
    .evolution-grid,
    .music-grid,
    .level-grid,
    #leaderboard-grid {
        grid-template-columns: 1fr;
    }

    .achievement-container,
    .evolution-container,
    .guide-container,
    .equip-container,
    .level-container,
    .music-container {
        width: 95%;
        height: 90vh;
        padding: var(--spacing-md);
    }

    .guide-sidebar,
    .loadout-section,
    .inventory-section,
    .skin-preview-section,
    .skin-options-section,
    .item-details,
    .collection-layout .inventory-grid {
        min-width: 0;
        width: 100%;
    }

    .guide-content,
    .equip-layout,
    .music-layout,
    .skin-layout,
    .collection-layout {
        flex-direction: column;
        height: auto;
    }

    .skin-preview-section {
        min-height: 200px;
    }

    .item-icon-large {
        width: 70px;
        height: 70px;
        font-size: 3rem;
    }

    /* Game HUD */
    #game-hud {
        padding: 5px 10px;
    }

    .hud-left,
    .hud-center,
    .hud-right {
        gap: 5px;
    }

    .coin-display,
    .wave-display {
        font-size: 0.9rem;
        padding: 5px 10px;
    }

    /* Unit Deploy Bar */
    #deploy-bar {
        height: 100px;
        padding: 5px;
    }

    .unit-btn {
        width: 60px;
        height: 60px;
        margin-top: 5px;
    }

    .unit-emoji {
        font-size: 2rem;
    }

    /* Skills Bar */
    .skill-btn {
        width: 35px;
        height: 35px;
        margin-bottom: 5px;
    }

    /* Target UI */
    .collin-wrapper {
        bottom: 120px;
        /* Above deploy bar */
        transform: scale(0.7);
        transform-origin: bottom left;
    }

    #cannon-hud {
        right: 10px;
        bottom: 120px;
        transform: scale(0.8);
        transform-origin: bottom right;
    }

    /* Overlays */
    .overlay-content {
        padding: var(--spacing-lg);
        width: 90%;
        max-width: 350px;
    }

    .unlock-panel {
        width: 95%;
        padding: var(--spacing-md);
    }

    .unlock-unit {
        width: 100%;
    }
}

@media (max-width: 480px) {

    /* Smaller phones */
    .battle-cats-logo {
        transform: scale(0.7);
    }

    .menu-buttons {
        width: 220px;
    }

    /* Game elements */
    .unit-btn {
        width: 50px;
        height: 50px;
    }

    .unit-emoji {
        font-size: 1.5rem;
    }

    .unit-cost {
        font-size: 0.7rem;
    }

    .coin-display,
    .wave-display {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    #game-hud {
        top: 5px;
    }
}