* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 40px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.calculator-wrapper {
    padding: 40px 30px;
}

.input-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 1rem;
}

#dataInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s;
    resize: vertical;
}

#dataInput:focus {
    outline: none;
    border-color: #667eea;
}

#percentileInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#percentileInput:focus {
    outline: none;
    border-color: #667eea;
}

.hint {
    font-size: 0.875rem;
    color: #666;
    margin-top: 8px;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 35px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}

.btn-secondary:hover {
    background: #dee2e6;
    transform: translateY(-2px);
}

.results-section {
    margin-top: 40px;
}

.results-section h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.stat-card.highlight {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #667eea;
}

.stat-card h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: #667eea;
    font-weight: 700;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: #555;
}

.stat-value {
    font-weight: 700;
    color: #333;
    font-size: 1.1rem;
}

.iqr-highlight {
    background: rgba(102, 126, 234, 0.15);
    padding: 12px !important;
    border-radius: 8px;
    margin-top: 8px;
}

.iqr-highlight .stat-value {
    color: #667eea;
    font-size: 1.3rem;
}

.sorted-data {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.sorted-data h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: #333;
}

.data-display {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    word-wrap: break-word;
    border: 2px solid #e9ecef;
}

.visual-representation {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
}

.visual-representation h3 {
    font-size: 1.25rem;
    margin-bottom: 25px;
    color: #333;
}

.boxplot {
    position: relative;
    height: 200px;
    margin: 40px 0;
}

.boxplot-scale {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.boxplot-container {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
}

.whisker-left,
.whisker-right {
    height: 2px;
    background: #333;
    position: absolute;
}

.whisker-left::before,
.whisker-right::before,
.whisker-left::after,
.whisker-right::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 40px;
    background: #333;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.box {
    position: absolute;
    height: 80px;
    background: rgba(102, 126, 234, 0.3);
    border: 3px solid #667eea;
    border-radius: 5px;
    display: flex;
}

.q1-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #667eea;
}

.median-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 4px;
    background: #764ba2;
}

.q3-line {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #667eea;
}

.outliers-container {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 80px;
}

.outlier-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border: 2px solid #c0392b;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.boxplot-labels {
    position: absolute;
    bottom: -30px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #666;
    font-weight: 600;
}

.info-section {
    background: #f8f9fa;
    padding: 40px 30px;
    border-top: 3px solid #667eea;
}

.info-section h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #333;
}

.info-section > p {
    margin-bottom: 30px;
    color: #555;
    line-height: 1.8;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.info-card {
    background: #fff;
    padding: 25px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.info-card h3 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.info-card p {
    color: #555;
    line-height: 1.7;
}

.footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 20px;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .calculator-wrapper,
    .info-section {
        padding: 25px 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .stats-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }
}