:root {
  --bg: #1c1916;
  --paper: #26221e;
  --ink: #e2dbd0;
  --muted: #9c948a;
  --line: rgba(226, 219, 208, 0.1);
  --accent: #e8a87c;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
  --radius: 22px;
  --font-ui: "Outfit", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --nav-bg: rgba(28, 25, 22, 0.82);
  --profile-wash: rgba(28, 25, 22, 0.72);
  --code-bg: #1a1714;
  --scroll-thumb: rgba(226, 219, 208, 0.22);
  --field-scroll: rgba(226, 219, 208, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html {
  scroll-behavior: auto;
  overflow-y: scroll;
}
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
.prose pre::-webkit-scrollbar { width: 10px; height: 10px; }
.prose pre::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: calc(var(--nav-h, 76px) + max(10px, env(safe-area-inset-top)));
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea {
  font: inherit;
  color: inherit;
}

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

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 30;
}

.nav {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  left: max(10px, env(safe-area-inset-left));
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding: 14px max(5vw, 18px);
  border-radius: 22px;
  overflow: hidden;
  background: transparent;
  border: 1px solid transparent;
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition: background-color 0.35s ease, border-color 0.35s ease, -webkit-backdrop-filter 0.35s ease, backdrop-filter 0.35s ease;
}
.nav.is-glazed,
.nav:has(.nav-links.is-open) {
  background: rgba(28, 25, 22, 0.48);
  border-color: rgba(226, 219, 208, 0.12);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  backdrop-filter: blur(20px) saturate(1.25);
}
@media (prefers-reduced-motion: reduce) {
  .nav { transition: none; }
}

.mark {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--muted); }
.nav-links a.is-on { color: var(--ink); }
.nav-toggle.ghost { display: none; }
.nav-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.nav-end .btn,
.nav-end .ghost {
  flex-shrink: 0;
  white-space: nowrap;
}

.stage {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 48px max(5vw, env(safe-area-inset-right)) max(80px, env(safe-area-inset-bottom)) max(5vw, env(safe-area-inset-left));
}
.foot {
  width: 100%;
  margin: 0 0 48px;
  padding: 32px calc(max(10px, env(safe-area-inset-right)) + max(5vw, 18px)) 0 calc(max(10px, env(safe-area-inset-left)) + max(5vw, 18px));
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  flex-wrap: wrap;
}
.foot-copy { margin: 0; max-width: 38rem; }
.foot-copy p { margin: 0; }
.foot-copy .quiet { margin: 8px 0 0; }
.foot-links {
  display: flex;
  gap: 22px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--ink); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h1 { font-size: clamp(2.4rem, 6vw, 5.2rem); margin: 0 0 16px; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.35rem; margin: 8px 0; }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 12px;
}

.lede { font-size: 1.15rem; color: var(--muted); max-width: 42rem; }
.live-count {
  color: #e25c4c;
  font-variant-numeric: tabular-nums;
}
.quiet { color: var(--muted); font-size: 0.92rem; }
.quiet.is-over { color: #e07a6a; }
.hero { padding: 0 0 72px; }
.hero h1 {
  white-space: nowrap;
  overflow-wrap: anywhere;
}
.hero-actions, .composer-actions, .profile-actions, .reading-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  align-items: center;
}
.reading-tools form,
.card-manage form,
.composer-actions form {
  margin: 0;
  display: flex;
  min-width: 0;
}

.btn, .ghost, .like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  max-width: 100%;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 22px;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.btn {
  background: var(--ink);
  color: var(--bg);
}
.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.btn.wide { width: 100%; }
.prose a.btn {
  color: var(--bg);
  text-decoration: none;
  background: var(--ink);
}
.prose a.btn:hover { color: var(--bg); }
.ghost, .like {
  background: transparent;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  color: inherit;
}
.danger { color: #e07a6a; border-color: rgba(224, 122, 106, 0.4); }
.ghost.sm, .btn.sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.shelf-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 28px;
  flex-wrap: wrap;
}
.shelf-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--muted);
}
.shelf-tabs a.is-on {
  color: var(--ink);
  border-color: var(--ink);
}
.shelf-tabs span {
  font-size: 0.8rem;
  opacity: 0.7;
}

.card-manage {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 22px;
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}
.shelf-grid > * { min-width: 0; }
.shelf-grid.is-slide-next {
  animation: shelf-next 0.42s ease;
}
.shelf-grid.is-slide-prev {
  animation: shelf-prev 0.42s ease;
}
@keyframes shelf-next {
  from { opacity: 0.2; transform: translateX(36px); }
  to { opacity: 1; transform: none; }
}
@keyframes shelf-prev {
  from { opacity: 0.2; transform: translateX(-36px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shelf-grid.is-slide-next,
  .shelf-grid.is-slide-prev { animation: none; }
}
.shelf-grid .is-off { display: none; }
.shelf-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
}
.shelf-nav[hidden] { display: none; }
.shelf-nav button:disabled {
  opacity: 0.35;
  cursor: default;
}
[data-pager]:focus { outline: none; }
[data-pager]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 8px;
  border-radius: 8px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--ink);
}

.cover {
  display: block;
  height: 150px;
  position: relative;
  overflow: hidden;
}
.cover.tall {
  height: auto !important;
  max-height: none !important;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
}
.cover.tall::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.reading-head .cover-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.cover.tall::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    115deg,
    rgba(8, 6, 5, 0.82) 0%,
    rgba(8, 6, 5, 0.52) 46%,
    rgba(8, 6, 5, 0.22) 100%
  );
  pointer-events: none;
}
.cover-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  padding: clamp(28px, 5vw, 40px) clamp(24px, 5vw, 44px);
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  color: #f4efe6;
}
.cover.tall[data-excerpt="none"] .cover-copy {
  padding-top: clamp(36px, 6vw, 52px);
  padding-bottom: clamp(36px, 6vw, 52px);
}
.cover.tall[data-excerpt="mid"] .cover-copy {
  padding-top: clamp(34px, 6vw, 48px);
  padding-bottom: clamp(34px, 6vw, 48px);
  gap: 16px;
}
.cover.tall[data-excerpt="long"] .cover-copy {
  padding-top: clamp(40px, 7vw, 56px);
  padding-bottom: clamp(40px, 7vw, 56px);
  gap: 18px;
}
.cover-copy h1 {
  margin: 0;
  color: #f4efe6;
  line-height: 1.12;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.cover.tall[data-title="short"] .cover-copy h1 {
  font-size: clamp(2.35rem, 5.2vw, 3.55rem);
}
.cover.tall[data-title="mid"] .cover-copy h1 {
  font-size: clamp(1.95rem, 3.6vw, 2.75rem);
}
.cover.tall[data-title="long"] .cover-copy h1 {
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
}
.cover-copy .lede {
  margin: 0;
  max-width: 42rem;
  font-size: clamp(1rem, 0.92rem + 0.4vw, 1.18rem);
  line-height: 1.55;
  color: rgba(244, 239, 230, 0.86);
  white-space: pre-wrap;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cover.tall[data-excerpt="long"] .cover-copy .lede {
  font-size: clamp(0.98rem, 0.9rem + 0.3vw, 1.12rem);
}
.cover-orb {
  position: absolute;
  width: 180px;
  height: 180px;
  right: -20px;
  top: -30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  filter: blur(8px);
  animation: drift 8s ease-in-out infinite;
}

@keyframes drift {
  50% { transform: translate(-18px, 12px) scale(1.1); }
}

.cover-ember { background: linear-gradient(135deg, #2a120c, #8a4630 58%, #c47852); }
.cover-ink { background: linear-gradient(135deg, #0c1016, #2f4a66 58%, #6a86a4); }
.cover-moss { background: linear-gradient(135deg, #0e1810, #3f6240 58%, #7a9a6e); }
.cover-dusk { background: linear-gradient(135deg, #140c18, #5a3868 58%, #9a72aa); }
.cover-clay { background: linear-gradient(135deg, #1c100c, #8a4a2e 58%, #c47a4a); }
.cover-tide { background: linear-gradient(135deg, #081416, #1f6462 58%, #4ea09c); }
.cover-rust { background: linear-gradient(135deg, #1c0c08, #8a3a1c 58%, #c45c26); }
.cover-honey { background: linear-gradient(135deg, #1c1408, #8a6810 58%, #c49a24); }
.cover-wine { background: linear-gradient(135deg, #14080e, #6a2840 58%, #a84e68); }
.cover-sage { background: linear-gradient(135deg, #101410, #4a6448 58%, #7a9a76); }
.cover-slate { background: linear-gradient(135deg, #0e1216, #3a4a58 58%, #6a7c8c); }
.cover-peach { background: linear-gradient(135deg, #1c100c, #a05c48 58%, #d48468); }
.cover-pine { background: linear-gradient(135deg, #08140e, #1e4a38 58%, #3e7a5e); }
.cover-lilac { background: linear-gradient(135deg, #120e1c, #5a4478 58%, #8a6aa8); }
.cover-cocoa { background: linear-gradient(135deg, #140c08, #4a2e1c 58%, #8a5a3a); }
.cover-brass { background: linear-gradient(135deg, #161208, #7a6228 58%, #b08d3a); }
.cover-fog { background: linear-gradient(135deg, #101418, #4a5866 58%, #7a8a9a); }
.cover-coral { background: linear-gradient(135deg, #1c0c10, #9a4048 58%, #d07070); }
.cover-midnight { background: linear-gradient(135deg, #060a14, #1c3468 58%, #4a68a0); }
.cover-olive { background: linear-gradient(135deg, #12100a, #4e4e22 58%, #7a7a38); }
.cover-rose { background: linear-gradient(135deg, #180c12, #8a3e56 58%, #c45c78); }
.cover-storm { background: linear-gradient(135deg, #0c1016, #2e4460 58%, #5a7494); }
.cover-saffron { background: linear-gradient(135deg, #1c1008, #a04c18 58%, #d07028); }
.cover-lagoon { background: linear-gradient(135deg, #081214, #1e5a72 58%, #3e8aaa); }
.cover-plum { background: linear-gradient(135deg, #120810, #4a284a 58%, #7a4a7a); }
.cover-ash { background: linear-gradient(135deg, #12100e, #3e3a36 58%, #6a645c); }
.cover-copper { background: linear-gradient(135deg, #1a0e08, #8a4a28 58%, #b86a3a); }
.cover-glacier { background: linear-gradient(135deg, #081014, #2e5a72 58%, #5a8aaa); }
.cover-indigo { background: linear-gradient(135deg, #0c0c1c, #2a3480 58%, #5a64b8); }
.cover-cherry { background: linear-gradient(135deg, #180608, #7a182c 58%, #b02040); }
.cover-sand { background: linear-gradient(135deg, #1a140c, #8a6e48 58%, #c4a070); }
.cover-forest { background: linear-gradient(135deg, #06100a, #164428 58%, #2e7a4a); }
.cover-orchid { background: linear-gradient(135deg, #140c18, #6a3470 58%, #a05090); }
.cover-bronze { background: linear-gradient(135deg, #140e08, #5e3e1c 58%, #8a5a28); }
.cover-ice { background: linear-gradient(135deg, #0c1418, #3a6880 58%, #6aa0b8); }
.cover-velvet { background: linear-gradient(135deg, #10080c, #4a1838 58%, #8a3060); }

.card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.card-body h3 { margin: 8px 0 10px; overflow-wrap: anywhere; }
.card-excerpt {
  margin: 0;
  flex: 1;
  min-height: 4.65em;
  color: var(--muted);
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.meta, .card-foot, .chips, .by {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}
.card-foot {
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--font-display);
  flex: none;
}
.avatar > * {
  grid-column: 1;
  grid-row: 1;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}
.avatar img[hidden] { display: none; }
.avatar img:not([hidden]) + span { visibility: hidden; }
.avatar.xs { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar.sm { width: 36px; height: 36px; }
.avatar.lg { width: 92px; height: 92px; font-size: 1.8rem; }
.avatar.xl { width: 128px; height: 128px; font-size: 2.2rem; }

.accent-ember { background: #3a1d12; color: #f3d5b5; }
.accent-ink { background: #1a2430; color: #c9d6e3; }
.accent-moss { background: #1a281c; color: #d7e3c4; }
.accent-dusk { background: #261428; color: #e4c7ef; }
.accent-clay { background: #2a1610; color: #efd0b0; }
.accent-tide { background: #102224; color: #c6ece8; }
.accent-rust { background: #2c120c; color: #f0b090; }
.accent-honey { background: #2a1e0a; color: #f6e3a1; }
.accent-wine { background: #1a0a12; color: #e8b4c4; }
.accent-sage { background: #161c16; color: #dce8d4; }
.accent-slate { background: #14181c; color: #c5d0da; }
.accent-peach { background: #2a1612; color: #f8d4c4; }
.accent-pine { background: #0c1812; color: #b7d8c6; }
.accent-lilac { background: #1a1428; color: #ddd0f0; }
.accent-cocoa { background: #1c120c; color: #d4b496; }
.accent-brass { background: #1e180c; color: #ead9a0; }
.accent-fog { background: #181c20; color: #e4eaf0; }
.accent-coral { background: #2a1014; color: #f5c4c0; }
.accent-midnight { background: #080c18; color: #a8bce0; }
.accent-olive { background: #16140a; color: #d8d8a8; }
.accent-rose { background: #221016; color: #f0c4d0; }
.accent-storm { background: #10141c; color: #b8c8dc; }
.accent-saffron { background: #24140a; color: #f6c890; }
.accent-lagoon { background: #0a181c; color: #b0dce8; }
.accent-plum { background: #180c18; color: #d4b0d4; }
.accent-ash { background: #161412; color: #d4d0c8; }
.accent-copper { background: #24140c; color: #f0c4a0; }
.accent-glacier { background: #0c1418; color: #d0e8f0; }
.accent-indigo { background: #101028; color: #b8c0f0; }
.accent-cherry { background: #24080c; color: #f0b0bc; }
.accent-sand { background: #241c10; color: #f0e0c4; }
.accent-forest { background: #0a140c; color: #a8d0b4; }
.accent-orchid { background: #1c1020; color: #e8c0dc; }
.accent-bronze { background: #1c1408; color: #e0c090; }
.accent-ice { background: #101820; color: #d8eef4; }
.accent-velvet { background: #140810; color: #e0a8c4; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 12px 0 24px;
}
.section-head a { color: var(--accent); }

.writer {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 6px;
  justify-items: start;
  color: var(--ink);
}

.empty { text-align: center; padding: 48px 0; }
.empty.tall { padding: 12vh 0; }
.page-head { margin-bottom: 36px; }

.compose-wrap {
  display: grid;
  justify-items: stretch;
}
.compose-wrap .page-head {
  width: 100%;
  text-align: left;
}
.compose-wrap .composer {
  margin: 0;
  width: 100%;
  display: grid;
  gap: 0;
}

.composer > label {
  gap: 14px;
  padding-bottom: 26px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.composer > label input,
.composer > label textarea,
.composer > label .quiet {
  letter-spacing: 0;
  text-transform: none;
  font-size: 1rem;
}

.composer > label textarea[data-excerpt] {
  resize: none;
  overflow: hidden;
  height: auto;
  max-height: none;
  min-height: 5.75rem;
  line-height: 1.55;
}

.composer > label textarea[data-body] {
  resize: none;
  min-height: 22rem;
  height: 22rem;
  max-height: 22rem;
  line-height: 1.65;
  overflow-y: auto;
}
.composer > label textarea[data-body]::-webkit-scrollbar {
  width: 10px;
}
.composer > label textarea[data-body]::-webkit-scrollbar-track {
  background: var(--paper);
  margin: 8px 0;
}
.composer > label textarea[data-body]::-webkit-scrollbar-thumb {
  background: var(--field-scroll);
  border-radius: 999px;
  border: 2px solid var(--paper);
}

.composer > label .quiet {
  font-size: 0.86rem;
}

.composer .swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, 40px);
  gap: 14px;
  padding: 0 0 26px;
  margin: 0;
  border: 0;
}

.composer .swatches legend {
  grid-column: 1 / -1;
  padding: 0 0 6px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
}

.composer .composer-actions {
  width: 100%;
  align-items: center;
  margin-top: 12px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.composer-publish {
  margin-left: auto;
}

.search {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  max-width: 42rem;
}
.search input { flex: 1; min-width: 0; }

label {
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}
input, textarea {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  font-size: 16px;
  max-width: 100%;
  color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--accent); }
.stack { display: grid; gap: 16px; }
.grow { flex: 1; }

.auth-wrap { display: grid; place-items: center; min-height: min(60vh, 100dvh); }
.auth-card, .composer, .desk {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.auth-card { width: min(480px, 100%); }
.auth-card.is-wide { width: min(560px, 100%); }
.recovery-code {
  margin: 8px 0 20px;
  padding: 16px 18px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  word-break: break-all;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 70%, #1c1916);
  border: 1px solid var(--line);
  border-radius: 12px;
  user-select: all;
}
.desk-spare {
  border-bottom: 1px solid var(--line);
}
.composer, .desk { width: 100%; }
.desk { display: flex; gap: 32px; }
.desk textarea[data-count] {
  overflow: hidden;
  resize: none;
  min-height: 6.5rem;
}
.desk-side { display: grid; gap: 12px; justify-items: center; height: max-content; }

.desk-vault {
  margin-top: 88px;
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.desk-vault-head {
  padding: 36px 36px 40px;
  max-width: 42rem;
  border-bottom: 1px solid var(--line);
}
.desk-vault-head h2 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 2.6vw, 2.05rem);
}
.desk-vault-head .quiet { margin: 0; }
.desk-vault-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
}
.desk-vault-rule {
  width: 1px;
  margin: 20px 0;
  background: linear-gradient(to bottom, transparent, var(--line) 12%, var(--line) 88%, transparent);
}
.desk-chamber {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 40px 36px 44px;
  min-width: 0;
}
.desk-chamber h3 {
  margin: 0 0 2px;
  font-size: 1.35rem;
}
.desk-chamber > .quiet { margin: 0 0 14px; max-width: 28rem; }
.desk-chamber .stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 2px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}
.desk-chamber label {
  min-width: 0;
  width: 100%;
}
.desk-chamber input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.desk-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  min-width: 0;
}
.desk-chamber .btn,
.desk-chamber .ghost {
  align-self: start;
  width: max-content;
  margin-top: auto;
}
.desk-chamber.is-grave {
  background:
    linear-gradient(180deg, color-mix(in srgb, #3a1814 10%, transparent), transparent 42%);
}
.desk-chamber.is-grave .kicker { color: #d4a39a; }
.desk-chamber.is-grave .danger {
  background: transparent;
  margin-top: auto;
}
.desk-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.file {
  width: 100%;
  justify-items: center;
  text-align: center;
}
.file-pick {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: center;
  width: 100%;
}
.file-pick input {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-btn {
  display: inline-block;
  border-radius: 999px;
  padding: 12px 22px;
  background: var(--ink);
  color: var(--bg);
  pointer-events: none;
}

.swatches {
  border: 0;
  padding: 0;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; }
.swatch span {
  width: 36px;
  height: 36px;
  display: block;
  border-radius: 50%;
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line);
}
.swatch input:checked + span {
  box-shadow: 0 0 0 2px var(--accent);
}

.profile-hero {
  border-radius: 32px;
  padding: 8px;
  margin-bottom: 40px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.profile-card {
  background: var(--profile-wash);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 26px;
  padding: 28px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 24px;
  row-gap: 8px;
  align-items: start;
  color: var(--ink);
}
.profile-card > .avatar {
  grid-column: 1;
  grid-row: 1 / span 4;
}
.profile-copy { display: contents; }
.profile-copy .kicker {
  grid-column: 2;
  grid-row: 1;
  margin: 0 0 4px;
}
.profile-copy h1 {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.profile-copy .lede {
  grid-column: 2;
  grid-row: 3;
  margin: 8px 0 0;
  max-width: 40rem;
  font-size: 1.05rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.profile-copy .chips {
  grid-column: 2;
  grid-row: 4;
  margin-top: 12px;
}
.profile-card .profile-actions {
  grid-column: 3;
  grid-row: 1 / span 4;
  margin: 0;
  flex: none;
  align-self: start;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chips span, .chips a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.reading { width: 100%; }
.reading-head > .kicker { margin: 22px 0 0; }
.reading-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
}
.reading-meta .chips { margin: 0; flex: 1; }
.reading-head .by {
  margin: 0 0 0 auto;
  text-align: right;
  flex: none;
}
.reading-head .by > span:first-child {
  display: grid;
  justify-items: end;
  line-height: 1.25;
}
.reading-head .by strong {
  color: var(--ink);
  font-weight: 500;
}
.reading-head .reading-tools {
  margin-bottom: 48px;
}
.prose { font-size: 1.15rem; }
.prose h1, .prose h2, .prose h3 { margin: 1.4em 0 0.5em; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose pre, .prose code {
  background: var(--code-bg);
  border-radius: 8px;
  color: var(--ink);
}
.prose pre { padding: 16px; overflow: auto; }
.prose code { padding: 2px 6px; }

.like.is-on { background: rgba(232, 168, 124, 0.16); border-color: var(--accent); }
.like.pop { animation: pop 0.35s ease; }
@keyframes pop {
  50% { transform: scale(1.12); }
}

.comments { width: 100%; margin: 56px auto 0; }
.comment-list { list-style: none; padding: 0; display: grid; gap: 18px; }
.comment-list li {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  animation: rise 0.4s ease, fade 0.4s ease 3.4s forwards;
}
.toast.ok { border-color: #6f8f6a; }
.toast.bad { border-color: #e07a6a; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
@keyframes fade { to { opacity: 0; transform: translateY(8px); } }

.reveal {
  animation: reveal 0.7s ease both;
  animation-delay: var(--d, 0ms);
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(18px); }
}

@media (pointer: coarse) {
  .btn, .ghost, .like, .nav-toggle {
    min-height: 44px;
  }
  .shelf-nav .ghost { min-width: 88px; }
}

@media (max-width: 1024px) {
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero h1 { white-space: normal; }
  .profile-card {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .profile-card > .avatar { grid-row: 1 / span 2; }
  .profile-copy .lede,
  .profile-copy .chips,
  .profile-card .profile-actions {
    grid-column: 1 / -1;
  }
  .profile-copy .lede { grid-row: 3; }
  .profile-copy .chips { grid-row: 4; }
  .profile-card .profile-actions {
    grid-row: 5;
    width: 100%;
    margin-top: 8px;
    justify-content: flex-start;
  }
  .reading-meta { flex-wrap: wrap; }
  .composer, .desk, .auth-card { padding: 28px; }
  .cover.tall[data-title="short"] .cover-copy h1 { font-size: clamp(1.7rem, 7vw, 2.6rem); }
  .cover.tall[data-title="mid"] .cover-copy h1 { font-size: clamp(1.5rem, 5.5vw, 2.2rem); }
  .cover.tall[data-title="long"] .cover-copy h1 { font-size: clamp(1.35rem, 4.8vw, 1.85rem); }
}

@media (max-width: 720px) {
  .nav { padding: 12px 16px; gap: 12px; border-radius: 18px; }
  .foot {
    padding-left: calc(max(10px, env(safe-area-inset-left)) + 16px);
    padding-right: calc(max(10px, env(safe-area-inset-right)) + 16px);
  }
  .mark { order: 1; }
  .nav-end { order: 2; gap: 8px; }
  .nav-toggle.ghost { display: inline-flex; align-items: center; }
  .nav-links {
    display: none;
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0 12px;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 10px 0; min-height: 44px; display: flex; align-items: center; }
  .desk { flex-direction: column; }
  .desk-vault { margin-top: 80px; border-radius: 20px; }
  .desk-vault-head,
  .desk-chamber { padding-left: 22px; padding-right: 22px; }
  .desk-vault-head { padding-top: 28px; padding-bottom: 36px; }
  .desk-vault-split { grid-template-columns: 1fr; }
  .desk-vault-rule {
    width: auto;
    height: 1px;
    margin: 16px 22px;
    background: linear-gradient(to right, transparent, var(--line) 12%, var(--line) 88%, transparent);
  }
  .desk-chamber { padding-top: 36px; padding-bottom: 40px; }
  .desk-pair { grid-template-columns: 1fr; }
  .shelf-grid { grid-template-columns: minmax(0, 1fr); }
  .cover-copy { padding: 28px 22px 24px; }
  .reading-head .by { margin-left: auto; }
  .profile-hero { border-radius: 22px; padding: 6px; }
  .profile-card { padding: 20px; row-gap: 6px; column-gap: 14px; }
  .profile-copy h1 { font-size: clamp(1.45rem, 7vw, 1.9rem); }
  .profile-card .profile-actions .btn,
  .profile-card .profile-actions .ghost {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    justify-content: center;
  }
  .desk-chamber .btn,
  .desk-chamber .ghost {
    width: 100%;
    max-width: 100%;
  }
  .hero-actions .btn,
  .hero-actions .ghost {
    width: 100%;
  }
  .reading-tools .btn,
  .reading-tools .ghost,
  .reading-tools .like {
    flex: 1 1 auto;
    min-width: min(100%, 8.5rem);
  }
  .composer .composer-actions { flex-direction: column; align-items: stretch; }
  .composer .composer-actions .ghost,
  .composer .composer-actions .btn {
    width: 100%;
  }
  .composer-publish { margin-left: 0; width: 100%; }
  .shelf-nav .ghost { flex: 1 1 40%; }
  .hero { padding: 0 0 48px; }
  .search { flex-wrap: wrap; }
  .search input, .search .btn { flex: 1 1 100%; }
  .toast { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  .section-head { flex-wrap: wrap; gap: 8px; }
  h1 { font-size: clamp(2rem, 9vw, 3.4rem); }
  .auth-card, .composer, .desk, .desk-panel { padding: 22px; border-radius: 20px; }
  .prose { overflow-wrap: anywhere; }
  .prose pre { max-width: 100%; }
}

@media (max-width: 480px) {
  .nav-end { gap: 6px; }
  .nav-end .btn, .nav-end .ghost { padding: 10px 12px; }
  .mark { font-size: 1.4rem; }
  .stage { padding-top: 28px; }
  .foot { margin-bottom: 28px; }
  .card-body { padding: 16px; }
  .avatar.lg { width: 76px; height: 76px; font-size: 1.5rem; }
  .avatar.xl { width: 96px; height: 96px; font-size: 1.7rem; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .hero { padding-bottom: 36px; }
  .stage { padding-top: 24px; }
}
