* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none; /* Prevent text selection across the site */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
}

/* Main content */
main {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 1000px) {
    .game-content {
        grid-template-columns: 1fr;
    }
}

/* Stats Panel */
.stats-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.points-container {
    text-align: center;
    margin-bottom: 1rem;
}

#points {
    font-size: 3rem;
    font-weight: bold;
    color: #2c3e50;
}

#points-label {
    font-size: 1.2rem;
    color: #7f8c8d;
}

.rates {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.rate {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.rate img {
    width: 20px;
    height: 20px;
}

/* Clicker Container */
.clicker-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

#main-clicker {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: #3498db;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.5);
    position: relative;
    transition: transform 0.1s, box-shadow 0.1s;
}

#main-clicker:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.6);
}

#main-clicker:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.4);
}

.click-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    opacity: 0;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 0.5;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Shop Panel */
.shop-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 500px;
}

.shop-panel h2 {
    margin-bottom: 1rem;
    text-align: center;
}

#shop-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.shop-item:hover {
    transform: translateY(-2px);
    background: #e9ecef;
}

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

.shop-item-title {
    font-weight: bold;
    font-size: 1rem;
}

.shop-item-count {
    background: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.shop-item-description {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.shop-item-price {
    background: #2ecc71;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
    margin-top: 5px;
}

.shop-item.unaffordable .shop-item-price {
    background: #e74c3c;
}

/* Leaderboard Container */
.leaderboard-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.leaderboard-container h2 {
    margin-bottom: 1rem;
    text-align: center;
}

#leaderboard {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.leaderboard-row {
    cursor: pointer;
    transition: background 0.2s;
}

.leaderboard-row:hover {
    background-color: #f5f5f5;
}

.leaderboard-row.current-user {
    background-color: rgba(52, 152, 219, 0.1);
}

/* Modal */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #333;
}

/* Initial setup modal */
#initial-setup textarea {
    width: 100%;
    height: 100px;
    padding: 10px;
    margin: 15px 0;
    border-radius: 4px;
    border: 1px solid #ddd;
    resize: vertical;
}

#start-game {
    background: #3498db;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    transition: background 0.2s;
}

#start-game:hover {
    background: #2980b9;
}

#loading-indicator {
    margin-top: 20px;
    text-align: center;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal content for player details */
.modal-stats {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.modal-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.modal-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
}

.modal-item span {
    font-weight: bold;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animation for point gain */
@keyframes float-up {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-50px);
    }
}

.point-gain {
    position: absolute;
    color: #2ecc71;
    font-weight: bold;
    animation: float-up 1.5s forwards;
    pointer-events: none;
}

/* Reset button */
.reset-button-container {
    text-align: center;
    margin-top: 20px;
    padding-bottom: 20px;
}

#reset-company {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

#reset-company:hover {
    background: #c0392b;
}

/* Confirmation dialog */
.confirm-dialog {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    text-align: center;
}

.confirm-dialog p {
    margin-bottom: 20px;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.confirm-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.confirm-yes {
    background: #e74c3c;
    color: white;
}

.confirm-no {
    background: #7f8c8d;
    color: white;
}