/* estudio256 — round 1 skeleton. Typography pass comes later. */

:root {
  --ink: #141210;
  --paper: #f6f1e7;
  --paper-deep: #ede4d2;
  --accent: #7a1e1e;
  --muted: #6b625a;
  --rule: #c9bfad;
  --measure: 36rem;
  --serif: 'EB Garamond', 'Hoefler Text', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.site-header .brand {
  font-weight: 600;
  color: var(--ink);
}
.site-header nav a {
  margin-left: 1.5rem;
  color: var(--ink);
}

main { min-height: calc(100vh - 8rem); }

.site-footer {
  padding: 2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  color: var(--muted);
  text-align: center;
}

/* hero */

.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(122, 30, 30, 0.06), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(20, 18, 16, 0.04), transparent 55%),
    var(--paper);
}

.hero-inner {
  max-width: var(--measure);
  text-align: center;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.book-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.05;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.book-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

.hero-lede {
  font-size: 1.1rem;
  margin: 0 auto 2.5rem;
  max-width: 32rem;
}

.cta {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 2px;
}
.cta:hover { background: var(--accent); text-decoration: none; }

/* toc */

.toc {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}
.toc-header { text-align: center; margin-bottom: 3rem; }
.toc-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  margin: 0.3rem 0 1rem;
}
.toc-note {
  color: var(--muted);
  font-style: italic;
}
.toc-book { margin: 0 0 3.5rem; }
.toc-book:last-child { margin-bottom: 0; }
.toc-book-header {
  text-align: center;
  margin: 0 0 1.25rem;
  padding: 1.75rem 0 0.5rem;
  border-top: 2px solid var(--rule);
}
.toc-book:first-of-type .toc-book-header {
  border-top: none;
  padding-top: 0.5rem;
}
.toc-book-label {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}
.toc-book-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.4rem;
  margin: 0;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-list li { border-top: 1px solid var(--rule); }
.toc-list li:last-child { border-bottom: 1px solid var(--rule); }
.toc-list a {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 1.25rem;
  padding: 1.1rem 0.25rem;
  align-items: baseline;
  color: var(--ink);
}
.toc-list a:hover { background: var(--paper-deep); text-decoration: none; }
.toc-num {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.toc-title {
  font-family: var(--serif);
  font-size: 1.3rem;
}
.toc-meta {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* chapter */

.chapter-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  z-index: 50;
}
.chapter-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.08s linear;
}

.chapter {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5rem 1.5rem 6rem;
}

.chapter-header {
  text-align: center;
  margin-bottom: 3rem;
}
.chapter-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.005em;
  line-height: 1.15;
  margin: 0.4rem 0 0;
}

.chapter-player {
  max-width: 480px;
  margin: 0 auto 2.5rem;
  text-align: center;
}
.chapter-player-info {
  margin-bottom: 0.6rem;
}
.chapter-player-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
}
.chapter-player-genre {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.chapter-player audio {
  width: 100%;
  max-width: 400px;
  height: 36px;
}
.chapter-player-variants {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.chapter-player-pick {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.chapter-player-pick:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.chapter-player-pick.is-active {
  color: var(--ink);
  border-color: var(--ink);
  font-weight: 500;
}

.chapter-body .para {
  margin: 0 0 1.1em;
  text-indent: 1.5em;
  font-size: 1.12rem;
  line-height: 1.62;
  hyphens: auto;
}
.chapter-body .para.first {
  text-indent: 0;
}
.chapter-body .para.first::first-letter {
  font-family: var(--serif);
  font-weight: 500;
  float: left;
  font-size: 3.6em;
  line-height: 0.88;
  padding: 0.1em 0.1em 0 0;
  color: var(--accent);
}
.chapter-body .para em {
  font-style: italic;
}
.chapter-body .para strong { font-weight: 600; }

.chapter-body .scene-break {
  display: block;
  width: 3rem;
  margin: 1.6em auto 1.9em;
  border: 0;
  text-align: center;
  color: var(--accent);
  opacity: 0.55;
}
.chapter-body .scene-break::before {
  content: '❋';
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: 0.6em;
  padding-left: 0.6em;
}

.para-wrap {
  position: relative;
}
.para-wrap::before {
  content: '';
  position: absolute;
  top: 0.35em;
  left: -0.9rem;
  width: 2px;
  height: 1.3em;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.para-wrap:hover::before { opacity: 0.35; }
.para-wrap.has-activity::before { opacity: 0.9; }

.chapter-hint {
  max-width: var(--measure);
  margin: -1.5rem auto 2rem;
  padding: 0.6rem 0.8rem 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  background: var(--paper-deep);
}
.chapter-hint-close {
  background: none;
  border: 0;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 0.2rem;
  color: var(--muted);
  cursor: pointer;
}
.chapter-hint-close:hover { color: var(--ink); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.15rem 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.chip:hover {
  background: var(--paper-deep);
  border-color: var(--rule);
}
.chip.has {
  background: var(--paper-deep);
  border-color: var(--rule);
}
.chip.mine {
  background: rgba(122, 30, 30, 0.1);
  border-color: var(--accent);
  color: var(--ink);
}
.chip-emoji {
  font-size: 1rem;
  filter: grayscale(0.15);
}
.chip-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 0.5em;
}
.chip.mine .chip-count { color: var(--ink); }
.chip.chip-error { background: rgba(122, 30, 30, 0.2); }
.chip-comment .chip-emoji { font-size: 0.9rem; }
.chip-comment.has { background: var(--paper-deep); border-color: var(--rule); }

.drawer-reactions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.2rem 0 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.drawer-reactions .chip {
  font-size: 0.95rem;
  padding: 0.35rem 0.7rem;
}
.drawer-reactions .chip-emoji { font-size: 1.1rem; }

.selection-quote-btn {
  position: absolute;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 18, 16, 0.25);
}
.selection-quote-btn:hover { background: var(--accent); }
.selection-quote-icon {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 0.8;
  color: var(--paper);
}

.drawer-pending-quote {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: var(--paper-deep);
  border-left: 2px solid var(--accent);
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink);
}
.drawer-pending-quote-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}
.drawer-pending-quote-text {
  flex: 1 1 auto;
  font-family: var(--serif);
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.drawer-pending-quote-clear {
  background: none;
  border: 0;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.2rem;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.drawer-pending-quote-clear:hover { color: var(--ink); }

.drawer-comment-quote {
  margin: 0.35rem 0 0.35rem 0;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid var(--rule);
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
}

/* comments drawer */

body.drawer-open { overflow: hidden; }

.comments-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  visibility: hidden;
}
.comments-drawer[aria-hidden="false"] {
  visibility: visible;
  pointer-events: auto;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0);
  transition: background 0.2s ease;
}
.comments-drawer[aria-hidden="false"] .drawer-backdrop {
  background: rgba(20, 18, 16, 0.35);
}
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(28rem, 100%);
  background: var(--paper);
  border-left: 1px solid var(--rule);
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}
.comments-drawer[aria-hidden="false"] .drawer-panel {
  transform: translateX(0);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}
.drawer-close {
  background: none;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 0.2rem;
}
.drawer-close:hover { color: var(--ink); }

.drawer-para {
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper-deep);
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--accent);
  margin: 0;
  max-height: 9rem;
  overflow-y: auto;
}
.drawer-para em { font-style: italic; }

.drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.drawer-comment {
  font-family: var(--sans);
  font-size: 0.92rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.drawer-comment header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}
.c-author { font-weight: 600; color: var(--ink); }
.c-author.account { color: var(--accent); }
.drawer-comment time {
  font-size: 0.72rem;
  color: var(--muted);
}
.drawer-comment p {
  margin: 0;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
}

.c-status {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  background: var(--rule);
  color: var(--muted);
  vertical-align: 0.1em;
}
.c-status-resolved      { background: #d6ead7; color: #23632a; }
.c-status-under_review  { background: #fbe7c2; color: #7a5400; }
.c-status-not_relevant  { background: #e6e3df; color: #7a7069; }

.drawer-comment.is-resolved .drawer-comment-body {
  text-decoration: line-through;
  text-decoration-color: rgba(0, 0, 0, 0.35);
  color: var(--muted);
}
.drawer-comment.is-dismissed,
.drawer-comment.is-hidden {
  opacity: 0.55;
}
.drawer-comment.is-hidden::before {
  content: 'hidden';
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 0.4rem;
}
.drawer-comment.is-reply {
  margin-left: 1.2rem;
  border-left: 2px solid var(--rule);
  padding-left: 0.8rem;
  border-bottom: none;
}
.drawer-comment.is-claudia .c-author { color: #5a4a8a; }

.drawer-comment-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.drawer-comment-actions button {
  font-family: var(--sans);
  font-size: 0.7rem;
  padding: 0.18rem 0.5rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
}
.drawer-comment-actions button:hover { color: var(--ink); border-color: var(--ink); }
.drawer-comment-actions button.danger:hover { color: #b03030; border-color: #b03030; }

.drawer-comment.is-busy { opacity: 0.4; pointer-events: none; }
.drawer-comment.is-error { border-color: #b03030 !important; }

.admin-panel-toggle {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 60;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  background: var(--ink);
  color: var(--paper, #fff);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}
.admin-panel-toggle:hover { filter: brightness(1.1); }
.admin-panel-toggle-count {
  display: inline-block;
  background: rgba(255, 255, 255, 0.22);
  padding: 0.04rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
}
body.drawer-open .admin-panel-toggle { display: none; }

.admin-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 90vw);
  background: var(--paper, #fbfaf7);
  border-left: 1px solid var(--rule);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  z-index: 55;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-panel[aria-hidden="false"] { transform: translateX(0); }
.admin-panel-head {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-panel-eyebrow {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.admin-panel-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--muted);
  cursor: pointer;
}
.admin-panel-close:hover { color: var(--ink); }
.admin-panel-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.78rem;
}
.admin-panel-filters label { cursor: pointer; }
.admin-panel-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem 1.2rem;
  overflow-y: auto;
  flex: 1;
}
.admin-panel-row {
  font-family: var(--sans);
  font-size: 0.85rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
.admin-panel-row header {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}
.admin-panel-row time {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--muted);
}
.admin-panel-snippet {
  margin: 0;
  line-height: 1.45;
  color: var(--ink);
}
.admin-panel-row.is-resolved .admin-panel-snippet {
  text-decoration: line-through;
  text-decoration-color: rgba(0, 0, 0, 0.3);
  color: var(--muted);
}
.admin-panel-row.is-dismissed,
.admin-panel-row.is-hidden { opacity: 0.6; }
.admin-panel-row.is-reply { padding-left: 1rem; border-left: 2px solid var(--rule); }
.admin-panel-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.admin-panel-actions button {
  font-family: var(--sans);
  font-size: 0.68rem;
  padding: 0.16rem 0.5rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
}
.admin-panel-actions button:hover { color: var(--ink); border-color: var(--ink); }
.admin-panel-actions button.danger:hover { color: #b03030; border-color: #b03030; }
.admin-panel-empty {
  color: var(--muted);
  font-style: italic;
  font-family: var(--sans);
  font-size: 0.82rem;
  padding: 0.8rem 0;
}
.drawer-empty, .drawer-loading {
  color: var(--muted);
  font-style: italic;
  font-family: var(--sans);
  font-size: 0.88rem;
}

.drawer-form {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
}
.drawer-form label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.drawer-form input, .drawer-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-family: var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 2px;
  resize: vertical;
}
.drawer-form textarea { min-height: 4.5rem; }
.drawer-form input:focus,
.drawer-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.drawer-whoami { margin: 0; color: var(--muted); }
.drawer-whoami strong { color: var(--ink); }
.drawer-locked { margin: 0; color: var(--muted); font-style: italic; }
.drawer-form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}
.drawer-err { color: var(--accent); font-size: 0.8rem; }
.drawer-form button[type="submit"] {
  padding: 0.5rem 1.2rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.drawer-form button[type="submit"]:hover:not([disabled]) { background: var(--accent); }
.drawer-form button[type="submit"][disabled] { opacity: 0.5; cursor: wait; }

.chapter-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.chapter-nav > * { min-width: 0; }
.chapter-nav a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chapter-nav .nav-prev { text-align: left; }
.chapter-nav .nav-toc {
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  white-space: nowrap;
}
.chapter-nav .nav-next { text-align: right; }

@media (max-width: 560px) {
  .chapter-nav {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    text-align: center;
  }
  .chapter-nav .nav-prev,
  .chapter-nav .nav-next { text-align: center; }
}

/* auth */
.auth {
  max-width: 24rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}
.auth h1 { font-size: 2rem; font-weight: 500; margin: 0 0 0.5rem; }
.auth-lede { color: var(--muted); margin: 0 0 2rem; }
.auth-error {
  background: rgba(122, 30, 30, 0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.6rem 0.8rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}
.auth-form label {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-form input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-family: var(--sans);
  border: 1px solid var(--rule);
  background: #fff;
  border-radius: 2px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-form button {
  padding: 0.7rem 1.4rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.auth-form button:hover { background: var(--accent); }
.auth-alt { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin-top: 1.5rem; }

.site-header .who {
  margin-left: 1.5rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.site-header .inline-form { display: inline; margin-left: 0.8rem; }
.site-header .linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.site-header .linkish:hover { text-decoration: underline; }

/* admin */
.admin {
  max-width: 60rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  font-family: var(--sans);
}
.admin-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  margin: 0;
}
.admin-lede { color: var(--muted); margin: 0.4rem 0 2rem; }

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.card {
  border: 1px solid var(--rule);
  padding: 1.1rem 1.2rem;
  background: #fff;
  border-radius: 2px;
}
.card-num {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}
.card-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.4rem;
}

.admin-section { margin-top: 2.5rem; }
.admin-section h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
.admin-empty { color: var(--muted); font-style: italic; }
.admin-form { display: flex; align-items: center; gap: 1rem; }
.admin-form .switch { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.admin-form button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--rule);
  background: #fff;
  border-radius: 2px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.admin-form button:hover { background: var(--paper-deep); }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-table th,
.admin-table td {
  padding: 0.55rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}
.admin-table th {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table td.when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-table tr.anon td.label { color: var(--muted); }

.admin-meta { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.8rem; }
.admin-pdf-actions { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.admin-link {
  font-size: 0.88rem;
  color: var(--accent);
  border-bottom: 1px solid transparent;
}
.admin-link:hover { border-bottom-color: var(--accent); text-decoration: none; }
.admin-hint { color: var(--muted); font-size: 0.8rem; }
.admin-form button[disabled] { opacity: 0.5; cursor: wait; }

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  border-bottom: 1px solid var(--rule);
  margin: 1.5rem 0 0;
}
.admin-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--ink); }
.admin-tab.is-active {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--rule);
  border-bottom-color: var(--paper);
}
.admin-tab-link { text-decoration: none; display: inline-block; }
.admin-tabpanel { display: none; }
.admin-tabpanel.is-active { display: block; }

.admin-comments-filter {
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin: 1rem 0;
}
.admin-comments-filter label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--muted); }
.admin-comments-filter select { padding: 0.3rem 0.4rem; font: inherit; }

.admin-comments-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.admin-comment {
  border: 1px solid var(--rule);
  padding: 0.8rem 1rem 0.6rem;
  background: var(--paper);
}
.admin-comment.is-hidden { opacity: 0.55; background: var(--paper-deep, #f3efe6); }
.admin-comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; font-size: 0.8rem; }
.admin-comment-status {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--rule);
}
.admin-comment-status.status-new { border-color: var(--accent); color: var(--accent); }
.admin-comment-status.status-resolved { opacity: 0.6; }
.admin-comment-status.status-not_relevant { opacity: 0.4; text-decoration: line-through; }
.admin-comment-hidden { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.admin-comment-meta { color: var(--muted); font-size: 0.8rem; }
.admin-comment-para {
  margin: 0.5rem 0;
  padding: 0.3rem 0.7rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
}
.admin-comment-para-missing {
  margin: 0.5rem 0;
  padding: 0.3rem 0.7rem;
  border-left: 2px solid #a33;
  color: #a33;
  font-size: 0.85rem;
}
.admin-comment-context {
  margin: 0.5rem 0;
  font-size: 0.88rem;
}
.admin-comment-context > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  justify-content: space-between;
}
.admin-comment-context > summary::-webkit-details-marker { display: none; }
.admin-comment-context > summary::before {
  content: "▸ ";
  color: var(--muted);
}
.admin-comment-context[open] > summary::before { content: "▾ "; }
.admin-comment-context-summary {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-comment-context-jump {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
}
.admin-comment-context-jump:hover { text-decoration: underline; }
.admin-comment-context-body {
  margin-top: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-left: 2px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.admin-comment-context-para {
  margin: 0;
  white-space: pre-wrap;
}
.admin-comment-context-para.is-context {
  color: var(--muted);
  font-size: 0.85rem;
}
.admin-comment-context-para.is-target {
  color: inherit;
  background: rgba(255, 220, 130, 0.25);
  padding: 0.3rem 0.5rem;
  border-radius: 2px;
}
.admin-comment-quote { font-size: 0.85rem; color: var(--muted); margin: 0.3rem 0; }
.admin-comment-body { margin: 0.5rem 0; white-space: pre-wrap; }
.admin-comment-replies {
  margin: 0.5rem 0 0.5rem 1rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.admin-comment-reply { font-size: 0.9rem; }
.admin-comment-reply.is-hidden { opacity: 0.5; }
.admin-comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.admin-comment-actions .linkish { background: none; border: none; padding: 0; cursor: pointer; color: var(--accent); font: inherit; }
.admin-comment-actions .linkish:hover { text-decoration: underline; }
.admin-comment-actions .linkish.danger { color: #a33; }
.admin-comment-reply-form { margin-top: 0.6rem; font-size: 0.85rem; }
.admin-comment-reply-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 0.4rem 0;
  padding: 0.4rem;
  font: inherit;
}

.admin-countries { flex-direction: column; align-items: stretch; gap: 0.8rem; }
.admin-country-group {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.8rem 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
}
.admin-country-group legend { padding: 0 0.3rem; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.admin-country {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  min-width: 11rem;
}

/* profile hub */
.me { max-width: var(--measure); margin: 2rem auto; padding: 0 1rem; }
.me-header { margin-bottom: 1.5rem; }
.me-header h1 { font-size: 2rem; margin: 0 0 0.3rem; }
.me-lede { color: var(--muted); font-size: 0.9rem; margin: 0; }
.me-section { margin-top: 2rem; }
.me-section h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.4rem;
}
.me-empty { color: var(--muted); }
.me-hint { color: var(--muted); font-size: 0.85rem; }
.me-comments-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.me-comment {
  border: 1px solid var(--rule);
  padding: 0.8rem 1rem;
  background: var(--paper);
}
.me-comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; font-size: 0.85rem; }
.me-comment-status {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--rule);
}
.me-comment-status.status-resolved { opacity: 0.6; }
.me-comment-status.status-not_relevant { opacity: 0.5; text-decoration: line-through; }
.me-comment-meta { color: var(--muted); font-size: 0.8rem; }
.me-comment-para {
  margin: 0.5rem 0;
  padding: 0.3rem 0.7rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
}
.me-comment-quote { font-size: 0.85rem; color: var(--muted); margin: 0.3rem 0; }
.me-comment-body { margin: 0.5rem 0; white-space: pre-wrap; }
.me-comment-replies {
  margin-top: 0.8rem;
  padding-left: 0.8rem;
  border-left: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.me-comment-replies-label { margin: 0; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.me-comment-reply { font-size: 0.92rem; }
.me-comment-reply-body { margin-top: 0.2rem; white-space: pre-wrap; }
.me-badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  margin-left: 0.2rem;
}

/* error */
.error {
  padding: 6rem 2rem;
  text-align: center;
  max-width: var(--measure);
  margin: 0 auto;
}
.error h1 {
  font-size: 5rem;
  margin: 0 0 1rem;
  color: var(--accent);
}

/* toc footer link */
.toc-foot {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px dashed var(--rule);
  text-align: center;
}
.toc-guide-link {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
}
.toc-guide-link:hover {
  background: var(--paper-deep);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.toc-foot-note {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  margin: 0.8rem 0 0;
}

/* doc (guide) */
.doc {
  max-width: 42rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
  font-size: 1rem;
  line-height: 1.6;
}
.doc h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0 0 1.5rem;
}
.doc h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}
.doc h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 1.6rem 0 0.5rem;
  color: var(--ink);
}
.doc p { margin: 0 0 1em; }
.doc ul, .doc ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.doc li { margin: 0 0 0.4em; }
.doc hr { border: 0; border-top: 1px solid var(--rule); margin: 2.2rem 0; }
.doc strong { font-weight: 600; }
.doc em { font-style: italic; }
.doc code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.88em;
  background: var(--paper-deep);
  padding: 0.12em 0.35em;
  border-radius: 3px;
}
.doc a { color: var(--accent); border-bottom: 1px solid transparent; }
.doc a:hover { border-bottom-color: var(--accent); text-decoration: none; }
.doc-foot {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.88rem;
}
