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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
}

body {
    background: #2c3e50;
}

.container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 2.2em;
}

.puzzle-name {
    text-align: center;
    color: #666;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: normal;
}

.instructions {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.game-board {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 600px;
}

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

.grid.size-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cell {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 150px;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
}

.cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.cell.unknown {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.cell.truth-teller {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.cell.mimic {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.cell.correct {
    animation: correctPulse 0.6s ease-in-out;
}

.cell.incorrect {
    animation: incorrectShake 0.6s ease-in-out;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.character {
    font-size: 2em;
    margin-bottom: 4px;
}

.character-name {
    font-size: 0.75em;
    font-weight: bold;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statement {
    font-size: 0.85em;
    line-height: 1.5;
    font-style: normal;
    font-weight: 600;
    color: #333;
    flex-grow: 1;
    display: flex;
    align-items: center;
    text-align: center;
    hyphens: auto;
    word-wrap: break-word;
}

.statement.multiple-statements {
    text-align: left;
    padding-left: 10px;
    padding-right: 10px;
}

.statement.neutral-quote {
    font-style: italic;
    font-weight: normal;
    color: #888;
    font-size: 0.8em;
}

.cell.truth-teller .statement:not(.neutral-quote) {
    color: #155724;
}

.cell.mimic .statement:not(.neutral-quote) {
    color: #721c24;
}

.cell.truth-teller .character-name {
    color: #155724;
}

.cell.mimic .character-name {
    color: #721c24;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.feedback {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.feedback.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.feedback.hidden {
    display: none;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #666;
}

.cell-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid;
}

.cell-preview.unknown {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.cell-preview.truth-teller {
    background: #d4edda;
    border-color: #28a745;
}

.cell-preview.mimic {
    background: #f8d7da;
    border-color: #dc3545;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .grid {
        max-width: 100%;
    }
    
    .cell {
        min-height: 100px;
        padding: 10px;
    }
    
    .character {
        font-size: 1.5em;
    }
    
    .statement {
        font-size: 0.8em;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }
}