:root {
    color-scheme: light;
    --paper: #fffdf8;
    --canvas: #f6f1e8;
    --ink: #24211c;
    --muted: #6f675b;
    --line: #d8cdbc;
    --accent: #9b4f2c;
    --accent-dark: #6f351e;
    --sage: #576d58;
    --sage-soft: #eef3ed;
    --danger: #9b2f24;
    --shadow: 0 18px 46px rgba(36, 33, 28, .08);
}

* {
    box-sizing: border-box;
}

html {
    background: transparent;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(246, 241, 232, .82), rgba(255, 253, 248, .96)),
        var(--canvas);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

body.survey-public {
    --paper: #090909;
    --canvas: #000000;
    --ink: #f7f7f7;
    --muted: #c8d1dc;
    --line: rgba(255, 255, 255, .16);
    --accent: #e31318;
    --accent-dark: #aa0509;
    --sage: #24d8ff;
    --sage-soft: rgba(36, 216, 255, .12);
    --danger: #ff564f;
    --shadow: 0 22px 60px rgba(0, 0, 0, .52);
    background:
        radial-gradient(circle at 20% 0%, rgba(227, 19, 24, .22), transparent 32%),
        radial-gradient(circle at 78% 18%, rgba(36, 216, 255, .16), transparent 30%),
        linear-gradient(180deg, #050505 0%, #000 34%, #070707 100%);
    color: var(--ink);
}

.survey-shell {
    width: min(980px, 100%);
    margin: 0 auto;
    padding: clamp(18px, 4vw, 42px);
}

.survey-hero,
.section-block,
.form-actions,
.thank-you {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, .94);
    box-shadow: var(--shadow);
}

.survey-public .survey-hero,
.survey-public .section-block,
.survey-public .form-actions,
.survey-public .thank-you {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .035)),
        rgba(8, 8, 8, .94);
    backdrop-filter: blur(8px);
}

.survey-hero {
    padding: clamp(24px, 5vw, 52px);
    border-top: 5px solid var(--accent);
}

.survey-public .survey-hero {
    border-top: 0;
    border-color: rgba(227, 19, 24, .46);
    box-shadow:
        0 0 0 1px rgba(227, 19, 24, .16),
        0 28px 70px rgba(0, 0, 0, .72),
        inset 0 1px 0 rgba(255, 255, 255, .08);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.survey-public .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 15px;
    text-shadow: 0 0 12px rgba(227, 19, 24, .9);
}

.brand-line {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.survey-logo {
    display: block;
    width: 76px;
    height: 76px;
    object-fit: contain;
}

h1,
h2 {
    margin: 0;
    line-height: 1.12;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

h1 {
    max-width: 780px;
    font-size: clamp(34px, 6vw, 58px);
}

.survey-public h1,
.survey-public h2 {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 900;
}

.survey-public h1 {
    max-width: 860px;
    font-size: clamp(28px, 4.2vw, 43px);
    color: #fff;
    text-transform: uppercase;
    text-shadow:
        2px 2px 0 var(--accent),
        0 0 18px rgba(36, 216, 255, .28);
}

.commune-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.commune-field {
    position: relative;
}

.commune-suggestions {
    position: absolute;
    z-index: 20;
    top: 100%;
    right: 0;
    left: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .6);
}

.commune-choice {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 11px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    border-radius: 0;
    background: #111;
    box-shadow: none;
    color: #fff;
    text-align: left;
    text-transform: none;
}

.commune-choice:last-child {
    border-bottom: 0;
}

.commune-choice:hover,
.commune-choice:focus {
    background: #242424;
}

h2 {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    font-size: clamp(24px, 3.5vw, 34px);
}

.survey-public h2 {
    color: #fff;
    border-bottom-color: rgba(227, 19, 24, .5);
}

.survey-hero > p:not(.eyebrow) {
    max-width: 760px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 18px;
}

.survey-public .survey-hero > p:not(.eyebrow) {
    color: #e8edf4;
}

.save-state {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 8px 11px;
    border: 1px solid rgba(87, 109, 88, .22);
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage);
    font-size: 14px;
    font-weight: 700;
}

.survey-public .save-state {
    border-color: rgba(36, 216, 255, .34);
    background: rgba(36, 216, 255, .1);
    color: #b8f4ff;
}

.save-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--sage);
}

.save-dot[data-state="pending"],
.save-dot[data-state="saving"] {
    background: #b5792e;
}

.save-dot[data-state="error"] {
    background: var(--danger);
}

.survey-form {
    display: grid;
    gap: 22px;
    margin-top: 22px;
}

.section-block,
.form-actions,
.thank-you {
    padding: clamp(20px, 4vw, 36px);
}

.question {
    display: block;
    margin: 24px 0 0;
    padding: 0;
    border: 0;
}

legend,
.field-label > span {
    display: block;
    margin-bottom: 10px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
}

.survey-public legend,
.survey-public .field-label > span {
    color: #fff;
}

.hint {
    margin: -4px 0 12px;
    color: var(--muted);
    font-size: 14px;
}

.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.options.columns {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.options label,
.consent-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf0;
    cursor: pointer;
}

.survey-public .options label,
.survey-public .consent-line {
    border-color: rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .055);
    color: #f7f7f7;
}

.survey-public .options label:hover,
.survey-public .consent-line:hover {
    border-color: rgba(227, 19, 24, .72);
    box-shadow: 0 0 0 1px rgba(227, 19, 24, .2), 0 0 22px rgba(227, 19, 24, .12);
}

input[type="radio"],
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--accent);
    flex: 0 0 auto;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf0;
    color: var(--ink);
    font: inherit;
    padding: 12px 13px;
    outline: none;
}

.survey-public input[type="text"],
.survey-public input[type="email"],
.survey-public input[type="tel"],
.survey-public textarea {
    border-color: rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.survey-public input::placeholder,
.survey-public textarea::placeholder {
    color: rgba(255, 255, 255, .5);
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 79, 44, .14);
}

.survey-public input:focus,
.survey-public textarea:focus {
    border-color: var(--sage);
    box-shadow: 0 0 0 3px rgba(36, 216, 255, .18), 0 0 22px rgba(36, 216, 255, .14);
}

.inline-other {
    display: grid;
    grid-template-columns: minmax(70px, max-content) 1fr;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
    color: var(--muted);
    font-weight: 700;
}

.matrix {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.survey-public .matrix {
    border-color: rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .035);
}

.matrix-head,
.matrix-row {
    display: grid;
    grid-template-columns: var(--matrix-columns, minmax(260px, 1.5fr) repeat(5, minmax(84px, 1fr)));
    min-width: 760px;
}

.matrix-head {
    background: #eee6d7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.survey-public .matrix-head {
    background: rgba(227, 19, 24, .22);
    color: #fff;
}

.matrix-head span,
.matrix-row p,
.matrix-row label {
    margin: 0;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
}

.survey-public .matrix-head span,
.survey-public .matrix-row p,
.survey-public .matrix-row label {
    border-color: rgba(255, 255, 255, .14);
}

.matrix-head span:not(:first-child),
.matrix-row label {
    text-align: center;
    border-left: 1px solid var(--line);
}

.matrix-row:last-child p,
.matrix-row:last-child label {
    border-bottom: 0;
}

.matrix-row label {
    display: grid;
    place-items: center;
    cursor: pointer;
}

.matrix-row label span {
    display: none;
}

.matrix-head small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-weight: 400;
}

.survey-public .matrix-head small {
    color: rgba(255, 255, 255, .68);
}

.draw-block {
    background:
        linear-gradient(135deg, rgba(155, 79, 44, .08), rgba(87, 109, 88, .10)),
        var(--paper);
}

.survey-public .draw-block {
    background:
        linear-gradient(135deg, rgba(227, 19, 24, .18), rgba(36, 216, 255, .08)),
        rgba(8, 8, 8, .95);
    border-color: rgba(227, 19, 24, .42);
}

.draw-block p {
    margin: 18px 0;
    color: var(--muted);
    font-size: 17px;
}

.survey-public .draw-block p {
    color: #e8edf4;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.contact-grid label {
    color: var(--muted);
    font-weight: 700;
}

.survey-public .contact-grid label,
.survey-public .inline-other {
    color: #dfe7f2;
}

.contact-grid input {
    margin-top: 6px;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.form-actions p {
    margin: 0;
    color: var(--muted);
}

button {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 12px 22px;
}

.survey-public button {
    background: linear-gradient(180deg, #f51c22, #c4070c);
    box-shadow: 0 10px 30px rgba(227, 19, 24, .34), inset 0 1px 0 rgba(255, 255, 255, .22);
    text-transform: uppercase;
}

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

.survey-public button:hover,
.survey-public button:focus {
    background: linear-gradient(180deg, #ff2b30, #a90509);
}

.thank-you {
    margin-top: 22px;
}

.thank-you h2 {
    border: 0;
    padding: 0;
}

@media (max-width: 720px) {
    .survey-shell {
        padding: 12px;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .inline-other {
        grid-template-columns: 1fr;
    }
}
