/* General Styles */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #ecf0f1;
    --text-color: #2c3e50;
    --board-border-color: #34495e;
    --grid-line-color: rgba(189, 195, 199, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    /* Tetromino Colors */
    --i-piece-color: #00bcd4; /* I - Cyan */
    --j-piece-color: #2962ff; /* J - Blue */
    --l-piece-color: #ff9800; /* L - Orange */
    --o-piece-color: #ffeb3b; /* O - Yellow */
    --s-piece-color: #4caf50; /* S - Green */
    --t-piece-color: #9c27b0; /* T - Purple */
    --z-piece-color: #f44336; /* Z - Red */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tetris-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-top: 60px; /* Space for the header */
}

/* Screen Management */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--shadow-color);
    padding: 30px;
}

.screen.active {
    display: flex;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Main Menu */
.menu-options {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 300px;
}

.menu-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 15px 20px;
    margin: 10px 0;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.menu-button:hover {
    background-color: #2980b9;
}

.menu-button:active {
    transform: scale(0.98);
}

.game-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    margin: 5px 0;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
}

.game-button:hover {
    background-color: #2980b9;
}

/* Game Screen */
.game-area {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

#tetris-board {
    width: 300px;
    height: 600px;
    background-color: #f8f9fa;
    border: 2px solid var(--board-border-color);
    display: grid;
    grid-template-rows: repeat(20, 1fr);
    grid-template-columns: repeat(10, 1fr);
    position: relative;
}

.game-cell {
    border: 1px solid var(--grid-line-color);
    box-sizing: border-box;
}

.game-info {
    display: flex;
    flex-direction: column;
    width: 200px;
    background-color: #f8f9fa;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.next-piece-container, .score-container, .level-container, .lines-container, .difficulty-container {
    margin-bottom: 15px;
    text-align: center;
}

#next-piece {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    display: grid;
    grid-template-rows: repeat(4, 1fr);
    grid-template-columns: repeat(4, 1fr);
    background-color: #f8f9fa;
    border: 1px solid var(--grid-line-color);
}

#score, #level, #lines, #difficulty {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Tetromino Styles */
.tetromino {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.tetromino.i-piece {
    background-color: var(--i-piece-color);
}

.tetromino.j-piece {
    background-color: var(--j-piece-color);
}

.tetromino.l-piece {
    background-color: var(--l-piece-color);
}

.tetromino.o-piece {
    background-color: var(--o-piece-color);
}

.tetromino.s-piece {
    background-color: var(--s-piece-color);
}

.tetromino.t-piece {
    background-color: var(--t-piece-color);
}

.tetromino.z-piece {
    background-color: var(--z-piece-color);
}

.tetromino.ghost {
    background-color: rgba(189, 195, 199, 0.5);
    border: 1px dashed rgba(0, 0, 0, 0.2);
}

/* High Scores Screen */
.difficulty-tabs {
    display: flex;
    margin-bottom: 20px;
    width: 100%;
    justify-content: center;
}

.tab-button {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tab-button:first-child {
    border-radius: 5px 0 0 5px;
}

.tab-button:last-child {
    border-radius: 0 5px 5px 0;
}

.tab-button.active {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.scores-container {
    width: 100%;
    max-width: 600px;
}

.scores-list {
    display: none;
    width: 100%;
}

.scores-list.active {
    display: block;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

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

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

.empty-scores {
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Settings Screen */
.settings-container {
    width: 100%;
    max-width: 500px;
}

.difficulty-setting, .controls-setting {
    margin-bottom: 30px;
    width: 100%;
}

.radio-group {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.radio-group label:hover {
    background-color: #e9ecef;
}

.radio-group input[type="radio"] {
    margin-right: 8px;
}

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

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.control-label {
    font-weight: bold;
}

.key-binding {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 8px 12px;
    min-width: 100px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.key-binding:hover {
    background-color: #e9ecef;
}

.settings-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    margin-top: 20px;
}

/* Modal for Key Binding */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

/* Game Over Screen */
.game-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 300px;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.stat-label {
    font-weight: bold;
}

.stat-value {
    font-size: 18px;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 300px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-area {
        flex-direction: column-reverse;
        align-items: center;
    }

    #tetris-board {
        width: 250px;
        height: 500px;
    }

    .game-info {
        width: 250px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        margin-top: 20px;
    }

    .next-piece-container {
        width: 100%;
    }

    .score-container, .level-container, .lines-container, .difficulty-container {
        width: 45%;
    }

    .game-button {
        width: 45%;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .settings-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .tetris-container {
        padding: 10px;
    }

    .screen {
        padding: 20px;
    }

    #tetris-board {
        width: 200px;
        height: 400px;
    }

    .game-info {
        width: 200px;
    }

    .score-container, .level-container, .lines-container, .difficulty-container {
        width: 100%;
    }

    .game-button {
        width: 100%;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px 5px;
    }
} 