* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Size Selection Styles */
.size-selection {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.size-selection h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.size-selection p {
    margin-bottom: 20px;
    color: #718096;
    font-size: 1.1rem;
}

.size-options, .custom-grid-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    justify-items: center;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 700px;
}

.size-btn, .custom-grid-btn {
    width: 100%;
    min-width: 0;
    height: 50px;
    padding: 0 10px;
    border: 2px solid #e2e8f0;
    background: #f7fafc;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    word-break: normal;
    text-align: center;
    box-sizing: border-box;
}

.size-btn:hover {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
    transform: translateY(-2px);
}

.custom-grid-btn:hover {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
    transform: translateY(-2px);
}

.custom-grids-section {
    border-top: 2px solid #e2e8f0;
    padding-top: 25px;
    margin-top: 25px;
}

.custom-grids-section h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.custom-grids-section p {
    color: #718096;
    margin-bottom: 15px;
    font-size: 1rem;
}

.full-tables-section {
    border-top: 2px solid #e2e8f0;
    padding-top: 25px;
    margin-top: 25px;
}

.full-tables-section h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.full-tables-section p {
    color: #718096;
    margin-bottom: 15px;
    font-size: 1rem;
}

.grid-container {
    overflow-x: auto;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.multiplication-grid {
    display: inline-grid;
    gap: 2px;
    background: #e2e8f0;
    border: 3px solid #4a5568;
    border-radius: 10px;
    padding: 3px;
}

.grid-cell {
    background: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 60px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.grid-cell.header {
    background: #4299e1;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
}

.grid-cell.header.selected {
    background: #8b5cf6;
    color: white;
    box-shadow: 0 0 0 2px #6d28d9;
}

.grid-cell.input-cell {
    background: #f0fff4;
    border: 2px solid #c6f6d5;
}

.grid-cell.input-cell:focus {
    outline: none;
    border-color: #48bb78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.2);
}

.grid-cell.filled {
    background: #2d7d7d;
    border: 2px solid #1a5a5a;
    color: white;
}

.grid-cell.correct {
    background: #f0fff4;
    border-color: #48bb78;
    color: #22543d;
}

.grid-cell.incorrect {
    background: #fed7d7;
    border-color: #f56565;
    color: #742a2a;
}

.grid-cell.corner {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    color: #4a5568;
    font-size: 1rem;
    font-weight: 600;
}

.grid-cell.corner.active {
    background: #8b5cf6;
    border: 2px solid #6d28d9;
    color: white;
}

/* Remove number input arrows */
.grid-cell input[type="number"]::-webkit-outer-spin-button,
.grid-cell input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.grid-cell input[type="number"] {
    appearance: textfield;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    color: #8b5cf6;
    font-weight: 600;
}

/* Remove placeholder styling */
.grid-cell input[type="number"]::placeholder {
    color: transparent;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .size-selection {
        max-width: 95vw;
    }
}

@media (max-width: 900px) {
    .size-selection {
        max-width: 98vw;
    }
    .size-options, .custom-grid-options {
        gap: 12px;
    }
    .size-btn, .custom-grid-btn {
        height: 45px;
        font-size: 0.95rem;
        padding: 0 6px;
    }
}

@media (max-width: 600px) {
    .size-selection {
        max-width: 100vw;
        padding: 10px;
    }
    .size-options, .custom-grid-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        max-width: 100%;
    }
    .size-btn, .custom-grid-btn {
        font-size: 0.95rem;
        padding: 8px 2px;
        white-space: nowrap;
        height: auto;
        min-height: 40px;
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .size-selection {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .size-options, .custom-grid-options {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .game-container {
        margin-top: 20px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .header-buttons {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    .grid-cell {
        min-width: 50px;
        min-height: 40px;
        padding: 10px 8px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .grid-cell {
        min-width: 40px;
        min-height: 35px;
        padding: 8px 6px;
        font-size: 0.9rem;
    }
    
    .size-options, .custom-grid-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .size-btn, .custom-grid-btn {
        width: 70px;
        height: 35px;
        font-size: 0.75rem;
        padding: 0 1px;
    }
    
    .header-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .timer-display, .check-btn, .reset-btn, .main-menu-btn {
        width: 100%;
        margin: 2px 0;
    }
}

.game-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 24px 16px 20px 16px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.game-header h2 {
    color: #222;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 18px;
}

.header-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 0.5rem;
    margin-bottom: 0;
    width: 100%;
}

.timer-display {
    padding: 12px 16px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-weight: 600;
    color: #4a5568;
    font-size: 1rem;
    min-width: 100px;
    text-align: center;
    margin-right: 8px;
}

.check-btn, .reset-btn, .main-menu-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.check-btn {
    background: #48bb78;
    color: white;
}
.check-btn:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.reset-btn {
    background: #ed8936;
    color: white;
}
.reset-btn:hover {
    background: #dd6b20;
    transform: translateY(-2px);
}

.main-menu-btn {
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.main-menu-btn:hover {
    background: #2563eb;
}

.game-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: center;
    justify-items: center;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .game-controls {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, auto);
        gap: 10px;
    }
    .game-controls #timerDisplay {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        width: 100%;
    }
    .game-controls #checkAnswersBtn {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        width: 100%;
    }
    .game-controls #resetGridBtn {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        width: 100%;
    }
    .game-controls #mainMenuBtn {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        width: 100%;
    }
    .game-controls button, .game-controls .timer-display {
        font-size: 1rem;
        min-width: 0;
        padding: 10px 0;
    }
} 