/* ===== CSS VARIABLES / DESIGN TOKENS ===== */
:root {
    /* Primary Colors - Warm Spa Theme */
    --color-primary: #f97316;
    --color-primary-light: #fb923c;
    --color-primary-dark: #ea580c;

    /* Secondary Colors */
    --color-secondary: #84cc16;
    --color-secondary-light: #a3e635;

    /* Accent Colors */
    --color-accent: #06b6d4;
    --color-accent-warm: #fbbf24;
    --color-gold: #ffd700;

    /* Background Colors */
    --color-bg-light: rgba(255, 255, 255, 0.9);
    --color-bg-glass: rgba(255, 255, 255, 0.6);
    --color-bg-panel: rgba(255, 255, 255, 0.4);

    /* Text Colors */
    --color-text-primary: #3d2e24;
    --color-text-secondary: #6b5a4e;
    --color-text-muted: #9ca3af;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 60px rgba(249, 115, 22, 0.3);

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 100ms ease-out;
    --transition-normal: 200ms ease-out;
    --transition-slow: 500ms ease-out;

    /* Font */
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    color: var(--color-text-primary);
    line-height: 1.5;
    background-color: #87ceeb;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== ANIMATIONS ===== */
@keyframes float {

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

    50% {
        transform: translateY(-12px);
    }
}

@keyframes pop-and-drop {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.5);
    }

    /* 35% {
        opacity: 1;
        transform: translate(var(--random-x, 0px), -80px) scale(1.3);
    } */

    50% {
        opacity: 1;
        transform: translate(calc(var(--random-x, 0px) * 1.2), -90px) scale(1.3);
    }

    100% {
        opacity: 0;
        transform: translate(calc(var(--random-x, 0px) * 1.5), 150px) scale(0.6);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes pulse-slow {

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

    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

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

    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

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

@keyframes frenzy-pulse {

    0%,
    100% {
        transform: scale(1);
        text-shadow: 0 0 10px rgba(249, 115, 22, 0.8);
    }

    50% {
        transform: scale(1.05);
        text-shadow: 0 0 20px rgba(249, 115, 22, 1);
    }
}

@keyframes slide-in {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

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

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-float-up {
    animation: float-up 1s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-pulse-slow {
    animation: pulse-slow 2s ease-in-out infinite;
}

.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.animate-frenzy {
    animation: frenzy-pulse 0.5s ease-in-out infinite;
}

/* ===== SPARKLE VORTEX ANIMATIONS ===== */
@keyframes vortex-spin {
    0% {
        transform: rotate(0deg);
    }

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

@keyframes vortex-spin-reverse {
    0% {
        transform: rotate(360deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@keyframes sparkle-twinkle {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.8);
        text-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
        text-shadow: 0 0 12px rgba(255, 215, 0, 1), 0 0 20px rgba(255, 165, 0, 0.8);
    }
}

@keyframes shimmer-float {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-15px) scale(1.3);
        opacity: 1;
    }

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

@keyframes shimmer-orbit {
    0% {
        transform: rotate(0deg) translateX(120px) rotate(0deg);
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: rotate(360deg) translateX(120px) rotate(-360deg);
        opacity: 0.6;
    }
}

/* Sparkle Vortex Container */
.sparkle-vortex {
    position: absolute;
    /* inset: -4rem; */
    pointer-events: none;
    z-index: 5;
    opacity: 0.5;
}

/* Sparkle Rings */
.sparkle-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.sparkle-ring-1 {
    width: 22rem;
    height: 22rem;
    animation: vortex-spin 15s linear infinite;
}

.sparkle-ring-2 {
    width: 28rem;
    height: 28rem;
    animation: vortex-spin-reverse 20s linear infinite;
}

.sparkle-ring-3 {
    width: 16rem;
    height: 16rem;
    animation: vortex-spin 10s linear infinite;
}

@media (min-width: 768px) {
    .sparkle-ring-1 {
        width: 28rem;
        height: 28rem;
    }

    .sparkle-ring-2 {
        width: 36rem;
        height: 36rem;
    }

    .sparkle-ring-3 {
        width: 20rem;
        height: 20rem;
    }
}

/* Individual Sparkles */
.sparkle {
    position: absolute;
    font-size: 1.2rem;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 0 16px rgba(255, 165, 0, 0.5);
    animation: sparkle-twinkle 2s ease-in-out infinite;
}

/* Ring 1 - 6 sparkles distributed evenly */
.sparkle-ring-1 .sparkle:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0s;
}

.sparkle-ring-1 .sparkle:nth-child(2) {
    top: 25%;
    right: 6%;
    animation-delay: 0.3s;
}

.sparkle-ring-1 .sparkle:nth-child(3) {
    bottom: 25%;
    right: 6%;
    animation-delay: 0.6s;
}

.sparkle-ring-1 .sparkle:nth-child(4) {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0.9s;
}

.sparkle-ring-1 .sparkle:nth-child(5) {
    bottom: 25%;
    left: 6%;
    animation-delay: 1.2s;
}

.sparkle-ring-1 .sparkle:nth-child(6) {
    top: 25%;
    left: 6%;
    animation-delay: 1.5s;
}

/* Ring 2 - 8 sparkles */
.sparkle-ring-2 .sparkle:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0.1s;
    font-size: 0.9rem;
}

.sparkle-ring-2 .sparkle:nth-child(2) {
    top: 15%;
    right: 15%;
    animation-delay: 0.35s;
    font-size: 1rem;
}

.sparkle-ring-2 .sparkle:nth-child(3) {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    animation-delay: 0.6s;
    font-size: 0.9rem;
}

.sparkle-ring-2 .sparkle:nth-child(4) {
    bottom: 15%;
    right: 15%;
    animation-delay: 0.85s;
    font-size: 1rem;
}

.sparkle-ring-2 .sparkle:nth-child(5) {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 1.1s;
    font-size: 0.9rem;
}

.sparkle-ring-2 .sparkle:nth-child(6) {
    bottom: 15%;
    left: 15%;
    animation-delay: 1.35s;
    font-size: 1rem;
}

.sparkle-ring-2 .sparkle:nth-child(7) {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    animation-delay: 1.6s;
    font-size: 0.9rem;
}

.sparkle-ring-2 .sparkle:nth-child(8) {
    top: 15%;
    left: 15%;
    animation-delay: 1.85s;
    font-size: 1rem;
}

/* Ring 3 - 4 sparkles (larger) */
.sparkle-ring-3 .sparkle:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0.2s;
    font-size: 1.5rem;
}

.sparkle-ring-3 .sparkle:nth-child(2) {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    animation-delay: 0.7s;
    font-size: 1.5rem;
}

.sparkle-ring-3 .sparkle:nth-child(3) {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 1.2s;
    font-size: 1.5rem;
}

.sparkle-ring-3 .sparkle:nth-child(4) {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    animation-delay: 1.7s;
    font-size: 1.5rem;
}

/* Shimmer Container */
.shimmer-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

/* Shimmer Lights */
.shimmer-light {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 223, 128, 0.8) 40%, transparent 70%);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 165, 0, 0.5);
}

.shimmer-1 {
    top: 10%;
    left: 20%;
    animation: shimmer-float 3s ease-in-out infinite;
    animation-delay: 0s;
}

.shimmer-2 {
    top: 5%;
    right: 25%;
    animation: shimmer-float 2.5s ease-in-out infinite;
    animation-delay: 0.5s;
    width: 6px;
    height: 6px;
}

.shimmer-3 {
    bottom: 15%;
    left: 15%;
    animation: shimmer-float 3.5s ease-in-out infinite;
    animation-delay: 1s;
    width: 10px;
    height: 10px;
}

.shimmer-4 {
    bottom: 10%;
    right: 20%;
    animation: shimmer-float 2.8s ease-in-out infinite;
    animation-delay: 1.5s;
}

.shimmer-5 {
    top: 50%;
    left: 5%;
    animation: shimmer-float 3.2s ease-in-out infinite;
    animation-delay: 0.8s;
    width: 5px;
    height: 5px;
}

.shimmer-6 {
    top: 50%;
    right: 8%;
    animation: shimmer-float 2.7s ease-in-out infinite;
    animation-delay: 1.3s;
    width: 7px;
    height: 7px;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 50%, #fecaca 100%);
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

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

.loading-capybara {
    font-size: 5rem;
    animation: float 2s ease-in-out infinite;
    margin-bottom: 1rem;
}

.loading-content h2 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.loading-bar {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0 auto;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent-warm));
    border-radius: var(--radius-full);
    transition: width 0.3s ease-out;
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    width: 100%;
    max-width: 48rem;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    animation: bounce-in 0.4s ease-out;
}

.modal-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.modal-text {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.inline-icon {
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
}

.collect-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
}

.collect-btn:hover {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent-warm));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== GOLDEN ORANGE ===== */
.golden-orange {
    position: fixed;
    z-index: 90;
    background: none;
    padding: 0;
    transition: transform var(--transition-normal);
    animation: pulse-slow 2s ease-in-out infinite;
}

.golden-orange:hover {
    transform: scale(1.15);
}

.golden-orange.hidden {
    display: none;
}

.orange-emoji {
    font-size: 4rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.orange-sparkle {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    color: #fde047;
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ===== FLOATING TEXTS ===== */
.floating-texts-container {
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
    overflow: hidden;
}

.floating-text {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 2px 2px 0 white, -1px -1px 0 white;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: pop-and-drop 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    user-select: none;
}

.floating-text .floating-icon {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

.floating-text.big {
    font-size: 2rem;
    text-align: center;
}

/* ===== GAME CONTAINER ===== */
.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-image: url('assets/hg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (min-width: 768px) {
    .game-container {
        flex-direction: row;
    }
}

/* ===== SPA PANEL (Left Side) ===== */
.spa-panel {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--color-bg-panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 4px solid rgba(251, 191, 36, 0.3);
}

@media (min-width: 768px) {
    .spa-panel {
        border-bottom: none;
        border-right: 4px solid rgba(251, 191, 36, 0.3);
    }
}

/* Audio Toggle */
.audio-toggle {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 20;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all var(--transition-normal);
}

.audio-toggle:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Dev Cheat Button */
.dev-cheat-btn {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    z-index: 50;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    background: rgba(239, 68, 68, 0.8);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0.7;
    transition: all var(--transition-normal);
}

.dev-cheat-btn:hover {
    background: rgba(220, 38, 38, 1);
    opacity: 1;
}

/* Reset Game Button */
.reset-game-btn {
    position: absolute;
    top: 5rem;
    bottom: auto;
    left: 1.5rem;
    z-index: 50;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    background: rgba(75, 85, 99, 0.8);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0.7;
    transition: all var(--transition-normal);
}

.reset-game-btn:hover {
    background: rgba(55, 65, 81, 1);
    opacity: 1;
}

/* Dev Toggle Button */
.dev-toggle-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 50;
    padding: 0.25rem;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.2;
    transition: all var(--transition-normal);
}

.dev-toggle-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Header Stats */
.header-stats {
    position: absolute;
    top: 1.5rem;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 2px 2px 0 white, -1px -1px 0 white;
    margin-bottom: 0.5rem;
}

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

.stats-bar {
    display: inline-flex;
    gap: 2rem;
    padding: 0.25rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
    /* Enable clicks */
}

.cps-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.cps-stat.frenzy {
    color: var(--color-accent-warm);
    font-weight: 700;
    animation: frenzy-pulse 0.5s ease-in-out infinite;
}

.stat-icon {
    width: 1rem;
    height: 1rem;
    object-fit: contain;
}

/* ===== CLICKER AREA ===== */
.clicker-area {
    position: relative;
    cursor: pointer;
    user-select: none;
    margin-top: 150px;
}

.glow-effect {
    position: absolute;
    inset: -2rem;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, transparent 70%);
    border-radius: var(--radius-full);
    opacity: 0.3;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.clicker-area:hover .glow-effect {
    opacity: 0.5;
}

.capybara-container {
    position: relative;
    width: 18rem;
    height: 18rem;
    transition: transform var(--transition-fast);
}

@media (min-width: 768px) {
    .capybara-container {
        width: 24rem;
        height: 24rem;
    }
}

.clicker-area:hover .capybara-container {
    transform: scale(1.05);
}

.clicker-area:active .capybara-container {
    transform: scale(0.95);
}

.capybara-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 25px 25px rgba(0, 0, 0, 0.15));
}

/* Fallback SVG */
.capybara-fallback {
    width: 100%;
    height: 100%;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.fallback-error-text {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

/* ===== HELPER ANIMALS ===== */
.helper-animal {
    position: absolute;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 20;
}

.helper-animal.hidden {
    display: none;
}

.helper-frog {
    bottom: 0;
    right: -1rem;
    width: 7rem;
    height: 7rem;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.2));
    /* animation-delay: 0.1s; */
}

@media (min-width: 768px) {
    .helper-frog {
        right: -3rem;
    }
}

.helper-bamboo {
    top: 4rem;
    right: -3rem;
    width: 14rem;
    height: 14rem;
    z-index: 10;
    animation-delay: 0.3s;
}

@media (min-width: 768px) {
    .helper-bamboo {
        right: -4rem;
    }
}

.helper-yuzu {
    left: 4.5rem;
    top: 156px;
    width: 80px;
    height: auto;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.15));
    animation-delay: 1s;
}

@media (min-width: 768px) {
    .helper-yuzu {
        left: 4.5rem;
        top: 176px;
    }
}

.helper-volcano {
    position: absolute;
    bottom: -10%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: none;
    z-index: 1;
    pointer-events: none;
    opacity: 1;
}

.helper-zen {
    width: 16rem;
    top: -10%;
    left: -20%;
    animation: float 5s ease-in-out infinite reverse;
    z-index: 10;
}

@keyframes spin-slow {
    from {
        transform: translateX(-50%) rotate(0deg);
    }

    to {
        transform: translateX(-50%) rotate(360deg);
    }
}

.helper-portal {
    top: 0%;
    right: 2rem;
    left: auto;
    width: 6rem;
    transform: none;
    animation: none;
    z-index: 5;
    opacity: 0.9;
}

@keyframes float-flipped {

    0%,
    100% {
        transform: translateY(0) scaleX(-1);
    }

    50% {
        transform: translateY(-10px) scaleX(-1);
    }
}

.helper-duck {
    top: 17rem;
    left: -0.5rem;
    width: 5rem;
    height: 5rem;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.15));
    animation: float-flipped 3s ease-in-out infinite;
    animation-delay: 2.5s;
    transform: translateY(0) scaleX(-1);
}

@media (min-width: 768px) {
    .helper-duck {
        left: -0.5rem;
        width: 6rem;
        height: 6rem;
    }
}

/* ===== POINTS DISPLAY ===== */
.points-display {
    margin-top: 4rem;
    text-align: center;
    background: var(--color-bg-glass);
    padding: 1rem;
    border-radius: var(--radius-xl);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
    min-width: 360px;
}

.points-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.025em;
}

.points-icon {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
}

.points-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
}

/* ===== SHOP PANEL (Right Side) ===== */
.shop-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    background: var(--color-bg-light);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    height: 50vh;
    border-left: 1px solid rgba(251, 191, 36, 0.3);
}

@media (min-width: 768px) {
    .shop-panel {
        max-width: 72rem;
        height: auto;
    }
}

.shop-header {
    padding: 1rem;
    background: rgba(255, 237, 213, 0.8);
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

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

/* ===== BUILDINGS CONTAINER ===== */
.buildings-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.shop-columns {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .shop-columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        align-items: start;
    }
}

.shop-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shop-section-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 0.25rem;
}

/* Custom Scrollbar */
.buildings-container::-webkit-scrollbar {
    width: 8px;
}

.buildings-container::-webkit-scrollbar-track {
    background: rgba(251, 191, 36, 0.1);
    border-radius: var(--radius-full);
}

.buildings-container::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.4);
    border-radius: var(--radius-full);
}

.buildings-container::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 191, 36, 0.6);
}

/* ===== BUILDING ITEM ===== */
.building-item {
    position: relative;
    overflow: hidden;
    padding: 0.75rem;
    border: 2px solid var(--color-secondary);
    border-radius: var(--radius-lg);
    background: white;
    cursor: pointer;
    transition: all var(--transition-normal);
    user-select: none;
}

.building-item:hover {
    background: rgba(255, 237, 213, 0.5);
    box-shadow: var(--shadow-md);
    transform: scale(1.02);
}

.building-item.disabled {
    cursor: not-allowed;
    border-color: #e5e7eb;
    background: #f9fafb;
    opacity: 0.7;
}

.building-item.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Progress Bar */
.building-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--color-secondary);
    opacity: 0.5;
    transition: width var(--transition-slow);
}

/* Building Content */
.building-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.building-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.building-emoji {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 237, 213, 0.8);
    border-radius: var(--radius-full);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.building-details h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.building-details p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.125rem;
}

.building-cps {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-secondary);
    margin-top: 0.25rem;
}

/* Building Stats */
.building-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.building-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-secondary);
}

.building-cost {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
}

.building-cost.disabled {
    color: var(--color-text-muted);
}

.building-cost .cost-icon {
    width: 1rem;
    height: 1rem;
    object-fit: contain;
}

/* ===== LATEST ACHIEVEMENT ===== */
.latest-achievement {
    padding: 0.75rem;
    background: rgba(249, 250, 251, 0.9);
    border-top: 1px solid #f3f4f6;
    font-size: 0.75rem;
    text-align: center;
    color: var(--color-text-muted);
}

.latest-achievement.hidden {
    display: none;
}

/* ===== FRENZY INDICATOR ===== */
.frenzy-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 75;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.95), rgba(234, 88, 12, 0.95));
    border-radius: var(--radius-xl);
    box-shadow: 0 0 40px rgba(249, 115, 22, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-align: center;
    animation: bounce-in 0.4s ease-out;
}

.frenzy-indicator.hidden {
    display: none;
}

.frenzy-text {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: frenzy-pulse 0.5s ease-in-out infinite;
}

.frenzy-timer {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 0.5rem;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    /* Stack upwards: first child is visually at bottom */
    gap: 0.75rem;
    pointer-events: none;
    /* Let clicks pass through gaps */
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--color-gold);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    /* Enable clicks on toast */
    animation: toast-slide-up 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--color-gold);
}

.toast-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toast-title {
    font-weight: 700;
    color: #ffd700;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.toast-message {
    color: #e2e8f0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    margin-top: -0.25rem;
}

.toast-close:hover {
    color: white;
}

@keyframes toast-slide-up {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

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

.clear-toasts-btn {
    position: absolute;
    bottom: 0;
    right: -4.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    transition: all 0.2s;
    line-height: 1;
    animation: fade-in 0.3s ease-out;
    pointer-events: auto;
}

.clear-toasts-btn:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

/* ===== PORTAL EFFECT ===== */
.portal-capybara {
    position: absolute;
    width: 2.5rem;
    height: auto;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    animation: fall-fade 2.5s ease-in forwards;
}

@keyframes fall-fade {
    0% {
        transform: translateY(0) rotate(0deg) scale(0.2);
        opacity: 0;
    }

    20% {
        opacity: 1;
        transform: translateY(2rem) rotate(45deg) scale(1);
    }

    80% {
        opacity: 1;
    }

    100% {
        transform: translateY(15rem) rotate(180deg) scale(0.8);
        opacity: 0;
    }
}

/* ===== LOCKED SHOP ITEMS ===== */
.building-item.locked {
    background: rgba(0, 0, 0, 0.05);
    border-color: transparent;
    cursor: not-allowed;
}

.building-item.locked .building-emoji {
    filter: brightness(0) opacity(0.2);
}

.building-item.locked .building-details h3 {
    color: transparent;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    filter: blur(4px);
    user-select: none;
}

.building-item.locked .building-details p,
.building-item.locked .building-cps,
.building-item.locked .building-stats {
    visibility: hidden;
}

.building-item.locked:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

/* ===== WEATHER SYSTEM ===== */
.weather-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 90;
    transition: background 2s ease;
}

/* Rain Effect */
.game-container.rain .weather-layer {
    background: rgba(20, 30, 50, 0.4);
}

/* Rain Effect - Layer 1 (Close) */
.game-container.rain .weather-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('assets/rain.svg');
    background-size: 300px 300px;
    animation: rain-scroll 0.8s linear infinite;
    opacity: 0.8;
    z-index: 2;
}

/* Rain Effect - Layer 2 (Far) */
.game-container.rain .weather-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('assets/rain.svg');
    background-size: 500px 500px;
    /* Larger pattern = appears smaller/further if drops are relative */
    /* Actually we want smaller drops for background. 
       If SVG has 200x200, scaling to 500x500 makes drops bigger.
       Scaling to 150x150 makes drops smaller. */
    background-size: 150px 150px;
    animation: rain-scroll 1.5s linear infinite;
    opacity: 0.4;
    z-index: 1;
}

/* Fog Effect */
.game-container.fog .weather-layer {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(1px);
}

.game-container.fog .weather-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    background-size: 200% 200%;
    animation: fog-drift 15s infinite alternate;
    opacity: 0.4;
}

/* Night Effect */
.game-container.night .weather-layer {
    background: rgba(10, 15, 60, 0.5);
    /* Lighter blue */
    z-index: 0;
}

.game-container.night .weather-layer::before {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: transparent;
    box-shadow: 10vw 10vh #fff, 20vw 5vh #fff, 30vw 15vh #fff, 50vw 8vh #fff, 60vw 12vh #fff, 80vw 5vh #fff, 90vw 25vh #fff, 15vw 40vh #fff, 45vw 35vh #fff, 75vw 50vh #fff, 25vw 60vh #fff, 65vw 75vh #fff, 85vw 80vh #fff, 5vw 90vh #fff, 55vw 95vh #fff;
    border-radius: 50%;
    opacity: 0.8;
    animation: twinkle 3s infinite alternate;
}

/* Night Moon - Separate Element */
.night-moon {
    position: absolute;
    bottom: -200px;
    left: 15%;
    width: 180px;
    height: 180px;
    background: url('assets/moon.png') no-repeat center center / contain;
    z-index: -1;
    /* Behind Capybara/UI */
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
    filter: drop-shadow(0 0 30px rgba(255, 255, 220, 0.8));
}

.game-container.night .night-moon {
    opacity: 1;
    animation: moon-rise 15s ease-out forwards;
}

.game-container.night .weather-layer::after {
    display: none;
}

/* Indicator Styles */
.weather-indicator {
    position: absolute;
    top: auto;
    bottom: 1.5rem;
    /* Below audio toggle */
    right: auto;
    left: 1.5rem;
    /* Aligned with audio toggle */
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
    z-index: 95;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.4);
    min-width: 140px;
}

.weather-icon {
    font-size: 2rem;
}

.weather-details {
    display: flex;
    flex-direction: column;
}

.weather-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text-primary);
}

.weather-bonus {
    font-size: 0.7rem;
    color: var(--color-primary-dark);
    font-weight: 600;
}

@keyframes rain-scroll {
    0% {
        background-position: 0 -20vh;
    }

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

@keyframes fog-drift {
    from {
        transform: translate(-20%, -20%);
    }

    to {
        transform: translate(10%, 10%);
    }
}

@keyframes twinkle {
    from {
        opacity: 0.3;
        transform: scale(0.8);
    }

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

@keyframes moon-rise {
    from {
        bottom: -200px;
        transform: translateX(-50%) rotate(-15deg);
    }

    to {
        bottom: 65%;
        transform: translateX(-50%) rotate(0deg);
    }
}

/* ===== PRESTIGE SYSTEM ===== */
.karmic-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.5rem;
    color: #8b5cf6;
    /* Purple */
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    border-radius: var(--radius-sm);
}

.karmic-stat:hover {
    background: rgba(139, 92, 246, 0.1);
}

.karmic-stat.can-prestige {
    color: #d946ef;
    /* Magenta */
    text-shadow: 0 0 8px rgba(217, 70, 239, 0.4);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {

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

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

#karmic-bonus {
    font-size: 0.8em;
    opacity: 0.8;
}

/* Prestige Modal */
.prestige-modal {
    border-top: 5px solid #8b5cf6;
}

.prestige-description {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.prestige-preview {
    background: rgba(139, 92, 246, 0.1);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.prestige-preview p {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
}

.prestige-preview strong {
    color: #8b5cf6;
}

.prestige-warning {
    color: #ef4444;
    font-weight: 700;
    margin-bottom: 2rem;
    padding: 0.75rem;
    background: #fee2e2;
    border-radius: var(--radius-md);
    display: inline-block;
}

.prestige-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.prestige-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
}

.prestige-btn.confirm {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.3);
}

.prestige-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.4);
}

.prestige-btn.cancel {
    background: #f3f4f6;
    color: var(--color-text-secondary);
}

.prestige-btn.cancel:hover {
    background: #e5e7eb;
}

/* Buy Multiplier */
.buy-multiplier {
    display: flex;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    gap: 0.25rem;
}

.multiplier-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: transparent;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.multiplier-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--color-primary);
}

.multiplier-btn.active {
    background: white;
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* Language Buttons */
.lang-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}