/* genesis-cell/css/style.css - Mobile-First & Desktop Microscopic Cyber-Bio Aesthetic */

:root {
    --bg-dark: #070d18;
    --bg-panel: rgba(13, 23, 39, 0.90);
    --bg-card: rgba(18, 33, 56, 0.75);
    --border-color: rgba(56, 189, 248, 0.2);
    --border-highlight: rgba(0, 240, 255, 0.6);
    
    --neon-cyan: #00f0ff;
    --neon-green: #00ff88;
    --neon-purple: #c084fc;
    --neon-amber: #f59e0b;
    --neon-rose: #f43f5e;
    --neon-gold: #ffd700;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html, body {
    height: 100%;
    height: 100dvh;
    width: 100vw;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header & Resource HUD */
header {
    background: rgba(10, 18, 32, 0.96);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 6px 14px;
    z-index: 10;
    flex-shrink: 0;
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 4px;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    font-size: 1.4rem;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00f0ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-small {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-small:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--neon-cyan);
}

.btn-small.danger:hover {
    background: rgba(244, 63, 94, 0.25);
    border-color: var(--neon-rose);
}

/* Resource Bar: Mobile friendly Pills */
.resources-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0;
    scrollbar-width: none;
}
.resources-bar::-webkit-scrollbar { display: none; }

.res-item {
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.res-item .res-val {
    font-weight: 700;
}

.res-item .res-rate {
    font-size: 0.68rem;
    font-family: monospace;
    opacity: 0.9;
}

.res-item.atp { border-color: rgba(0, 240, 255, 0.25); }
.res-item.atp .res-val { color: var(--neon-cyan); }
.res-item.atp .res-rate { color: #67e8f9; }

.res-item.protein { border-color: rgba(0, 255, 136, 0.25); }
.res-item.protein .res-val { color: var(--neon-green); }
.res-item.protein .res-rate { color: #86efac; }

.res-item.dna { border-color: rgba(192, 132, 252, 0.25); }
.res-item.dna .res-val { color: var(--neon-purple); }

.res-item.nanite { border-color: rgba(245, 158, 11, 0.25); }
.res-item.nanite .res-val { color: var(--neon-amber); }

.res-item.epoch-badge {
    border-color: rgba(56, 189, 248, 0.3);
    color: var(--neon-cyan);
    font-weight: 600;
}

/* FEVER Charge HUD inside Header */
.fever-hud {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
}

.fever-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.fever-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff007f, #ffd700);
    transition: width 0.3s ease;
}

.fever-bar-fill.fever-active {
    background: linear-gradient(90deg, #ff007f, #ffd700, #00f0ff, #ff007f);
    background-size: 200% 100%;
    animation: fever-glow 1s linear infinite;
}

.fever-text {
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Main Layout */
.main-wrapper {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* Left: Petri Area (Canvas) */
.petri-area {
    flex: 1.1;
    position: relative;
    background: radial-gradient(circle at center, #0b1a32 0%, #040810 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#petri-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    display: block;
}

/* Petri Floating Controls */
.petri-floating-actions {
    position: absolute;
    bottom: calc(14px + env(safe-area-inset-bottom, 10px));
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
    z-index: 6;
}

.petri-action-btn {
    pointer-events: auto;
    background: rgba(10, 22, 40, 0.88);
    border: 1px solid var(--neon-cyan);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.petri-action-btn.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.35), rgba(0, 255, 136, 0.35));
    border-color: var(--neon-green);
    color: #fff;
    box-shadow: 0 0 14px rgba(0, 255, 136, 0.4);
}

.petri-action-btn.disabled {
    opacity: 0.6;
    border-color: rgba(255, 255, 255, 0.15);
    cursor: not-allowed;
}

.event-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.3), rgba(0, 240, 255, 0.3));
    border: 1px solid var(--neon-purple);
    padding: 6px 16px;
    border-radius: 8px;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.35);
    text-align: center;
    z-index: 5;
    max-width: 90%;
    animation: pulse-glow 2s infinite ease-in-out;
}

.event-banner .banner-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffd700;
}

.event-banner .banner-desc {
    font-size: 0.72rem;
    color: var(--text-primary);
}

/* Right: Control Center */
.control-center {
    flex: 0.9;
    min-width: 0;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tabs-nav {
    display: flex;
    background: rgba(7, 13, 24, 0.92);
    border-bottom: 1px solid var(--border-color);
    padding: 4px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.tabs-nav::-webkit-scrollbar { display: none; }

.tab-btn {
    flex: 1;
    min-height: 38px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(0, 240, 255, 0.15);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 240, 255, 0.4);
}

.tabs-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 25px));
    -webkit-overflow-scrolling: touch;
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.tab-content.active {
    display: flex;
}

/* SPECIMEN DEX STYLES */
.dex-header-card {
    background: linear-gradient(135deg, rgba(14, 28, 50, 0.95), rgba(6, 12, 22, 0.95));
    border: 1px solid var(--neon-cyan);
    border-radius: 12px;
    padding: 14px;
}
.dex-header-card h3 {
    color: #ffd700;
    font-size: 1rem;
}
.dex-badge {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid #ffd700;
    color: #ffd700;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}
.dex-header-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.dex-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.dex-card {
    background: var(--bg-card);
    border: 1px solid;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    transition: all 0.2s ease;
}

.dex-card.locked {
    opacity: 0.55;
    background: rgba(0, 0, 0, 0.3);
}

.dex-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.dex-info {
    flex: 1;
    min-width: 0;
}
.dex-name {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dex-rarity {
    font-size: 0.68rem;
    margin-top: 1px;
}
.dex-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.25;
}
.dex-bonus {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 2px;
}

/* LOTTERY GACHA MACHINE STYLES */
.lottery-machine-card {
    background: linear-gradient(135deg, rgba(30, 15, 45, 0.9), rgba(12, 6, 20, 0.95));
    border: 2px solid #ffd700;
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.2);
}
.lottery-machine-card h3 {
    color: #ffd700;
    font-size: 1.15rem;
    margin-bottom: 6px;
}
.lottery-machine-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.slot-display-box {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

.slot-reel {
    width: 72px;
    height: 72px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffd700;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.3);
    transition: transform 0.2s ease;
}

.slot-reel.rolling {
    animation: reel-spin 0.1s linear infinite;
}

.lottery-result-text {
    min-height: 24px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 12px;
}

/* Cards Design */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
    word-break: break-word;
}

.card:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 4px 14px rgba(0, 240, 255, 0.08);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header .icon {
    font-size: 1.3rem;
    background: rgba(255, 255, 255, 0.05);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.card-titles {
    flex: 1;
    min-width: 0;
}

.card-titles .name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-titles .count {
    font-size: 0.76rem;
    color: var(--neon-cyan);
}

.card-titles .status-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.card .desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.card .output-preview {
    font-size: 0.74rem;
    color: var(--neon-green);
    background: rgba(0, 255, 136, 0.06);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Buy Buttons */
.buy-btn {
    margin-top: 4px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    width: 100%;
}

.buy-btn.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.35), rgba(0, 255, 136, 0.35));
    border-color: var(--neon-cyan);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.buy-btn.active:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.55), rgba(0, 255, 136, 0.55));
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}

.buy-btn.disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: not-allowed;
}

.card.purchased {
    border-color: rgba(0, 255, 136, 0.4);
    background: rgba(6, 78, 59, 0.2);
}

.card.purchased .status-badge {
    color: var(--neon-green);
    font-weight: 700;
}

/* Epoch Tab */
.epoch-hero-card {
    background: linear-gradient(135deg, rgba(14, 28, 50, 0.9), rgba(6, 12, 22, 0.9));
    border: 2px solid;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    position: relative;
}

.epoch-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.epoch-hero-card h2 {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.epoch-hero-card .subname {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.epoch-next-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.requirement-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.req-item .label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 3px;
    color: var(--text-secondary);
}

.progress-bar {
    height: 7px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--neon-cyan);
    transition: width 0.3s ease;
}

.evolve-btn {
    padding: 12px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.evolve-btn.ready {
    background: linear-gradient(135deg, #00f0ff, #c084fc);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.evolve-btn.disabled {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.stat-card .stat-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--neon-cyan);
    margin-bottom: 2px;
}

.stat-card .stat-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Achievements */
.ach-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.ach-card .ach-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.ach-card .ach-details {
    flex: 1;
    min-width: 0;
}

.ach-card .reward {
    font-size: 0.72rem;
    color: var(--neon-gold);
    margin-top: 2px;
}

.ach-card.unlocked {
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(251, 191, 36, 0.08);
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 10px));
    right: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(10, 20, 36, 0.95);
    border: 1px solid #00ff88;
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    max-width: 480px;
    width: auto;
    text-align: center;
    animation: toast-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.toast.out {
    animation: toast-out 0.3s ease forwards;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-box {
    background: #0d1a2d;
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.25);
    border-radius: 14px;
    padding: 20px;
    max-width: 440px;
    width: 100%;
    text-align: center;
}

.modal-box h3 {
    font-size: 1.15rem;
    color: var(--neon-cyan);
    margin-bottom: 8px;
}

.offline-rewards {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(192, 132, 252, 0.3); }
    50% { box-shadow: 0 0 30px rgba(0, 240, 255, 0.6); }
}

@keyframes fever-glow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes reel-spin {
    0% { transform: translateY(-8px); opacity: 0.5; }
    50% { transform: translateY(8px); opacity: 0.8; }
    100% { transform: translateY(-8px); opacity: 0.5; }
}

/* Responsive Layout */
@media (max-width: 860px) {
    .main-wrapper {
        flex-direction: column;
    }
    
    .petri-area {
        height: 40%;
        height: 40dvh;
        flex: none;
    }

    .control-center {
        flex: 1;
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        height: 60%;
        height: 60dvh;
    }

    .main-wrapper.expanded-dish .petri-area {
        height: 72%;
        height: 72dvh;
    }
    .main-wrapper.expanded-dish .control-center {
        height: 28%;
        height: 28dvh;
    }

    .petri-floating-actions {
        bottom: calc(8px + env(safe-area-inset-bottom, 8px));
        left: 8px;
        right: 8px;
    }

    .petri-action-btn {
        padding: 6px 10px;
        font-size: 0.76rem;
    }

    .dex-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
