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

body {
    font-family: "Open Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

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

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

h2 {
    color: #555;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.setup-section {
    margin-bottom: 25px;
}

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

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.radio-group label:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.radio-group input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.radio-group input[type="radio"]:checked + span,
.radio-group label:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background-color: #f0f4ff;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 5px;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.game-status {
    font-size: 1.1em;
    color: #666;
    text-align: center;
    flex: 1;
    min-height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-controls-top {
    display: flex;
    gap: 10px;
}

.puzzle-container {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    gap: 10px;
    margin: 20px 0;
    max-width: 100%;
    overflow: auto;
}

.col-clues {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-auto-flow: column;
    gap: 1px;
    background: #ddd;
    padding: 5px;
    border-radius: 5px;
}

.row-clues {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-auto-flow: row;
    gap: 1px;
    background: #ddd;
    padding: 5px;
    border-radius: 5px;
}

.game-board {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    gap: 1px;
    background: #333;
    border-radius: 5px;
    padding: 5px;
}

.clue-cell {
    background: #f8f9fa;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
    min-height: 25px;
    min-width: 25px;
    padding: 2px;
    text-align: center;
    line-height: 1.2;
}

.clue-cell.row-clue {
    justify-content: flex-end;
    padding-right: 8px;
}

.clue-cell.col-clue {
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 5px;
}

.cell {
    aspect-ratio: 1;
    background: white;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 25px;
    min-width: 25px;
    font-size: 1em;
    font-weight: bold;
    user-select: none;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cell.filled {
    background: #333;
    color: white;
}

.cell.marked {
    background: #f8f9fa;
    color: #e74c3c;
    font-size: 1.2em;
}

.cell.correct {
    background: #27ae60 !important;
    color: white;
}

.cell.incorrect {
    background: #e74c3c !important;
    color: white;
    animation: shake 0.5s ease-in-out;
}

.cell.solution {
    background: #f39c12 !important;
    color: white;
}

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

.game-controls {
    text-align: center;
    margin-top: 20px;
}

.info-sections {
    margin-top: 40px;
}

.collapsible-section {
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 5px solid #667eea;
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-section:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.section-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    transition: background-color 0.3s ease;
    user-select: none;
}

.section-header:hover {
    background: #e9ecef;
}

.section-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2em;
}

.toggle-icon {
    font-size: 1.2em;
    color: #667eea;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.section-content {
    padding: 0 20px 20px 20px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.section-content.collapsed {
    max-height: 0;
    padding: 0 20px;
}

.section-content ul {
    list-style-position: inside;
    color: #555;
    margin: 0;
}

.section-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.example {
    margin: 15px 0;
    padding: 15px;
    background: #e8f4fd;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.example p {
    margin: 0;
    color: #2c3e50;
    font-style: italic;
}

.reference {
    margin: 0;
}

.reference p {
    color: #666;
    font-size: 0.9em;
    margin: 0;
}

.reference a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.reference a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.section-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

.section-content strong {
    color: #333;
}

.completion-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.completion-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.completion-content h2 {
    color: #27ae60;
    margin-bottom: 20px;
    font-size: 2em;
}

.completion-content p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.2em;
    line-height: 1.4;
}

/* Grid size specific styles */
.grid-15 {
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
}

.grid-20 {
    grid-template-columns: repeat(20, 1fr);
    grid-template-rows: repeat(20, 1fr);
}

.clues-15 {
    grid-template-columns: repeat(15, 1fr);
}

.clues-20 {
    grid-template-columns: repeat(20, 1fr);
}

.row-clues-15 {
    grid-template-rows: repeat(15, 1fr);
}

.row-clues-20 {
    grid-template-rows: repeat(20, 1fr);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-info {
        flex-direction: column;
        text-align: center;
    }
    
    .game-controls-top {
        justify-content: center;
    }
    
    .puzzle-container {
        font-size: 0.8em;
    }
    
    .cell {
        min-height: 20px;
        min-width: 20px;
    }
    
    .clue-cell {
        min-height: 20px;
        min-width: 20px;
        font-size: 0.7em;
    }
    
    .radio-group {
        gap: 8px;
    }
    
    .radio-group label {
        padding: 8px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
        margin: 5px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .puzzle-container {
        font-size: 0.7em;
    }
    
    .cell {
        min-height: 18px;
        min-width: 18px;
    }
    
    .clue-cell {
        min-height: 18px;
        min-width: 18px;
        font-size: 0.6em;
    }
    
    .btn-secondary {
        padding: 8px 15px;
        font-size: 0.9em;
        margin: 3px;
    }
}
