:root {
    color-scheme: light;
    --crystal-pink-50: #fff8fb;
    --crystal-pink-100: #fdeef5;
    --crystal-pink-200: #f7dbe8;
    --crystal-pink-300: #ebbed2;
    --crystal-pink-400: #d99aae;
    --mist-lilac: #f5f1f7;
    --cool-ice: #f7fbfc;
    --rose-ink: #47333d;
    --muted: #74636b;
    --line: rgba(130, 88, 108, 0.18);
    --panel: rgba(255, 255, 255, 0.82);
    --shadow: 0 18px 50px rgba(111, 70, 91, 0.13);
    --page-background: linear-gradient(145deg, rgba(255, 248, 251, 0.96), rgba(247, 251, 252, 0.88) 46%, rgba(253, 238, 245, 0.76)), #fff8fb;
    --surface-background: rgba(255, 255, 255, 0.88);
    --input-background: rgba(255, 255, 255, 0.94);
    --surface-soft: rgba(255, 255, 255, 0.84);
    --surface-muted: rgba(255, 255, 255, 0.72);
    --selected-background: #fff0f6;
    --action-background: #8f405e;
    --action-text: #ffffff;
    --link-text: #7f3b58;
    --danger-text: #8c3446;
    --danger-background: #fff2f5;
    --success-text: #2f6346;
    --success-background: #e4f4eb;
    --warning-text: #765b22;
    --warning-background: #fff9e1;
    --archived-text: #5d5362;
    --archived-background: #f5f1f7;
    --code-text: #7f4c63;
    --chart-accent: #8f405e;
    --chart-area: rgba(143, 64, 94, 0.16);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --rose-ink: #f4eaf0;
    --muted: #c3b2bc;
    --line: rgba(239, 203, 220, 0.2);
    --panel: rgba(35, 27, 33, 0.94);
    --crystal-pink-50: #171217;
    --crystal-pink-100: #34242d;
    --crystal-pink-200: #4a303d;
    --crystal-pink-300: #684353;
    --crystal-pink-400: #b66f8a;
    --page-background: linear-gradient(145deg, #171217, #211920 52%, #15191b), #171217;
    --surface-background: rgba(38, 29, 35, 0.96);
    --input-background: rgba(27, 22, 26, 0.96);
    --surface-soft: #2b2228;
    --surface-muted: #261d23;
    --selected-background: #3d2933;
    --action-background: #8f405e;
    --action-text: #ffffff;
    --link-text: #f0a2ba;
    --danger-text: #ffb7c5;
    --danger-background: #4a202c;
    --success-text: #a7e5bd;
    --success-background: #173d2a;
    --warning-text: #f6d984;
    --warning-background: #443714;
    --archived-text: #ddd2e0;
    --archived-background: #352f39;
    --code-text: #ffc1d4;
    --chart-accent: #f0a2ba;
    --chart-area: rgba(240, 162, 186, 0.18);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --rose-ink: #f4eaf0; --muted: #c3b2bc; --line: rgba(239,203,220,.2); --panel: rgba(35,27,33,.94);
        --crystal-pink-50: #171217; --crystal-pink-100: #34242d; --crystal-pink-200: #4a303d; --crystal-pink-300: #684353; --crystal-pink-400: #b66f8a;
        --page-background: linear-gradient(145deg,#171217,#211920 52%,#15191b),#171217; --surface-background: rgba(38,29,35,.96); --input-background: rgba(27,22,26,.96); --shadow: 0 18px 50px rgba(0,0,0,.28);
        --surface-soft:#2b2228; --surface-muted:#261d23; --selected-background:#3d2933; --action-background:#8f405e; --action-text:#fff; --link-text:#f0a2ba;
        --danger-text:#ffb7c5; --danger-background:#4a202c; --success-text:#a7e5bd; --success-background:#173d2a; --warning-text:#f6d984; --warning-background:#443714;
        --archived-text:#ddd2e0; --archived-background:#352f39; --code-text:#ffc1d4; --chart-accent:#f0a2ba; --chart-area:rgba(240,162,186,.18);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--rose-ink);
    background: var(--page-background);
}

a {
    color: inherit;
}

.shell,
.survey-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.panel,
.survey-card {
    width: min(760px, 100%);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-background);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.survey-card::before {
    content: "";
    display: block;
    width: 52px;
    height: 4px;
    margin-bottom: 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(217, 154, 174, 0.78), rgba(245, 241, 247, 0.9), rgba(185, 215, 218, 0.62));
}

.survey-shell {
    align-items: flex-start;
    padding-top: 48px;
}

.unlock-card {
    width: min(520px, 100%);
}

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

.unlock-form.is-shaking .captcha-slots span {
    border-color: rgba(177, 83, 100, 0.68);
    background: var(--danger-background);
}

.unlock-form.is-shaking {
    animation: shake-x 0.28s ease;
}

.unlock-form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.captcha-block {
    display: grid;
    gap: 10px;
    justify-items: center;
}

.captcha-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.captcha-display span {
    display: inline-flex;
    width: 38px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--rose-ink);
    font-size: 24px;
    font-weight: 800;
}

.captcha-refresh {
    color: var(--link-text);
    font-weight: 700;
    text-decoration: none;
}

.captcha-slots {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.captcha-slots span {
    display: inline-flex;
    width: 42px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(130, 88, 108, 0.26);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--rose-ink);
    font-size: 24px;
    font-weight: 800;
}

.captcha-slots .is-filled {
    border-color: rgba(217, 154, 174, 0.72);
    background: var(--selected-background);
}

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

.number-keypad button {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--rose-ink);
    font: inherit;
    font-size: 18px;
    font-weight: 800;
}

.number-keypad button:active {
    background: var(--crystal-pink-100);
}

.captcha-message {
    margin: -2px 0 0;
    color: var(--danger-text);
    font-weight: 800;
    text-align: center;
}

@keyframes shake-x {
    0%, 100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-8px);
    }
    40% {
        transform: translateX(7px);
    }
    60% {
        transform: translateX(-5px);
    }
    80% {
        transform: translateX(4px);
    }
}

.survey-form-card {
    width: min(840px, 100%);
}

.survey-heading {
    margin-bottom: 24px;
}

.step-indicator {
    display: flex;
    gap: 8px;
    margin: 18px 0 26px;
}

.step-indicator span {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    background: var(--surface-muted);
    font-size: 13px;
    font-weight: 700;
}

.step-indicator .is-active {
    color: var(--action-text);
    border-color: rgba(217, 154, 174, 0.55);
    background: var(--action-background);
}

.step-indicator .is-done {
    color: var(--rose-ink);
    background: var(--crystal-pink-100);
}

.step-title {
    margin-bottom: 18px;
}

.step-title span {
    color: var(--muted);
    font-size: 13px;
}

.step-title h2 {
    margin: 6px 0 0;
    font-size: 24px;
    line-height: 1.3;
}

.step-validation-message {
    margin: -4px 0 16px;
    padding: 10px 12px;
    border: 1px solid rgba(177, 83, 100, 0.22);
    border-radius: 8px;
    background: var(--danger-background);
    color: var(--danger-text);
    font-weight: 700;
    line-height: 1.5;
}

.question-list {
    display: grid;
    gap: 18px;
}

.question {
    margin: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.question legend {
    padding: 0;
    color: var(--rose-ink);
    font-size: 17px;
    font-weight: 800;
}

.question legend em {
    margin-left: 8px;
    color: var(--link-text);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.question-help {
    margin: 8px 0 14px;
    color: var(--muted);
    line-height: 1.65;
}

.field-error {
    margin: 8px 0 14px;
    color: var(--danger-text);
    font-weight: 700;
}

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

.option-card {
    display: grid;
    gap: 8px;
    min-height: 58px;
    align-content: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.option-card input[type="radio"],
.option-card input[type="checkbox"] {
    position: absolute;
    width: 1px;
    min-height: 1px;
    opacity: 0;
    pointer-events: none;
}

.option-card span {
    font-weight: 700;
}

.option-card.is-selected {
    border-color: rgba(217, 154, 174, 0.68);
    background: var(--selected-background);
    box-shadow: 0 8px 24px rgba(111, 70, 91, 0.09);
}

.option-description {
    color: var(--muted);
    line-height: 1.55;
}

.extra-input {
    margin-top: 4px;
}

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

.survey-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 24px -32px -32px;
    padding: 16px 32px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface-background);
    backdrop-filter: blur(10px);
}

.success-summary {
    display: grid;
    gap: 6px;
    margin-top: 22px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.success-summary span {
    color: var(--muted);
    font-size: 13px;
}

.success-summary strong {
    font-size: 20px;
}

.copy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.copy-button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(158, 104, 129, 0.25);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--link-text);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
}

.copy-feedback {
    color: var(--success-text);
    font-weight: 700;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

[hidden],
.modal-backdrop[hidden] {
    display: none !important;
}

.eyebrow {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--muted);
}

h1 {
    margin: 0 0 14px;
    font-size: 30px;
    line-height: 1.25;
    letter-spacing: 0;
}

.muted {
    color: var(--muted);
    line-height: 1.7;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
    padding: 0 18px;
    border: 1px solid rgba(158, 104, 129, 0.25);
    border-radius: 8px;
    background: var(--action-background);
    color: var(--action-text);
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.button-secondary {
    background: #fff;
    color: var(--rose-ink);
}

:root[data-theme="dark"] .button-secondary {
    border-color: var(--line);
    background: var(--input-background);
    color: var(--rose-ink);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .button-secondary {
        border-color: var(--line);
        background: var(--input-background);
        color: var(--rose-ink);
    }
}

.button.full {
    width: 100%;
}

.button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(111, 70, 91, 0.14);
}

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

.form-stack label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-background);
    color: var(--rose-ink);
    font: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid rgba(217, 154, 174, 0.28);
    border-color: rgba(217, 154, 174, 0.58);
}

.notice {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.notice-error {
    border-color: rgba(177, 83, 100, 0.28);
    color: var(--danger-text);
    background: var(--danger-background);
}

.invite-welcome,
.invite-note {
    margin: 16px 0;
    padding: 12px 14px;
    border: 1px solid rgba(217, 154, 174, 0.28);
    border-radius: 8px;
    background: var(--selected-background);
    color: var(--rose-ink);
    line-height: 1.65;
}

.invite-note {
    margin-bottom: 0;
}

.check-list {
    margin: 24px 0 0;
}

.check-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.check-list dt {
    color: var(--muted);
}

.check-list dd {
    margin: 0;
    font-weight: 700;
}

.preference-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.public-toolbar {
    display: flex;
    justify-content: flex-end;
    width: min(840px, 100%);
    margin: 0 auto;
    padding: 14px 16px 0;
}

.theme-toggle,
.language-select-field select {
    width: auto;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-background);
    color: var(--rose-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    cursor: pointer;
}

.theme-toggle [data-theme-icon] {
    width: 16px;
    font-size: 16px;
    line-height: 1;
    text-align: center;
}

.language-select-field select {
    min-width: 112px;
    padding: 5px 30px 5px 10px;
}

.preference-controls.is-compact {
    flex-shrink: 0;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

:root[data-theme="dark"] .option-card,
:root[data-theme="dark"] .captcha-display,
:root[data-theme="dark"] .captcha-display span,
:root[data-theme="dark"] .captcha-slots span,
:root[data-theme="dark"] .number-keypad button,
:root[data-theme="dark"] .success-summary,
:root[data-theme="dark"] .notice {
    background: var(--surface-background);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .option-card,
    :root:not([data-theme="light"]) .captcha-display,
    :root:not([data-theme="light"]) .captcha-display span,
    :root:not([data-theme="light"]) .captcha-slots span,
    :root:not([data-theme="light"]) .number-keypad button,
    :root:not([data-theme="light"]) .success-summary,
    :root:not([data-theme="light"]) .notice { background: var(--surface-background); }
}

@media (max-width: 560px) {
    body {
        background: var(--page-background);
    }

    .public-toolbar {
        padding: 10px 12px 0;
    }

    .shell,
    .survey-shell {
        align-items: stretch;
        min-height: auto;
        padding: 12px;
    }

    .panel,
    .survey-card {
        padding: 20px 14px;
        box-shadow: 0 10px 30px rgba(111, 70, 91, 0.09);
        backdrop-filter: none;
    }

    .survey-form-card {
        padding-bottom: 112px;
    }

    .survey-card::before {
        margin-bottom: 14px;
    }

    h1 {
        font-size: 22px;
    }

    .muted,
    .question-help {
        line-height: 1.55;
    }

    .captcha-display,
    .captcha-slots {
        gap: 6px;
    }

    .captcha-display {
        padding: 10px;
    }

    .captcha-display span {
        width: 32px;
        height: 38px;
        font-size: 21px;
    }

    .captcha-slots span {
        width: 34px;
        height: 42px;
        font-size: 21px;
    }

    .number-keypad {
        gap: 8px;
    }

    .number-keypad button {
        min-height: 44px;
        font-size: 17px;
    }

    .step-indicator {
        justify-content: center;
        margin: 12px 0 18px;
    }

    .step-title h2 {
        font-size: 20px;
    }

    .question {
        padding: 14px;
    }

    .question legend {
        font-size: 16px;
    }

    .option-grid,
    .time-pair {
        grid-template-columns: 1fr;
    }

    .survey-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 0;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        background: rgba(255, 248, 251, 0.96);
        box-shadow: 0 -10px 28px rgba(111, 70, 91, 0.12);
    }

    .survey-actions .button {
        width: 100%;
        min-height: 46px;
        margin-top: 0;
        padding: 0 12px;
    }

    .survey-actions [data-submit-survey] {
        grid-column: auto;
    }

    .survey-actions.is-first {
        grid-template-columns: 1fr;
    }

    .survey-actions.is-last {
        grid-template-columns: 0.8fr 1.4fr;
    }

    .copy-row {
        display: grid;
        gap: 10px;
    }

    .copy-button {
        width: 100%;
    }
}
