/* 人类备用台词库 · late-night library · soft ink paper */

:root {
  --bg: #141210;
  --bg-elevated: #1c1916;
  --bg-panel: #24201c;
  --paper: #f2ebe0;
  --paper-dim: #d9d0c2;
  --ink: #1a1612;
  --muted: #8a8175;
  --line: rgba(242, 235, 224, 0.1);
  --line-strong: rgba(242, 235, 224, 0.18);

  --rose: #c97b84;
  --rose-soft: rgba(201, 123, 132, 0.16);
  --amber: #c9a06a;
  --amber-soft: rgba(201, 160, 106, 0.16);
  --slate: #8a9aab;
  --slate-soft: rgba(138, 154, 171, 0.16);
  --moss: #7d9a7a;
  --moss-soft: rgba(125, 154, 122, 0.16);
  --ink-hue: #a89b8c;
  --ink-soft: rgba(168, 155, 140, 0.16);

  --accent: var(--amber);
  --accent-soft: var(--amber-soft);

  --font-display: "Cormorant Garamond", "Noto Serif SC", serif;
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.75;
  color: var(--paper);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}

.ambient {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(201, 123, 132, 0.1), transparent 50%),
    radial-gradient(ellipse 55% 40% at 90% 5%, rgba(201, 160, 106, 0.08), transparent 45%),
    radial-gradient(ellipse 50% 45% at 50% 100%, rgba(138, 154, 171, 0.06), transparent 50%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: rgba(20, 18, 16, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--amber);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-text strong {
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.brand-text em {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.88rem;
}

.nav a {
  color: var(--paper-dim);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.nav a:hover {
  color: var(--paper);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn-icon:hover {
  border-color: var(--line-strong);
  background: var(--bg-panel);
}

.pocket-count {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--rose);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}

.pocket-count:empty,
.pocket-count[data-zero="1"] {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 0 10px;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--paper);
  border-radius: 1px;
}

/* main layout */
main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem;
}

/* hero */
.hero {
  padding: clamp(3rem, 10vw, 6rem) 0 clamp(3rem, 8vw, 5rem);
  text-align: center;
}

.hero-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--amber);
}

.dot {
  opacity: 0.5;
}

.hero-title {
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.title-en {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.title-zh {
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 0.08em;
  line-height: 1.25;
}

.hero-lead {
  max-width: 34em;
  margin: 0 auto 2rem;
  color: var(--paper-dim);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  font-weight: 300;
}

.hero-lead strong {
  color: var(--paper);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.hero-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2.5rem;
  margin: 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
}

.hero-stats li {
  text-align: center;
}

.hero-stats em {
  display: block;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--paper);
  line-height: 1.2;
}

.hero-stats span {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s, color 0.2s, transform 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.btn-primary:hover {
  background: #fff8ee;
}

.btn-ghost {
  background: transparent;
  color: var(--paper-dim);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  color: var(--paper);
  border-color: var(--paper-dim);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}

.btn.active,
.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--paper);
}

/* sections */
.section {
  padding: clamp(2.5rem, 6vw, 4rem) 0;
}

.section-head {
  margin-bottom: 1.75rem;
  max-width: 36em;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--amber);
}

.section-head h2 {
  margin: 0 0 0.5rem;
  font-weight: 500;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  letter-spacing: 0.04em;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 300;
}

/* scene grid */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.scene-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.35rem 1.25rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), background 0.25s;
  overflow: hidden;
}

.scene-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--card-hue, var(--amber));
  opacity: 0.85;
}

.scene-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  background: var(--bg-panel);
}

.scene-card[data-hue="rose"] { --card-hue: var(--rose); }
.scene-card[data-hue="amber"] { --card-hue: var(--amber); }
.scene-card[data-hue="slate"] { --card-hue: var(--slate); }
.scene-card[data-hue="moss"] { --card-hue: var(--moss); }
.scene-card[data-hue="ink"] { --card-hue: var(--ink-hue); }

.scene-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.scene-name {
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.scene-en {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--muted);
}

.scene-tagline {
  margin: 0;
  color: var(--paper-dim);
  font-size: 0.92rem;
  font-weight: 300;
}

.scene-meta {
  margin-top: auto;
  padding-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* vault toolbar */
.vault-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scene-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.scene-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--font-serif);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.scene-tab:hover {
  border-color: var(--line-strong);
  color: var(--paper);
}

.scene-tab[aria-selected="true"] {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-wrap input {
  width: min(200px, 40vw);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-wrap input:focus {
  border-color: var(--amber);
}

/* line cards */
.line-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.line-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}

.line-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-panel);
}

.line-card[data-hue="rose"] { border-left: 3px solid var(--rose); }
.line-card[data-hue="amber"] { border-left: 3px solid var(--amber); }
.line-card[data-hue="slate"] { border-left: 3px solid var(--slate); }
.line-card[data-hue="moss"] { border-left: 3px solid var(--moss); }
.line-card[data-hue="ink"] { border-left: 3px solid var(--ink-hue); }

.line-body {
  min-width: 0;
}

.line-scene-label {
  margin: 0 0 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.line-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.85;
  letter-spacing: 0.02em;
}

.line-note {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 300;
}

.line-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: stretch;
  justify-content: center;
}

.line-actions .btn {
  white-space: nowrap;
  min-width: 5.5rem;
}

.line-actions .btn.collected {
  background: var(--rose-soft);
  border-color: var(--rose);
  color: var(--paper);
}

.empty-hint {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

/* daily */
.daily-section {
  padding-top: 1rem;
}

.daily-card {
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background:
    linear-gradient(145deg, rgba(201, 160, 106, 0.08), transparent 50%),
    var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.daily-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.daily-date {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.daily-scene {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--amber);
  letter-spacing: 0.08em;
}

.daily-text {
  margin: 0 0 1.5rem;
  padding: 0;
  border: none;
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  font-weight: 400;
  line-height: 1.9;
  letter-spacing: 0.03em;
}

.daily-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* pocket */
.pocket-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

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

.pocket-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--paper-dim);
}

.pocket-empty .muted {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.pocket-empty[hidden],
.pocket-list:not([hidden]) + .pocket-empty {
  display: none;
}

/* deposit form */
.deposit-form {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row label {
  font-size: 0.85rem;
  color: var(--paper-dim);
}

.label-hint {
  color: var(--muted);
  font-size: 0.78rem;
  margin-left: 0.35rem;
}

.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}

.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--amber);
}

.form-row select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%238a8175' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2rem;
}

.char-count {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.form-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

.form-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 300;
}

.private-drawer {
  margin-top: 2rem;
}

.private-drawer h3 {
  margin: 0 0 1rem;
  font-weight: 500;
  font-size: 1.05rem;
}

.private-drawer .muted {
  color: var(--muted);
  font-weight: 300;
  font-size: 0.85rem;
}

/* about */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.about-grid p {
  color: var(--paper-dim);
  font-weight: 300;
}

.about-grid strong {
  color: var(--paper);
  font-weight: 500;
}

.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rules li {
  display: flex;
  gap: 0.85rem;
  align-items: baseline;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--paper-dim);
}

.rules span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber);
  flex-shrink: 0;
}

/* footer */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--paper-dim);
}

.footer-note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 10000;
  padding: 0.65rem 1.25rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.35s var(--ease);
}

.toast[hidden] {
  display: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

.reveal.delay-1 { transition-delay: 0.08s; }
.reveal.delay-2 { transition-delay: 0.16s; }
.reveal.delay-3 { transition-delay: 0.24s; }
.reveal.delay-4 { transition-delay: 0.32s; }

/* responsive */
@media (max-width: 820px) {
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
    background: rgba(20, 18, 16, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--line);
  }

  .nav-toggle {
    display: flex;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .line-card {
    grid-template-columns: 1fr;
  }

  .line-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .brand-text em {
    display: none;
  }

  .vault-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-right {
    justify-content: space-between;
  }

  .search-wrap input {
    width: 100%;
    flex: 1;
  }
}

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .scene-card:hover {
    transform: none;
  }
}
