:root {
    --climate-bg: #dfe7ee;
    --climate-surface: rgba(255, 255, 255, 0.95);
    --climate-surface-strong: #f7fafc;
    --climate-surface-muted: #eef3f7;
    --climate-surface-subtle: #e8eef4;
    --climate-border: rgba(96, 114, 131, 0.18);
    --climate-border-strong: rgba(96, 114, 131, 0.28);
    --climate-copy: #22313d;
    --climate-muted: #667786;
    --climate-accent: #566c7d;
    --climate-accent-strong: #405566;
    --climate-accent-soft: #dde6ed;
    --climate-track: #d6dfe7;
    --climate-shadow: 0 6px 18px rgba(37, 49, 63, 0.06);
}

body {
    min-height: 100vh;
    background: linear-gradient(180deg, #d8e1e9 0%, #e1e8ef 36%, #e8eef3 100%);
    color: var(--climate-copy);
    font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

.container,
.otree-body {
    max-width: 960px;
}

.otree-body {
    margin-top: 32px;
    margin-bottom: 32px;
}

.page-header,
.otree-title {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    color: #253542;
    font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    font-size: clamp(1.9rem, 2.8vw, 2.55rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.otree-body .card {
    border: 0;
    box-shadow: none;
}

.study-shell {
    position: relative;
    padding: 28px;
    border: 1px solid var(--climate-border);
    border-radius: 12px;
    background: var(--climate-surface-strong);
    box-shadow: var(--climate-shadow);
    overflow: hidden;
}

.study-shell::before {
    content: none;
}

.study-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px 14px;
    border: 1px solid var(--climate-border);
    border-radius: 6px;
    background: rgba(91, 114, 131, 0.1);
    color: var(--climate-accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.study-kicker::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--climate-accent);
}

.study-shell p {
    color: var(--climate-copy);
    font-size: 1.02rem;
    line-height: 1.7;
}

.study-lead {
    max-width: 52rem;
    margin-bottom: 22px;
    color: #314351;
    font-size: 1.1rem;
}

.study-panel {
    margin: 18px 0;
    padding: 20px 22px;
    border: 1px solid var(--climate-border);
    border-radius: 10px;
    background: var(--climate-surface-strong);
}

.study-panel--muted {
    background: var(--climate-surface-muted);
}

.study-panel--warm {
    background: var(--climate-surface-subtle);
}

.study-panel__title {
    margin: 0 0 8px;
    color: #2b3f4f;
    font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.study-panel__eyebrow {
    margin-bottom: 10px;
    color: var(--climate-accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.metric-card {
    padding: 18px;
    border: 1px solid var(--climate-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
}

.metric-card__label {
    margin-bottom: 6px;
    color: var(--climate-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.metric-card__value {
    color: #273846;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.metric-card__hint {
    margin-top: 6px;
    color: var(--climate-muted);
    font-size: 0.92rem;
}

.study-note {
    margin: 18px 0 22px;
    padding: 16px 18px;
    border-left: 4px solid var(--climate-accent);
    border-radius: 8px;
    background: rgba(227, 235, 241, 0.78);
    color: #3a5161;
}

.study-note strong {
    color: #324756;
}

.btn-outline-climate {
    margin-top: 6px;
    padding: 10px 18px;
    border: 1px solid var(--climate-border-strong);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--climate-accent);
    font-weight: 700;
}

.btn-outline-climate:hover,
.btn-outline-climate:focus {
    border-color: var(--climate-accent);
    background: var(--climate-accent-soft);
    color: var(--climate-accent-strong);
}

.btn-outline-climate:disabled {
    opacity: 1;
    border-color: var(--climate-border);
    background: rgba(227, 235, 241, 0.85);
    color: #52697a;
}

.reveal-panel {
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px solid var(--climate-border);
}

.reveal-panel.is-visible {
    animation: reveal-slide 280ms ease-out;
}

.allocation-table {
    width: 100%;
    margin: 16px 0 18px;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.allocation-table thead th {
    padding: 0 12px 8px;
    color: var(--climate-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.allocation-table tbody tr {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 0 0 1px rgba(96, 114, 131, 0.08);
}

.allocation-table tbody td {
    padding: 14px 12px;
    vertical-align: middle;
}

.allocation-track {
    height: 18px;
    border-radius: 6px;
    background: var(--climate-track);
    overflow: hidden;
}

.allocation-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #60798b 0%, #8aa0b1 100%);
}

.allocation-percent {
    display: inline-flex;
    min-width: 70px;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(91, 114, 131, 0.1);
    color: var(--climate-accent);
    font-weight: 700;
}

.summary-table td:last-child,
.allocation-table td:last-child {
    width: 42%;
}

.summary-list {
    display: grid;
    gap: 12px;
    margin: 20px 0 22px;
}

.summary-item {
    padding: 16px 18px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--climate-border);
}

.summary-item__label {
    margin-bottom: 6px;
    color: var(--climate-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.summary-item__value {
    color: #2a3d4b;
    font-size: 1.05rem;
    font-weight: 600;
}

.otree-form-errors,
.alert-danger {
    border: 0;
    border-left: 4px solid #b13f30;
    border-radius: 14px;
    background: rgba(177, 63, 48, 0.09);
    color: #8a3126;
}

label {
    color: #283946;
    font-weight: 700;
}

.form-control,
.form-select,
input[type="number"],
textarea {
    border: 1px solid var(--climate-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: none;
    color: var(--climate-copy);
}

.form-control:focus,
.form-select:focus,
input[type="number"]:focus,
textarea:focus {
    border-color: var(--climate-accent);
    box-shadow: 0 0 0 0.24rem rgba(91, 114, 131, 0.14);
}

.controls,
.form-group {
    margin-bottom: 18px;
}

.form-check,
.radio {
    margin-bottom: 12px;
    padding: 16px 18px 16px 44px;
    border: 1px solid var(--climate-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
}

.form-check input,
.radio input {
    margin-top: 0.2rem;
}

.btn-primary,
.otree-btn-next {
    min-width: 180px;
    margin-top: 16px;
    padding: 12px 22px;
    border: 0;
    border-radius: 8px;
    background: #5a7182;
    box-shadow: 0 4px 12px rgba(62, 82, 98, 0.1);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.btn-primary:hover,
.btn-primary:focus,
.otree-btn-next:hover,
.otree-btn-next:focus {
    background: #4b6272;
}

.completion-note {
    margin-top: 28px;
    padding: 18px 20px;
    border-radius: 10px;
    background: #e7edf2;
    color: #455d6f;
    font-weight: 600;
}

@keyframes reveal-slide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .study-shell {
        padding: 22px 18px;
        border-radius: 10px;
    }

    .allocation-table,
    .summary-table {
        display: block;
        overflow-x: auto;
    }

    .summary-table td:last-child,
    .allocation-table td:last-child {
        width: auto;
    }
}
