:root {
  color-scheme: light;
  --page: #f3f0e9;
  --paper: #fbfaf6;
  --paper-deep: #f6f3ec;
  --ink: #252622;
  --ink-soft: #44463f;
  --muted: #6b6d64;
  --faint: #6a6c63;
  --line: #dcd8ce;
  --line-strong: #c9c4b8;
  --accent: #52675a;
  --accent-dark: #3e5145;
  --accent-soft: #e7ebe5;
  --error: #91453e;
  --error-soft: #f5e9e5;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --content-width: 740px;
  --wide-width: 920px;
  --radius: 5px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--accent);
}

button {
  color: inherit;
}

button:not(:disabled),
a[href] {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  color: var(--paper);
  background: var(--accent-dark);
  border-radius: var(--radius);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(calc(100% - 40px), var(--wide-width));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

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

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.brand-tagline {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
}

.header-actions,
.main-nav {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 22px;
}

.main-nav {
  align-self: stretch;
  gap: 26px;
}

.main-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  position: relative;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.main-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--ink);
}

.main-nav a[aria-current="page"]::after {
  background: var(--accent);
}

.logout-form {
  margin: 0;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.page-shell {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.page-shell:focus {
  outline: none;
}

.page-heading {
  margin-bottom: 48px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.69rem;
  font-weight: 650;
  letter-spacing: 0.2em;
  line-height: 1.4;
}

.page-heading h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.25rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.page-heading > p:last-child:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.feed-list {
  display: grid;
  gap: 68px;
}

.batch-heading {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-strong);
}

.batch-heading h2 {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.batch-heading p {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 0.78rem;
}

.card-list {
  display: grid;
  gap: 28px;
}

.saved-list {
  gap: 32px;
}

.reading-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 5px rgb(43 40 32 / 3%);
  transition: opacity 120ms ease-out, transform 120ms ease-out;
}

.reading-card.is-leaving {
  opacity: 0;
  transform: translateY(4px);
}

.card-header {
  padding: 34px 38px 0;
}

.source-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.source-name {
  color: var(--accent-dark);
  font-weight: 600;
  letter-spacing: 0.025em;
}

.meta-separator {
  color: var(--line-strong);
}

.card-title {
  margin: 0;
  overflow-wrap: break-word;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.45;
}

.card-title:focus {
  outline: none;
}

.original-title {
  margin: 11px 0 0;
  color: var(--faint);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.card-body {
  padding: 25px 38px 32px;
}

.summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.88;
  overflow-wrap: break-word;
}

.key-points {
  margin-top: 28px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
}

.key-points h4 {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.16em;
}

.key-points ul {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: points;
}

.key-points li {
  position: relative;
  padding-left: 31px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.78;
  counter-increment: points;
}

.key-points li + li {
  margin-top: 11px;
}

.key-points li::before {
  content: counter(points, decimal-leading-zero);
  position: absolute;
  top: 0.16em;
  left: 0;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.73rem;
  line-height: 1.8;
}

.card-footer {
  min-height: 76px;
  padding: 16px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.source-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.79rem;
  text-decoration: none;
}

.source-links a::after {
  content: "↗";
  margin-left: 5px;
  color: var(--faint);
  font-size: 0.75rem;
}

.source-links a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.card-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.card-actions form {
  margin: 0;
}

.primary-button,
.quiet-button,
.text-button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 3px;
  font-size: 0.84rem;
  line-height: 1.2;
}

.primary-button,
.quiet-button {
  padding: 10px 18px;
  border: 1px solid transparent;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.quiet-button {
  color: var(--muted);
  background: transparent;
  border-color: var(--line-strong);
}

.quiet-button:hover:not(:disabled) {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--faint);
}

.text-button {
  padding: 8px 2px;
  color: var(--accent-dark);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.text-button:hover:not(:disabled) {
  color: var(--accent);
}

.logout-button {
  min-height: 44px;
  padding: 8px 0 8px 2px;
  color: var(--muted);
  border: 0;
  font-size: 0.79rem;
}

.logout-button:hover:not(:disabled) {
  color: var(--ink);
  background: transparent;
}

.saved-time {
  margin: 0;
  color: var(--faint);
  font-size: 0.75rem;
  white-space: nowrap;
}

.undo-banner {
  margin: -20px 0 32px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-soft);
  background: var(--accent-soft);
  border: 1px solid #d1d9cf;
  border-radius: var(--radius);
  font-size: 0.86rem;
}

.undo-banner form {
  flex: none;
  margin: 0;
}

.empty-state {
  padding: 64px 24px;
  text-align: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.empty-mark {
  margin: 0 0 20px;
  color: var(--line-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.5rem;
  font-style: italic;
  line-height: 1;
}

.empty-state h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
}

.empty-state > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.pagination {
  margin-top: 48px;
  padding-top: 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.pagination p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  white-space: nowrap;
}

.pagination-direction {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  color: var(--accent-dark);
  font-size: 0.82rem;
  text-decoration: none;
}

.pagination-direction:last-child {
  justify-self: end;
}

.pagination-direction:hover {
  text-decoration: underline;
}

.pagination-direction.is-disabled {
  color: var(--faint);
  opacity: 0.55;
}

.site-footer {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 24px 0 36px;
  color: var(--faint);
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.toast-region {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: 20px;
  width: min(calc(100% - 40px), 420px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 10px 10px 10px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--paper);
  background: #343832;
  border: 1px solid #4b5149;
  border-radius: var(--radius);
  box-shadow: 0 5px 20px rgb(30 31 27 / 15%);
  font-size: 0.85rem;
  pointer-events: auto;
}

.toast-message {
  flex: 1;
}

.toast form {
  flex: none;
  margin: 0;
}

.toast .text-button,
.toast .toast-close {
  color: #f3f4ee;
}

.toast-close {
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 1.25rem;
  line-height: 1;
}

.toast-error {
  background: #683c37;
  border-color: #83534c;
}

.login-page {
  display: flex;
  flex-direction: column;
}

.login-page .page-shell {
  width: min(calc(100% - 40px), 430px);
  flex: 1;
  display: flex;
  align-items: center;
  padding: 48px 0;
}

.login-panel {
  width: 100%;
  padding: 42px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login-brand {
  margin-bottom: 38px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.25rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.login-panel h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
}

.login-intro {
  margin: 12px 0 28px;
  color: var(--muted);
  font-size: 0.88rem;
}

.login-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.login-form input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

.login-form input[type="password"]:focus {
  border-color: var(--accent);
}

.login-submit {
  width: 100%;
  margin-top: 18px;
}

.form-error {
  margin: 0 0 20px;
  padding: 11px 13px;
  color: var(--error);
  background: var(--error-soft);
  border-left: 2px solid var(--error);
  font-size: 0.84rem;
}

@media (max-width: 640px) {
  .header-inner {
    width: min(calc(100% - 32px), var(--wide-width));
    min-height: 72px;
    gap: 12px;
  }

  .brand-tagline {
    display: none;
  }

  .brand-name {
    font-size: 1.55rem;
  }

  .header-actions {
    gap: 14px;
  }

  .main-nav {
    gap: 18px;
  }

  .logout-form {
    padding-left: 12px;
  }

  .page-shell {
    width: min(calc(100% - 32px), var(--content-width));
    padding: 42px 0 56px;
  }

  .page-heading {
    margin-bottom: 36px;
  }

  .feed-list {
    gap: 52px;
  }

  .card-list {
    gap: 20px;
  }

  .card-header {
    padding: 26px 23px 0;
  }

  .card-body {
    padding: 21px 23px 27px;
  }

  .summary {
    line-height: 1.85;
  }

  .card-footer {
    padding: 15px 23px;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .card-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .saved-time {
    padding: 6px 0;
  }

  .undo-banner {
    align-items: flex-start;
    padding: 10px 12px 10px 15px;
  }

  .pagination {
    gap: 8px;
  }

  .pagination p {
    font-size: 0.7rem;
  }

  .pagination-direction {
    font-size: 0.78rem;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
    width: calc(100% - 32px);
  }

  .login-panel {
    padding: 32px 25px;
  }
}

@media (max-width: 390px) {
  .header-inner {
    gap: 8px;
  }

  .header-actions {
    gap: 10px;
  }

  .main-nav {
    gap: 14px;
  }

  .card-actions .primary-button,
  .card-actions .quiet-button {
    flex: 1;
  }

  .card-actions form {
    flex: 1;
  }

  .pagination p span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
