/* Mobile-first responsive design for Mean and SD Demonstration */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 10px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

/* Header Styles */
.main-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.main-header h1 {
    font-size: 1.8rem;
    color: #232D4B;
    margin-bottom: 10px;
}

.main-header h2 {
    font-size: 1.4rem;
    color: #E57200;
    margin-bottom: 10px;
}

.main-header h3 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 500;
}

.attribution {
    font-size: 1rem;
    color: #666;
    margin-top: 10px;
}

.date {
    font-size: 0.9rem;
    color: #888;
    margin-top: 5px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.5rem;
    color: #232D4B;
    flex: 1;
    min-width: 200px;
}

.back-link {
    color: #E57200;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 12px;
    border: 1px solid #E57200;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.back-link:hover {
    background-color: #E57200;
    color: white;
}

/* Navigation */
.navigation {
    margin-top: 20px;
}

.intro {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1rem;
    color: #555;
    padding: 0 10px;
}

.exercise-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.exercise-link {
    display: block;
    padding: 20px;
    background-color: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    min-height: 80px;
}

.exercise-link:hover {
    background-color: #E57200;
    color: white;
    border-color: #E57200;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.exercise-link h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: inherit;
}

.exercise-link p {
    font-size: 0.95rem;
    color: inherit;
    opacity: 0.9;
}

/* Exercise Container */
.exercise-container {
    width: 100%;
}

.controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group-centered {
    justify-content: center;
}

.control-group label {
    font-weight: 500;
    min-width: 150px;
    font-size: 0.95rem;
}

.control-group input[type="range"] {
    flex: 1;
    min-width: 200px;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #E57200;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #E57200;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group span {
    font-weight: 600;
    color: #E57200;
    min-width: 50px;
    text-align: right;
    font-size: 1rem;
}

.info-box {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.info-box p {
    margin: 0;
    font-size: 0.95rem;
}

/* Canvas Container */
.canvas-container {
    width: 100%;
    margin: 20px 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    overflow: hidden;
}

#galton-canvas,
#histogram-canvas {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

/* Stats Display */
.stats-display {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-size: 0.95rem;
}

.stats-display p {
    margin: 5px 0;
}

.stats-display strong {
    color: #232D4B;
}

/* Buttons */
.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-height: 44px; /* Touch-friendly minimum size */
    min-width: 120px;
    flex: 1;
    max-width: 200px;
}

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

.btn-primary:hover {
    background-color: #d16500;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

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

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

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

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

/* Responsive Design */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .container {
        max-width: 900px;
        padding: 30px;
    }
    
    .main-header h1 {
        font-size: 2.2rem;
    }
    
    .main-header h2 {
        font-size: 1.8rem;
    }
    
    .main-header h3 {
        font-size: 1.5rem;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    .exercise-link {
        padding: 25px;
    }
    
    .canvas-container {
        padding: 15px;
    }
    
    #galton-canvas,
    #histogram-canvas {
        max-height: 600px;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .main-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .main-header h1 {
        font-size: 1.5rem;
    }
    
    .main-header h2 {
        font-size: 1.2rem;
    }
    
    .main-header h3 {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }
    
    .buttons,
    .controls {
        display: none;
    }
}
