:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #687385;
  --line: #d9dee8;
  --brand: #256f8f;
  --brand-dark: #174f68;
  --accent: #b94f43;
  --soft: #eef5f8;
  --shadow: 0 10px 30px rgba(25, 40, 60, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--brand);
  text-decoration: none;
}

.search-highlight {
  padding: 0 2px;
  background: #ffe2e2;
  border-radius: 3px;
  color: #9d1f2a;
  font-weight: inherit;
}

main {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto 28px;
}

.site-footer {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto 56px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.site-footer p {
  margin: 0 0 4px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 40px;
  background: #8b1f2d;
  color: white;
  border-radius: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.account,
.paper-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account {
  gap: 12px;
  font-size: 15px;
}

.account-link {
  color: var(--brand-dark);
  font-weight: 720;
}

.account-link:hover {
  color: var(--brand);
}

.account form {
  margin: 0;
}

.account-user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-menu-toggle {
  min-height: auto;
  padding: 4px 10px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: inherit;
  cursor: pointer;
}

.user-menu-toggle:hover {
  border-color: #bdd6df;
  color: var(--brand-dark);
}

.account-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(25, 40, 60, 0.15);
  z-index: 30;
}

.account-user-menu.open .account-menu-panel {
  display: block;
}

.account-menu-panel .account-link {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--brand-dark);
}

.account-menu-panel .account-link:hover {
  background: var(--soft);
  color: var(--brand);
}

.account-menu-panel form {
  margin: 4px 0 0;
}

.account-logout {
  width: 100%;
  display: block;
  min-height: 32px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  text-align: left;
  border-radius: 6px;
}

.account-logout:hover {
  border-color: var(--line);
  color: var(--brand-dark);
  background: var(--soft);
}

.filters {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 280px 120px auto auto auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  white-space: nowrap;
}

.checkline input {
  width: auto;
  min-height: auto;
}

button,
.primary-button,
.ghost-button,
.icon-button,
.star-button {
  border: 0;
  border-radius: 7px;
  min-height: 40px;
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  background: var(--brand);
  color: white;
}

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

.ghost-button {
  background: var(--soft);
  color: var(--brand-dark);
}

.list-head {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(280px, auto) minmax(160px, 1fr);
  align-items: center;
  gap: 12px;
}

.date-picker {
  display: flex;
  align-items: center;
  margin: 0;
}

.date-picker input {
  width: 132px;
  min-height: 32px;
  padding: 5px 9px;
  background: #ffffff;
  border-color: #cfd9e4;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  text-align-last: center;
}

.date-input-wrap {
  position: relative;
  display: contents;
  min-width: 0;
}

.date-display {
  display: none;
  width: 100%;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.submission-filter {
  display: inline-flex;
  align-items: center;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  gap: 4px;
  padding: 2px;
  background: #edf3f6;
  border: 1px solid #d7e2ea;
  border-radius: 9px;
}

.submission-filter-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #233143;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.submission-filter-option:hover,
.submission-filter-option.active {
  border-color: rgba(47, 82, 111, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.submission-filter-all {
  background: #ffffff;
}

.submission-filter-new {
  background: #edf7ee;
  color: #2f6d3a;
}

.submission-filter-cross {
  background: #f7eee5;
  color: #75513a;
}

.submission-filter-replacement {
  background: #eef2f6;
  color: #51606f;
}

.submission-filter-all.active {
  background: #ffffff;
}

.submission-filter-new.active {
  border-color: #a7d4ad;
  background: #dff2e1;
}

.submission-filter-cross.active {
  border-color: #dec0a8;
  background: #f2e2d3;
}

.submission-filter-replacement.active {
  border-color: #c4ced9;
  background: #e4ebf2;
}

.date-nav {
  display: inline-flex;
  align-items: center;
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  gap: 8px;
}

.date-nav a,
.date-nav span {
  min-height: 36px;
  padding: 7px 12px;
  background: #ffffff;
  border: 1px solid #d5dee8;
  border-radius: 8px;
  color: var(--brand-dark);
  text-align: center;
  font-weight: 750;
}

.date-nav a:hover,
.date-nav a.active {
  background: #eef5f8;
  border-color: #b8cfdd;
  color: var(--brand-dark);
}

.date-nav span {
  color: var(--muted);
}

.date-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.date-arrow.disabled {
  background: #f5f7f9;
  color: #aab4bf;
}

.date-latest {
  min-width: 58px;
}

.date-latest.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.result-chip {
  display: inline-flex;
  align-items: center;
  grid-column: 3;
  grid-row: 1;
  gap: 6px;
  justify-self: end;
  min-width: 0;
  padding: 8px 12px;
  background: #f4f1ec;
  border: 1px solid #e1d5c8;
  border-radius: 7px;
  border-color: #e1d5c8;
  color: #684533;
  box-shadow: 0 6px 18px rgba(104, 69, 51, 0.08);
}

.result-category {
  color: var(--brand-dark);
  font-weight: 750;
}

.result-chip strong {
  color: var(--ink);
  font-size: 16px;
}

.content-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.category-sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sidebar-head h2 {
  margin: 0;
  font-size: 18px;
}

.sidebar-head a {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 650;
}

.category-tree {
  display: grid;
  gap: 6px;
}

.category-group {
  border: 0;
  padding: 0;
}

.category-major {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  background: var(--soft);
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.major-code {
  font-size: 13px;
}

.hot-icons {
  margin-left: 3px;
  font-size: 11px;
  line-height: 1;
}

.major-name {
  overflow: hidden;
  color: var(--brand-dark);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-major:hover {
  background: #dfeef3;
  color: var(--brand-dark);
}

.category-major small {
  color: var(--muted);
  font-weight: 600;
}

.subcategory-list {
  display: grid;
  gap: 4px;
  padding: 4px 0 8px 10px;
}

.subcategory-link {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--ink);
  border-radius: 7px;
}

.subcategory-link:hover,
.subcategory-link.active {
  background: #f4f1ec;
  color: var(--brand-dark);
}

.subcategory-link span {
  font-weight: 720;
  font-size: 13px;
}

.subcategory-link small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-list {
  display: grid;
  gap: 14px;
}

.mobile-home-controls {
  display: contents;
}

.mobile-list-actions,
.mobile-inline-panel {
  display: none;
}

.paper-card {
  position: relative;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-right: 116px;
  color: var(--muted);
  font-size: 13px;
}

.paper-meta span {
  padding: 2px 8px;
  background: var(--soft);
  border-radius: 999px;
}

.paper-meta .category-pill {
  background: #f4f1ec;
  color: #684533;
  font-weight: 650;
}

.paper-meta .submission-pill {
  border: 1px solid #d5dee8;
  background: #eef4f8;
  color: #2f526f;
  font-weight: 700;
}

.paper-meta .submission-cross {
  border-color: #d8dccd;
  background: #f1f5e9;
  color: #4f622d;
}

.paper-meta .submission-replacement {
  border-color: #e3d6c8;
  background: #f7eee5;
  color: #75513a;
}

.paper-card h2 {
  margin: 10px 0 6px;
  font-size: 19px;
  line-height: 1.32;
}

.title-cn {
  margin: 0 0 6px;
  color: #253244;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
}

.authors {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.affiliations {
  margin: 8px 0 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.5;
}

.affiliations-label {
  position: relative;
  margin-right: 6px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 750;
}

.affiliations-note {
  position: relative;
  top: -0.35em;
  margin-left: 1px;
  color: #9b1c31;
  cursor: help;
  font-size: 11px;
  font-weight: 850;
}

.affiliations-list {
  min-width: 0;
}

.affiliation-item {
  overflow-wrap: anywhere;
}

.affiliation-separator {
  color: var(--muted);
}

.summary {
  margin: 14px 0;
  color: #27313d;
  font-size: 14px;
  font-weight: 520;
}

.summary-label {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  padding: 2px 6px;
  background: #e9f3f6;
  border: 1px solid #cfe3ea;
  border-radius: 6px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.paper-comments {
  margin: 10px 0 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.5;
}

.paper-comments-label {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 2px 6px;
  background: #f3f4f6;
  border: 1px solid #d6dce4;
  border-radius: 6px;
  color: #4b5563;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.paper-comments-text {
  overflow-wrap: anywhere;
}

.paper-comments-text a {
  color: var(--brand-dark);
  text-decoration: underline;
  text-decoration-color: rgba(37, 111, 143, 0.4);
}

.paper-comments-text a:hover {
  text-decoration-color: currentColor;
}

.comments-submission {
  display: inline;
  padding: 1px 5px;
  background: #fff5d6;
  border: 1px solid #f1cf6e;
  border-radius: 4px;
  color: #8a5b00;
  font-weight: 700;
}

.comments-venue {
  display: inline;
  padding: 1px 5px;
  background: #e6f0ff;
  border: 1px solid #b9cdf0;
  border-radius: 4px;
  color: #1a4ea0;
  font-weight: 700;
}

.comments-venue a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(26, 78, 160, 0.4);
}

.topic-nav {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topic-nav-title {
  display: block;
  margin: 0 0 8px;
  color: #27313d;
  font-size: 13px;
  font-weight: 800;
}

.topic-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.topic-nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  background: #f7fafc;
  border: 1px solid #dce5ec;
  border-radius: 7px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.topic-nav-links a:hover {
  border-color: #bdd5df;
  background: #eef7fa;
}

.topic-nav-links span {
  color: var(--muted);
  font-weight: 800;
}

.topic-section-heading {
  scroll-margin-top: 86px;
  margin: 16px 0 10px;
  padding: 9px 12px;
  background: #eef3f6;
  border-left: 4px solid #9a1b30;
  border-radius: 0 8px 8px 0;
}

.topic-section-heading h2 {
  margin: 0;
  color: #1f2933;
  font-size: 18px;
  line-height: 1.35;
}

.topic-section-heading span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.paper-toolbar {
  display: contents;
}

.paper-details-row {
  position: relative;
  min-height: 34px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 6px;
}

.paper-details {
  min-width: 0;
}

.paper-details summary {
  min-width: 0;
  padding-right: 82px;
  color: var(--brand);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

.paper-details-content {
  min-width: 0;
}

.paper-reactions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.paper-actions form,
.paper-reactions form {
  margin: 0;
}

.reaction-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  background: #f8fafc;
  border: 1px solid #dbe3ed;
  border-radius: 7px;
  color: #4d5b6b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.reaction-button:hover,
.reaction-button.active {
  background: #e9f3f6;
  border-color: #cfe3ea;
  color: var(--brand-dark);
}

.reaction-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.reaction-button.dislike {
  background: #f4f1ec;
  border-color: #e1d5c8;
  color: #684533;
}

.reaction-button span {
  margin-left: 3px;
}

.detail-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #edf1f5;
  border-radius: 7px;
}

.detail-row dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.detail-row dd {
  margin: 0;
  min-width: 0;
  color: #3e4856;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detail-abstract {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fbfcfd;
  border-left: 3px solid #cfe3ea;
}

.detail-abstract span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-abstract p {
  margin: 6px 0 0;
  color: #3e4856;
  font-size: 15px;
  line-height: 1.5;
  text-align: justify;
  text-justify: inter-ideograph;
}

.detail-abstract-cn p {
  color: #253244;
}

.paper-actions {
  position: absolute;
  top: 14px;
  right: 20px;
  align-items: flex-start;
  gap: 6px;
}

.icon-button,
.star-button {
  width: 32px;
  min-height: 30px;
  padding: 0;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 17px;
}

.url-button,
.pdf-button {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.html-button {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
}

.copy-button {
  width: auto;
  min-width: 40px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.copy-button.copied {
  background: #d9f5e2;
  color: #1f7a3a;
}

.star-button.active {
  background: #fff2d6;
  color: var(--accent);
}

.empty-state,
.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.empty-state {
  padding: 36px;
  text-align: center;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.pagination a,
.pagination span {
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.page-jump {
  display: flex;
  align-items: end;
  gap: 8px;
}

.page-jump label {
  grid-template-columns: auto 80px;
  align-items: center;
  gap: 8px;
}

.page-jump input {
  min-height: 38px;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 100px);
}

.auth-panel {
  width: min(420px, 100%);
  padding: 28px;
}

.auth-panel h1 {
  margin: 0 0 20px;
}

.auth-panel label {
  margin-bottom: 14px;
}

.wide {
  width: 100%;
}

.flash-wrap {
  width: min(1220px, calc(100% - 32px));
  margin: 14px auto 0;
}

.flash {
  padding: 10px 14px;
  background: #fff7df;
  color: #6b4a12;
  border: 1px solid #f0d591;
  border-radius: 8px;
}

.user-chip {
  color: var(--muted);
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--brand);
  border: 1px solid var(--brand-dark);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: white;
  font-size: 22px;
  font-weight: 800;
}

.back-to-top:hover {
  background: var(--brand-dark);
}

@media (max-width: 980px) {
  .home-shell {
    display: flex;
    flex-direction: column;
  }

  .home-shell .content-layout {
    display: contents;
  }

  .home-shell .paper-list {
    order: 1;
  }

  .home-shell .pagination {
    order: 2;
  }

  .home-shell .filters {
    order: 3;
  }

  .home-shell .category-sidebar {
    order: 4;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .search-box {
    grid-column: 1 / -1;
  }

  .date-range-filter {
    grid-column: 1 / -1;
  }

  .list-head {
    grid-template-columns: 1fr;
  }

  .mobile-home-controls {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 82px;
    align-items: stretch;
    column-gap: 6px;
    row-gap: 6px;
    width: 100%;
    margin-top: 10px;
    overflow-x: visible;
  }

  .mobile-home-controls .list-head {
    display: contents;
  }

  .mobile-home-controls .submission-filter {
    display: inline-flex;
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: center;
    max-width: 100%;
    gap: 4px;
    padding: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-home-controls .submission-filter::-webkit-scrollbar {
    display: none;
  }

  .mobile-home-controls .submission-filter-option {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 12px;
    line-height: 1;
  }

  .mobile-inline-panel {
    grid-column: 1 / -1;
    grid-row: 4;
    min-width: 0;
    padding: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .mobile-inline-panel[hidden] {
    display: none;
  }

  .mobile-inline-panel:not([hidden]) {
    display: block;
  }

  .mobile-home-controls .date-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    justify-self: center;
    width: auto;
    gap: 5px;
    margin: 0;
  }

  .mobile-home-controls .date-nav a,
  .mobile-home-controls .date-nav span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 32px;
    padding: 5px 6px;
    font-size: 12px;
    line-height: 1.2;
  }

  .mobile-home-controls .result-chip {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
  }

  .result-chip {
    justify-self: end;
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .category-sidebar {
    position: static;
    max-height: none;
  }

  .home-shell .filters,
  .home-shell .category-sidebar {
    margin-top: 18px;
  }

  .mobile-inline-panel .filters,
  .mobile-inline-panel .category-sidebar {
    margin-top: 0;
    box-shadow: none;
  }

  .mobile-inline-panel .category-sidebar {
    max-height: min(70vh, 520px);
    overflow: auto;
  }

  .mobile-list-actions {
    display: contents;
  }

  .mobile-list-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 34px;
    padding: 6px 3px;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
  }

  .mobile-home-controls .result-chip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    min-width: 0;
    max-width: 100%;
    padding: 6px 7px;
    background: #ffffff;
    border-color: #d9e1ea;
    border-radius: 7px;
    box-shadow: none;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
    overflow: hidden;
    white-space: nowrap;
  }

  .mobile-home-controls .result-category {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-home-controls .result-chip strong {
    color: var(--ink);
    font-size: 13px;
  }

  .mobile-home-controls .result-count {
    white-space: nowrap;
  }

  .mobile-list-actions a:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .mobile-list-actions a:last-child {
    grid-column: 3;
    grid-row: 1;
  }

  .mobile-list-actions a::after {
    content: "▾";
    margin-left: 3px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1;
  }

  .mobile-home-controls .date-picker {
    display: contents;
    width: auto;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .mobile-home-controls .date-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 126px;
    min-height: 32px;
    padding: 5px 7px;
    background: #ffffff;
    border: 1px solid #cfd9e4;
    border-radius: 8px;
    color: var(--ink);
  }

  .mobile-home-controls .date-picker input {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 100%;
    padding: 0;
    opacity: 0;
    cursor: pointer;
  }

  .mobile-home-controls .date-display {
    display: block;
    font-size: 12px;
  }

}

@media (max-width: 640px) {
  main {
    width: min(100% - 20px, 1220px);
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 8px 10px;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand-mark {
    flex: 0 0 auto;
    width: 86px;
    height: 32px;
    border-radius: 7px;
    font-size: 14px;
  }

  .brand strong {
    display: none;
  }

  .brand small {
    display: none;
  }

  .account {
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: 13px;
  }

  .account .ghost-button,
  .account .primary-button {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 13px;
  }

  .account-user-menu {
    position: relative;
    display: block;
  }

  .user-menu-toggle {
    display: block;
    padding: 2px 8px;
    min-height: 26px;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: inherit;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
  }

  .user-menu-toggle .user-chip {
    max-width: none;
  }

  .account-user-menu.open .account-menu-panel {
    display: block;
  }

  .account-menu-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 132px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(25, 40, 60, 0.15);
    z-index: 30;
    white-space: nowrap;
  }

  .account-menu-panel .account-link,
  .account-menu-panel .account-logout {
    display: block;
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    white-space: nowrap;
    border-radius: 4px;
  }

  .account-menu-panel .account-link {
    color: var(--brand-dark);
    font-weight: 600;
  }

  .account-menu-panel .account-link:hover {
    background: var(--soft);
    color: var(--brand);
  }

  .account-menu-panel .account-logout {
    min-height: 28px;
    border: 0;
    background: transparent;
    color: var(--brand-dark);
    font-weight: 600;
  }

  .account-menu-panel .account-logout:hover {
    background: var(--soft);
  }

  .user-chip {
    display: block;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--brand-dark);
    font-weight: 700;
  }

  .filters,
  .date-picker,
  .date-range-inputs,
  .subcategory-link,
  .detail-row {
    grid-template-columns: 1fr;
  }

  .list-head {
    gap: 8px;
  }

  .date-picker {
    width: auto;
  }

  .mobile-home-controls .date-picker {
    display: contents;
    width: auto;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .mobile-home-controls .date-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 118px;
    min-height: 32px;
    padding: 5px 6px;
    background: #ffffff;
    border: 1px solid #cfd9e4;
    border-radius: 8px;
    color: var(--ink);
  }

  .mobile-home-controls .date-picker input {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 100%;
    padding: 0;
    opacity: 0;
    cursor: pointer;
  }

  .mobile-home-controls .date-display {
    display: block;
    font-size: 12px;
  }

  .mobile-home-controls .mobile-list-actions a {
    min-height: 34px;
    padding: 6px 3px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .date-nav {
    gap: 4px;
    margin: 0;
  }

  .date-nav a,
  .date-nav span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 32px;
    padding: 5px 6px;
    font-size: 12px;
    line-height: 1.2;
  }

  .mobile-home-controls .date-nav {
    justify-content: center;
    justify-self: center;
    width: auto;
  }

  .mobile-home-controls .date-nav a,
  .mobile-home-controls .date-nav span {
    min-width: 0;
  }

  .result-chip {
    justify-self: center;
    grid-column: 2;
    grid-row: 1;
    padding: 5px 7px;
    font-size: 12px;
    align-items: center;
    white-space: nowrap;
  }

  .result-chip strong {
    font-size: 14px;
  }


  .paper-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
  }

  .paper-details-row {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 0;
    min-width: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .paper-details summary {
    padding-right: 0;
  }

  .paper-details[open] {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .paper-details-row:has(.paper-details[open]) {
    flex: 1 1 100%;
  }

  .paper-details[open] .paper-details-content {
    width: 100%;
  }

  .paper-reactions {
    flex: 0 0 auto;
    gap: 4px;
    justify-content: flex-start;
  }

  .paper-actions {
    position: static;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 0;
    margin-left: auto;
  }

  .reaction-button {
    min-height: 28px;
    padding: 4px 8px;
  }

  .icon-button,
  .star-button {
    width: 30px;
    min-height: 28px;
  }

  .paper-meta {
    padding-right: 0;
  }
}

/* ===== account page ===== */
.account-shell {
  width: min(620px, 100%);
  margin: 32px auto 48px;
  display: grid;
  gap: 18px;
}

.account-header {
  padding: 0 4px;
}

.account-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.account-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.account-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
  display: grid;
  gap: 14px;
}

.account-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.account-card-hint {
  margin: -6px 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.account-card label {
  margin: 0;
}

.account-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 540px) {
  .account-grid {
    grid-template-columns: 1fr;
  }
  .account-card {
    padding: 20px;
  }
}

.account-summary {
  gap: 12px;
}

.account-info {
  margin: 0;
  display: grid;
  gap: 10px;
}

.account-info > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: baseline;
  gap: 12px;
}

.account-info dt {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.account-info dd {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  word-break: break-all;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.account-email {
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.badge-ok {
  background: #e6f6ed;
  color: #0f7a3a;
  border-color: #c4ebd1;
}

.badge-warn {
  background: #fff3e0;
  color: #b45309;
  border-color: #fbd9a4;
}

.inline-link {
  font-size: 13px;
  color: var(--brand-dark);
  text-decoration: underline;
}

.inline-link:hover {
  color: var(--brand);
}

/* ---------- Admin ---------- */
.admin {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 0;
}

.admin-nav {
  display: flex;
  gap: 8px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.admin-nav a {
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.admin-nav a:hover {
  background: var(--soft);
  color: var(--brand-dark);
}

.admin-nav a.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand-dark);
}

.admin-body {
  margin-top: 18px;
}

.admin-h1 {
  margin: 6px 0 14px;
  font-size: 20px;
}

.admin-h2 {
  margin: 24px 0 10px;
  font-size: 16px;
  color: var(--brand-dark);
}

.admin-h3 {
  margin: 18px 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.admin-muted {
  color: var(--muted);
  font-size: 13px;
}

.admin-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}

.admin-form input[type=text] {
  flex: 1 1 280px;
  max-width: 360px;
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
}

.admin-card {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.admin-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.admin-card-value {
  margin: 4px 0 2px;
  color: var(--brand-dark);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.admin-card-sub {
  color: var(--muted);
  font-size: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

.admin-table th {
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 700;
  white-space: nowrap;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table-compact th,
.admin-table-compact td {
  padding: 6px 10px;
  font-size: 12px;
}

.admin-cell-email,
.admin-cell-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-cell-preview {
  max-width: 600px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  word-break: break-word;
}

.admin-tag {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.admin-tag-ok {
  background: #e6f7ec;
  color: #15803d;
  border-color: #b6e0c6;
}

.admin-tag-warn {
  background: #fff3e0;
  color: #b45309;
  border-color: #fbd9a4;
}

.admin-tag-admin {
  background: #fde2e4;
  color: #9d1f2a;
  border-color: #f4b8be;
}

.admin-btn-danger {
  min-height: 28px;
  padding: 4px 10px;
  background: #fde2e4;
  color: #9d1f2a;
  border: 1px solid #f4b8be;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.admin-btn-danger:hover {
  background: #f9c8cc;
}

.admin-btn-small {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}

.admin-tabs {
  display: flex;
  gap: 6px;
  margin: 6px 0 14px;
}

.admin-tabs a {
  padding: 6px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.admin-tabs a.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand-dark);
}

.admin-paper-summary {
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 0 18px;
  line-height: 1.55;
}

.admin-back {
  font-size: 13px;
  color: var(--brand-dark);
}

/* ---------- Gone / 404 友好页 ---------- */
.gone-page {
  width: min(720px, calc(100% - 32px));
  margin: 56px auto;
  padding: 36px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: center;
}

.gone-h1 {
  margin: 0 0 14px;
  font-size: 22px;
  color: var(--ink);
}

.gone-lead {
  margin: 0 auto 26px;
  max-width: 540px;
  color: var(--muted);
  line-height: 1.7;
}

.gone-lead code {
  padding: 1px 6px;
  background: var(--soft);
  border-radius: 4px;
  font-size: 13px;
}

.gone-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.gone-suggest {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.gone-suggest h2 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.gone-suggest ul {
  margin: 0;
  padding: 0 0 0 20px;
  color: var(--brand-dark);
  line-height: 1.9;
}

.gone-suggest a:hover {
  color: var(--brand);
  text-decoration: underline;
}
