:root {
    color-scheme: light;
    --primary: #1677d2;
    --primary-dark: #0f62b2;
    --ai-start: #6c54e8;
    --ai-end: #3979e7;
    --text: #242424;
    --muted: #777d85;
    --border: #d8dde3;
    --page: #f3f5f7;
    --surface: #ffffff;
    --danger: #d64545;
    --success: #168c54;
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background: var(--page);
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.page-shell {
    width: 100%;
    padding: 18px 12px calc(28px + env(safe-area-inset-bottom));
}

.form-card {
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 28px 20px 24px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 5px 24px rgb(30 45 60 / 7%);
}

.form-header {
    margin-bottom: 34px;
}

.form-kicker {
    margin: 0 0 24px;
    color: #24679f;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
}

h1 {
    margin: 0;
    font-size: 27px;
    line-height: 1.4;
}

.form-description {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}

.form-section {
    min-width: 0;
    margin: 0 0 34px;
    padding: 0;
    border: 0;
}

legend,
.field-label {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 23px;
    font-weight: 700;
    line-height: 1.4;
}

.required {
    color: #de5c5c;
}

.field-help {
    margin: 8px 0 17px;
    color: #92979d;
    font-size: 15px;
    line-height: 1.65;
}

.radio-list {
    display: grid;
    gap: 11px;
}

.radio-option {
    position: relative;
    display: flex;
    min-height: 58px;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.radio-option:has(input:checked) {
    border-color: var(--primary);
    background: #f3f8fe;
}

.radio-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.radio-mark {
    width: 23px;
    height: 23px;
    margin-right: 13px;
    border: 2px solid #c7cdd4;
    border-radius: 50%;
    background: white;
    box-shadow: inset 0 0 0 5px white;
}

.radio-option input:checked + .radio-mark {
    border-color: var(--primary);
    background: var(--primary);
}

.radio-option input:focus-visible + .radio-mark {
    outline: 3px solid rgb(22 119 210 / 25%);
    outline-offset: 2px;
}

.radio-text {
    font-size: 18px;
}

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

.textarea-wrap {
    position: relative;
}

textarea,
input[type="text"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    background: white;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
    min-height: 230px;
    padding: 16px 16px 62px;
    line-height: 1.7;
    resize: vertical;
}

input[type="text"] {
    height: 58px;
    margin-top: 17px;
    padding: 0 16px;
}

textarea:focus,
input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(22 119 210 / 12%);
}

textarea::placeholder,
input::placeholder {
    color: #b0b5ba;
}

.char-count {
    color: #9aa0a6;
    font-size: 12px;
    white-space: nowrap;
}

.textarea-footer {
    position: absolute;
    right: 13px;
    bottom: 10px;
    left: 13px;
    display: flex;
    min-height: 36px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.voice-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: 0;
    border: 0;
    color: #416b9d;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
}

.voice-button:focus-visible {
    border-radius: 4px;
    outline: 3px solid rgb(22 119 210 / 20%);
    outline-offset: 2px;
}

.voice-button:disabled {
    cursor: wait;
    opacity: 0.58;
}

.voice-icon {
    position: relative;
    width: 14px;
    height: 20px;
    margin: 0 9px 0 3px;
    border: 2px solid currentColor;
    border-radius: 8px;
}

.voice-icon::before {
    position: absolute;
    right: -6px;
    bottom: -6px;
    left: -6px;
    height: 12px;
    border: 2px solid currentColor;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    content: "";
}

.voice-icon::after {
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 8px;
    border-bottom: 2px solid currentColor;
    content: "";
    transform: translateX(-50%);
}

.voice-button.is-listening {
    color: #d64545;
}

.voice-button.is-listening .voice-icon {
    animation: voice-pulse 1.1s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgb(214 69 69 / 28%);
    }
    50% {
        box-shadow: 0 0 0 8px rgb(214 69 69 / 0%);
    }
}

.polish-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 13px;
}

.button {
    min-height: 45px;
    padding: 0 18px;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
}

.button:focus-visible {
    outline: 3px solid rgb(22 119 210 / 25%);
    outline-offset: 2px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.66;
}

.button-ai {
    color: white;
    background: linear-gradient(120deg, var(--ai-start), var(--ai-end));
    box-shadow: 0 5px 14px rgb(83 91 222 / 22%);
}

.ai-icon {
    margin-right: 5px;
}

.button-ghost {
    color: #4c6080;
    background: #eef3f9;
}

.button-submit {
    width: 100%;
    min-height: 58px;
    color: white;
    background: var(--primary);
    font-size: 21px;
}

.button-submit:not(:disabled):active {
    background: var(--primary-dark);
}

.action-status,
.field-error,
.submit-error {
    min-height: 20px;
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.5;
}

.status-success {
    color: var(--success);
}

.status-error,
.field-error,
.submit-error {
    color: var(--danger);
}

.privacy-hint {
    margin: 9px 0 0;
    color: #9aa0a6;
    font-size: 13px;
}

.dialog-backdrop {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgb(17 27 38 / 55%);
}

.dialog-backdrop[hidden] {
    display: none;
}

.dialog-card {
    width: min(100%, 420px);
    padding: 30px 22px 22px;
    border-radius: 14px;
    background: white;
    text-align: center;
    box-shadow: 0 14px 50px rgb(0 0 0 / 22%);
}

.dialog-card h2 {
    margin: 12px 0 8px;
}

.dialog-card p {
    color: var(--muted);
    line-height: 1.6;
}

.success-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--success);
    font-size: 30px;
}

.feedback-number strong {
    color: var(--text);
}

@media (min-width: 700px) {
    .page-shell {
        padding-top: 34px;
    }

    .form-card {
        padding: 40px 46px 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
