:root {
    --bg: #f8f1df;
    --panel: rgba(255, 253, 247, 0.9);
    --panel-soft: rgba(247, 236, 212, 0.9);
    --border: #dcccaa;
    --text: #3b2f23;
    --muted: #7a6a52;
    --purple: #2f6fd0;
    --green: #2e7d4f;
    --danger: #bf4a3f;
    --font-serif: "Noto Serif SC", serif;
    --font-sans: "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    min-height: 100vh;
    background:
        repeating-linear-gradient(0deg, rgba(140, 105, 55, 0.055) 0 1px, transparent 1px 80px),
        repeating-linear-gradient(90deg, rgba(140, 105, 55, 0.04) 0 1px, transparent 1px 80px),
        radial-gradient(ellipse at 20% 0%, rgba(214, 158, 62, 0.18), transparent 45%),
        radial-gradient(ellipse at 85% 100%, rgba(181, 86, 36, 0.08), transparent 42%),
        linear-gradient(180deg, #f2e5c8 0%, #fbf5e6 48%, #f7eed9 100%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-sans);
}

.home-shell { width: min(1040px, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0; }
.home-header { position: relative; margin-bottom: 1.5rem; text-align: center; }
.home-title-row { display: flex; align-items: baseline; justify-content: center; gap: 0.8rem; }
.home-header h1 { margin: 0.35rem 0; color: #45321f; font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: 0.12em; text-shadow: 0 2px 10px rgba(120, 90, 40, 0.22); }
.home-version { color: #6f5a3f; font-size: 1rem; font-weight: 600; white-space: nowrap; text-shadow: 0 1px 6px rgba(120, 90, 40, 0.18); }

.archive-import-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.25rem; margin-bottom: 1rem; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); box-shadow: 0 12px 32px rgba(120, 90, 40, 0.13); }
.archive-import-heading { display: flex; align-items: center; gap: 0.75rem; }
.archive-import-heading h2 { font-family: var(--font-serif); font-size: 1.05rem; }
.archive-import-copy > p { margin-top: 0.4rem; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.archive-import-copy code { color: var(--text); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.archive-import-copy .archive-import-role { margin-top: 0.25rem; }
.archive-import-role strong { color: var(--text); }
.archive-import-actions { min-width: 10.5rem; text-align: center; }
.archive-import-button { width: 100%; font-weight: 650; }
.archive-import-button:focus-within { outline: 2px solid rgba(47, 111, 208, 0.45); outline-offset: 2px; }
.archive-import-actions .home-message { min-height: 1.1rem; margin-top: 0.45rem; }

.home-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.home-panel { margin-bottom: 1rem; padding: 1.25rem; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); box-shadow: 0 12px 32px rgba(120, 90, 40, 0.13); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel-heading h2 { margin-top: 0.18rem; font-family: var(--font-serif); font-size: 1.15rem; }
.status-badge { padding: 0.35rem 0.65rem; border: 1px solid rgba(47, 111, 208, 0.4); border-radius: 999px; color: var(--purple); font-size: 0.78rem; }
.home-main-role { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0; padding: 0.8rem; border-radius: 9px; background: var(--panel-soft); }
.home-main-role span { color: var(--muted); font-size: 0.78rem; }
.home-main-role strong { color: var(--text); font-family: var(--font-serif); }

.save-version-label { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.8rem; }
.save-version-label[hidden] { display: none; }
.save-version-select { flex: 1; min-width: 0; padding: 0.48rem 0.6rem; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); font: inherit; }
.web-license-label { display: grid; gap: 0.45rem; margin-top: 0.85rem; color: var(--muted); font-size: 0.8rem; }
.web-license-label[hidden] { display: none; }
.web-license-input { width: 100%; padding: 0.62rem 0.7rem; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); font: inherit; }
.web-license-input:focus { border-color: rgba(47, 111, 208, 0.7); outline: none; }
.home-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.55rem; padding: 0.65rem 1rem; border: 1px solid transparent; border-radius: 8px; cursor: pointer; color: var(--text); font: 500 0.85rem var(--font-sans); text-decoration: none; transition: transform 0.15s, border-color 0.15s, background 0.15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { border-color: rgba(47, 111, 208, 0.5); background: rgba(47, 111, 208, 0.12); color: #2563c4; }
.btn-secondary { border-color: var(--border); background: transparent; color: var(--muted); }
.home-message { min-height: 1.5rem; margin-top: 0.8rem; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }
.home-message.is-success { color: var(--green); }
.home-message.is-error { color: var(--danger); }

.exporter-panel { display: flex; flex-direction: column; }
.exporter-panel > p { margin: 1rem 0; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.exporter-download { width: 100%; margin-top: auto; }
.exporter-download[hidden] { display: none; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1.15rem; margin-top: 1rem; }
.module-card { display: flex; flex-direction: column; justify-content: center; gap: 0.38rem; min-height: 4.6rem; padding: 0.85rem 1.15rem; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-soft); color: var(--text); text-decoration: none; transition: transform 0.15s, border-color 0.15s, background 0.15s; }
.module-card:hover { transform: translateY(-2px); border-color: rgba(47, 111, 208, 0.55); background: rgba(47, 111, 208, 0.08); }
.module-card strong { display: block; color: var(--purple); font-family: var(--font-serif); font-size: 0.98rem; }
.module-card span { color: var(--muted); font-size: 0.75rem; line-height: 1.55; }

.changelog-panel { max-height: 34rem; overflow-y: auto; scrollbar-color: var(--border) transparent; }
.changelog-header { display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.changelog-header h2 { font-family: var(--font-serif); font-size: 1.15rem; }
.changelog-kicker { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.12em; }
.changelog-entry { padding: 1rem 0 0.25rem; }
.changelog-entry + .changelog-entry { margin-top: 0.75rem; border-top: 1px solid var(--border); }
.changelog-entry.is-current { margin-top: 0.85rem; padding: 0.9rem; border: 1px solid rgba(181, 134, 46, 0.32); border-radius: 10px; background: rgba(181, 134, 46, 0.07); }
.changelog-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.changelog-meta h3 { color: var(--purple); font-family: var(--font-serif); }
.changelog-meta time { color: var(--muted); font-size: 0.7rem; }
.changelog-entry ul { margin: 0.6rem 0 0 1.2rem; color: var(--muted); font-size: 0.78rem; line-height: 1.65; }
.changelog-entry li + li { margin-top: 0.3rem; }
.changelog-entry li::marker { color: var(--purple); }
.app-footer { padding: 0.5rem 0 1.5rem; color: var(--muted); font-size: 0.72rem; text-align: center; }
.app-footer a { color: var(--purple); }

@media (max-width: 760px) {
    .home-shell { width: min(100% - 1rem, 1040px); padding: 1.5rem 0; }
    .home-grid { grid-template-columns: 1fr; }
    .archive-import-panel { grid-template-columns: 1fr; gap: 0.85rem; }
    .archive-import-actions { width: 100%; }
}

@media (max-width: 460px) {
    .home-header h1 { letter-spacing: 0.06em; }
    .home-title-row { gap: 0.55rem; }
    .home-version { font-size: 0.9rem; }
    .home-panel { padding: 1rem; }
    .home-actions, .save-version-label { align-items: stretch; flex-direction: column; }
    .save-version-select { width: 100%; }
    .module-grid { grid-template-columns: 1fr; }
    .module-card { min-height: auto; }
}

/* ── HAR 存档信息 ── */
.har-info-panel { margin-bottom: 1rem; padding: 1.15rem 1.25rem; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); box-shadow: 0 12px 32px rgba(120, 90, 40, 0.13); }
.har-info-panel[hidden] { display: none; }
.har-info-heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.55rem; }
.har-info-toggle { padding: 0.32rem 0.72rem; border: 1px solid var(--border); border-radius: 999px; background: rgba(181, 134, 46, 0.06); color: var(--muted); font: 550 0.74rem var(--font-sans); cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.har-info-toggle:hover { border-color: rgba(181, 134, 46, 0.55); background: rgba(181, 134, 46, 0.12); color: var(--text); }
.har-info-toggle:focus-visible { outline: 2px solid rgba(181, 134, 46, 0.5); outline-offset: 2px; }
.har-info-body[hidden] { display: none; }
@media (max-width: 460px) {
    .har-info-panel .panel-heading { flex-wrap: wrap; }
    .har-info-heading-actions { width: 100%; justify-content: flex-start; }
}
.har-info-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem 1rem; margin-top: 1rem; }
.har-info-item { min-width: 0; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: rgba(181, 134, 46, 0.05); }
.har-info-item span { display: block; color: var(--muted); font-size: 0.72rem; }
.har-info-item strong { display: block; margin-top: 0.22rem; color: var(--text); font-size: 0.85rem; font-weight: 650; overflow-wrap: anywhere; cursor: default; }
#infoAccount { cursor: pointer; }
.har-info-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }
.har-info-actions .btn { padding: 0.45rem 0.8rem; font-size: 0.78rem; }
.har-details { margin-top: 1rem; border-top: 1px dashed var(--border); padding-top: 0.8rem; }
.har-details summary { cursor: pointer; color: var(--muted); font-size: 0.8rem; }
.har-steps { display: grid; gap: 0.35rem; margin-top: 0.7rem; }
.har-step { display: flex; gap: 0.6rem; font-size: 0.76rem; line-height: 1.5; }
.har-step span { flex: 0 0 6.5rem; color: var(--muted); }
.har-step strong { color: var(--text); font-weight: 550; overflow-wrap: anywhere; }
.har-warnings { display: grid; gap: 0.4rem; margin-top: 0.6rem; }
.har-warning { padding: 0.5rem 0.7rem; border-radius: 8px; border: 1px solid rgba(200, 120, 40, 0.35); background: rgba(200, 120, 40, 0.08); color: var(--text); font-size: 0.76rem; }
.status-badge.is-warn { border-color: rgba(200, 120, 40, 0.5); color: #b5651d; }
@media (max-width: 980px) {
    .har-info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .har-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .har-step { flex-direction: column; gap: 0.1rem; }
    .har-step span { flex: none; }
}
