body {
    font-family: 'Courier New', monospace;
    margin: 0;
    padding: 20px;
    padding-bottom: 50px; /* Add padding to prevent content from being hidden behind footer */
    background-color: #121212;
    color: #333;
    touch-action: manipulation; /* Prevents double-tap to zoom on iOS */
    -webkit-touch-callout: none; /* Prevents callout to copy image, etc when tap to hold */
    -webkit-tap-highlight-color: transparent; /* Removes the tap highlight */
}

.container {
    max-width: 600px;
    min-width: 400px; /* Slightly reduced minimum width */
    margin: 0 auto;
    background-color: #ffffff;
    padding: clamp(15px, 3vw, 25px); /* Responsive padding that scales with viewport */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    width: 100%; /* Ensure it takes full width up to max-width */
    box-sizing: border-box; /* Include padding in width calculation */
}

h1 {
    text-align: center;
    color: #555555;
    margin-bottom: clamp(15px, 4vw, 25px);
    font-size: clamp(1.8em, 5vw, 2.5em); /* Responsive font size */
}

.currency-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: clamp(15px, 3vw, 20px);
    font-size: clamp(1em, 3vw, 1.2em); /* Responsive font size */
}

.currency-item {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 120px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.currency-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.currency-rate, .currency-click {
    font-size: 0.9em;
    color: #666;
}

.click-button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: clamp(15px, 4vw, 25px) auto;
    padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 30px);
    font-size: clamp(1.1em, 3vw, 1.5em);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    height: auto; /* Let height be determined by content and padding */
    min-height: clamp(40px, 8vw, 50px);
    touch-action: manipulation; /* Prevents double-tap to zoom on iOS */
    -webkit-user-select: none; /* Safari */
    user-select: none; /* Standard syntax */
}

.click-button:hover {
    background-color: #0d8bf2;
}

.click-button:active {
    transform: scale(0.95);
}

.upgrades {
    margin-top: 30px;
}

.upgrades ul {
    list-style: none;
    padding: 0;
}

.upgrade-header {
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 20px;
    margin-bottom: 10px;
    padding: 5px;
    background-color: #e0e0e0;
    border-radius: 5px;
    text-align: center;
    color: #333;
}

.upgrades li {
    margin: clamp(8px, 2vw, 12px) 0;
    padding: clamp(8px, 2vw, 12px);
    background-color: #f5f5f5;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: clamp(5px, 1.5vw, 10px);
    border: 1px solid #e0e0e0;
}

.upgrade-container {
    display: flex;
    width: 100%;
    /* Base styles for all screen sizes - other properties handled in media queries */
}

.upgrade-stats {
    display: grid;
    grid-template-columns: minmax(60px, 1fr) auto auto minmax(60px, 1fr);
    gap: clamp(5px, 1.5vw, 10px);
    align-items: center;
    width: 100%;
}

.upgrade-rate {
    text-align: left;
    justify-self: start;
}

.upgrade-count {
    text-align: center;
    justify-self: center;
}

.upgrade-equals {
    text-align: center;
    justify-self: center;
}

.upgrade-total {
    text-align: right;
    justify-self: end;
    font-weight: bold;
    color: #0066cc;
}

.upgrade-btn {
    padding: clamp(6px, 1.5vw, 10px) clamp(10px, 2vw, 15px);
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.8em, 2vw, 0.95em);
    /* Width handled in media queries */
    font-family: 'Courier New', monospace;
    transition: all 0.2s ease;
    touch-action: manipulation; /* Prevents double-tap to zoom on iOS */
    -webkit-user-select: none; /* Safari */
    user-select: none; /* Standard syntax */
}

.upgrade-btn:hover {
    background-color: #45a049;
    transform: scale(1.03);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.upgrade-btn:active {
    transform: scale(0.97);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.upgrade-btn:disabled {
    background-color: #888888;
    cursor: not-allowed;
}

.upgrade-cost {
    color: rgba(255, 255, 255, 0.7); /* Subtle darker color for the cost */
}

.footer {
    text-align: center;
    color: #666666;
    font-size: 0.8em;
    padding: 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #121212;
    display: flex;
    justify-content: center;
    align-items: center;
}

.reset-button {
    position: absolute;
    left: 15px;
    background: none;
    border: none;
    color: #666666;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.reset-button:hover {
    opacity: 1;
}

/* Ensure all interactive elements prevent double-tap zoom */
button,
.click-button,
.upgrade-btn,
.reset-button {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

/* Floating currency animation */
.floating-currency {
    position: absolute;
    color: #4CAF50;
    font-weight: bold;
    font-size: 1.2rem;
    pointer-events: none;
    opacity: 0;
    z-index: 100;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    animation: float-up 1.5s ease-out forwards;
    white-space: nowrap; /* Keep text on one line */
}

@keyframes float-up {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.8);
    }
    10% {
        opacity: 1;
        transform: translateY(-10px) scale(1.1);
    }
    20% {
        transform: translateY(-20px) scale(1);
    }
    80% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.9);
    }
}

/* Mobile optimization for floating currency */
@media screen and (max-width: 480px) {
    .floating-currency {
        font-size: 1rem;
    }
}

/* Media Queries for Responsive Design - Simplified to 2 breakpoints */

/* Desktop and Tablet */
@media screen and (min-width: 481px) {
    .container {
        max-width: 960px;
    }
    
    .upgrade-container {
        flex-direction: row;
        align-items: center;
        gap: 15px;
    }
    
    .upgrade-btn {
        min-width: 180px;
    }
}

/* Mobile devices */
@media screen and (max-width: 480px) {
    body {
        padding: 10px;
        padding-bottom: 50px;
    }
    
    /* Stack button and stats vertically on mobile */
    .upgrade-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .upgrade-btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Adjust grid for mobile */
    .upgrade-stats {
        font-size: 0.9em;
        gap: 3px;
    }
    
    .upgrade-rate, .upgrade-count, .upgrade-equals, .upgrade-total {
        white-space: nowrap;
        text-align: center;
    }
}
