:root {
    color-scheme: light;
    --bg: #eef2ff;
    --bg-soft: #f8fafc;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-border: rgba(148, 163, 184, 0.24);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #4f46e5;
    --accent-dark: #3730a3;
    --ring: rgba(79, 70, 229, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background: radial-gradient(circle at 20% -20%, #c7d2fe 0%, transparent 40%),
                radial-gradient(circle at 90% 10%, #e0e7ff 0%, transparent 35%),
                linear-gradient(160deg, var(--bg), var(--bg-soft));
}

.page-wrap {
    width: min(1200px, 94vw);
    margin: 0 auto;
    padding: 36px 0 24px;
}

.hero {
    padding: 12px 4px 24px;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--accent);
}

.hero h1 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: -0.03em;
}

.hero-subtitle {
    margin: 0;
    max-width: 780px;
    color: var(--text-muted);
    line-height: 1.55;
}

.hero-intro {
    margin: 10px 0 0;
    max-width: 860px;
    color: #475569;
    line-height: 1.6;
}

.app-shell {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.card {
    border-radius: 22px;
    padding: 24px;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.11);
}

.control-panel {
    position: sticky;
    top: 18px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 1.15rem;
}

.panel-heading p {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.form-grid {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.distribution-description {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 0.87rem;
    line-height: 1.4;
}

.inline-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
}

select,
input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid #dbe3f1;
    background: #fff;
    font-size: 0.94rem;
    color: var(--text-main);
    padding: 11px 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--ring);
}

.calculate-btn {
    margin-top: 2px;
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 12px 20px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calculate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.28);
}

.result-box {
    margin-top: 18px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    padding: 13px 14px;
    color: #312e81;
    background: rgba(79, 70, 229, 0.09);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.chart-wrap {
    margin-top: 14px;
}

canvas {
    width: 100% !important;
    height: 440px !important;
}

footer {
    text-align: center;
    padding: 22px 0 8px;
    color: #94a3b8;
    font-size: 0.84rem;
}

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .control-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .page-wrap {
        width: min(100%, 96vw);
        padding-top: 20px;
    }

    .card {
        padding: 18px;
    }

    .inline-inputs {
        grid-template-columns: 1fr;
        gap: 0;
    }

    canvas {
        height: 350px !important;
    }
}

.sample-size-panel {
    margin-top: 20px;
}

.sample-grid {
    margin-top: 16px;
}

#sampleSizeResult {
    margin-top: 14px;
}

.formula-box {
    margin-top: 10px;
    border-radius: 12px;
    padding: 12px 14px;
    color: #1e293b;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.35);
    font-size: 0.93rem;
    line-height: 1.5;
}

.formula-box code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
}
