* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Header */
.game-header {
    text-align: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid #00ffff;
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
    flex-shrink: 0;
    z-index: 10;
}

.game-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 3px;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #ff00cc, #00ffff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(255, 0, 204, 0.5);
}

.remastered {
    font-size: 1.5rem;
    vertical-align: top;
    color: #ffcc00;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
}

.subtitle {
    font-size: 0.9rem;
    color: #aaa;
    letter-spacing: 2px;
    font-style: italic;
}

/* Screens */
.screen {
    display: none;
    flex: 1;
    overflow: auto;
    padding: 20px;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen-content {
    background: rgba(0, 0, 30, 0.85);
    border-radius: 20px;
    padding: 30px;
    max-width: 900px;
    width: 90%;
    text-align: center;
    border: 2px solid #00aaff;
    box-shadow: 0 10px 30px rgba(0, 170, 255, 0.3);
    backdrop-filter: blur(10px);
    margin: auto;
}

/* Start Screen */
.mode-selection {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.mode-option {
    background: rgba(20, 20, 60, 0.7);
    border-radius: 15px;
    padding: 20px;
    width: 220px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mode-option:hover, .mode-option.selected {
    border-color: #00ffff;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 255, 255, 0.3);
    background: rgba(30, 30, 80, 0.9);
}

.mode-option i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #00ffff;
}

.mode-option h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #fff;
}

.mode-option p {
    color: #aaa;
    font-size: 0.9rem;
}

.difficulty-selection {
    margin: 30px 0;
}

.difficulty-selection h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: #ffcc00;
}

.difficulty-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.diff-option {
    padding: 10px 20px;
    background: rgba(40, 40, 80, 0.7);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    border: 2px solid transparent;
    min-width: 80px;
}

.diff-option:hover, .diff-option.active {
    transform: scale(1.05);
}

.diff-option[data-diff="easy"]:hover, 
.diff-option[data-diff="easy"].active {
    background: rgba(0, 200, 0, 0.8);
    border-color: #00ff00;
}

.diff-option[data-diff="medium"]:hover, 
.diff-option[data-diff="medium"].active {
    background: rgba(255, 165, 0, 0.8);
    border-color: #ffa500;
}

.diff-option[data-diff="hard"]:hover, 
.diff-option[data-diff="hard"].active {
    background: rgba(255, 50, 50, 0.8);
    border-color: #ff3232;
}

.diff-option[data-diff="expert"]:hover, 
.diff-option[data-diff="expert"].active {
    background: rgba(180, 0, 180, 0.8);
    border-color: #b400b4;
}

.controls-info {
    margin: 30px 0;
    background: rgba(30, 30, 60, 0.5);
    padding: 20px;
    border-radius: 15px;
}

.controls-info h3 {
    margin-bottom: 15px;
    color: #00aaff;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 350px;
    margin: 0 auto;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(50, 50, 100, 0.5);
    padding: 10px 15px;
    border-radius: 8px;
}

.key {
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
    font-family: 'Orbitron', sans-serif;
    color: #00ffff;
    border: 1px solid #00ffff;
    font-size: 0.9rem;
}

.action {
    color: #ddd;
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary, .btn-secondary, .control-btn {
    padding: 12px 25px;
    font-size: 1.1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    margin: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(90deg, #ff00cc, #00aaff);
    color: white;
    box-shadow: 0 5px 15px rgba(255, 0, 204, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 0, 204, 0.6);
}

.btn-secondary {
    background: rgba(60, 60, 100, 0.8);
    color: white;
    border: 2px solid #00aaff;
}

.btn-secondary:hover {
    background: rgba(80, 80, 120, 0.9);
    transform: translateY(-3px);
}

.control-btn {
    background: rgba(40, 40, 80, 0.8);
    color: white;
    border: 2px solid #00ffff;
    font-size: 0.9rem;
    padding: 10px 15px;
    margin: 5px;
}

.control-btn:hover {
    background: rgba(60, 60, 100, 0.9);
    transform: translateY(-2px);
}

.device-warning {
    margin-top: 20px;
    padding: 12px;
    background: rgba(255, 100, 0, 0.2);
    border-radius: 10px;
    border: 1px solid #ff6400;
    color: #ffcc99;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

/* Game Screen Layout */
#game-screen {
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow: hidden;
}

#game-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.players-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
    padding: 10px;
    gap: 20px;
    min-height: 0;
    overflow: auto;
}

.player-container {
    background: rgba(0, 0, 30, 0.8);
    border-radius: 15px;
    padding: 15px;
    border: 3px solid #00aaff;
    box-shadow: 0 10px 25px rgba(0, 170, 255, 0.3);
    min-width: 350px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #00ffff;
}

.player-header h3 {
    font-family: 'Orbitron', sans-serif;
    color: #00ffff;
    font-size: 1.3rem;
}

.player-controls {
    background: rgba(0, 100, 200, 0.3);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: #aaddff;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.info-box {
    background: rgba(20, 20, 60, 0.8);
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    flex: 1;
    margin: 0 3px;
    border: 1px solid #5555ff;
}

.info-label {
    display: block;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 3px;
}

.info-value {
    display: block;
    font-size: 1.7rem;
    font-family: 'Orbitron', sans-serif;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.game-board-container {
    display: flex;
    gap: 15px;
    flex: 1;
    min-height: 0;
}

.game-board {
    background-color: rgba(0, 0, 20, 0.9);
    border-radius: 5px;
    border: 3px solid #5555ff;
    box-shadow: inset 0 0 20px rgba(0, 0, 50, 0.8);
    flex-shrink: 0;
}

.next-block-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.next-label {
    background: rgba(0, 50, 100, 0.8);
    padding: 6px 12px;
    border-radius: 10px 10px 0 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: #00ffff;
    width: 100%;
    text-align: center;
}

.next-block {
    background: rgba(0, 0, 30, 0.8);
    border-radius: 0 0 10px 10px;
    border: 2px solid #5555ff;
    border-top: none;
    flex-shrink: 0;
}

#multiplayer-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    flex-shrink: 0;
}

.vs-circle {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #ff00cc, #00aaff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 204, 0.7);
    border: 3px solid white;
}

/* Game Controls - Positioned at bottom */
#game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 20, 0.7);
    border-top: 2px solid #00ffff;
    margin-top: 10px;
    flex-shrink: 0;
}

/* Mobile Controls - Only shown during gameplay */
#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 30, 0.95);
    padding: 15px;
    z-index: 100;
    border-top: 2px solid #00ffff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-controls-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    width: 100%;
}

.mobile-row {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mobile-btn {
    background: rgba(50, 50, 100, 0.9);
    border: 2px solid #00aaff;
    color: white;
    font-size: 1.2rem;
    padding: 15px;
    border-radius: 15px;
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 70px;
    transition: all 0.2s;
    touch-action: manipulation;
}

.mobile-btn:active {
    background: rgba(80, 80, 150, 0.9);
    transform: scale(0.95);
}

.rotate-btn {
    background: linear-gradient(135deg, #ff00cc, #00aaff);
}

.wide-btn {
    flex: 2;
    font-size: 1.1rem;
}

/* Game Over Screen */
#game-over-title {
    font-size: 2.5rem;
    color: #ff3333;
    text-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
    margin-bottom: 20px;
}

.winner-text {
    font-size: 2rem;
    color: #ffcc00;
    text-shadow: 0 0 15px rgba(255, 204, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.final-scores {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.final-score {
    background: rgba(20, 20, 60, 0.8);
    border-radius: 15px;
    padding: 20px;
    width: 220px;
    border: 3px solid;
}

.player1-score {
    border-color: #00ffff;
}

.player2-score {
    border-color: #ff00cc;
}

.final-score h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #fff;
}

.score-value {
    font-size: 2.5rem;
    font-family: 'Orbitron', sans-serif;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.7);
    margin-bottom: 10px;
}

.score-details {
    background: rgba(0, 0, 30, 0.5);
    padding: 12px;
    border-radius: 10px;
    text-align: left;
    font-size: 1rem;
}

.score-details div {
    margin: 5px 0;
}

.score-details span {
    color: #00ffff;
    font-weight: bold;
}

.action-buttons {
    margin-top: 20px;
}

/* Notification */
.notification {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 30px;
    border-radius: 10px;
    border: 2px solid #00ffff;
    color: #00ffff;
    font-size: 1.2rem;
    font-family: 'Orbitron', sans-serif;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0, 255, 255, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .players-container {
        flex-wrap: wrap;
    }
    
    .player-container {
        min-width: 320px;
    }
    
    #multiplayer-divider {
        width: 100%;
        height: 50px;
        margin: 10px 0;
    }
    
    .vs-circle {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: 2rem;
    }
    
    .remastered {
        font-size: 1.2rem;
    }
    
    .screen {
        padding: 10px;
    }
    
    .screen-content {
        padding: 20px;
        width: 95%;
    }
    
    .mode-selection {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-option {
        width: 100%;
        max-width: 280px;
    }
    
    .difficulty-options {
        flex-wrap: wrap;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
        max-width: 280px;
    }
    
    .player-container {
        min-width: 280px;
        padding: 12px;
    }
    
    .game-board {
        width: 240px !important;
        height: 480px !important;
    }
    
    .next-block {
        width: 90px !important;
        height: 90px !important;
    }
    
    .mobile-btn {
        min-height: 60px;
        font-size: 1rem;
        padding: 12px;
    }
    
    #game-controls {
        padding: 10px;
        gap: 10px;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    #game-over-title {
        font-size: 2rem;
    }
    
    .winner-text {
        font-size: 1.5rem;
    }
    
    .final-score {
        width: 100%;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 10px 15px;
    }
    
    .game-header h1 {
        font-size: 1.7rem;
    }
    
    .remastered {
        font-size: 1rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
    
    .mode-option h3 {
        font-size: 1.3rem;
    }
    
    .player-container {
        min-width: 260px;
    }
    
    .game-board {
        width: 220px !important;
        height: 440px !important;
    }
    
    .next-block {
        width: 80px !important;
        height: 80px !important;
    }
    
    .info-value {
        font-size: 1.5rem;
    }
    
    .mobile-btn {
        min-height: 55px;
        font-size: 0.9rem;
    }
    
    .notification {
        font-size: 1rem;
        padding: 12px 24px;
        top: 80px;
    }
}

/* Prevent body scroll on mobile */
body.mobile-active {
    overflow: hidden;
    height: 100vh;
}

/* Ensure game area doesn't overflow */
#game-screen.active {
    overflow: hidden;
}

/* Make sure mobile controls don't show on start screen */
#start-screen.active ~ #mobile-controls {
    display: none !important;
}
