.aa-match-wrapper {
    --aa-match-bg: #fffafa;
    --aa-match-surface: #ffffff;
    --aa-match-text: #352a31;
    --aa-match-muted: #7a6570;
    --aa-match-border: #eadedf;
    --aa-match-primary: #812023;
    --aa-match-primary-strong: #681a1c;
    --aa-match-primary-soft: rgba(129, 32, 35, 0.12);
    --aa-match-accent: #a4a23a;
    --aa-match-success: #2f7d5d;
    --aa-match-focus: rgba(129, 32, 35, 0.25);
    --aa-match-shadow: 0 14px 36px rgba(53, 36, 39, 0.1);
    --aa-match-radius-xl: 24px;
    --aa-match-radius-lg: 16px;
    --aa-match-radius-md: 12px;
    --aa-match-space-1: 0.5rem;
    --aa-match-space-2: 0.75rem;
    --aa-match-space-3: 1rem;
    --aa-match-space-4: 1.5rem;
    --aa-match-space-5: 2rem;
    --aa-match-space-6: 2.75rem;

    color: var(--aa-match-text);
    font: inherit;
    max-width: 760px;
    margin: 2rem auto;
    padding: clamp(1.25rem, 2.2vw, 2.4rem);
    background: #e8e1d7;
    border: 1px solid var(--aa-match-border);
    border-radius: var(--aa-match-radius-xl);
    box-shadow: var(--aa-match-shadow);
    box-sizing: border-box;
}

.aa-match-wrapper *,
.aa-match-wrapper *::before,
.aa-match-wrapper *::after {
    box-sizing: inherit;
}

.aa-match-divi-compatible {
    line-height: 1.6;
}

.aa-match-feedback {
    white-space: pre-line;
}

.aa-match-header {
    text-align: center;
    margin-bottom: var(--aa-match-space-5);
}

.aa-match-title {
    margin: 0;
    font: inherit;
    font-weight: 700;
    font-size: clamp(1.5rem, 3.1vw, 2rem);
    line-height: 1.2;
    color: var(--aa-match-text);
    letter-spacing: 0.01em;
}

.aa-match-subtitle {
    margin: 0.75rem auto 0;
    max-width: 52ch;
    font: inherit;
    color: var(--aa-match-muted);
    font-size: clamp(0.98rem, 1.5vw, 1.08rem);
}

.aa-match-progress {
    margin-bottom: var(--aa-match-space-5);
}

.aa-match-progress-track {
    width: 100%;
    height: 0.62rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #f4eeee 0%, #efe9e9 100%);
    overflow: hidden;
    border: 1px solid rgba(129, 32, 35, 0.14);
}

.aa-match-progress-bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #812023 0%, #752022 62%, #a4a23a 100%);
    box-shadow: 0 2px 12px rgba(129, 32, 35, 0.32);
    transition: width 280ms ease;
}

.aa-match-progress-text {
    margin: 0.75rem 0 0;
    text-align: right;
    color: var(--aa-match-muted);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
}

.aa-match-step-area {
    position: relative;
    margin-bottom: var(--aa-match-space-5);
    min-height: 180px;
}

.aa-match-step {
    background: var(--aa-match-surface);
    border: 1px solid var(--aa-match-border);
    border-radius: var(--aa-match-radius-lg);
    padding: clamp(1rem, 2vw, 1.5rem);
}

.aa-match-step-title {
    margin: 0;
    font: inherit;
    font-size: clamp(1.16rem, 2vw, 1.34rem);
    font-weight: 700;
    color: var(--aa-match-text);
}

.aa-match-step-description {
    margin: 0.6rem 0 0;
    font: inherit;
    color: var(--aa-match-muted);
}

.aa-match-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--aa-match-space-3);
    margin-top: var(--aa-match-space-4);
}

.aa-match-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.aa-match-field-checkbox {
    grid-column: 1 / -1;
}

.aa-match-label {
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--aa-match-text);
}

.aa-match-label input[type="checkbox"] {
    margin-right: 0.55rem;
    vertical-align: middle;
}

.aa-match-input,
.aa-match-wrapper textarea,
.aa-match-wrapper select {
    width: 100%;
    min-height: 46px;
    padding: 0.72rem 0.85rem;
    border-radius: var(--aa-match-radius-md);
    border: 1px solid #d8cdce;
    background: #fff;
    color: var(--aa-match-text);
    font: inherit;
    line-height: 1.4;
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.aa-match-wrapper textarea {
    min-height: 120px;
    resize: vertical;
}

.aa-match-input::placeholder,
.aa-match-wrapper textarea::placeholder {
    color: #9b8f90;
}

.aa-match-input:hover,
.aa-match-wrapper textarea:hover,
.aa-match-wrapper select:hover {
    border-color: #c8b9bb;
}

.aa-match-input:focus-visible,
.aa-match-wrapper textarea:focus-visible,
.aa-match-wrapper select:focus-visible,
.aa-match-wrapper input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: var(--aa-match-primary);
    box-shadow: 0 0 0 4px var(--aa-match-focus);
}

.aa-match-wrapper input[type="radio"],
.aa-match-wrapper input[type="checkbox"] {
    accent-color: var(--aa-match-primary);
}

.aa-match-field-error {
    border-color: #a94448 !important;
    background: #fdf5f5;
}

.aa-match-error-text {
    margin: 0;
    color: #a94448;
    font-size: 0.86rem;
    font-weight: 600;
}

.aa-match-summary-list {
    margin: var(--aa-match-space-3) 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.45rem;
}

.aa-match-summary-list li {
    border: 1px solid var(--aa-match-border);
    background: #fff;
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
}

.aa-match-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--aa-match-space-3);
}

.aa-match-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    min-height: 48px;
    min-width: 140px;
    padding: 0.76rem 1.1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.aa-match-btn:hover {
    transform: translateY(-1px);
}

.aa-match-btn:active {
    transform: translateY(0);
}

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

.aa-match-btn-primary {
    color: #fff;
    border-color: var(--aa-match-primary-strong);
    background: var(--aa-match-primary);
    box-shadow: 0 8px 18px rgba(129, 32, 35, 0.3);
}

.aa-match-btn-primary:hover:not(:disabled) {
    background: var(--aa-match-primary-strong);
    box-shadow: 0 10px 22px rgba(104, 26, 28, 0.34);
}

.aa-match-btn-secondary {
    color: var(--aa-match-primary);
    border-color: var(--aa-match-primary);
    background: #fff;
}

.aa-match-btn-secondary:hover:not(:disabled) {
    border-color: var(--aa-match-accent);
    background: rgba(129, 32, 35, 0.07);
}

.aa-match-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--aa-match-focus);
}

.aa-match-theme-light {
    --aa-match-bg: #ffffff;
    --aa-match-surface: #ffffff;
    --aa-match-text: #2d2b31;
    --aa-match-muted: #67606a;
}

.aa-match-theme-dark {
    --aa-match-bg: #1f1718;
    --aa-match-surface: #2a1f20;
    --aa-match-text: #f4eceb;
    --aa-match-muted: #d2bdbb;
    --aa-match-border: #4d3637;
    --aa-match-primary-soft: rgba(129, 32, 35, 0.26);
    --aa-match-focus: rgba(129, 32, 35, 0.35);
    --aa-match-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
}

.aa-match-theme-dark .aa-match-input,
.aa-match-theme-dark .aa-match-wrapper textarea,
.aa-match-theme-dark .aa-match-wrapper select,
.aa-match-theme-dark .aa-match-summary-list li,
.aa-match-theme-dark .aa-match-step {
    background: #332728;
    color: var(--aa-match-text);
    border-color: #5e4748;
}

.aa-match-theme-dark .aa-match-btn-secondary {
    background: transparent;
    color: #f4eceb;
    border-color: #a4a23a;
}

@media (max-width: 767px) {
    .aa-match-wrapper {
        margin: 1rem auto;
        padding: 1rem;
        border-radius: 18px;
    }

    .aa-match-header {
        margin-bottom: var(--aa-match-space-4);
        text-align: left;
    }

    .aa-match-progress-text {
        text-align: left;
        margin-top: 0.6rem;
    }

    .aa-match-step-area {
        min-height: 160px;
        margin-bottom: var(--aa-match-space-4);
    }

    .aa-match-fields-grid {
        grid-template-columns: 1fr;
        gap: var(--aa-match-space-2);
    }

    .aa-match-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .aa-match-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aa-match-progress-bar,
    .aa-match-btn,
    .aa-match-input,
    .aa-match-wrapper textarea,
    .aa-match-wrapper select {
        transition: none !important;
    }
}
