/* ═══════════════════════════════════════════════════════════
   Juice Clicker — Cookie-Clicker-style idle game
   ═══════════════════════════════════════════════════════════ */

/* ── Wrapper ─────────────────────────────────────────────── */
.jc-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
    position: relative;
    z-index: 10;
}

.jc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border-primary, #26262b);
}

.jc-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    color: var(--color-text-primary, #f1f3f5);
}

.jc-back-btn {
    background: none;
    border: 1px solid var(--color-border-primary, #333);
    color: var(--color-text-secondary, #ccc);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.jc-back-btn:hover { background: var(--color-bg-secondary, #222); }

.jc-header-btns {
    display: flex;
    gap: 0.4rem;
}

.jc-save-btn,
.jc-reset-btn {
    background: var(--color-bg-secondary, #1f1f23);
    border: 1px solid var(--color-border-primary, #333);
    color: var(--color-text-secondary, #ccc);
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.jc-save-btn:hover { background: #2a5d2a; }
.jc-reset-btn:hover { background: #5d2a2a; }

/* ── Main layout: two columns ────────────────────────────── */
.jc-main {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    align-items: start;
}

/* ── Left column: juice display + click ──────────────────── */
.jc-left {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.jc-juice-display {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    border: 1px solid #2a2a4a;
}

.jc-juice-count {
    font-size: 2.4rem;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
    line-height: 1.1;
    word-break: break-all;
}

.jc-juice-label {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0.2rem;
}

.jc-cps, .jc-per-click {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.jc-golden-indicator {
    font-size: 0.85rem;
    color: #fbbf24;
    font-weight: 600;
    margin-top: 0.3rem;
    animation: jc-pulse 0.5s ease infinite alternate;
}

/* ── Click area ──────────────────────────────────────────── */
.jc-click-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 300px;
    margin: 0 auto;
    background: radial-gradient(circle at 40% 40%, #2a1a3e, #0f0a1e);
    border-radius: 50%;
    border: 3px solid #4a2a6a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    transition: transform 0.08s ease;
    touch-action: manipulation;
    box-shadow: 0 0 40px rgba(74, 42, 106, 0.3), inset 0 0 60px rgba(0,0,0,0.3);
}

.jc-click-area:active {
    transform: scale(0.95);
}

.jc-big-juice {
    font-size: 6rem;
    pointer-events: none;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.3));
    transition: transform 0.08s ease;
}

.jc-click-area:active .jc-big-juice {
    transform: scale(0.9) rotate(-5deg);
}

/* ── Floating click text ─────────────────────────────────── */
.jc-float-text {
    position: absolute;
    color: #fbbf24;
    font-weight: 700;
    font-size: 1.1rem;
    pointer-events: none;
    animation: jc-float-up 1s ease-out forwards;
    z-index: 20;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

@keyframes jc-float-up {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}

/* ── Click particles ─────────────────────────────────────── */
.jc-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fbbf24;
    border-radius: 50%;
    pointer-events: none;
    animation: jc-particle-fly 0.6s ease-out forwards;
    z-index: 15;
}

@keyframes jc-particle-fly {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

/* ── Golden juice drop ───────────────────────────────────── */
.jc-golden-drop {
    position: absolute;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 30;
    animation: jc-golden-bob 2s ease-in-out infinite, jc-golden-glow 1s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 12px gold);
    transition: transform 0.15s;
}

.jc-golden-drop:hover {
    transform: scale(1.3);
}

@keyframes jc-golden-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes jc-golden-glow {
    from { filter: drop-shadow(0 0 8px gold); }
    to { filter: drop-shadow(0 0 24px gold) brightness(1.2); }
}

/* ── Prestige section ────────────────────────────────────── */
.jc-prestige-section {
    background: linear-gradient(135deg, #1a1a2e, #1e293b);
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}

.jc-prestige-info {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.5rem;
}

.jc-prestige-btn {
    width: 100%;
    padding: 0.5rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.jc-prestige-btn:hover {
    filter: brightness(1.2);
}

/* ── Right column: tab panel ─────────────────────────────── */
.jc-right {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    max-height: 75vh;
    background: var(--color-bg-secondary, #18181b);
    border: 1px solid var(--color-border-primary, #26262b);
    border-radius: 12px;
    overflow: hidden;
}

.jc-tabs {
    display: flex;
    background: #111;
    border-bottom: 1px solid #26262b;
    overflow-x: auto;
    scrollbar-width: none;
}

.jc-tabs::-webkit-scrollbar { display: none; }

.jc-tab-btn {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.3rem;
    background: transparent;
    color: #94a3b8;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.72rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.jc-tab-btn.active {
    color: #fbbf24;
    border-bottom-color: #fbbf24;
}

.jc-tab-btn:hover { color: #e2e8f0; }

.jc-tab-panel {
    display: none;
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem;
}

.jc-tab-panel.active { display: block; }

/* ── Buildings list ──────────────────────────────────────── */
.jc-buildings-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.jc-building-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    background: #1e1e2e;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: #e2e8f0;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s;
    opacity: 0.5;
}

.jc-building-btn.affordable {
    opacity: 1;
    border-color: #3b82f6;
}

.jc-building-btn.affordable:hover {
    background: #1e293b;
    border-color: #60a5fa;
}

.jc-building-icon { font-size: 1.8rem; flex-shrink: 0; }

.jc-building-info { flex: 1; min-width: 0; }

.jc-building-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #f1f5f9;
}

.jc-building-desc {
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jc-building-stats {
    font-size: 0.65rem;
    color: #60a5fa;
    margin-top: 0.1rem;
}

.jc-building-right {
    text-align: right;
    flex-shrink: 0;
}

.jc-building-price {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fbbf24;
}

.jc-building-owned {
    font-size: 1.6rem;
    font-weight: 800;
    color: #475569;
    line-height: 1;
}

/* ── Upgrades list ───────────────────────────────────────── */
.jc-upgrades-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.jc-upgrade-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.6rem;
    background: #1e1e2e;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    cursor: pointer;
    color: #e2e8f0;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}

.jc-upgrade-btn.affordable {
    opacity: 1;
    border-color: #22c55e;
}

.jc-upgrade-btn.affordable:hover {
    background: #1e2e1e;
    border-color: #4ade80;
}

.jc-upgrade-icon { font-size: 1.3rem; }
.jc-upgrade-name { font-weight: 600; }
.jc-upgrade-price { color: #fbbf24; font-weight: 600; margin-left: auto; }

.jc-no-upgrades {
    text-align: center;
    color: #475569;
    padding: 2rem 1rem;
    font-size: 0.85rem;
}

/* ── Achievements grid ───────────────────────────────────── */
.jc-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.4rem;
}

.jc-ach {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #2a2a3e;
    transition: border-color 0.2s;
}

.jc-ach.unlocked {
    background: #1a2e1a;
    border-color: #22c55e;
}

.jc-ach.locked {
    background: #1e1e2e;
    opacity: 0.5;
}

.jc-ach-icon { font-size: 1.5rem; }
.jc-ach-name { font-size: 0.65rem; color: #94a3b8; margin-top: 0.2rem; }

/* ── Stats panel ─────────────────────────────────────────── */
.jc-stats-content {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.jc-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border-bottom: 1px solid #1e1e2e;
    color: #e2e8f0;
}

.jc-stat-row span:last-child {
    font-weight: 600;
    color: #fbbf24;
}

/* ── Toast ───────────────────────────────────────────────── */
.jc-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fbbf24;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    border: 1px solid #334155;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    max-width: 90vw;
    text-align: center;
}

.jc-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: jc-toast-fade 3s ease forwards;
}

@keyframes jc-toast-fade {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Offline popup ───────────────────────────────────────── */
.jc-offline-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.jc-offline-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    max-width: 320px;
    width: 90%;
    color: #e2e8f0;
}

.jc-offline-card h3 { margin-top: 0; font-size: 1.1rem; }

.offline-amount {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fbbf24;
    margin: 0.8rem 0 0.3rem;
}

.jc-btn-primary {
    margin-top: 0.8rem;
    padding: 0.5rem 1.5rem;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.jc-btn-primary:hover { background: #2563eb; }

/* ── Pulse animation ─────────────────────────────────────── */
@keyframes jc-pulse {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE / RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
    .jc-main {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .jc-left {
        order: 1;
    }

    .jc-right {
        order: 2;
        max-height: 50vh;
    }

    .jc-click-area {
        max-width: 220px;
    }

    .jc-big-juice {
        font-size: 4.5rem;
    }

    .jc-juice-count {
        font-size: 1.8rem;
    }

    .jc-title {
        font-size: 1rem;
    }

    .jc-tab-btn {
        font-size: 0.65rem;
        padding: 0.45rem 0.15rem;
    }

    .jc-building-btn {
        padding: 0.45rem 0.5rem;
    }

    .jc-building-icon {
        font-size: 1.4rem;
    }

    .jc-building-desc {
        display: none;
    }

    .jc-building-name {
        font-size: 0.78rem;
    }

    .jc-achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    }

    .jc-prestige-info {
        flex-direction: column;
        gap: 0.2rem;
    }
}

@media (max-width: 380px) {
    .jc-click-area {
        max-width: 180px;
    }

    .jc-big-juice {
        font-size: 3.5rem;
    }

    .jc-juice-count {
        font-size: 1.5rem;
    }

    .jc-building-owned {
        font-size: 1.2rem;
    }
}

/* ── Dedicated page layout adjustments ───────────────────── */
.jc-dedicated-page .jc-wrapper {
    max-width: 1100px;
}

.jc-dedicated-page .jc-main {
    min-height: calc(100vh - 120px);
}

@media (min-width: 721px) {
    .jc-dedicated-page .jc-right {
        max-height: calc(100vh - 140px);
    }
}
