:root {
    --bg: #f7f7f2;
    --ink: #1d2528;
    --muted: #5c686c;
    --panel: #ffffff;
    --line: #d9ded7;
    --accent: #23665a;
    --accent-dark: #17443d;
    --gold: #d89b36;
    --coral: #c85d4c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px clamp(20px, 5vw, 72px);
    border-bottom: 1px solid var(--line);
    background: rgba(247, 247, 242, 0.94);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 800;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 18px;
    color: var(--muted);
    font-weight: 650;
}

nav a {
    text-decoration: none;
}

main {
    padding: clamp(24px, 5vw, 72px);
}

.hero {
    min-height: 520px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.55fr);
    align-items: center;
    gap: clamp(28px, 6vw, 88px);
}

.hero-copy h1,
.form-shell h1,
.results-header h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(2.25rem, 6vw, 5.25rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.hero-copy p {
    max-width: 640px;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1.7;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--coral);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.primary {
    background: var(--accent);
    color: white;
}

.secondary {
    background: var(--panel);
    border-color: var(--line);
    color: var(--accent-dark);
}

.hero-panel {
    background: var(--ink);
    color: white;
    border-radius: 8px;
    padding: 32px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: 0 24px 70px rgba(29, 37, 40, 0.14);
}

.hero-panel span {
    color: #c8d8d3;
    font-weight: 800;
}

.hero-panel strong {
    display: block;
    margin: 12px 0;
    font-size: 4rem;
    line-height: 1;
}

.hero-panel p {
    margin: 0;
    color: #dfe8e5;
}

.process,
.charity-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 32px;
}

.process article,
.charity-card,
.result-card,
.profile-form,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.process article,
.charity-card,
.empty-state {
    padding: 24px;
}

.process span,
.rank {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3d7a3;
    color: #5a3f14;
    font-weight: 900;
}

h2 {
    margin: 16px 0 8px;
    font-size: 1.15rem;
}

p {
    line-height: 1.6;
}

.muted {
    color: var(--muted);
}

.form-shell,
.results-header {
    max-width: 1080px;
    margin: 0 auto;
}

.profile-form {
    margin-top: 28px;
    padding: clamp(20px, 4vw, 36px);
}

fieldset {
    margin: 0 0 28px;
    padding: 0;
    border: 0;
}

legend {
    margin-bottom: 16px;
    font-size: 1.15rem;
    font-weight: 900;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--muted);
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 14px;
    color: var(--ink);
    font: inherit;
    background: #fbfbf8;
}

textarea {
    resize: vertical;
}

.check,
.option {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
}

.check input,
.option input {
    width: auto;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.option {
    min-height: 52px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfbf8;
}

.results-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.results-list {
    max-width: 1080px;
    margin: 28px auto 0;
    display: grid;
    gap: 16px;
}

.result-card {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 18px;
    padding: 22px;
}

.result-card h2,
.charity-card h2 {
    margin-top: 0;
}

.explanation {
    color: var(--accent-dark);
    font-weight: 750;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
}

.meta-row span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 750;
}

.text-link {
    color: var(--accent);
    font-weight: 850;
}

.flash-wrap {
    padding: 16px clamp(20px, 5vw, 72px) 0;
}

.flash {
    margin: 0 auto 8px;
    max-width: 1080px;
    padding: 12px 14px;
    border-radius: 8px;
}

.flash.error {
    background: #ffe7e2;
    color: #8d2e20;
}

.error-shell {
    max-width: 1080px;
    margin: 0 auto;
}

.error-shell pre {
    overflow: auto;
    max-height: 70vh;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #151b1d;
    color: #f7f7f2;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 760px) {
    .site-header,
    .results-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero,
    .process,
    .charity-grid,
    .option-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .hero-copy h1,
    .form-shell h1,
    .results-header h1 {
        font-size: 2.35rem;
        line-height: 1.05;
    }

    main {
        padding: 24px 18px 48px;
    }
}
