:root {
    --page-bg: #f4f6f3;
    --page-bg-soft: #fbfcfa;
    --surface: rgba(255, 255, 253, 0.97);
    --surface-strong: #ffffff;
    --surface-muted: #eef1ed;
    --surface-panel: #f3f5f2;
    --border: #d6ddd8;
    --border-strong: #b9c5bf;
    --text-main: #1b241f;
    --text-soft: #5a6660;
    --text-subtle: #73807a;
    --brand: #1b355e;
    --brand-strong: #102443;
    --brand-soft: #e7edf6;
    --brand-soft-strong: #d7e2f0;
    --gold: #6f6255;
    --gold-soft: #edf0ed;
    --danger: #9a4340;
    --danger-soft: #f7eceb;
    --shadow-lg: 0 30px 70px rgba(27, 36, 31, 0.08);
    --shadow-md: 0 16px 36px rgba(27, 36, 31, 0.06);
    --shadow-sm: 0 8px 18px rgba(27, 36, 31, 0.045);
    --radius-xl: 30px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(27, 53, 94, 0.08), transparent 24rem),
        linear-gradient(180deg, var(--page-bg-soft) 0%, var(--page-bg) 100%);
    color: var(--text-main);
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1:focus {
    outline: none;
}

.survey-shell {
    width: min(100%, 84rem);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.survey-form {
    display: grid;
    gap: 1.25rem;
}

.hero-card,
.progress-card,
.survey-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(214, 221, 216, 0.95);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.hero-card::before,
.progress-card::before,
.survey-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(27, 53, 94, 0.34), rgba(255, 255, 255, 0));
}

.hero-card {
    padding: 1.75rem;
    margin-bottom: 1rem;
}

.hero-layout {
    display: grid;
    gap: 1.5rem;
    align-items: stretch;
}

.hero-main {
    display: grid;
    gap: 1.1rem;
    align-content: start;
}

.hero-card h1,
.thank-you-card h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.2rem, 3.2vw, 3.3rem);
    line-height: 1.15;
    letter-spacing: -0.05em;
    color: #16211d;
}

.hero-copy {
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1.7;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.78rem;
    border: 1px solid rgba(27, 53, 94, 0.18);
    border-radius: 999px;
    background: rgba(231, 237, 246, 0.82);
    color: #243b63;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.notice-strip {
    display: flex;
    align-items: center;
    min-height: 3.75rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(238, 242, 239, 0.92), rgba(255, 255, 254, 0.96));
    border: 1px solid rgba(185, 197, 190, 0.62);
    color: #2d3c55;
    font-weight: 600;
    line-height: 1.55;
}

.hero-points {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-point {
    display: grid;
    gap: 0.2rem;
    padding: 0.95rem 1rem;
    border-radius: 0;
    background: var(--surface-panel);
    border: 1px solid rgba(185, 197, 190, 0.55);
}

.hero-point-value {
    color: var(--brand-strong);
    font-size: 1rem;
    font-weight: 700;
}

.hero-point-label {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.hero-panel {
    display: grid;
    gap: 0.9rem;
    padding: 1.1rem;
    align-content: start;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(27, 53, 94, 0.05), rgba(255, 255, 255, 0.78));
    border: 1px solid rgba(185, 197, 190, 0.68);
}

.hero-panel-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.4rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: #182036;
}

.hero-panel-copy {
    color: var(--text-soft);
    line-height: 1.7;
}

.hero-panel-label,
.section-kicker {
    color: var(--text-subtle);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-panel strong {
    font-size: 1rem;
    line-height: 1.45;
    font-weight: 600;
}

.progress-card,
.survey-card {
    padding: 1.5rem;
}

.progress-header,
.field-heading,
.survey-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.progress-label,
.field-meta,
.optional-label,
.field-help {
    color: var(--text-soft);
}

.progress-header {
    align-items: flex-start;
}

.progress-label {
    font-size: 1rem;
    font-weight: 600;
    color: #44516d;
}

.autosave-row {
    margin-top: 0.7rem;
    min-height: 1.35rem;
}

.autosave-status {
    color: var(--text-subtle);
    font-size: 0.92rem;
}

.autosave-error {
    color: var(--danger);
}

.progress-track {
    margin-top: 1.15rem;
    width: 100%;
    height: 0.6rem;
    background: #dde4df;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand) 0%, #4a6ca3 100%);
}

.step-header {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(214, 221, 216, 0.82);
}

.step-header h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    color: #17243f;
}

.step-header p {
    color: var(--text-soft);
    line-height: 1.7;
}

.form-grid,
.ratings-stack,
.tag-stack {
    display: grid;
    gap: 1.2rem;
}

.field-group,
.rating-field,
.tag-selector {
    display: grid;
    gap: 0.6rem;
}

.field-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #19243a;
}

.field-meta,
.optional-label,
.field-help {
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    min-height: 3.35rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(185, 197, 190, 0.9);
    border-radius: 0;
    background: var(--surface-strong);
    color: var(--text-main);
    box-shadow: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-control:hover {
    border-color: var(--border-strong);
}

.form-control:focus {
    outline: none;
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(27, 53, 94, 0.12);
}

.form-control:disabled {
    background: var(--surface-muted);
    color: var(--text-soft);
}

.country-field {
    position: relative;
}

.country-icon {
    position: absolute;
    inset-inline-start: 1rem;
    top: 50%;
    width: 1.35rem;
    height: 1.35rem;
    transform: translateY(-50%);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='2' fill='%23d61f26'/%3E%3Cpath fill='%23fff' d='M6.75 3.25h2.5v3h3v2.5h-3v3h-2.5v-3h-3v-2.5h3z'/%3E%3C/svg%3E");
}

.country-input {
    padding-inline-start: 3rem;
    cursor: not-allowed;
    opacity: 1;
}

.form-textarea {
    min-height: 8.75rem;
    resize: vertical;
    line-height: 1.65;
}

.choice-grid,
.checkbox-grid,
.tag-grid,
.rating-buttons {
    display: grid;
    gap: 0.8rem;
}

.choice-grid,
.checkbox-grid,
.tag-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.two-up {
    grid-template-columns: minmax(0, 1fr);
}

.choice-card,
.checkbox-chip,
.tag-chip,
.rating-button,
.button {
    border: 1px solid rgba(185, 197, 190, 0.88);
    border-radius: 0;
    background: var(--surface-strong);
    color: var(--text-main);
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.choice-card,
.checkbox-chip {
    min-height: 3.4rem;
    padding: 0.95rem 1rem;
    text-align: left;
    font-weight: 600;
}

.tag-chip {
    min-height: 3.3rem;
    padding: 0.9rem 1rem;
    text-align: left;
    line-height: 1.45;
}

.tag-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.65rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.62rem 0.95rem;
    border-radius: 999px;
    background: var(--surface-panel);
    border-color: rgba(185, 197, 190, 0.92);
    font-weight: 700;
    text-align: center;
    line-height: 1.25;
    white-space: normal;
}

.rating-field {
    padding: 1.05rem;
    border: 1px solid rgba(214, 221, 216, 0.92);
    border-radius: 0;
    background: linear-gradient(180deg, rgba(255, 255, 253, 0.99), rgba(242, 245, 242, 0.86));
}

.rating-buttons {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rating-button {
    min-height: 5rem;
    padding: 0.9rem 0.85rem;
    display: grid;
    gap: 0.18rem;
    justify-items: start;
    align-content: center;
    text-align: left;
}

.rating-number {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1;
    color: var(--brand-strong);
}

.rating-text {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.choice-card:hover,
.checkbox-chip:hover,
.tag-chip:hover,
.rating-button:hover,
.button:hover {
    transform: translateY(-1px);
    border-color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.selected {
    border-color: var(--brand);
    background: linear-gradient(180deg, var(--brand-soft), #eef3fb);
    box-shadow: 0 0 0 4px rgba(27, 53, 94, 0.08);
}

.tag-chip.selected {
    color: var(--brand-strong);
}

.tag-chip:disabled {
    opacity: 0.46;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3.4rem;
    padding: 0.95rem 1.55rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.button-primary {
    background: linear-gradient(180deg, #27466f, #1b355e);
    border-color: #1b355e;
    color: #fcfaf6;
}

.button-primary:hover {
    background: linear-gradient(180deg, #203d66, #102443);
    border-color: #102443;
}

.button-secondary {
    background: rgba(255, 253, 250, 0.92);
    color: #555b57;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.survey-actions {
    padding-top: 0.2rem;
    justify-content: space-between;
}

.thank-you-card {
    display: grid;
    gap: 1rem;
}

.thank-you-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.inline-error,
.validation-message {
    color: var(--danger);
    font-size: 0.92rem;
}

.form-alert {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    border: 1px solid rgba(154, 67, 64, 0.22);
    color: #7d3330;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--brand);
}

.invalid {
    outline: 1px solid #d65e57;
}

.blazor-error-boundary {
    background: #932c2c;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

@media (max-width: 639px) {
    .progress-header,
    .field-heading,
    .survey-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .survey-actions {
        flex-direction: row;
        align-items: stretch;
        gap: 0.75rem;
    }

    .survey-actions .button {
        flex: 1 1 0;
        min-width: 0;
    }

    .rating-buttons,
    .two-up,
    .hero-points {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .tag-grid {
        gap: 0.55rem;
    }
}

@media (min-width: 900px) {
    .hero-card,
    .progress-card,
    .survey-card {
        padding: 2rem;
    }

    .hero-layout {
        grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.85fr);
        align-items: stretch;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .field-group-full {
        grid-column: 1 / -1;
    }

    .choice-grid,
    .checkbox-grid,
    .tag-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
