:root {
  --bg: #f4efe6;
  --paper: #fffdf8;
  --ink: #1e1a16;
  --muted: #6f675e;
  --line: #e4d9c8;
  --accent: #8d3b2f;
  --accent-soft: #f3e4df;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
}

body {
  -webkit-user-select: none;
  user-select: none;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  background: rgba(244, 239, 230, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 700 22px/1 "Songti SC", serif;
  cursor: pointer;
  padding: 0;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.crumb button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

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

.who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.who[hidden] { display: none; }

.who button, .gate button {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.who button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.gate {
  max-width: 420px;
  margin: 36px auto 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px 24px;
}

.gate h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 650;
}

.gate label {
  display: block;
  margin: 18px 0 8px;
}

.gate input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: 18px/1.4 inherit;
  -webkit-user-select: text;
  user-select: text;
}

.gate .err {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 14px;
}

.gate button { margin-top: 8px; }

main {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.choice, .row {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--paper);
  color: inherit;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
}

.choice { padding: 18px 16px; }
.choice strong { display: block; font-size: 20px; font-weight: 650; }
.choice span, .row span { color: var(--muted); font-size: 13px; }

.list { display: flex; flex-direction: column; gap: 8px; }

.row {
  padding: 12px 14px;
}

.row b {
  display: block;
  font-weight: 650;
  margin-bottom: 4px;
}

.reader {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 22px 18px;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.body {
  margin: 0;
  white-space: pre-wrap;
  font-size: 18px;
  line-height: 1.85;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.actions button, .back {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.actions .copy {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}

@media print {
  body { display: none; }
}
