:root {
    --bg-color: #121212;
    --text-color: #f5f5f5;
    --primary-color: #8e44ad;
    --primary-color-light: #9b59b6;
    --grid-size: 5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2 {
    text-align: center;
    margin-bottom: 20px;
}

p {
    margin-bottom: 15px;
    text-align: center;
}

.btn {
    background-color: var(--primary-color);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    margin: 10px 5px;
    transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
    background-color: var(--primary-color-light);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* Mode selection styles */
.mode-selection {
    margin: 15px 0;
    width: 100%;
    text-align: center;
}

.mode-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.mode-btn {
    background-color: #2c2c2c;
    padding: 8px 16px;
    font-weight: bold;
}

.mode-btn:hover {
    background-color: var(--primary-color-light);
}

.mode-selected {
    background-color: var(--primary-color);
    border: 2px solid white;
}

.game-section {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hidden {
    display: none;
}

/* Grid container with labels */
.grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    width: 100%;
    max-width: 440px;
}

.grid-labels-row {
    display: grid;
    grid-template-columns: 40px repeat(var(--grid-size), 1fr);
    width: 100%;
    gap: 4px;
    margin-bottom: 4px;
}

.grid-with-labels {
    display: flex;
    width: 100%;
}

.grid-labels-col {
    display: grid;
    grid-template-rows: repeat(var(--grid-size), 1fr);
    gap: 4px;
    margin-right: 4px;
    width: 40px;
}

.col-label, .row-label {
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--text-color);
    font-size: 18px;
}

/* Make text smaller for 10x10 grid */
.grid-size-10 .col-label,
.grid-size-10 .row-label {
    font-size: 14px;
}

.empty-corner {
    width: 40px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-size), 1fr);
    grid-template-rows: repeat(var(--grid-size), 1fr);
    gap: 4px;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.grid-size-10 .grid-cell {
    border-radius: 3px;
}

.grid-cell {
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.grid-cell:hover {
    transform: scale(1.05);
    z-index: 1;
}

.grid-size-10 .grid-cell:hover {
    transform: scale(1.1);
}

.grid-cell.target {
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.grid-size-10 .grid-cell.target {
    border-width: 2px;
}

.grid-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
}

#target-cell {
    width: 60px;
    height: 60px;
    margin: 20px;
    border-radius: 6px;
}

#target-coords {
    font-size: 24px;
    font-weight: bold;
}

#guessing-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-input {
    display: flex;
    align-items: center;
    margin: 10px 0;
    width: 100%;
    justify-content: center;
}

.player-input label {
    margin-right: 10px;
    font-weight: bold;
}

.player-input input {
    background-color: #2c2c2c;
    border: 1px solid #444;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 16px;
    text-transform: uppercase;
    width: 80px;
    text-align: center;
}

.results-item {
    margin: 5px 0;
    padding: 10px;
    border-radius: 8px;
    background-color: #2c2c2c;
    width: 100%;
    text-align: center;
}

.correct {
    border-left: 4px solid #27ae60;
}

.incorrect {
    border-left: 4px solid #e74c3c;
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .grid-container {
        max-width: 340px;
    }
    
    .col-label, .row-label {
        font-size: 16px;
    }
    
    .grid-size-10 .col-label,
    .grid-size-10 .row-label {
        font-size: 12px;
    }
    
    .grid-labels-row {
        grid-template-columns: 30px repeat(var(--grid-size), 1fr);
    }
    
    .grid-labels-col {
        width: 30px;
    }
    
    .empty-corner {
        width: 30px;
    }
}

.word-input-container {
    margin: 20px 0;
    text-align: center;
}

#color-word {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #ccc;
    border-radius: 5px;
    width: 80%;
    max-width: 300px;
    text-align: center;
}

#color-word:focus {
    outline: none;
    border-color: #007bff;
}

.displayed-word {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin: 15px 0;
    color: var(--text-color);
    font-style: italic;
}

.tournament-return-button {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.tournament-return-button:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tournament-return-button.hidden {
    display: none;
}

.btn-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
}