:root {
    color-scheme: light;
    --blue: #0788d7;
    --blue-deep: #076eae;
    --ink: #212a34;
    --muted: #626e79;
    --line: #e4e9ec;
    --paper: #fff;
    --canvas: #f2f3f4;
    --amber: #8a5400;
    font: 16px/1.5 Arial, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
a { color: var(--blue-deep); text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #007bc4; outline-offset: 3px; }
h1, h2, p { margin: 0; }

.shell { max-width: 500px; min-height: 100vh; margin: 0 auto; padding-bottom: calc(78px + env(safe-area-inset-bottom)); background: var(--canvas); }
.topbar, .page-header { color: #fff; background: var(--blue); }
.topbar { min-height: 36px; padding: calc(7px + env(safe-area-inset-top)) 16px 7px; display: flex; align-items: center; justify-content: space-between; font-size: .81rem; font-weight: 600; }
.topbar a { color: inherit; margin-left: 15px; }
.brand { background: #fff; padding: 14px 16px 13px; }
.brand img { display: block; width: 145px; height: 45px; object-fit: contain; object-position: left center; margin: 0 auto 10px; }
.search, .doi-form { display: flex; min-width: 0; gap: 6px; }
input, textarea, select { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #c6d0d8; border-radius: 4px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #65727d; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; border: 1px solid transparent; border-radius: 4px; color: #fff; background: var(--blue-deep); font-weight: 600; text-align: center; white-space: nowrap; }
.button.outline { border-color: var(--blue-deep); color: var(--blue-deep); background: #fff; }
.filters { display: flex; justify-content: space-around; padding: 0 6px; background: #fff; border-bottom: 1px solid var(--line); }
.filters a { min-height: 45px; display: flex; align-items: center; justify-content: center; padding: 0 5px; color: var(--muted); font-size: .88rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.filters a[aria-current] { color: var(--blue-deep); font-weight: 700; border-bottom-color: var(--blue); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
.thread-list { padding: 0 12px; margin: 0; list-style: none; }
.thread-list li + li { border-top: 1px solid var(--line); }
.thread { min-height: 72px; display: flex; align-items: center; gap: 9px; padding: 11px 0; color: var(--ink); }
.thread-main { flex: 1; min-width: 0; }
.thread-main h2 { font-size: 1rem; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.journal { display: inline-block; max-width: 100%; margin-top: 5px; padding: 1px 6px; border-radius: 3px; background: #e5f4fd; color: #075987; overflow-wrap: anywhere; font-size: .73rem; }
.thread-count { display: grid; grid-template-columns: 39px minmax(44px, auto); align-items: center; gap: 4px; }
.points { display: grid; place-content: center; min-height: 40px; color: var(--amber); background: #fff4d6; border-radius: 4px; text-align: center; font-size: .67rem; line-height: 1.12; }
.points strong { font-size: .93rem; }
.state { display: inline-block; white-space: nowrap; text-align: center; padding: 4px 5px; border-radius: 3px; color: #4c5a67; background: #eef1f3; font-size: .74rem; }
.state.pending { background: #e5f4fd; color: #075987; }
.state.done { background: #edf5ef; color: #3e6248; }
.pagination { display: flex; justify-content: center; gap: 24px; padding: 12px; border-top: 1px solid var(--line); }
.empty { padding: 19px 16px; color: var(--muted); }

.page-header { display: flex; gap: 8px; align-items: center; padding: calc(2px + env(safe-area-inset-top)) 10px 2px; }
.page-header h1 { font-size: 1.14rem; }
.desktop-link { margin-left: auto; min-height: 44px; display: grid; align-items: center; color: #fff; padding-inline: 8px; }
.back { display: grid; place-content: center; width: 44px; min-height: 46px; font-size: 2.05rem; line-height: 1; color: #fff; }
.page-body { padding: 12px 11px 20px; }
.form { display: grid; padding: 16px; gap: 7px; }
.form label { margin-top: 5px; font-weight: 700; }
.form .submit { margin-top: 11px; }
.form .points-input { background: #fff7e4; color: var(--amber); border-color: #ecd49b; }
.form-note, .lookup-message { color: var(--muted); font-size: .82rem; }
.lookup-message:empty { display: none; }
.paper-result { padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: #f1f8fd; overflow-wrap: anywhere; }
.paper-result summary { color: var(--blue-deep); cursor: pointer; font-weight: 600; }
.paper-result pre { font: inherit; margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.error { background: #fff0f1; color: #a32936; padding: 9px; }
.article, .responses { padding: 15px; }
.article h2 { line-height: 1.37; font-size: 1.3rem; overflow-wrap: anywhere; }
.article-tag { color: #9a4a00; }
.reward { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin: 13px 0 9px; padding: 9px; color: var(--amber); background: #fff5db; border-radius: 3px; }
.metadata { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; font-size: .9rem; padding: 6px 0; }
.doi-value { overflow-wrap: anywhere; }
.text-button { min-width: 44px; min-height: 44px; border: none; background: none; color: var(--blue-deep); padding: 4px; }
.responses { margin-top: 11px; }
.responses h2 { font-size: 1rem; border-left: 4px solid var(--blue); padding-left: 9px; }
.reply-summary { margin-top: 11px; color: var(--muted); }
.responses > .button { margin-top: 10px; }
.post-preview { margin-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.download-list { list-style: none; margin: 10px 0 0; padding: 0; }
.download-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; overflow-wrap: anywhere; }
.download-list li + li { border-top: 1px solid var(--line); }
.download-list .button { flex-shrink: 0; }
.account, .account-requests { margin-bottom: 12px; }
.account { padding: 15px; }
.account h2, .account-section h2 { font-size: 1rem; }
.account p { margin: 3px 0; color: var(--muted); font-size: .84rem; }
.account-actions { display: flex; gap: 8px; margin-top: 9px; }
.account-line { display: flex; align-items: center; gap: 10px; }
.account-avatar { flex: 0 0 50px; height: 50px; position: relative; display: grid; place-items: center; border-radius: 50%; overflow: hidden; color: var(--blue-deep); background: #e5f4fd; font-weight: 700; }
.account-avatar img { position: absolute; inset: 0; object-fit: cover; }
.account-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.account-credits { display: grid; text-align: center; padding: 5px 9px; border-radius: 4px; color: var(--amber); background: #fff4d6; }
.account-credits span { font-size: .75rem; }
.account-section { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.footer { position: fixed; z-index: 1; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 500px); border-top: 1px solid var(--line); background: #fff; padding-bottom: env(safe-area-inset-bottom); }
.nav { display: grid; grid-template-columns: repeat(3, 1fr); }
.nav a { display: grid; text-align: center; align-content: center; min-height: 59px; color: var(--muted); font-size: .79rem; }
.nav a[aria-current] { color: var(--blue-deep); font-weight: 700; }
.nav-icon { font-size: 1.29rem; line-height: 1.15; }

@media (max-width: 345px) {
    .thread-count { grid-template-columns: auto; justify-items: end; }
    .points { padding: 4px; min-height: 29px; }
    .doi-form .button, .search .button { padding-inline: 7px; font-size: .86rem; }
}
