:root {
  --color-bg: #5c3b81;
  --color-bg-start: #505ab7;
  --color-text: #fff;
  --color-line: rgba(255, 255, 255, 0.35);
  --color-line-strong: rgba(255, 255, 255, 0.55);
  --color-fill: rgba(255, 255, 255, 0.16);
  --color-fill-strong: rgba(255, 255, 255, 0.38);
  --color-card: rgba(255, 255, 255, 0.12);
  --color-code: rgba(0, 0, 0, 0.25);
  --color-button: rgba(255, 255, 255, 0.22);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-title: 0 4px 24px rgba(0, 0, 0, 0.25);
  --radius: 8px;
  --radius-card: 16px;
  --radius-round: 50%;
  --measure: 640px;
  --page: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--color-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg) 100%) fixed;
  color: var(--color-text);
  font-family: var(--font);
}

:focus-visible {
  outline: 2px solid var(--color-line-strong);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

a,
button {
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

a:active {
  transform: translateY(1px);
}

.topbar a,
.doc-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  line-height: 1.2;
}

.topbar a:active,
.doc-nav a:active {
  transform: translateY(1px);
}

.topbar a:hover,
.doc-nav a:hover,
.doc-nav a[aria-current="page"] {
  background: var(--color-fill);
}

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

.topbar {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.25rem 0;
}

.page-home main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
}

.brand {
  font-size: clamp(2rem, 7vw, 4rem);
  margin: 0 0 1.5rem;
  text-shadow: var(--shadow-title);
  letter-spacing: 0.08em;
  animation: fadeIn 1s ease-out;
}

.brand .accent {
  display: inline-block;
  transform: rotate(-2deg);
}

.greeting {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 0.25rem 0.5rem;
  border-top: 1px solid var(--color-line);
  animation: fadeIn 1.4s ease-out;
}

.greeting p {
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  line-height: 1.9;
  margin: 0.3rem 0;
}

.greeting .sig {
  margin-top: 1rem;
  font-size: 0.95rem;
  font-style: italic;
}

.site-footer {
  flex-shrink: 0;
  padding: 0.5rem 1.25rem 1.2rem;
  text-align: center;
  font-size: 0.95rem;
  animation: fadeIn 2s ease-out;
}

.site-footer .links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.15rem 0.35rem;
  margin-bottom: 0.2rem;
}

.site-footer a {
  text-decoration: none;
  padding: 0.45rem 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
}

.site-footer a:hover {
  background: var(--color-card);
}

.site-footer .sep {
  opacity: 0.7;
}

.copyright {
  font-size: 0.9rem;
}

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.8rem;
  height: 2.8rem;
  border: none;
  border-radius: var(--radius-round);
  background: var(--color-button);
  color: var(--color-text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  visibility: hidden;
  pointer-events: none;
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.12s ease;
}

.to-top.is-visible {
  visibility: visible;
  pointer-events: auto;
}

.to-top:hover {
  background: var(--color-fill-strong);
}

.to-top:active,
.ai-hot-collect:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.page-doc {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem 0;
}

.page-doc main.container {
  flex: 1 0 auto;
}

.page-doc .site-footer {
  flex-shrink: 0;
  max-width: var(--page);
  width: 100%;
  margin: 0 auto;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.container {
  max-width: var(--page);
  margin: 0 auto;
  background: var(--color-card);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-card);
  padding: 1.15rem 1rem 1.35rem;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.8s ease-out;
}

.container h1 {
  margin-top: 0;
  font-size: 1.8rem;
}

.container h2 {
  margin-top: 1.5rem;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--color-line);
  padding-bottom: 0.3rem;
}

.container p,
.container li {
  line-height: 1.75;
}

.container ul {
  padding-left: 1.2rem;
}

.container p a,
.container li a {
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.container code {
  background: var(--color-code);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.updated {
  font-size: 0.9rem;
  margin-top: 2rem;
}

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

@media (min-width: 640px) {
  .page-doc {
    padding: 2rem 1rem 0;
  }

  .container {
    padding: 2rem 2.5rem 2.2rem;
  }

  .page-doc .site-footer {
    padding-left: 0;
    padding-right: 0;
  }
}

/* AI 热点 · 首页摘要卡片 */
.ai-hot-card {
  flex-shrink: 0;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
  animation: fadeIn 1s ease-out;
}

.ai-hot-card .container {
  padding: 1.15rem 1.4rem 1.25rem;
}

.ai-hot-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.ai-hot-summary-label {
  font-size: 1.15rem;
  font-weight: 600;
}

.ai-hot-summary-date {
  font-size: 0.9rem;
  opacity: 0.8;
}

.ai-hot-summary-overview {
  margin: 0 0 0.8rem;
  line-height: 1.7;
  font-size: 0.97rem;
}

.ai-hot-summary-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  opacity: 0.85;
}

.ai-hot-summary-link {
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  padding: 0.15rem 0;
}

.ai-hot-summary-link:hover {
  background: var(--color-card);
}

/* AI 热点 · 专栏页 */
.ai-hot-section-title {
  margin-top: 1.6rem;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--color-line);
  padding-bottom: 0.3rem;
}

.ai-hot-section-title:first-child {
  margin-top: 0;
}

.ai-hot-day {
  margin-top: 0.6rem;
}

.ai-hot-date {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}

.ai-hot-overview {
  margin: 0.4rem 0 1rem;
  line-height: 1.75;
}

.ai-hot-archive {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.ai-hot-archive-item {
  border: 0;
  padding: 0;
  background: transparent;
}

.ai-hot-archive-item + .ai-hot-archive-item {
  border-top: 1px solid var(--color-line);
  padding-top: 0.75rem;
}

.ai-hot-archive-item > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.97rem;
  padding: 0.2rem 0;
  list-style: none;
}

.ai-hot-archive-item > summary::-webkit-details-marker {
  display: none;
}

.ai-hot-archive-item > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.2s ease;
}

.ai-hot-archive-item[open] > summary::before {
  transform: rotate(90deg);
}

.ai-hot-archive-item[open] {
  padding-bottom: 0;
}

.ai-hot-archive-item > .ai-hot-overview {
  margin: 0.7rem 0 0.8rem;
}

.ai-hot-empty {
  font-size: 0.95rem;
  opacity: 0.8;
  margin: 0.5rem 0;
}

.ai-hot-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 0.8rem 0 1rem;
}

.ai-hot-collect {
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  background: var(--color-button);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.12s ease;
}

.ai-hot-collect:hover:not(:disabled) {
  background: var(--color-fill-strong);
}

.ai-hot-collect:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ai-hot-status {
  font-size: 0.88rem;
  opacity: 0.8;
}

.update-page > p {
  margin-bottom: 1.2rem;
}

.update-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.update-input {
  display: block;
  width: 100%;
  margin-bottom: 0.9rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.15);
  color: var(--color-text);
  font: inherit;
}

.update-status {
  min-height: 1.7em;
  font-size: 0.9rem;
  opacity: 0.82;
}

/* 热点条目卡片（专栏页与归档共用） */
.ai-hot-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin: 0.4rem 0 0;
}

.ai-hot-card-item {
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  padding: 0.85rem 1rem 0.95rem;
  box-shadow: var(--shadow-card);
}

.ai-hot-card-topic {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
}

.ai-hot-card-progress {
  margin: 0 0 0.6rem;
  font-size: 0.93rem;
  line-height: 1.7;
}

.ai-hot-card-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-line);
  font-size: 0.88rem;
}

.ai-hot-card-refs a {
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  padding: 0.1rem 0;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.ai-hot-card-refs a:hover {
  background: var(--color-fill);
}

@media (min-width: 640px) {
  .ai-hot-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .ai-hot-card-item {
    padding: 1rem 1.15rem 1.1rem;
  }

  .ai-hot-archive-item .ai-hot-cards {
    grid-template-columns: 1fr;
  }

  .ai-hot-archive-item .ai-hot-card-item {
    box-shadow: none;
    border-radius: var(--radius);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
