/*
 * 心迹心理测评 front-end styles.
 * Scoped to .xinli-page and designed to inherit Zibll CSS variables.
 */

.xinli-page {
    /*
     * Warm terracotta accent. This site must not use green: in a clinical
     * grade scale green reads as "nothing wrong", which is the opposite of
     * what the accent is used for here.
     */
    /* Fixed warm accent. Inheriting Zibll --focus-color was tried first, but
     this site's focus colour is teal-green and green is forbidden here, so
     the plugin keeps its own accent and adapts to the theme everywhere else. */
    /* 主色：加深的樱花玫瑰，用于文字与描边，保证在白底上可读。
       实心填充单独用 --xl-accent-solid（参考图的樱花粉），浅底配深字。 */
    --xl-accent: #a8586b;
    --xl-accent-soft: rgba(243, 199, 207, 0.34);
    --xl-accent-solid: #f3c7cf;
    --xl-accent-ink: #5c2f3a;
    --xl-text: #3d3236;
    --xl-muted: #7d6b70;
    --xl-muted-2: #a2939a;
    --xl-bg: #fffdfa;
    --xl-soft: #fbf3ef;
    --xl-border: rgba(47, 42, 36, 0.10);
    --xl-radius: var(--main-radius, 14px);
    --xl-danger: #a94a53;
    --xl-warn: #a8772f;
    --xl-warn-soft: rgba(242, 217, 160, 0.36);
    --xl-good: #a98a76;
    /* Surfaces used by plugin components. Dark theme overrides these below. */
    --xl-surface: var(--xl-bg);
    --xl-surface-2: var(--xl-soft);
    --xl-glass: #ffffff;
    --xl-glass-soft: rgba(255, 255, 255, 0.94);
    --xl-tint: #fdf6f2;
    --xl-tint-2: #fdf9f6;
    --xl-tint-3: #fffdfb;
    --xl-amber-soft: #fff7ea;
    --xl-amber-line: #efdcc4;
    --xl-amber-ink: #a66b2b;
    --xl-line-soft: #f0dfe0;
    --xl-line-strong: #e7cfd2;
    --xl-shadow: rgba(122, 86, 96, 0.08);
    color: var(--xl-text);
}

.xinli-page .xinli-main {
    padding-top: 22px;
    padding-bottom: 54px;
}

.xinli-page .xinli-main::after {
    content: "";
    display: table;
    clear: both;
}

.xinli-page .xinli-layout {
    float: none;
    width: 100%;
    max-width: 980px;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 0;
    margin-bottom: 0;
}

.xinli-page .xinli-layout *,
.xinli-page .xinli-layout *::before,
.xinli-page .xinli-layout *::after {
    box-sizing: border-box;
}

.xinli-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 2px 16px;
    font-size: 13px;
    color: var(--xl-muted);
    flex-wrap: wrap;
}

.xinli-breadcrumb a {
    color: var(--xl-muted);
    text-decoration: none;
}

.xinli-breadcrumb a:hover {
    color: var(--xl-accent);
}

.xinli-breadcrumb span[aria-current] {
    color: var(--xl-text);
}

.xinli-card {
    position: relative;
    background: var(--xl-bg);
    border: 1px solid var(--xl-border);
    border-radius: var(--xl-radius);
    padding: 28px;
    margin-bottom: 18px;
    box-shadow: 0 12px 34px var(--xl-shadow);
}

.xinli-page .xinli-card h2,
.xinli-page .xinli-card h3,
.xinli-page .xinli-card p {
    margin-top: 0;
}

.xinli-hero {
    display: flex;
    gap: 20px;
    padding: 30px 32px;
    border-radius: calc(var(--xl-radius) + 2px);
    border: 1px solid var(--xl-border);
    background:
        radial-gradient(ellipse 70% 110% at 100% 0%, rgba(226, 148, 166, 0.10), transparent 60%),
        linear-gradient(145deg, var(--xl-bg), var(--xl-soft));
    margin-bottom: 18px;
    overflow: hidden;
}

.xinli-hero-icon {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
    border: 1px solid var(--xl-border);
}

.xinli-hero-icon .xinli-svg {
    width: 30px;
    height: 30px;
}

.xinli-hero-main {
    min-width: 0;
    flex: 1;
}

.xinli-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--xl-muted);
    margin-bottom: 8px;
}

.xinli-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
    border: 1px solid var(--xl-border);
}

.xinli-badge-soft {
    color: var(--xl-muted);
    background: transparent;
}

.xinli-badge-warn {
    color: var(--xl-warn);
    background: rgba(154, 106, 32, 0.08);
    border-color: rgba(154, 106, 32, 0.18);
}

.xinli-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.22;
    letter-spacing: -0.02em;
    color: var(--xl-text);
    font-weight: 700;
}

.xinli-abbr {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 8px;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
    border: 1px solid var(--xl-border);
}

.xinli-tagline {
    margin: 0 0 14px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--xl-muted);
}

.xinli-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--xl-muted);
}

.xinli-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.xinli-svg {
    width: 1.15em;
    height: 1.15em;
    flex: 0 0 auto;
    vertical-align: -0.16em;
}

.xinli-hero-compact {
    align-items: flex-start;
    padding: 26px 30px;
}

.xinli-hero-compact h1 {
    font-size: clamp(24px, 3vw, 32px);
}

.xinli-hero-compact p {
    margin: 0;
    color: var(--xl-muted);
    font-size: 14px;
    line-height: 1.75;
}

.xinli-intro .xinli-lead {
    font-size: 15.5px;
    line-height: 1.85;
    color: var(--xl-muted);
    margin-bottom: 20px;
}

.xinli-section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.xinli-section-heading h2,
.xinli-section-heading h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.4;
    color: var(--xl-text);
    font-weight: 700;
}

.xinli-section-index {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
}

.xinli-instruction {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--xl-border);
    background: var(--xl-soft);
    margin-bottom: 18px;
}

.xinli-instruction > .xinli-svg {
    width: 20px;
    height: 20px;
    color: var(--xl-accent);
    margin-top: 2px;
}

.xinli-instruction strong {
    display: block;
    margin-bottom: 4px;
    color: var(--xl-text);
}

.xinli-instruction p {
    margin: 0;
    font-size: 14px;
    line-height: 1.75;
    color: var(--xl-muted);
}

.xinli-notice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.xinli-notice-grid > div {
    padding: 15px;
    border-radius: 12px;
    background: var(--xl-soft);
    border: 1px solid var(--xl-border);
}

.xinli-notice-grid strong {
    display: block;
    margin-bottom: 5px;
    color: var(--xl-text);
    font-size: 14px;
}

.xinli-notice-grid p {
    margin: 0;
    font-size: 13px;
    line-height: 1.68;
    color: var(--xl-muted);
}

.xinli-privacy-note {
    padding: 14px 16px;
    border-left: 3px solid var(--xl-accent);
    background: var(--xl-soft);
    border-radius: 0 10px 10px 0;
    margin: 14px 0;
}

.xinli-privacy-note strong {
    display: block;
    margin-bottom: 3px;
    color: var(--xl-text);
}

.xinli-privacy-note p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--xl-muted);
}

.xinli-details {
    border-top: 1px solid var(--xl-border);
    padding-top: 12px;
    margin-top: 14px;
    font-size: 13px;
    color: var(--xl-muted);
}

.xinli-details summary {
    cursor: pointer;
    color: var(--xl-accent);
    font-weight: 600;
    list-style: none;
}

.xinli-details summary::-webkit-details-marker {
    display: none;
}

.xinli-details summary::before {
    content: "+";
    display: inline-block;
    width: 18px;
    color: var(--xl-accent);
}

.xinli-details[open] summary::before {
    content: "−";
}

.xinli-details-body {
    padding-top: 10px;
    line-height: 1.75;
}

.xinli-details-body p {
    margin: 0 0 6px;
}

.xinli-start-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.xinli-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.xinli-btn:hover {
    transform: translateY(-1px);
}

.xinli-btn:focus-visible {
    outline: 3px solid var(--xl-accent-soft);
    outline-offset: 2px;
}

.xinli-btn-primary {
    /* 浅樱粉上放白字对比度只有 1.6:1，改为深玫瑰字，保持柔和但不牺牲可读性。 */
    color: var(--xl-accent-ink) !important;
    background: var(--xl-accent-solid);
    border-color: var(--xl-accent-solid);
    box-shadow: 0 8px 20px rgba(168, 88, 107, 0.16);
}

.xinli-btn-primary:hover {
    color: var(--xl-accent-ink) !important;
    background: #eebbc5;
    border-color: #eebbc5;
}

.xinli-btn-secondary {
    color: var(--xl-accent) !important;
    background: var(--xl-surface-2);
    border-color: var(--xl-border);
}

.xinli-btn-ghost {
    color: var(--xl-muted) !important;
    background: transparent;
    border-color: var(--xl-border);
}

.xinli-btn-ghost:hover {
    color: var(--xl-accent) !important;
    background: var(--xl-accent-soft);
}

.xinli-btn-block {
    width: 100%;
    margin-top: 12px;
}

.xinli-btn-small {
    min-height: 36px;
    padding: 6px 13px;
    font-size: 13px;
}

.xinli-form-card {
    padding: 0;
}

.xinli-form-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 26px 28px 14px;
}

.xinli-form-head h2 {
    margin: 0;
    font-size: 22px;
}

.xinli-form-progress-label {
    font-size: 13px;
    color: var(--xl-muted);
    white-space: nowrap;
}

.xinli-form-progress-label span[data-xinli-answered] {
    font-weight: 700;
    color: var(--xl-accent);
    font-size: 16px;
}

.xinli-form-progress {
    height: 5px;
    margin: 0 28px;
    border-radius: 999px;
    background: var(--xl-soft);
    overflow: hidden;
}

.xinli-form-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--xl-accent);
    border-radius: inherit;
    transition: width 0.25s ease;
}

.xinli-section-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 16px 28px 4px;
    scrollbar-width: thin;
}

.xinli-section-nav a {
    flex: 0 0 auto;
    padding: 6px 11px;
    border: 1px solid var(--xl-border);
    border-radius: 999px;
    color: var(--xl-muted);
    font-size: 12.5px;
    text-decoration: none;
    background: var(--xl-soft);
}

.xinli-section-nav a:hover {
    color: var(--xl-accent);
    border-color: var(--xl-accent);
}

.xinli-form {
    padding: 0 28px 28px;
}

.xinli-form [hidden] {
    display: none !important;
}

.xinli-wizard-head {
    scroll-margin-top: 96px;
    padding: 16px 0 0;
}

.xinli-wizard-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.xinli-wizard-crumb {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex-wrap: wrap;
}

.xinli-wizard-step-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--xl-accent);
    letter-spacing: 0.01em;
}

.xinli-wizard-section-label {
    font-size: 12px;
    color: var(--xl-muted-2);
    padding-left: 9px;
    border-left: 1px solid var(--xl-border);
}

.xinli-wizard-section-label:empty {
    display: none;
}

.xinli-wizard-count {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--xl-muted-2);
    white-space: nowrap;
}

.xinli-wizard-count span:first-child {
    color: var(--xl-accent);
    font-weight: 700;
    font-size: 15px;
}

.xinli-wizard-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--xl-soft);
    overflow: hidden;
}

.xinli-wizard-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--xl-accent);
    transition: width 0.25s ease;
}

.xinli-wizard-stage {
    padding-top: 18px;
}

.xinli-wizard-start,
.xinli-wizard-finish {
    padding: 24px;
    border: 1px solid var(--xl-border);
    border-radius: 14px;
    background:
        radial-gradient(ellipse 70% 100% at 100% 0%, var(--xl-accent-soft), transparent 65%),
        var(--xl-soft);
}

.xinli-wizard-start-icon,
.xinli-wizard-finish-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--xl-accent);
    background: var(--xl-bg);
    border: 1px solid var(--xl-border);
    margin-bottom: 12px;
}

.xinli-wizard-start-icon .xinli-svg,
.xinli-wizard-finish-icon .xinli-svg {
    width: 24px;
    height: 24px;
}

.xinli-wizard-start h3,
.xinli-wizard-finish h3 {
    margin: 0 0 7px;
    font-size: 21px;
    color: var(--xl-text);
}

.xinli-wizard-start > p,
.xinli-wizard-finish > p {
    margin: 0 0 14px;
    color: var(--xl-muted);
    line-height: 1.75;
    font-size: 14px;
}

.xinli-wizard-start .xinli-consent-box {
    background: var(--xl-bg);
    margin: 16px 0;
}

.xinli-wizard-start-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.xinli-wizard-finish-icon {
    color: var(--xl-good);
}

.xinli-profile-fields {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 12px 0 4px;
    padding: 7px 0;
    border-top: 1px dashed var(--xl-border);
    color: var(--xl-muted-2);
    font-size: 12px;
}

.xinli-profile-hint {
    flex: 0 0 auto;
    opacity: 0.85;
}

.xinli-profile-fields label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-weight: 400;
}

.xinli-profile-fields .xinli-optional {
    color: var(--xl-muted-2);
    font-size: 11.5px;
    opacity: 0.9;
}

.xinli-profile-fields input {
    width: 110px;
    padding: 2px 3px;
    border: 0;
    border-bottom: 1px solid var(--xl-border);
    border-radius: 0;
    background: transparent;
    color: var(--xl-text);
    font-size: 12px;
    line-height: 1.5;
    box-shadow: none;
}

.xinli-profile-fields input[type="date"] {
    width: 132px;
}

.xinli-profile-fields input:focus {
    outline: none;
    border-bottom-color: var(--xl-accent);
}

.xinli-wizard-finish-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding-top: 12px;
    border-top: 1px solid var(--xl-border);
    color: var(--xl-muted-2);
    font-size: 12.5px;
    line-height: 1.65;
}

.xinli-wizard-finish-note .xinli-svg {
    color: var(--xl-accent);
    margin-top: 2px;
}

.xinli-form.is-wizard .xinli-section-nav {
    margin-top: 14px;
    padding: 0 0 4px;
}

.xinli-form.is-wizard .xinli-section {
    border-top: 0;
    margin: 0;
    padding: 0;
}

.xinli-form.is-wizard .xinli-section-heading {
    display: none;
}

.xinli-form.is-wizard .xinli-item {
    display: none;
    margin: 0;
}

/* One question at a time: the switch is a real transition, so it gets the
   same unhurried easing as the report rather than the old 200ms linear snap. */
.xinli-form.is-wizard .xinli-item.is-current {
    animation: xinli-step-in 520ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
}

.xinli-form.is-wizard .xinli-item.is-current {
    display: block;
}

.xinli-form.is-wizard .xinli-wizard-questions {
    min-height: 200px;
}

.xinli-wizard-nav {
    position: sticky;
    bottom: 10px;
    z-index: 22;
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 20px;
    padding: 9px 11px;
    border: 1px solid var(--xl-border);
    border-radius: 13px;
    background: var(--xl-bg);
    box-shadow: 0 10px 30px rgba(20, 50, 52, 0.15);
    backdrop-filter: blur(8px);
}

.xinli-wizard-nav-mid {
    flex: 1;
    min-width: 0;
    text-align: center;
    color: var(--xl-muted-2);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xinli-wizard-nav .xinli-btn {
    flex: 0 0 auto;
}

@keyframes xinli-step-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.xinli-consent-box {
    margin: 18px 0 6px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--xl-border);
    background: var(--xl-soft);
    font-size: 13px;
    line-height: 1.7;
    color: var(--xl-muted);
}

.xinli-consent-box label {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    cursor: pointer;
}

.xinli-consent-box input {
    margin-top: 4px;
    accent-color: var(--xl-accent);
}

.xinli-section {
    padding-top: 22px;
    border-top: 1px solid var(--xl-border);
    margin-top: 18px;
}

.xinli-section:first-of-type {
    border-top: 0;
    margin-top: 8px;
}

.xinli-section .xinli-section-heading {
    margin-bottom: 16px;
}

.xinli-section .xinli-section-heading h3 {
    font-size: 18px;
}

.xinli-item {
    padding: 18px 18px 16px;
    border: 1px solid var(--xl-border);
    border-radius: 12px;
    margin-bottom: 12px;
    background: var(--xl-bg);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.xinli-item:focus-within {
    border-color: var(--xl-accent);
    box-shadow: 0 0 0 3px var(--xl-accent-soft);
}

.xinli-item.has-error {
    border-color: rgba(176, 68, 68, 0.55);
    background: rgba(176, 68, 68, 0.025);
}

.xinli-item.is-answered {
    border-color: rgba(226, 148, 166, 0.28);
}

.xinli-item-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.xinli-qnum {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
}

.xinli-qtext {
    min-width: 0;
    flex: 1;
}

.xinli-qtext p {
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
    color: var(--xl-text);
}

.xinli-required {
    color: var(--xl-danger);
    margin-left: 5px;
    font-size: 13px;
}

.xinli-item-help {
    margin: 5px 0 0 !important;
    font-size: 12.5px !important;
    line-height: 1.65 !important;
    color: var(--xl-muted-2) !important;
}

.xinli-options {
    display: grid;
    gap: 8px;
}

.xinli-options.is-grid {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
}

.xinli-options.is-list {
    grid-template-columns: 1fr;
}

.xinli-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid var(--xl-border);
    border-radius: 12px;
    background: var(--xl-soft);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.xinli-option:hover {
    border-color: var(--xl-accent);
}

.xinli-option.is-checked {
    border-color: var(--xl-accent);
    background: var(--xl-accent-soft);
}

.xinli-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* The radio itself is the single visible circle; the whole label remains clickable. */
.xinli-option-radio input[type="radio"] {
    position: relative !important;
    display: inline-block !important;
    flex: 0 0 18px !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer;
    -webkit-appearance: none !important;
    appearance: none !important;
    border: 1.5px solid var(--xl-muted-2);
    border-radius: 50%;
    background: var(--xl-bg);
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.xinli-option-radio input[type="radio"]:hover {
    border-color: var(--xl-accent);
}

.xinli-option-radio input[type="radio"]:checked {
    border-color: var(--xl-accent);
    background: var(--xl-accent);
    box-shadow: inset 0 0 0 3px var(--xl-bg);
}

.xinli-option-radio input[type="radio"]:focus-visible {
    outline: 2px solid var(--xl-accent-soft);
    outline-offset: 2px;
}

.xinli-option:focus-within {
    outline: 2px solid var(--xl-accent-soft);
    outline-offset: 1px;
}

.xinli-option-text {
    min-width: 0;
    display: block;
    font-size: 15px;
    line-height: 1.45;
}

.xinli-option-short {
    display: block;
    text-align: center;
    white-space: normal;
}

.xinli-option-full {
    display: none;
}

.xinli-options.is-list .xinli-option {
    align-items: flex-start;
    padding: 11px 12px;
    background: var(--xl-bg);
}

.xinli-options.is-list .xinli-option-short {
    display: none;
}

.xinli-options.is-list .xinli-option-full {
    display: block;
    text-align: left;
    font-size: 13.5px;
    color: var(--xl-text);
}

.xinli-option input:checked ~ .xinli-option-text {
    color: var(--xl-accent);
    font-weight: 600;
}

.xinli-option-check .xinli-checkbox {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--xl-muted-2);
    background: var(--xl-bg);
    position: relative;
}

.xinli-option-check input:checked + .xinli-checkbox {
    background: var(--xl-accent);
    border-color: var(--xl-accent);
}

.xinli-option-check input:checked + .xinli-checkbox::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.xinli-option-check input:checked ~ .xinli-option-text {
    color: var(--xl-accent);
    font-weight: 600;
}

.xinli-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.xinli-input-row input {
    width: min(240px, 100%);
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid var(--xl-border);
    border-radius: 9px;
    background: var(--xl-soft);
    color: var(--xl-text);
    font-size: 15px;
}

.xinli-input-row input:focus {
    outline: none;
    border-color: var(--xl-accent);
    box-shadow: 0 0 0 3px var(--xl-accent-soft);
}

.xinli-input-unit {
    color: var(--xl-muted);
    font-size: 13px;
}

.xinli-item-error {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 9px 0 0 !important;
    color: var(--xl-danger) !important;
    font-size: 12.5px !important;
}

.xinli-submit-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 22px;
    border-top: 1px solid var(--xl-border);
    margin-top: 20px;
}

.xinli-submit-row .xinli-small {
    max-width: 440px;
    margin: 0;
}

.xinli-sticky-progress {
    position: sticky;
    bottom: 12px;
    z-index: 20;
    margin: 0 16px 16px;
    padding: 8px 12px;
    border: 1px solid var(--xl-border);
    border-radius: 13px;
    background: var(--xl-bg);
    box-shadow: 0 10px 30px rgba(20, 50, 52, 0.15);
    backdrop-filter: blur(8px);
}

.xinli-sticky-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.xinli-sticky-text {
    font-size: 12px;
    color: var(--xl-muted);
    white-space: nowrap;
}

.xinli-sticky-text strong {
    color: var(--xl-accent);
    font-size: 15px;
}

.xinli-sticky-track {
    flex: 1;
    height: 7px;
    border-radius: 999px;
    background: var(--xl-soft);
    overflow: hidden;
}

.xinli-sticky-track span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--xl-accent);
    border-radius: inherit;
    transition: width 0.25s ease;
}

.xinli-small {
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--xl-muted-2);
}

.xinli-muted {
    color: var(--xl-muted);
}

.xinli-alert {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 15px 17px;
    border-radius: 12px;
    border: 1px solid var(--xl-border);
    margin-bottom: 18px;
    font-size: 13.5px;
    line-height: 1.7;
}

.xinli-alert > .xinli-svg {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex: 0 0 20px;
}

.xinli-alert strong {
    display: block;
    margin-bottom: 2px;
    color: var(--xl-text);
}

.xinli-alert p {
    margin: 0;
    color: var(--xl-muted);
}

.xinli-alert-error {
    background: rgba(176, 68, 68, 0.065);
    border-color: rgba(176, 68, 68, 0.20);
    color: var(--xl-danger);
}

.xinli-alert-error > .xinli-svg,
.xinli-alert-error strong {
    color: var(--xl-danger);
}

.xinli-alert-warn {
    background: rgba(154, 106, 32, 0.065);
    border-color: rgba(154, 106, 32, 0.18);
}

.xinli-alert-warn > .xinli-svg {
    color: var(--xl-warn);
}

.xinli-alert-info {
    background: var(--xl-accent-soft);
    border-color: var(--xl-border);
}

.xinli-alert-info > .xinli-svg {
    color: var(--xl-accent);
}

.xinli-locked {
    max-width: 680px;
    margin: 46px auto;
    padding: 48px 34px;
    text-align: center;
    background: var(--xl-bg);
    border: 1px solid var(--xl-border);
    border-radius: calc(var(--xl-radius) + 2px);
    box-shadow: 0 16px 40px var(--xl-shadow);
}

.xinli-locked-icon {
    width: 70px;
    height: 70px;
    border-radius: 22px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
    border: 1px solid var(--xl-border);
}

.xinli-locked-icon .xinli-svg {
    width: 32px;
    height: 32px;
}

.xinli-locked h1 {
    margin: 0 0 10px;
    font-size: clamp(24px, 4vw, 32px);
    color: var(--xl-text);
}

.xinli-locked p {
    margin: 0 auto 16px;
    max-width: 520px;
    color: var(--xl-muted);
    line-height: 1.75;
    font-size: 14.5px;
}

.xinli-empty {
    text-align: center;
    color: var(--xl-muted);
}

.xinli-empty-state {
    padding: 34px 18px;
    text-align: center;
}

.xinli-empty-state .xinli-svg {
    width: 38px;
    height: 38px;
    color: var(--xl-accent);
}

.xinli-empty-state h2 {
    margin: 10px 0 5px;
    font-size: 20px;
}

.xinli-empty-state p {
    margin: 0;
    color: var(--xl-muted);
}

/* Result */
.xinli-result-summary {
    padding: 30px;
}

.xinli-result-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    margin-bottom: 20px;
}

.xinli-result-head-main {
    min-width: 0;
}

.xinli-result-head-main h2 {
    margin: 2px 0 8px;
    font-size: clamp(26px, 3.4vw, 38px);
    line-height: 1.25;
    color: var(--xl-text);
}

.xinli-result-head-main p {
    margin: 0;
    max-width: 660px;
    color: var(--xl-muted);
    line-height: 1.75;
    font-size: 14.5px;
}

.xinli-score-orb {
    /*
     * 只铺圆心柔光。进度弧由 ::before 用 mask 抠成环带，剩余轨道由 ::after
     * 单独画 —— 早先把 conic-gradient 直接写在圆心上，边界会变成一条从圆心
     * 切到边缘的直线，把半圆劈成两色。
     */
    background: radial-gradient(circle at 35% 25%, var(--xl-accent-soft), var(--xl-bg) 72%);
    flex: 0 0 140px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--xl-border);
    box-shadow: inset 0 0 0 7px var(--xl-bg);
    /*
     * position: relative is load-bearing here. The ring sweep (::after) and the
     * percentage ring (::before) both anchor to this box; without it they
     * resolve against the nearest positioned ancestor and land elsewhere.
     */
    position: relative;
}

/*
 * 未得分轨道：与 ::before 同一几何（inset -5px、同样的 mask 环带），
 * 只画 --xli-pct 之后的那一段，颜色是极淡的中性灰。
 * 必须抠成环带，否则 conic-gradient 的边界会在圆心外拉出一条直线切痕。
 */
.xinli-score-orb::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: conic-gradient(from -90deg,
            transparent 0 var(--xli-pct, 0%),
            rgba(0, 0, 0, 0.05) var(--xli-pct, 0%) 100%);
    -webkit-mask: radial-gradient(circle, transparent 0 64%, #000 65%);
    mask: radial-gradient(circle, transparent 0 64%, #000 65%);
    pointer-events: none;
}

/* 得分占比环：从 12 点方向顺时针铺到 --xli-pct。 */
.xinli-score-orb::before {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: conic-gradient(from -90deg,
            var(--xl-accent) 0 var(--xli-pct, 0%),
            transparent var(--xli-pct, 0%) 100%);
    -webkit-mask: radial-gradient(circle, transparent 0 64%, #000 65%);
    mask: radial-gradient(circle, transparent 0 64%, #000 65%);
    pointer-events: none;
    opacity: 0.85;
    /* ::before 盖在 ::after 之上 */
    z-index: 1;
}

.xinli-score-number {
    font-size: 38px;
    line-height: 1;
    font-weight: 700;
    color: var(--xl-accent);
    letter-spacing: -0.03em;
}

.xinli-score-max {
    font-size: 12px;
    color: var(--xl-muted-2);
    margin-top: 2px;
}

/*
 * The caption under the denominator. It is deliberately the quietest line in
 * the ring: 10.5px, muted, letter-spaced, and tucked close to "/ N" so the eye
 * reads "14 / 15 总分" as one block rather than three competing rows. Without
 * it the numeral had nothing naming it and readers asked what the number was.
 *
 * The visibility line prevents any theme-wide rule (Zibll ships `small { … }`
 * and `:last-child` overrides) from blanking the label out. It is inert but it
 * costs nothing to be explicit here.
 */
.xinli-score-caption {
    display: block;
    margin-top: 5px;
    font-size: 10.5px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0.16em;
    /* 中文字距会多出一个尾空格，右侧缩进把它拉回视觉居中 */
    text-indent: 0.16em;
    color: var(--xl-muted-2);
    text-transform: none;
    visibility: visible;
    opacity: 1;
    height: auto;
    max-height: none;
    overflow: visible;
}

.xinli-tone-good .xinli-result-head-main h2 {
    color: var(--xl-good);
}

.xinli-tone-mild .xinli-result-head-main h2 {
    color: var(--xl-warn);
}

.xinli-tone-moderate .xinli-result-head-main h2 {
    color: #a35a20;
}

.xinli-tone-severe .xinli-result-head-main h2,
.xinli-tone-critical .xinli-result-head-main h2 {
    color: var(--xl-danger);
}

/*
 * The track is a pill, and the four band segments inside it are rectangles.
 * Rounding only the outer two segments (the original approach) meant the
 * inner corners were hard 90° angles sticking out past the pill's curve —
 * with `overflow: visible` they were simply painted over the rounded edge.
 * Clipping the track is the correct fix: the pill shape comes from the
 * container, the segments just fill it. The knob (`.marker`) is a sibling
 * positioned at top:50% with height 16px, so it would be half-clipped; it is
 * pulled out of the clip with margin instead of by leaving the track open.
 */
.xinli-severity-track {
    position: relative;
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    /* 让 16px 的滑块能探出 10px 的轨道，同时不被裁掉 */
    overflow: clip;
    overflow-clip-margin: 24px;
    margin: 18px 0 7px;
    /* 分段之间的淡白缝由容器的底色透出，而不是每段自己画内阴影 */
    background: var(--xl-bg);
}

.xinli-severity-track .seg {
    flex: 1;
    height: 100%;
    border-radius: 0;
    /*
     * The gutter is a real 2px margin, not a transparent border. A border
     * would only work if `background-clip: padding-box` survived — but the
     * band fills come from `.xinli-tone-bg-*` which uses the `background`
     * shorthand with `!important`, and the shorthand resets background-clip
     * to border-box, so the colour painted straight over the border and no
     * gap appeared. A margin reclaims the space from the flex line, which no
     * shorthand can undo.
     */
    margin-right: 3px;
}

@media (max-width: 600px) {
    .xinli-severity-track .seg {
        /* 窄屏色条只有 300 多像素，3px 的缝占比过大，收到 2px 保持节奏 */
        margin-right: 2px;
    }
}

.xinli-severity-track .seg:last-of-type {
    margin-right: 0;
}

.xinli-severity-track .seg-1 {
    background: #efd8dd;
}

.xinli-severity-track .seg-2 {
    background: #e3c0c6;
}

.xinli-severity-track .seg-3 {
    background: #d69aa3;
}

.xinli-severity-track .seg-4 {
    background: #c4697c;
}

.xinli-severity-track .marker {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    /*
     * The knob is 16px wide and the track is position:relative, so a marker
     * pinned to 0% or 100% hangs half outside it. The PHP side clamps the
     * reported percentage into a band a little inside each end, which keeps
     * the knob on the ruler at every score including the extremes.
     */
    transform: translate(-8px, -50%);
    border-radius: 50%;
    background: var(--xl-bg);
    border: 3px solid var(--xl-accent);
    box-shadow: 0 2px 7px rgba(20, 50, 52, 0.18);
}

.xinli-severity-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--xl-muted-2);
    margin-bottom: 18px;
}

/*
 * Band-sized ruler. Each label sits in a flex item whose width is the band's
 * share of the score range, so the label sits directly under its own segment
 * instead of being evenly spaced across the whole track.
 */
.xinli-severity-labels .xinli-ruler-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    padding: 0 4px;
    line-height: 1.35;
    text-align: center;
    border-left: 1px solid transparent;
}

.xinli-severity-labels .xinli-ruler-item b {
    font-size: 12px;
    font-weight: 600;
    color: var(--xl-muted-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xinli-severity-labels .xinli-ruler-item i {
    font-style: normal;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--xl-muted-2);
    white-space: nowrap;
}

.xinli-severity-labels .xinli-ruler-item.is-current {
    border-left-color: var(--xl-accent);
}

.xinli-severity-labels .xinli-ruler-item.is-current b {
    color: var(--xl-text);
    font-weight: 700;
}

.xinli-severity-labels .xinli-ruler-item.is-current i {
    color: var(--xl-text);
}

/* The current band stays fully saturated; the others recede so the eye
   lands on the one that applies. */
.xinli-severity-track .seg {
    opacity: 0.62;
}

.xinli-severity-track .seg.is-current {
    opacity: 1;
}

.xinli-ruler-sr {
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--xl-muted-1);
}

@media (max-width: 560px) {
    .xinli-severity-labels .xinli-ruler-item i {
        display: none;
    }

    .xinli-severity-labels .xinli-ruler-item b {
        font-size: 11px;
    }
}

.xinli-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.xinli-metrics.is-single {
    grid-template-columns: minmax(170px, 270px);
}

.xinli-metrics.is-six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.xinli-metric {
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--xl-border);
    background: var(--xl-soft);
    min-width: 0;
}

.xinli-metric-label {
    display: block;
    font-size: 12px;
    color: var(--xl-muted);
    margin-bottom: 3px;
}

.xinli-metric-value {
    display: block;
    font-size: 21px;
    line-height: 1.3;
    color: var(--xl-text);
    font-weight: 700;
}

.xinli-metric-hint {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    color: var(--xl-muted-2);
    margin-top: 3px;
}

.xinli-result-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    align-items: start;
}

.xinli-result-grid .xinli-card {
    margin-bottom: 0;
}

.xinli-interpretation p {
    margin: 0 0 12px;
    color: var(--xl-muted);
    line-height: 1.85;
    font-size: 14.5px;
}

.xinli-interpretation p:last-child {
    margin-bottom: 0;
}

.xinli-report-meta-card .xinli-dl {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 7px 9px;
    margin: 0;
    font-size: 13px;
}

.xinli-dl dt {
    color: var(--xl-muted-2);
}

.xinli-dl dd {
    margin: 0;
    color: var(--xl-text);
    overflow-wrap: anywhere;
}

.xinli-factor-list {
    display: grid;
    gap: 14px;
}

.xinli-factor {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--xl-border);
}

.xinli-factor:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.xinli-factor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 6px;
}

.xinli-factor-head strong {
    display: block;
    color: var(--xl-text);
    font-size: 14.5px;
}

.xinli-factor-head p {
    margin: 2px 0 0;
    font-size: 12.5px;
    line-height: 1.62;
    color: var(--xl-muted-2);
}

.xinli-factor-score {
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 700;
    color: var(--xl-accent);
}

.xinli-factor-score small {
    font-weight: 400;
    font-size: 12px;
    color: var(--xl-muted-2);
}

.xinli-factor-track {
    height: 7px;
    border-radius: 999px;
    background: var(--xl-soft);
    overflow: hidden;
}

.xinli-factor-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--xl-accent);
}

/*
 * Severity ramp. Deliberately avoids green: the brief for this site rules it
 * out, and on a Chinese clinical report green also reads as "normal / safe"
 * while brown-to-red reads as a graded scale. The steps keep hue moving
 * (20° -> 4°) so the sequence survives greyscale printing as well as the
 * colour-blindness types that collapse red and green.
 */
.xinli-tone-bg-good {
    background: #c9b5bd !important;
}

.xinli-tone-bg-mild {
    background: #dda5a0 !important;
}

.xinli-tone-bg-moderate {
    background: #c9737f !important;
}

.xinli-tone-bg-severe,
.xinli-tone-bg-critical {
    background: #a9485e !important;
}

.xinli-factor-level {
    margin-top: 4px;
    font-size: 12px;
    color: var(--xl-muted-2);
    text-align: right;
}

.xinli-chart-wrap {
    margin: 4px 0 20px;
}

.xinli-chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

/*
 * Charts fill the card and keep their aspect ratio; the viewBox makes them
 * scale cleanly. Each figure states its native width in --chart-w so narrow
 * screens scroll instead of shrinking 10px labels into unreadable 6px text.
 * (Capping max-width at --chart-w was tried first and turned the wide cards
 * into a thin centred strip with a tiny axis.)
 */
.xinli-chart-scroll svg {
    display: block;
    width: 100%;
    min-width: var(--chart-w, 560px);
    height: auto;
    margin: 0 auto;
}

/* ------------------------------------------------------------------
   Radar chart
   ------------------------------------------------------------------
   The bar chart needs 640px to stay legible, which is why it scrolls on a
   phone. A radar is square, so it reads at a smaller width and needs a
   lower floor; without this override the shared 640px minimum would force
   horizontal scrolling on every phone.
   ------------------------------------------------------------------ */
.xinli-radar-wrap .xinli-chart-scroll svg {
    min-width: 420px;
    max-width: 620px;
    margin: 0 auto;
}

/* Radar and bars stack vertically. Side by side was tried first, but each
   column ends up around 430px inside a 900px report card, and the bar chart
   is not legible below roughly 640px — labels collide. Stacked, both charts
   keep their natural width and stay readable. */
.xinli-chart-duo > div + div {
    margin-top: 20px;
}

.xinli-chart-duo .xinli-radar-wrap {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 560px) {
    /* A 340px floor shrank the 11.5px axis labels to roughly 7px, which is
       unreadable. The radar keeps 460px and scrolls horizontally instead,
       matching how the bar chart already behaves on a phone. */
    .xinli-radar-wrap .xinli-chart-scroll svg {
        min-width: 460px;
    }
}

/* Dark theme: the SVG draws its own light surface, so the scroll box gets a
   matching white frame and a hairline border. Without the border it reads as
   a hole punched in the dark card rather than as an embedded figure. */
body.dark-theme .xinli-radar-wrap .xinli-chart-scroll,
html.dark .xinli-radar-wrap .xinli-chart-scroll {
    background: #ffffff;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

@media print {
    .xinli-chart-duo {
        display: block;
    }

    .xinli-chart-duo > div + div {
        margin-top: 10px;
    }

    .xinli-radar-wrap .xinli-chart-scroll svg {
        min-width: 0;
    }
}

/* ------------------------------------------------------------------
   Clinical report addenda
   ------------------------------------------------------------------
   检查所见 / 危险行为预测 / 两点编码 / 答题效度 / 分类概率.
   These mirror the blocks a hospital department report prints, using the
   severity notation (+++) / (++) / (+) / (±) / (-) that clinicians read
   fluently, plus a risk table and a validity verdict.
   ------------------------------------------------------------------ */

/* ---- 检查所见: graded symptom list ---- */
.xinli-grade-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0 0 14px;
    padding: 9px 12px;
    border-radius: var(--xl-radius);
    background: var(--xl-soft);
    font-size: 12px;
    color: var(--xl-muted);
}

.xinli-grade-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.xinli-grade-legend b {
    font-family: var(--xl-mono-font, ui-monospace, monospace);
    font-size: 12px;
    font-weight: 700;
    color: var(--xl-text);
}

.xinli-grade-list {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 2px;
}

.xinli-grade-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--xl-text);
    background: var(--xl-soft);
}

.xinli-grade-item:nth-child(even) {
    background: transparent;
}

/* The marker carries the severity, so it gets the weight rather than the row.
   Three steps: severe (red), mild (amber), none (quiet grey). */
.xinli-grade-mark {
    flex: 0 0 auto;
    min-width: 42px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: right;
    color: var(--xl-muted);
}

.xinli-grade-item.is-high .xinli-grade-mark {
    color: #a13838;
}

.xinli-grade-item.is-high .xinli-grade-name {
    font-weight: 700;
}

.xinli-grade-item.is-mild .xinli-grade-mark {
    color: #9a6a20;
}

.xinli-grade-item.is-none .xinli-grade-name {
    color: var(--xl-muted);
}

/* Secondary count under a domain name, e.g. "3 / 5 项存在". */
.xinli-grade-note {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
    color: var(--xl-muted-2);
}

.xinli-grade-item.is-high .xinli-grade-note {
    color: var(--xl-muted);
}

/* ---- 危险行为预测 ---- */
.xinli-risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.xinli-risk-cell {
    display: grid;
    gap: 3px;
    padding: 13px 14px;
    border: 1px solid var(--xl-border);
    border-radius: var(--xl-radius);
    background: var(--xl-bg);
    border-left: 3px solid #c9bda9;
}

.xinli-risk-cell.is-high {
    border-left-color: #a13838;
    background: #fdf5f4;
}

body.dark-theme .xinli-risk-cell.is-high,
html.dark .xinli-risk-cell.is-high {
    background: rgba(161, 56, 56, 0.12);
}

.xinli-risk-label {
    font-size: 12px;
    color: var(--xl-muted);
}

.xinli-risk-value {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--xl-text);
    font-variant-numeric: tabular-nums;
}

.xinli-risk-cell.is-high .xinli-risk-value {
    color: #a13838;
}

.xinli-risk-band {
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--xl-muted);
}

/* ---- 两点编码 ---- */
.xinli-code-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.xinli-code-value {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    color: var(--xl-accent);
    font-variant-numeric: tabular-nums;
}

.xinli-code-desc {
    font-size: 13px;
    line-height: 1.6;
    color: var(--xl-text);
}

/* ---- 答题效度 ---- */
.xinli-validity-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 12.5px;
}

.xinli-validity-table th {
    width: 92px;
    padding: 9px 10px;
    text-align: left;
    font-weight: 700;
    color: var(--xl-text);
    border-bottom: 1px solid var(--xl-border);
    white-space: nowrap;
}

.xinli-validity-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--xl-border);
    color: var(--xl-muted);
}

.xinli-validity-table td:nth-child(2) {
    width: 130px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    color: var(--xl-text);
    font-variant-numeric: tabular-nums;
}

.xinli-validity-table tr.is-flagged td,
.xinli-validity-table tr.is-flagged th {
    background: var(--xl-warn-soft, rgba(154, 106, 32, 0.08));
}

.xinli-validity-table tr.is-flagged td:nth-child(2) {
    color: #9a6a20;
    font-weight: 700;
}

.xinli-validity-verdict {
    margin: 0;
    padding: 11px 13px;
    border-left: 3px solid var(--xl-accent);
    background: var(--xl-soft);
    border-radius: 0 8px 8px 0;
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--xl-text);
}

/* ---- 分类概率 ---- */
.xinli-class-bars {
    display: grid;
    gap: 9px;
    margin-bottom: 12px;
}

.xinli-class-row {
    display: grid;
    grid-template-columns: minmax(72px, 130px) minmax(0, 1fr) 52px;
    align-items: center;
    gap: 12px;
}

.xinli-class-label {
    font-size: 12.5px;
    color: var(--xl-muted);
    overflow-wrap: anywhere;
}

.xinli-class-row.is-current .xinli-class-label {
    color: var(--xl-text);
    font-weight: 700;
}

.xinli-class-track {
    display: block;
    height: 14px;
    border-radius: 4px;
    background: var(--xl-soft);
    overflow: hidden;
}

/* The band the score actually falls in gets a subtle outline, so the reader
   does not have to infer it from the bar length alone. */
.xinli-class-row.is-current .xinli-class-track {
    outline: 2px solid var(--xl-accent);
    outline-offset: 1px;
}

/*
 * The bar is a plain block that grows to the inline width. It was previously
 * absolutely positioned with inset:0, which stretched it across the whole
 * track and made the inline width do nothing — every row then looked the same
 * width, and the highlighted row appeared to lose its bar entirely.
 */
.xinli-class-track i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: #c9bda9;
    /* Keep very small shares visible instead of collapsing to nothing. */
    min-width: 3px;
}

.xinli-class-row.is-current .xinli-class-track > i {
    background: var(--xl-accent);
}

.xinli-class-val {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12.5px;
    text-align: right;
    color: var(--xl-muted);
    font-variant-numeric: tabular-nums;
}

.xinli-class-row.is-current .xinli-class-val {
    color: var(--xl-text);
    font-weight: 700;
}

@media (max-width: 560px) {
    .xinli-grade-item {
        font-size: 12.5px;
        padding: 8px 10px;
    }

    .xinli-risk-grid {
        grid-template-columns: 1fr 1fr;
    }

    .xinli-risk-value {
        font-size: 20px;
    }

    .xinli-code-value {
        font-size: 24px;
    }

    .xinli-validity-table th {
        width: 72px;
    }

    .xinli-validity-table td:nth-child(2) {
        width: 92px;
    }

    .xinli-class-row {
        grid-template-columns: minmax(60px, 92px) minmax(0, 1fr) 44px;
        gap: 9px;
    }
}

@media print {
    .xinli-grade-item,
    .xinli-risk-cell,
    .xinli-class-row {
        break-inside: avoid;
    }
}

/* ------------------------------------------------------------------
   Personality profile and risk checklist
   ------------------------------------------------------------------
   The quadrant plot needs the same scroll floor as the radar; the summary
   checklist prints every item (present and absent) so the reader can see what
   was ruled out as well as what was found.
   ------------------------------------------------------------------ */
.xinli-quadrant-wrap .xinli-chart-scroll svg {
    min-width: 440px;
    max-width: 620px;
    margin: 0 auto;
}

@media (max-width: 560px) {
    .xinli-quadrant-wrap .xinli-chart-scroll svg {
        min-width: 440px;
    }
}

body.dark-theme .xinli-quadrant-wrap .xinli-chart-scroll,
html.dark .xinli-quadrant-wrap .xinli-chart-scroll {
    background: #ffffff;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* ---- 总结论 ---- */
.xinli-conclusion-text {
    margin: 0 0 16px;
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--xl-text);
}

.xinli-risk-grid-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

.xinli-risk-item {
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid var(--xl-border);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--xl-muted);
    background: var(--xl-bg);
}

.xinli-risk-item b {
    flex: 0 0 auto;
    min-width: 16px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
    color: var(--xl-muted-2);
}

.xinli-risk-item i {
    flex: 0 0 auto;
    margin-left: auto;
    font-style: normal;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--xl-muted-2);
}

/* A present factor is the actionable one: give it weight and an accent rail. */
.xinli-risk-item.is-present {
    /* Plain rgba: color-mix() is not available on the older browsers this
       plugin still supports. */
    border-color: rgba(161, 56, 56, 0.32);
    border-left: 3px solid #a13838;
    background: #fdf6f5;
    color: var(--xl-text);
    font-weight: 600;
}

.xinli-risk-item.is-present b,
.xinli-risk-item.is-present i {
    color: #a13838;
}

body.dark-theme .xinli-risk-item.is-present {
    background: rgba(161, 56, 56, 0.14);
}

/* Personality conclusions are explanatory paragraphs, not warnings: keep them
   quiet so they read as description rather than alarm. */
.xinli-factor-conclusion {
    margin: 7px 0 0;
    padding: 11px 13px;
    border-left: 2px solid var(--xl-accent);
    background: var(--xl-soft);
    border-radius: 0 8px 8px 0;
    font-size: 12.5px;
    line-height: 1.85;
    color: var(--xl-text);
}

@media (max-width: 560px) {
    .xinli-risk-grid-items {
        grid-template-columns: 1fr;
    }

    .xinli-conclusion-text {
        font-size: 13px;
    }
}

@media print {
    .xinli-risk-item {
        break-inside: avoid;
    }
}

.xinli-chart-note {
    margin: 7px 0 0;
    font-size: 12px;
    line-height: 1.65;
    color: var(--xl-muted-2);
}

.xinli-factor-note {
    margin: 8px 0 0;
    padding: 9px 11px;
    border-left: 2px solid #d8a86e;
    border-radius: 0 8px 8px 0;
    background: var(--xl-soft);
    font-size: 12.5px;
    line-height: 1.72;
    color: var(--xl-muted);
}

.xinli-impression-list {
    margin: 6px 0 10px;
    padding-left: 22px;
    display: grid;
    gap: 10px;
}

.xinli-impression-list li {
    padding-left: 2px;
    color: var(--xl-text);
    font-size: 13.5px;
    line-height: 1.78;
}

.xinli-impression-list li::marker {
    color: var(--xl-accent);
    font-weight: 700;
}

.xinli-pay-card {
    text-align: left;
}

.xinli-pay-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
    margin-bottom: 10px;
}

.xinli-pay-icon .xinli-svg {
    width: 22px;
    height: 22px;
}

.xinli-pay-card h2 {
    margin: 0 0 8px;
    font-size: 21px;
}

.xinli-pay-card > p {
    margin: 0 0 14px;
    color: var(--xl-muted);
    line-height: 1.75;
    font-size: 13.5px;
}

.xinli-pay-amount {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 14px 16px;
    margin: 4px 0 16px;
    border: 1px solid var(--xl-border);
    border-radius: 12px;
    background: var(--xl-soft);
}

.xinli-pay-amount strong {
    color: var(--xl-accent);
    font-size: 26px;
    line-height: 1;
}

.xinli-pay-amount span {
    color: var(--xl-muted-2);
    font-size: 12px;
}

.xinli-zibpay-box {
    margin-top: 8px;
}

.xinli-zibpay-box .border-title,
.xinli-zibpay-box .abs-close {
    display: none;
}

.xinli-zibpay-box .paid-modal-content {
    max-height: none;
    overflow: visible;
}

.xinli-zibpay-box .order-info-box {
    border: 1px solid var(--xl-border);
    border-radius: 12px;
    background: var(--xl-soft);
}

.xinli-opinion-list {
    margin: 0;
    padding-left: 22px;
    display: grid;
    gap: 8px;
    color: var(--xl-text);
    font-size: 13.5px;
    line-height: 1.8;
}

.xinli-opinion-list li::marker {
    color: var(--xl-accent);
    font-weight: 650;
}

.xinli-care-stages {
    margin: 0 0 4px;
    padding-left: 22px;
    display: grid;
    gap: 7px;
    color: var(--xl-text);
    font-size: 13.5px;
    line-height: 1.8;
}

.xinli-care-stages li::marker {
    color: var(--xl-accent);
    font-weight: 650;
}

.xinli-clinical-analysis .xinli-analysis-block {
    padding: 14px 0;
    border-top: 1px solid var(--xl-border);
}

.xinli-clinical-analysis .xinli-analysis-block:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.xinli-analysis-block h3 {
    margin: 0 0 7px;
    color: var(--xl-text);
    font-size: 15px;
    font-weight: 650;
}

.xinli-analysis-block p {
    margin: 0;
    color: var(--xl-muted);
    font-size: 13.5px;
    line-height: 1.85;
}

.xinli-analysis-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 7px;
    color: var(--xl-muted);
    font-size: 13.5px;
    line-height: 1.8;
}

.xinli-analysis-list li::marker {
    color: var(--xl-accent);
}

.xinli-analysis-risk {
    padding: 9px 11px;
    margin-bottom: 9px !important;
    border-left: 3px solid var(--xl-warn);
    border-radius: 0 8px 8px 0;
    background: var(--xl-warn-soft, var(--xl-soft));
    color: var(--xl-text) !important;
}

.xinli-risk-list {
    display: grid;
    gap: 8px;
}

.xinli-risk-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: start;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid var(--xl-border);
    border-radius: 10px;
    background: var(--xl-soft);
}

.xinli-risk-row.is-flagged {
    border-color: var(--xl-warn);
    background: var(--xl-warn-soft, var(--xl-soft));
}

.xinli-risk-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--xl-surface-2);
    color: var(--xl-muted);
    font-size: 12px;
}

.xinli-risk-row strong {
    display: block;
    font-size: 12.5px;
    line-height: 1.6;
}

.xinli-risk-row small {
    display: block;
    margin-top: 2px;
    color: var(--xl-muted);
    font-size: 12px;
}

.xinli-risk-state {
    color: var(--xl-muted-2);
    font-size: 12px;
    white-space: nowrap;
}

.xinli-risk-row.is-flagged .xinli-risk-state {
    color: var(--xl-warn);
    font-weight: 600;
}

.xinli-reference-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* The fade tells the reader there is more table to the right instead of
       letting the last column look simply missing. */
    background:
        linear-gradient(to right, transparent calc(100% - 28px), rgba(168, 88, 107, 0.07)) right center / 28px 100% no-repeat;
}

.xinli-reference-table-wrap::-webkit-scrollbar {
    height: 6px;
}

.xinli-reference-table-wrap::-webkit-scrollbar-thumb {
    background: var(--xl-line-strong);
    border-radius: 3px;
}

.xinli-reference-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 12.5px;
}

.xinli-reference-table th,
.xinli-reference-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--xl-border);
    text-align: left;
}

.xinli-reference-table th {
    color: var(--xl-muted-2);
    font-weight: 500;
    font-size: 12px;
}

.xinli-reference-table tr.is-current {
    background: var(--xl-accent-soft);
    color: var(--xl-text);
    font-weight: 600;
}

.xinli-advice-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
    color: var(--xl-muted);
    line-height: 1.85;
    font-size: 14.5px;
}

.xinli-advice-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
}

.xinli-advice-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.78em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--xl-accent);
}

.xinli-answers-details {
    cursor: default;
}

.xinli-answers-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-weight: 600;
    color: var(--xl-text);
    list-style: none;
}

.xinli-answers-details summary::-webkit-details-marker {
    display: none;
}

.xinli-answers-details summary span::before {
    content: "+";
    color: var(--xl-accent);
    margin-right: 7px;
}

.xinli-answers-details[open] summary span::before {
    content: "−";
}

.xinli-answers-details summary small {
    font-size: 12px;
    color: var(--xl-muted-2);
    font-weight: 400;
}

.xinli-answer-table-wrap {
    overflow-x: auto;
    margin-top: 14px;
}

.xinli-answer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    line-height: 1.55;
}

.xinli-answer-table th,
.xinli-answer-table td {
    border: 1px solid var(--xl-border);
    padding: 7px 9px;
    text-align: left;
    vertical-align: top;
}

.xinli-answer-table th {
    background: var(--xl-soft);
    color: var(--xl-muted);
    font-weight: 600;
    white-space: nowrap;
}

.xinli-answer-table td:first-child {
    width: 46px;
    color: var(--xl-muted-2);
    text-align: center;
}

.xinli-answer-table td:last-child {
    width: 190px;
    color: var(--xl-muted);
}

.xinli-disclaimer-card p {
    color: var(--xl-muted);
    line-height: 1.8;
    font-size: 13.5px;
}

.xinli-hotline {
    margin-top: 10px;
    padding: 10px 13px;
    border-radius: 9px;
    background: var(--xl-accent-soft);
    border: 1px solid var(--xl-border);
    color: var(--xl-text);
    font-size: 13px;
    line-height: 1.65;
}

.xinli-hotline strong {
    color: var(--xl-accent);
}

.xinli-crisis-card {
    display: flex;
    gap: 16px;
    padding: 24px;
    margin-bottom: 18px;
    border: 1px solid rgba(176, 68, 68, 0.34);
    border-left: 5px solid var(--xl-danger);
    border-radius: var(--xl-radius);
    background: linear-gradient(135deg, rgba(176, 68, 68, 0.08), rgba(176, 68, 68, 0.025));
}

.xinli-crisis-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--xl-danger);
    background: rgba(176, 68, 68, 0.10);
}

.xinli-crisis-icon .xinli-svg {
    width: 24px;
    height: 24px;
}

.xinli-crisis-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--xl-danger);
    margin-bottom: 3px;
}

.xinli-crisis-card h2 {
    margin: 0 0 6px;
    font-size: 21px;
    color: var(--xl-danger);
}

.xinli-crisis-card p {
    margin: 0 0 8px;
    color: #6e3a3a;
    line-height: 1.75;
    font-size: 14px;
}

.xinli-crisis-card .xinli-hotline {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(176, 68, 68, 0.16);
    color: #5d3131;
}

body.dark-theme .xinli-crisis-card .xinli-hotline,
body[class*="dark"] .xinli-crisis-card .xinli-hotline,
html.dark .xinli-crisis-card .xinli-hotline,
html[data-theme="dark"] .xinli-crisis-card .xinli-hotline {
    background: rgba(0, 0, 0, 0.24);
    border-color: rgba(224, 135, 135, 0.28);
    color: var(--xl-text);
}

body.dark-theme .xinli-crisis-card h2,
body.dark-theme .xinli-crisis-card p,
body[class*="dark"] .xinli-crisis-card h2,
body[class*="dark"] .xinli-crisis-card p,
html.dark .xinli-crisis-card h2,
html.dark .xinli-crisis-card p,
html[data-theme="dark"] .xinli-crisis-card h2,
html[data-theme="dark"] .xinli-crisis-card p {
    color: var(--xl-text);
}

.xinli-crisis-card .xinli-hotline strong {
    color: var(--xl-danger);
}

.xinli-actions-card {
    margin-top: 18px;
}

.xinli-actions-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 7px;
}

.xinli-actions-title h2 {
    margin: 0;
    font-size: 20px;
}

.xinli-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 14px;
}

.xinli-report-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--xl-muted-2);
    font-size: 12.5px;
}

.xinli-inline-form {
    display: inline;
    margin: 0;
}

.xinli-link-danger {
    border: 0;
    padding: 0;
    background: none;
    color: var(--xl-danger);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.xinli-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--xl-border);
}

.xinli-history-toolbar strong {
    display: block;
    color: var(--xl-text);
    font-size: 18px;
}

.xinli-history-toolbar span {
    display: block;
    margin-top: 3px;
    color: var(--xl-muted-2);
    font-size: 12px;
    line-height: 1.6;
}

.xinli-report-list {
    display: grid;
    gap: 9px;
}

.xinli-report-item {
    border: 1px solid var(--xl-border);
    border-radius: 12px;
    background: var(--xl-soft);
    overflow: hidden;
}

.xinli-report-item .xinli-report-row {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.xinli-report-item .xinli-report-row:hover {
    transform: none;
    background: var(--xl-accent-soft);
}

.xinli-report-row.is-static {
    cursor: default;
}

.xinli-report-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 8px 16px 10px;
    border-top: 1px solid var(--xl-border);
    background: var(--xl-bg);
}

.xinli-report-action {
    padding: 0;
    border: 0;
    background: none;
    color: var(--xl-muted);
    font-size: 12px;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
}

.xinli-report-action:hover {
    color: var(--xl-accent);
}

.xinli-report-actions .xinli-inline-form {
    display: inline;
    margin: 0;
}

.xinli-report-actions .xinli-link-danger {
    font-size: 12px;
}

.xinli-report-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    border: 1px solid var(--xl-border);
    border-radius: 12px;
    background: var(--xl-soft);
    text-decoration: none !important;
    color: var(--xl-text);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.xinli-report-row:hover {
    border-color: var(--xl-accent);
    transform: translateY(-1px);
}

.xinli-report-row-icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
}

.xinli-report-row-main {
    flex: 1;
    min-width: 0;
}

.xinli-report-row-main strong {
    display: block;
    font-size: 14.5px;
    color: var(--xl-text);
}

.xinli-report-row-main small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--xl-muted-2);
    line-height: 1.5;
}

.xinli-report-row-score {
    flex: 0 0 auto;
    text-align: right;
}

.xinli-report-row-score strong {
    display: block;
    color: var(--xl-accent);
    font-size: 18px;
}

.xinli-report-row-score.is-unpaid strong {
    font-size: 13px;
    color: var(--xl-warn);
}

.xinli-report-row-score.is-unpaid small {
    color: var(--xl-muted-2);
}

.xinli-report-row-score small {
    display: block;
    color: var(--xl-muted-2);
    font-size: 12px;
    max-width: 130px;
}

.xinli-report-row-arrow {
    flex: 0 0 auto;
    color: var(--xl-muted-2);
}

/* Catalog shortcode */
.xinli-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.xinli-catalog-card {
    padding: 20px;
    border: 1px solid var(--xl-border);
    border-radius: var(--xl-radius);
    background: var(--xl-bg);
    box-shadow: 0 8px 24px var(--xl-shadow);
}

.xinli-catalog-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.xinli-catalog-abbr {
    font-size: 12px;
    font-weight: 700;
    color: var(--xl-accent);
    background: var(--xl-accent-soft);
    border-radius: 6px;
    padding: 3px 7px;
}

.xinli-catalog-cat {
    font-size: 12px;
    color: var(--xl-muted-2);
}

.xinli-catalog-card h3 {
    margin: 0 0 6px;
    font-size: 18px;
    color: var(--xl-text);
}

.xinli-catalog-card p {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--xl-muted);
}

.xinli-catalog-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--xl-muted-2);
    margin-bottom: 8px;
}

.xinli-catalog-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.xinli-my-results-page .xinli-hero {
    margin-bottom: 18px;
}

/* Scale catalog page */
.xinli-catalog-page .xinli-hero {
    margin-bottom: 16px;
    align-items: flex-end;
}

.xinli-hero-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

.xinli-catalog-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--xl-border);
    border-radius: 12px;
    background: var(--xl-bg);
}

.xinli-catalog-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 260px;
    min-width: 0;
    padding: 8px 11px;
    border: 1px solid var(--xl-border);
    border-radius: 9px;
    background: var(--xl-soft);
    color: var(--xl-muted-2);
}

.xinli-catalog-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--xl-text);
    font-size: 13.5px;
    outline: none;
}

.xinli-catalog-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.xinli-catalog-chips button {
    padding: 7px 11px;
    border: 1px solid var(--xl-border);
    border-radius: 999px;
    background: var(--xl-soft);
    color: var(--xl-muted);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.xinli-catalog-chips button:hover {
    border-color: var(--xl-accent);
    color: var(--xl-accent);
}

.xinli-catalog-chips button.is-active {
    background: var(--xl-accent);
    border-color: var(--xl-accent);
    color: #fff;
}

.xinli-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
    gap: 14px;
    margin: 0 0 18px;
}

.xinli-catalog-grid .xinli-catalog-card {
    display: flex;
    flex-direction: column;
    margin: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.xinli-catalog-grid .xinli-catalog-card:hover {
    border-color: var(--xl-accent);
    box-shadow: 0 14px 34px var(--xl-shadow);
    transform: translateY(-1px);
}

.xinli-catalog-grid .xinli-catalog-card p {
    flex: 1;
}

.xinli-catalog-grid .xinli-catalog-meta {
    flex-wrap: wrap;
    gap: 8px 12px;
}

.xinli-catalog-card[hidden] {
    display: none;
}

.xinli-catalog-empty {
    margin: 0 0 18px;
    padding: 22px;
    border: 1px dashed var(--xl-border);
    border-radius: 12px;
    text-align: center;
    color: var(--xl-muted);
    font-size: 13.5px;
}

.xinli-catalog-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--xl-border);
}

.xinli-catalog-foot p {
    margin: 0;
    color: var(--xl-muted-2);
    font-size: 12.5px;
    line-height: 1.7;
}

@media (max-width: 860px) {
    .xinli-catalog-grid {
        grid-template-columns: 1fr;
    }

    .xinli-catalog-page .xinli-hero {
        align-items: flex-start;
    }

    .xinli-hero-actions {
        width: 100%;
    }

    .xinli-hero-actions .xinli-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 860px) {
    .xinli-hero {
        padding: 24px 20px;
        gap: 14px;
    }

    .xinli-hero-icon {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .xinli-hero-icon .xinli-svg {
        width: 24px;
        height: 24px;
    }

    .xinli-card {
        padding: 22px 18px;
    }

    .xinli-form-head,
    .xinli-form,
    .xinli-form-progress,
    .xinli-section-nav {
        padding-left: 18px;
        padding-right: 18px;
    }

    .xinli-form-progress {
        margin-left: 18px;
        margin-right: 18px;
        padding: 0;
    }

    .xinli-notice-grid {
        grid-template-columns: 1fr;
    }

    .xinli-result-grid {
        grid-template-columns: 1fr;
    }

    .xinli-result-head {
        align-items: flex-start;
    }

    .xinli-score-orb {
        flex-basis: 112px;
        width: 112px;
        height: 112px;
    }

    .xinli-score-number {
        font-size: 30px;
    }

    .xinli-sticky-progress {
        bottom: 0;
        margin: 0 8px 8px;
        border-radius: 12px;
    }

    .xinli-wizard-start,
    .xinli-wizard-finish {
        padding: 18px;
        border-radius: 12px;
    }

    .xinli-wizard-nav {
        bottom: 0;
        margin-top: 16px;
        padding: 8px;
        border-radius: 12px;
    }

    .xinli-wizard-nav-mid {
        display: none;
    }

    .xinli-wizard-nav [data-xinli-prev],
    .xinli-wizard-nav [data-xinli-next],
    .xinli-wizard-nav [data-xinli-submit] {
        flex: 1 1 0;
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-width: 600px) {
    .xinli-page .xinli-main {
        padding-top: 12px;
        padding-bottom: 34px;
        /* 10px 贴边太紧，卡片圆角几乎顶到屏幕边缘；14px 让卡片"浮"在页面上。 */
        padding-left: 14px;
        padding-right: 14px;
    }

    /*
     * 卡片内边距在窄屏要收：28px 的内边距 + 外层留白，一行只剩十几个字，
     * 临床描述会频繁断行。20px 是"还看得出层次、又不浪费宽度"的折中。
     */
    .xinli-page .xinli-card {
        padding-left: 20px;
        padding-right: 20px;
    }

    .xinli-hero {
        display: block;
        padding: 22px 17px;
    }

    .xinli-hero-icon {
        margin-bottom: 12px;
    }

    .xinli-hero h1 {
        font-size: 26px;
    }

    .xinli-tagline {
        font-size: 14.5px;
    }

    .xinli-meta {
        gap: 6px 12px;
        font-size: 12px;
    }

    .xinli-card {
        padding: 18px 14px;
        border-radius: 12px;
    }

    .xinli-form-head {
        padding: 20px 15px 12px;
        align-items: flex-start;
    }

    .xinli-form {
        padding: 0 15px 20px;
    }

    .xinli-form-progress {
        margin: 0 15px;
    }

    .xinli-section-nav {
        padding: 14px 15px 2px;
    }

    .xinli-item {
        padding: 14px 13px;
    }

    .xinli-options.is-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .xinli-options.is-list {
        grid-template-columns: 1fr;
    }

    .xinli-qtext p {
        font-size: 14px;
    }

    .xinli-qnum {
        flex-basis: 30px;
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /*
     * 窄屏也保留圆环形状，只缩小。
     * 旧写法把圆环拉成整宽横条（width:100% + border-radius:12px + row），
     * 是为了横排「数字 / 分母 / 总分」；总分去掉后横条只剩两个小字，
     * 既空洞又白占一行。现在 104px 的小圆环，和桌面版是同一个形状。
     */
    .xinli-result-head {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 18px;
    }

    .xinli-score-orb {
        margin-top: 0;
        flex-basis: 104px;
        width: 104px;
        height: 104px;
        border-radius: 50%;
        padding: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0;
    }

    .xinli-score-number {
        font-size: 30px;
    }

    .xinli-score-max {
        font-size: 11.5px;
    }

    .xinli-severity-labels {
        font-size: 11px;
    }

    .xinli-metrics,
    .xinli-metrics.is-six {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .xinli-history-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .xinli-report-actions {
        gap: 12px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .xinli-metric-value {
        font-size: 18px;
    }

    .xinli-crisis-card {
        display: block;
        padding: 18px;
    }

    .xinli-crisis-icon {
        margin-bottom: 10px;
    }

    .xinli-action-buttons .xinli-btn {
        width: 100%;
    }

    .xinli-report-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .xinli-report-row-main {
        flex-basis: calc(100% - 55px);
    }

    .xinli-report-row-score {
        flex-basis: 100%;
        text-align: left;
        padding-left: 51px;
    }

    .xinli-report-row-score small {
        max-width: none;
    }

    .xinli-report-row-arrow {
        display: none;
    }

    .xinli-sticky-text span {
        display: none;
    }

    .xinli-sticky-progress .xinli-btn {
        flex: 0 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .xinli-page *,
    .xinli-page *::before,
    .xinli-page *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .xinli-breadcrumb,
    .xinli-sticky-progress,
    .xinli-actions-card,
    .xinli-start-row,
    .xinli-section-nav,
    .xinli-form-card {
        display: none !important;
    }

    .xinli-page .xinli-main {
        padding: 0;
    }

    .xinli-card,
    .xinli-result-summary,
    .xinli-crisis-card {
        box-shadow: none;
    }

    /*
     * Severity is carried by background colour on the band ruler, the factor
     * tracks and the risk cells. Browsers drop background colours in print by
     * default, which would leave a floating marker over an empty track, so ask
     * for exact colours. The border below is a fallback for printers that
     * ignore print-color-adjust anyway.
     */
    .xinli-page,
    .xinli-page * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .xinli-severity-track {
        border: 1px solid #dfcdbc;
        border-radius: 999px;
        box-sizing: border-box;
    }

    .xinli-severity-track .seg {
        opacity: 1;
    }

    .xinli-severity-labels .xinli-ruler-item.is-current b {
        text-decoration: underline;
    }

    /*
     * Print pagination.
     *
     * 1. Cards must be allowed to break. A report card holding several charts
     *    is taller than one page; forcing break-inside: avoid made the browser
     *    push the whole card to the next page and leave most of the previous
     *    one empty.
     * 2. Headings stay attached to the content that follows, so a section
     *    title never ends a page on its own.
     * 3. The chart scroll container is the real culprit: overflow-x: auto
     *    makes it a monolithic block that cannot be fragmented, so a figure
     *    that did not fit in the remaining space jumped to the next page. In
     *    print there is nothing to scroll, so overflow is released.
     */
    .xinli-card,
    .xinli-result-summary {
        break-inside: auto;
        page-break-inside: auto;
    }

    .xinli-section-heading,
    .xinli-card > h2,
    .xinli-card > h3,
    .xinli-analysis-block > h3 {
        break-after: avoid;
        page-break-after: avoid;
        break-inside: avoid;
    }

    .xinli-chart-scroll {
        overflow: visible !important;
        -webkit-overflow-scrolling: auto;
    }

    .xinli-chart-scroll svg {
        min-width: 0 !important;
    }

    /* A figure should fit the space left on the page rather than jump to the
       next one. Both dimensions stay auto so the SVG scales with its own
       aspect ratio; a fixed height with width:100% would letterbox the chart
       inside a wide box and leave visible side gaps. */
    .xinli-chart-wrap {
        break-inside: avoid;
        page-break-inside: avoid;
        margin: 8px 0 14px;
    }

    /*
     * 125mm is the balance point measured on a real report: the figure keeps
     * roughly 84% of the column width, and a chart still fits in the space
     * left by a typical page, so it does not jump and strand a heading. At
     * 150mm the tallest chart tipped the report from 7 to 8 pages.
     */
    .xinli-chart-wrap .xinli-chart-scroll svg {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 125mm;
        margin: 0 auto;
    }

    /* Small repeated units are worth keeping whole. */
    .xinli-factor,
    .xinli-grade-item,
    .xinli-risk-item,
    .xinli-class-row,
    .xinli-validity-table tr,
    .xinli-opinion-list > li {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Long tables repeat their header on every page. */
    .xinli-reference-table thead,
    .xinli-validity-table thead {
        display: table-header-group;
    }

    .xinli-reference-table tr,
    .xinli-validity-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

@media (max-width: 600px) {
    .xinli-reference-table-wrap {
        margin-left: -4px;
        margin-right: -4px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .xinli-reference-table {
        min-width: 430px;
        font-size: 12px;
    }

    .xinli-reference-table th,
    .xinli-reference-table td {
        padding: 7px 7px;
    }

    /* The norm column carries the smallest print; keep it on one line so the
       four columns stay aligned instead of ragged. */
    .xinli-reference-table td:last-child {
        white-space: nowrap;
    }
}

/* On phones the four-column norm table becomes a two-line card per row.
   Horizontal scrolling is invisible on touch: a half-cut last column reads as
   missing data, not as "scroll me". */
@media (max-width: 600px) {
    .xinli-reference-table-wrap {
        background: none;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .xinli-reference-table {
        display: block;
        min-width: 0;
        width: 100%;
        font-size: 12.5px;
    }

    .xinli-reference-table thead {
        display: none;
    }

    .xinli-reference-table tbody {
        display: block;
    }

    .xinli-reference-table tr {
        display: grid;
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.7fr) minmax(0, 1.4fr);
        gap: 3px 10px;
        padding: 8px 0 7px;
        border-bottom: 1px solid var(--xl-line-soft);
    }

    .xinli-reference-table tr:first-child {
        border-top: 1px solid var(--xl-line-soft);
    }

    .xinli-reference-table td {
        display: block;
        padding: 0;
        border: 0;
        text-align: left;
    }

    .xinli-reference-table td.xli-cell-label {
        grid-column: 1 / -1;
        color: var(--xl-text);
        font-weight: 600;
        font-size: 12.5px;
        line-height: 1.35;
        margin-bottom: 1px;
    }

    .xinli-reference-table td[data-label] {
        line-height: 1.35;
        word-break: keep-all;
    }

    /* Field name above the value: laying it inline clipped "129.96 ± 38.76"
       at the end of the widest column. */
    .xinli-reference-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0;
        color: var(--xl-muted-2);
        font-size: 11px;
        font-weight: 400;
        line-height: 1.35;
        letter-spacing: 0.02em;
        white-space: nowrap;
    }

    .xinli-reference-table td[data-label] {
        font-variant-numeric: tabular-nums;
    }

    .xinli-reference-table tr.is-current {
        background: var(--xl-accent-soft);
        margin-left: -8px;
        margin-right: -8px;
        padding-left: 8px;
        padding-right: 8px;
        border-radius: 8px;
    }
}

/* Question number pill and the progress rail carry meaning, so their
   contrast is pinned instead of riding on a soft tint that a global span
   rule can flatten. */
.xinli-page .xinli-qnum {
    /* The lighter accent only reached 3.25:1 on the tinted pill and read as
       a smudge; #803d4f clears 4.5:1 while staying in the same rose family. */
    color: #803d4f !important;
    background: var(--xl-accent-soft) !important;
    border: 1px solid var(--xl-line-strong);
    box-sizing: border-box;
}

.xinli-page .xinli-form-progress {
    background: var(--xl-soft) !important;
    border: 1px solid var(--xl-line-soft);
    box-sizing: border-box;
    overflow: hidden !important;
}

.xinli-page .xinli-form-progress span {
    background: var(--xl-accent) !important;
    display: block !important;
    height: 100%;
}

body.dark-theme .xinli-page .xinli-qnum {
    color: #f3c7cf !important;
    background: rgba(243, 199, 207, 0.14) !important;
    border-color: rgba(243, 199, 207, 0.3);
}

body.dark-theme .xinli-page .xinli-form-progress {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .xinli-page .xinli-form-progress span {
    background: #e8a8b8 !important;
}

/* The item head is a flex row; a global `label { display:block }`-style rule
   must not push the question text under the number. */
.xinli-page .xinli-item-head {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
}

.xinli-page .xinli-qtext {
    display: block !important;
    min-width: 0;
    flex: 1 1 auto;
}

.xinli-page .xinli-qtext p {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0;
}

/* ------------------------------------------------------------------
 * Zibll theme guard (light + dark).
 *
 * The theme ships broad global rules for svg and for divs inside its
 * content column. Our icons are stroke-only drawings, so any inherited
 * `fill` turns them into solid blobs, and any global `display` reset
 * collapses them to zero box. Both are pinned here on our own scope.
 *
 * Colour is taken from our own tokens rather than inheriting, because the
 * theme recolours text globally when it switches to dark mode.
 * ------------------------------------------------------------------ */
.xinli-page .xinli-svg {
    display: inline-block !important;
    width: 1.15em !important;
    height: 1.15em !important;
    min-width: 1.15em;
    min-height: 1.15em;
    max-width: none;
    max-height: none;
    flex: 0 0 auto !important;
    vertical-align: -0.16em;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.8 !important;
    stroke-linecap: round;
    stroke-linejoin: round;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible;
}

/* Icons that sit on a tinted surface take their colour from it, not from a
   possibly-recoloured ancestor. */
.xinli-page .xinli-btn .xinli-svg,
.xinli-page .xinli-btn-primary .xinli-svg {
    color: inherit !important;
}

.xinli-page .xinli-btn-secondary .xinli-svg,
.xinli-page .xinli-btn-block .xinli-svg {
    color: var(--xl-accent) !important;
}

/* ------------------------------------------------------------------
 * Question cards.
 * The wizard shows exactly one item; anything else is display:none by
 * design. The active one must survive any global div rule the theme has.
 * ------------------------------------------------------------------ */
.xinli-page .xinli-form.is-wizard .xinli-item.is-current,
.xinli-page .xinli-form.is-wizard .xinli-item.xli-item-current {
    display: block !important;
    visibility: visible !important;
    opacity: 1;
    height: auto !important;
    max-height: none !important;
    overflow: visible;
}

.xinli-page .xinli-item .xinli-item-title,
.xinli-page .xinli-item .xinli-item-hint,
.xinli-page .xinli-item .xinli-option-label {
    display: revert !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit;
}

/* `!important` stays so a theme hiding or collapsing the list cannot win,
   but the layout stays a grid: five equal columns need no flex maths. */
.xinli-page .xinli-item .xinli-options {
    display: grid !important;
    gap: 10px;
    height: auto !important;
    max-height: none !important;
    grid-auto-rows: 1fr;
}

.xinli-page .xinli-item .xinli-options.is-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.xinli-page .xinli-item .xinli-options.is-list {
    grid-template-columns: 1fr;
}

@media (min-width: 721px) {
    /* Five-option Likert rows read best as one full row. */
    .xinli-page .xinli-item .xinli-options.is-grid > .xinli-option:nth-child(5):last-child,
    .xinli-page .xinli-item .xinli-options.is-grid:has(> .xinli-option:nth-child(5):last-child) {
        grid-column: auto;
    }

    .xinli-page .xinli-item .xinli-options.is-grid:has(> .xinli-option:nth-child(5):last-child) {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .xinli-page .xinli-item .xinli-options.is-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Options are labels wrapping a native radio; themes often hide inputs. */
.xinli-page .xinli-option {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    min-height: 40px;
}

.xinli-page .xinli-option input[type="radio"] {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    flex: 0 0 18px;
}

/* ------------------------------------------------------------------
 * Typography floor.
 * Themes commonly scale down `.container` contents; a 0.7× em cascade can
 * shrink body text past legibility. Pin the base size on our scope.
 * ------------------------------------------------------------------ */
.xinli-page {
    font-size: var(--xl-base, 14.5px);
    line-height: 1.7;
}

/* Zibll dark-mode compatibility: use the theme's variables when present. */
body.dark-theme .xinli-page,
body[class*="dark"] .xinli-page,
html[data-theme="dark"] .xinli-page {
    --xl-bg: #323335;
    --xl-soft: #37383a;
    --xl-text: #e5eef7;
    --xl-muted: #b4b6bb;
    --xl-muted-2: #888a8f;
    --xl-border: rgba(255, 255, 255, 0.08);
}

body.dark-theme .xinli-severity-track .seg-1,
body[class*="dark"] .xinli-severity-track .seg-1,
html[data-theme="dark"] .xinli-severity-track .seg-1 {
    background: #6a4f57;
}

body.dark-theme .xinli-severity-track .seg-2,
body[class*="dark"] .xinli-severity-track .seg-2,
html[data-theme="dark"] .xinli-severity-track .seg-2 {
    background: #85505c;
}

body.dark-theme .xinli-severity-track .seg-3,
body[class*="dark"] .xinli-severity-track .seg-3,
html[data-theme="dark"] .xinli-severity-track .seg-3 {
    background: #a25a72;
}

body.dark-theme .xinli-severity-track .seg-4,
body[class*="dark"] .xinli-severity-track .seg-4,
html[data-theme="dark"] .xinli-severity-track .seg-4 {
    background: #b95f7d;
}

/*
 * 深色下的圆环：内阴影用的是 --xl-bg（深底），在暗背景上会缩成一圈黑箍，
 * 得换成「比底色稍亮」的一圈，让环带和圆心之间有一道分隔而不是一道黑洞。
 */
body.dark-theme .xinli-score-orb,
body[class*="dark"] .xinli-score-orb,
html[data-theme="dark"] .xinli-score-orb {
    box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.045);
    border-color: rgba(214, 154, 173, 0.2);
}

body.dark-theme .xinli-score-orb::after,
body[class*="dark"] .xinli-score-orb::after,
html[data-theme="dark"] .xinli-score-orb::after {
    background: conic-gradient(from -90deg,
            transparent 0 var(--xli-pct, 0%),
            rgba(255, 255, 255, 0.09) var(--xli-pct, 0%) 100%);
}

/*
 * Dark-theme surface tokens.
 *
 * Zibll switches themes by adding/removing `dark-theme` on <body> (and the
 * toggle is also mirrored on <html> as `light`/`dark`). Every plugin surface
 * here reads the tokens above, so following the theme only requires redefining
 * them once. Nothing is hard-coded per component beyond these fallbacks.
 */
body.dark-theme .xinli-page,
body[class*="dark"] .xinli-page,
html.dark .xinli-page,
html[data-theme="dark"] .xinli-page,
body.dark-theme,
body[class*="dark"],
html.dark,
html[data-theme="dark"] {
    --xl-bg: #323335;
    --xl-soft: #37383a;
    --xl-text: #e5eef7;
    --xl-muted: #b4b6bb;
    --xl-muted-2: #888a8f;
    --xl-border: rgba(184, 184, 184, 0.12);

    --xl-surface: #3a3236;
    --xl-surface-2: #433a3f;
    --xl-glass: #363739;
    --xl-glass-soft: rgba(58, 50, 54, 0.94);
    --xl-tint: #3b3236;
    --xl-tint-2: #383034;
    --xl-tint-3: #41383c;
    --xl-amber-soft: #3d3427;
    --xl-amber-line: #5c4b31;
    --xl-amber-ink: #e2b878;
    --xl-line-soft: #4c4147;
    --xl-line-strong: #584b52;
    --xl-shadow: rgba(0, 0, 0, 0.34);
    --xl-danger: #e08787;
    --xl-warn: #ddb070;
    --xl-warn-soft: rgba(221, 176, 112, 0.14);
    --xl-good: #bdb096;
}

/*
 * Reader surfaces are also painted directly. If a theme wrapper sits between
 * <body> and .xinli-page, or a page-level override drops the token, the hard
 * fallback keeps the dark surface instead of showing a white block.
 */
body.dark-theme .xinli-reader-top,
body[class*="dark"] .xinli-reader-top,
html.dark .xinli-reader-top,
html[data-theme="dark"] .xinli-reader-top {
    background: var(--xl-glass-soft, #37383a);
    border-color: var(--xl-line-strong, #554636);
    box-shadow: 0 5px 20px var(--xl-shadow, rgba(0, 0, 0, 0.34));
}

body.dark-theme .xinli-reader-nav,
body[class*="dark"] .xinli-reader-nav,
html.dark .xinli-reader-nav,
html[data-theme="dark"] .xinli-reader-nav {
    background: var(--xl-glass-soft, #37383a);
    border-color: var(--xl-line-strong, #554636);
}

body.dark-theme .xinli-reader-basis,
body[class*="dark"] .xinli-reader-basis,
html.dark .xinli-reader-basis,
html[data-theme="dark"] .xinli-reader-basis {
    background: var(--xl-tint-2, #372d25);
    color: var(--xl-muted, #b4b6bb);
}

body.dark-theme .xinli-reader-journey,
body[class*="dark"] .xinli-reader-journey,
html.dark .xinli-reader-journey,
html[data-theme="dark"] .xinli-reader-journey {
    background: var(--xl-tint, #3a2f26);
    border-color: var(--xl-line-strong, #554636);
}

body.dark-theme .xinli-reader-brand strong,
body[class*="dark"] .xinli-reader-brand strong,
html.dark .xinli-reader-brand strong,
html[data-theme="dark"] .xinli-reader-brand strong {
    color: var(--xl-text, #e5eef7);
}

body.dark-theme .xinli-reader-brand span,
body[class*="dark"] .xinli-reader-brand span,
html.dark .xinli-reader-brand span,
html[data-theme="dark"] .xinli-reader-brand span {
    color: var(--xl-muted-2, #888a8f);
}

/* Accent-derived pills and tints keep readable contrast on dark surfaces. */
body.dark-theme .xinli-btn-ghost,
body[class*="dark"] .xinli-btn-ghost,
html.dark .xinli-btn-ghost,
html[data-theme="dark"] .xinli-btn-ghost {
    background: transparent;
    border-color: var(--xl-line-strong);
    color: var(--xl-text);
}

body.dark-theme .xinli-crisis-card,
body[class*="dark"] .xinli-crisis-card,
html.dark .xinli-crisis-card,
html[data-theme="dark"] .xinli-crisis-card {
    background: linear-gradient(135deg, rgba(176, 68, 68, 0.16), rgba(176, 68, 68, 0.06));
    border-color: rgba(224, 135, 135, 0.32);
}

body.dark-theme .xinli-alert-error,
body[class*="dark"] .xinli-alert-error,
html.dark .xinli-alert-error,
html[data-theme="dark"] .xinli-alert-error {
    background: rgba(176, 68, 68, 0.14);
    border-color: rgba(224, 135, 135, 0.32);
}

body.dark-theme .xinli-alert-warn,
body[class*="dark"] .xinli-alert-warn,
html.dark .xinli-alert-warn,
html[data-theme="dark"] .xinli-alert-warn {
    background: rgba(154, 106, 32, 0.16);
    border-color: rgba(221, 176, 112, 0.32);
}

body.dark-theme .xinli-alert-info,
body[class*="dark"] .xinli-alert-info,
html.dark .xinli-alert-info,
html[data-theme="dark"] .xinli-alert-info {
    background: rgba(127, 169, 161, 0.14);
    border-color: rgba(127, 169, 161, 0.3);
}

/* Inputs and selects inherit the theme inside plugin pages. */
body.dark-theme .xinli-page input,
body.dark-theme .xinli-page select,
body.dark-theme .xinli-page textarea,
body[class*="dark"] .xinli-page input,
body[class*="dark"] .xinli-page select,
body[class*="dark"] .xinli-page textarea,
html.dark .xinli-page input,
html.dark .xinli-page select,
html.dark .xinli-page textarea,
html[data-theme="dark"] .xinli-page input,
html[data-theme="dark"] .xinli-page select,
html[data-theme="dark"] .xinli-page textarea {
    background: var(--xl-surface-2);
    color: var(--xl-text);
    border-color: var(--xl-border);
}

body.dark-theme .xinli-page input::placeholder,
body.dark-theme .xinli-page textarea::placeholder,
body[class*="dark"] .xinli-page input::placeholder,
body[class*="dark"] .xinli-page textarea::placeholder,
html.dark .xinli-page input::placeholder,
html[data-theme="dark"] .xinli-page input::placeholder {
    color: var(--xl-muted-2);
}

/* Tables and reference rows use layered surfaces instead of pure white. */
body.dark-theme .xinli-page table th,
body[class*="dark"] .xinli-page table th,
html.dark .xinli-page table th,
html[data-theme="dark"] .xinli-page table th {
    background: var(--xl-surface-2);
    color: var(--xl-text);
}

@media (prefers-reduced-motion: no-preference) {
    .xinli-page,
    .xinli-page .xinli-card,
    .xinli-reader-top,
    .xinli-reader-nav,
    .xinli-reader-journey,
    .xinli-scale-landing,
    .xinli-last-report-card,
    .xinli-start-card,
    .xinli-take-bar {
        transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
    }
}

/* ------------------------------------------------------------------
   Report figure entrance animation
   ------------------------------------------------------------------
   The report figures are PHP-rendered inline SVG, so the motion lives on
   the stable hooks the renderer emits and nothing else:

     svg.xli-chart-svg[data-anim="bars|radar|line"]
       rect.xli-chart-bar            horizontal bars, grow from the axis
       polygon.xli-chart-shape       radar data polygon, expand from centre
       polyline.xli-chart-line       line chart, drawn by dash offset
       polygon.xli-chart-area        line chart fill, fades in behind the line
       circle.xli-chart-dot[data-i]  data points, pop in sequence
     span.xli-track-fill             factor track fill, 0 -> target width

   Two rules keep this safe:
   1. Every "not drawn yet" state is scoped to html.xli-anim-ready, a class
      the JS adds only when it can actually animate. With JS off, without
      IntersectionObserver, or under prefers-reduced-motion the figures
      render in their final state, so a chart can never be left invisible.
   2. The observer adds .is-in to the card once and then unobserves it, so
      nothing runs in reverse and the report does not flicker on scroll.

   Timing: a figure staggers at 45-70ms and finishes inside 900ms. The JS
   owns those numbers and feeds --xli-delay here. Print and PDF force the
   final geometry below, because a half-drawn figure on paper is worse than
   no animation at all.
   ------------------------------------------------------------------ */

/* Horizontal bars: scaleX from the left edge. fill-box anchors the origin
   to the bar itself rather than to the SVG canvas. */
html.xli-anim-ready .xli-chart-svg .xli-chart-bar {
    opacity: 0;
    transform: scaleX(0);
    transform-box: fill-box;
    transform-origin: left center;
}

html.xli-anim-ready .xinli-card.is-in .xli-chart-svg .xli-chart-bar,
html.xli-anim-ready .xli-chart-svg.is-in .xli-chart-bar {
    animation: xli-figure-bar-in 400ms cubic-bezier(0.22, 0.68, 0.26, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* Radar data polygon: expand from the chart centre and fade in. view-box
   keeps the origin at the radar's axis centre, not at the data polygon's
   own bounding box, which would drift when the profile is lopsided. */
html.xli-anim-ready .xli-chart-svg .xli-chart-shape {
    opacity: 0;
    transform: scale(0.72);
    transform-box: view-box;
    transform-origin: center center;
}

html.xli-anim-ready .xinli-card.is-in .xli-chart-svg .xli-chart-shape,
html.xli-anim-ready .xli-chart-svg.is-in .xli-chart-shape {
    animation: xli-figure-radar-in 560ms cubic-bezier(0.2, 0.7, 0.28, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* Line chart: the JS measures the polyline and stores its length in
   --xli-len, so the dash offset is the real path length, not a guess. */
html.xli-anim-ready .xli-chart-svg .xli-chart-line {
    stroke-dasharray: var(--xli-len, 0);
    stroke-dashoffset: var(--xli-len, 0);
}

html.xli-anim-ready .xinli-card.is-in .xli-chart-svg .xli-chart-line,
html.xli-anim-ready .xli-chart-svg.is-in .xli-chart-line {
    animation: xli-figure-line-draw 620ms cubic-bezier(0.33, 0.08, 0.2, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

html.xli-anim-ready .xli-chart-svg .xli-chart-area {
    opacity: 0;
}

html.xli-anim-ready .xinli-card.is-in .xli-chart-svg .xli-chart-area,
html.xli-anim-ready .xli-chart-svg.is-in .xli-chart-area {
    animation: xli-figure-area-in 420ms ease-out both;
    animation-delay: calc(var(--xli-delay, 0ms) + 140ms);
}

/* Data points pop in sequence once the line or the polygon has started. */
html.xli-anim-ready .xli-chart-svg .xli-chart-dot {
    opacity: 0;
    transform: scale(0.35);
    transform-box: fill-box;
    transform-origin: center center;
}

html.xli-anim-ready .xinli-card.is-in .xli-chart-svg .xli-chart-dot,
html.xli-anim-ready .xli-chart-svg.is-in .xli-chart-dot {
    animation: xli-figure-dot-in 240ms cubic-bezier(0.16, 0.6, 0.34, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* Factor track fill: 0 to the width the renderer wrote into --xli-w. Width
   is animated rather than a scaled transform because the track clips the
   fill with overflow: hidden and a stretched scale would distort the pill
   radius while it grows. The script writes the 0 start width inline before
   html.xli-anim-ready appears, so arming never animates a rendered bar
   backwards; this rule only owns the transition. */
html.xli-anim-ready .xli-track-fill {
    transition: width 400ms cubic-bezier(0.2, 0.66, 0.34, 1);
    transition-delay: var(--xli-delay, 0ms);
}

html.xli-anim-ready .xinli-card.is-in .xli-track-fill,
html.xli-anim-ready .xli-track-fill.is-in {
    width: var(--xli-w, 100%) !important;
}

@keyframes xli-figure-bar-in {
    from {
        opacity: 0;
        transform: scaleX(0);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

@keyframes xli-figure-radar-in {
    from {
        opacity: 0;
        transform: scale(0.72);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes xli-figure-line-draw {
    from {
        stroke-dashoffset: var(--xli-len, 0);
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes xli-figure-area-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes xli-figure-dot-in {
    from {
        opacity: 0;
        transform: scale(0.35);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/*
 * Print / PDF: the entrance animation is screen-only. Every figure is forced
 * to its final geometry with !important because a report can be printed
 * without ever being scrolled (cards below the fold never received .is-in)
 * or while an entrance is still running. Anything that could leave a blank
 * or half-drawn chart is overridden here.
 */
@media print {
    html.xli-anim-ready .xli-chart-svg .xli-chart-bar,
    html.xli-anim-ready .xli-chart-svg .xli-chart-shape,
    html.xli-anim-ready .xli-chart-svg .xli-chart-dot,
    html.xli-anim-ready .xli-chart-svg .xli-chart-area {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    html.xli-anim-ready .xli-chart-svg .xli-chart-line {
        animation: none !important;
        stroke-dasharray: none !important;
        stroke-dashoffset: 0 !important;
    }

    html.xli-anim-ready .xli-track-fill {
        transition: none !important;
        width: var(--xli-w, 100%) !important;
    }
}

/* Reduced motion: complete immediately, zero delay, zero movement. The JS
   also skips arming in that case; this block is the safety net for a
   preference changed while the report is already open. */
@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xli-chart-svg .xli-chart-bar,
    html.xli-anim-ready .xli-chart-svg .xli-chart-shape,
    html.xli-anim-ready .xli-chart-svg .xli-chart-dot,
    html.xli-anim-ready .xli-chart-svg .xli-chart-area {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    html.xli-anim-ready .xli-chart-svg .xli-chart-line {
        animation: none !important;
        stroke-dasharray: none !important;
        stroke-dashoffset: 0 !important;
    }

    html.xli-anim-ready .xli-track-fill {
        transition: none !important;
        width: var(--xli-w, 100%) !important;
    }
}

/* ------------------------------------------------------------------
   Report content choreography
   ------------------------------------------------------------------
   The figure animation above covers charts. This second pass covers the
   report itself: the hero block, the section headings, and the card
   contents that arrive as a list (analysis blocks, graded findings,
   symptom groups, risk rows, reference tables).

   Contract with frontend.js (data-anim hooks written into the markup):
     .xinli-card.is-in  the trigger the observer sets once per card
     .xli-rise          a block that fades up, delay from --xli-delay
     .xli-row-in        a list child that slides in, delay from --xli-delay
     .xli-num-pop       the score figure, scales up slightly
     .xli-orb-halo      the ring behind the score, expands once
     .xli-seg-grow      a severity segment, grows from zero width

   Every hidden state lives under html.xli-anim-ready, so a reader without
   JS, with a frozen observer, or with reduced motion sees the final layout.
   ------------------------------------------------------------------ */

/* Blocks fade up from 10px. Kept small so a long page does not feel like it
   is assembling itself piece by piece. */
html.xli-anim-ready .xinli-card .xli-rise {
    opacity: 0;
    transform: translateY(34px);
}

html.xli-anim-ready .xinli-card.is-in .xli-rise,
html.xli-anim-ready .xli-rise.is-in {
    animation: xli-content-rise 1500ms cubic-bezier(0.16, 0.62, 0.34, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* List children slide in from the left. 8px is enough to read as motion
   without making the reader wait for text to settle. */
html.xli-anim-ready .xinli-card .xli-row-in {
    opacity: 0;
    transform: translateX(-28px);
}

html.xli-anim-ready .xinli-card.is-in .xli-row-in,
html.xli-anim-ready .xli-row-in.is-in {
    animation: xli-content-row-in 1300ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* The headline score: a short scale-up, no bounce. */
html.xli-anim-ready .xinli-card /* Number roll: the digits climb from 0 to the real value. The mask hides the
   seam at the top and bottom of the glyph box while they travel, so the number
   reads as a mechanism rather than a value that simply pops in. */
.xli-num-roll {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
}

.xli-num-pop {
    opacity: 0;
    transform: scale(0.9);
    transform-origin: center center;
}

html.xli-anim-ready .xinli-card.is-in .xli-num-pop,
html.xli-anim-ready .xli-num-pop.is-in {
    animation: xli-content-num-pop 1600ms cubic-bezier(0.16, 0.62, 0.3, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* A single soft halo behind the score ring, expanding and fading out; it
   draws the eye to the result without a looping pulse that would keep
   pulling attention away from the text. */
html.xli-anim-ready .xinli-card .xli-orb-halo {
    opacity: 0;
}

html.xli-anim-ready .xinli-card.is-in .xli-orb-halo,
html.xli-anim-ready .xli-orb-halo.is-in {
    animation: xli-content-halo 2000ms ease-out both;
    animation-delay: var(--xli-delay, 0ms);
}

/* Severity segments grow from the left edge, in band order, so the ruler
   reads left to right the way it is meant to be read. Width is animated
   because flex-basis is what the renderer controls inline.

   The segments are <span> elements, and transform does not apply to an
   inline box: without display:inline-block the scaleX below would be
   ignored and the ruler would simply pop in at full length. */
html.xli-anim-ready .xinli-card .xli-seg-grow {
    display: inline-block;
    transform: scaleX(0);
    transform-origin: left center;
}

html.xli-anim-ready .xinli-card.is-in .xli-seg-grow,
html.xli-anim-ready .xli-seg-grow.is-in {
    animation: xli-content-seg-grow 1300ms cubic-bezier(0.2, 0.66, 0.34, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* The current-band marker drops in after its segment has grown. */
html.xli-anim-ready .xinli-card .xli-marker-in {
    opacity: 0;
}

html.xli-anim-ready .xinli-card.is-in .xli-marker-in,
html.xli-anim-ready .xli-marker-in.is-in {
    animation: xli-content-marker 1000ms cubic-bezier(0.18, 0.64, 0.34, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-content-rise {
    from {
        opacity: 0;
        transform: translateY(34px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes xli-content-row-in {
    from {
        opacity: 0;
        transform: translateX(-28px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes xli-content-num-pop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes xli-content-halo {
    0% {
        opacity: 0;
        transform: scale(0.72);
    }
    55% {
        opacity: 0.55;
    }
    100% {
        opacity: 0;
        transform: scale(1.16);
    }
}

@keyframes xli-content-seg-grow {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@keyframes xli-content-marker {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ---------------------------------------------------------------------
   Section headings are their own reveal trigger.

   A heading lights up when the reader actually reaches it, not when its
   card first peeks into view. This is what keeps motion coming far down a
   long report: the card may have started playing two screens ago, but each
   heading still announces itself as it arrives.
   ------------------------------------------------------------------ */
html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec] {
    opacity: 0;
    transform: translateY(18px);
}

html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec].is-sec-in {
    opacity: 1;
    transform: none;
    transition:
        opacity 620ms cubic-bezier(0.18, 0.6, 0.32, 1),
        transform 620ms cubic-bezier(0.18, 0.6, 0.32, 1);
}

/* The rule under a heading draws itself from the left. Scoped to the same
   trigger so the two land together rather than as two separate events. */
html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec]::after {
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 780ms cubic-bezier(0.18, 0.6, 0.32, 1) 90ms;
}

html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec].is-sec-in::after {
    transform: scaleX(1);
}

@media print {
    html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec]::after {
        transform: none !important;
        transition: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    html.xli-anim-ready .xinli-card .xinli-section-heading[data-xli-sec]::after {
        transform: none !important;
        transition: none !important;
    }
}


/* =====================================================================
   Maximum-motion layer.

   Every structure that can carry text now enters on its own beat: prose
   paragraphs settle, list items slide, table cells fill in column by
   column, metric tiles spring, symptom and grade rows alternate sides so
   a long list never reads as one block dropping in.

   Two invariants hold for every rule below:
     * the hidden state only exists under html.xli-anim-ready, so a reader
       without JS, with a frozen observer, or with reduced motion sees the
       finished page;
     * anything that animates here is also neutralised by the print and
       reduced-motion blocks at the end of this file.
   ================================================================== */

/* ---- Prose paragraphs: settle in place, with a hair of tracking relief ---- */
html.xli-anim-ready .xinli-card .xli-p-in {
    opacity: 0;
    transform: translateY(14px);
    letter-spacing: 0.014em;
}

html.xli-anim-ready .xinli-card .xli-p-in.is-xli-on {
    animation: xli-para-settle 1100ms cubic-bezier(0.16, 0.62, 0.34, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-para-settle {
    from {
        opacity: 0;
        transform: translateY(14px);
        letter-spacing: 0.014em;
    }

    to {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: normal;
    }
}

/* ---- Bullet items: slide in from the left, one after another ---- */
html.xli-anim-ready .xinli-card .xli-li-in {
    opacity: 0;
    transform: translateX(-18px);
}

html.xli-anim-ready .xinli-card .xli-li-in.is-xli-on {
    animation: xli-li-slide 900ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-li-slide {
    from {
        opacity: 0;
        transform: translateX(-18px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- Table cells: fill in column by column ---- */
html.xli-anim-ready .xinli-card .xli-cell-in {
    opacity: 0;
    transform: translateY(6px);
}

html.xli-anim-ready .xinli-card .xli-cell-in.is-xli-on {
    animation: xli-cell-fade 700ms cubic-bezier(0.2, 0.6, 0.35, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-cell-fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Metric tiles: a short overshoot, then settle ---- */
html.xli-anim-ready .xinli-card .xli-metric-in {
    opacity: 0;
    transform: scale(0.94);
}

html.xli-anim-ready .xinli-card .xli-metric-in.is-xli-on {
    animation: xli-metric-pop 1000ms cubic-bezier(0.16, 0.68, 0.3, 1.06) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-metric-pop {
    from {
        opacity: 0;
        transform: scale(0.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Symptom rows: from the left ---- */
html.xli-anim-ready .xinli-card .xli-symptom-in {
    opacity: 0;
    transform: translateX(-16px);
}

html.xli-anim-ready .xinli-card .xli-symptom-in.is-xli-on {
    animation: xli-row-left 850ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-row-left {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- Grade rows: from the right, so consecutive lists alternate ---- */
html.xli-anim-ready .xinli-card .xli-grade-in {
    opacity: 0;
    transform: translateX(16px);
}

html.xli-anim-ready .xinli-card .xli-grade-in.is-xli-on {
    animation: xli-row-right 850ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-row-right {
    from {
        opacity: 0;
        transform: translateX(16px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- Risk rows: the colour bar on the left grows with the row ---- */
html.xli-anim-ready .xinli-card .xli-risk-in {
    opacity: 0;
    transform: translateX(-14px);
}

html.xli-anim-ready .xinli-card .xli-risk-in.is-xli-on {
    animation: xli-row-left 820ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* ---- Section index badge: a small bounce as its heading arrives ---- */
html.xli-anim-ready .xinli-card .xli-secidx-in {
    opacity: 0;
    transform: scale(0.6) rotate(-8deg);
}

html.xli-anim-ready .xinli-card .xli-secidx-in.is-xli-on {
    animation: xli-badge-pop 900ms cubic-bezier(0.2, 0.7, 0.3, 1.12) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-badge-pop {
    from {
        opacity: 0;
        transform: scale(0.6) rotate(-8deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/*
 * Progress tracks already animate through the width transition declared at
 * the .xli-track-fill block above (the fill's radius would distort under a
 * scaleX). A second transform animation here silently won that fight through
 * animation-fill-mode, and every bar snapped to full on the first frame, so
 * the track is deliberately left to the transition.
 */

/* ---- Card frame: the border warms up as the card settles ---- */
html.xli-anim-ready .xinli-card.xli-frame-in {
    border-color: rgba(226, 148, 166, 0.06);
}

html.xli-anim-ready .xinli-card.is-in.xli-frame-in {
    transition: border-color 1400ms cubic-bezier(0.18, 0.6, 0.32, 1) 240ms;
    border-color: var(--xl-line);
}

/* ---- Answer details: rows fade in once the section is opened ---- */
html.xli-anim-ready details.is-open .xli-ans-in {
    opacity: 0;
}

html.xli-anim-ready details.is-open .xli-ans-in.is-xli-on {
    animation: xli-cell-fade 620ms cubic-bezier(0.2, 0.6, 0.35, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

/* ---- Print / reduced motion: all of the above collapses to final state ---- */
@media print {
    html.xli-anim-ready .xinli-card .xli-p-in,
    html.xli-anim-ready .xinli-card .xli-li-in,
    html.xli-anim-ready .xinli-card .xli-cell-in,
    html.xli-anim-ready .xinli-card .xli-metric-in,
    html.xli-anim-ready .xinli-card .xli-symptom-in,
    html.xli-anim-ready .xinli-card .xli-grade-in,
    html.xli-anim-ready .xinli-card .xli-risk-in,
    html.xli-anim-ready .xinli-card .xli-secidx-in,
    html.xli-anim-ready .xinli-card .xli-track-fill,
    html.xli-anim-ready details.is-open .xli-ans-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        letter-spacing: normal !important;
    }

    html.xli-anim-ready .xinli-card.xli-frame-in {
        transition: none !important;
        border-color: var(--xl-line) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-card .xli-p-in,
    html.xli-anim-ready .xinli-card .xli-li-in,
    html.xli-anim-ready .xinli-card .xli-cell-in,
    html.xli-anim-ready .xinli-card .xli-metric-in,
    html.xli-anim-ready .xinli-card .xli-symptom-in,
    html.xli-anim-ready .xinli-card .xli-grade-in,
    html.xli-anim-ready .xinli-card .xli-risk-in,
    html.xli-anim-ready .xinli-card .xli-secidx-in,
    html.xli-anim-ready .xinli-card .xli-track-fill,
    html.xli-anim-ready details.is-open .xli-ans-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        letter-spacing: normal !important;
    }

    html.xli-anim-ready .xinli-card.xli-frame-in {
        transition: none !important;
        border-color: var(--xl-line) !important;
    }
}

/* ---- Icons: a small spring as their card settles ----
   These sit in section headers and metric labels, so a 260ms pop is enough to
   read as "this arrived" without drawing the eye away from the text. */
html.xli-anim-ready .xinli-card .xli-icon-in {
    opacity: 0;
    transform: scale(0.72);
}

html.xli-anim-ready .xinli-card.is-in .xli-icon-in {
    opacity: 1;
    transform: scale(1);
    animation: xli-icon-pop 620ms cubic-bezier(0.18, 0.72, 0.32, 1.1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-icon-pop {
    from {
        opacity: 0;
        transform: scale(0.72);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Factor card header: name and score land from opposite sides ----
   The bar underneath already grows; splitting the header keeps the first
   read of each dimension from being one flat block. */
html.xli-anim-ready .xinli-card .xinli-factor-head > * {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 760ms cubic-bezier(0.18, 0.6, 0.32, 1),
        transform 760ms cubic-bezier(0.18, 0.6, 0.32, 1);
    transition-delay: var(--xli-delay, 0ms);
}

html.xli-anim-ready .xinli-card.is-in .xinli-factor-head > * {
    opacity: 1;
    transform: none;
}

/* ---- Table header rows: a warmer band slides across first ---- */
html.xli-anim-ready .xinli-card .xli-row-list > tr > th {
    opacity: 0;
}

html.xli-anim-ready .xinli-card.is-in .xli-row-list > tr > th {
    opacity: 1;
    transition: opacity 640ms cubic-bezier(0.18, 0.6, 0.32, 1);
}

html.xli-anim-ready .xinli-card.is-in .xli-row-list > tr:first-child {
    background-color: rgba(226, 148, 166, 0.05);
    transition: background-color 1500ms cubic-bezier(0.18, 0.6, 0.32, 1) 240ms;
}

/* ------------------------------------------------------------------
Fifth pass: the shell, the symptom groups, and the factor notes.

Everything below follows the same rule as the earlier passes — the hidden
state only exists under `html.xli-anim-ready`, so a reader without JS, with
a frozen observer, or with reduced motion always sees the final layout.
------------------------------------------------------------------ */

/* The reader journey is the first horizontal thing on the page and was the
   only one that never moved. Each step rises in turn and its connector line
   wipes out from the left, so the eye is walked through the three stages. */
html.xli-anim-ready .xinli-reader-journey .xinli-reader-journey-step {
    opacity: 0;
    transform: translateY(-8px);
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey-step {
    animation: xli-journey-step 900ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey-step:nth-of-type(2) {
    animation-delay: 160ms;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey-step:nth-of-type(3) {
    animation-delay: 320ms;
}

@keyframes xli-journey-step {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
}

html.xli-anim-ready .xinli-reader-journey .xinli-reader-journey-line {
    transform: scaleX(0);
    transform-origin: left center;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey-line {
    animation: xli-journey-line 1100ms cubic-bezier(0.18, 0.6, 0.32, 1) 120ms both;
}

@keyframes xli-journey-line {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Symptom groups: the group frame used to be on screen already while its
   rows animated in, which read as rows materialising inside a fixed box. */
html.xli-anim-ready .xinli-card .xli-group-in {
    opacity: 0;
    transform: translateY(14px);
}

html.xli-anim-ready .xinli-card.is-in .xli-group-in {
    animation: xli-group-in 900ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-group-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* The note under each factor bar: same slide as the bar above it, a beat
   later, so the reading order stays bar → number → explanation. */
html.xli-anim-ready .xinli-card .xli-note-in {
    opacity: 0;
    transform: translateY(10px);
}

html.xli-anim-ready .xinli-card.is-in .xli-note-in {
    animation: xli-note-in 800ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-note-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

@media print {
    html.xli-anim-ready .xinli-card .xli-icon-in,
    html.xli-anim-ready .xinli-card .xinli-factor-head > *,
    html.xli-anim-ready .xinli-card .xli-row-list > tr > th {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }

    html.xli-anim-ready .xinli-card.is-in .xli-row-list > tr:first-child {
        background-color: transparent !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-card .xli-icon-in,
    html.xli-anim-ready .xinli-card .xinli-factor-head > *,
    html.xli-anim-ready .xinli-card .xli-row-list > tr > th {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }

    html.xli-anim-ready .xinli-card.is-in .xli-row-list > tr:first-child {
        background-color: transparent !important;
    }
}

/* Print and reduced motion: everything above collapses to its final state. */
@media print {
    html.xli-anim-ready .xinli-card .xli-rise,
    html.xli-anim-ready .xinli-card .xli-row-in,
    html.xli-anim-ready .xinli-card .xli-num-pop,
    html.xli-anim-ready .xinli-card .xli-seg-grow,
    html.xli-anim-ready .xinli-card .xli-marker-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    html.xli-anim-ready .xinli-card .xli-orb-halo {
        animation: none !important;
        opacity: 0 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-card .xli-rise,
    html.xli-anim-ready .xinli-card .xli-row-in,
    html.xli-anim-ready .xinli-card .xli-num-pop,
    html.xli-anim-ready .xinli-card .xli-seg-grow,
    html.xli-anim-ready .xinli-card .xli-marker-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    html.xli-anim-ready .xinli-card .xli-orb-halo {
        animation: none !important;
        opacity: 0 !important;
    }
}

/* ------------------------------------------------------------------
   Decorative choreography
   ------------------------------------------------------------------
   A second layer of motion that is purely presentational: the card lifts
   into place, the section rule draws itself, the score ring is traced,
   and the number gets one warm flash when it settles. None of it carries
   meaning, so every piece collapses to its final state under print and
   reduced motion.
   ------------------------------------------------------------------ */

/* Card lift.
   The card itself must never be hidden: if the observer fails to fire (fast
   scroll, nested layout, script error) the reader would face a blank report.
   So only the card's own transform and shadow are animated, never opacity. */
html.xli-anim-ready .xinli-card.is-in {
    animation: xli-card-lift 1300ms cubic-bezier(0.16, 0.6, 0.34, 1) both;
}

@keyframes xli-card-lift {
    from {
        transform: translateY(14px);
        box-shadow: 0 0 0 rgba(74, 48, 26, 0);
    }
    to {
        transform: translateY(0);
        box-shadow: 0 18px 44px -28px rgba(74, 48, 26, 0.28);
    }
}

/* Section rule: the short accent bar under a heading grows to the right. */
html.xli-anim-ready .xinli-card .xinli-section-heading::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 1px;
    background: linear-gradient(90deg, var(--xl-line-strong), transparent 72%);
    transform: scaleX(0);
    transform-origin: left center;
}

html.xli-anim-ready .xinli-card .xinli-section-heading {
    position: relative;
}

html.xli-anim-ready .xinli-card.is-in .xinli-section-heading::after {
    animation: xli-rule-expand 1400ms cubic-bezier(0.24, 0.8, 0.3, 1) 120ms both;
}

@keyframes xli-rule-expand {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* Score ring trace.
   The orb is a plain CSS circle (border-radius + border), not an SVG path, so
   stroke-dasharray cannot draw it. Instead a thin conic-gradient ring sweeps
   around the orb once, from the top clockwise, and fades out when complete. */
html.xli-anim-ready .xinli-card .xinli-score-orb::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            var(--xl-accent) 0turn,
            var(--xl-accent) var(--xli-sweep, 0turn),
            transparent var(--xli-sweep, 0turn),
            transparent 1turn);
    -webkit-mask: radial-gradient(circle, transparent 0 62%, #000 63%);
    mask: radial-gradient(circle, transparent 0 62%, #000 63%);
    pointer-events: none;
    opacity: 0;
}

html.xli-anim-ready .xinli-card.is-in .xinli-score-orb::after {
    animation: xli-ring-sweep 1800ms cubic-bezier(0.2, 0.6, 0.36, 1) 120ms both;
}

@keyframes xli-ring-sweep {
    0% {
        --xli-sweep: 0turn;
        opacity: 0;
    }
    8% {
        opacity: 0.95;
    }
    82% {
        --xli-sweep: 1turn;
        opacity: 0.95;
    }
    100% {
        --xli-sweep: 1turn;
        opacity: 0;
    }
}

/* @property lets the gradient angle be interpolated; without it browsers
   snap straight to the final value, which still looks fine (no ring). */
@property --xli-sweep {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0turn;
}

/* The digit gets one warm flash as it settles, drawing the eye without
   pulsing forever. */
html.xli-anim-ready .xinli-card.is-in .xinli-score-number {
    animation:
        xli-content-num-pop 1600ms cubic-bezier(0.16, 0.62, 0.3, 1) both,
        xli-num-glow 2200ms ease-out 500ms both;
}

@keyframes xli-num-glow {
    0%, 55% { text-shadow: none; }
    70% {
        text-shadow: 0 0 18px rgba(236, 168, 184, 0.45);
    }
    100% { text-shadow: none; }
}

/* Table rows: a light tint sweeps down each table as it arrives. */
html.xli-anim-ready .xinli-card.is-in .xli-row-list tr.xli-row-in {
    animation:
        xli-content-row-in 1300ms cubic-bezier(0.18, 0.6, 0.32, 1) both,
        xli-row-tint 1800ms ease-out both;
    animation-delay: var(--xli-delay, 0ms), calc(var(--xli-delay, 0ms) + 120ms);
}

@keyframes xli-row-tint {
    from { background-color: rgba(226, 148, 166, 0.07); }
    to { background-color: transparent; }
}

/* Desktop pointer feedback: rows lift slightly on hover. Pointer devices
   only, and never for the print stylesheet. */
@media (hover: hover) and (pointer: fine) {
    html.xli-anim-ready .xinli-card.is-in .xli-row-in,
    html.xli-anim-ready .xinli-card.is-in .xli-analysis-block,
    html.xli-anim-ready .xinli-card.is-in .xinli-metric {
        transition: transform 220ms ease, box-shadow 220ms ease;
    }

    html.xli-anim-ready .xinli-card.is-in .xli-row-in:hover,
    html.xli-anim-ready .xinli-card.is-in .xli-analysis-block:hover,
    html.xli-anim-ready .xinli-card.is-in .xinli-metric:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 26px -20px rgba(74, 48, 26, 0.5);
    }
}

/* Everything decorative collapses for print / reduced motion. */
@media print {
    html.xli-anim-ready .xinli-card.is-in,
    html.xli-anim-ready .xinli-card.is-in .xinli-score-number,
    html.xli-anim-ready .xinli-card.is-in .xli-row-list tr.xli-row-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        text-shadow: none !important;
    }

    html.xli-anim-ready .xinli-card .xinli-section-heading::after {
        animation: none !important;
        transform: scaleX(1) !important;
    }

    html.xli-anim-ready .xinli-card.is-in .xinli-score-orb::after {
        animation: none !important;
        opacity: 0 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-card.is-in,
    html.xli-anim-ready .xinli-card.is-in .xinli-score-number,
    html.xli-anim-ready .xinli-card.is-in .xli-row-list tr.xli-row-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        text-shadow: none !important;
    }

    html.xli-anim-ready .xinli-card .xinli-section-heading::after {
        animation: none !important;
        transform: scaleX(1) !important;
    }

    html.xli-anim-ready .xinli-card.is-in .xinli-score-orb::after {
        animation: none !important;
        opacity: 0 !important;
    }
}

/* ------------------------------------------------------------------
   Third pass: broader coverage
   ------------------------------------------------------------------
   Earlier passes only animated report cards. The shell (brand bar, chapter
   nav, breadcrumb) and the tail (signature, footer) came in with no motion
   at all, which made the page feel like it started and stopped. These
   helpers extend the same staggered vocabulary across the whole document.
   ------------------------------------------------------------------ */

/* Shell: brand bar, step trail and chapter nav slide in in reading order.
   The real classes are .xinli-reader-top / .xinli-reader-journey /
   .xinli-reader-nav; there is no separate breadcrumb element. */
html.xli-anim-ready .xinli-page .xinli-reader-top,
html.xli-anim-ready .xinli-page .xinli-reader-journey,
html.xli-anim-ready .xinli-page .xinli-reader-nav {
    opacity: 0;
    transform: translateY(-8px);
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-top,
html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey,
html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-nav {
    animation: xli-shell-in 900ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey {
    animation-delay: 160ms;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-nav {
    animation-delay: 300ms;
}

/* Each step in the trail lights up in turn, so the progress reads as
   sequence rather than three icons appearing at once. */
html.xli-anim-ready .xinli-page .xinli-reader-journey-step {
    opacity: 0;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey-step {
    animation: xli-step-in 700ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: 320ms;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey-step:nth-child(3) {
    animation-delay: 480ms;
}

html.xli-anim-ready .xinli-page.is-shell-in .xinli-reader-journey-step:nth-child(5) {
    animation-delay: 640ms;
}

@keyframes xli-step-in {
    from {
        opacity: 0;
        transform: scale(0.86);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes xli-shell-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Figure notes and legends arrive just after their chart finishes drawing,
   so the eye reads the shape first and the explanation second. */
html.xli-anim-ready .xinli-card .xinli-chart-note {
    opacity: 0;
}

html.xli-anim-ready .xinli-card.is-in .xinli-chart-note {
    animation: xli-note-in 1100ms cubic-bezier(0.18, 0.6, 0.32, 1) 420ms both;
}

@keyframes xli-note-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ------------------------------------------------------------------
   Section-level reveal

   A card is one trigger, but a card can be 1400px tall. If everything inside
   it is scheduled when the card first peeks into view, the reader reaches the
   bottom of the card having missed most of the motion - which reads as "no
   animation at all". So each section inside a card reveals on its own: the
   heading draws its rule, then the content under it follows immediately.
   ------------------------------------------------------------------ */

html.xli-anim-ready .xinli-card .xinli-section-heading {
    position: relative;
}

/* A heading that has not reached the viewport yet keeps only a faint trace of
   itself: the rule is absent. This is what makes the reveal visible as the
   reader scrolls - the line draws itself when the section arrives. */
html.xli-anim-ready .xinli-card .xinli-section-heading::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 1px;
    background: linear-gradient(90deg, var(--xl-line-strong), transparent 72%);
    transform: scaleX(0);
    transform-origin: left center;
}

html.xli-anim-ready .xinli-card.is-in .xinli-section-heading::after,
html.xli-anim-ready .xinli-section-heading.is-sec-in::after {
    animation: xli-rule-expand 1400ms cubic-bezier(0.24, 0.8, 0.3, 1) 120ms both;
}

@keyframes xli-rule-expand {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ------------------------------------------------------------------
   Coverage: the pieces that used to appear without any motion

   Tables, bullet lists and the two-column detail grids are the most common
   element in this report and had no animation at all, which is why the page
   read as mostly static. They now arrive row by row.
   ------------------------------------------------------------------ */

/* Table rows: each row slides up a few pixels, in document order. Capped at
   twelve rows so a long reference table does not become a ticker. */
/* Bullet lists: the marker and the line arrive together, so a long advice
   list reads as being written rather than pasted. */
html.xli-anim-ready .xinli-card.is-in ul li,
html.xli-anim-ready .xinli-card.is-in ol li {
    animation: xli-li-in 1000ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
}

@keyframes xli-li-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

html.xli-anim-ready .xinli-card.is-in ul li:nth-child(odd),
html.xli-anim-ready .xinli-card.is-in ol li:nth-child(odd) {
    animation-delay: 90ms;
}

html.xli-anim-ready .xinli-card.is-in ul li:nth-child(even),
html.xli-anim-ready .xinli-card.is-in ol li:nth-child(even) {
    animation-delay: 170ms;
}

/* Print and reduced motion: every one of the above collapses to its final
   state, so the paper version never carries a half-drawn line. */
@media print {
    html.xli-anim-ready .xinli-card .xinli-section-heading::after,
    html.xli-anim-ready .xinli-card.is-in .xinli-table tbody tr,
    html.xli-anim-ready .xinli-card.is-in .xinli-sheet-answers tbody tr,
    html.xli-anim-ready .xinli-card.is-in .xinli-kv-row,
    html.xli-anim-ready .xinli-card.is-in .xinli-fact-row,
    html.xli-anim-ready .xinli-card.is-in ul li,
    html.xli-anim-ready .xinli-card.is-in ol li {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-card .xinli-section-heading::after,
    html.xli-anim-ready .xinli-card.is-in .xinli-table tbody tr,
    html.xli-anim-ready .xinli-card.is-in .xinli-sheet-answers tbody tr,
    html.xli-anim-ready .xinli-card.is-in .xinli-kv-row,
    html.xli-anim-ready .xinli-card.is-in .xinli-fact-row,
    html.xli-anim-ready .xinli-card.is-in ul li,
    html.xli-anim-ready .xinli-card.is-in ol li {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Tail: signature block and footer fade up last, so the report closes rather
   than simply stopping. */
html.xli-anim-ready .xinli-card .xinli-reader-sign,
html.xli-anim-ready .xinli-card .xinli-report-foot {
    opacity: 0;
}

html.xli-anim-ready .xinli-card.is-in .xinli-sign,
html.xli-anim-ready .xinli-card.is-in .xinli-report-foot {
    animation: xli-tail-in 1300ms cubic-bezier(0.18, 0.6, 0.32, 1) 200ms both;
}

@keyframes xli-tail-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Everything added here must also collapse for print and reduced motion. */
@media print {
    html.xli-anim-ready .xinli-page .xinli-reader-top,
    html.xli-anim-ready .xinli-page .xinli-reader-journey,
    html.xli-anim-ready .xinli-page .xinli-reader-journey-step,
    html.xli-anim-ready .xinli-page .xinli-reader-nav,
    html.xli-anim-ready .xinli-card .xinli-chart-note,
    html.xli-anim-ready .xinli-card .xinli-reader-sign,
    html.xli-anim-ready .xinli-card .xinli-report-foot {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-page .xinli-reader-top,
    html.xli-anim-ready .xinli-page .xinli-reader-journey,
    html.xli-anim-ready .xinli-page .xinli-reader-journey-step,
    html.xli-anim-ready .xinli-page .xinli-reader-nav,
    html.xli-anim-ready .xinli-card .xinli-chart-note,
    html.xli-anim-ready .xinli-card .xinli-reader-sign,
    html.xli-anim-ready .xinli-card .xinli-report-foot {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ------------------------------------------------------------------
   Gentle layer
   ------------------------------------------------------------------
   This report is often the first thing a worried person reads about
   themselves. The motion added here is deliberately slow to arrive and
   slow to settle: nothing snaps, nothing bounces, and no element moves
   far from where it will rest.
   ------------------------------------------------------------------ */

/* A warm halo blooms behind a card as it arrives, then fades away for good.
   It is drawn as a pseudo element so it never affects layout. */
html.xli-anim-ready .xinli-card.is-in {
    position: relative;
}

html.xli-anim-ready .xinli-card.is-in::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: radial-gradient(120% 140% at 50% 0%,
            rgba(226, 148, 166, 0.07) 0%,
            rgba(226, 148, 166, 0.03) 42%,
            rgba(226, 148, 166, 0) 72%);
    pointer-events: none;
    opacity: 0;
    animation: xli-halo-bloom 2600ms cubic-bezier(0.2, 0.55, 0.4, 1) both;
}

@keyframes xli-halo-bloom {
    0% { opacity: 0; }
    26% { opacity: 1; }
    100% { opacity: 0; }
}

/* The score ring breathes, very slowly, only while it is on screen. Two
   breaths then it settles: a loop would keep pulling the eye back.

   Three constraints, all learned the hard way:

   1. The breathing animation must NOT be what makes the ring visible. Once an
      animation finishes with no fill mode the element falls back to its
      resting style, and the resting style here is `.xli-rise { opacity: 0 }`
      — so the ring vanished the moment the last breath ended. The fix is to
      pin the resting state: `.is-in` now restates opacity 1 with enough
      specificity to win over the rise rule, and the animation only animates
      `transform`.

   2. It must not use a fill mode either. A `fill: both` breathe outranked the
      rise animation and pinned the ring at the rise from-frame (opacity 0)
      for the whole 9.6s.

   3. The rise animation must still get its moment, so it is listed first and
      the breathe keyframes no longer mention opacity at all. */
html.xli-anim-ready .xinli-card.is-in .xinli-score-orb {
    opacity: 1;
    transform: none;
    animation: xli-orb-breathe 4600ms ease-in-out 1400ms 2;
}

@keyframes xli-orb-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.028); }
}

/* Paper texture: the quiet cards get a barely-there warm tint so they read
   like printed stock rather than flat UI panels. */
.xinli-card.xinli-interpretation,
.xinli-card.xinli-advice,
.xinli-card.xinli-care-plan {
    background-image:
        radial-gradient(140% 120% at 0% 0%, rgba(226, 148, 166, 0.035) 0%, transparent 58%),
        radial-gradient(120% 140% at 100% 100%, rgba(226, 148, 166, 0.025) 0%, transparent 62%);
    background-color: var(--xl-card, #fffdfb);
}

/* Focus and hover warm up rather than jump: the border shifts toward the
   accent colour and the shadow softens, nothing changes size. */
html.xli-anim-ready .xinli-card.is-in .xli-row-in,
html.xli-anim-ready .xinli-card.is-in .xinli-metric {
    border-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    html.xli-anim-ready .xinli-card.is-in .xli-row-in:hover,
    html.xli-anim-ready .xinli-card.is-in .xinli-metric:hover {
        transform: none;
        box-shadow: 0 6px 22px -18px rgba(120, 66, 32, 0.55);
        background-color: rgba(226, 148, 166, 0.035);
    }
}

/* The crisis card gets the plainest possible entrance: a slow fade, no
   movement, no glow. It should be seen, not staged. */
html.xli-anim-ready .xinli-crisis-card {
    opacity: 0;
    animation: xli-calm-in 1800ms ease-out both;
}

@keyframes xli-calm-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Long-form paragraphs lift their leading slightly while the page settles,
   which reads as a soft landing instead of a hard cut. */
html.xli-anim-ready .xinli-card.is-in p,
html.xli-anim-ready .xinli-card.is-in li {
    animation: xli-text-settle 1600ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
}

@keyframes xli-text-settle {
    from {
        opacity: 0;
        letter-spacing: 0.012em;
    }
    to {
        opacity: 1;
        letter-spacing: normal;
    }
}

@media print {
    html.xli-anim-ready .xinli-card.is-in::before,
    html.xli-anim-ready .xinli-card.is-in .xinli-score-orb,
    html.xli-anim-ready .xinli-crisis-card,
    html.xli-anim-ready .xinli-card.is-in p,
    html.xli-anim-ready .xinli-card.is-in li {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        letter-spacing: normal !important;
    }

    html.xli-anim-ready .xinli-card.is-in::before {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-card.is-in::before,
    html.xli-anim-ready .xinli-card.is-in .xinli-score-orb,
    html.xli-anim-ready .xinli-crisis-card,
    html.xli-anim-ready .xinli-card.is-in p,
    html.xli-anim-ready .xinli-card.is-in li {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        letter-spacing: normal !important;
    }

    html.xli-anim-ready .xinli-card.is-in::before {
        display: none !important;
    }
}

/* ------------------------------------------------------------------
   Wide screens: let the take page use the room it has
   ------------------------------------------------------------------
   980px reads well in the report (about 40 characters per line), but the
   take page shows one question at a time and leaves very wide gutters on
   1400px screens. Raise the cap only well above tablet width.
   ------------------------------------------------------------------ */
@media (min-width: 1200px) {
    .xinli-page .xinli-layout {
        max-width: 1080px;
    }
}

/* ------------------------------------------------------------------
   Warmth layer: light and breathing room
   ------------------------------------------------------------------
   Motion is capped by now. What remains is typography and surface: a
   little more air between lines, a hairline of warmth along the bottom
   of each card, and edges that lean warm instead of grey.
   ------------------------------------------------------------------ */

/* Breathing room. Long clinical paragraphs at 1.75 leading feel tight on
   a phone; 1.9 gives the eye somewhere to rest without looking loose. */
.xinli-reader-report .xinli-card p,
.xinli-reader-report .xinli-card li,
.xinli-reader-report .xinli-analysis-block p,
.xinli-reader-report .xinli-symptom-item {
    line-height: 1.9;
}

.xinli-reader-report .xinli-card p + p {
    margin-top: 0.85em;
}

/* The bottom warm edge: a one-pixel gradient rule, warm at the accent end
   and fading out, sitting just inside the card's own border. It reads as
   light falling off the card rather than as a second border. */
.xinli-reader-report .xinli-card {
    position: relative;
    border-color: var(--xl-line-soft);
    background-image: none;
}

.xinli-reader-report .xinli-card::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg,
            rgba(226, 148, 166, 0.28) 0%,
            rgba(226, 148, 166, 0.1) 38%,
            rgba(226, 148, 166, 0) 82%);
    pointer-events: none;
}

/* Soften the corners a notch: sharper corners read as "form", rounder
   corners read as "page". */
.xinli-reader-report .xinli-card {
    border-radius: 18px;
}

.xinli-reader-report .xinli-card .xinli-metric,
.xinli-reader-report .xinli-card .xli-row-in {
    border-radius: 12px;
}

/* Section headings get a touch more air above them so a new chapter feels
   like a new page rather than another row. */
.xinli-reader-report .xinli-card > h2,
.xinli-reader-report .xinli-card > h3,
.xinli-reader-report .xinli-section-heading {
    margin-top: 6px;
}

/* The hero verdict deserves the most air of all: it is the sentence the
   reader came for. */
.xinli-reader-report .xinli-result-head-main h2 {
    line-height: 1.28;
    letter-spacing: 0.01em;
}

.xinli-reader-report .xinli-result-head-main p {
    line-height: 1.95;
    margin-top: 10px;
}

/* ==========================================================================
   Sixth pass — the same gentle entrance on the answering page and the scale
   catalogue. Questions arrive a tick late so a reader never sees a wall of
   text appear at once, and catalogue cards lift in one by one.
   -------------------------------------------------------------------------
   Options are deliberately NOT animated: tapping a radio already produces an
   immediate visual response, and a second motion on the same gesture reads as
   lag rather than as care.
   ========================================================================== */
/* Hidden until the observer marks the node; the animation only starts once
   `.xli-anim-ready-item` is added, otherwise every question on a 90-item page
   would start on the same frame the root class lands. */
/* The answering page runs in wizard mode: exactly one question is on screen
   at a time and the rest are `display: none`. An IntersectionObserver can
   never fire for a display:none node, so questions cannot be armed by
   scrolling. The fade is driven by the wizard instead — frontend.js adds
   `.xli-item-current` to the question it is about to show. */
html.xli-anim-ready .xinli-form .xinli-item.xli-item-in.xli-item-current {
    animation: xli-item-in 520ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
}

@keyframes xli-item-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* `.xinli-section` is the wrapper the wizard hides and shows; giving it a
   fade would blank the whole question block, so it is left alone. */
html.xli-anim-ready .xinli-form .xinli-section.xli-sec-in-block {
    opacity: 1;
    transform: none;
}

@keyframes xli-sec-block-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

html.xli-anim-ready .xinli-catalog-card.xli-cat-in.xli-anim-ready-item,
html.xli-anim-ready .xinli-hero.xli-hero-in.xli-anim-ready-item {
    animation: xli-cat-in 880ms cubic-bezier(0.18, 0.6, 0.32, 1) both;
    animation-delay: var(--xli-delay, 0ms);
}

@keyframes xli-cat-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    html.xli-anim-ready .xinli-form .xinli-item.xli-item-in,
    html.xli-anim-ready .xinli-form .xinli-section.xli-sec-in-block,
    html.xli-anim-ready .xinli-catalog-card.xli-cat-in,
    html.xli-anim-ready .xinli-hero.xli-hero-in {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

@media print {
    html.xli-anim-ready .xinli-form .xinli-item.xli-item-in,
    html.xli-anim-ready .xinli-form .xinli-section.xli-sec-in-block,
    html.xli-anim-ready .xinli-catalog-card.xli-cat-in,
    html.xli-anim-ready .xinli-hero.xli-hero-in {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

@media print {
    .xinli-reader-report .xinli-card::after {
        display: none;
    }
}

/* Dark mode: the warm edge would read as a bright scratch, so it becomes a
   cool-neutral hairline instead of disappearing entirely. */
body.dark-theme .xinli-reader-report .xinli-card::after {
    background: linear-gradient(90deg,
            rgba(224, 145, 63, 0.24) 0%,
            rgba(224, 145, 63, 0.08) 38%,
            rgba(224, 145, 63, 0) 82%);
}
