/* ============================================================
   EVOLUTION IDLE — style.css
   Dark sci-fi theme με neon glow effects
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;500;600&display=swap');

/* --- Base Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Eliminate 300ms tap delay on all interactive elements */
button, [role="button"], a, input, select, textarea, label,
#cell, .upgrade-card, .skill-node, .ach-card, .mg-btn,
.mg-chain-card, .dna-card, .tab-btn, .modal-primary-btn,
.modal-secondary-btn, .setting-btn, .mg-tap-btn, .daily-day,
.mg-close-btn, .cry-boost-btn, .cry-inline-btn, .cry-skip-btn, .auth-danger-btn,
.race-fs-tap-btn, .race-fs-close-btn, .dev-btn, .dev-open-btn {
    touch-action: manipulation;
}

:root {
    --primary:    #00ff88;
    --secondary:  #00d4ff;
    --accent:     #ff006e;
    --gold:       #ffd700;
    --dna-color:  #44aaff;
    --bg-base:    #0a0e1a;
    --bg-panel:   rgba(10, 20, 40, 0.85);
    --bg-card:    rgba(0, 255, 136, 0.04);
    --border:     rgba(0, 255, 136, 0.25);
    --text-dim:   rgba(0, 255, 136, 0.5);
    --font-head:  'Orbitron', monospace;
    --font-body:  'Rajdhani', sans-serif;
    --transition: 0.25s ease;
    --glow:       0 0 12px rgba(0, 255, 136, 0.4);
    --glow-strong: 0 0 24px rgba(0, 255, 136, 0.6), 0 0 48px rgba(0, 255, 136, 0.2);
}

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

/* --- Twemoji --- */
img.emoji {
    height: 1em; width: 1em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.1em;
    display: inline-block;
}

body {
    background: var(--bg-base);
    color: var(--primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.4;
    transition: background 1.2s ease;
}

/* --- Game Wrapper --- */
#game-wrapper {
    max-width: 500px;
    margin: 0 auto;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* --- Header --- */
#game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 26, 0.95);
    position: sticky;
    top: 0;
    z-index: 50;
}

#game-title {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--primary);
    text-shadow: var(--glow);
}

#stage-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

#stage-emoji {
    font-size: 2rem;
    animation: pulse-float 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 8px var(--primary));
}

#stage-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#stage-name {
    font-family: var(--font-head);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--glow);
}

#stage-num {
    font-size: 0.65rem;
    color: var(--text-dim);
}

/* --- Resources Bar --- */
#resources-bar {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
}

.res-chip {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 8px;
    min-width: 0;
}

#chip-energy  { border-color: rgba(0, 255, 136, 0.4); }
#chip-dna     { border-color: rgba(68, 170, 255, 0.4); }
#chip-mutation{ border-color: rgba(255, 0, 110, 0.4); }
#chip-crystal { border-color: rgba(255, 215, 0, 0.4); }

#chip-dna     .res-main { color: var(--dna-color); }
#chip-mutation .res-main{ color: var(--accent); }
#chip-crystal .res-main { color: var(--gold); }

body.alien-active #chip-energy { border-color: #aa00ff; box-shadow: 0 0 12px rgba(170, 0, 255, 0.6); animation: alien-chip-pulse 2s ease-in-out infinite; }
body.alien-active #chip-energy .res-main { color: #00ffee; }

.res-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}

.res-vals {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.res-main {
    font-family: var(--font-head);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.res-rate {
    font-size: 0.58rem;
    color: var(--text-dim);
}

/* --- Tab Navigation --- */
#tab-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 10px 4px 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: color var(--transition), background var(--transition);
    border-bottom: 2px solid transparent;
    position: relative;
}

.tab-btn span {
    font-size: 0.55rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tab-btn[data-tab="game"] {
    font-size: 1.1rem;
    background: rgba(0, 255, 136, 0.09);
    border-radius: 12px;
    margin: 0 2px;
    border-bottom: 2px solid rgba(0, 255, 136, 0.35);
    color: var(--primary);
}
.tab-btn[data-tab="game"] span {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--primary);
}
.tab-btn[data-tab="game"]:hover {
    background: rgba(0, 255, 136, 0.16);
    color: var(--primary);
}
.tab-btn[data-tab="game"].active {
    background: rgba(0, 255, 136, 0.15);
    border-bottom-color: var(--primary);
    color: var(--primary);
    text-shadow: var(--glow);
    box-shadow: 0 0 12px rgba(0,255,136,0.2);
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    text-shadow: var(--glow);
}

/* --- Tab Panes --- */
#tabs-area {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tab-pane {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px;
    animation: fadeIn 0.2s ease;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.tab-pane.hidden {
    display: none;
}

.tab-header-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--primary);
    text-shadow: var(--glow);
    text-align: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* --- Game Tab --- */
#cell-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 16px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#cell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

#cell-aura {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,255,136,0.15) 0%, transparent 70%);
    animation: aura-pulse 2.5s ease-in-out infinite;
    pointer-events: none;
}

#cell {
    font-size: 7rem;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    animation: pulse-float 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 16px rgba(0, 255, 136, 0.5));
    transition: transform 0.1s ease, filter var(--transition);
    position: relative;
    z-index: 2;
    display: block;
    line-height: 1;
    touch-action: manipulation;
}

#cell:hover {
    filter: drop-shadow(0 0 28px rgba(0, 255, 136, 0.8));
    transform: scale(1.05);
}

#cell.cell-bounce {
    animation: cell-click 0.15s ease-out forwards;
}

#click-label {
    font-family: var(--font-head);
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

#click-val {
    color: var(--primary);
    text-shadow: var(--glow);
}

/* Click popup */
.click-popup {
    position: absolute;
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--glow);
    pointer-events: none;
    z-index: 100;
    animation: popup-float 0.9s ease-out forwards;
    white-space: nowrap;
}

/* --- Progress Section --- */
#progress-section {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 0 8px;
}

.prog-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

#prog-pct {
    font-family: var(--font-head);
    font-size: 0.7rem;
    color: var(--primary);
}

#prog-track {
    width: 100%;
    height: 14px;
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
    margin-bottom: 6px;
}

#prog-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00aa55, #00ff88, #00ffcc);
    border-radius: 7px;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
    position: relative;
}

#evolve-btn {
    width: 100%;
    margin-top: 8px;
    padding: 11px;
    background: rgba(0,255,136,0.12);
    border: 2px solid var(--primary);
    border-radius: 12px;
    color: var(--primary);
    font-family: var(--font-head);
    font-size: 0.88rem;
    letter-spacing: 1.5px;
    cursor: pointer;
    animation: evolve-pulse 1.4s ease-in-out infinite;
    transition: background 0.2s;
}
#evolve-btn:hover { background: rgba(0,255,136,0.25); }
@keyframes evolve-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(0,255,136,0.3); }
    50%       { box-shadow: 0 0 22px rgba(0,255,136,0.75), 0 0 6px rgba(0,255,136,0.4) inset; }
}

#prog-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    border-radius: 0 7px 7px 0;
}

#eps-display {
    font-family: var(--font-head);
    font-size: 0.7rem;
    color: var(--primary);
    text-shadow: var(--glow);
}

/* --- Upgrades Tab --- */
#upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upgrade-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all var(--transition);
    opacity: 0.65;
}

.upgrade-card.affordable {
    opacity: 1;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.upgrade-card.affordable:hover {
    background: rgba(0, 255, 136, 0.08);
    box-shadow: var(--glow-strong);
    transform: translateY(-1px);
}

.upgrade-card.locked {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.1);
}

.upgrade-card.maxed {
    opacity: 0.8;
    cursor: default;
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.upg-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.upg-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.upg-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.upg-name {
    font-family: var(--font-head);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
}

.upg-level {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.upgrade-card.maxed .upg-level {
    color: var(--gold);
}

.upg-cost-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.upg-cost-wrap::before {
    content: none;
}

.upg-cost {
    font-family: var(--font-head);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
}


.cost-ok          { color: var(--primary); text-shadow: var(--glow); }
.cost-no          { color: rgba(255,255,255,0.3); }
.cost-maxed       { color: var(--gold); }
.cost-dna         { color: var(--dna-color); }
.cost-dna-ok      { color: #00e5ff; text-shadow: 0 0 6px #00e5ff88; }
.cost-dna-missing { color: #ff4444; }

.upg-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.upgrade-card.locked .upg-desc {
    color: rgba(255,100,100,0.5);
    font-size: 0.68rem;
}

.upg-level-badge {
    font-size: 0.62rem;
    color: var(--text-dim);
    font-family: var(--font-main);
}

.upgrade-card.maxed .upg-level-badge {
    color: var(--gold);
}

.upg-prog {
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.upg-prog-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.upgrade-card.maxed .upg-prog-fill {
    background: var(--gold);
}

/* --- Upgrade Sections --- */
.upg-section {
    margin-bottom: 18px;
}
.upg-section-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-family: var(--font-head);
    font-size: 0.78rem;
    color: var(--primary);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 2px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.upg-section-sub {
    font-family: var(--font-main);
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}
.upg-section-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Info Boxes (Skills/Achievements placeholders) --- */
.info-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 14px;
}

.info-box.locked-box {
    opacity: 0.4;
}

.info-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.info-box h3 {
    font-family: var(--font-head);
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 10px;
    text-shadow: var(--glow);
}

.info-box p {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 16px;
}

.locked-label {
    color: rgba(255,100,100,0.6) !important;
    font-size: 0.8rem;
}

.small-text {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 10px;
}

/* Prestige Button */
.prestige-btn {
    background: linear-gradient(135deg, rgba(255,0,110,0.15), rgba(0,255,136,0.1));
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all var(--transition);
    width: 100%;
    margin-top: 12px;
    text-shadow: 0 0 8px var(--accent);
}

.prestige-btn:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(255,0,110,0.3), rgba(0,255,136,0.2));
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.5);
    transform: translateY(-1px);
}

.prestige-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: var(--text-dim);
    border-color: var(--border);
    text-shadow: none;
}

/* --- Stats Tab --- */
.stats-top-card {
    margin-bottom: 8px;
}

.stats-rank-energy-block {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 12px;
    padding: 14px 12px;
    margin-bottom: 8px;
}

.stats-rank-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stats-energy-connector {
    font-size: 0.58rem;
    color: var(--text-dim);
    text-align: center;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.stats-energy-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-mini-card {
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-mini-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-mini-val {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    text-shadow: var(--glow);
}

.stats-details-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-details-block .stat-card {
    background: rgba(0, 255, 136, 0.04);
    border-color: rgba(0, 255, 136, 0.12);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-formula-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.stat-formula-base {
    font-family: var(--font-head);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--glow);
}

.stat-formula-op {
    font-size: 0.65rem;
    color: var(--text-dim);
    flex-shrink: 0;
}

.stat-formula-mult {
    font-family: var(--font-head);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
}

.stat-formula-total {
    font-family: var(--font-head);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--glow);
}

#bonus-tooltip {
    position: fixed;
    z-index: 300;
    background: #0d1a2e;
    border: 1px solid rgba(0, 255, 136, 0.4);
    border-radius: 10px;
    padding: 12px 14px;
    width: 220px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.8), 0 0 12px rgba(0,255,136,0.15);
}

.bonus-tt-title {
    font-family: var(--font-head);
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.bonus-tt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.75rem;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.bonus-tt-row:last-child { border-bottom: none; }

.bonus-tt-val {
    font-family: var(--font-head);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-bonus-pill {
    font-family: var(--font-head);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    background: rgba(255, 200, 0, 0.1);
    border: 1px solid rgba(255, 200, 0, 0.3);
    border-radius: 6px;
    padding: 2px 7px;
    text-shadow: 0 0 8px rgba(255, 200, 0, 0.4);
    white-space: nowrap;
}

.stat-card-wide {
    grid-column: span 2;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.tab-intro-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.tab-intro-modal {
    background: rgba(10,20,40,0.98);
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 22px 20px;
    text-align: center;
    max-width: 300px;
    width: 100%;
    box-shadow: var(--glow-strong);
    animation: modalPop 0.3s ease;
}
.tab-intro-desc {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.65;
    text-align: center;
    margin-top: 10px;
}

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

.stat-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-val {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--glow);
}

/* --- Settings Tab --- */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.settings-section h3 {
    font-family: var(--font-head);
    font-size: 0.8rem;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.setting-btn {
    display: block;
    width: 100%;
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    transition: all var(--transition);
    margin-bottom: 8px;
}

.setting-btn:hover {
    background: rgba(0, 255, 136, 0.15);
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.danger-btn {
    background: rgba(255, 0, 110, 0.08) !important;
    border-color: rgba(255, 0, 110, 0.4) !important;
    color: var(--accent) !important;
}

.danger-btn:hover {
    background: rgba(255, 0, 110, 0.2) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 12px rgba(255, 0, 110, 0.4) !important;
}

.setting-note {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
}

#import-area {
    width: 100%;
    min-height: 80px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.7rem;
    resize: vertical;
    margin-bottom: 8px;
    outline: none;
}

#import-area:focus {
    border-color: var(--primary);
    box-shadow: var(--glow);
}

/* --- Notifications --- */
#notif-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 280px;
}

.notif {
    background: rgba(10, 20, 40, 0.95);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(8px);
    max-width: 100%;
    word-break: break-word;
}

.notif.notif-show {
    opacity: 1;
    transform: translateX(0);
}

.notif-success   { border-color: var(--primary); color: var(--primary); box-shadow: var(--glow); }
.notif-error     { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px rgba(255,0,110,0.4); }
.notif-evolution { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 16px rgba(255,215,0,0.5); font-size: 0.85rem; }
.notif-upgrade   { border-color: var(--secondary); color: var(--secondary); box-shadow: 0 0 12px rgba(0,212,255,0.4); }
.notif-info      { border-color: var(--text-dim); color: var(--text-dim); }

/* --- Offline Modal --- */
#offline-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(6px);
}

#offline-overlay.hidden {
    display: none;
}

#offline-modal {
    background: rgba(10, 20, 40, 0.98);
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 36px 28px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: var(--glow-strong);
    animation: modalPop 0.3s ease;
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 14px;
}

#offline-modal h3 {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--primary);
    text-shadow: var(--glow);
    margin-bottom: 14px;
}

#offline-msg {
    font-size: 0.9rem;
    color: rgba(0,255,136,0.8);
    margin-bottom: 20px;
    line-height: 1.5;
}

#offline-msg strong {
    color: var(--primary);
    text-shadow: var(--glow);
}

#offline-ok {
    background: linear-gradient(135deg, rgba(0,255,136,0.2), rgba(0,212,255,0.1));
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 12px 32px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 700;
    transition: all var(--transition);
    text-shadow: var(--glow);
    box-shadow: var(--glow);
}

#offline-ok:hover {
    background: linear-gradient(135deg, rgba(0,255,136,0.35), rgba(0,212,255,0.2));
    box-shadow: var(--glow-strong);
    transform: translateY(-2px);
}

/* --- Keyframe Animations --- */
@keyframes pulse-float {
    0%, 100% { transform: scale(1) translateY(0); }
    50%       { transform: scale(1.06) translateY(-4px); }
}

@keyframes aura-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%       { opacity: 0.8; transform: scale(1.15); }
}

@keyframes cell-click {
    0%   { transform: scale(1); }
    30%  { transform: scale(0.88); }
    70%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes popup-float {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    20%  { opacity: 1; transform: translateY(-10px) scale(1.1); }
    100% { opacity: 0; transform: translateY(-70px) scale(0.8); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

/* Scrollbar styling */
.tab-pane::-webkit-scrollbar { width: 4px; }
.tab-pane::-webkit-scrollbar-track { background: transparent; }
.tab-pane::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}
.tab-pane::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* --- Responsive --- */
@media (max-width: 599px) {
    /* Inactive tabs: emoji only */
    .tab-btn      { font-size: 1.5rem; padding: 6px 2px; min-height: 50px; }
    .tab-btn span:not(.tab-badge) { display: none; }
    /* Active tab: emoji + label, takes more space */
    .tab-btn.active       { flex: 2; font-size: 1.35rem; padding: 4px 4px; }
    .tab-btn.active span:not(.tab-badge)  {
        display: block;
        font-size: 0.6rem;
        letter-spacing: 0.4px;
        margin-top: 2px;
        text-transform: uppercase;
    }
}

@media (max-width: 380px) {
    #game-title { font-size: 0.9rem; letter-spacing: 1px; }
    #cell       { font-size: 5.5rem; }
    .stats-grid { grid-template-columns: 1fr; }
}

@media (min-width: 600px) {
    html, body {
        overflow: auto;
    }

    #game-wrapper {
        height: auto;
        margin: 20px auto;
        border: 1px solid var(--border);
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 0 40px rgba(0,255,136,0.1);
    }

    #tabs-area {
        flex: none;
        height: 580px;
    }

    .tab-pane {
        flex: none;
        height: 580px;
    }
}

/* ============================================================
   ΦΑΣΗ 2 — Skills + Achievements styles
   ============================================================ */

/* Utility */
.hidden { display: none !important; }
.energy-col   { color: var(--primary)   !important; text-shadow: var(--glow); }
.dna-col      { color: var(--dna-color) !important; text-shadow: 0 0 8px var(--dna-color); }
.mutation-col { color: var(--accent)    !important; text-shadow: 0 0 8px var(--accent); }
.gold-col     { color: var(--gold)      !important; text-shadow: 0 0 8px var(--gold); }

/* Auto-click label */
#auto-click-label {
    font-family: var(--font-head);
    font-size: 0.65rem;
    color: #e74c3c;
    text-shadow: 0 0 8px #e74c3c;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* --- Prestige Panel --- */
#prestige-panel {
    background: var(--bg-card);
    border: 1px solid rgba(255, 0, 110, 0.3);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}

#mp-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mp-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px var(--accent));
}

#mp-value {
    font-family: var(--font-head);
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 12px var(--accent);
}

.mp-label {
    font-size: 0.65rem;
    color: rgba(255,0,110,0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Skill Tree --- */
.skill-tree-title {
    font-family: var(--font-head);
    font-size: 0.85rem;
    color: var(--primary);
    text-shadow: var(--glow);
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.skill-tree-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.skill-paths {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.skill-path {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--pc, var(--border));
    border-radius: 10px;
    padding: 10px;
}

.sp-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sp-icon { font-size: 1.1rem; }

.sp-name {
    font-family: var(--font-head);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--pc, var(--primary));
    text-shadow: 0 0 6px var(--pc, var(--primary));
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sp-nodes {
    display: flex;
    flex-direction: column;
}

.sn-connector {
    width: 2px;
    height: 8px;
    background: rgba(255,255,255,0.1);
    margin: 0 auto;
}
.sn-connector.snc-active {
    background: var(--nc, var(--primary));
    box-shadow: 0 0 4px var(--nc, var(--primary));
}

.skill-node {
    border: 1px solid var(--nc, var(--border));
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.sn-cost {
    font-family: var(--font-head);
    font-size: 0.6rem;
    color: var(--nc, var(--text-dim));
    margin-bottom: 3px;
    font-weight: 700;
}

.sn-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--nc, var(--primary));
    margin-bottom: 2px;
    line-height: 1.2;
}

.sn-desc {
    font-size: 0.6rem;
    color: var(--text-dim);
    line-height: 1.3;
}

/* States */
.sn-done {
    background: rgba(0,0,0,0.2);
    opacity: 1;
    cursor: default;
    box-shadow: 0 0 8px color-mix(in srgb, var(--nc, #00ff88) 30%, transparent);
}
.sn-done .sn-cost { color: var(--primary); }

.sn-buy {
    opacity: 1;
    box-shadow: 0 0 10px color-mix(in srgb, var(--nc, #00ff88) 40%, transparent);
}
.sn-buy:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 18px color-mix(in srgb, var(--nc, #00ff88) 60%, transparent);
    background: rgba(255,255,255,0.04);
}

.sn-avail {
    opacity: 0.55;
}
.sn-avail:hover {
    opacity: 0.75;
}

.sn-locked {
    opacity: 0.2;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.08);
}
.sn-locked .sn-name, .sn-locked .sn-cost { color: rgba(255,255,255,0.2); }

/* --- Achievements Tab --- */
.ach-summary {
    font-family: var(--font-head);
    font-size: 0.78rem;
    color: var(--gold);
    text-shadow: 0 0 8px var(--gold);
    text-align: center;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.ach-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.ach-filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
}
.ach-filter-btn:hover { color: var(--primary); border-color: var(--primary); }
.ach-filter-btn.active {
    background: rgba(0,255,136,0.12);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--glow);
}

.ach-grid {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ach-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    transition: all var(--transition);
}

.ach-done {
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.04);
}
.ach-done:hover { box-shadow: 0 0 12px rgba(255,215,0,0.2); }

.ach-todo {
    opacity: 0.45;
}

.ach-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

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

.ach-name {
    font-family: var(--font-head);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 2px;
}
.ach-todo .ach-name { color: var(--text-dim); }

.ach-desc {
    font-size: 0.65rem;
    color: var(--text-dim);
    line-height: 1.3;
}

.ach-bonus {
    font-size: 0.6rem;
    color: var(--primary);
    margin-top: 3px;
    font-weight: 600;
}

.ach-bonus-preview {
    color: #888;
    font-style: italic;
    opacity: 0.8;
}

.ach-check {
    font-size: 1rem;
    color: var(--gold);
    font-weight: 900;
    flex-shrink: 0;
    text-shadow: 0 0 8px var(--gold);
}

/* Achievement notification — special larger style */
.notif-achievement {
    border-color: var(--gold) !important;
    background: rgba(10, 20, 40, 0.98) !important;
    box-shadow: 0 0 20px rgba(255,215,0,0.5), 0 0 40px rgba(255,215,0,0.15) !important;
    padding: 12px 16px !important;
}

.ach-notif-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ach-notif-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px var(--gold));
}

.ach-notif-title {
    font-size: 0.65rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.ach-notif-name {
    font-family: var(--font-head);
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
}

.ach-notif-claim {
    font-size: 0.6rem;
    color: var(--primary);
    margin-top: 3px;
    font-style: italic;
}

/* Tab badge for pending achievement claims — absolutely positioned to not affect layout */
.tab-badge {
    position: absolute;
    top: 4px;
    right: 2px;
    background: var(--accent);
    border-radius: 50%;
    width: 8px;
    height: 8px;
    font-size: 0;
    box-shadow: 0 0 5px rgba(255,0,110,0.7);
    pointer-events: none;
}

/* Claimable achievement card */
.ach-claimable {
    border-color: var(--primary) !important;
    background: rgba(0,255,136,0.06) !important;
    animation: ach-pulse 2s ease-in-out infinite;
}
@keyframes ach-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(0,255,136,0.2); }
    50%       { box-shadow: 0 0 14px rgba(0,255,136,0.5); }
}

.ach-claim-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--primary);
    background: rgba(0,255,136,0.12);
    color: var(--primary);
    font-family: var(--font-head);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all var(--transition);
    white-space: nowrap;
}
.ach-claim-btn:hover {
    background: rgba(0,255,136,0.25);
    box-shadow: 0 0 8px rgba(0,255,136,0.4);
}

/* One-column skill paths on very small screens */
@media (max-width: 380px) {
    .skill-paths { grid-template-columns: 1fr; }
    .ach-filter-row { gap: 4px; }
    .ach-filter-btn { font-size: 0.58rem; padding: 4px 7px; }
}

/* ============================================================
   ΦΑΣΗ 3 — Daily Rewards + Random Events
   ============================================================ */

/* --- Combo Counter --- */
#combo-display {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 2px;
    margin-top: 6px;
    animation: combo-pulse 0.3s ease;
    text-transform: uppercase;
    transition: color 0.2s ease;
}
#combo-display[data-lvl="1"] { color: var(--secondary); text-shadow: 0 0 10px var(--secondary); }
#combo-display[data-lvl="2"] { color: var(--gold);      text-shadow: 0 0 14px var(--gold); }
#combo-display[data-lvl="3"] { color: var(--accent);    text-shadow: 0 0 18px var(--accent); }
#combo-display[data-lvl="4"] { color: #fff;             text-shadow: 0 0 22px #fff, 0 0 40px var(--accent); }
#combo-x { font-size: 1.3em; }

@keyframes combo-pulse {
    0%   { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* --- Event Banner --- */
.event-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    margin: 8px 14px 4px;
    font-family: var(--font-head);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    animation: banner-slide-in 0.4s ease;
    transition: all var(--transition);
}
.ev-positive { background: rgba(0,255,136,0.12); border: 1px solid var(--primary); color: var(--primary); box-shadow: var(--glow); }
.ev-negative { background: rgba(255,0,110,0.12); border: 1px solid var(--accent);  color: var(--accent);  box-shadow: 0 0 12px rgba(255,0,110,0.4); }
.ev-neutral  { background: rgba(0,212,255,0.12); border: 1px solid var(--secondary); color: var(--secondary); box-shadow: 0 0 12px rgba(0,212,255,0.4); }
.ev-timer {
    font-size: 0.85em;
    opacity: 0.8;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

@keyframes banner-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Daily Reward Button --- */
#daily-available {
    margin: 10px 14px 0;
}
.daily-open-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(0,255,136,0.08));
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all var(--transition);
    text-shadow: 0 0 8px var(--gold);
    animation: daily-glow 2s ease-in-out infinite;
}
.daily-open-btn:hover {
    background: linear-gradient(135deg, rgba(255,215,0,0.25), rgba(0,255,136,0.15));
    box-shadow: 0 0 20px rgba(255,215,0,0.5);
    transform: translateY(-1px);
}
@keyframes daily-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.3); }
    50%       { box-shadow: 0 0 20px rgba(255,215,0,0.6); }
}

/* --- Mini-Games Section --- */
#minigame-section {
    margin: 12px 14px 0;
    animation: fadeIn 0.3s ease;
}
.section-header {
    font-family: var(--font-head);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
#mg-info-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    cursor: pointer;
    line-height: 1;
    color: var(--text-dim);
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}
#mg-info-btn:hover { border-color: var(--primary); color: var(--primary); }


#mg-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mg-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,212,255,0.05);
    border: 1px solid rgba(0,212,255,0.25);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    width: 100%;
}
.mg-btn:hover:not(:disabled) {
    background: rgba(0,212,255,0.12);
    border-color: var(--secondary);
    box-shadow: 0 0 12px rgba(0,212,255,0.3);
    transform: translateY(-1px);
}
.mg-btn:disabled, .mg-btn.mg-on-cd {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.1);
}
.mg-icon { font-size: 1.6rem; flex-shrink: 0; }
.mg-info { display: flex; flex-direction: column; }
.mg-name {
    font-family: var(--font-head);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--secondary);
}
.mg-cd-label {
    font-size: 0.62rem;
    color: var(--text-dim);
    margin-top: 1px;
}

/* ============================================================
   ΦΑΣΗ 4 — Mini-Game Modal + Daily Modal + Event Modal
   ============================================================ */

/* --- Generic Modal Box --- */
.modal-box {
    background: rgba(10, 20, 40, 0.98);
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    max-width: 360px;
    width: 92%;
    box-shadow: var(--glow-strong);
    animation: modalPop 0.3s ease;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-primary-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, rgba(0,255,136,0.2), rgba(0,212,255,0.1));
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.82rem;
    font-weight: 700;
    transition: all var(--transition);
    text-shadow: var(--glow);
    box-shadow: var(--glow);
    margin-top: 14px;
}
.modal-primary-btn:hover {
    background: linear-gradient(135deg, rgba(0,255,136,0.35), rgba(0,212,255,0.2));
    box-shadow: var(--glow-strong);
    transform: translateY(-2px);
}
.modal-secondary-btn {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.78rem;
    transition: all var(--transition);
    margin-top: 8px;
}
.modal-secondary-btn:hover { color: var(--primary); border-color: var(--primary); }
.modal-desc {
    font-size: 0.82rem;
    color: rgba(0,255,136,0.75);
    line-height: 1.5;
    margin-bottom: 4px;
}

/* --- Daily Reward Modal --- */
#daily-overlay, #event-overlay-modal, #mg-overlay, #evolve-hint-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(6px);
}
#daily-overlay.hidden, #event-overlay-modal.hidden, #mg-overlay.hidden { display: none; }

.daily-streak-row {
    font-family: var(--font-head);
    font-size: 0.8rem;
    color: var(--gold);
    text-shadow: 0 0 8px var(--gold);
    margin-bottom: 14px;
}
.daily-days-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 16px;
}
.daily-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    min-width: 38px;
    opacity: 0.4;
    transition: all var(--transition);
}
.daily-day-num  { font-family: var(--font-head); font-size: 0.55rem; color: var(--text-dim); }
.daily-day-icon { font-size: 1rem; }
.daily-day-past    { opacity: 0.6; border-color: rgba(0,255,136,0.2); }
.daily-day-current {
    opacity: 1;
    border-color: var(--gold);
    background: rgba(255,215,0,0.1);
    box-shadow: 0 0 12px rgba(255,215,0,0.4);
    transform: scale(1.1);
}
.daily-reward-preview { margin-bottom: 8px; }
.daily-reward-big {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 12px var(--gold);
    margin-bottom: 4px;
}
.daily-reward-sub {
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* --- Event Modal --- */
#event-modal {
    border-color: var(--secondary);
    box-shadow: 0 0 30px rgba(0,212,255,0.3);
}
#event-modal h3 {
    font-family: var(--font-head);
    font-size: 0.95rem;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary);
    margin-bottom: 10px;
}

/* --- Mini-Game Modal --- */
.mg-modal-box {
    border-color: var(--secondary);
    box-shadow: 0 0 30px rgba(0,212,255,0.25);
    padding-top: 44px;
}
.mg-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(255,0,110,0.15);
    border: 1px solid rgba(255,0,110,0.4);
    color: var(--accent);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mg-close-btn:hover {
    background: rgba(255,0,110,0.3);
    border-color: var(--accent);
}
.mg-screen { text-align: center; }

/* Abandon confirmation overlay */
.mg-abandon-box {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 26, 0.95);
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 10;
    padding: 24px;
}
.mg-abandon-icon { font-size: 2.5rem; }
.mg-abandon-text {
    text-align: center;
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    line-height: 1.5;
}
.mg-abandon-text strong { color: var(--accent); }
.mg-abandon-btns { display: flex; gap: 12px; }
.mg-abandon-yes {
    padding: 10px 20px;
    background: rgba(255,0,110,0.2);
    border: 1px solid var(--accent);
    border-radius: 10px;
    color: var(--accent);
    font-family: var(--font-head);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.mg-abandon-yes:hover { background: rgba(255,0,110,0.4); }
.mg-abandon-no {
    padding: 10px 20px;
    background: rgba(0,255,136,0.1);
    border: 1px solid var(--primary);
    border-radius: 10px;
    color: var(--primary);
    font-family: var(--font-head);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.mg-abandon-no:hover { background: rgba(0,255,136,0.2); }
.mg-title {
    font-family: var(--font-head);
    font-size: 0.9rem;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary);
    margin-bottom: 6px;
}
.mg-subtitle {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 14px;
    line-height: 1.4;
}
.mg-timer {
    font-family: var(--font-head);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: var(--glow-strong);
    margin-bottom: 14px;
    transition: color 0.3s ease;
}
.mg-status {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 10px;
    min-height: 1.4em;
    line-height: 1.4;
}
.mg-status strong { color: var(--primary); text-shadow: var(--glow); }

/* DNA Grid */
.mg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    padding: 4px;
    margin: 0 auto;
    max-width: 280px;
}
.dna-card {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--border);
    color: var(--text-dim);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}
.dna-card:hover:not(.dna-matched) { transform: scale(1.06); }
.dna-flipped  { background: rgba(0,0,0,0.6) !important; }
.dna-matched  {
    background: rgba(0,255,136,0.1) !important;
    cursor: default;
    animation: card-match 0.4s ease;
}
@keyframes card-match {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ====== ROCKET SECTION ====== */
#rocket-section {
    margin: 12px 0;
    padding: 14px;
    background: rgba(255, 140, 0, 0.06);
    border: 1px solid rgba(255, 140, 0, 0.35);
    border-radius: 12px;
    text-align: center;
}
.rocket-build-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff8c00, #ff4500);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    box-shadow: 0 0 16px rgba(255,140,0,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}
.rocket-build-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 0 24px rgba(255,140,0,0.65);
}
.rocket-countdown {
    padding: 8px 0 4px;
}
.rocket-cd-text {
    font-size: 13px;
    color: rgba(255,200,100,0.8);
    margin-bottom: 6px;
}
.rocket-timer {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 900;
    color: #ffa500;
    text-shadow: 0 0 12px rgba(255,165,0,0.7);
    letter-spacing: 2px;
}
.rocket-launch-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #00d4ff, #0080ff);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    letter-spacing: 1px;
    box-shadow: 0 0 20px rgba(0,212,255,0.5);
    animation: rocket-pulse 1.5s ease-in-out infinite;
    transition: transform 0.15s;
}
.rocket-launch-btn:hover { transform: scale(1.04); }
@keyframes rocket-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0,212,255,0.5); }
    50%       { box-shadow: 0 0 36px rgba(0,212,255,0.85), 0 0 60px rgba(0,212,255,0.3); }
}

/* Cell Division Race */
.mg-tap-btn {
    background: linear-gradient(135deg, rgba(0,255,136,0.2), rgba(0,212,255,0.1));
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 20px 32px;
    border-radius: 16px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 900;
    transition: all 0.1s ease;
    box-shadow: var(--glow);
    letter-spacing: 1px;
    display: block;
    width: 100%;
    margin-bottom: 8px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.mg-tap-btn:active {
    transform: scale(0.92);
    box-shadow: none;
}
.mg-tap-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Mutation Roulette */
.rlt-balance {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--primary);
    text-shadow: var(--glow);
    margin-bottom: 12px;
}
.roulette-bets {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}
.rlt-bet-btn {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.78rem;
    font-weight: 700;
    transition: all var(--transition);
}
.rlt-bet-btn:hover, .rlt-bet-btn.rlt-active {
    background: rgba(0,255,136,0.12);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--glow);
}
.rlt-bet-info {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.rlt-bet-info span { color: var(--primary); font-weight: 700; }
.roulette-spin-btn {
    background: linear-gradient(135deg, rgba(255,0,110,0.2), rgba(255,215,0,0.1));
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 700;
    transition: all var(--transition);
    width: 100%;
    text-shadow: 0 0 8px var(--accent);
    letter-spacing: 0.5px;
}
.roulette-spin-btn:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(255,0,110,0.35), rgba(255,215,0,0.15));
    box-shadow: 0 0 20px rgba(255,0,110,0.5);
    transform: translateY(-1px);
}
.roulette-spin-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rlt-result {
    margin-top: 12px;
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    animation: fadeIn 0.4s ease;
}
.rlt-odds {
    margin-top: 10px;
    color: rgba(255,255,255,0.2);
    font-size: 0.6rem;
}

/* --- Sound Controls --- */
.sound-ctrl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.sound-label {
    font-size: 0.82rem;
    color: var(--text-dim);
    white-space: nowrap;
    flex: 1;
}
.sound-toggle-btn {
    background: rgba(0,255,136,0.08);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 7px 0;
    width: 112px;
    flex-shrink: 0;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}
.sound-toggle-btn:hover {
    background: rgba(0,255,136,0.15);
    border-color: var(--primary);
    box-shadow: var(--glow);
}
.lang-dropdown { position: relative; min-width: 200px; }
.lang-drop-selected {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    border: 1px solid var(--border);
    background: rgba(0, 255, 136, 0.05);
    color: var(--primary);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.lang-drop-selected:hover {
    border-color: var(--primary);
    background: rgba(0, 255, 136, 0.1);
    box-shadow: var(--glow);
}
.lang-drop-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 300;
    background: rgba(8, 15, 35, 0.98);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), var(--glow);
}
.lang-drop-opt {
    padding: 9px 14px;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.1s;
}
.lang-drop-opt:hover { background: rgba(0, 255, 136, 0.12); }
.lang-drop-opt.lang-active {
    background: rgba(0, 255, 136, 0.08);
    color: #fff;
    font-weight: 500;
}
.volume-slider-wide {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    accent-color: var(--primary);
    outline: none;
    cursor: pointer;
    display: block;
    margin-bottom: 4px;
}
.volume-slider-wide::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0,255,136,0.5);
}
.volume-slider-wide::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(0,255,136,0.5);
}
.volume-slider-wide::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--primary) var(--val, 50%), rgba(255,255,255,0.1) var(--val, 50%));
}
.sound-slider-dim {
    opacity: 0.3;
    pointer-events: none;
}

/* ============================================================
   MAP TAB
   ============================================================ */

#map-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

#world-map-svg {
    width: 100%;
    max-width: 472px;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.08), inset 0 0 40px rgba(10, 22, 40, 0.8);
    display: block;
}

/* Pulse animation rings for Australia marker */
.map-pulse-1,
.map-pulse-2 {
    transform-box: fill-box;
    transform-origin: center;
}

.map-pulse-1 {
    animation: map-ring-pulse 2s ease-out infinite;
}

.map-pulse-2 {
    animation: map-ring-pulse 2s ease-out infinite;
    animation-delay: 0.8s;
}

@keyframes map-ring-pulse {
    0%   { transform: scale(0.4); opacity: 0.9; }
    100% { transform: scale(2.8); opacity: 0; }
}

#map-info-row {
    font-family: var(--font-head);
    font-size: 0.72rem;
    color: var(--text-dim);
    text-align: center;
    letter-spacing: 0.5px;
    padding: 4px 0 2px;
}

#map-stage-info {
    color: var(--primary);
    text-shadow: var(--glow);
}

/* ============================================================
   Ranks Tab
   ============================================================ */
.ranks-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
}
.ranks-lock-icon { font-size: 3rem; }
.ranks-lock-title {
    font-family: var(--font-head);
    font-size: 1.1rem;
    color: var(--primary);
}
.ranks-lock-desc { color: var(--text-dim); font-size: 0.85rem; }
.ranks-header {
    font-family: var(--font-head);
    font-size: 1.1rem;
    color: var(--gold);
    text-align: center;
    padding: 12px 0 4px;
    letter-spacing: 1px;
}
.ranks-summary {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-bottom: 10px;
}
.ranks-list { display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
}
.rank-row.rank-done { border-color: var(--primary); }
.rank-idx { color: var(--text-dim); min-width: 16px; }
.rank-emoji { font-size: 1.2rem; }
.rank-name { flex: 1; color: var(--text); }
.rank-goal { color: var(--primary); font-family: var(--font-head); font-size: 0.78rem; }
.rank-row.rank-pending { opacity: 0.5; }
.ranks-total {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 8px 8px 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-dim);
}
.ranks-total span:last-child { color: var(--primary); font-family: var(--font-head); }

/* ============================================================
   Cell Race Full-Screen Overlay
   ============================================================ */
#race-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}
#race-fullscreen.hidden { display: none; }

#race-fs-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#race-fs-title {
    font-family: var(--font-head);
    font-size: 0.85rem;
    color: var(--primary);
    letter-spacing: 1px;
    text-shadow: var(--glow);
}
.race-fs-close-btn {
    background: none;
    border: 1px solid var(--accent);
    color: var(--accent);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
}
.race-fs-close-btn:hover { background: rgba(255,0,110,0.12); }

#race-fs-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 24px 4px;
    flex-shrink: 0;
}
.race-fs-count {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--secondary);
    letter-spacing: 1px;
}
.race-fs-timer {
    font-family: var(--font-head);
    font-size: 2.8rem;
    color: var(--primary);
    text-shadow: var(--glow-strong);
    min-width: 60px;
    text-align: right;
    line-height: 1;
}

#race-fs-emoji {
    font-size: 9rem;
    line-height: 1;
    text-align: center;
    filter: drop-shadow(0 0 32px rgba(0,255,136,0.5));
    pointer-events: none;
    user-select: none;
    animation: pulse-float 2.5s ease-in-out infinite;
}
#race-fs-emoji img.emoji {
    width: 9rem;
    height: 9rem;
}

#race-fs-divide-title {
    font-family: var(--font-head);
    font-size: 0.85rem;
    letter-spacing: 4px;
    color: var(--text-dim);
    text-transform: uppercase;
    pointer-events: none;
    user-select: none;
    margin: 4px 0 8px;
}

.race-fs-tap-btn {
    flex: 1;
    width: calc(100% - 32px);
    max-width: 460px;
    border-radius: 22px;
    border: 3px solid var(--primary);
    background: rgba(0,255,136,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(0,255,136,0.25), inset 0 0 20px rgba(0,255,136,0.04);
    transition: transform 0.07s ease, background 0.1s ease, box-shadow 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    margin: 0 16px 12px;
}
.race-fs-tap-btn:hover { background: rgba(0,255,136,0.10); }
.race-fs-tap-btn:active { background: rgba(0,255,136,0.16); transform: scale(0.97); }
.race-fs-tap-btn:disabled { opacity: 0.35; cursor: default; box-shadow: none; }

#race-fs-status {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-dim);
    text-align: center;
    padding: 12px 20px 8px;
    min-height: 2.2em;
    flex-shrink: 0;
}
#race-fs-status strong { color: var(--primary); }

/* ============================================================
   Responsive final tweaks
   ============================================================ */
@media (max-width: 380px) {
    .mg-tap-btn    { font-size: 0.95rem; padding: 16px 20px; }
    .mg-timer      { font-size: 2rem; }
    #combo-display { font-size: 0.85rem; }
    .daily-days-row { gap: 3px; }
    .daily-day { min-width: 32px; padding: 5px 2px; }
    .daily-day-num  { font-size: 0.5rem; }
}

/* ============================================================
   100-Level System: Wait Display + Evolution Chain + Endgame
   ============================================================ */

/* Level wait display pulse */
#level-wait-display {
    font-family: var(--font-head);
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    animation: wait-pulse 1.5s ease-in-out infinite;
}
@keyframes wait-pulse {
    0%, 100% { opacity: 0.8; text-shadow: 0 0 6px var(--primary); }
    50%       { opacity: 1;   text-shadow: 0 0 14px var(--primary), 0 0 28px var(--primary); }
}

/* Evolution Chain grid */
.mg-chain-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
    max-width: 280px;
    margin: 0 auto;
}
.mg-chain-card {
    aspect-ratio: 1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0,255,136,0.08);
    border: 2px solid var(--border);
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}
.chain-num {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    font-family: var(--font-head);
}
.mg-chain-card:hover {
    background: rgba(0,255,136,0.15);
    border-color: var(--primary);
    transform: scale(1.05);
}
.mg-chain-card.correct {
    border-color: var(--primary);
    background: rgba(0,255,136,0.2);
}
.mg-chain-card.wrong {
    border-color: var(--accent);
    background: rgba(255,0,110,0.2);
}
.mg-chain-phase {
    font-family: var(--font-head);
    font-size: 0.85rem;
    color: var(--secondary);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

/* Tutorial overlay */
#tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
#tutorial-overlay.hidden { display: none; }
#tutorial-modal {
    max-width: 420px;
    width: 90%;
}
#tutorial-modal .modal-desc {
    text-align: left;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-dim);
}

/* ============================================================
   AUTH + CLOUD SAVE
   ============================================================ */

.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.2) !important;
    color: #fff;
}
.auth-google-btn:hover { background: rgba(255,255,255,0.12); }
.auth-danger-btn {
    background: rgba(255,50,50,0.1) !important;
    border-color: rgba(255,80,80,0.35) !important;
    color: #ff8080 !important;
}
.auth-danger-btn:hover { background: rgba(255,50,50,0.2) !important; }

.rename-pencil-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.55;
    padding: 0 2px;
    line-height: 1;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.rename-pencil-btn:hover { opacity: 1; }

.auth-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0 12px;
}
.auth-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    object-fit: cover;
}
.auth-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.auth-username-text {
    font-family: var(--font-head);
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
}

/* ============================================================
   LEADERBOARD (Ranks Tab)
   ============================================================ */

.ranks-header {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(255,215,0,0.5);
    text-align: center;
    padding: 8px 0 14px;
    letter-spacing: 2px;
}
.ranks-loading, .ranks-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 24px;
    font-size: 0.85rem;
}
#ranks-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    transition: all var(--transition);
}
.rank-row.rank-me {
    border-color: var(--gold);
    border-width: 2px;
    background: rgba(255,215,0,0.28);
    box-shadow: 0 0 22px rgba(255,215,0,0.70), inset 0 0 0 1px rgba(255,215,0,0.40);
}
.rank-row.rank-top3 {
    border-color: rgba(255,215,0,0.4);
    background: rgba(255,215,0,0.04);
}
.rank-pos {
    font-family: var(--font-head);
    font-size: 1rem;
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.rank-ava {
    flex-shrink: 0;
}
.rank-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
    display: block;
}
.rank-emoji-icon { font-size: 1.4rem; }
.rank-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.rank-name {
    font-family: var(--font-head);
    font-size: 0.75rem;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rank-sub {
    font-size: 0.62rem;
    color: var(--text-dim);
}
.rank-score {
    font-family: var(--font-head);
    font-size: 0.72rem;
    color: var(--gold);
    white-space: nowrap;
    flex-shrink: 0;
}

.auth-prompt-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    margin-bottom: 14px;
}
.auth-prompt-icon { font-size: 2rem; margin-bottom: 8px; }
.auth-prompt-box p { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0; }

/* Endgame overlay + modal */
#endgame-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
#endgame-modal {
    border-color: var(--gold) !important;
    box-shadow: 0 0 40px rgba(255,215,0,0.5), 0 0 80px rgba(255,215,0,0.2) !important;
}
#endgame-modal h3 { color: var(--gold); text-shadow: 0 0 12px var(--gold); }

/* Crystal inline buttons */
.cry-inline-btn {
    display: inline-block; margin-left: 8px;
    padding: 2px 8px; border-radius: 6px;
    border: 1px solid rgba(255,215,0,0.4);
    background: rgba(255,215,0,0.08); color: var(--gold);
    cursor: pointer; font-size: 0.72rem; font-family: var(--font-body);
    transition: background 0.2s;
}
.cry-inline-btn:hover:not(:disabled) { background: rgba(255,215,0,0.22); }
.cry-inline-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.cry-boost-area { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 2px; flex-wrap: wrap; }

/* shared base for all three action buttons in cry-boost-area */
.cry-boost-btn, .exchange-open-btn, #alien-mode-toggle {
    height: 36px; padding: 0 14px; border-radius: 10px;
    font-size: 0.8rem; font-family: var(--font-body); font-weight: 600;
    letter-spacing: 0.3px; white-space: nowrap; cursor: pointer;
    border-width: 1.5px; border-style: solid;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}
.cry-boost-btn, .exchange-open-btn, #alien-mode-toggle { box-shadow: none; }
.cry-boost-btn:hover:not(:disabled),
.exchange-open-btn:hover,
#alien-mode-toggle:hover { transform: translateY(-1px); }

/* 2× Boost — gold */
.cry-boost-btn {
    border-color: rgba(255,215,0,0.5);
    background: rgba(255,215,0,0.09); color: var(--gold);
    box-shadow: 0 0 8px rgba(255,215,0,0.12);
}
.cry-boost-btn:hover:not(:disabled) {
    background: rgba(255,215,0,0.2);
    border-color: rgba(255,215,0,0.8);
    box-shadow: 0 0 14px rgba(255,215,0,0.25);
}
.cry-boost-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ── Exchange button & modal ── */
/* Exchange — cyan (shares base from cry-boost-area shared block above) */
.exchange-open-btn {
    border-color: rgba(0,212,255,0.5);
    background: rgba(0,212,255,0.09); color: var(--secondary);
    box-shadow: 0 0 8px rgba(0,212,255,0.12);
}
.exchange-open-btn:hover {
    background: rgba(0,212,255,0.2);
    border-color: rgba(0,212,255,0.8);
    box-shadow: 0 0 14px rgba(0,212,255,0.28);
}
#exchange-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.88); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 500;
}
#exchange-overlay.hidden { display: none; }

#exchange-modal {
    position: relative; max-width: 360px; width: 92%;
    border-color: rgba(0,212,255,0.3);
    box-shadow: 0 0 40px rgba(0,212,255,0.12), 0 8px 32px rgba(0,0,0,0.6);
}
#exchange-modal .modal-icon { color: var(--secondary); }
#exchange-modal h3 { color: var(--secondary); margin: 0; }
.exch-modal-title-row {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-bottom: 10px;
}
.exch-info-btn {
    background: none; border: 1px solid var(--border); border-radius: 50%;
    width: 22px; height: 22px; font-size: 0.8rem; cursor: pointer;
    line-height: 1; color: var(--text-dim);
    transition: border-color 0.2s, color 0.2s; flex-shrink: 0;
}
.exch-info-btn:hover { border-color: var(--secondary); color: var(--secondary); }

.modal-close-x {
    position: absolute; top: 10px; right: 10px;
    background: none; border: none; color: var(--text-dim);
    font-size: 1rem; cursor: pointer; padding: 2px 6px; border-radius: 4px;
    transition: color 0.15s;
}
.modal-close-x:hover { color: var(--text-main); }

/* Exchange slots — new independent-slot design */
.exch-slots { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 4px; }
.exch-slot {
    background: rgba(255,255,255,0.04); border: 1.5px solid var(--border);
    border-radius: 12px; padding: 12px 14px;
}
.exch-slot-hd {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.exch-slot-type { flex: 1; font-size: 0.9rem; color: var(--text-main); font-weight: 600; }
.exch-dropdown { position: relative; flex: 1; }
.exch-pair-selector { display: flex; align-items: center; gap: 6px; flex: 1; }
.exch-half-drop { position: relative; flex: 1; min-width: 0; }
.exch-pair-arrow { color: var(--secondary); font-size: 1rem; flex-shrink: 0; }
.exch-drop-selected {
    padding: 6px 10px; border-radius: 7px; font-size: 0.82rem;
    border: 1px solid rgba(0,212,255,0.4); background: rgba(0,5,20,0.7);
    color: var(--secondary); cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between;
    transition: border-color 0.15s, background 0.15s;
}
.exch-drop-selected:hover { border-color: var(--secondary); background: rgba(0,212,255,0.1); }
.exch-drop-list {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
    background: rgba(4,8,28,0.98); border: 1px solid rgba(0,212,255,0.45);
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 8px 28px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,212,255,0.1);
}
.exch-drop-opt {
    padding: 8px 12px; font-size: 0.82rem; color: var(--text-main); cursor: pointer;
    transition: background 0.12s;
}
.exch-drop-opt:hover { background: rgba(0,212,255,0.15); color: var(--secondary); }
.exch-slot-lv {
    font-size: 0.72rem; color: var(--secondary); white-space: nowrap;
    background: rgba(0,212,255,0.1); padding: 2px 6px; border-radius: 4px;
}
.exch-slot-body {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.exch-amt-label { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; }
.exch-stepper {
    display: flex; align-items: center; gap: 0;
    border: 1px solid rgba(0,212,255,0.4); border-radius: 8px; overflow: hidden;
    background: rgba(0,0,0,0.3);
}
.exch-step-btn {
    width: 28px; height: 28px; border: none; background: rgba(0,212,255,0.1);
    color: var(--secondary); font-size: 1.1rem; font-weight: 700; cursor: pointer;
    transition: background 0.15s; flex-shrink: 0; line-height: 1;
}
.exch-step-btn:hover:not(:disabled) { background: rgba(0,212,255,0.25); }
.exch-step-btn:disabled { opacity: 0.25; cursor: default; }
.exch-step-val {
    min-width: 28px; text-align: center; font-size: 0.95rem; font-weight: 700;
    color: var(--text-main); font-family: var(--font-head); padding: 0 4px;
}
.exch-preview { flex: 1; font-size: 0.82rem; color: var(--primary); text-align: right; font-weight: 600; }
.exch-start-btn {
    width: 100%; padding: 10px; border-radius: 10px;
    border: 1.5px solid rgba(0,255,136,0.5); background: rgba(0,255,136,0.12);
    color: var(--primary); cursor: pointer; font-size: 0.88rem; font-family: var(--font-body);
    font-weight: 600; transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.exch-start-btn:hover:not(:disabled) { background: rgba(0,255,136,0.22); box-shadow: 0 0 14px rgba(0,255,136,0.2); transform: translateY(-1px); }
.exch-start-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.exch-slot-active { text-align: center; padding: 4px 0; }
.exch-active-desc { font-size: 1rem; color: var(--text-main); font-weight: 600; margin-bottom: 6px; }
.exch-active-status {
    font-size: 0.85rem; color: var(--secondary); font-family: var(--font-head);
    letter-spacing: 0.5px; margin-bottom: 12px;
}
.exch-claim-btn {
    width: 100%; padding: 10px; border-radius: 10px;
    border: 1.5px solid rgba(255,215,0,0.45); background: rgba(255,215,0,0.09);
    color: var(--gold); cursor: pointer; font-size: 0.9rem; font-family: var(--font-body);
    font-weight: 600; transition: background 0.2s, box-shadow 0.2s;
}
.exch-claim-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.exch-claim-ready { border-color: var(--primary) !important; background: rgba(0,255,136,0.15) !important; color: var(--primary) !important; box-shadow: 0 0 18px rgba(0,255,136,0.2) !important; }
.exch-claim-ready:hover { background: rgba(0,255,136,0.25) !important; }
.exch-slot-lock {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.exch-lock-type { font-size: 0.9rem; color: rgba(255,255,255,0.3); font-weight: 600; }
.exch-upgrade-btn {
    padding: 4px 10px; border-radius: 6px; font-size: 0.72rem;
    border: 1px solid rgba(0,212,255,0.4); background: rgba(0,212,255,0.08);
    color: var(--secondary); cursor: pointer; font-family: var(--font-body);
    transition: background 0.2s; white-space: nowrap; flex-shrink: 0;
}
.exch-upgrade-btn:hover { background: rgba(0,212,255,0.18); }
.exch-upgrade-btn:disabled { opacity: 0.5; cursor: default; }
.exchange-unlock-btn {
    padding: 5px 12px; border-radius: 7px;
    border: 1.5px solid rgba(255,215,0,0.45);
    background: rgba(255,215,0,0.08); color: var(--gold);
    cursor: pointer; font-size: 0.78rem; font-family: var(--font-body);
    font-weight: 600; transition: background 0.2s, box-shadow 0.2s; white-space: nowrap;
}
.exchange-unlock-btn:hover { background: rgba(255,215,0,0.18); box-shadow: 0 0 10px rgba(255,215,0,0.15); }

.mg-btn-row { display: flex; align-items: center; gap: 6px; }
.mg-btn-row .mg-btn { flex: 1; }
.cry-skip-btn {
    flex-shrink: 0; width: 38px; height: 38px;
    border-radius: 8px; border: 1px solid rgba(255,215,0,0.4);
    background: rgba(255,215,0,0.08); color: var(--gold);
    cursor: pointer; font-size: 1rem;
    transition: background 0.2s;
}
.cry-skip-btn:hover:not(:disabled) { background: rgba(255,215,0,0.2); }
.cry-skip-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.crystal-boost-display {
    text-align: center;
    font-family: var(--font-head);
    font-size: 0.75rem;
    color: var(--gold);
    background: rgba(255,215,0,0.1);
    border-radius: 8px;
    padding: 5px 10px;
    margin: 4px 0;
    animation: wait-pulse 1.5s ease-in-out infinite;
}

/* Skill Bonuses section in Stats tab */
#skill-bonus-section {
    margin-top: 12px;
    background: rgba(0,255,136,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
#skill-bonus-section h2 {
    font-family: var(--font-head);
    font-size: 0.75rem;
    color: var(--secondary);
    letter-spacing: 1px;
    margin: 0 0 10px;
    text-align: center;
    font-weight: 700;
}
.sb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0,255,136,0.08);
    font-size: 0.82rem;
}
.sb-row:last-child { border-bottom: none; }
.sb-label { color: var(--text-dim); }
.sb-val   { color: var(--primary); font-family: var(--font-head); font-size: 0.78rem; }

/* mp-spent in skills tab */
#mp-spent {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ====== ALIEN MODE TOGGLE ====== */
/* Alien toggle — purple/teal (shares base from cry-boost-area shared block) */
#alien-mode-toggle {
    border-color: rgba(170,0,255,0.5);
    background: rgba(170,0,255,0.09); color: #cc88ff;
    box-shadow: 0 0 8px rgba(170,0,255,0.12);
}
#alien-mode-toggle:hover {
    background: rgba(170,0,255,0.2);
    border-color: rgba(170,0,255,0.8);
    box-shadow: 0 0 14px rgba(170,0,255,0.3);
}
#alien-mode-toggle.mode-alien {
    border-color: rgba(0,255,238,0.5);
    background: rgba(0,255,238,0.09); color: #00ffee;
    box-shadow: 0 0 8px rgba(0,255,238,0.12);
}
#alien-mode-toggle.mode-alien:hover {
    background: rgba(0,255,238,0.2);
    border-color: rgba(0,255,238,0.8);
    box-shadow: 0 0 14px rgba(0,255,238,0.3);
}

/* ====== ALIEN PHASE ====== */
@keyframes alien-bg-shift {
    0%   { background: radial-gradient(ellipse at 20% 10%, #2d0060 0%, #0a0030 35%, #000010 70%, #000005 100%); }
    25%  { background: radial-gradient(ellipse at 80% 30%, #003d00 0%, #001a00 35%, #000010 70%, #000005 100%); }
    50%  { background: radial-gradient(ellipse at 50% 80%, #400030 0%, #1a0010 35%, #000010 70%, #000005 100%); }
    75%  { background: radial-gradient(ellipse at 10% 60%, #003040 0%, #001520 35%, #000010 70%, #000005 100%); }
    100% { background: radial-gradient(ellipse at 20% 10%, #2d0060 0%, #0a0030 35%, #000010 70%, #000005 100%); }
}

@keyframes alien-glow-pulse {
    0%, 100% { filter: brightness(1) saturate(1.2); }
    50%       { filter: brightness(1.25) saturate(1.8) hue-rotate(15deg); }
}

body.alien-active {
    animation: alien-bg-shift 12s ease-in-out infinite,
               alien-glow-pulse 4s ease-in-out infinite;
}

body.alien-active #game-header {
    border-bottom-color: rgba(180, 0, 255, 0.5);
    box-shadow: 0 2px 20px rgba(150, 0, 255, 0.3);
}

body.alien-active #prog-fill {
    background: linear-gradient(90deg, #aa00ff, #00ffee, #aa00ff);
    background-size: 200% 100%;
    animation: alien-bar-slide 2s linear infinite;
}

@keyframes alien-bar-slide {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

body.alien-active #cell {
    filter: drop-shadow(0 0 20px #aa00ff) drop-shadow(0 0 40px #00ffee);
    animation: alien-cell-spin 6s linear infinite;
}

@keyframes alien-cell-spin {
    0%   { transform: rotate(0deg)   scale(1);    }
    25%  { transform: rotate(5deg)   scale(1.08); }
    50%  { transform: rotate(0deg)   scale(1);    }
    75%  { transform: rotate(-5deg)  scale(1.08); }
    100% { transform: rotate(0deg)   scale(1);    }
}

@keyframes alien-chip-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(170,0,255,0.5); }
    50%       { box-shadow: 0 0 20px rgba(170,0,255,0.9), 0 0 40px rgba(0,255,238,0.3); }
}

/* ============================================================
   DEV PANEL
   ============================================================ */

.dev-open-btn {
    background: rgba(255,153,0,0.12);
    border-color: rgba(255,153,0,0.4);
    color: #ff9900;
}
.dev-open-btn:hover { background: rgba(255,153,0,0.22); }

.dev-panel-box {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.dev-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dev-btn {
    padding: 14px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,153,0,0.35);
    background: rgba(255,153,0,0.10);
    color: #ffb84d;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    touch-action: manipulation;
}
.dev-btn:hover  { background: rgba(255,153,0,0.22); }
.dev-btn:active { transform: scale(0.95); }

/* +25% EXP button spans full width */
#dev-add-energy {
    grid-column: 1 / -1;
    background: rgba(0,200,255,0.10);
    border-color: rgba(0,200,255,0.35);
    color: #4dd9ff;
}
#dev-add-energy:hover { background: rgba(0,200,255,0.22); }

.dev-btn-time {
    background: rgba(160,80,255,0.10);
    border-color: rgba(160,80,255,0.35);
    color: #c084ff;
}
.dev-btn-time:hover { background: rgba(160,80,255,0.22); }

.dev-btn-reset {
    background: rgba(255,60,60,0.10);
    border-color: rgba(255,60,60,0.35);
    color: #ff6060;
}
.dev-btn-reset:hover { background: rgba(255,60,60,0.22); }

.dev-btn-max {
    background: rgba(255,215,0,0.10);
    border-color: rgba(255,215,0,0.35);
    color: #ffd700;
}
.dev-btn-max:hover { background: rgba(255,215,0,0.22); }

.dev-btn-alien {
    background: rgba(170,0,255,0.12);
    border-color: rgba(170,0,255,0.40);
    color: #cc66ff;
}
.dev-btn-alien:hover { background: rgba(170,0,255,0.25); }

