/* 情绪翻译局 · Emotion Translation Bureau
   Aesthetic: night bureau × paper slips × soft absurd dictionary
*/

:root {
  --bg: #16141f;
  --bg-elevated: #1e1b2a;
  --bg-panel: #252235;
  --paper: #f4efe6;
  --paper-dim: #e6dfd2;
  --ink: #16141f;
  --ink-soft: #3a3548;
  --muted: #9a93a8;
  --line: rgba(244, 239, 230, 0.1);
  --line-strong: rgba(244, 239, 230, 0.2);

  --amber: #e0b36a;
  --amber-glow: rgba(224, 179, 106, 0.28);
  --rose: #d9899e;
  --rose-glow: rgba(217, 137, 158, 0.25);
  --blue: #7aa8d4;
  --blue-glow: rgba(122, 168, 212, 0.25);
  --green: #7ab892;
  --green-glow: rgba(122, 184, 146, 0.25);
  --red: #e07a6a;
  --red-glow: rgba(224, 122, 106, 0.25);

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

  --font-display: "Syne", "Noto Serif SC", sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

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

*,
*::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.7;
  color: var(--paper);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  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;
}

.paper-noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(224, 179, 106, 0.12), transparent 50%),
    radial-gradient(ellipse 55% 40% at 90% 5%, rgba(217, 137, 158, 0.08), transparent 45%),
    radial-gradient(ellipse 50% 45% at 50% 100%, rgba(122, 168, 212, 0.08), transparent 50%);
}

/* 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(22, 20, 31, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--paper);
}

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

.brand-text strong {
  font-weight: 600;
  font-size: 0.95rem;
}

.brand-text em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  margin: 0 auto;
  background: var(--paper);
}

/* 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-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s;
  background: transparent;
}

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

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

.btn-primary:hover {
  background: #fff;
  box-shadow: 0 8px 24px rgba(244, 239, 230, 0.12);
}

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

.btn-ghost:hover {
  border-color: var(--muted);
  background: rgba(244, 239, 230, 0.04);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.72rem;
}

/* hero */
.hero {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 5rem) clamp(1rem, 4vw, 2.5rem) 3rem;
}

.hero-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--accent);
}

.meta-dot {
  opacity: 0.5;
}

.hero-title {
  margin: 0 0 1.25rem;
}

.title-en {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.85rem, 2vw, 1rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.title-zh {
  display: block;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.hero-lead {
  max-width: 36em;
  margin: 0 0 1.75rem;
  color: var(--paper-dim);
  font-size: 1.05rem;
  font-weight: 300;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(30, 27, 42, 0.65);
}

.stat-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.stat-label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.ticker {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(224, 179, 106, 0.08), transparent);
}

.ticker-label {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 0.2rem;
}

.ticker p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--paper-dim);
}

/* sections */
.section {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 4vw, 2.5rem) 3.5rem;
}

.section-head {
  margin-bottom: 1.75rem;
}

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

.section-head h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 600;
}

.section-sub {
  margin: 0;
  max-width: 40em;
  color: var(--muted);
  font-size: 0.95rem;
}

/* desk */
.desk-panel {
  padding: 1.5rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.desk-label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.desk-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.desk-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.9rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.desk-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.desk-input::placeholder {
  color: rgba(154, 147, 168, 0.7);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--font-serif);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.chip:hover {
  border-color: var(--muted);
  background: rgba(244, 239, 230, 0.04);
}

.chip.is-active {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--paper);
}

.desk-hint {
  margin: 1rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: 0.2s;
}

.filter-chip:hover {
  color: var(--paper);
  border-color: var(--line-strong);
}

.filter-chip.is-active {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--paper);
}

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

.count-pill {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

/* random spotlight */
.random-spotlight {
  margin-bottom: 1.5rem;
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(224, 179, 106, 0.35);
  background:
    linear-gradient(135deg, rgba(224, 179, 106, 0.12), rgba(217, 137, 158, 0.06)),
    var(--bg-elevated);
  animation: softIn 0.45s var(--ease);
}

.random-spotlight .spot-label {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.random-spotlight .spot-text {
  margin: 0 0 0.85rem;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.55;
}

.random-spotlight .spot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.t-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: softIn 0.4s var(--ease) both;
}

.t-card.is-local {
  background: linear-gradient(180deg, #f7f1e4 0%, #efe6d4 100%);
  border-color: rgba(224, 179, 106, 0.45);
}

.t-card.is-seed {
  background: linear-gradient(180deg, #f3ebe0 0%, #ebe2d4 100%);
}

.t-card-text {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

.t-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  background: rgba(22, 20, 31, 0.06);
  color: var(--ink-soft);
}

.tag-source {
  background: rgba(224, 179, 106, 0.25);
  color: #6b4a16;
}

.t-card-actions {
  display: flex;
  gap: 0.4rem;
  padding-top: 0.15rem;
  border-top: 1px dashed rgba(22, 20, 31, 0.12);
}

.icon-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: rgba(22, 20, 31, 0.05);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
  background: rgba(22, 20, 31, 0.1);
  color: var(--ink);
}

.icon-btn.is-liked {
  background: rgba(217, 137, 158, 0.2);
  color: #8a3d52;
}

.empty-state {
  margin: 2rem 0 0;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

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

.lex-card {
  text-align: left;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s var(--ease), background 0.2s;
}

.lex-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.lex-card.is-active {
  border-color: var(--accent);
  background: linear-gradient(160deg, rgba(224, 179, 106, 0.12), var(--bg-elevated));
  box-shadow: 0 0 0 1px rgba(224, 179, 106, 0.2);
}

.lex-phrase {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.lex-count {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.lex-gloss {
  margin: 0;
  font-size: 0.85rem;
  color: var(--paper-dim);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* contribute */
.contribute-panel {
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  margin-bottom: 2rem;
}

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  margin-bottom: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

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

.form-row select:focus,
.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.form-msg {
  min-height: 1.4em;
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  color: var(--accent);
}

.subhead {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.subhead span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

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

.local-list li {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(30, 27, 42, 0.7);
}

.local-list .local-phrase {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.local-list .local-text {
  margin: 0.3rem 0 0;
  font-size: 0.98rem;
}

.local-list .local-empty {
  color: var(--muted);
  border-style: dashed;
}

/* footer */
.site-footer {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 3.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0 0 0.5rem;
  max-width: 42em;
}

.footer-meta {
  font-size: 0.82rem;
}

.footer-code {
  margin-top: 1rem !important;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 200;
  transform: translateX(-50%);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  box-shadow: var(--shadow);
  animation: softIn 0.3s var(--ease);
}

/* reveal */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: softIn 0.7s var(--ease) forwards;
}

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

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

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

  .nav.is-open {
    display: flex;
  }

  .nav a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-toggle {
    display: flex;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .count-pill {
    margin-left: 0;
  }
}

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

  .reveal,
  .t-card,
  .random-spotlight,
  .toast {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
