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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1.welcome-title {
    font-size: 3rem;
    color: #1a5490;
    margin-bottom: 20px;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

h1, h2 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

h2 {
    font-size: 2rem;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Game Container Styles */
.game-container {
    transition: opacity 0.3s ease;
}

.game-container.hidden {
    display: none;
}

.controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.grid-size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.grid-size-selector label {
    font-weight: 600;
    color: #555;
}

.grid-size-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background: white;
    cursor: pointer;
}

.grid-size-selector select:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-social {
    background: #34495e;
    color: white;
}

.btn-social:hover {
    background: #2c3e50;
}

.game-info {
    display: flex;
    gap: 30px;
    align-items: center;
}

.timer, .progress {
    font-size: 1.2rem;
    font-weight: 600;
}

.timer span:first-child, .progress span:first-child {
    color: #7f8c8d;
}

#timer, #nextNumber {
    color: #2c3e50;
    font-family: 'Courier New', monospace;
}

.grid-container {
    display: grid;
    gap: 2px;
    background: #ecf0f1;
    padding: 10px;
    border-radius: 8px;
    margin: 0 auto;
    width: fit-content;
}

.grid-cell {
    background: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Arial Black', 'Helvetica Bold', Impact, sans-serif;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #000000;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.grid-cell:hover:not(.selected) {
    background: #f0f0f0;
    transform: scale(1.05);
}

.grid-cell.selected {
    color: #e74c3c;
    background: #ffecec;
    cursor: not-allowed;
}

.grid-cell.wrong {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.game-complete {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    margin-top: 20px;
}

.game-complete h2 {
    color: #27ae60;
    margin-bottom: 20px;
}

.results {
    margin: 20px 0;
}

.results p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.results span {
    font-weight: bold;
    color: #2c3e50;
}

.complete-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.chart-container {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.chart-container h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

#performanceChart {
    max-height: 300px;
}

.mobile-font-control {
    display: none;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.mobile-font-control label {
    font-weight: 600;
    color: #555;
    display: block;
    margin-bottom: 10px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

#fontSizeSlider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    transition: background 0.3s;
}

#fontSizeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

#fontSizeSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

#fontSizeSlider:hover {
    background: #ccc;
}

#fontSizeSlider::-webkit-slider-thumb:hover {
    background: #2980b9;
}

#fontSizeSlider::-moz-range-thumb:hover {
    background: #2980b9;
}

#fontSizeValue {
    min-width: 50px;
    font-weight: 600;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

#historyList {
    margin: 20px 0;
}

.history-item {
    background: #f8f9fa;
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
    border-left: 4px solid #3498db;
}

.history-item h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.history-item p {
    margin: 5px 0;
    color: #555;
}

.share-text {
    margin: 20px 0;
}

.share-text textarea {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Focus Level Modal Styles */
.focus-modal-content {
    text-align: center;
    max-width: 500px;
}

.focus-modal-content h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.focus-slider-container {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
    color: #555;
    font-size: 1.2rem;
}

.focus-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    outline: none;
    transition: background 0.3s;
}

.focus-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.focus-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.focus-slider:hover {
    background: #ccc;
}

.focus-slider::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.focus-slider::-moz-range-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.focus-value-display {
    margin-top: 20px;
    font-size: 3rem;
    font-weight: bold;
    color: #3498db;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.focus-help-text {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Science Link Styles */
.science-link-container {
    margin: 20px 0;
    text-align: center;
}

.science-link {
    color: #3498db;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 12px;
    display: inline-block;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.science-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.science-link:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    border-radius: 4px;
}

.science-link:visited {
    color: #8e44ad;
}

.science-link:after {
    content: ' →';
    font-size: 0.85em;
    margin-left: 2px;
    transition: margin-left 0.3s ease;
}

.science-link:hover:after {
    margin-left: 5px;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .grid-size-selector {
        flex-wrap: wrap;
        justify-content: center;
    }

    .game-info {
        justify-content: center;
    }

    .mobile-font-control {
        display: block;
    }

    .complete-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

