:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --secondary-dark: #be185d;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-darker: #0a0e27;
    --bg-card: #1e293b;
    --bg-card-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    padding-top: 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.app-title {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--warning) 0%, var(--secondary-dark) 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

.streak-icon {
    font-size: 1.2rem;
}

.usage-counter {
    margin-top: 0.5rem;
}

#usageTodayText {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.usage-bar {
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Main game area */
.game-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Empire stats */
.empire-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tap section */
.tap-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.tap-button {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    font-size: 3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.tap-button:active {
    transform: scale(0.95);
}

.tap-button:hover {
    box-shadow: 0 20px 30px rgba(99, 102, 241, 0.4);
}

.tap-text {
    display: block;
    font-size: 2.5rem;
}

.tap-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
}

.energy-bar-container {
    width: 100%;
    max-width: 300px;
}

.energy-bar {
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--primary) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.energy-text {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Offline earnings */
.offline-earnings {
    width: 100%;
}

.info-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.info-icon {
    font-size: 1.5rem;
}

.info-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--success);
}

/* Tab container */
.tab-container {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-top: 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0 1rem;
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    min-width: 100px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 1rem 0;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-button:hover {
    color: var(--text-primary);
}

/* Tab content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tab-content h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

/* Upgrades list */
.upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upgrade-item {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.upgrade-item:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
    transform: translateX(4px);
}

.upgrade-item.locked {
    opacity: 0.6;
}

.upgrade-info {
    flex: 1;
}

.upgrade-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.upgrade-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upgrade-cost {
    background: rgba(99, 102, 241, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-right: 0.5rem;
}

.upgrade-button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    min-width: 70px;
}

.upgrade-button:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.upgrade-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* History list */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-amount {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--success);
}

.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Prestige section */
.prestige-info {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.prestige-stat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.prestige-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.prestige-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--warning) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prestige-button {
    width: 100%;
    background: linear-gradient(135deg, var(--warning) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.prestige-button:hover:not(:disabled) {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.prestige-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.prestige-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Footer */
.app-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
}

.footer-button {
    flex: 1;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.footer-button:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.premium-buy-btn {
    background: linear-gradient(135deg, var(--warning) 0%, var(--secondary) 100%);
    border: none;
    color: white;
}

.premium-buy-btn:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary) 100%);
    box-shadow: 0 10px 20px rgba(236, 72, 153, 0.3);
}

.button-icon {
    font-size: 1.2rem;
}

.button-text {
    font-size: 0.7rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    z-index: 100;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, -40%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.modal-content {
    position: relative;
}

.modal-close {
    position: absolute;
    top: -1rem;
    right: 0;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.premium-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-text {
    font-weight: 500;
}

.premium-pricing {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    border-radius: 0.75rem;
}

.price-currency {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--warning);
}

.price-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.premium-unlock-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--warning) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.premium-unlock-btn:hover {
    box-shadow: 0 10px 20px rgba(236, 72, 153, 0.3);
    transform: translateY(-2px);
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
}

.modal-overlay.active {
    display: block;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 0.6s ease-in-out;
}

@keyframes popFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px);
    }
}

.pop-text {
    position: fixed;
    pointer-events: none;
    font-weight: 700;
    font-size: 1.3rem;
    animation: popFloat 1s ease-out forwards;
}

/* Responsive */
@media (max-width: 600px) {
    .app-title {
        font-size: 1.5rem;
    }

    .tap-button {
        width: 120px;
        height: 120px;
        font-size: 2.5rem;
    }

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

    .modal {
        max-width: 95%;
        padding: 1.5rem;
    }

    .tab-button {
        min-width: 80px;
        padding: 0.75rem 0;
    }

    .footer-button {
        padding: 0.5rem;
    }
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Disabled tap when no energy */
.tap-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
