:root {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Newsreader", Georgia, "Times New Roman", serif;

  --bg: #f4ede1;
  --bg-deep: #ebe1d0;
  --surface: #fffaf1;
  --surface-2: #f8f0e3;
  --ink: #2b2018;
  --ink-soft: #5a4a3c;
  --muted: #8b7a68;
  --line: #e6dac6;
  --line-strong: #d3c3aa;
  --accent: #7d2f27;
  --accent-hover: #67241e;
  --accent-ink: #fff8ee;
  --accent-soft: #f4e2d9;
  --brass: #a17a3a;
  --brass-soft: #f1e5cc;
  --sage: #5d6b4f;
  --sage-soft: #e3e8d8;
  --danger: #9b2c2c;
  --cover-a: #6e2a23;
  --cover-b: #3f1915;
  --overlay: rgba(43, 32, 24, 0.45);
  --hero-tint: transparent;

  --radius-lg: 22px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(70, 45, 20, 0.06);
  --shadow: 0 1px 2px rgba(70, 45, 20, 0.05), 0 12px 32px -16px rgba(70, 45, 20, 0.28);
  --shadow-lg: 0 2px 6px rgba(70, 45, 20, 0.08), 0 30px 60px -24px rgba(70, 45, 20, 0.45);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1511;
    --bg-deep: #15100d;
    --surface: #251d17;
    --surface-2: #2d241d;
    --ink: #f2e8da;
    --ink-soft: #d2c3b0;
    --muted: #9d8c79;
    --line: #3a2f26;
    --line-strong: #4b3e32;
    --accent: #d98c78;
    --accent-hover: #e6a08d;
    --accent-ink: #1b1511;
    --accent-soft: #3b2621;
    --brass: #d4ac66;
    --brass-soft: #3a2f1f;
    --sage: #a9b893;
    --sage-soft: #2c3226;
    --danger: #e58a82;
    --cover-a: #5c231d;
    --cover-b: #2a0f0c;
    --overlay: rgba(8, 5, 3, 0.6);
    --hero-tint: transparent;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 30px 60px -24px rgba(0, 0, 0, 0.75);
    color-scheme: dark;
  }
}

:root[data-theme="matcha"] {
  --bg: #f7efec;
  --bg-deep: #efe0dc;
  --surface: #fffafa;
  --surface-2: #fbf1f0;
  --ink: #2c2a26;
  --ink-soft: #4f5a4c;
  --muted: #666d61;
  --line: #f0dcd9;
  --line-strong: #dfc4c0;
  --accent: #a8426a;
  --accent-hover: #8e3457;
  --accent-ink: #fffafa;
  --accent-soft: #f8e1e9;
  --brass: #4f6e36;
  --brass-soft: #e4edd9;
  --sage: #4f6e36;
  --sage-soft: #e4edd9;
  --danger: #a3333d;
  --cover-a: #c97a96;
  --cover-b: #7e3654;
  --overlay: rgba(44, 42, 38, 0.4);
  --hero-tint: rgba(236, 160, 185, 0.22);
  --shadow-sm: 0 1px 2px rgba(120, 60, 80, 0.07);
  --shadow: 0 1px 2px rgba(120, 60, 80, 0.06), 0 12px 32px -16px rgba(120, 60, 80, 0.26);
  --shadow-lg: 0 2px 6px rgba(120, 60, 80, 0.08), 0 30px 60px -24px rgba(120, 60, 80, 0.4);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="matcha"] {
    --bg: #191d1a;
    --bg-deep: #141714;
    --surface: #222823;
    --surface-2: #2a312b;
    --ink: #eef1e8;
    --ink-soft: #c8d0c0;
    --muted: #929d8b;
    --line: #333d34;
    --line-strong: #435044;
    --accent: #f0a3bd;
    --accent-hover: #f6bccf;
    --accent-ink: #191d1a;
    --accent-soft: #3e2a32;
    --brass: #a8c98b;
    --brass-soft: #2d3826;
    --sage: #a8c98b;
    --sage-soft: #2d3826;
    --danger: #f08a92;
    --cover-a: #9a4d69;
    --cover-b: #4d2234;
    --overlay: rgba(5, 8, 5, 0.6);
    --hero-tint: rgba(240, 163, 189, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 30px 60px -24px rgba(0, 0, 0, 0.75);
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--surface) 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

.hero {
  position: relative;
  height: clamp(260px, 52vh, 520px);
  overflow: hidden;
  transition: height 0.5s var(--ease);
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--hero-tint), var(--hero-tint)),
    linear-gradient(180deg, rgba(20, 12, 8, 0.15) 0%, rgba(20, 12, 8, 0) 40%),
    linear-gradient(180deg, transparent 55%, var(--bg) 100%);
}

body.is-app .hero {
  height: clamp(150px, 22vw, 240px);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
}

.meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.empty.small {
  font-size: 0.9rem;
}

.error {
  color: var(--danger);
  font-size: 0.95rem;
}

.login-view {
  position: relative;
  z-index: 2;
  width: min(420px, calc(100% - 32px));
  margin: -120px auto 4rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem 2rem 2rem;
  text-align: center;
}

.wordmark {
  font-size: clamp(2.4rem, 7vw, 3.1rem);
  font-weight: 600;
  font-style: italic;
  margin: 0.35rem 0 1.75rem;
  color: var(--ink);
}

.login {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
textarea,
.select {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

textarea {
  resize: vertical;
  min-height: 3rem;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 55%,
    calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.select-sm {
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  font-size: 0.92rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}

.btn-sm {
  padding: 0.42rem 0.85rem;
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.link-btn.danger:hover {
  color: var(--danger);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0.6rem 0;
}

.brand {
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--ink);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.topbar-link {
  padding: 0.45rem 0.8rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.98rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.topbar-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.topbar-profile-wrap {
  position: relative;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.85rem 0.25rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}

.topbar-profile:hover,
.topbar-profile[aria-expanded="true"] {
  border-color: var(--line-strong);
}

#topbar-name {
  font-weight: 600;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 13rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: pop-in 0.16s var(--ease);
}

.topbar-menu button {
  padding: 0.55rem 0.8rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.topbar-menu button:hover {
  background: var(--surface-2);
}

.menu-section {
  display: flex;
  flex-direction: column;
  margin: 0.25rem 0;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.menu-label {
  padding: 0.2rem 0.8rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
}

.topbar-menu .theme-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}

.theme-swatch {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line-strong);
}

.swatch-library {
  background: linear-gradient(135deg, #7d2f27 0 50%, #e8d7bd 50% 100%);
}

.swatch-matcha {
  background: linear-gradient(135deg, #e48fae 0 50%, #8fae6d 50% 100%);
}

.theme-check {
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
  visibility: hidden;
}

.theme-option[aria-checked="true"] .theme-check {
  visibility: visible;
}

.app-main {
  width: min(1120px, calc(100% - 32px));
  margin: 2rem auto 4rem;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 2rem);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.card-head h2,
.card-title {
  font-size: 1.45rem;
}

.card-head h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card > .card-title {
  margin-bottom: 1.5rem;
}

.count-badge:not(:empty) {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--brass-soft);
  color: var(--brass);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
}

.chip-toggle {
  padding: 0.38rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.88rem;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip-toggle:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.chip-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-deep);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-strong);
}

.avatar.sm {
  width: 36px;
  height: 36px;
}

.avatar.lg {
  width: 72px;
  height: 72px;
}

.avatar.xl {
  width: 112px;
  height: 112px;
}

.current-card > .eyebrow {
  margin-bottom: 1.25rem;
}

.book {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 300px;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}

.book-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cover-link {
  display: block;
  line-height: 0;
  transition: transform 0.3s var(--ease);
}

a.cover-link:hover {
  transform: translateY(-3px) rotate(-0.6deg);
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 3px 8px 8px 3px;
  background: var(--bg-deep);
  box-shadow:
    inset 4px 0 6px -3px rgba(0, 0, 0, 0.35),
    var(--shadow-lg);
}

.book-cover.placeholder {
  display: flex;
  align-items: flex-end;
  padding: 1rem 0.85rem;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 6px, transparent 6px),
    linear-gradient(160deg, var(--cover-a), var(--cover-b));
  color: #f1dfc0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.25;
}

.book-cover.placeholder span {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-caption {
  text-align: center;
}

.book-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}

.book-author {
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.book-main {
  min-width: 0;
}

.byline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.byline div {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.post-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--ink);
}

.post-body::first-letter {
  float: left;
  margin: 0.08em 0.1em 0 0;
  font-family: var(--font-display);
  font-size: 3.4em;
  line-height: 0.85;
  font-weight: 600;
  color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.book-polls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  padding-left: clamp(1.25rem, 2.5vw, 2rem);
  border-left: 1px solid var(--line);
}

.poll-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.poll-card.compact {
  padding: 0.85rem;
  background: var(--surface);
}

.poll-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.poll-heading h4 {
  font-size: 1.02rem;
  line-height: 1.3;
}

.status {
  flex-shrink: 0;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--bg-deep);
  color: var(--muted);
}

.status-active {
  background: var(--sage-soft);
  color: var(--sage);
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.poll-option {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.8rem;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.poll-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--brass-soft);
  transition: width 0.5s var(--ease);
}

.poll-option.selected {
  border-color: var(--accent);
}

.poll-option.selected .poll-fill {
  background: var(--accent-soft);
}

button.poll-option:hover {
  border-color: var(--accent);
}

.poll-option-main,
.poll-count {
  position: relative;
}

.poll-option-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.poll-label {
  min-width: 0;
  overflow-wrap: break-word;
}

.poll-check {
  color: var(--accent);
  font-weight: 700;
}

.poll-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.poll-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.poll-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.poll-form input:not([type="checkbox"]) {
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  background: var(--surface);
}

.poll-form .actions {
  margin-top: 0.25rem;
}

.poll-others-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.poll-others-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: none;
  background: transparent;
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-align: left;
}

.poll-others-toggle:hover {
  background: var(--surface-2);
}

.chevron {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s var(--ease);
}

.poll-others-toggle[aria-expanded="true"] .chevron {
  transform: rotate(-135deg) translateY(-2px);
}

.poll-others-window {
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--surface-2);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1rem;
  text-align: center;
}

.empty-book {
  width: 72px;
  aspect-ratio: 2 / 3;
  border-radius: 3px 8px 8px 3px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 5px, transparent 5px),
    linear-gradient(160deg, var(--cover-a), var(--cover-b));
  box-shadow: var(--shadow);
  transform: rotate(-4deg);
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.stack-form .actions {
  margin-top: 0.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.comment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.comment:first-child {
  padding-top: 0.25rem;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.65rem;
  margin-bottom: 0.3rem;
}

.comment-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

.comment-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-radius: 8px;
  transition: filter 0.25s var(--ease), opacity 0.25s var(--ease);
}

.comment-content.is-concealed {
  filter: blur(7px);
  opacity: 0.7;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.spoiler-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.18rem 0.3rem 0.18rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  transition: border-color 0.15s;
}

.spoiler-chip:hover {
  border-color: var(--accent);
}

.spoiler-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.spoiler-action {
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.comments-empty {
  padding: 0.5rem 0 1.25rem;
}

.composer {
  margin-bottom: 1.25rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.composer textarea {
  padding: 0.35rem 0.25rem;
  border: none;
  background: transparent;
}

.composer textarea:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}

.composer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.composer-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.composer .select {
  width: auto;
  max-width: 14rem;
  background-color: var(--surface);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s var(--ease);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.shelf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.75rem 1.25rem;
}

.shelf-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  color: inherit;
}

.shelf-item.is-current .book-cover {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.shelf-item .book-cover {
  margin-bottom: 0.65rem;
  box-shadow:
    inset 3px 0 5px -3px rgba(0, 0, 0, 0.35),
    var(--shadow);
  transition: transform 0.3s var(--ease);
}

.shelf-item:hover .book-cover {
  transform: translateY(-3px);
}

.shelf-item .book-cover.placeholder {
  font-size: 0.9rem;
}

.shelf-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.shelf-author {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.shelf-item .meta {
  font-size: 0.8rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
}

.back-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

#profile-view .card,
#bembers-view .card {
  max-width: 760px;
}

#profile-view,
#bembers-view {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#profile-view .card,
#bembers-view .card {
  width: 100%;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.file-btn {
  position: relative;
  cursor: pointer;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.password-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.password-panel summary {
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink-soft);
}

.password-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.password-panel > .stack-form {
  padding: 1rem;
}

.password-panel input:not([type="checkbox"]) {
  background: var(--surface);
}

.profile-readonly {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
  text-align: center;
}

.role-badge {
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  background: var(--brass-soft);
  color: var(--brass);
  font-size: 0.82rem;
  font-weight: 600;
}

.profile-readonly .about {
  max-width: 34rem;
  margin: 0;
  white-space: pre-wrap;
  font-size: 1.12rem;
  font-style: italic;
  line-height: 1.7;
  color: var(--ink-soft);
}

.bembers-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.member-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.35rem 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}

.member-card .avatar {
  margin-bottom: 0.4rem;
}

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

.member-name {
  font-family: var(--font-display);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.2s var(--ease);
}

.modal {
  width: min(26rem, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.25s var(--ease);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.modal > .meta {
  margin-bottom: 1.1rem;
}

.section-edit-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 16rem;
  overflow: auto;
}

.section-edit-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.45rem 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

.section-edit-list .section-empty {
  justify-content: center;
  padding: 0.85rem;
  color: var(--muted);
  font-style: italic;
  border-style: dashed;
  background: transparent;
}

.section-add-row {
  display: flex;
  gap: 0.5rem;
}

.section-add-row input:not([type="checkbox"]) {
  padding: 0.5rem 0.75rem;
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 0.95rem;
  text-align: center;
  animation: toast-in 0.25s var(--ease);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(10px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.btn-lg {
  padding: 0.85rem 2.4rem;
  font-size: 1.1rem;
}

.pick-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1.5rem 0 1rem;
  text-align: center;
}

.pick-art {
  position: relative;
  width: 140px;
  height: 104px;
  margin-bottom: 0.5rem;
}

.pick-art span {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 58px;
  height: 88px;
  margin-left: -29px;
  border-radius: 3px 7px 7px 3px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 5px, transparent 5px),
    linear-gradient(160deg, var(--cover-a), var(--cover-b));
  box-shadow: var(--shadow);
  transform-origin: 50% 100%;
}

.pick-art span:nth-child(1) {
  transform: rotate(-16deg) translateX(-20px);
  filter: saturate(0.6) brightness(1.15);
}

.pick-art span:nth-child(2) {
  transform: rotate(14deg) translateX(20px);
  filter: hue-rotate(60deg) saturate(0.55);
}

.pick-art span:nth-child(3) {
  height: 96px;
}

.pick-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-style: italic;
}

.pick-lede {
  max-width: 32rem;
  color: var(--ink-soft);
}

.pick-pool {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.4rem;
  margin: 0.25rem 0 0.5rem;
}

.avatar-stack {
  display: flex;
}

.avatar-stack .avatar + .avatar {
  margin-left: -10px;
}

.pick-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 600;
}

.pick-check {
  font-weight: 700;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

a.brand {
  text-decoration: none;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 760px;
}

.admin-lede {
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
}

.last-pick {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.last-pick div {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.entrant-list,
.member-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.entrant {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.entrant:hover {
  border-color: var(--line-strong);
}

.entrant:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.entrant input {
  accent-color: var(--accent);
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.entrant .member-name,
.member-row .member-name {
  flex: 1;
  min-width: 0;
}

.entrant-empty {
  padding: 1rem 0;
}

.next-badge {
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 0.75rem;
  font-weight: 600;
}

.count-pill {
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: var(--brass-soft);
  color: var(--brass);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.25rem;
  border-bottom: 1px solid var(--line);
}

.member-row:last-child {
  border-bottom: none;
}

.back-link {
  display: inline-flex;
  margin-bottom: 0.75rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.back-link:hover {
  color: var(--accent);
}

.card-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.segment {
  padding: 0.32rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

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

.segment[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.segmented-sm .segment {
  padding: 0.24rem 0.7rem;
  font-size: 0.82rem;
}

.segmented-block {
  display: flex;
  width: 100%;
}

.segmented-block .segment {
  flex: 1;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.closed-note {
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.composer.is-replying {
  border-color: var(--accent);
}

.reply-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: -0.15rem -0.15rem 0.6rem;
  padding: 0.45rem 0.45rem 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
}

.reply-banner-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-arrow {
  font-weight: 700;
}

.reply-excerpt {
  color: var(--ink-soft);
  font-style: italic;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.15rem;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--surface);
}

.reply-ref {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  max-width: 100%;
  margin: 0 0 0.35rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
}

.reply-ref strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.reply-ref .reply-excerpt {
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-ref:hover,
.reply-ref:hover strong {
  color: var(--accent);
}

.comment {
  scroll-margin: 6rem;
  border-radius: var(--radius-sm);
}

.comment.is-highlighted {
  animation: comment-flash 1.8s var(--ease);
}

@keyframes comment-flash {
  0%,
  40% {
    background: var(--accent-soft);
    box-shadow: 0 0 0 10px var(--accent-soft);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 10px transparent;
  }
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.9rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.1s;
}

.like-btn svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.like-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

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

.like-btn[aria-pressed="true"] svg path {
  fill: currentColor;
}

.like-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.like-btn:disabled {
  cursor: default;
}

.composer-poll {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.poll-builder {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.composer-poll .poll-builder {
  padding: 0;
  border: none;
  background: transparent;
}

.poll-builder .segmented {
  align-self: flex-start;
  background: var(--surface);
}

.poll-builder .segment[aria-pressed="true"] {
  background: var(--surface-2);
}

.poll-builder input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  background: var(--surface);
}

.pb-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pb-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
}

.pb-book-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pb-book-preview:empty {
  display: none;
}

.pb-remove {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
}

.pb-remove:hover {
  background: var(--surface);
  color: var(--danger);
}

.pb-add {
  align-self: flex-start;
}

.poll-builder .actions {
  margin-top: 0.25rem;
}

.poll-kind {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

.poll-actions {
  display: inline-flex;
  gap: 0.75rem;
}

.date-tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.3rem;
  padding: 0.12rem 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  line-height: 1.05;
}

.date-month {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.date-day {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.poll-option.kind-schedule,
.poll-option.kind-book {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.mini-cover {
  width: 2.1rem;
  height: 3.15rem;
  flex-shrink: 0;
  border-radius: 2px 4px 4px 2px;
  object-fit: cover;
  background: var(--bg-deep);
  box-shadow: inset 2px 0 3px -2px rgba(0, 0, 0, 0.4), var(--shadow-sm);
}

.mini-cover.placeholder {
  display: inline-block;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 3px, transparent 3px),
    linear-gradient(160deg, var(--cover-a), var(--cover-b));
}

.book-option-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.book-option-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  overflow-wrap: break-word;
}

.book-option-author {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
}

.poll-option-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.poll-option-wrap .poll-option {
  flex: 1;
  min-width: 0;
}

.option-link {
  display: grid;
  place-items: center;
  width: 1.6rem;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
}

.option-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.comment .poll-card {
  max-width: 28rem;
}

.library-lede {
  margin: -0.75rem 0 1.25rem;
}

.library-item {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.library-shelf {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.library-status {
  align-self: flex-start;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--brass-soft);
  color: var(--brass);
  font-size: 0.8rem;
  font-weight: 600;
}

.library-status.status-read {
  background: var(--sage-soft);
  color: var(--sage);
}

.library-status.status-unfinished {
  background: var(--bg-deep);
  color: var(--muted);
}

#library-card {
  margin-top: 1.5rem;
}

.chip-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chip-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.session-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.85rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.session-strip:empty {
  display: none;
}

.session-strip .btn {
  margin-left: auto;
}

.session-joined {
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 0.85rem;
  font-weight: 600;
}

.composer-attachments {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.5rem 0 0;
  padding: 0;
}

.attachment {
  position: relative;
  width: 84px;
  height: 84px;
}

.attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.attachment-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid var(--surface-2);
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.95rem;
  line-height: 1;
}

.comment-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  max-width: 26rem;
}

.comment-images.count-1 {
  grid-template-columns: minmax(0, 1fr);
  max-width: 20rem;
}

.comment-images.count-3 .comment-image:first-child {
  grid-row: span 2;
}

.comment-image {
  display: block;
  padding: 0;
  overflow: hidden;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  aspect-ratio: 1;
}

.comment-images.count-1 .comment-image {
  aspect-ratio: auto;
  max-height: 22rem;
}

.comment-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}

.comment-image:hover img {
  transform: scale(1.03);
}

.gallery-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  aspect-ratio: 1;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease), filter 0.25s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-item.is-concealed img {
  filter: blur(14px);
  transform: scale(1.15);
}

.gallery-spoiler {
  position: absolute;
  inset: auto 0.5rem 0.5rem auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

body.no-scroll {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 16px;
  background: rgba(12, 9, 7, 0.92);
  animation: fade-in 0.2s var(--ease);
}

.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  max-width: min(1100px, 100%);
  margin: 0;
}

.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.lightbox-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.85rem;
  color: #f2e8da;
}

.lightbox-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.lightbox-date,
.lightbox-count {
  color: #b9ab99;
  font-size: 0.85rem;
}

.lightbox-count {
  font-variant-numeric: tabular-nums;
}

.lightbox-goto {
  color: #f2e8da;
  border-color: rgba(242, 232, 218, 0.35);
}

.lightbox-goto:hover {
  background: rgba(242, 232, 218, 0.1);
  border-color: rgba(242, 232, 218, 0.6);
}

.lightbox-close,
.lightbox-nav {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(242, 232, 218, 0.12);
  color: #f2e8da;
  line-height: 1;
  transition: background 0.15s;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(242, 232, 218, 0.24);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
}

.lightbox-nav {
  width: 48px;
  height: 48px;
  font-size: 2rem;
}

@media (max-width: 640px) {
  .lightbox-nav {
    position: absolute;
    bottom: 20px;
  }

  .lightbox-prev {
    left: 16px;
  }

  .lightbox-next {
    right: 16px;
  }

  .lightbox-image {
    max-height: calc(100vh - 220px);
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .session-strip .btn,
  .session-joined {
    margin-left: 0;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 960px) {
  .book {
    grid-template-columns: 170px minmax(0, 1fr);
  }

  .book-polls {
    grid-column: 1 / -1;
    padding-left: 0;
    padding-top: 1.5rem;
    border-left: none;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  body {
    font-size: 1rem;
  }

  .app-main {
    margin-top: 1.25rem;
  }

  .book {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-aside {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
  }

  .book-aside .cover-link {
    width: 110px;
    flex-shrink: 0;
  }

  .book-caption {
    flex: 1;
    min-width: 0;
    text-align: left;
    align-self: center;
  }

  .book-aside .field,
  .book-aside .btn {
    flex-basis: 100%;
  }

  .post-body {
    font-size: 1.06rem;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-link {
    padding: 0.4rem 0.55rem;
    font-size: 0.9rem;
  }

  #topbar-name {
    display: none;
  }

  .topbar-profile {
    padding: 0.2rem;
  }

  .shelf {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 1.25rem 1rem;
  }

  .composer-bar .btn {
    margin-left: auto;
  }

  .avatar-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
