
:root {
  --bg: #efe9dc;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #1f2a3a;
  --muted: #5f6877;
  --line: rgba(31, 42, 58, 0.12);
  --shadow: 0 18px 44px rgba(22, 30, 46, 0.12);
  --shadow-soft: 0 10px 24px rgba(22, 30, 46, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--theme-text, var(--text));
  background:
    radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--theme-accent) 22%, transparent), transparent 36%),
    radial-gradient(circle at 92% 10%, color-mix(in srgb, var(--theme-accent) 18%, transparent), transparent 32%),
    linear-gradient(160deg, color-mix(in srgb, var(--theme-bg) 92%, #fff) 0%, #f8fafc 100%);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4, .brand-mark {
  font-family: "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.66);
  border-bottom: 1px solid rgba(255, 255, 255, 0.52);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-mark {
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
}

.site-nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border-radius: 6px;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.82);
  outline: none;
}

.hero {
  padding: 56px 0 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  align-items: start;
  animation: rise-in .45s ease both;
}

.hero-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 10px;
  color: color-mix(in srgb, var(--theme-accent) 70%, #5a5a5a);
  font-weight: 700;
}

.hero-text {
  max-width: 44rem;
  color: var(--muted);
  margin: 0 0 24px;
}

.card {
  position: relative;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

main {
  position: relative;
  z-index: 1;
}

a,
button,
input,
label,
textarea,
[role="button"],
.book-card {
  position: relative;
  z-index: 2;
  touch-action: manipulation;
}

.ask-form {
  padding: 22px;
}

.input-label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
}

.ask-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 100px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  padding: 16px 18px;
  font: inherit;
  outline: none;
}

.ask-form textarea:focus {
  border-color: color-mix(in srgb, var(--theme-accent) 40%, #5d6b7f);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-accent) 14%, transparent);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 0.94rem;
}

.primary-btn,
.ghost-btn,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: transform .15s ease, opacity .15s ease, background-color .15s ease;
}

.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.text-link:focus-visible,
.chip-btn:focus-visible,
.book-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--theme-accent) 60%, #2c3a4c);
  outline-offset: 2px;
}

.primary-btn[disabled],
.ghost-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.primary-btn {
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  background: var(--theme-text);
  color: white;
  font-weight: 700;
}

.primary-btn:hover,
.ghost-btn:hover,
.text-link:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--theme-text);
}

.preset-wrap {
  margin-top: 10px;
}

.preset-title {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form {
  display: inline;
}

.micro-copy,
.permalink,
.today-hint,
.sample-card p,
.book-card p,
.prose p,
.section-head p,
.result-hint,
.today-date,
.char-counter {
  color: var(--muted);
}

.char-counter {
  margin: 8px 2px 0;
  text-align: right;
  font-size: 0.86rem;
}

.char-counter.over {
  color: #b42318;
}

.today-card {
  padding: 24px;
  animation: rise-in .55s ease both;
}

.today-card h2 {
  margin: 12px 0 10px;
  font-size: 1rem;
}

.today-title {
  font-size: 1.6rem;
  line-height: 1.2;
  font-weight: 800;
  margin: 0 0 10px;
}

.book-pill,
.book-badge,
.sample-book {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-accent) 18%, white);
  color: color-mix(in srgb, var(--theme-text) 92%, black);
  font-size: 0.9rem;
  font-weight: 700;
}

.section {
  padding: 28px 0;
}

.section-head {
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.book-grid,
.sample-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.book-card,
.sample-card {
  padding: 22px;
  transition: transform .15s ease, border-color .15s ease;
}

.book-card {
  cursor: pointer;
  outline: none;
}

.book-card.selected {
  transform: translateY(-2px);
  border: 1px solid color-mix(in srgb, var(--theme-accent) 55%, #ffffff);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--theme-accent) 10%, transparent);
}

.book-card h3,
.sample-card h3 {
  margin: 16px 0 10px;
  font-size: 1.15rem;
}

.sample-action,
.result-action {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--theme-accent) 10%, white);
  border: 1px solid color-mix(in srgb, var(--theme-accent) 18%, white);
  font-weight: 600;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 28%, white);
  background: color-mix(in srgb, var(--theme-accent) 12%, white);
  font-size: 0.82rem;
  color: var(--theme-text);
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 340px;
  gap: 22px;
  align-items: start;
}

.result-card,
.side-card,
.prose {
  padding: 26px;
}

.result-card h1,
.prose h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.result-hint {
  margin: 0;
  font-size: 1.08rem;
}

.book-filter {
  margin: 10px 0 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  min-height: 36px;
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
}

.chip-btn.active {
  border-color: color-mix(in srgb, var(--theme-accent) 55%, #ffffff);
  background: color-mix(in srgb, var(--theme-accent) 18%, white);
  font-weight: 700;
}

.result-actions,
.share-buttons {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.related-list {
  display: grid;
  gap: 10px;
}

.related-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.related-item h4 {
  margin: 0;
  font-size: 1rem;
}

.related-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.history-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  transition: transform .15s ease, border-color .15s ease;
}

.history-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--theme-accent) 35%, #ffffff);
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.history-head time {
  color: var(--muted);
  font-size: 0.86rem;
}

.history-item h2 {
  margin: 0;
  font-size: 1.12rem;
}

.history-item p {
  margin: 0;
}

.history-question {
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--theme-accent) 25%, white);
  font-size: 0.92rem;
}

.quick-books {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.favorites-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.favorites-list {
  display: grid;
  gap: 12px;
}

.favorite-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.favorite-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.favorite-item-title {
  margin: 0;
  font-size: 1.08rem;
}

.favorite-item-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.favorite-item .share-buttons {
  margin-top: 4px;
}

.question-preset {
  font-size: 0.86rem;
}

.question-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px dashed color-mix(in srgb, var(--theme-accent) 24%, white);
}

.question-label {
  font-weight: 700;
  margin-bottom: 6px;
}

.muted-card {
  background: rgba(255, 255, 255, 0.62);
}

.narrow {
  width: min(760px, calc(100% - 32px));
}

.site-footer {
  padding: 28px 0 44px;
}

.footer-inner {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 8px;
  color: var(--muted);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-records {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.footer-record {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.footer-record a:hover {
  text-decoration: underline;
}

.prose h2 {
  margin-top: 28px;
  font-size: 1.2rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.95);
  color: white;
  padding: 12px 16px;
  border-radius: 999px;
  transition: .2s ease;
  z-index: 50;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .hero-grid,
  .result-layout,
  .book-grid,
  .sample-grid {
    grid-template-columns: 1fr;
  }

  .site-nav {
    gap: 10px;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100%, calc(100% - 20px));
  }

  .hero {
    padding-top: 36px;
  }

  .header-inner {
    min-height: 64px;
  }

  .site-nav {
    font-size: 0.9rem;
    row-gap: 6px;
  }

  .result-card,
  .side-card,
  .prose,
  .ask-form,
  .book-card,
  .sample-card,
  .today-card {
    padding: 20px;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }
}
