/* DotPoet — web app. Design system matched to the iOS app (cool slate, New York serif,
   monochrome ink), but with REAL WEBSITE STRUCTURE on desktop: a persistent left sidebar,
   a bordered center column, and a discovery rail — collapsing to the phone shell (topbar
   + floating dock) under 720px. */
:root {
  --surface: #0E1013;
  --raised: #171A1F;
  --pressed: #21252B;
  --ink: #F2F3F5;
  --ink-2: rgba(242,243,245,.62);
  --ink-3: rgba(242,243,245,.55);
  --sep: rgba(242,243,245,.08);
  --hair: rgba(242,243,245,.06);
  --serif: ui-serif, "Literata", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --hover: rgba(255,255,255,.025);
  --shadow: rgba(0,0,0,.4);
  --headbg: rgba(14,16,19,.88);
  --verse: rgba(242,243,245,.9);
  --err: #e5837f;
  --sel: rgba(242,243,245,.22);
  --on-ink: rgba(14,16,19,.55);      /* text sitting on an --ink surface */
  --focus: rgba(242,243,245,.55);
}
/* The app's light appearance: clean neutral, never sepia. Worlds stay dark. */
html[data-mode="light"] {
  --surface: #F6F6F7;
  --raised: #FFFFFF;
  --pressed: #E9EAEC;
  --ink: #141519;
  --ink-2: rgba(20,21,25,.7);
  --ink-3: rgba(20,21,25,.64);
  --sep: rgba(20,21,25,.12);
  --hair: rgba(20,21,25,.08);
  --hover: rgba(20,21,25,.03);
  --shadow: rgba(20,21,25,.14);
  --headbg: rgba(246,246,247,.86);
  --verse: rgba(20,21,25,.88);
  --err: #B3403A;
  --sel: rgba(20,21,25,.16);
  --on-ink: rgba(246,246,247,.66);
  --focus: rgba(20,21,25,.55);
}
* { margin: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--sans); background: var(--surface); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.4; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.m-only { display: none !important; }

/* ---------- desktop layout: sidebar · center · rail ---------- */
.layout { display: grid; grid-template-columns: 250px minmax(0, 660px) 340px;
  justify-content: center; min-height: 100vh; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 16px; border-right: 1px solid var(--hair); }
.wordmark { font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: -.01em; }
.wordmark .d { opacity: .55; }
.wordmark.side { font-size: 27px; padding: 6px 14px 20px; display: block; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 16px; padding: 12px 14px;
  border-radius: 999px; font-size: 17px; color: var(--ink-2); cursor: pointer;
  transition: background .12s ease, color .12s ease; }
.nav-item svg { width: 22px; height: 22px; flex: none; }
.nav-item:hover { background: var(--raised); color: var(--ink); }
.nav-item.on { color: var(--ink); font-weight: 600; }
.side-write { display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--ink); color: var(--surface); border-radius: 999px; padding: 14px;
  font-weight: 600; font-size: 16px; margin-top: 20px; width: 100%; transition: opacity .12s; }
.side-write:hover { opacity: .9; }
.side-write svg { width: 19px; height: 19px; }
.side-foot { margin-top: auto; }
.side-foot .mini { font-size: 13px; overflow: hidden; text-overflow: ellipsis;
  max-width: 150px; white-space: nowrap; }

.center { border-right: 1px solid var(--hair); min-height: 100vh; }
.main { padding-bottom: 48px; }

.rail { position: sticky; top: 0; height: 100vh; overflow: auto; padding: 22px 26px;
  scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-search { width: 100%; padding: 13px 18px; border-radius: 999px; background: var(--raised);
  border: 1px solid var(--sep); outline: none; font-size: 14px; }
.rail-search:focus { border-color: rgba(242,243,245,.22); }
.rail-card { background: var(--raised); border: 1px solid var(--hair); border-radius: 18px;
  padding: 18px 18px 16px; margin-top: 16px; }
.rail-card h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.rail-p { color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.rail-link { display: inline-block; margin-top: 10px; color: var(--ink); font-size: 14px;
  font-weight: 600; border-bottom: 1px solid var(--sep); }
.rail-link:hover { border-color: var(--ink-2); }
.rail-poet { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.rail-poet:hover .by-name { text-decoration: underline; }
.rail-poet.in-list { padding: 10px 20px; }
.rail-poet.in-list:hover { background: var(--hover); }
.rail-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 18px;
  font-size: 12px; color: var(--ink-3); padding: 0 4px; }
.rail-foot a:hover { color: var(--ink-2); }

/* ---------- center-column header ---------- */
.page-head { position: sticky; top: 0; z-index: 15; background: var(--headbg);
  backdrop-filter: saturate(1.2) blur(14px); border-bottom: 1px solid var(--hair); }
.topbar-in { display: flex; align-items: center; gap: 14px; padding: 14px 20px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); background: var(--raised); }
.icon-btn svg { width: 21px; height: 21px; }
.topbar-in .spacer { flex: 1; }
.scopes { display: flex; gap: 22px; padding: 3px 20px 0; }
.scope { position: relative; padding: 13px 0; font-size: 15px; font-weight: 600; color: var(--ink-3); }
.scope:hover { color: var(--ink-2); }
.scope.on { color: var(--ink); }
.scope.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--ink); border-radius: 2px; }
.page-title { font-family: var(--serif); font-weight: 600; font-size: 19px; padding: 15px 20px; }
.sec-h { font-family: var(--serif); font-weight: 600; font-size: 18px; padding: 22px 20px 8px; }

/* ---------- feed cells ---------- */
.cell { display: block; padding: 22px 20px 20px; border-bottom: 1px solid var(--hair);
  position: relative; cursor: pointer; transition: background .12s ease; }
.cell:hover { background: var(--hover); }
.byline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--pressed); flex: none;
  display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 15px;
  color: var(--ink-2); background-size: cover; background-position: center; }
.by-name { font-size: 14px; font-weight: 600; }
.by-sub { font-size: 12px; color: var(--ink-3); }
.cell h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.2;
  margin-bottom: 8px; letter-spacing: -.005em; }
.verse { font-family: var(--serif); font-size: 18px; line-height: 1.55; white-space: pre-wrap;
  color: var(--verse);
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.engage { display: flex; gap: 22px; margin-top: 16px; color: var(--ink-3); }
.engage button { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.engage button:hover { color: var(--ink-2); }
.engage button.on { color: var(--ink); }
.engage svg { width: 18px; height: 18px; }

/* ---------- reader ---------- */
.reader { padding: 30px 22px 60px; }
.reader .back { color: var(--ink-2); font-size: 14px; margin-bottom: 26px; display: inline-flex;
  align-items: center; gap: 6px; }
.reader .back:hover { color: var(--ink); }
.reader h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.15;
  margin: 0 0 22px; }
.reader .r-by { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.reader .r-by:hover .by-name { text-decoration: underline; }
.reader .r-verse { font-family: var(--serif); font-size: 21px; line-height: 1.62; white-space: pre-wrap; }
.reader .r-foot { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--hair);
  color: var(--ink-3); font-size: 14px; }

/* ---------- auth ---------- */
.auth { display: flex; flex-direction: column; justify-content: center;
  max-width: 430px; margin: 0 auto; padding: 40px 26px; text-align: center; min-height: 100vh; }
.auth .mark { font-family: var(--serif); font-size: 40px; font-weight: 500; margin-bottom: 10px; }
.auth .mark .d { opacity: .55; }
.auth .sub { color: var(--ink-2); margin-bottom: 34px; }
.auth .poem { font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.5;
  color: var(--ink); margin: 0 0 6px; }
.auth .attr { color: var(--ink-3); font-size: 13px; margin-bottom: 40px; }
.field { width: 100%; padding: 15px 16px; border-radius: 14px; background: var(--raised);
  border: 1px solid var(--sep); margin-bottom: 10px; outline: none; font-size: 16px; }
.field:focus { border-color: rgba(242,243,245,.2); }
.btn { width: 100%; padding: 15px; border-radius: 14px; font-weight: 600; font-size: 16px;
  background: var(--ink); color: var(--surface); margin-top: 6px; transition: opacity .12s; }
.btn:hover { opacity: .92; }
.btn.ghost { background: var(--raised); color: var(--ink); }
.btn:disabled { opacity: .5; }
.auth .switch { margin-top: 18px; color: var(--ink-2); font-size: 14px; }
.auth .err { color: var(--err); font-size: 14px; margin-top: 12px; min-height: 18px; }
.err { color: var(--err); font-size: 14px; min-height: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--sep); }
@media (min-width: 721px) {
  .auth { min-height: auto; margin: 9vh auto; background: var(--raised);
    border: 1px solid var(--hair); border-radius: 26px; padding: 52px 44px; }
}

/* ---------- mobile dock ---------- */
/* The full-width strip is layout only — taps beside the capsule fall through
   to the page instead of dying on invisible chrome. */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  justify-content: center; padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  pointer-events: none; }
.dock-in { pointer-events: auto; }
.dock-in { display: flex; gap: 6px; background: var(--raised); border: 1px solid var(--sep);
  border-radius: 999px; padding: 7px 10px; box-shadow: 0 12px 34px var(--shadow); }
.dock a { width: 52px; height: 44px; display: grid; place-items: center; color: var(--ink-3); border-radius: 999px; }
.dock a.on { color: var(--ink); }
.dock a.quill { background: var(--ink); color: var(--surface); width: 50px; height: 50px; border-radius: 50%; margin: -3px 4px 0; }
.dock svg { width: 21px; height: 21px; }

/* ---------- states ---------- */
.center-msg, .center { }
.center-empty { text-align: center; padding: 80px 24px; color: var(--ink-3); }
.skeleton { padding: 22px 20px; border-bottom: 1px solid var(--hair); }
.sk { background: linear-gradient(90deg, var(--raised), var(--pressed), var(--raised));
  background-size: 200% 100%; border-radius: 8px; animation: sh 1.4s infinite; }
@keyframes sh { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.spin { width: 22px; height: 22px; border: 2px solid var(--sep); border-top-color: var(--ink);
  border-radius: 50%; animation: r .7s linear infinite; margin: 40px auto; }
@keyframes r { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1160px) {
  .layout { grid-template-columns: 76px minmax(0, 1fr); }
  .rail { display: none; }
  .sidebar { padding: 22px 10px; align-items: center; }
  .wordmark.side { padding: 6px 0 20px; }
  .wordmark.side .rest { display: none; }
  .nav-item span, .side-write span, .side-foot .mini { display: none; }
  .nav-item { padding: 13px; }
  .side-write { width: 50px; height: 50px; padding: 0; border-radius: 50%; }
}
@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar, .rail, .d-only { display: none !important; }
  .m-only { display: flex !important; }
  .center { border: 0; min-height: 100vh; }
  .main { padding-bottom: 96px; }
  .reader h1 { font-size: 30px; }
}

/* ---------- v3 polish ---------- */
.fadein { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--sel); }

.vbadge { display: inline-block; width: 15px; height: 15px; margin-left: 5px; vertical-align: -2px; color: var(--ink); }
.vbadge svg { width: 15px; height: 15px; }

.engage.quiet { margin-top: 14px; gap: 18px; }
.est { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-3); }
.est svg { width: 15px; height: 15px; }
.pop svg { animation: pop .35s ease; }
@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.35)} 100%{transform:scale(1)} }

.udot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); display: inline-block; margin-left: 8px; }
.dock a { position: relative; }
.dock .udot { position: absolute; margin: 0; top: 8px; right: 10px; width: 7px; height: 7px; }
.udot.still { margin-left: auto; align-self: center; flex: none; }

/* explore */
.potd { display: block; margin: 18px 20px 6px; padding: 26px 24px 22px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1); cursor: pointer; color: #f2f3f5;
  transition: transform .15s ease; }
.potd:hover { transform: translateY(-2px); }
.potd-eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .65;
  font-weight: 600; margin-bottom: 12px; }
.potd-title { font-family: var(--serif); font-weight: 600; font-size: 26px; margin-bottom: 10px; }
.potd-verse { font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.55;
  opacity: .9; white-space: pre-wrap; }
.potd-by { margin-top: 14px; font-size: 13px; opacity: .75; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 20px; }
.chip { font-family: var(--serif); font-style: italic; font-size: 15px; padding: 8px 14px;
  border-radius: 999px; background: var(--raised); border: 1px solid var(--sep); color: var(--ink-2); }
.chip:hover { color: var(--ink); border-color: rgba(242,243,245,.25); }
.voices { display: flex; gap: 18px; padding: 8px 20px 20px; flex-wrap: wrap; }
.voice { text-align: center; width: 74px; }
.voice .avatar { width: 56px; height: 56px; margin: 0 auto 8px; font-size: 22px; }
.v-name { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice:hover .v-name { color: var(--ink); }

/* activity */
.arow { display: flex; gap: 12px; align-items: center; padding: 16px 20px;
  border-bottom: 1px solid var(--hair); cursor: pointer; }
.arow:hover { background: var(--hover); }
.arow.unread { background: var(--hover); }
.a-main { flex: 1; min-width: 0; }
.a-line { font-size: 14.5px; line-height: 1.45; }
.a-title { color: var(--ink-2); font-family: var(--serif); font-style: italic; }

/* reader tint */
.center { position: relative; }
.r-tint { position: absolute; left: 0; right: 0; top: 0; height: 300px; opacity: .22; pointer-events: none; }
.reader { position: relative; }

/* editor */
.editor { padding: 26px 22px; }
.w-title { width: 100%; background: none; border: 0; outline: none; font-family: var(--serif);
  font-size: 28px; font-weight: 600; color: var(--ink); padding: 6px 0 10px; }
.w-title::placeholder, .w-body::placeholder { color: var(--ink-3); }
.w-body { width: 100%; background: none; border: 0; outline: none; font-family: var(--serif);
  font-size: 19px; line-height: 1.62; color: var(--ink); resize: vertical; min-height: 280px; }
.w-meta { color: var(--ink-3); font-size: 12.5px; padding: 2px 0 16px; }
.w-hint { color: var(--ink-3); font-size: 12.5px; margin-top: 12px; text-align: center; }

/* profile */
.p-head { text-align: center; padding: 36px 24px 22px; }
.p-avatar .avatar { width: 92px; height: 92px; margin: 0 auto 14px; font-size: 36px; }
.p-name { font-family: var(--serif); font-size: 27px; font-weight: 600; }
.p-bio { color: var(--ink-2); margin-top: 12px; max-width: 42ch; margin-left: auto;
  margin-right: auto; line-height: 1.55; }
.p-site { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--ink-2);
  font-size: 13.5px; border-bottom: 1px solid var(--sep); padding-bottom: 1px; }
.p-site svg { width: 14px; height: 14px; }
.p-site:hover { color: var(--ink); }
.p-stats { display: flex; justify-content: center; gap: 26px; margin-top: 16px;
  color: var(--ink-3); font-size: 13.5px; }
.p-stats b { color: var(--ink); font-weight: 600; }

/* login */
.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero { position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 48px; border-right: 1px solid var(--hair); overflow: hidden;
  background: radial-gradient(900px 500px at 20% 0%, rgba(242,243,245,.06), transparent 60%),
              linear-gradient(165deg, #171b21, #0b0d10); }
.login-quote blockquote { font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(22px, 2.6vw, 32px); line-height: 1.5; white-space: pre-wrap; color: var(--ink);
  opacity: 0; transform: translateY(8px); transition: all .6s ease; max-width: 24ch; }
.login-quote cite { display: block; margin-top: 16px; color: var(--ink-3); font-style: normal;
  font-size: 14px; opacity: 0; transition: opacity .6s ease .1s; }
.login-quote blockquote.show { opacity: 1; transform: none; }
.login-quote cite.show { opacity: 1; }
.login-tag { color: var(--ink-3); font-size: 14px; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 44px 26px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-h { font-family: var(--serif); font-weight: 600; font-size: 30px; margin-bottom: 8px; }
.auth-sub { color: var(--ink-2); font-size: 14.5px; line-height: 1.5; margin-bottom: 24px; }
.mode-tabs { display: flex; gap: 6px; background: var(--raised); border: 1px solid var(--hair);
  border-radius: 999px; padding: 4px; margin-bottom: 22px; }
.mtab { flex: 1; padding: 9px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-3); }
.mtab.on { background: var(--ink); color: var(--surface); }
.flabel { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  margin: 2px 2px 6px; text-transform: uppercase; letter-spacing: .08em; }
.pw-wrap { position: relative; }
.pw-eye { position: absolute; right: 8px; top: 7px; width: 36px; height: 36px; display: grid;
  place-items: center; color: var(--ink-3); border-radius: 50%; }
.pw-eye:hover { color: var(--ink); }
.pw-eye svg { width: 18px; height: 18px; }
.ts-wrap { margin: 6px 0 4px; display: flex; justify-content: center; }
.auth-foot { margin-top: 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.m-only-b { display: none; }
.login .mark { font-family: var(--serif); font-size: 34px; text-align: center; margin-bottom: 14px; }
.login .mark .d { opacity: .55; }
@media (max-width: 900px) {
  .login { display: block; }
  .login-hero { display: none !important; }
  .login-side { min-height: 100vh; }
  .m-only-b { display: block; }
}

/* ---------- v4: messages, saved, editing ---------- */
.btn.slim { width: auto; padding: 10px 26px; margin: 0 4px; display: inline-block; }
.p-actions { margin-top: 18px; }

/* The chat is height-bound so .chat-log genuinely scrolls — with min-height the
   flex column just grows and every scroll-to-bottom call is a silent no-op. */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 120px); }
.chat-head { display: flex; gap: 10px; align-items: center; padding: 14px 20px;
  border-bottom: 1px solid var(--hair); }
.chat-head:hover .by-name { text-decoration: underline; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex;
  flex-direction: column; gap: 10px; }
.bubble { max-width: 76%; background: var(--raised); border: 1px solid var(--hair);
  padding: 10px 14px; border-radius: 16px 16px 16px 6px; font-size: 15px; line-height: 1.45;
  align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--ink); color: var(--surface);
  border-radius: 16px 16px 6px 16px; border: 0; }
.b-time { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }
.bubble.mine .b-time { color: var(--on-ink); }
.chat-bar { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--hair);
  position: sticky; bottom: 0; background: var(--surface); }
@media (max-width: 720px) {
  .chat-bar { bottom: 0; }
  .chat { height: calc(100dvh - 150px); }
}

/* ---------- v5: fonts, worlds, pagination ---------- */
@font-face {
  font-family: "Literata";
  src: url("/app/vendor/fonts/literata.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/app/vendor/fonts/literata-italic.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap;
}

.tgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 8px;
  border-radius: 999px; background: var(--pressed); border: 1px solid var(--sep);
  font-size: 12.5px; color: var(--ink-2); }
.tchip:hover { color: var(--ink); }
.tchip.on { color: var(--ink); border-color: rgba(242,243,245,.4); }
.tsw { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); }
.m-strip { display: none; }
@media (max-width: 720px) {
  .m-strip { display: flex; justify-content: center; margin-top: 18px; }
}

.loadmore { display: block; margin: 22px auto 10px; padding: 12px 26px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--sep); color: var(--ink-2);
  font-size: 14px; font-weight: 600; }
.loadmore:hover { color: var(--ink); border-color: rgba(242,243,245,.25); }
.loadmore:disabled { opacity: .6; }

/* ---------- v6: the painted worlds ---------- */
#world-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
#world-bg svg { display: block; width: 100%; height: min(64vh, 640px); }
.wb-fade { position: absolute; top: 0; left: 0; right: 0; height: min(64vh, 640px);
  background: linear-gradient(180deg, transparent 26%, var(--surface) 97%); }

.r-scene, .room-scene { position: absolute; inset: 0 0 auto 0; height: 380px;
  overflow: hidden; pointer-events: none; }
.r-scene svg, .room-scene svg { display: block; width: 100%; height: 380px; }
.rs-fade { position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 20%, var(--surface) 96%); }
.room-scene { height: 100%; }
.room-scene svg { height: 100%; }
.p-head { position: relative; overflow: hidden; }
.p-head > *:not(.room-scene) { position: relative; z-index: 1; }
.reader > * { position: relative; z-index: 1; }

/* ---------- v8: motion respect + print ---------- */
@media (prefers-reduced-motion: reduce) {
  .sk, .fadein, .pop svg, .cell, .potd, .side-write { animation: none !important; transition: none !important; }
  .login-quote blockquote, .login-quote cite { transition: none !important; }
}
@media print {
  body, .center { background: #fff !important; color: #111 !important; }
  #world-bg, .r-scene, .room-scene, .sidebar, .rail, .dock, .page-head,
  .engage, .comments, #cinput, #csend, .back { display: none !important; }
  .reader h1, .reader .r-verse { color: #111 !important; }
  .reader .r-foot { color: #555 !important; }
}
img.avatar { object-fit: cover; border: 0; }

/* ---------- v9: threaded notes, safety ---------- */
.note { display: flex; gap: 10px; padding: 12px 0; }
.note.reply { margin-left: 44px; padding-top: 2px; }
.note-main { flex: 1; min-width: 0; }
.note-text { font-size: 15px; line-height: 1.5; margin-top: 3px; overflow-wrap: anywhere; }
.note-acts { display: flex; gap: 16px; margin-top: 7px; align-items: center; }
.note-like { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-3); }
.note-like svg { width: 14px; height: 14px; }
.note-like.on { color: var(--ink); }
.note-reply { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.note-reply:hover, .note-like:hover { color: var(--ink-2); }
.reply-banner { display: flex; align-items: center; gap: 10px; margin-top: 14px;
  padding: 8px 12px; background: var(--raised); border: 1px solid var(--hair);
  border-radius: 10px; font-size: 13px; color: var(--ink-2); }
.reply-banner button { color: var(--ink-3); font-size: 16px; line-height: 1; }
.reply-banner button:hover { color: var(--ink); }
.safety { margin-top: 22px; font-size: 12.5px; color: var(--ink-3); }
.safety button { font-size: 12.5px; color: var(--ink-3); }
.safety button:hover { color: var(--ink-2); }
.safety .s-dot { margin: 0 8px; }
.s-note { color: var(--ink-2); font-size: 13px; }

/* ---------- v10: the craft pass ---------- */
/* Interactions: everything that responds, responds smoothly. */
.btn, .side-write, .chip, .tchip, .contact-btn, .follow, .loadmore {
  transition: transform .12s ease, opacity .12s ease, background .15s ease,
              color .15s ease, border-color .15s ease; }
.btn:active, .side-write:active, .loadmore:active { transform: scale(.98); }
.icon-btn, .nav-item, .scope, .est, .note-like, .note-reply {
  transition: background .15s ease, color .15s ease; }
.field, .rail-search { transition: border-color .15s ease, background .15s ease; }

/* The poet's signature at the poem's foot, and a quiet ornament before the notes. */
.sig { font-family: var(--serif); font-style: italic; font-size: 17px;
  color: var(--ink-2); margin-top: 26px; }
.orn { text-align: center; color: var(--ink-3); letter-spacing: 8px;
  margin: 34px 0 4px; font-size: 13px; }

/* World thread on themed feed cells. */
.cell.tinted::before { content: ""; position: absolute; left: 0; top: 20px; bottom: 20px;
  width: 2px; border-radius: 2px; background: var(--cw); opacity: .45; }

/* Empty-state mark. */
.ce-mark { color: var(--ink-3); margin-bottom: 14px; }
.ce-mark svg { width: 26px; height: 26px; }

/* Toasts. */
.toast { position: fixed; bottom: 32px; left: 50%; transform: translate(-50%, 12px);
  background: var(--ink); color: var(--surface); font-size: 14px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px; z-index: 60; opacity: 0;
  transition: opacity .3s ease, transform .3s ease; box-shadow: 0 10px 30px var(--shadow);
  pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 720px) { .toast { bottom: 104px; } }

/* Command palette. */
#cmdk { position: fixed; inset: 0; z-index: 70; }
.ck-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px); }
.ck-card { position: relative; max-width: 560px; margin: 12vh auto 0; background: var(--raised);
  border: 1px solid var(--sep); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: ck-in .18s ease; }
@keyframes ck-in { from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; } }
.ck-input { width: 100%; padding: 18px 20px; background: none; border: 0; outline: none;
  font-size: 17px; border-bottom: 1px solid var(--hair); }
.ck-list { max-height: 320px; overflow-y: auto; padding: 8px; }
.ck-item { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.ck-item.on { background: var(--pressed); }
.ck-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-hint { flex: none; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600; }
.ck-none { padding: 22px; text-align: center; color: var(--ink-3); font-size: 14px; }
.ck-foot { padding: 10px 18px; border-top: 1px solid var(--hair); color: var(--ink-3);
  font-size: 12px; }
@media (max-width: 720px) { .ck-card { margin: 8vh 14px 0; } }

/* ---------- v11: light-mode corrections ---------- */
/* World scenes are night paintings. Under the light appearance they soften into a
   pale wash so the page's dark ink stays readable over them. */
html[data-mode="light"] .r-scene svg,
html[data-mode="light"] .room-scene svg { opacity: .18; }
html[data-mode="light"] #world-bg svg { opacity: .24; }
/* The login hero is always a night scene: it keeps its own light ink in any mode. */
.login-hero, .login-hero .login-tag { color: #F2F3F5; }
.login-hero .login-quote blockquote { color: #F2F3F5; }
.login-hero .login-quote cite, .login-hero .login-tag { color: rgba(242,243,245,.55); }
.login-hero .wordmark { color: #F2F3F5; }

/* ---------- v11: studio, pins ---------- */
.stu-tot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 20px 20px 4px; }
.stu-card { background: var(--raised); border: 1px solid var(--hair); border-radius: 16px;
  padding: 16px 14px; text-align: center; }
.stu-card b { display: block; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.stu-card span { font-size: 12px; color: var(--ink-3); }
.stu-note { color: var(--ink-2); font-size: 13.5px; padding: 12px 22px 0; }
.stu-list { padding: 14px 0 0; }
.stu-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--hair); cursor: pointer; }
.stu-row:hover { background: var(--hover); }
.stu-main { flex: 1; min-width: 0; }
.stu-title { font-family: var(--serif); font-weight: 600; font-size: 16.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stu-stats { display: flex; gap: 14px; flex: none; }
.stu-edit { color: var(--ink-3); width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; flex: none; }
.stu-edit:hover { color: var(--ink); background: var(--pressed); }
.stu-edit svg { width: 16px; height: 16px; }
@media (max-width: 560px) { .stu-tot { grid-template-columns: repeat(2, 1fr); } .stu-stats { gap: 9px; } }

.pin-flag { display: flex; align-items: center; gap: 6px; padding: 14px 20px 0;
  color: var(--ink-3); font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; }
.pin-flag svg { width: 13px; height: 13px; }

/* ---------- v12: the craft + feature pass ---------- */
/* Screen-reader-only text (unread dots, icon-only affordances). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The tender corner's framing line. */
.scope-framing { font-family: var(--serif); font-style: italic; font-size: 14.5px;
  color: var(--ink-3); padding: 14px 20px 2px; }
.cell.thought .verse { font-style: italic; color: var(--ink-2); }
.cell.thought h2 { font-size: 19px; }

/* Long verse dissolves at the clamp edge instead of being cut mid-stroke. */
.cell .verse.faded { -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 97%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 97%); }

/* A human reading, playable in the stream. */
.listen { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  font-weight: 600; color: var(--ink-2); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--sep); transition: color .15s ease, border-color .15s ease; }
.listen:hover { color: var(--ink); border-color: var(--focus); }
.listen.on { color: var(--ink); border-color: var(--ink); }
.listen svg { width: 13px; height: 13px; }

/* The reader's listening bar — the poet's voice above the verse. */
.reading-bar { display: flex; align-items: center; gap: 14px; margin: 0 0 26px;
  padding: 13px 16px; border: 1px solid var(--sep); border-radius: 16px;
  background: var(--raised); }
.reading-bar button { width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--ink); color: var(--surface); display: grid; place-items: center; }
.reading-bar button svg { width: 17px; height: 17px; }
.reading-bar .rb-t { font-size: 14px; font-weight: 600; }
.reading-bar .rb-s { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }

/* Verse lines hang: a wrapped line indents, the poet's own break does not. */
.r-verse .vln { white-space: pre-wrap; padding-left: 1.35em; text-indent: -1.35em; }
.r-verse .vgap { height: 1.1em; }

/* The reader breathes a little deeper. */
.reader { padding-top: 36px; }
.reader .sig { margin-top: 30px; }
.reader .orn { margin: 42px 0 6px; }

/* A fresh publish gets a moment. */
.live-note { border: 1px solid var(--sep); border-radius: 18px; padding: 20px 22px;
  margin-bottom: 30px; background: var(--raised); }
.live-note .ln-t { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.live-note .ln-s { color: var(--ink-2); font-size: 14px; margin: 6px 0 14px; line-height: 1.5; }

/* After the last line, the room opens. */
.aftermatter { margin-top: 40px; }
.am-h { font-family: var(--serif); font-weight: 600; font-size: 17px;
  margin: 26px 0 6px; }
.am-more { display: flex; flex-direction: column; }
.am-poem { display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  font-family: var(--serif); font-size: 16.5px; padding: 10px 0;
  border-bottom: 1px solid var(--hair); }
.am-poem:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.am-poem span { font-family: var(--sans); font-size: 12px; color: var(--ink-3); flex: none; }
.aftermatter .cell { border: 1px solid var(--hair); border-radius: 18px; margin-top: 8px; }
.aftermatter .rail-poet { padding: 8px 0; }

/* Suggestions carry a real Follow. */
.rail-poet { display: flex; gap: 10px; align-items: center; }
.rail-poet .rp-id { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 0; }
.rail-poet .rp-id > div { min-width: 0; }
.rail-poet .by-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-sm { flex: none; font-size: 12.5px; font-weight: 600; padding: 7px 14px;
  border-radius: 999px; background: var(--ink); color: var(--surface);
  transition: opacity .12s ease; }
.follow-sm:hover { opacity: .9; }
.follow-sm.on { background: transparent; color: var(--ink-2); border: 1px solid var(--sep); }

/* Sidebar identity: a person, not an email address. */
.side-me .avatar { width: 26px; height: 26px; font-size: 12px; }

/* Tag pages are places. */
.tag-hero { padding: 30px 20px 18px; border-bottom: 1px solid var(--hair); }
.tag-name { font-family: var(--serif); font-style: italic; font-size: 40px;
  font-weight: 600; letter-spacing: -.01em; line-height: 1.1; }
.tag-facts { color: var(--ink-3); font-size: 13.5px; margin-top: 10px; }
.tag-poets { display: flex; align-items: center; margin-top: 16px; }
.tag-poet .avatar { width: 32px; height: 32px; font-size: 14px;
  border: 2px solid var(--surface); }
.tag-poet { margin-right: -8px; border-radius: 50%; }
.tag-poet:hover { position: relative; z-index: 2; }
.tag-poets-note { margin-left: 18px; font-size: 12.5px; color: var(--ink-3); }
.tag-tabs { display: flex; gap: 22px; padding: 4px 20px 0; border-bottom: 1px solid var(--hair); }

/* Writing: the themes readers browse, one tap from the tag field. */
.wtag-chips { padding: 10px 0 0; }
.chip.wt { font-size: 13.5px; padding: 6px 12px; }
.chip.wt.on { color: var(--ink); border-color: var(--ink); }

/* Chat: days and runs, like a real correspondence. */
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px;
  color: var(--ink-3); font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
.bubble.run { margin-top: -4px; }
.bubble:not(.mine).run { border-top-left-radius: 16px; }
.bubble.mine.run { border-top-right-radius: 16px; }

/* Studio: a poem that hasn't been found yet waits, it doesn't read zeros. */
.stu-wait { font-family: var(--serif); font-style: italic; }

/* Explore: the poem of the day lives inside its painted world. */
.potd { position: relative; overflow: hidden; }
.potd-scene { position: absolute; inset: 0; pointer-events: none; }
.potd-scene svg { width: 100%; height: 100%; display: block; }
.potd-scene::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.38)); }
.potd-in { position: relative; z-index: 1; }

/* Mobile login keeps its persuasion. */
.m-quote { margin-bottom: 22px; }
.m-quote blockquote { font-family: var(--serif); font-style: italic; font-size: 17px;
  line-height: 1.5; white-space: pre-wrap; color: var(--ink-2); }
.m-quote cite { display: block; margin-top: 8px; color: var(--ink-3);
  font-style: normal; font-size: 12.5px; }

/* Notes composer grows with the note. */
#cinput { min-height: 48px; line-height: 1.45; }

/* Reduced motion: everything that moves, stops. */
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity .01s !important; transform: translate(-50%, 0) !important; }
  .ck-card { animation: none !important; }
  .spin { animation-duration: 1.5s !important; }
  html { scroll-behavior: auto !important; }
}
