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

body {
    font-family: Arial, sans-serif;
    background-color: #261B13;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 1200px;
    background-color: #261B13;
    border-radius: 10px;
    overflow: hidden;
}

/* Header */
.game-header {
    text-align: center;
    padding: 20px;
    background-color: #1a1108;
}

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    color: #caab95;
}

.subtitle {
    font-size: 1em;
    color: #888;
    font-style: italic;
}

/* Game Board */
.game-board {
    padding: 20px;
}

/* Tiles Container */
.tiles-container {
    margin-bottom: 20px;
}

.tile-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 8px;
    margin: 0 auto;
    max-width: 1100px;
}

.tile {
    aspect-ratio: 3/5;
    background-color: #B8956A;
    border: 3px solid #8B7355;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    color: #1A1A1A;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.tile:hover:not(.tile-disabled) {
    background-color: #D4A574;
    transform: translateY(-2px);
}

.tile.selected {
    background-color: #FFA500;
    transform: scale(0.95);
}

.tile.tile-disabled {
    background-color: #6B5D4F;
    cursor: not-allowed;
    opacity: 0.6;
}

.tile.hidden {
    visibility: hidden;
    pointer-events: none;
}

.separator-bar {
    height: 15px;
    background-color: #caab95;
    margin: 10px auto;
    border-radius: 3px;
    max-width: 1100px;
}

/* Bottom Section */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    gap: 20px;
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
}

.left-controls,
.right-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
}

.game-btn {
    padding: 12px 20px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    text-transform: uppercase;
}

.end-turn-btn,
.new-game-btn,
.mode-btn {
    background-color: #8B4513;
    min-height: 45px;
}

.end-turn-btn:hover,
.new-game-btn:hover,
.mode-btn:hover {
    background-color: #A0522D;
    transform: translateY(-1px);
}

.game-btn:active {
    transform: translateY(1px);
}

/* Dice Area */
.dice-area {
    background-color: #247345;
    border: 3px solid #1a5a35;
    border-radius: 10px;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dice-container {
    display: flex;
    gap: 30px;
}

.die {
    width: 80px;
    height: 80px;
    background-color: white;
    border: 3px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.die-face {
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    padding: 8px;
    position: relative;
}

.pip {
    width: 12px;
    height: 12px;
    background-color: black;
    border-radius: 50%;
    position: absolute;
}

/* Status Bar */
.status-bar {
    background-color: #1a1a1a;
    padding: 15px 20px;
    margin-top: 20px;
}

.status-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.mode-indicators {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
}

.label {
    font-weight: bold;
    color: #ccc;
}

.separator {
    margin: 0 5px;
}

.mode-value {
    font-weight: bold;
    color: #4CAF50;
}

.mode-value.open-close {
    color: #2196F3;
}

.player-mode-value {
    font-weight: bold;
    color: #FF9800;
}

.player-scores {
    display: flex;
    gap: 30px;
}

.player-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-name {
    font-weight: bold;
    font-size: 1em;
}

.score-value {
    font-weight: bold;
    font-size: 1.1em;
    color: white;
}

.score-value.active {
    color: #FFA500;
}

.score-value.winner {
    color: #4CAF50;
}

.control-buttons {
    display: flex;
    gap: 8px;
}

.status-btn {
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.players-btn {
    background-color: #FF9800;
}

.players-btn:hover {
    background-color: #F57C00;
}

.rules-btn {
    background-color: #9C27B0;
}

.rules-btn:hover {
    background-color: #7B1FA2;
}

.feedback-btn {
    background-color: #00BCD4;
}

.feedback-btn:hover {
    background-color: #0097A7;
}

.roll-btn {
    background-color: #2196F3;
}

.roll-btn:hover {
    background-color: #1976D2;
}

.status-bottom-row {
    text-align: center;
}

.message {
    color: #FFEB3B;
    font-size: 1em;
    margin: 0;
}

.message.success {
    color: #4CAF50;
}

.message.error {
    color: #FF5252;
}

.message.info {
    color: #2196F3;
}

.message.warning {
    color: #FF9800;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #2b2b2b;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.rules-content {
    max-width: 700px;
}

.feedback-content {
    max-width: 600px;
}

.modal-content h2 {
    color: #caab95;
    margin-bottom: 20px;
    text-align: center;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #ccc;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #555;
    border-radius: 5px;
    background-color: #1a1a1a;
    color: white;
    font-size: 1em;
    font-family: Arial, sans-serif;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

.mode-selector {
    display: flex;
    gap: 10px;
}

.mode-option {
    flex: 1;
    padding: 12px;
    background-color: #555;
    border: 2px solid #666;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-option:hover {
    background-color: #666;
}

.mode-option.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.modal-btn {
    width: 100%;
    padding: 15px;
    background-color: #4CAF50;
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

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

.modal-btn.secondary {
    background-color: #666;
}

.modal-btn.secondary:hover {
    background-color: #777;
}

.rules-mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.rules-mode-btn {
    flex: 1;
    padding: 10px;
    background-color: #555;
    border: 2px solid #666;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rules-mode-btn:hover {
    background-color: #666;
}

.rules-mode-btn.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.rules-text {
    background-color: #1a1a1a;
    padding: 20px;
    border-radius: 5px;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    color: #ddd;
    white-space: pre-wrap;
}

.feedback-description {
    color: #ccc;
    margin-bottom: 20px;
    text-align: center;
}

.feedback-buttons {
    display: flex;
    gap: 10px;
}

.feedback-buttons .modal-btn {
    width: auto;
    flex: 1;
}

.feedback-info {
    text-align: center;
    color: #888;
    font-size: 0.9em;
    margin-top: 15px;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tile {
        font-size: 1.5em;
    }

    .bottom-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .left-controls,
    .right-controls {
        flex-direction: row;
        justify-content: center;
    }

    .dice-area {
        order: -1;
    }
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: 2em;
    }

    .tile {
        font-size: 1.2em;
        border-width: 2px;
    }

    .tile-row {
        gap: 4px;
    }

    .die {
        width: 60px;
        height: 60px;
    }

    .status-top-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .control-buttons {
        width: 100%;
        flex-wrap: wrap;
    }

    .status-btn {
        flex: 1;
        min-width: 80px;
    }

    .player-scores {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .game-header h1 {
        font-size: 1.5em;
    }

    .tile {
        font-size: 1em;
    }

    .game-btn {
        font-size: 0.9em;
        padding: 10px 15px;
    }

    .modal-content {
        padding: 20px;
    }
}

/* Animation for tile flipping */
@keyframes flipDown {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.tile.flipping {
    animation: flipDown 0.3s ease;
}
