:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --error-color: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    font-size: 1rem;
    font-weight: 600;
}

textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    align-self: flex-start;
}

button:hover {
    background: var(--accent-hover);
}

button:active {
    transform: scale(0.98);
}

.error {
    color: var(--error-color);
    font-size: 0.9rem;
    background: rgba(239, 68, 68, 0.1);
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.hidden {
    display: none !important;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 8px;
}

.stat-card small {
    font-size: 0.75rem;
    display: block;
    margin-top: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.five-number-summary h2, .plot-section h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #e2e8f0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    text-align: center;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(15, 23, 42, 0.4);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}

.summary-item span:first-child {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 1.2rem;
    font-weight: 600;
}

.plot-container {
    width: 100%;
    overflow-x: auto;
}

#box-plot, #dot-plot {
    min-width: 600px; /* Ensure it doesn't get too squished on mobile */
}

@media (max-width: 640px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    .summary-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 20px;
    }
}
