/* ===== CrabFun — Clicker Styles ===== */

/* --- Layout --- */
.clicker-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

/* --- Stats Bar --- */
.stats-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    text-align: center;
    backdrop-filter: blur(8px);
    min-width: 130px;
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
}

/* --- Crab Area --- */
.crab-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.click-crab {
    font-size: 10rem;
    cursor: pointer;
    user-select: none;
    transition: transform 0.08s ease;
    filter: drop-shadow(0 15px 40px rgba(0,0,0,0.4));
    animation: crabIdle 3s ease-in-out infinite;
    position: relative;
    z-index: 10;
}

.click-crab:active {
    transform: scale(0.88);
    animation: none;
}

@keyframes crabIdle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-2deg); }
    75% { transform: translateY(-8px) rotate(2deg); }
}

/* --- Click Particles --- */
.particle {
    position: absolute;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--gold);
    pointer-events: none;
    z-index: 20;
    animation: particleFly 0.8s ease-out forwards;
    text-shadow: 0 0 8px rgba(255, 214, 10, 0.5);
}

@keyframes particleFly {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.5);
    }
}

/* --- Combo --- */
.combo-display {
    text-align: center;
    margin-top: 10px;
    height: 40px;
}

.combo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.combo-text.active {
    opacity: 1;
    animation: comboPulse 0.3s ease;
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.combo-bar {
    width: 200px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin: 8px auto 0;
    overflow: hidden;
}

.combo-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    border-radius: 3px;
    width: 0%;
    transition: width 0.15s ease;
}

/* --- Auto Crabs (helpers) --- */
.auto-crabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-top: 16px;
    min-height: 30px;
}

.auto-crab {
    font-size: 1.5rem;
    animation: autoCrabWalk 1.5s ease-in-out infinite;
}

.auto-crab:nth-child(even) {
    animation-direction: reverse;
}

@keyframes autoCrabWalk {
    0%, 100% { transform: translateX(0) scaleX(1); }
    50% { transform: translateX(5px) scaleX(-1); }
}

/* Party dancing crabs */
.party-active .auto-crab {
    animation: autoCrabDance 0.4s ease-in-out infinite;
}

@keyframes autoCrabDance {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-15deg) scale(1.1); }
    75% { transform: rotate(15deg) scale(1.1); }
}

/* --- Upgrade Shop --- */
.shop-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shop-title {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.upgrade-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    backdrop-filter: blur(8px);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.upgrade-card:hover:not(.upgrade-disabled) {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(-4px);
}

.upgrade-card.upgrade-disabled {
    opacity: 0.45;
}

.upgrade-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.upgrade-info {
    flex: 1;
    min-width: 0;
}

.upgrade-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.upgrade-effect {
    font-size: 0.78rem;
    opacity: 0.7;
}

.upgrade-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.upgrade-price {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
}

.upgrade-count {
    font-size: 0.75rem;
    opacity: 0.6;
}

.upgrade-buy {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
    transition: all var(--transition);
}

.upgrade-buy:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.upgrade-buy:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Achievements Panel --- */
.achievements-toggle {
    margin-top: 12px;
}

.achievements-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.achievement-item.unlocked {
    background: rgba(6, 214, 160, 0.15);
    border: 1px solid rgba(6, 214, 160, 0.3);
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 1.5rem;
}

/* --- Golden Crab --- */
.golden-crab {
    position: fixed;
    font-size: 4rem;
    cursor: pointer;
    z-index: 500;
    filter: drop-shadow(0 0 20px rgba(255, 214, 10, 0.8));
    animation: goldenFloat 5s linear forwards;
    user-select: none;
}

@keyframes goldenFloat {
    0% {
        transform: translateX(-100px) rotate(0deg);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateX(calc(100vw + 100px)) rotate(720deg);
        opacity: 0;
    }
}

.golden-burst {
    position: fixed;
    font-size: 2rem;
    z-index: 501;
    pointer-events: none;
    animation: burstOut 0.6s ease-out forwards;
    color: var(--gold);
    font-weight: 700;
}

@keyframes burstOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(2) translateY(-50px); }
}

/* --- Party Timer --- */
.party-timer {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    opacity: 0.6;
}

.party-timer span {
    color: var(--gold);
    font-weight: 600;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .clicker-layout {
        grid-template-columns: 1fr;
    }

    .click-crab {
        font-size: 7rem;
    }

    .stats-bar {
        gap: 8px;
    }

    .stat-item {
        min-width: 100px;
        padding: 10px 14px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .shop-panel {
        order: 2;
    }
}

@media (max-width: 480px) {
    .click-crab {
        font-size: 5rem;
    }
}
