:root {
    --vanilla-cream: #faf7f0;
    --warm-beige: #f5f1e8;
    --soft-tan: #eae5d6;
    --warm-brown: #8b7355;
    --deep-brown: #5d4e37;
    --coral-accent: #ff6b6b;
    --sage-green: #87a96b;
    --warm-gold: #d4af37;
    --sunset-orange: #ff8c42;
    --text-primary: #2c2417;
    --text-secondary: #5d4e37;
    --text-light: #8b7355;
    --bg-primary: #faf7f0;
    --bg-secondary: #f5f1e8;
    --bg-card: #ffffff;
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --transition: 0.4s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary) url('assets/background.png') center / 512px repeat;
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(1.5rem, 4vh, 3rem);
    padding: clamp(1.5rem, 4vw, 3rem);
    padding-bottom: 4.5rem;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    height: 100dvh;
}

.balance-display {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    transition: transform 0.1s ease;
}

.balance-display.bump {
    transform: scale(1.05);
}

.dollar-sign {
    color: var(--sage-green);
    margin-right: 0.05em;
}

.per-second {
    font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    color: var(--text-light);
    font-weight: 600;
    margin-top: -0.5rem;
}

.click-button {
    width: clamp(150px, 42vw, 200px);
    height: clamp(150px, 42vw, 200px);
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, var(--warm-gold), var(--sunset-orange));
    box-shadow:
        0 8px 32px rgba(212, 175, 55, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    padding: 0;
}

.click-button:active {
    transform: scale(0.92);
    box-shadow:
        0 4px 16px rgba(212, 175, 55, 0.2),
        0 1px 4px rgba(0, 0, 0, 0.1),
        inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.reset-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--soft-tan);
    background: var(--bg-card);
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, border-color 0.2s ease;
    z-index: 50;
}

.reset-btn:hover {
    color: var(--coral-accent);
    border-color: var(--coral-accent);
}

.coin-symbol {
    font-size: clamp(3.5rem, 12vw, 5rem);
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    line-height: 1;
}

.stats {
    display: flex;
    gap: clamp(1rem, 4vw, 2rem);
    background: var(--bg-card);
    border: 1px solid var(--soft-tan);
    border-radius: var(--border-radius);
    padding: clamp(1rem, 3vw, 1.5rem) clamp(1.25rem, 4vw, 2rem);
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.08);
    width: 100%;
    justify-content: space-around;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.stat-label {
    font-size: clamp(0.6rem, 1.8vw, 0.75rem);
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.stat-value {
    font-size: clamp(0.9rem, 2.8vw, 1.15rem);
    font-weight: 700;
    color: var(--text-secondary);
}

.sidebar-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 56px;
    border-radius: 8px 0 0 8px;
    border: 1px solid var(--soft-tan);
    border-right: none;
    background: var(--bg-card);
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    box-shadow: -2px 0 8px rgba(139, 115, 85, 0.1);
}

.sidebar-toggle:hover {
    color: var(--warm-gold);
}

.sidebar-toggle.open {
    right: 220px;
}

.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: rgba(250, 247, 240, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid rgba(234, 229, 214, 0.6);
    padding: 1.5rem 0.75rem;
    padding-bottom: 5rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 44;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(234, 229, 214, 0.6);
}

.sidebar .upgrade-btn {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(234, 229, 214, 0.5);
    padding: 0.75rem 1rem;
    box-shadow: none;
}

@media (min-width: 900px) {
    .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: none;
    }
}

.panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 4rem;
    background: transparent;
    z-index: 40;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.ai-pipeline-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
    padding: 1rem 0.75rem 2rem;
    gap: 0.75rem;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.research-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(135, 169, 107, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(135, 169, 107, 0.3);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    width: fit-content;
}

.research-icon {
    font-size: 0.9rem;
}

.research-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--sage-green);
}

.research-rate {
    font-size: 0.65rem;
    color: var(--text-light);
}

.level-selector {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid var(--soft-tan);
    overflow: hidden;
}

.level-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.5rem 0.3rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
    position: relative;
}

.level-btn::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--soft-tan);
}

.level-btn:last-child::after {
    display: none;
}

.level-btn .level-num {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.level-btn .level-icon {
    font-size: 1rem;
}

.level-btn .level-name {
    font-size: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.level-btn .level-cost {
    font-size: 0.45rem;
    font-weight: 700;
    color: var(--sage-green);
}

.level-btn.active {
    background: rgba(212, 175, 55, 0.12);
}

.level-btn.active .level-num {
    color: var(--warm-gold);
}

.level-btn.locked {
    opacity: 0.4;
}

.level-btn.locked:hover {
    background: rgba(135, 169, 107, 0.08);
    opacity: 0.7;
}

.pipeline-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 0.4rem 0.75rem;
}

.pipeline-info .pipe-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pipeline-info .pipe-bonus {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--warm-gold);
    background: rgba(212, 175, 55, 0.12);
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    margin-left: auto;
}

.market-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 1rem;
    gap: 1rem;
    overflow-y: auto;
}

.market-conveyor {
    width: 100%;
    position: relative;
}

.market-conveyor-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.market-conveyor-label .refresh-timer {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--warm-gold);
    margin-left: auto;
}

.market-belt {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.market-belt::-webkit-scrollbar {
    height: 3px;
}

.market-belt::-webkit-scrollbar-thumb {
    background: var(--soft-tan);
    border-radius: 3px;
}

.market-card {
    min-width: 130px;
    max-width: 130px;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border: 1.5px solid var(--soft-tan);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    user-select: none;
    scroll-snap-align: start;
    flex-shrink: 0;
}

.market-card:hover {
    border-color: var(--warm-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
}

.market-card:active {
    transform: scale(0.96);
}

.market-card.cant-afford {
    opacity: 0.35;
    cursor: not-allowed;
}

.market-card.cant-afford:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--soft-tan);
}

.market-card .card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.market-card .card-icon {
    font-size: 1.3rem;
}

.market-card .card-rarity {
    font-size: 0.5rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rarity-common { background: var(--soft-tan); color: var(--text-secondary); }
.rarity-uncommon { background: rgba(135, 169, 107, 0.2); color: var(--sage-green); }
.rarity-rare { background: rgba(100, 149, 237, 0.15); color: #4a7edd; }
.rarity-epic { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.rarity-legendary { background: rgba(212, 175, 55, 0.2); color: var(--warm-gold); }

.market-card .card-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

.market-card .card-quality {
    display: flex;
    gap: 1px;
}

.market-card .card-quality .q-pip {
    width: 8px;
    height: 3px;
    border-radius: 1px;
    background: var(--soft-tan);
}

.market-card .card-quality .q-pip.filled {
    background: var(--warm-gold);
}

.market-card .card-stats {
    font-size: 0.55rem;
    color: var(--text-light);
}

.market-card .card-price {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--sage-green);
    margin-top: 0.1rem;
}

.market-card.special {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(255, 248, 230, 0.9);
}

.market-deck-status {
    font-size: 0.6rem;
    color: var(--text-light);
    text-align: center;
}

.market-deck-status strong {
    color: var(--text-secondary);
}

.ai-market-section {
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    border: 1px solid rgba(234, 229, 214, 0.6);
    padding: 0.6rem;
}

.ai-market-section .market-conveyor-label {
    padding: 0 0.2rem;
}

.ai-market-section .market-belt {
    padding: 0.3rem 0;
}

.ai-market-section .market-card {
    min-width: 110px;
    max-width: 110px;
    padding: 0.5rem;
}

.ai-market-section .market-card .card-icon {
    font-size: 1.1rem;
}

.market-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.deck-card.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

.pipeline-slot.special-converter { border-color: var(--sunset-orange); }
.pipeline-slot.special-booster { border-color: var(--coral-accent); }
.pipeline-slot.special-combiner { border-color: #9b59b6; }
.deck-card.special-converter { border-color: var(--sunset-orange); }
.deck-card.special-booster { border-color: var(--coral-accent); }
.deck-card.special-combiner { border-color: #9b59b6; }

.ai-pipeline {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    gap: 1rem;
}

.pipeline-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pipeline-output {
    font-size: 0.9rem;
    color: var(--sage-green);
    font-weight: 700;
}

.conveyor {
    width: 100%;
    overflow-x: auto;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
    border-radius: 14px;
    border: 1px solid rgba(234, 229, 214, 0.6);
}

.conveyor-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.pipeline-slot {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 2px dashed var(--soft-tan);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
    position: relative;
}

.pipeline-slot.empty {
    background: rgba(255, 255, 255, 0.4);
}

.pipeline-slot.empty .slot-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    opacity: 0.5;
}

.pipeline-slot.dragover,
.pipeline-slot.drag-over {
    border-color: var(--warm-gold);
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.pipeline-slot.filled {
    border: 2px solid var(--warm-gold);
    background: white;
    cursor: pointer;
}

.pipeline-slot.filled .slot-model {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.pipeline-slot.filled .slot-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.output-slot {
    border: 2px solid var(--sage-green);
    background: rgba(135, 169, 107, 0.1);
}

.output-slot .slot-label {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--sage-green);
}

.conveyor-arrow {
    font-size: 1rem;
    color: var(--text-light);
    opacity: 0.5;
    flex-shrink: 0;
}

.combo-display {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--warm-gold);
    text-align: center;
    min-height: 1rem;
}

.deck-section {
    width: 100%;
    max-width: 380px;
}

.deck-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.deck-count {
    color: var(--text-secondary);
}

.deck-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.deck-card {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1px solid var(--soft-tan);
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.1s ease;
    padding: 0.3rem;
}

.deck-card:hover {
    border-color: var(--warm-gold);
    transform: scale(1.05);
}

.deck-card .card-icon {
    font-size: 1.3rem;
}

.deck-card .card-name {
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.1;
}

.deck-card .card-rarity-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 2px;
}

.card-rarity-dot.rarity-common { background: var(--text-light); }
.card-rarity-dot.rarity-uncommon { background: var(--sage-green); }
.card-rarity-dot.rarity-rare { background: #4a7edd; }
.card-rarity-dot.rarity-epic { background: #9b59b6; }
.card-rarity-dot.rarity-legendary { background: var(--warm-gold); }

.deck-empty {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1px dashed var(--soft-tan);
    background: rgba(255, 255, 255, 0.3);
}

.pipeline-hint {
    font-size: 0.65rem;
    color: var(--text-light);
    text-align: center;
}

@media (max-width: 480px) {
    .ai-market {
        width: 140px;
        min-width: 140px;
    }

    .pipeline-slot {
        width: 48px;
        height: 48px;
    }
}

.upgrade-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--soft-tan);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.08);
}

.upgrade-btn:hover {
    border-color: var(--warm-gold);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
}

.upgrade-btn:active {
    transform: scale(0.98);
}

.upgrade-btn.cant-afford {
    opacity: 0.5;
}

.upgrade-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.upgrade-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.upgrade-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.upgrade-cost {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sage-green);
    white-space: nowrap;
}

.float-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

.float-text {
    position: absolute;
    font-size: clamp(1.2rem, 3.5vw, 1.6rem);
    font-weight: 700;
    color: var(--sage-green);
    animation: float-up 1s ease-out forwards;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(234, 229, 214, 0.6);
    padding: 0.5rem 0;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    z-index: 50;
    box-shadow: 0 -2px 8px rgba(139, 115, 85, 0.06);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.65rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-item:hover {
    color: var(--text-secondary);
    background: var(--warm-beige);
}

.nav-item.active {
    color: var(--warm-gold);
}

.nav-item span {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nav-item.locked {
    opacity: 0.4;
    position: relative;
}

.nav-item.locked:hover {
    background: none;
    color: var(--text-light);
}

.nav-item.locked .lock-cost {
    position: absolute;
    top: -0.4rem;
    right: -0.2rem;
    font-size: 0.55rem;
    background: var(--warm-gold);
    color: white;
    padding: 0.1rem 0.3rem;
    border-radius: 6px;
    font-weight: 700;
}

.nav-item.locked .lock-icon {
    position: absolute;
    top: -0.3rem;
    right: -0.1rem;
    font-size: 0.6rem;
}

@media (min-width: 768px) {
    .bottom-nav {
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        border: 1px solid var(--soft-tan);
        border-bottom: none;
    }
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.6);
    }
}


/* Prestige system */
.prestige-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 1.5rem 1rem;
    gap: 1rem;
    overflow-y: auto;
}

.prestige-header {
    text-align: center;
    width: 100%;
}

.prestige-points-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.prestige-points-display .pp-icon {
    font-size: 1.5rem;
}

.prestige-points-display .pp-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--warm-gold);
}

.prestige-points-display .pp-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prestige-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.prestige-stat {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.6);
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--soft-tan);
}

.prestige-reset-btn {
    width: 100%;
    max-width: 320px;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--soft-tan);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.prestige-reset-btn.ready {
    border-color: var(--warm-gold);
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.08), rgba(255, 140, 66, 0.08));
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2);
}

.prestige-reset-btn.ready:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
}

.prestige-reset-btn.ready:active {
    transform: scale(0.97);
}

.prestige-reset-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.prestige-btn-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.prestige-btn-desc {
    font-size: 0.7rem;
    color: var(--text-light);
}

.prestige-btn-progress {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--warm-gold);
    margin-top: 0.2rem;
}

.prestige-shop-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    width: 100%;
    max-width: 320px;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--soft-tan);
}

.prestige-shop-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 320px;
}

.prestige-upgrade-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.1rem 0.5rem;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--soft-tan);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.1s ease;
}

.prestige-upgrade-card:hover {
    border-color: var(--warm-gold);
    transform: translateY(-1px);
}

.prestige-upgrade-card:active {
    transform: scale(0.98);
}

.prestige-upgrade-card.cant-afford {
    opacity: 0.45;
    cursor: not-allowed;
}

.prestige-upgrade-card.cant-afford:hover {
    border-color: var(--soft-tan);
    transform: none;
}

.prestige-upgrade-card.maxed {
    border-color: var(--sage-green);
    background: rgba(135, 169, 107, 0.08);
}

.prestige-upgrade-card .pu-icon {
    font-size: 1.3rem;
    grid-row: span 2;
}

.prestige-upgrade-card .pu-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.prestige-upgrade-card .pu-desc {
    font-size: 0.6rem;
    color: var(--text-light);
    grid-column: 2;
}

.prestige-upgrade-card .pu-level {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-secondary);
    grid-row: 1;
    grid-column: 3;
    text-align: right;
}

.prestige-upgrade-card .pu-cost {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--warm-gold);
    grid-row: 2;
    grid-column: 3;
    text-align: right;
}

.prestige-upgrade-card.maxed .pu-cost {
    color: var(--sage-green);
}

/* Prestige nav ready state (pulsing glow when available) */
.nav-item.prestige-ready {
    opacity: 1 !important;
    animation: prestige-pulse 2s ease-in-out infinite;
}

@keyframes prestige-pulse {
    0%, 100% { color: var(--text-light); }
    50% { color: var(--warm-gold); }
}
/* Achievement badge counter */
.achievement-counter {
    position: fixed;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-card);
    border: 1px solid var(--soft-tan);
    border-radius: 20px;
    padding: 0.4rem 0.7rem;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.08);
}

.achievement-icon {
    font-size: 1rem;
    line-height: 1;
}

.achievement-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--warm-gold);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 4px;
}

/* Achievement toast */
.achievement-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid var(--warm-gold);
    border-radius: 14px;
    padding: 0.6rem 1rem;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    opacity: 0;
    white-space: nowrap;
}

.achievement-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.achievement-toast-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.achievement-toast-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.achievement-toast-title {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--warm-gold);
}

.achievement-toast-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Offline earnings welcome-back modal */
.offline-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 36, 23, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.offline-modal-overlay.show {
    opacity: 1;
}

.offline-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid var(--soft-tan);
    border-radius: var(--border-radius-lg);
    padding: 2rem 1.5rem;
    width: 90%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 16px 48px rgba(93, 78, 55, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.offline-modal-overlay.show .offline-modal {
    transform: scale(1) translateY(0);
}

.offline-modal-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.offline-modal-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--text-primary);
}

.offline-modal-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

.offline-modal-earnings {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: rgba(250, 247, 240, 0.8);
    border: 1px solid var(--soft-tan);
    border-radius: var(--border-radius);
}

.offline-earning-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.offline-earning-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.offline-earning-value {
    font-size: 1rem;
    font-weight: 700;
}

.offline-earning-value.money {
    color: var(--sage-green);
}

.offline-earning-value.rp {
    color: var(--warm-gold);
}

.offline-modal-note {
    font-size: 0.6rem;
    color: var(--text-light);
    text-align: center;
}

.offline-modal-btn {
    margin-top: 0.5rem;
    padding: 0.7rem 2.5rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--warm-gold), var(--sunset-orange));
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.offline-modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.offline-modal-btn:active {
    transform: scale(0.96);
}

/* Model Fusion */
.deck-card.fusible {
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.15);
    position: relative;
}

.fuse-btn {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.15rem 0.4rem;
    border: none;
    border-radius: 6px;
    background: linear-gradient(145deg, var(--warm-gold), var(--sunset-orange));
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    z-index: 2;
}

.fuse-btn:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.4);
}

.fuse-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* Pipeline Automation Upgrades */
.automation-section {
    width: 100%;
    max-width: 380px;
    margin-top: 0.5rem;
}

.automation-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--soft-tan);
}

.automation-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.automation-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 0.1rem 0.5rem;
    align-items: center;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--soft-tan);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.1s ease;
}

.automation-card:hover {
    border-color: var(--sage-green);
    transform: translateY(-1px);
}

.automation-card:active {
    transform: scale(0.98);
}

.automation-card.cant-afford {
    opacity: 0.45;
    cursor: not-allowed;
}

.automation-card.cant-afford:hover {
    border-color: var(--soft-tan);
    transform: none;
}

.automation-card.maxed {
    border-color: var(--sage-green);
    background: rgba(135, 169, 107, 0.08);
}

.automation-card .auto-icon {
    font-size: 1.3rem;
    grid-row: span 3;
}

.automation-card .auto-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.automation-card .auto-desc {
    font-size: 0.55rem;
    color: var(--text-light);
    grid-column: 2;
}

.automation-card .auto-level {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-secondary);
    grid-row: 1;
    grid-column: 3;
    text-align: right;
}

.automation-card .auto-interval {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--sage-green);
    grid-row: 2;
    grid-column: 3;
    text-align: right;
}

.automation-card .auto-cost {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--warm-gold);
    grid-row: 3;
    grid-column: 2 / 4;
    text-align: right;
}

.automation-card.maxed .auto-cost {
    color: var(--sage-green);
}
