:root {
  color-scheme: light;
  --background: #f3f5f1;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --text: #17211e;
  --muted: #64716c;
  --line: #dce3de;
  --accent: #0b6b57;
  --accent-dark: #075343;
  --accent-soft: #dcefe9;
  --shadow: 0 18px 50px rgba(23, 33, 30, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(11, 107, 87, 0.08), transparent 30rem),
    var(--background);
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 68px;
  padding: 10px max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(220, 227, 222, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: var(--text);
  font-size: 18px;
  font-weight: 760;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: var(--accent);
  font-size: 13px;
  letter-spacing: -0.03em;
}

.nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.nav-button, .token-button, .refresh-button {
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.nav-button { padding: 7px 18px; }
.nav-button.is-active { color: var(--text); background: var(--surface); box-shadow: 0 2px 8px rgba(23, 33, 30, 0.08); }
.token-button { justify-self: end; padding: 9px 12px; border: 1px solid var(--line); }
.token-button:hover, .refresh-button:hover { color: var(--accent); border-color: var(--accent); }

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  padding-bottom: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(34px, 5vw, 58px); line-height: 1.06; letter-spacing: -0.045em; }
.hero-copy { max-width: 620px; margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.7; }

.metrics { display: flex; gap: 10px; flex: 0 0 auto; }
.metric { min-width: 106px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.75); }
.metric strong, .metric span { display: block; }
.metric strong { margin-bottom: 3px; font-size: 25px; letter-spacing: -0.04em; }
.metric span { color: var(--muted); font-size: 12px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 26px;
  border-top: 1px solid var(--line);
}

.topics { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.topics::-webkit-scrollbar { display: none; }
.topic-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
}
.topic-button.is-active { color: #fff; border-color: var(--accent); background: var(--accent); }
.refresh-button { flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--line); background: var(--surface); }

.notice { margin-bottom: 20px; padding: 14px 16px; border: 1px solid #efd8a9; border-radius: 12px; color: #79571c; background: #fff8e9; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.topic-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--card-accent, var(--accent));
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(23, 33, 30, 0.04);
}

.topic-card-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topic-card h2 { margin-bottom: 3px; font-size: 19px; letter-spacing: -0.02em; }
.topic-summary { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.entry-count { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 12px; font-weight: 700; }
.entry-list { display: grid; gap: 14px; }
.entry { padding-top: 14px; border-top: 1px solid var(--line); }
.entry:first-child { padding-top: 0; border-top: 0; }
.entry-title { margin-bottom: 5px; font-size: 16px; line-height: 1.45; }
.entry-title a { text-decoration: none; }
.entry-title a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.original-title { margin: -1px 0 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.entry-summary, .empty-copy { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; white-space: pre-line; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.entry-action { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 700; }
.entry-action-primary { color: #fff; background: var(--accent); border-color: var(--accent); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.section-heading h1 { margin-bottom: 0; }
.section-heading > p { max-width: 360px; margin-bottom: 8px; color: var(--muted); text-align: right; }
.history-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.history-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.history-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.history-date { display: block; margin-bottom: 8px; font-size: 20px; font-weight: 750; letter-spacing: -0.03em; }
.history-meta { color: var(--muted); font-size: 13px; }

.token-dialog { width: min(440px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 18px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.token-dialog::backdrop { background: rgba(13, 24, 20, 0.54); backdrop-filter: blur(4px); }
.token-dialog form { position: relative; padding: 30px; }
.token-dialog h2 { margin-bottom: 10px; font-size: 27px; letter-spacing: -0.03em; }
.dialog-copy { margin-bottom: 22px; color: var(--muted); line-height: 1.6; }
.dialog-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-soft); font-size: 22px; }
.token-dialog label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.token-dialog input { width: 100%; margin-bottom: 12px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); outline: none; }
.token-dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.primary-button { width: 100%; margin-top: 8px; padding: 12px; border: 0; border-radius: 10px; color: #fff; background: var(--accent); font-weight: 750; }
.primary-button:hover { background: var(--accent-dark); }
.form-error { margin: 0 0 8px; color: #a43838; font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; max-width: 360px; padding: 12px 16px; border-radius: 10px; color: #fff; background: #26312d; box-shadow: var(--shadow); }
.skeleton { min-height: 190px; overflow: hidden; position: relative; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.8), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.is-hidden { display: none !important; }

@media (max-width: 780px) {
  .topbar { grid-template-columns: 1fr auto; padding: 10px 16px; }
  .nav { position: fixed; right: 16px; bottom: 16px; left: 16px; z-index: 30; justify-content: center; box-shadow: var(--shadow); }
  .nav-button { flex: 1; }
  .token-button { font-size: 0; }
  .token-button::after { content: "凭据"; font-size: 14px; }
  .shell { width: min(100% - 28px, 620px); padding: 42px 0 92px; }
  .hero { display: block; }
  .metrics { margin-top: 24px; }
  .metric { flex: 1; }
  .toolbar { align-items: start; }
  .report-grid, .history-list { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 10px; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
