:root {
    --ink: #17231f;
    --ink-soft: #34443e;
    --paper: #f5f6f1;
    --paper-deep: #ecefe8;
    --surface: #ffffff;
    --pine: #1f6a50;
    --pine-dark: #154a39;
    --sage: #dce7de;
    --sun: #f2b84b;
    --vermilion: #b84b36;
    --line: #d9ded7;
    --muted: #65706b;
    --danger: #a33c2f;
    --warning: #8a651c;
    --shadow: 0 12px 34px rgba(23, 35, 31, 0.09);
    --container: 1180px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background: var(--paper);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

body,
button,
input,
a {
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button,
label[for] {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

button:not(:disabled),
label[for] {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

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

img {
    display: block;
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid var(--sun);
    outline-offset: 3px;
}

.page-shell {
    width: min(var(--container), calc(100% - 40px));
    margin: 0 auto;
}

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

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2000;
    min-height: 44px;
    padding: 10px 14px;
    color: #ffffff;
    background: var(--ink);
    border-radius: 4px;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid rgba(23, 35, 31, 0.12);
}

.header-inner {
    min-height: 72px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
}

.brand {
    min-width: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    justify-self: start;
}

.brand img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(23, 35, 31, 0.12);
}

.brand span {
    min-width: 0;
    display: grid;
    line-height: 1.2;
}

.brand strong {
    font-size: 17px;
}

.brand small,
.header-product small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.header-product {
    display: grid;
    justify-items: center;
    line-height: 1.2;
}

.header-product span {
    font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
    font-size: 18px;
    font-weight: 800;
}

.header-login {
    justify-self: end;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 750;
    text-align: center;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.button-primary {
    color: #ffffff;
    background: var(--pine);
}

.button-primary:hover {
    background: var(--pine-dark);
}

.button-secondary {
    color: var(--pine-dark);
    background: var(--surface);
    border-color: #bfcac1;
}

.button-secondary:hover {
    border-color: var(--pine);
    background: #f7faf7;
}

.button-accent {
    color: #ffffff;
    background: var(--vermilion);
}

.button-accent:hover {
    background: #983d2d;
}

.button:disabled {
    color: #89918d;
    background: #e6e9e5;
    border-color: #d9ded7;
}

.text-button {
    min-height: 44px;
    padding: 6px 4px;
    color: var(--pine-dark);
    background: transparent;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.text-button:hover {
    color: var(--vermilion);
}

.intro-band {
    padding: 58px 0 52px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.intro-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
    gap: 72px;
    align-items: end;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--pine-dark);
    font-size: 13px;
    font-weight: 800;
}

.eyebrow::before {
    content: "";
    width: 28px;
    height: 2px;
    display: inline-block;
    margin: 0 10px 4px 0;
    background: var(--vermilion);
}

h1,
h2,
h3,
h4,
p {
    overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4 {
    margin-top: 0;
    color: var(--ink);
}

h1 {
    margin-bottom: 18px;
    font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
    font-size: 48px;
    line-height: 1.15;
}

.intro-copy {
    max-width: 680px;
    margin: 0;
    color: var(--ink-soft);
    font-size: 18px;
}

.medical-boundary {
    padding: 4px 0 4px 24px;
    border-left: 3px solid var(--vermilion);
}

.medical-boundary strong {
    font-family: "Songti SC", "STSong", serif;
    font-size: 18px;
}

.medical-boundary p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.work-band {
    padding: 58px 0 72px;
    background: var(--surface);
}

.section-heading {
    margin-bottom: 28px;
}

.section-heading h2,
.report-header h2 {
    margin-bottom: 0;
    font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
    font-size: 34px;
    line-height: 1.25;
}

.work-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.55fr);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.image-workspace,
.analysis-panel {
    min-width: 0;
    padding: 28px;
}

.analysis-panel {
    background: #f8f9f5;
    border-left: 1px solid var(--line);
}

.panel-heading,
.panel-heading > div {
    display: flex;
    align-items: center;
}

.panel-heading {
    min-height: 44px;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.panel-heading > div {
    min-width: 0;
    gap: 11px;
}

.panel-heading h3 {
    margin: 0;
    font-size: 20px;
}

.step-number,
.report-index {
    color: var(--vermilion);
    font-family: Georgia, serif;
    font-size: 13px;
    font-weight: 800;
}

.format-note {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.image-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 330px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px dashed #9ead9f;
    border-radius: 6px;
}

.image-stage:hover,
.image-stage.is-dragging {
    border-color: var(--pine);
    background: #f0f5f0;
}

.image-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #edf0ea;
}

.empty-preview {
    max-width: 420px;
    padding: 28px;
    text-align: center;
}

.empty-preview-mark {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    margin-bottom: 14px;
    color: var(--pine-dark);
    border: 1px solid #9ead9f;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

.empty-preview strong {
    display: block;
    font-size: 18px;
}

.empty-preview p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.file-summary {
    min-width: 0;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 8px 2px 0;
}

.file-summary > div {
    min-width: 0;
    display: grid;
}

.file-summary strong,
.file-summary span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-summary strong {
    font-size: 13px;
}

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

.image-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.file-action {
    width: 100%;
}

.field-message {
    margin: 12px 0 0;
    color: var(--danger);
    font-size: 13px;
}

.analysis-facts {
    margin: 0;
    border-top: 1px solid var(--line);
}

.analysis-facts > div {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.analysis-facts dt {
    color: var(--muted);
    font-size: 13px;
}

.analysis-facts dd {
    margin: 0;
    text-align: right;
    font-size: 14px;
    font-weight: 700;
}

.analysis-facts dd strong {
    color: var(--vermilion);
    font-size: 21px;
}

.account-actions {
    min-height: 44px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px 18px;
    margin: 3px 0 12px;
}

.consent-field {
    min-height: 44px;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 14px;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
}

.consent-field input {
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: var(--pine);
}

.consent-field a {
    color: var(--pine-dark);
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.analyze-button {
    width: 100%;
    min-height: 50px;
    margin-top: 16px;
}

.analysis-status {
    min-height: 78px;
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-top: 16px;
    padding: 15px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: #89938d;
}

.analysis-status[data-tone="busy"] .status-indicator {
    background: var(--sun);
    box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.18);
}

.analysis-status[data-tone="success"] .status-indicator {
    background: var(--pine);
}

.analysis-status[data-tone="warning"] .status-indicator {
    background: var(--warning);
}

.analysis-status[data-tone="error"] .status-indicator {
    background: var(--danger);
}

.analysis-status strong {
    display: block;
    font-size: 14px;
}

.analysis-status p,
.analysis-status small {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.analysis-status small {
    display: block;
    overflow-wrap: anywhere;
}

.recovery-actions {
    margin-top: 14px;
}

.recovery-actions .button {
    width: 100%;
}

.recovery-actions p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.report-band {
    padding: 68px 0 76px;
    background: var(--paper-deep);
    border-top: 1px solid var(--line);
}

.report-shell {
    min-width: 0;
}

.report-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 36px;
    align-items: end;
    padding-bottom: 28px;
    border-bottom: 2px solid var(--ink);
}

.report-header > div {
    min-width: 0;
}

.report-header > div > p:last-child {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--muted);
}

.report-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

.report-meta span {
    max-width: 360px;
    overflow-wrap: anywhere;
}

.quality-section,
.report-section {
    padding: 30px 0;
    border-bottom: 1px solid #cbd1ca;
}

.report-section-heading {
    min-width: 0;
    display: flex;
    gap: 14px;
    align-items: baseline;
    margin-bottom: 20px;
}

.report-section-heading > div {
    min-width: 0;
}

.report-section-heading h3 {
    margin: 0;
    font-size: 21px;
}

.report-section-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.quality-grid,
.report-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 48px;
}

.quality-grid > div {
    min-width: 0;
}

.quality-grid h4 {
    margin-bottom: 10px;
    font-size: 14px;
}

.quality-grid ul,
.compact-section ul {
    margin: 0;
    padding-left: 21px;
    color: var(--ink-soft);
}

.quality-grid li,
.compact-section li {
    margin-top: 7px;
}

.report-list {
    border-top: 1px solid #cbd1ca;
}

.report-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(160px, 0.34fr) minmax(0, 0.66fr);
    gap: 28px;
    padding: 19px 0;
    border-bottom: 1px solid #cbd1ca;
}

.report-row:last-child {
    border-bottom: 0;
}

.report-row h4 {
    margin: 0;
    font-size: 15px;
}

.report-row p {
    margin: 0;
    color: var(--ink-soft);
}

.certainty-label {
    display: block;
    width: fit-content;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.reference-copy {
    display: grid;
    gap: 7px;
}

.reference-copy p strong {
    color: var(--ink);
}

.empty-report-row {
    margin: 0;
    padding: 19px 0;
    color: var(--muted);
}

.report-columns .compact-section {
    min-width: 0;
}

.report-disclaimer {
    margin-top: 30px;
    padding: 20px 22px;
    color: var(--ink-soft);
    background: #fffaf0;
    border-left: 3px solid var(--sun);
}

.report-disclaimer strong {
    color: var(--ink);
}

.report-disclaimer p {
    margin: 6px 0 0;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 26px;
}

.site-footer {
    padding: 36px 0 calc(30px + env(safe-area-inset-bottom));
    color: #cbd4d0;
    background: #101714;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.footer-brand {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    font-family: "Songti SC", "STSong", serif;
    font-size: 22px;
    font-weight: 800;
}

.footer-inner p {
    margin: 0;
    color: #9fabaa;
    font-size: 12px;
}

.footer-inner nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 22px;
}

.footer-inner nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
}

.footer-inner nav a:hover {
    color: #ffffff;
}

.login-dialog {
    width: min(430px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 32px;
    overflow: auto;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(16, 23, 20, 0.24);
    text-align: center;
}

.login-dialog::backdrop {
    background: rgba(16, 23, 20, 0.58);
}

.login-dialog > form:first-child {
    position: absolute;
    top: 8px;
    right: 8px;
}

.dialog-close {
    width: 44px;
    height: 44px;
    color: var(--muted);
    background: transparent;
    font-size: 27px;
    line-height: 1;
}

.dialog-brand {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 4px auto 18px;
    color: #ffffff;
    background: var(--pine-dark);
    border-radius: 50%;
    font-family: "Songti SC", "STSong", serif;
    font-weight: 800;
}

.login-dialog h2 {
    margin-bottom: 10px;
    font-size: 24px;
}

.login-dialog > p {
    margin: 0 0 20px;
    color: var(--muted);
}

.login-dialog .button {
    width: 100%;
}

.login-dialog > form:last-child {
    margin-top: 10px;
}

.dialog-status {
    min-height: 24px;
    margin: 10px 0 0 !important;
    color: var(--danger) !important;
    font-size: 13px;
}

.noscript-message {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    margin: 0;
    padding: 14px 20px;
    color: var(--ink);
    background: #fff4cf;
    border-top: 1px solid var(--sun);
    text-align: center;
}

@media (max-width: 900px) {
    .intro-inner {
        grid-template-columns: minmax(0, 1fr) minmax(250px, 0.65fr);
        gap: 38px;
    }

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

    .analysis-panel {
        border-top: 1px solid var(--line);
        border-left: 0;
    }
}

@media (max-width: 700px) {
    .page-shell {
        width: min(var(--container), calc(100% - 32px));
    }

    .header-inner {
        min-height: 64px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px;
    }

    .brand img {
        width: 38px;
        height: 38px;
    }

    .brand small,
    .header-product {
        display: none;
    }

    .header-login {
        max-width: 132px;
        padding: 0 14px;
    }

    .intro-band {
        padding: 38px 0 34px;
    }

    .intro-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    h1 {
        font-size: 38px;
    }

    .intro-copy {
        font-size: 16px;
    }

    .medical-boundary {
        padding-left: 18px;
    }

    .work-band {
        padding: 42px 0 52px;
    }

    .section-heading h2,
    .report-header h2 {
        font-size: 28px;
    }

    .work-grid {
        border-radius: 6px;
    }

    .image-workspace,
    .analysis-panel {
        padding: 20px;
    }

    .panel-heading {
        align-items: flex-start;
    }

    .format-note {
        max-width: 160px;
    }

    .image-stage {
        min-height: 250px;
    }

    .file-summary {
        align-items: flex-start;
    }

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

    .account-actions {
        justify-content: flex-start;
    }

    .report-band {
        padding: 48px 0 58px;
    }

    .report-header,
    .quality-grid,
    .report-columns,
    .report-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .report-header,
    .report-row {
        gap: 16px;
    }

    .report-meta {
        justify-items: start;
    }

    .report-row {
        padding: 17px 0;
    }

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

    .report-actions .button {
        width: 100%;
    }

    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer-inner nav {
        justify-content: flex-start;
    }

    .login-dialog {
        padding: 28px 22px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
