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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a1128 0%, #1e3c72 100%);
    color: #fff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Landing Screen */
#landingScreen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 20px;
    width: 100%;
}

.logo-main {
    font-size: clamp(32px, 10vw, 48px);
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 0 4px 8px rgba(0,0,0,0.3);
    margin-bottom: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.logo-main.gradient-logo {
    background: linear-gradient(135deg, #4CAF50, #2196F3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: clamp(16px, 5vw, 24px);
    font-weight: 300;
    letter-spacing: clamp(2px, 1vw, 4px);
    opacity: 0.9;
    word-wrap: break-word;
}

.landing-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 0 20px;
}

.tagline {
    font-size: 18px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.players-waiting {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.waiting-icon {
    font-size: 18px;
}

input[type="text"] {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    margin-bottom: 15px;
    background: rgba(255,255,255,0.9);
    color: #1e3c72;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    background: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 10px;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    background: transparent;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.8);
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Mode Selection */
.mode-selection {
    width: 100%;
    margin-bottom: 20px;
}

.mode-selection h3 {
    font-size: 16px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
    transform: scale(1.05);
}

.mode-btn.selected {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
    border-width: 3px;
}

.mode-icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.mode-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 3px;
}

.mode-time {
    font-size: 12px;
    opacity: 0.8;
}

/* Lobby Screen */
#lobbyScreen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lobby-container {
    text-align: center;
}

.lobby-container h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

#lobbyStatus {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.loader {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Countdown Screen */
#countdownScreen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.countdown-container {
    text-align: center;
}

.countdown-number {
    font-size: 120px;
    font-weight: 900;
    margin: 30px 0;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.players-list {
    font-size: 16px;
    opacity: 0.9;
}

/* Game Screen */
#gameScreen {
    padding: 10px;
    overflow-y: auto;
}

/* News Ticker */
.news-ticker {
    background: linear-gradient(90deg, #ff6b6b 0%, #f44336 100%);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    animation: newsSlide 0.5s ease-out;
}

.news-ticker.positive {
    background: linear-gradient(90deg, #51cf66 0%, #4CAF50 100%);
}

@keyframes newsSlide {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.news-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.news-icon {
    font-size: 20px;
}

/* Power-ups */
.powerups-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.powerup-btn {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(138, 43, 226, 0.3);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.powerup-btn:hover:not(:disabled) {
    background: rgba(138, 43, 226, 0.6);
    border-color: rgba(255,255,255,0.6);
    transform: scale(1.05);
}

.powerup-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.powerup-btn.active {
    background: rgba(138, 43, 226, 0.8);
    border-color: #ffd700;
    animation: powerupPulse 1s infinite;
}

@keyframes powerupPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
}

#gameScreen {
    padding: 10px;
    overflow-y: auto;
}

.game-header {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.game-branding {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.game-branding h1 {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 1px;
    margin: 0;
    background: linear-gradient(135deg, #4CAF50, #2196F3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.branding-sub {
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 2px;
    opacity: 0.8;
}

.timer-container {
    text-align: center;
}

.timer {
    font-size: 28px;
    font-weight: 900;
    color: #4CAF50;
}

.timer.warning {
    color: #ff9800;
}

.timer.danger {
    color: #f44336;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.5; }
}

.player-stats {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.stat {
    flex: 1;
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

/* Leaderboard */
.leaderboard {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.leaderboard h3 {
    font-size: 16px;
    margin-bottom: 10px;
    text-align: center;
    opacity: 0.9;
}

#leaderboardList {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    font-size: 14px;
}

.leaderboard-item.rank-1 {
    background: rgba(255, 215, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.leaderboard-item.rank-2 {
    background: rgba(192, 192, 192, 0.3);
    border: 1px solid rgba(192, 192, 192, 0.5);
}

.leaderboard-item.rank-3 {
    background: rgba(205, 127, 50, 0.3);
    border: 1px solid rgba(205, 127, 50, 0.5);
}

/* Stocks Container */
.stocks-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.stock-card {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 15px;
    position: relative;
}

.stock-card.frozen {
    border: 2px solid #00bcd4;
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.5);
}

.stock-card.pumped {
    border: 2px solid #ff9800;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5);
}

.stock-category {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.stock-category.tech {
    background: rgba(33, 150, 243, 0.8);
}

.stock-category.food {
    background: rgba(76, 175, 80, 0.8);
}

.stock-category.crypto {
    background: rgba(255, 152, 0, 0.8);
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stock-info h4 {
    font-size: 18px;
    margin-bottom: 3px;
}

.stock-name {
    font-size: 12px;
    opacity: 0.7;
}

.stock-price {
    text-align: right;
}

.price-value {
    font-size: 24px;
    font-weight: 700;
}

.price-change {
    font-size: 12px;
    margin-top: 3px;
}

.price-change.positive {
    color: #4CAF50;
}

.price-change.negative {
    color: #f44336;
}

.stock-chart {
    height: 60px;
    margin: 10px 0;
    position: relative;
}

.chart-line {
    width: 100%;
    height: 100%;
}

.stock-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.btn-buy, .btn-sell {
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-buy {
    background: #4CAF50;
    color: white;
}

.btn-buy:hover {
    background: #45a049;
}

.btn-buy:active {
    transform: scale(0.95);
}

.btn-sell {
    background: #f44336;
    color: white;
}

.btn-sell:hover {
    background: #da190b;
}

.btn-sell:active {
    transform: scale(0.95);
}

.btn-powerup-target {
    padding: 8px;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 8px;
    background: rgba(138, 43, 226, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    grid-column: 1 / -1;
}

.btn-powerup-target:hover {
    background: rgba(138, 43, 226, 0.4);
    border-color: rgba(255, 215, 0, 0.8);
}

.btn-powerup-target:active {
    transform: scale(0.95);
}

/* Holdings */
.holdings-container {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.holdings-container h3 {
    font-size: 16px;
    margin-bottom: 10px;
    opacity: 0.9;
}

#holdingsList {
    font-size: 14px;
}

.holding-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.holding-item:last-child {
    border-bottom: none;
}

/* Game Over Screen */
#gameOverScreen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.gameover-container {
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.gameover-container h1 {
    font-size: 48px;
    margin-bottom: 30px;
}

.final-leaderboard {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.final-rank {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 18px;
}

.final-rank.winner {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.8);
    font-size: 20px;
    font-weight: 700;
}

/* Responsive adjustments for larger screens */
@media (min-width: 768px) {
    #gameScreen {
        padding: 20px;
        max-width: 1200px;
        margin: 0 auto;
    }

    .stocks-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .logo-main {
        font-size: 72px;
    }

    .logo-sub {
        font-size: 32px;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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