.auth-card h2 {
    margin-block: 0 16px;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.modes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px 18px;
    margin-block: 4px 16px;
}

.mode-item {
    background: var(--bg-soft);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    transition: background .15s, box-shadow .15s, border-color .15s;
}

.mode-item:hover {
    background: #f3f4f6;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    border-color: #d1d5db;
}

.mode-item-disabled {
    opacity: 0.55;
    background: #f3f4f6;
    cursor: not-allowed;
}

.mode-item-disabled:hover {
    background: #f3f4f6;
    box-shadow: none;
    border-color: var(--border);
}

.mode-label {
    font-weight: 600;
    color: var(--text);
    margin-block: 4px;
    font-size: 14px;
}

.mode-item-disabled .mode-label {
    color: var(--muted);
}

.api-key-section {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    margin-block: 20px;
    border-radius: 8px;
}

.api-key-section label {
    font-weight: 600;
    color: #92400e;
    display: block;
    margin-block: 6px;
}

.api-key-section input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

/* Auth / captcha modal */
.captcha-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.captcha-modal.active {
    display: flex;
}

/* Upload error modal — reuses .captcha-modal as base, adds left-aligned text + details/pre + copy button.
 * NOTE: selectors are scoped to .upload-error-modal and use compound class specificity so they win over
 * the later-defined `.captcha-container { text-align: center }` regardless of file order. */
.upload-error-modal .captcha-container,
.upload-error-modal .upload-error-container {
    text-align: left;
    max-width: 720px;
    width: min(94vw, 720px);
}

.upload-error-modal .upload-error-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-block: 0 8px;
}

.upload-error-modal .upload-error-title {
    margin: 0;
    color: #b91c1c;
    text-align: left;
    flex: 1 1 auto;
}

.upload-error-modal .upload-error-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background-color .15s, color .15s;
}

.upload-error-modal .upload-error-close:hover,
.upload-error-modal .upload-error-close:focus-visible {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
    outline: none;
}

.upload-error-modal .upload-error-message {
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    margin-block: 4px 14px;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

.upload-error-modal .upload-error-details {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    margin-block: 0 14px;
    text-align: left;
}

.upload-error-modal .upload-error-details > summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    list-style: none;
    user-select: none;
    text-align: left;
}

.upload-error-modal .upload-error-details > summary::marker {
    content: "";
}

.upload-error-modal .upload-error-details > summary::-webkit-details-marker {
    display: none;
}

.upload-error-modal .upload-error-details > summary::before {
    content: "▸";
    display: inline-block;
    margin-inline-end: 6px;
    transition: transform .15s;
}

.upload-error-modal .upload-error-details[open] > summary::before {
    transform: rotate(90deg);
}

.upload-error-modal .upload-error-pre {
    margin-block: 10px 0;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

.upload-error-modal .upload-error-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    /* Buttons live at the trailing (right) edge; the copy-status span absorbs
     * the leading whitespace via margin-inline-end:auto below. RTL-safe. */
    justify-content: flex-end;
    text-align: left;
}

.upload-error-modal .upload-error-copy-status {
    font-size: 12px;
    color: var(--muted);
    min-height: 1em;
    text-align: left;
    /* Pushes following flex items (the two buttons) to the trailing edge while
     * keeping this status span pinned to the leading edge of the row. When the
     * row wraps on narrow screens, the status simply moves above the buttons
     * and they stay grouped on the right. */
    margin-inline-end: auto;
    flex: 1 1 auto;
    min-width: 0;
}

.upload-error-modal .upload-error-copy-status.is-success {
    color: #047857;
}

.upload-error-modal .upload-error-copy-status.is-error {
    color: #b91c1c;
}

.captcha-container {
    background: #fff;
    padding-block: 26px;
    padding-inline: 28px;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    max-width: 760px;
    width: min(92vw, 760px);
    max-height: 88vh;
    overflow-y: auto;
    text-align: center;
}

.captcha-title {
    font-size: 20px;
    font-weight: 700;
    margin-block: 0 16px;
    color: var(--text);
}

.captcha-description {
    color: var(--muted);
    margin-block: 0 20px;
    font-size: 14px;
}

.captcha-art {
    background: #fafbfc;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 20px;
    margin-block: 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
    color: var(--text);
}

.captcha-input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-block: 20px;
    justify-content: center;
}

.captcha-input {
    flex: 1 1 220px;
    max-width: 320px;
    padding: 10px 14px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    font-size: 16px;
    text-align: center;
    text-transform: uppercase;
}

.captcha-input:focus {
    outline: none;
    border-color: var(--accent);
}

.captcha-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.captcha-input-group .captcha-btn {
    min-width: 120px;
}

@media (max-width: 760px) {
    .captcha-container {
        width: min(96vw, 640px);
        padding-block: 20px;
        padding-inline: 16px;
        border-radius: 12px;
        max-height: 92vh;
    }

    .captcha-input-group {
        justify-content: stretch;
    }

    .captcha-input {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .captcha-input-group .captcha-btn {
        flex: 1 1 calc(33.333% - 8px);
        min-width: 96px;
        padding-left: 12px;
        padding-right: 12px;
    }
}

.captcha-btn-primary {
    background: #1e1b4b;
    color: #fff;
}

.captcha-btn-primary:hover {
    background: #312e81;
}

.captcha-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.captcha-btn-secondary:hover {
    background: #e5e7eb;
}

.captcha-error {
    color: #dc2626;
    font-size: 14px;
    margin-block: 10px;
    display: none;
    text-align: left;
}

.captcha-error-details {
    color: #7b241c;
    font-size: 13px;
    margin-block: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 8px;
    border-left: 3px solid #dc2626;
    line-height: 1.5;
}

.captcha-error-solutions {
    color: #374151;
    font-size: 13px;
    margin-block: 10px;
    padding: 10px 12px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 3px solid #0ea5e9;
    line-height: 1.6;
}

.captcha-error-solutions ul {
    margin-block: 8px 0;
    padding-left: 18px;
}

.captcha-error-solutions li {
    margin-block: 0 4px;
}

.login-section {
    margin-block: 20px;
    padding: 24px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-radius: 14px;
    border: 1px solid #c4b5fd;
    text-align: center;
}

.login-title {
    font-size: 18px;
    font-weight: 700;
    color: #312e81;
    margin-block: 0 12px;
}

.login-description {
    font-size: 14px;
    color: #475569;
    margin-block: 0 20px;
}

.login-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-block: 0 16px;
}

.login-btn {
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.login-btn-primary {
    background: #1e1b4b;
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 27, 75, 0.25);
}

.login-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(30, 27, 75, 0.35);
}

.login-btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.login-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.login-note {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
}

.direct-apikey-section {
    margin-block: 20px;
    padding: 20px;
    background: #fafbfc;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.direct-apikey-section label {
    font-size: 14px;
    color: var(--text);
    margin-block: 0 8px;
    display: block;
    font-weight: 600;
}

.direct-apikey-section input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--font-mono);
    margin-block: 0 12px;
}

.direct-apikey-section input:focus {
    outline: none;
    border-color: var(--accent);
}

.direct-apikey-buttons {
    display: flex;
    gap: 10px;
}

.apikey-section {
    margin-block: 20px;
    padding: 20px;
    background: #fafbfc;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.apikey-label {
    font-size: 14px;
    color: var(--text);
    margin-block: 0 8px;
    display: block;
}

.apikey-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--font-mono);
}

.apikey-input:focus {
    outline: none;
    border-color: var(--accent);
}

.divider {
    margin-block: 24px;
    text-align: center;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.divider-text {
    background: #fff;
    padding: 0 12px;
    color: var(--muted);
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.guest-info {
    background: #ecfdf5;
    border: 1px solid #10b981;
    border-radius: 10px;
    padding: 12px 16px;
    margin-block: 20px;
    font-size: 14px;
    color: #065f46;
}

.guest-info .balance {
    font-weight: 700;
    color: #059669;
}

@media (max-width: 600px) {
    .modes-container {
        grid-template-columns: 1fr;
    }
}



.hero-card,
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    max-width: var(--card-w);
    margin-left: auto;
    margin-right: auto;
}

.hero-card {
    padding: 34px;
}

.hero-top-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px 32px;
    min-width: 0;
    /* 与 .upload-shell-body 水平内边距一致，左右与上传区内容对齐 */
    padding-left: 4px;
    padding-right: 4px;
}

.hero-head {
    flex: 1 1 42%;
    min-width: min(100%, 260px);
}

.hero-mode-strip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 10px;
    flex: 1 1 48%;
    min-width: min(100%, 220px);
}

.hero-mode {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    min-width: 0;
}

.hero-top-row .hero-mode {
    justify-content: flex-end;
    align-items: flex-end;
}

.hero-mode-strip .config-panel-blurb.hero-mode-blurb {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(100%, 32rem);
    text-align: left;
    align-self: flex-end;
}

.config-panel-blurb {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.hero-head h1,
.auth-card-head h2 {
    margin-block: 0 8px;
    font-size: 24px;
    font-weight: 800;
    hyphens: none;
    overflow-wrap: break-word;
}

.hero-head p,
.auth-card-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    max-width: 36em;
}

.landing-sources-row {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-block: 24px 0;
    margin-inline: auto;
    max-width: 100%;
    align-items: stretch;
}

.landing-sources-row .upload-shell {
    margin: 0;
}

/* 加载时保留双卡占位，仅盖住内容，避免整行高度/宽度变化 */
.landing-sources-row.is-loading .upload-shell,
.landing-sources-row.is-loading .url-source-shell,
.landing-sources-row.is-loading .landing-sources-or,
.landing-sources-row.is-loading .landing-sources-config-divider,
.landing-sources-row.is-loading .landing-parse-config,
.landing-sources-row.is-loading .config-submit-row {
    visibility: hidden;
    pointer-events: none;
    user-select: none;
}

.landing-sources-or {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    margin-block: 2px;
}

.landing-sources-or-line {
    flex: 1;
    min-width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line) 12%, var(--line) 88%, transparent);
}

.landing-sources-or-text {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.08em;
}

.landing-sources-config-title {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.landing-sources-config-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 4px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    color: inherit;
    font: inherit;
    vertical-align: middle;
    flex-shrink: 0;
}

.landing-sources-config-toggle:hover {
    background: rgba(15, 23, 42, 0.06);
}

.landing-sources-config-toggle.is-forced-expanded {
    cursor: default;
}

.landing-sources-config-toggle.is-forced-expanded:hover {
    background: transparent;
}

.landing-sources-config-toggle:focus-visible {
    outline: 2px solid var(--landing-dash-active, #6c8dff);
    outline-offset: 2px;
}

.landing-sources-config-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    color: var(--muted);
    transition: transform 0.2s ease;
    transform: rotate(0deg);
}

.landing-sources-config-chevron-svg {
    display: block;
}

.landing-sources-config-toggle.is-expanded .landing-sources-config-chevron {
    transform: rotate(180deg);
}

.landing-sources-config-toggle.is-forced-expanded .landing-sources-config-chevron-svg {
    opacity: 0.42;
}

.landing-parse-config {
    margin-block: 12px 0;
    padding: 0;
    max-width: 100%;
}

.landing-sources-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-block: 48px;
    padding-inline: 24px;
    border: 1px dashed rgba(99, 102, 241, 0.34);
    border-radius: 24px;
    background: rgba(247, 249, 255, 0.96);
    box-shadow: var(--landing-inset);
}

.upload-progress-card {
    display: flex;
    align-items: center;
    gap: 18px;
    width: min(480px, 100%);
    padding: 16px 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.035);
}

.upload-progress-ring {
    --progress: 0%;
    position: relative;
    width: 76px;
    height: 76px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        conic-gradient(#4f46e5 var(--progress), rgba(226, 232, 240, 0.72) 0),
        #eef2ff;
}

.upload-progress-ring.is-indeterminate {
    background:
        conic-gradient(from 0deg, transparent 0 25%, #4f46e5 34%, transparent 46% 100%),
        #eef2ff;
    animation: progress-spin 1.1s linear infinite;
}

.upload-progress-ring-inner {
    position: relative;
    z-index: 1;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #312e81;
    font-size: 18px;
    font-weight: 800;
}

.upload-progress-ring.is-indeterminate .upload-progress-ring-inner {
    animation: progress-spin 1.1s linear infinite reverse;
}

.upload-progress-copy {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1 1 auto;
    min-width: 0;
}

.upload-progress-phase {
    color: #1e1b4b;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.upload-progress-stages {
    display: grid;
    margin-top: 1px;
}

.upload-progress-stages[hidden] {
    display: none;
}

.upload-progress-stage {
    display: grid;
    gap: 4px;
}

.upload-progress-stage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
}

.upload-progress-stage-head span:last-child {
    color: #4f46e5;
    font-family: var(--font-mono);
    font-size: 10px;
    white-space: nowrap;
}

.upload-progress-stage-bar {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.8);
}

.upload-progress-stage-bar span {
    display: block;
    width: var(--stage-progress, 0%);
    height: 100%;
    border-radius: inherit;
    background: #4f46e5;
    transition: width 0.24s ease;
}

.upload-shell {
    position: relative;
    max-width: 100%;
    margin-block: 24px 0;
    margin-inline: auto;
    border: 1px dashed var(--landing-dash);
    border-radius: 24px;
    background: var(--landing-bg-glow), var(--panel);
    overflow: hidden;
    box-shadow: var(--landing-inset);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.upload-shell:hover:not(.is-dragover) {
    border-color: var(--landing-dash-hover);
    box-shadow: var(--landing-inset), 0 10px 32px rgba(96, 165, 250, 0.1);
}

.upload-shell.is-active-source,
.url-source-shell.is-active-source {
    border-color: rgba(37, 99, 235, 0.62);
    background:
        radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.12), transparent 42%),
        var(--landing-bg-glow),
        var(--panel);
    box-shadow: var(--landing-inset), 0 14px 34px rgba(37, 99, 235, 0.14);
}

.upload-shell.is-dragover {
    border-color: var(--landing-dash-active);
    box-shadow: var(--landing-inset), 0 18px 40px rgba(96, 165, 250, 0.16);
    transform: translateY(-1px);
}

.home-main:has(#landingSourcesRow.is-loading) .hero-card .hero-top-row .hero-mode-strip,
.home-main:has(#landingSourcesRow.is-loading) .landing-parse-config {
    opacity: 0.16;
    pointer-events: none;
    user-select: none;
}

.url-source-shell {
    position: relative;
    max-width: 100%;
    border: 1px dashed var(--landing-dash);
    border-radius: 24px;
    background: var(--landing-bg-glow), var(--panel);
    overflow: hidden;
    box-shadow: var(--landing-inset);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.url-source-shell:hover {
    border-color: var(--landing-dash-hover);
    box-shadow: var(--landing-inset), 0 10px 32px rgba(96, 165, 250, 0.1);
}

.url-source-body {
    padding-block: 24px;
    padding-inline: 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 8px;
}

.url-source-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
}

.url-source-icon {
    flex-shrink: 0;
    align-self: center;
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

.url-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.url-field.url-input-frame {
    gap: 0;
}

.url-input-frame {
    border-radius: 12px;
    border: 1px solid var(--field-border);
    background: var(--panel);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.url-input-frame:focus-within {
    border-color: var(--field-border-focus);
    box-shadow: var(--focus-ring);
}

.url-input-frame.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.url-source-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: none;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    outline: none;
    text-align: left;
    letter-spacing: -0.01em;
    transition: background 0.15s ease;
}

.url-source-input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.url-source-input:hover {
    background: rgba(248, 250, 252, 0.8);
}

.url-source-submit.upload-primary-btn {
    align-self: center;
    margin-block: 2px;
}

.url-source-submit.is-config-hidden {
    display: none;
}

.url-source-error {
    min-height: 18px;
    margin: -8px 4px -6px;
    color: #dc2626;
    font-size: 12px;
    line-height: 18px;
    text-align: left;
    visibility: hidden;
}

.url-source-error:not(:empty) {
    visibility: visible;
}

.url-source-footnote {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--muted);
    text-align: center;
    padding: 0 4px;
}

.landing-file-input {
    display: none;
}

.upload-mode-field {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: auto;
    max-width: 100%;
    min-width: 0;
}

.upload-mode-label {
    color: #475569;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.upload-mode-select-wrap {
    flex: 1;
    min-width: 0;
}

.hero-mode .upload-mode-field {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
}

.hero-mode .upload-mode-label {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.hero-mode .upload-mode-select-wrap {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    position: relative;
}

.home-mode-dropdown {
    position: relative;
    width: var(--home-mode-trigger-width);
    max-width: 100%;
    min-width: 0;
    flex-shrink: 0;
}

/* 自定义解析网格内：与顶栏同款下拉，宽度铺满 mode-item */
.modes-container .mode-select-dropdown.home-mode-dropdown {
    width: 100%;
    max-width: 100%;
}

/* 供 JS 读 value / change；不参与展示与焦点 */
.home-mode-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.home-mode-select-trigger {
    --mode-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px var(--home-mode-trigger-padding-x);
    border: 1px solid transparent;
    border-radius: 14px;
    background-color: #fff;
    /* background-image: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%); */
    /* box-shadow: var(--landing-inset), 0 2px 10px rgba(15, 23, 42, 0.05); */
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1.35;
    letter-spacing: -0.015em;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.home-mode-select-trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-mode-select-trigger-chevron {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: var(--mode-select-chevron) center / contain no-repeat;
    transition: transform 0.2s ease;
}

.home-mode-dropdown.is-open .home-mode-select-trigger-chevron {
    transform: rotate(180deg);
}

.home-mode-select-trigger:hover {
    border-color: var(--landing-dash-hover);
    box-shadow: var(--landing-inset), 0 6px 20px rgba(96, 165, 250, 0.14);
    transform: translateY(-1px);
}

.home-mode-select-trigger:focus-visible {
    border-color: var(--field-border-focus);
    box-shadow: var(--focus-ring), var(--landing-inset), 0 4px 16px rgba(96, 165, 250, 0.12);
}

.home-mode-select-trigger:active {
    transform: translateY(0);
}

.home-mode-dropdown.is-open .home-mode-select-trigger {
    border-color: var(--field-border-focus);
    box-shadow: var(--focus-ring), var(--landing-inset), 0 4px 16px rgba(96, 165, 250, 0.12);
}

.home-mode-select-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    margin: 0;
    padding: 6px;
    list-style: none;
    border-radius: 14px;
    border: 1px solid var(--field-border);
    background: var(--panel);
    box-shadow: var(--shadow), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.home-mode-select-panel:focus {
    outline: none;
}

.home-mode-opt {
    margin: 0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.012em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.home-mode-opt + .home-mode-opt {
    margin-block: 2px 0;
}

/* 自定义解析面板内枚举项：统一中性样式 */
.home-mode-opt--default {
    color: var(--text);
    background: linear-gradient(180deg, #ffffff 0%, var(--soft) 100%);
}

.home-mode-opt--default:hover,
.home-mode-opt--default:focus-visible {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    box-shadow: inset 0 0 0 1px var(--field-border);
}

.home-mode-opt--default.is-selected {
    color: #1e40af;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
}

.home-mode-opt--scientific {
    color: #0f172a;
    background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
}

.home-mode-opt--scientific:hover,
.home-mode-opt--scientific:focus-visible {
    color: #1e3a8a;
    background: linear-gradient(180deg, #e0edff 0%, #dbeafe 100%);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.home-mode-opt--molecule {
    color: #0f172a;
    background: linear-gradient(180deg, #f7fef9 0%, #ecfdf5 100%);
}

.home-mode-opt--molecule:hover,
.home-mode-opt--molecule:focus-visible {
    color: #065f46;
    background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 100%);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.28);
}

.home-mode-opt--custom {
    color: #0f172a;
    background: linear-gradient(180deg, #fafaff 0%, #f5f3ff 100%);
}

.home-mode-opt--custom:hover,
.home-mode-opt--custom:focus-visible {
    color: #5b21b6;
    background: linear-gradient(180deg, #ede9fe 0%, #ddd6fe 100%);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.3);
}

.home-mode-opt.is-selected {
    font-weight: 700;
    box-shadow: inset 0 0 0 2px rgba(79, 109, 246, 0.45);
}

.home-mode-opt--scientific.is-selected {
    color: #1e40af;
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
}

.home-mode-opt--molecule.is-selected {
    color: #047857;
    background: linear-gradient(180deg, #a7f3d0 0%, #6ee7b7 100%);
}

.home-mode-opt--custom.is-selected {
    color: #6d28d9;
    background: linear-gradient(180deg, #ddd6fe 0%, #c4b5fd 100%);
}

@media (prefers-reduced-motion: reduce) {
    .home-mode-select-trigger:hover,
    .home-mode-select-trigger:active {
        transform: none;
    }

    .home-mode-select-trigger-chevron {
        transition: none;
    }
}

.upload-shell-body {
    padding-block: 24px;
    padding-inline: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
}

.upload-format-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.upload-format-icon {
    width: 42px;
    height: 42px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 12px 20px rgba(15, 23, 42, 0.14));
    user-select: none;
    pointer-events: none;
}

.upload-primary-btn {
    border: 1px solid var(--field-border);
    background: var(--panel);
    color: var(--text);
    height: 52px;
    padding: 0 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.upload-primary-btn:hover {
    transform: translateY(-1px);
    border-color: var(--field-border-focus);
    box-shadow: 0 14px 28px rgba(79, 109, 246, 0.14);
}

.upload-primary-btn:active {
    transform: translateY(0);
}

.upload-primary-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
}

.upload-support-text,
.upload-limit-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.upload-limit-note {
    color: #991b1b;
    font-weight: 600;
}

.source-status {
    margin: 0;
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.source-status:empty {
    display: none;
}

.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #5b73f7;
    animation: loading-bounce 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.12s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.24s;
}

.uploading-text {
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
}

@keyframes progress-spin {
    to {
        transform: rotate(360deg);
    }
}

.custom-mode-left.custom-mode-left-locked .mode-select-dropdown {
    opacity: 0.58;
}

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

.config-submit-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.config-submit-row--inside {
    margin-top: 18px;
    width: 100%;
}

.config-submit-row--inside .config-submit-hint {
    max-width: 100%;
}

.config-submit-btn {
    min-width: min(320px, 100%);
    height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.26);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, opacity .18s ease;
}

.config-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: saturate(1.08);
    box-shadow: 0 18px 36px rgba(79, 70, 229, 0.32);
}

.config-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.config-submit-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 3px;
}

.config-submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.56;
    box-shadow: none;
    filter: grayscale(0.15);
}

.config-submit-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.config-submit-hint {
    margin: 0;
    max-width: 520px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease, padding .18s ease;
}

.config-submit-hint.is-ready {
    padding: 0;
    border-color: transparent;
    background: transparent;
    color: #2563eb;
    font-weight: 600;
    box-shadow: none;
}

.config-submit-hint.is-error {
    color: #dc2626;
    font-weight: 600;
}

.custom-mode-left,
.custom-mode-right {
    min-width: 0;
    padding: 14px 16px;
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: none;
}

.custom-mode-grid .custom-block-title {
    margin-block: 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.custom-config-intro {
    margin-block: 0 12px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--muted);
}

.page-range-input {
    width: 60%;
    max-width: 60%;
    justify-self: end;
    box-sizing: border-box;
    height: 36px;
    padding: 7px 12px;
    border: 1px solid #dbe2ee;
    border-radius: 9px;
    background: #fbfcff;
    color: #111827;
    font-size: 13px;
    line-height: 1.35;
    text-align: right;
    appearance: none;
    outline: none;
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.03);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.page-range-input:focus {
    border-color: rgba(37, 99, 235, 0.52);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.page-range-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* 一行一项；标签与下拉同一行（无 mode-item 卡片） */
.compact-modes {
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
    margin-block: 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e8eaef;
    border-radius: 10px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* 固定标签列宽，右侧下拉区域各行宽度一致 */
.compact-modes .compact-mode-row {
    --compact-mode-label-col: 7.25rem;
    display: grid;
    grid-template-columns: var(--compact-mode-label-col) minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    row-gap: 0;
    min-width: 0;
    padding: 6px 0;
}

.compact-modes .compact-mode-row:not(:last-child) {
    border-bottom: 1px solid #eef0f4;
}

.compact-modes .compact-mode-row[hidden] {
    display: none;
}

.compact-modes .compact-mode-row:has(+ .compact-mode-row[hidden]) {
    border-bottom: none;
}

.compact-modes .mode-label {
    margin-block: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    letter-spacing: -0.01em;
}

.compact-modes .mode-select-dropdown.home-mode-dropdown {
    width: 60%;
    max-width: 60%;
    min-width: 0;
    justify-self: end;
}

.compact-modes .home-mode-select-trigger {
    justify-content: flex-start;
    gap: 8px;
    text-align: right;
}

.compact-modes .home-mode-select-trigger-text {
    flex: 1 1 auto;
    text-align: right;
}

.page-range-input:disabled {
    cursor: not-allowed;
    border-color: #e5e7eb;
    background: #f8fafc;
    color: #a1aab8;
    box-shadow: none;
}

.code-note {
    margin-block: 0 12px;
    color: var(--muted);
    font-size: 13px;
}

.semantic-code {
    margin: 0;
    min-height: 180px;
    padding: 18px;
    border-radius: 16px;
    background: #0f172a;
    color: #e2e8f0;
    overflow: auto;
    font-size: 13px;
    line-height: 1.7;
}

.semantic-code code {
    font-family: var(--font-mono);
    white-space: pre;
}

.auth-card {
    margin-block: 24px 0;
    padding-block: 28px;
    padding-inline: 34px;
}

.inline-logout-btn {
    margin-left: 10px;
    border: 1px solid #fbcaca;
    background: linear-gradient(180deg, #fff6f6 0%, #ffe9e9 100%);
    color: #b42318;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(180, 35, 24, 0.08);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.inline-logout-btn:hover {
    transform: translateY(-1px);
    border-color: #f7a3a3;
    background: linear-gradient(180deg, #fff1f1 0%, #ffe2e2 100%);
    color: #912018;
    box-shadow: 0 8px 16px rgba(180, 35, 24, 0.16);
}

.inline-logout-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(180, 35, 24, 0.12);
}

.inline-logout-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.15), 0 3px 10px rgba(180, 35, 24, 0.12);
}

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0.72);
        opacity: 0.55;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 960px) {
    .hero-top-row {
        flex-wrap: wrap;
    }

    .hero-mode-strip {
        flex: 1 1 100%;
        align-items: flex-start;
    }

    .hero-mode-strip .config-panel-blurb.hero-mode-blurb {
        max-width: none;
        text-align: left;
        align-self: stretch;
    }

    .hero-top-row .hero-mode {
        max-width: 100%;
        justify-content: flex-start;
    }

    .custom-mode-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .hero-card,
    .auth-card {
        padding-block: 22px 20px;
        padding-inline: 18px;
    }

    .hero-top-row {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .hero-mode-strip {
        align-items: stretch;
    }

    .hero-top-row .hero-mode {
        justify-content: flex-start;
        width: 100%;
    }

    .hero-mode-strip .config-panel-blurb.hero-mode-blurb {
        text-align: left;
        align-self: stretch;
    }

    .home-mode-dropdown {
        width: 100%;
    }

    .hero-mode .upload-mode-field {
        flex-direction: column;
        align-items: stretch;
        min-width: 100%;
    }

    .upload-mode-field {
        min-width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .upload-shell-body {
        padding-block: 24px;
        padding-inline: 16px;
    }

    .landing-sources-loading {
        padding-block: 40px;
        padding-inline: 16px;
    }

    .upload-progress-card {
        flex-direction: column;
        text-align: center;
        gap: 14px;
        padding: 18px;
    }

    .upload-progress-copy {
        width: 100%;
    }

    .upload-progress-phase {
        font-size: 20px;
    }

    .semantic-code {
        min-height: 280px;
    }
}
