/* The Ink and Quill — Dark Academia Theme */

/* Prefer stable system metrics until webfonts arrive (display=swap already set). */
html {
  font-synthesis: none;
}

:root {
  --app-vvh: 1vh;
  --parchment: #f4e8d0;
  --ink: #1a1410;
  --candlelight: #d4a574;
  --stone: #3d3832;
  --mahogany: #2c1810;
  --gold: #c9a227;
  --shadow: #0d0a08;
  --ember: #8b4513;
  --mist: rgba(244, 232, 208, 0.72);
  --font-display: 'Cinzel', 'Cinzel Fallback', 'Times New Roman', Times, serif;
  --font-body: 'Crimson Pro', 'Crimson Pro Fallback', 'Times New Roman', Times, serif;
  --font-accent: 'EB Garamond', 'EB Garamond Fallback', 'Times New Roman', Times, serif;
}

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

/* Custom checkboxes — gilt on ink, site-wide (overrides browser blue).
   Checkmark uses background-image (not ::before) so Safari/Firefox match Chromium. */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex-shrink: 0;
  vertical-align: middle;
  border: 1px solid rgba(201, 162, 39, 0.55);
  border-radius: 3px;
  background-color: transparent;
  background-image: linear-gradient(165deg, rgba(54, 34, 22, 0.95), rgba(22, 17, 12, 0.98));
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 1px 0 rgba(244, 232, 208, 0.06);
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
input[type="checkbox"]:hover {
  border-color: var(--candlelight);
  box-shadow:
    inset 0 1px 0 rgba(244, 232, 208, 0.1),
    0 0 0 1px rgba(212, 165, 116, 0.2);
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(212, 165, 116, 0.65);
  outline-offset: 2px;
}
input[type="checkbox"]:checked {
  border-color: var(--gold);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%231a1410' d='M6.2 11.6 2.8 8.2l1.1-1.1 2.3 2.3 5-5.1 1.1 1.1z'/%3E%3C/svg%3E"),
    linear-gradient(165deg, var(--candlelight), var(--gold));
  background-size: 0.78rem 0.78rem, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 236, 0.35),
    0 0 8px rgba(201, 162, 39, 0.25);
}
input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
input[type="checkbox"]:indeterminate {
  border-color: var(--candlelight);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='3' y='7' width='10' height='2' rx='1' fill='%23f4e8d0'/%3E%3C/svg%3E"),
    linear-gradient(165deg, rgba(212, 165, 116, 0.45), rgba(44, 24, 16, 0.9));
  background-size: 0.78rem 0.78rem, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* Gilt-on-dark scrollbars, everywhere — inherited (Firefox) or universally
   selected (WebKit/Chromium) so every scrollable panel across the site
   (feed, messenger dock, admin tables, modals, the emoji picker, etc.)
   matches the candlelit theme without needing a rule per component. A more
   specific selector elsewhere (e.g. .bookshelf-hall-track's hidden nav
   scrollbar) still wins over these on purpose. */
html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 165, 116, .55) rgba(20, 14, 10, .65);
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background: rgba(20, 14, 10, .55);
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(212, 165, 116, .6), rgba(139, 69, 19, .55));
  border: 2px solid rgba(13, 10, 8, .8);
  border-radius: 8px;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(230, 195, 150, .8), rgba(180, 100, 40, .7));
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

/* Chromium/WebKit still reserve space for the classic up/down/left/right
   arrow buttons at each end of a scrollbar even once the track/thumb are
   restyled, which is what gave scrollable panels (like the emoji picker)
   that dated, mismatched Windows-95 look. Suppress them everywhere. */
*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
/* Ambient site background — a faint damask wallpaper weave, layered
   candlelight glows (now reaching the middle of the page, not just the
   corners), a soft vignette, fine grain, and a slow breathing flicker over
   a dark base, so pages read as a lit, furnished room rather than flat
   black. Fixed pseudo-elements (not `body { background }`) so it never
   scrolls, tiles, or fights with per-page backgrounds set on children. */
body {
  margin: 0;
  background: var(--shadow);
  color: var(--parchment);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Delicate quatrefoil/diamond lattice — reads as embossed wallpaper. Must
   sit ABOVE body::before (z-index -1, not behind it): that layer's base
   vignette is fully opaque, so anything painted further back is completely
   hidden regardless of its own opacity/blend-mode. `screen`/soft-light lift
   the pale gold linework off the dark backdrop without ever competing with
   foreground text or cards. */
html::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cg fill='none' stroke='%23d4a574' stroke-width='1' stroke-opacity='0.16'%3E%3Cpath d='M85 6 L164 85 L85 164 L6 85 Z'/%3E%3Ccircle cx='85' cy='85' r='40'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 170px 170px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  animation: ambient-flicker 9s ease-in-out infinite;
  background:
    radial-gradient(ellipse 1100px 750px at 12% -8%, rgba(212, 165, 116, 0.14), transparent 55%),
    radial-gradient(ellipse 900px 650px at 92% 6%, rgba(139, 69, 19, 0.16), transparent 55%),
    radial-gradient(ellipse 1000px 700px at 8% 60%, rgba(201, 162, 39, 0.09), transparent 55%),
    radial-gradient(ellipse 950px 750px at 96% 62%, rgba(139, 69, 19, 0.12), transparent 58%),
    radial-gradient(ellipse 1500px 1000px at 50% 45%, rgba(180, 130, 70, 0.08), transparent 62%),
    radial-gradient(ellipse 1300px 850px at 50% 108%, rgba(201, 162, 39, 0.1), transparent 60%),
    radial-gradient(circle at 50% 32%, #191209 0%, #100b08 45%, #060403 100%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* A very slow, subtle breathing glow — like candlelight, not a strobe. */
@keyframes ambient-flicker {
  0%, 100% { opacity: 1; }
  45% { opacity: 0.88; }
  60% { opacity: 1; }
  78% { opacity: 0.93; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}
main { flex: 1; position: relative; z-index: 0; }
a { color: var(--candlelight); }
img, video { max-width: 100%; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.section { padding: 3rem 0; }
.section-narrow { max-width: 520px; margin: 0 auto; }
/* Feed column: wider than section-narrow so poem line breaks stay intact. */
.section-feed { max-width: 52rem; margin: 0 auto; }
.text-center { text-align: center; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 999; background: var(--gold); color: var(--ink); padding: .5rem 1rem; }

/* Typography */
h1, h2, h3, .section-title { font-family: var(--font-display); color: var(--candlelight); font-weight: 600; }
.section-title { font-size: clamp(1.75rem, 4vw, 2.5rem); letter-spacing: .05em; }
.subtitle { font-family: var(--font-accent); font-style: italic; color: var(--mist); }
.hint { font-size: .85rem; color: var(--mist); }
.link-gold { color: var(--gold); text-decoration: none; }
.link-gold:hover { color: var(--candlelight); }

/* Buttons & inputs */
.btn, .btn-ghost {
  display: inline-block; padding: .75rem 1.5rem; font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: .08em; font-size: .8rem;
  border-radius: 4px; cursor: pointer; text-decoration: none; border: 1px solid var(--candlelight);
  transition: all .3s;
  /* Faster taps / no double-tap-zoom delay on iOS Safari. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(212, 165, 116, 0.22);
}
/* Author display above defeats the UA [hidden] { display: none } rule. */
.btn[hidden],
.btn-ghost[hidden] {
  display: none !important;
}
.btn {
  background: linear-gradient(to bottom, var(--ember), var(--mahogany));
  color: var(--parchment);
  box-shadow: 0 0 20px rgba(212,165,116,.25);
}
.btn:hover { background: linear-gradient(to bottom, var(--candlelight), var(--ember)); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--candlelight); }
.btn-ghost:hover { background: rgba(212,165,116,.1); }
.btn-danger { background: linear-gradient(to bottom, #8b2c1a, #4a1510); box-shadow: 0 0 20px rgba(178,58,34,.25); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: .5rem 1rem; font-size: .7rem; }
.input-sm { padding: .4rem .6rem; font-size: .85rem; width: auto; display: inline-block; }
.input, select.input, textarea.input {
  width: 100%; padding: .75rem 1rem; background: rgba(13,10,8,.6);
  border: 1px solid var(--stone); border-radius: 4px; color: var(--parchment);
  font-family: var(--font-accent); margin-bottom: .75rem;
}
.input:focus { outline: 2px solid var(--gold); border-color: var(--candlelight); }

/* Number fields — keep steppers, but paint them in the gilt palette
   instead of the browser's default light arrows on dark inputs. */
input.input[type="number"] {
  color-scheme: dark;
  padding-right: 0.55rem;
}
input.input[type="number"]::-webkit-outer-spin-button,
input.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: inner-spin-button;
  appearance: auto;
  opacity: 1;
  margin: 0 0 0 0.35rem;
  height: 1.65em;
  width: 1.05em;
  cursor: pointer;
  /* Map the light system glyph toward candle/gold without custom SVG buttons. */
  filter: invert(0.82) sepia(0.55) saturate(2.4) hue-rotate(350deg) brightness(0.95);
}
input.input[type="number"]::-webkit-inner-spin-button:hover {
  filter: invert(0.9) sepia(0.45) saturate(2.8) hue-rotate(348deg) brightness(1.05);
}

/* Native selects — closed field + open list stay on the dark gilt theme.
   color-scheme: dark keeps OS pickers from flashing a cream/blue system menu. */
select.input,
select.ink-input,
select.works-sort-select,
select.writing-focus-select,
select.tome-share-select,
select.notes-scope-select,
select.report-reason-select,
select.page-paper-select,
select.color-harmony-select,
.studio-craft-panel select,
.writing-rail-panel select,
.writing-rail-panel select.ink-input,
.immersive-editor-toolbar select,
.immersive-editor-toolbar select.ink-input,
.studio-move-work select,
.studio-collab-invite-row select,
.help-bug-form select,
.help-bug-field select,
form select:not([multiple]):not(.studio-craft-select__native) {
  color-scheme: dark;
  -webkit-appearance: none;
  appearance: none;
  background-color: rgba(13, 10, 8, 0.92) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 L6 6.5 L11 1.5' fill='none' stroke='%23d4a574' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.65rem center !important;
  background-size: 0.75rem !important;
  padding-right: 1.85rem;
  color: var(--parchment, #f4e8d0);
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 4px;
  cursor: pointer;
}

select.input:hover,
select.ink-input:hover,
select.works-sort-select:hover,
select.writing-focus-select:hover,
select.tome-share-select:hover,
select.notes-scope-select:hover,
select.report-reason-select:hover,
select.page-paper-select:hover,
select.color-harmony-select:hover,
.studio-craft-panel select:hover,
.writing-rail-panel select:hover,
.immersive-editor-toolbar select:hover,
.studio-move-work select:hover,
.studio-collab-invite-row select:hover,
.help-bug-form select:hover,
.help-bug-field select:hover,
form select:not([multiple]):not(.studio-craft-select__native):hover {
  border-color: rgba(212, 165, 116, 0.6);
}

select.input:focus,
select.ink-input:focus,
select.works-sort-select:focus,
select.writing-focus-select:focus,
select.tome-share-select:focus,
select.notes-scope-select:focus,
select.report-reason-select:focus,
select.page-paper-select:focus,
select.color-harmony-select:focus,
.studio-craft-panel select:focus,
.writing-rail-panel select:focus,
.immersive-editor-toolbar select:focus,
.studio-move-work select:focus,
.studio-collab-invite-row select:focus,
.help-bug-form select:focus,
.help-bug-field select:focus,
form select:not([multiple]):not(.studio-craft-select__native):focus {
  outline: none;
  border-color: rgba(212, 165, 116, 0.75);
  box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.22);
}

/* Open list / options — parchment on ink, gilt highlight (where the browser allows). */
select.input option,
select.ink-input option,
select.works-sort-select option,
select.writing-focus-select option,
select.tome-share-select option,
select.notes-scope-select option,
select.report-reason-select option,
select.page-paper-select option,
select.color-harmony-select option,
.studio-craft-panel select option,
.writing-rail-panel select option,
.immersive-editor-toolbar select option,
.studio-move-work select option,
.studio-collab-invite-row select option,
.help-bug-form select option,
.help-bug-field select option,
form select:not([multiple]):not(.studio-craft-select__native) option,
#writing-font-select option {
  color: var(--parchment, #f4e8d0);
  background-color: #1a1410;
}

select.input option:checked,
select.ink-input option:checked,
select.works-sort-select option:checked,
select.writing-focus-select option:checked,
select.tome-share-select option:checked,
select.notes-scope-select option:checked,
select.report-reason-select option:checked,
select.page-paper-select option:checked,
select.color-harmony-select option:checked,
.studio-craft-panel select option:checked,
.writing-rail-panel select option:checked,
.immersive-editor-toolbar select option:checked,
.studio-move-work select option:checked,
.studio-collab-invite-row select option:checked,
.help-bug-form select option:checked,
.help-bug-field select option:checked,
form select:not([multiple]):not(.studio-craft-select__native) option:checked,
#writing-font-select option:checked {
  color: #1a1410;
  background-color: var(--candlelight, #d4a574);
}

select.input option:hover,
select.ink-input option:hover,
select.works-sort-select option:hover,
select.writing-focus-select option:hover,
select.tome-share-select option:hover,
select.notes-scope-select option:hover,
select.report-reason-select option:hover,
select.page-paper-select option:hover,
select.color-harmony-select option:hover,
.studio-craft-panel select option:hover,
.writing-rail-panel select option:hover,
.immersive-editor-toolbar select option:hover,
.studio-move-work select option:hover,
.studio-collab-invite-row select option:hover,
.help-bug-form select option:hover,
.help-bug-field select option:hover,
form select:not([multiple]):not(.studio-craft-select__native) option:hover,
#writing-font-select option:hover {
  color: #1a1410;
  background-color: rgba(212, 165, 116, 0.85);
}

/* Compact selects keep a tighter chevron inset. */
select.works-sort-select,
select.writing-focus-select,
select.tome-share-select {
  background-position: right 0.35rem center !important;
  padding-right: 1.35rem;
}

/* Custom themed dropdown — replaces the OS popup (cream/blue on Windows). */
.ink-select {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ink-select:has(select.ink-input),
.ink-select:has(select.input) {
  margin-bottom: 0.75rem;
}

.writing-rail-panel .ink-select,
.immersive-editor-toolbar .ink-select,
.studio-collab-invite-row .ink-select,
.ink-select--compact {
  margin-bottom: 0;
}

.ink-select--inline {
  display: inline-block;
  width: auto;
  vertical-align: middle;
}

.ink-select__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.ink-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.75rem 1rem;
  padding-right: 1.85rem;
  background: rgba(13, 10, 8, 0.92);
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 4px;
  color: var(--parchment, #f4e8d0);
  font: inherit;
  font-family: var(--font-accent, Georgia, serif);
  text-align: left;
  cursor: pointer;
  appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(212, 165, 116, 0.22);
}

.ink-select__trigger:hover {
  border-color: rgba(212, 165, 116, 0.6);
}

.ink-select__trigger:focus,
.ink-select__trigger:focus-visible {
  outline: none;
  border-color: rgba(212, 165, 116, 0.75);
  box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.22);
}

.ink-select__trigger::after {
  content: '';
  position: absolute;
  right: 0.65rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--candlelight, #d4a574);
  border-bottom: 1.5px solid var(--candlelight, #d4a574);
  transform: translateY(-65%) rotate(45deg);
  opacity: 0.95;
  pointer-events: none;
}

.ink-select.is-open .ink-select__trigger::after {
  transform: translateY(-20%) rotate(225deg);
}

.ink-select__trigger {
  position: relative;
}

.ink-select__label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.ink-select__list {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #1a1410;
  border: 1px solid rgba(212, 165, 116, 0.55);
  border-radius: 4px;
  max-height: 16rem;
  overflow: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.ink-select__list[hidden] {
  display: none !important;
}

.ink-select__option {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--parchment, #f4e8d0);
  font: inherit;
  font-family: var(--font-accent, Georgia, serif);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(212, 165, 116, 0.22);
}

.ink-select__option:hover,
.ink-select__option:focus-visible {
  background: rgba(212, 165, 116, 0.28);
  color: #fffaf0;
  outline: none;
}

.ink-select__option[aria-selected="true"] {
  background: var(--candlelight, #d4a574);
  color: #1a1410;
}

.ink-select__option[aria-selected="true"]:hover,
.ink-select__option[aria-selected="true"]:focus-visible {
  background: #e0c089;
  color: #1a1410;
}

.ink-select--compact {
  width: auto;
  min-width: 0;
}

.ink-select--compact .ink-select__trigger {
  padding: 0.2rem 0.35rem;
  padding-right: 1.35rem;
  font-size: 0.78rem;
  background: rgba(8, 5, 3, 0.75);
  color: var(--candlelight, #e8d5b5);
}

.ink-select--compact .ink-select__trigger::after {
  right: 0.35rem;
}

.writing-rail-panel .ink-select .ink-select__trigger,
.immersive-editor-toolbar .ink-select .ink-select__trigger {
  background: rgba(8, 5, 3, 0.55);
  border-color: rgba(212, 165, 116, 0.28);
  padding: 0.45rem 0.65rem;
  padding-right: 1.7rem;
  margin-bottom: 0;
}

.studio-collab-invite-row .ink-select {
  flex: 1;
  min-width: 8rem;
}

.label { display: block; color: var(--candlelight); font-size: .85rem; margin-bottom: .35rem; font-family: var(--font-accent); }
.ink-label {
  display: block;
  color: rgba(212, 165, 116, 0.9);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  font-family: var(--font-accent);
  letter-spacing: 0.03em;
}
.ink-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(13, 10, 8, 0.55);
  border: 1px solid rgba(61, 56, 50, 0.7);
  border-radius: 4px;
  color: var(--parchment);
  font-family: var(--font-accent);
  margin-bottom: 0.75rem;
  transition: border-color 0.2s, background 0.2s;
}
.ink-input:focus {
  outline: none;
  border-color: rgba(212, 165, 116, 0.6);
  box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.2);
}
.ink-input[type="date"] { color-scheme: dark; }

.password-field {
  position: relative;
  margin-bottom: 0.75rem;
}

.password-field > .ink-input,
.password-field > .input {
  margin-bottom: 0;
  padding-right: 4.5rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  /* WCAG 2.2 / Lighthouse target-size: at least 24×24px hit area */
  width: auto;
  min-width: 2.75rem;
  height: 28px;
  min-height: 28px;
  background: transparent;
  border: none;
  color: var(--candlelight);
  font-family: var(--font-accent);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0 0.55rem;
  line-height: 1;
  z-index: 1;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--gold);
  outline: none;
}

.error { color: #f87171; text-align: center; }
.error--list {
  text-align: left;
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 8px;
  background: rgba(80, 16, 16, 0.45);
}
.error--list .error-lead {
  margin: 0 0 0.35rem;
  font-weight: 600;
}
.error--list .error-list {
  margin: 0;
  padding-left: 1.15rem;
}
.error--list .error-list li {
  margin: 0.15rem 0;
}
.success { color: #86efac; text-align: center; margin-bottom: 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Honeypot field for bot signups — off-screen, not just visually hidden, so simple bots that ignore CSS still fill it in. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.signup-turnstile {
  display: flex;
  justify-content: center;
  margin: 0.85rem 0 0.35rem;
  min-height: 65px;
  /* Challenges render in a portal; don't clip the widget in the door card. */
  overflow: visible;
  position: relative;
  z-index: 2;
}

.signup-turnstile .cf-turnstile {
  width: 100%;
  max-width: 100%;
}

/* Cards */
.card {
  background:
    linear-gradient(160deg, rgba(255, 241, 224, 0.05), transparent 45%),
    linear-gradient(165deg, rgba(58, 34, 22, 0.9), rgba(36, 20, 13, 0.9));
  border: 1px solid rgba(212,165,116,.22);
  border-radius: 8px; padding: 1.5rem; backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.candle-glow { box-shadow: 0 0 20px rgba(212,165,116,.3), inset 0 1px 0 rgba(244,232,208,.1); }
.grid-2 { display: grid; gap: 1.5rem; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr 1fr; } }

/* Header & footer */
.site-header {
  background: linear-gradient(180deg, rgba(52, 30, 20, 0.94), rgba(36, 20, 13, 0.94));
  border-bottom: 1px solid rgba(212, 165, 116, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; flex-wrap: wrap; gap: .5rem; }
.logo { display: inline-flex; align-items: center; text-decoration: none; }
.logo picture { display: contents; }
.logo-img { height: 48px; width: auto; display: block; }

/* The bookshelf hall packs a lot of chrome above an already-tall bookcase
   (nav, section tabs, heading, sort controls) — trim the header itself a
   little on that one page so more of the shelves fit without scrolling. */
.page-bookshelf-hall .header-inner {
  padding: .4rem 1rem;
}
.page-bookshelf-hall .logo-img {
  height: 36px;
}
.main-nav { display: flex; gap: 1.25rem; }
.main-nav a { color: rgba(244,232,208,.8); text-decoration: none; font-family: var(--font-accent); }
.main-nav a:hover { color: var(--candlelight); }
.nav-gold { color: var(--gold) !important; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.logout-form { margin: 0; display: inline-flex; }
.user-name { font-size: .85rem; color: var(--mist); }
.site-footer {
  background: linear-gradient(180deg, rgba(30, 17, 11, 0.7), rgba(20, 12, 8, 0.9));
  border-top: 1px solid rgba(212, 165, 116, 0.18);
  margin-top: auto;
  padding: 1.25rem 0 .6rem;
  font-size: .9rem;
  line-height: 1.45;
}
.footer-grid { display: grid; gap: 1.25rem 1.5rem; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.5fr; } }
.site-footer h2, .site-footer h3,
.site-footer .footer-brand-title, .site-footer .footer-col-title {
  font-family: var(--font-display);
  color: var(--candlelight);
  margin: 0 0 .35rem;
  font-size: .95rem;
  letter-spacing: .04em;
}
.site-footer h2, .site-footer .footer-brand-title { font-size: 1.05rem; }
.site-footer p { margin: 0 0 .35rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .25rem; }
.site-footer li:last-child { margin-bottom: 0; }
.site-footer a { color: var(--mist); text-decoration: none; }
.footer-bottom {
  text-align: center;
  font-size: .7rem;
  color: var(--mist);
  margin-top: 1rem;
  padding-top: .6rem;
  border-top: 1px solid rgba(61,56,50,.3);
}

/* Hero */
.hero { position: relative; min-height: 85vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  background-color: #0d0a08;
  background-image:
    radial-gradient(ellipse 900px 600px at 20% 10%, rgba(212, 165, 116, 0.16), transparent 55%),
    radial-gradient(ellipse 800px 550px at 85% 20%, rgba(139, 69, 19, 0.18), transparent 55%),
    radial-gradient(ellipse 1000px 700px at 50% 100%, rgba(201, 162, 39, 0.12), transparent 60%),
    linear-gradient(165deg, #1e150e 0%, #100b08 45%, #050403 100%);
}
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(13,10,8,.55), rgba(13,10,8,.35), var(--shadow)); }
.hero-content { position: relative; text-align: center; max-width: 46rem; padding: 2rem; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4rem); letter-spacing: .1em; }
.hero-tagline { font-family: var(--font-accent); font-style: italic; font-size: 1.25rem; }
.hero-desc { color: var(--mist); }
.hero-offer {
  margin: 0.85rem 0 0;
  color: var(--parchment, #f4ece0);
  font-size: 1.02rem;
  line-height: 1.5;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-signin { text-align: center; margin-top: 1rem; }
.hero-signin a { color: var(--gold); }
.hero-emoji { font-size: 3rem; }
.page-hero {
  padding: 3rem 0;
  border-bottom: 1px solid rgba(212, 165, 116, 0.15);
  background:
    radial-gradient(ellipse 900px 400px at 50% -30%, rgba(212, 165, 116, 0.12), transparent 65%),
    linear-gradient(180deg, rgba(52, 30, 20, 0.4), rgba(30, 17, 11, 0.25));
}
.section-alt {
  background: linear-gradient(180deg, rgba(52, 30, 20, 0.35), rgba(30, 17, 11, 0.35));
  border-block: 1px solid rgba(212, 165, 116, 0.12);
}
.tags { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.tag { padding: .4rem 1rem; border: 1px solid rgba(61,56,50,.4); border-radius: 999px; font-family: var(--font-accent); font-size: .85rem; }
.writer-kinds {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  align-items: center;
  max-width: 42rem;
  margin: 0 auto;
}
.writer-kinds-group { width: 100%; }
.writer-kinds-label {
  margin: 0 0 .65rem;
  font-family: var(--font-accent);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--candlelight, #d4a574);
}
.tag--available {
  border-color: rgba(212, 165, 116, 0.45);
  color: var(--parchment, #f4ece0);
  background: rgba(212, 165, 116, 0.08);
}
.tag--soon {
  border-style: dashed;
  border-color: rgba(139, 115, 85, 0.35);
  color: rgba(244, 236, 224, 0.55);
  background: transparent;
}
.writer-kinds-soon {
  margin: 1.35rem auto 0;
  max-width: 32rem;
  font-size: 0.85rem;
  color: rgba(244, 236, 224, 0.5);
}
.card-icon { font-size: 2rem; }

/* Home — Inside the Scriptorium peeks */
.home-peeks-intro {
  max-width: 36rem;
  margin: 0 auto 1.75rem;
}
.home-peeks-lead {
  margin: 0.35rem 0 0;
  color: var(--mist, #c4b8a8);
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.45;
}
.home-peeks-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .home-peeks-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem 1.5rem;
  }
}
.home-peek {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}
.home-peek-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(212, 165, 116, 0.28);
  box-shadow:
    0 0 0 1px rgba(13, 10, 8, 0.55),
    0 18px 40px rgba(0, 0, 0, 0.35);
  background: #0d0a08;
  aspect-ratio: 16 / 9;
}
.home-peek-zoom {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  color: inherit;
  font: inherit;
  position: relative;
}
.home-peek-zoom:focus-visible {
  outline: 2px solid var(--candlelight, #d4a574);
  outline-offset: -2px;
}
.home-peek-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.35s ease;
}
.home-peek-zoom:hover img,
.home-peek-zoom:focus-visible img {
  transform: scale(1.03);
}
.home-peek-zoom-hint {
  position: absolute;
  right: 0.65rem;
  bottom: 0.55rem;
  padding: 0.28rem 0.55rem;
  border-radius: 2px;
  border: 1px solid rgba(212, 165, 116, 0.45);
  background: rgba(13, 10, 8, 0.78);
  color: var(--candlelight, #d4a574);
  font-family: var(--font-display, Cinzel, serif);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(0.2rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.home-peek-zoom:hover .home-peek-zoom-hint,
.home-peek-zoom:focus-visible .home-peek-zoom-hint {
  opacity: 1;
  transform: translateY(0);
}
.home-peek-title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--candlelight, #d4a574);
}
.home-peek-caption {
  margin: 0.25rem 0 0;
  color: var(--mist, #c4b8a8);
  font-size: 0.95rem;
  line-height: 1.45;
}
.home-peeks-cta {
  margin-top: 2rem;
}
.home-peeks-more {
  margin-top: 1.75rem;
}
.home-family-note {
  margin: 0.75rem 0 0.65rem;
}
.home-family-note a { color: var(--gold); }
.home-trust-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  max-width: 64rem;
  margin: 0 auto;
}
.home-trust-item h3 {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
  letter-spacing: 0.04em;
  color: var(--candlelight, #d4a574);
}
.home-trust-item p {
  margin: 0;
  color: var(--mist, #c4b8a8);
  font-size: 0.95rem;
  line-height: 1.45;
}
.home-close-card {
  max-width: 36rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
}
.home-close-card .section-title {
  margin-bottom: 0.4rem;
}
.home-close-lead {
  margin: 0 0 1.25rem;
  color: var(--mist, #c4b8a8);
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.45;
}
@media (min-width: 768px) {
  .home-trust-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
@media (min-width: 960px) {
  .home-peeks-grid--three,
  .home-peeks-more {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Home peek lightbox — full image for detail reading */
.home-peek-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  box-sizing: border-box;
}
.home-peek-lightbox[hidden] {
  display: none !important;
}
.home-peek-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 4, 0.88);
  border: 0;
  padding: 0;
  cursor: zoom-out;
}
.home-peek-lightbox__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: min(96vw, 72rem);
  max-height: min(94vh, 100%);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.home-peek-lightbox__img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: calc(94vh - 4.5rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(212, 165, 116, 0.35);
  box-shadow:
    0 0 0 1px rgba(13, 10, 8, 0.7),
    0 24px 64px rgba(0, 0, 0, 0.55);
  background: #0d0a08;
}
.home-peek-lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(94vh - 4.5rem);
  object-fit: contain;
}
.home-peek-lightbox__caption {
  margin: 0;
  max-width: 40rem;
  text-align: center;
  color: rgba(244, 232, 208, 0.92);
  font-family: var(--font-display, Cinzel, serif);
  font-size: 1rem;
  letter-spacing: 0.04em;
}
.home-peek-lightbox__close {
  position: absolute;
  top: max(0.65rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(212, 165, 116, 0.45);
  border-radius: 2px;
  background: rgba(13, 10, 8, 0.85);
  color: var(--candlelight, #d4a574);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.home-peek-lightbox__close:hover,
.home-peek-lightbox__close:focus-visible {
  border-color: var(--candlelight, #d4a574);
  color: #f4e8d0;
  outline: none;
}
body.home-peek-lightbox-open {
  overflow: hidden;
}

@media (max-width: 959px) {
  .hero-offer {
    font-size: 0.95rem;
  }
  .home-trust-item h3 {
    font-size: 1.02rem;
  }
  .home-close-card {
    padding: 1.4rem 1.1rem;
  }
  .home-close-lead {
    font-size: 0.98rem;
  }
  .home-peeks-intro {
    margin-bottom: 1.25rem;
    padding: 0 0.15rem;
  }
  .home-peeks-lead {
    font-size: 0.98rem;
  }
  .home-peeks-grid {
    gap: 1.35rem;
  }
  .home-peek-title {
    font-size: 1.05rem;
  }
  .home-peek-caption {
    font-size: 0.92rem;
  }
  /* Always show the affordance on touch — hover is unreliable. */
  .home-peek-zoom-hint {
    opacity: 0.95;
    transform: none;
  }
  .home-peek-lightbox {
    padding: max(0.65rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) max(0.65rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
  }
  .home-peek-lightbox__img-wrap,
  .home-peek-lightbox__img {
    max-height: calc(100dvh - 5.5rem);
  }
  .home-peek-lightbox__caption {
    font-size: 0.92rem;
    padding: 0 0.35rem;
  }
}

@media (max-width: 480px) {
  .home-peek-frame {
    aspect-ratio: 4 / 3;
  }
  .home-peeks-cta {
    margin-top: 1.5rem;
  }
  .home-peek-zoom-hint {
    font-size: 0.62rem;
    right: 0.45rem;
    bottom: 0.4rem;
    padding: 0.22rem 0.42rem;
  }
}

/* Auth / Portal */
.page-auth { overflow: hidden; }
.page-auth main { padding: 0; }

.auth-page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}

.auth-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  z-index: 0;
  background: #0a0705 linear-gradient(180deg, #1a120c 0%, #0a0705 55%, #050403 100%);
}

.auth-video.auth-video--failed {
  display: none;
}

.auth-page:has(.auth-video--failed),
.auth-page.auth-page--video-failed,
.auth-page:not(:has(.auth-video[data-src])):not(:has(.auth-video source)) {
  background: #0a0705 linear-gradient(180deg, #1a120c 0%, #0a0705 55%, #050403 100%);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, rgba(13,10,8,.35), transparent, rgba(13,10,8,.6));
  z-index: 1;
  pointer-events: none;
}

/* Sized and positioned to cover the door in the video */
.auth-door-zone {
  position: fixed;
  top: 45%;
  left: 61%;
  transform: translate(-50%, -50%);
  width: clamp(300px, 23vw, 420px);
  aspect-ratio: 3 / 4.1;
  max-height: 68vh;
  z-index: 10;
}

.door-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 25px;
  overflow: hidden;
  box-shadow: 20px 20px 50px rgba(0, 0, 0, 1);
}

.door-light {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(to top, rgba(200, 220, 255, 0.8), transparent);
  transition: height 1s, opacity 1s;
  pointer-events: none;
  z-index: 2;
}

.door-light.open {
  height: 100%;
  opacity: 0.6;
}

.portal-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 25px;
  z-index: 5;
}

.portal-video.hidden { display: none; }

/* Literary-style frosted glass — fills the entire door */
.auth-form-wrap {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 1.35rem 1.15rem;
  color: rgba(245, 245, 245, 0.863);
  border-top: 2px solid rgba(238, 228, 228, 1);
  border-radius: 25px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 20px 20px 50px rgba(0, 0, 0, 1);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
  transition: opacity 0.8s ease, transform 0.8s ease;
  overflow: hidden;
}

.auth-form-wrap.hidden {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

.auth-card {
  width: 100%;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  text-align: center;
}

/* Desktop login: door shrinks to the form — no empty glass tower, no scroll.
   Prefer .auth-door-zone--login (from PHP) so this doesn't depend on :has(). */
@media (min-width: 960px) {
  .auth-door-zone--login,
  .auth-door-zone:has(.auth-card--login) {
    top: 50%;
    width: clamp(340px, 24vw, 400px);
    aspect-ratio: auto;
    height: fit-content;
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .auth-door-zone--login .door-frame,
  .auth-door-zone:has(.auth-card--login) .door-frame {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .auth-door-zone--login .auth-form-wrap,
  .auth-door-zone:has(.auth-card--login) .auth-form-wrap {
    position: relative;
    inset: auto;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0.75rem 1.15rem 0.8rem;
    justify-content: flex-start;
    overflow: visible;
  }

  .auth-card--login {
    overflow: visible;
    max-height: none;
    min-height: 0;
  }

  .auth-card--login h1 {
    font-size: clamp(1.45rem, 2.4vw, 1.9rem);
    line-height: 1.15;
    margin-bottom: 0.15rem;
  }

  .auth-card--login .subtitle {
    margin-bottom: 0.45rem;
  }

  .auth-card--login .ink-label {
    margin-bottom: 0.1rem;
  }

  .auth-page .auth-card--login .ink-input {
    margin-bottom: 0.3rem;
    padding: 7px 10px;
  }

  .auth-card--login form .hint:not(.auth-forgot-link) {
    margin: 0.05rem 0 0.25rem;
    font-size: 0.76rem;
  }

  .auth-card--login .btn.btn-block {
    margin-top: 0.2rem;
    padding: 0.5rem 1.75rem;
  }

  .auth-card--login .auth-forgot-link {
    margin: 0.25rem 0 0.05rem;
  }

  .auth-card--login .switch-mode {
    margin-top: 0.25rem;
  }

  .auth-card--login .auth-academy-link {
    margin-top: 0.35rem;
    padding-top: 0.3rem;
    padding-bottom: 0;
  }
}

.auth-card--signup {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.auth-card h1,
.auth-card h2 {
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: rgba(245, 245, 245, 0.863);
  letter-spacing: 0.08em;
  margin: 0 0 0.35rem;
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
}

.auth-card .subtitle {
  text-align: center;
  margin-bottom: 1.25rem;
  color: rgba(245, 245, 245, 0.863);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
}

.auth-page .ink-label {
  color: rgba(245, 245, 245, 0.863);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
  text-align: left;
}

.auth-page .ink-input {
  width: 100%;
  margin: 0 auto 0.85rem;
  padding: 10px;
  text-align: center;
  background: linear-gradient(
    54deg,
    rgba(196, 145, 123, 1) 7%,
    rgba(94, 59, 33, 1) 42%,
    rgba(94, 59, 33, 1) 69%,
    rgba(94, 59, 33, 1) 100%
  );
  border: 1px solid rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  color: rgba(245, 245, 245, 0.863);
  font-size: 1.0625rem;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.auth-page .ink-input::placeholder {
  color: rgba(245, 245, 245, 0.863);
}

.auth-page .ink-input:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.6);
  color: rgb(227, 184, 75);
}

.auth-page .btn {
  margin-top: 0.5rem;
  padding: 0.65rem 2rem;
  border-radius: 25px;
  border: 1px solid #000;
  background: linear-gradient(
    54deg,
    rgba(196, 145, 123, 1) 7%,
    rgba(94, 59, 33, 1) 42%,
    rgba(94, 59, 33, 1) 69%,
    rgba(94, 59, 33, 1) 100%
  );
  color: rgba(245, 245, 245, 0.863);
  box-shadow: none;
}

.auth-page .btn:hover {
  color: rgb(227, 184, 75);
  background: linear-gradient(
    54deg,
    rgba(196, 145, 123, 1) 7%,
    rgba(94, 59, 33, 1) 42%,
    rgba(94, 59, 33, 1) 69%,
    rgba(94, 59, 33, 1) 100%
  );
  transition-duration: 1s;
}

.auth-page .hint {
  color: rgba(245, 245, 245, 0.863);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
}

.auth-handle-preview {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.8rem;
  text-align: left;
}

.auth-forgot-link {
  margin: 0.55rem 0 0.35rem;
  text-align: right;
}
.auth-forgot-link a {
  color: var(--candlelight);
}
.auth-forgot-link a:hover {
  color: var(--gold);
}

.auth-handle-preview span {
  color: rgb(227, 184, 75);
}

.auth-author-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  text-align: left;
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
}

.auth-author-option input {
  margin-top: 0.2rem;
}

.family-members-panel {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(238, 228, 228, 0.35);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
  text-align: left;
}

.family-members-panel summary {
  cursor: pointer;
  color: rgba(245, 245, 245, 0.863);
  font-size: 0.9rem;
  list-style: none;
}

.family-members-panel summary::-webkit-details-marker {
  display: none;
}

.family-members-intro {
  margin: 0.75rem 0 1rem;
  font-size: 0.8rem;
}

.account-family-roster {
  margin: 0 0 1.5rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}

.account-family-roster-lead {
  margin: 0 0 1rem;
}

.account-family-empty {
  margin: 0.5rem 0 0;
}

.account-family-add {
  margin-top: 0.25rem;
}

.family-member-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.5rem;
}

.family-access-badge {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 165, 116, 0.35);
  color: var(--gold);
}

.family-access-badge--scriptorium {
  border-color: rgba(201, 162, 39, 0.55);
  color: var(--candlelight);
}

.family-access-badge--spouse {
  border-color: rgba(180, 200, 220, 0.45);
  color: #d8e8f4;
}

.family-member-row--spouse {
  padding-bottom: 0.85rem;
}

.family-member-draft {
  margin: 0.75rem 0 1rem;
  padding: 1rem 0 0.25rem;
  border-top: 1px solid rgba(212, 165, 116, 0.2);
}

.family-member-draft .family-member-label {
  margin-top: 0;
}

.account-family-spouse-form {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}

.family-member-row {
  padding: 0.75rem 0;
  border-top: 1px solid rgba(238, 228, 228, 0.2);
}

.family-member-row:first-of-type {
  border-top: 0;
}

.family-member-label {
  font-family: var(--font-accent);
  color: rgb(227, 184, 75);
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}

#add-family-member {
  margin-top: 0.5rem;
}

.account-page .section-title {
  text-align: center;
}

.account-page .subtitle {
  text-align: center;
  margin-bottom: 2rem;
}

.account-tabs-shell {
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.account-tabs-shell .account-card {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
  padding: 0.35rem;
  border: 1px solid rgba(212, 165, 116, 0.22);
  border-radius: 8px;
  background: rgba(13, 10, 8, 0.45);
}

.account-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--mist, #c9b8a0);
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 0.85rem;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.account-tab:hover {
  color: var(--candlelight);
  background: rgba(212, 165, 116, 0.08);
}

.account-tab.is-active,
.account-tab[aria-selected="true"] {
  color: var(--parchment, #f4e8d0);
  background: linear-gradient(160deg, rgba(70, 42, 28, 0.9), rgba(36, 22, 16, 0.95));
  border-color: rgba(212, 165, 116, 0.4);
  box-shadow: inset 0 1px 0 rgba(244, 232, 208, 0.06);
}

.account-tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.account-tab-panel[hidden] {
  display: none !important;
}

.account-card {
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.account-card h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--candlelight);
  margin: 0 0 1rem;
}

.account-details {
  margin: 0;
}

.account-details > div {
  margin-bottom: 0.75rem;
}

.account-details dt {
  font-family: var(--font-accent);
  font-size: 0.85rem;
  color: var(--mist);
  margin-bottom: 0.15rem;
}

.account-details dd {
  margin: 0;
  font-size: 1rem;
}

.account-details--spaced {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(201, 162, 39, 0.15);
}

.account-profile-form {
  margin-bottom: 0;
}

.account-name-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 480px) {
  .account-name-fields {
    grid-template-columns: 1fr;
  }
}

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

.account-avatar-actions {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.account-avatar-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
}

.account-avatar-form input[type="file"] {
  color: var(--parchment);
  font-size: 0.85rem;
  max-width: 100%;
}

.account-avatar-form .hint {
  margin: 0;
}

.family-members-existing {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}

.family-members-existing li {
  padding: 0.5rem 0;
  border-top: 1px solid rgba(212, 165, 116, 0.1);
}

.account-family-form {
  margin-top: 1rem;
}

.account-family-submit {
  margin-top: 1rem;
}

.admin-page .section-title,
.admin-page .subtitle {
  text-align: center;
}

.admin-tabs-shell {
  max-width: 960px;
}

.admin-tabs-shell .account-card {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.admin-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  color: var(--parchment, #f4e8d0);
  background: rgba(180, 70, 50, 0.85);
}

.admin-tab-badge--warn {
  background: rgba(200, 140, 40, 0.9);
  color: #1a120c;
}

.account-tab.is-active .admin-tab-badge,
.account-tab[aria-selected="true"] .admin-tab-badge {
  box-shadow: 0 0 0 1px rgba(244, 232, 208, 0.15);
}

.admin-stats {
  max-width: 900px;
  margin: 0 auto 1.5rem;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.75rem;
  max-width: 960px;
  margin: 0 auto 1.25rem;
}

.admin-stats-heading {
  font-family: var(--font-display);
  color: var(--candlelight);
  font-size: 1.05rem;
  text-align: center;
  margin: 1.75rem 0 0.85rem;
}

.admin-stats-member-link {
  margin-bottom: 0.5rem;
}

.admin-moderation-section {
  scroll-margin-top: 5rem;
}

.admin-card--highlight {
  border-color: rgba(212, 165, 116, 0.45);
  background: linear-gradient(145deg, rgba(44, 24, 16, 0.55), rgba(26, 20, 16, 0.85));
}

.admin-stat {
  text-align: center;
  padding: 1.25rem 1rem;
}

.admin-stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--gold);
  margin: 0 0 0.25rem;
}

a.admin-stat--link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

a.admin-stat--link:hover,
a.admin-stat--link:focus-visible {
  border-color: rgba(212, 165, 116, 0.55);
  outline: none;
}

a.admin-stat--link:hover .admin-stat-drill,
a.admin-stat--link:focus-visible .admin-stat-drill {
  color: var(--candlelight);
}

.admin-stat--active {
  border-color: rgba(212, 165, 116, 0.65);
  box-shadow: 0 0 0 1px rgba(212, 165, 116, 0.25);
}

.admin-stat-drill {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: rgba(212, 165, 116, 0.7);
}

.admin-stats-filters {
  max-width: 960px;
  margin: 0 auto 1.25rem;
}

.admin-stats-filter-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) repeat(2, minmax(130px, 1fr)) auto;
  gap: 0.75rem 1rem;
  align-items: end;
}

.admin-stats-filter-actions {
  display: flex;
  align-items: end;
  padding-bottom: 0.1rem;
}

.admin-stats-range-label {
  margin: 0.85rem 0 0;
}

.admin-stats-detail {
  max-width: 960px;
  margin: 0 auto 1.5rem;
  scroll-margin-top: 5rem;
}

.admin-stats-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.admin-stats-detail-head h2 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--candlelight);
  font-size: 1.15rem;
}

.admin-stats-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-stats-detail-item {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) auto;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-top: 1px solid rgba(212, 165, 116, 0.15);
}

.admin-stats-detail-item:first-child {
  border-top: 0;
}

.admin-stats-detail-name {
  color: var(--candlelight);
  font-weight: 600;
  text-decoration: none;
}

a.admin-stats-detail-name:hover,
a.admin-stats-detail-name:focus-visible {
  color: var(--gold);
  text-decoration: underline;
}

.admin-stats-detail-when {
  white-space: nowrap;
  text-align: right;
}

@media (max-width: 959px) {
  .admin-stats-filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .admin-stats-filter-actions {
    grid-column: 1 / -1;
  }

  .admin-stats-detail-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .admin-stats-detail-when {
    text-align: left;
  }
}

.admin-card {
  margin-bottom: 1.5rem;
}

.admin-invite-form {
  margin-top: 1rem;
}

.admin-invite-list,
.admin-staff-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(212, 165, 116, 0.15);
}

.admin-invite-item:first-child,
.admin-staff-list li:first-child {
  border-top: 0;
}

.admin-staff-list li {
  padding: 0.6rem 0;
  border-top: 1px solid rgba(212, 165, 116, 0.1);
}

.admin-role-badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin: 0 0.35rem;
  font-family: var(--font-display);
}

.admin-role-developer {
  background: rgba(201, 162, 39, 0.2);
  color: var(--gold);
  border: 1px solid rgba(201, 162, 39, 0.35);
}

.admin-role-admin {
  background: rgba(212, 165, 116, 0.15);
  color: var(--candlelight);
  border: 1px solid rgba(212, 165, 116, 0.3);
}

.admin-role-engagement_lead {
  background: rgba(139, 168, 120, 0.18);
  color: #c5d4b0;
  border: 1px solid rgba(139, 168, 120, 0.35);
}

.admin-back {
  margin-top: 2rem;
}

.admin-billing-status-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}

.admin-billing-status-list li {
  margin: 0.35rem 0;
}

.admin-billing-ok { color: #a3d3a3; }
.admin-billing-warn { color: #e8b86d; }

.admin-billing-section-title {
  margin-top: 1.5rem;
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.admin-billing-form .label:first-of-type {
  margin-top: 0.75rem;
}

.admin-billing-copy-block {
  margin-top: 0.75rem;
}

.admin-billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.admin-billing-alert {
  border-color: rgba(180, 80, 80, 0.45);
}

.admin-status-badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin: 0 0.35rem;
  font-family: var(--font-display);
}
.admin-status-active { background: rgba(120, 168, 120, .15); color: #a3d3a3; border: 1px solid rgba(120, 168, 120, .35); }
.admin-status-suspended { background: rgba(201, 162, 39, 0.2); color: var(--gold); border: 1px solid rgba(201, 162, 39, 0.35); }
.admin-status-banned { background: rgba(178, 58, 34, .2); color: #e6a08e; border: 1px solid rgba(178, 58, 34, .4); }
.admin-status-deleted { background: rgba(120, 120, 140, .18); color: #b8b8c8; border: 1px solid rgba(120, 120, 140, .4); }

.admin-activity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  max-width: 720px;
  margin: 0 auto 1.25rem;
}

.admin-activity-filters--section {
  margin-top: 0.85rem;
  margin-bottom: 1.1rem;
}

.admin-activity-filter-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 10rem;
}

.admin-activity-filter-row select.input {
  min-width: 12rem;
}

.admin-activity-breakdown-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--gold);
  text-align: center;
  margin: 0.5rem 0 0.75rem;
}

.admin-activity-since {
  text-align: center;
  margin: -0.35rem 0 0.85rem;
}

.admin-activity-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  max-width: 960px;
  margin: 0 auto 1.5rem;
  align-items: stretch;
}

.admin-activity-staff-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  min-height: 100%;
  padding: 1rem 0.85rem 0.85rem;
}

.admin-activity-staff-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  min-height: 3.5rem;
  margin: 0 0 0.65rem;
}

.admin-activity-staff-name {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.25;
  word-break: break-word;
}

.admin-activity-staff-time {
  margin: 0 0 0.75rem;
}

.admin-activity-time {
  font-size: 1.65rem;
  margin: 0 0 0.15rem;
  line-height: 1.1;
}

.admin-activity-staff-time .hint {
  margin: 0;
}

.admin-activity-metrics {
  list-style: none;
  padding: 0;
  margin: auto 0 0;
  text-align: left;
  min-height: 5.5rem;
}

.admin-activity-metrics li {
  min-height: 1.25rem;
}

.admin-activity-metrics li + li {
  margin-top: 0.2rem;
}

.admin-activity-log-wrap {
  overflow-x: auto;
  max-width: 960px;
  margin: 0 auto 1.5rem;
}

.admin-activity-log {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-activity-log th,
.admin-activity-log td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid rgba(61, 56, 50, 0.45);
  text-align: left;
  vertical-align: top;
}

.admin-activity-log th {
  color: var(--candlelight);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-activity-event {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: rgba(212, 165, 116, 0.12);
  border: 1px solid rgba(212, 165, 116, 0.25);
}

.admin-activity-event--action {
  background: rgba(120, 168, 120, 0.12);
  border-color: rgba(120, 168, 120, 0.3);
}

.admin-ops-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0 0 1.25rem;
  font-family: var(--font-accent);
  font-size: 0.95rem;
}
.admin-ops-jump a {
  color: var(--candlelight);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 165, 116, 0.35);
}
.admin-ops-jump a:hover { color: var(--gold); }

.admin-ops-shell {
  max-width: 960px;
  margin: 0 auto 1.5rem;
}

.admin-ops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
  padding: 0.35rem;
  border: 1px solid rgba(212, 165, 116, 0.22);
  border-radius: 8px;
  background: rgba(13, 10, 8, 0.45);
}

.admin-ops-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--mist, #c9b8a0);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.admin-ops-tab:hover {
  color: var(--candlelight);
  background: rgba(212, 165, 116, 0.08);
}

.admin-ops-tab.is-active,
.admin-ops-tab[aria-selected="true"] {
  color: var(--parchment, #f4e8d0);
  background: linear-gradient(160deg, rgba(70, 42, 28, 0.9), rgba(36, 22, 16, 0.95));
  border-color: rgba(212, 165, 116, 0.4);
  box-shadow: inset 0 1px 0 rgba(244, 232, 208, 0.06);
}

.admin-ops-tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.admin-ops-panel[hidden] {
  display: none !important;
}

.admin-ops-cluster {
  margin: 0 0 1.35rem;
}

.admin-ops-cluster__title {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.03em;
  text-align: center;
}

.admin-ops-cluster__grid {
  margin-bottom: 0;
}

.admin-ops-quick-links {
  margin: 0.25rem 0 1.5rem;
}

.admin-ops-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-ops-breakdown {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.admin-ops-breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
  color: var(--mist);
  font-size: 0.92rem;
}
.admin-ops-breakdown li:last-child { border-bottom: 0; }
.admin-ops-breakdown strong {
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 500;
  white-space: nowrap;
}

.admin-ops-settings .label { margin-top: 0.85rem; }
.admin-ops-settings .label:first-of-type { margin-top: 0; }

.admin-stat--warn {
  border-color: rgba(212, 165, 116, 0.55);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.12);
}

.admin-search-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.admin-search-form .input { min-width: 220px; }

/* Keep Status/search above the results card (backdrop-filter cards stack later on top). */
.admin-card--filters {
  position: relative;
  z-index: 4;
}
.admin-card--filters:focus-within {
  z-index: 8;
}

.nav-staff {
  font-size: 0.85rem;
  color: var(--gold);
  text-decoration: none;
  font-family: var(--font-accent);
}

.nav-staff:hover {
  color: var(--candlelight);
}

.nav-warn {
  font-size: 0.78rem;
  color: #e8b86d;
  text-decoration: none;
  font-family: var(--font-accent);
  border: 1px solid rgba(232, 184, 109, .4);
  border-radius: 999px;
  padding: .2rem .6rem;
  white-space: nowrap;
}
.nav-warn:hover { background: rgba(232, 184, 109, .12); color: #f4d29a; }

.account-verify-banner { border: 1px solid rgba(232, 184, 109, .4); background: rgba(232, 184, 109, .06); }
.account-verify-banner h2 { color: #e8b86d; }
.account-verified-badge { color: #86efac; }

.auth-page .signup-pledge {
  text-align: left;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(238, 228, 228, 0.35);
  border-radius: 12px;
  margin: 0.5rem 0;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.auth-page .pledge-title,
.auth-page .pledge-checkbox {
  color: rgba(245, 245, 245, 0.863);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
}

.switch-mode {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.switch-mode a {
  color: rgba(245, 245, 245, 0.863);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
  text-decoration: none;
}

.switch-mode a:hover {
  color: rgb(227, 184, 75);
  transition-duration: 0.5s;
}

.auth-academy-link {
  position: relative;
  width: 100%;
  margin: 0.85rem 0 0;
  padding: 0.7rem 0 0;
  text-align: center;
  border-top: 1px solid rgba(238, 228, 228, 0.4);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  left: auto;
  bottom: auto;
}

.auth-academy-link .hint {
  color: rgba(245, 245, 245, 0.863);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.auth-academy-link .btn-ghost {
  color: rgba(245, 245, 245, 0.863);
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
  border-color: rgba(238, 228, 228, 0.5);
  white-space: normal;
  line-height: 1.25;
  display: inline-block;
  max-width: 100%;
  padding: 0.45rem 0.9rem;
}

.auth-academy-link .btn-ghost:hover {
  color: rgb(227, 184, 75);
  transition-duration: 0.5s;
}

@media (max-width: 1100px) {
  .auth-door-zone {
    left: 58%;
  }
}

@media (max-width: 768px) {
  .main-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.35rem 0.45rem;
  }

  .header-actions .btn,
  .header-actions a.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .auth-door-zone {
    left: 50%;
    top: 50%;
    width: min(360px, 90vw);
    max-height: 88vh;
    max-height: min(88vh, 88dvh);
  }

  .auth-form-wrap {
    padding: 0.85rem 1.1rem 0.9rem;
    justify-content: center;
  }

  .auth-card--login .subtitle {
    margin-bottom: 0.65rem;
  }

  .auth-card--login form .hint:not(.auth-forgot-link) {
    margin: 0.1rem 0 0.4rem;
    font-size: 0.78rem;
  }

  .auth-card--login .auth-page .ink-input,
  .auth-page .auth-card--login .ink-input {
    margin-bottom: 0.5rem;
    padding: 8px;
  }

  .auth-card--login .auth-forgot-link {
    margin: 0.4rem 0 0.25rem;
  }

  .auth-card--login .btn.btn-block {
    margin-top: 0.35rem;
    padding: 0.55rem 1.5rem;
  }

  .auth-card--login .switch-mode {
    margin-top: 0.4rem;
  }

  .auth-academy-link {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
  }

  .auth-academy-link .hint {
    font-size: 0.72rem;
  }
}

/* Short viewports — compact the door so login still fits without a scrollbar when possible. */
@media (max-height: 800px) {
  .auth-door-zone {
    max-height: 92vh;
    max-height: min(92vh, 92dvh);
    top: 50%;
  }

  .auth-form-wrap {
    padding: 0.65rem 1.15rem 0.7rem;
    align-items: center;
    justify-content: center;
  }

  /* Login must stay content-sized — do not re-stretch / re-center into empty glass. */
  .auth-door-zone--login,
  .auth-door-zone:has(.auth-card--login) {
    aspect-ratio: auto;
    height: fit-content;
    height: auto;
    max-height: min(92vh, 92dvh);
  }

  .auth-door-zone--login .door-frame,
  .auth-door-zone:has(.auth-card--login) .door-frame {
    height: auto;
  }

  .auth-door-zone--login .auth-form-wrap,
  .auth-door-zone:has(.auth-card--login) .auth-form-wrap {
    position: relative;
    inset: auto;
    height: auto;
    justify-content: flex-start;
    overflow: visible;
    padding: 0.55rem 1rem 0.6rem;
  }

  .auth-card h1,
  .auth-card h2 {
    /* At the narrower door widths that show up around 1300-1400px viewports,
       the display font at the old clamp size wrapped onto two lines and blew
       through the card's height budget all on its own — cap it smaller and
       tighten the line-height so "Welcome Back" / "Claim Your Quill" stay
       on one line. */
    font-size: clamp(1.25rem, 3vw, 1.55rem);
    line-height: 1.15;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
  }

  .auth-card .subtitle {
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
  }

  .auth-card .ink-label {
    margin-bottom: 0.15rem;
  }

  .auth-card form .hint:not(.auth-forgot-link) {
    margin: 0.1rem 0 0.4rem;
  }

  .auth-page .ink-input {
    margin-bottom: 0.45rem;
    padding: 7px;
  }

  .auth-forgot-link {
    margin: 0.35rem 0 0.2rem;
  }

  .auth-page .btn.btn-block {
    margin-top: 0.35rem;
    padding: 0.5rem 1.75rem;
  }

  .switch-mode {
    margin-top: 0.3rem;
  }

  .auth-academy-link {
    margin-top: 0.5rem;
    padding-top: 0.45rem;
  }

  .auth-academy-link .hint {
    margin-top: 0.2rem;
    font-size: 0.7rem;
  }
}

/* Phone/tablet auth: allow sign-in and sign-up to scroll inside the door panel.
   Desktop (960px+) keeps the fixed, non-page-scroll portal layout unchanged.
   Must follow the max-height:800px block so flex-start wins over centering. */
@media (max-width: 959px) {
  .auth-door-zone {
    left: 50%;
    top: 50%;
    width: min(360px, 92vw);
    max-height: 90vh;
    max-height: min(90vh, 90dvh);
  }

  .auth-form-wrap {
    justify-content: flex-start;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.75rem 1.1rem 0.9rem;
  }

  .auth-card,
  .auth-card--login,
  .auth-card--signup {
    max-height: none;
    overflow: visible;
    flex: 0 0 auto;
  }
}

.portal-page { position: relative; min-height: 100vh; background: var(--shadow); }
.portal-full { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portal-text { text-align: center; font-family: var(--font-display); color: var(--candlelight); letter-spacing: .15em; animation: flicker 3s infinite; margin: 0; }
.portal-page-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12%;
  z-index: 2;
  pointer-events: none;
}

/* Full-screen portal takeover after login (replaces ancient library). */
.auth-portal-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--shadow);
  cursor: pointer;
}
.auth-portal-stage.hidden { display: none; }
.auth-portal-full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0705;
}

/* iPhone: promote portal video onto its own layer so the first frame paints. */
@media (max-width: 959px) {
  .auth-portal-full,
  .portal-full {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}
.auth-portal-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12%;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  margin: 0;
}

.auth-page--portal-active .auth-video,
.auth-page--portal-active .auth-overlay,
.auth-page--portal-active .auth-door-zone,
.auth-page--portal-active .auth-academy-link {
  visibility: hidden;
  pointer-events: none;
}

/* Academy */
.track-section { margin-bottom: 3rem; }
.track-section-title { font-size: 1.5rem; margin-bottom: 1rem; }
.track-card + .track-card { margin-top: 1.5rem; }
.track-header { display: flex; gap: 1rem; margin-bottom: 1.25rem; }
.track-header span { font-size: 2rem; }
.lesson-grid { display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .lesson-grid { grid-template-columns: repeat(2, 1fr); gap: 1.35rem; } }
@media (min-width: 900px) { .lesson-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }
.lesson-card { display: block; padding: 1.25rem; background: rgba(13,10,8,.4); border: 1px solid rgba(61,56,50,.4); border-radius: 6px; text-decoration: none; color: inherit; transition: border-color .2s; }
.lesson-card:hover { border-color: rgba(212,165,116,.4); }
.lesson-card h4 { font-family: var(--font-accent); color: var(--parchment); margin: .5rem 0; }
.lesson-card p { font-size: .8rem; color: var(--mist); }
.lesson-meta { display: flex; justify-content: space-between; font-size: .7rem; text-transform: uppercase; color: rgba(212,165,116,.7); }
.lesson-badges span { font-size: .65rem; padding: .15rem .4rem; background: rgba(139,69,19,.3); border-radius: 3px; margin-right: .25rem; }
.embed { border-radius: 8px; overflow: hidden; border: 1px solid rgba(61,56,50,.4); background: var(--shadow); }
.embed-video { aspect-ratio: 16/9; }
.embed iframe { width: 100%; height: 100%; border: 0; min-height: 400px; }
.embed-video iframe,
.embed-video video,
.embed-video .yt-facade {
  min-height: auto;
  height: 100%;
  border-radius: 8px;
  background: #000;
}
.yt-facade {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  color: var(--candlelight);
}
.yt-facade:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.yt-facade-play {
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 24px solid var(--gold);
  margin-left: 4px;
}
.embed-reading { height: 600px; }
.video-fallback,
.reading-fallback { margin-top: 0.75rem; font-size: 0.85rem; }
.reading-fallback a { color: var(--mist); }
.reading-fallback a:hover { color: var(--gold); }
.video-part-label { font-size: 0.8rem; color: var(--mist); margin: 1rem 0 0.35rem; text-transform: uppercase; letter-spacing: 0.04em; }
.video-part-label:first-child { margin-top: 0; }

/* Lesson learning path */
.path-stepper { margin-bottom: 2rem; }
.path-stepper ol { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0; list-style: none; padding: 0; margin: 0; }
.path-stepper-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mist); }
.path-stepper-num { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 1px solid rgba(212,165,116,.35); color: var(--gold); font-size: 0.7rem; }
.path-stepper-connector { width: 1.25rem; height: 1px; background: rgba(212,165,116,.25); list-style: none; }
.path-step { padding: 1.5rem 0; border-bottom: 1px solid rgba(61,56,50,.25); }
.path-step:last-of-type { border-bottom: 0; }
.path-step-eyebrow { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(212,165,116,.75); margin: 0 0 0.35rem; }
.path-step-title { font-family: var(--font-accent); color: var(--parchment); font-size: 1.25rem; margin: 0 0 0.5rem; }
.path-step-intro { font-size: 0.9rem; color: var(--mist); margin: 0 0 1.25rem; max-width: 42rem; }
.lesson-read { max-width: 42rem; color: var(--parchment); }
.lesson-read h3 { font-family: var(--font-accent); font-size: 1.05rem; color: var(--candlelight); margin: 1.35rem 0 0.5rem; }
.lesson-read p { margin: 0 0 0.9rem; line-height: 1.65; color: var(--mist); }
.lesson-read ul { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--mist); }
.lesson-read li { margin: 0.35rem 0; line-height: 1.55; }
.lesson-script-sample {
  margin: 0 0 1.15rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: rgba(13,10,8,.55);
  border: 1px solid rgba(212,165,116,.22);
  border-radius: 8px;
  color: var(--parchment);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.path-step-action { margin-top: 1.25rem; }
.practice-card { padding: 1.25rem 1.5rem; background: rgba(44,24,16,.35); border: 1px solid rgba(212,165,116,.2); border-radius: 8px; max-width: 40rem; }
.practice-prompt { color: var(--parchment); margin: 0 0 0.75rem; line-height: 1.6; }
.practice-tip { font-size: 0.85rem; color: var(--mist); margin: 0 0 1.25rem; font-style: italic; }
.practice-form { display: flex; flex-direction: column; gap: 1rem; }
.practice-field label { display: block; font-size: 0.8rem; color: var(--gold); margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.04em; }
.practice-field input,
.practice-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: rgba(13,10,8,.6);
  border: 1px solid rgba(61,56,50,.5);
  border-radius: 6px;
  color: var(--parchment);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
}
.practice-field input:focus,
.practice-field textarea:focus {
  outline: none;
  border-color: rgba(212,165,116,.5);
  box-shadow: 0 0 0 2px rgba(212,165,116,.12);
}
.practice-field input::placeholder,
.practice-field textarea::placeholder { color: rgba(180,170,160,.45); }
.practice-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.practice-feedback { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid rgba(61,56,50,.3); }
.practice-feedback.hidden { display: none; }
.practice-summary { font-family: var(--font-accent); margin: 0 0 0.75rem; }
.practice-summary--pass { color: #4ade80; }
.practice-summary--fail { color: #fbbf24; }
.practice-feedback-list { margin: 0; padding: 0; list-style: none; }
.practice-feedback-item { font-size: 0.88rem; line-height: 1.5; padding: 0.45rem 0; border-top: 1px solid rgba(61,56,50,.2); }
.practice-feedback-item--ok { color: var(--mist); }
.practice-feedback-item--ok::before { content: '✓ '; color: #4ade80; }
.practice-feedback-item--no { color: var(--parchment); }
.practice-feedback-item--no::before { content: '→ '; color: #fbbf24; }
.lesson-supplements { margin-top: 1.5rem; padding: 0.75rem 1rem; border: 1px solid rgba(61,56,50,.35); border-radius: 8px; background: rgba(13,10,8,.25); }
.lesson-supplements summary { cursor: pointer; color: var(--mist); font-size: 0.9rem; list-style: none; }
.lesson-supplements summary::-webkit-details-marker { display: none; }
.supplements-hint { font-size: 0.75rem; color: var(--gold); margin-left: 0.5rem; }
.supplements-list { margin: 0.75rem 0 0; padding: 0; list-style: none; }
.supplements-list li { padding: 0.5rem 0; border-top: 1px solid rgba(61,56,50,.2); font-size: 0.85rem; }
.supplements-list a { color: var(--gold); }
.supplements-source { display: block; font-size: 0.75rem; color: var(--mist); margin-top: 0.15rem; }
.lesson-duration { font-size: 0.8rem; color: var(--mist); margin-top: 0.5rem; }

.academy-path-banner { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.35rem; margin: 1rem 0 0.5rem; }
.path-pill { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.25rem 0.6rem; border: 1px solid rgba(212,165,116,.3); border-radius: 999px; color: var(--gold); }
.path-arrow { color: rgba(212,165,116,.4); font-size: 0.75rem; }
.lesson-path-preview { font-size: 0.7rem; color: rgba(212,165,116,.65); margin: 0.5rem 0 0; text-transform: uppercase; letter-spacing: 0.04em; }

.toolkit-section { margin-bottom: 2.5rem; }
.toolkit-section-title { font-family: var(--font-accent); color: var(--parchment); font-size: 1.15rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.toolkit-grid { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .toolkit-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .toolkit-grid { grid-template-columns: repeat(3, 1fr); } }
.toolkit-card { display: block; padding: 1rem 1.15rem; background: rgba(13,10,8,.4); border: 1px solid rgba(61,56,50,.4); border-radius: 6px; text-decoration: none; color: inherit; transition: border-color .2s; }
.toolkit-card:hover { border-color: rgba(212,165,116,.4); }
.toolkit-card h3 { font-family: var(--font-accent); color: var(--parchment); font-size: 0.95rem; margin: 0 0 0.35rem; }
.toolkit-card p { font-size: 0.8rem; color: var(--mist); margin: 0; line-height: 1.45; }
.khan-video-card {
  padding: 1.5rem;
  text-align: center;
  background: rgba(44, 24, 16, 0.6);
  border: 1px solid rgba(212, 165, 116, 0.25);
  border-radius: 8px;
}
.lesson-header { padding: 1.5rem 0; border-bottom: 1px solid rgba(61,56,50,.3); background: rgba(44,24,16,.2); }
.back-link { color: var(--mist); font-size: .85rem; }
.track-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(212,165,116,.7); }
.lesson-nav { display: flex; justify-content: space-between; padding-top: 2rem; border-top: 1px solid rgba(61,56,50,.3); margin-top: 2rem; }
.credits-line { font-size: .85rem; color: var(--mist); }

/* Attribution */
.attribution-block { margin-top: .75rem; padding: 1rem; background: rgba(13,10,8,.5); border-left: 3px solid var(--candlelight); border-radius: 0 6px 6px 0; font-size: .8rem; }
.attribution-heading { font-family: var(--font-display); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--candlelight); margin: 0 0 .5rem; }
.attribution-item { margin: .25rem 0; color: var(--mist); }
.attribution-note { font-style: italic; font-size: .75rem; margin-top: .5rem; }

/* Quiz */
.quiz-card { margin-top: 1.5rem; }
.quiz-option { display: block; width: 100%; text-align: left; margin-bottom: .5rem; padding: .6rem 1rem; background: rgba(13,10,8,.6); border: 1px solid var(--stone); border-radius: 4px; color: var(--parchment); cursor: pointer; font-family: var(--font-accent); }
.quiz-option.selected { border-color: var(--candlelight); background: rgba(212,165,116,.1); }
.quiz-option.correct { border-color: #4ade80; background: rgba(22,101,52,.2); }
.quiz-option.wrong { border-color: #f87171; background: rgba(127,29,29,.2); }
.quiz-result { text-align: center; padding-top: 1rem; border-top: 1px solid rgba(61,56,50,.3); }

/* Studio */
.scriptorium-nav {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid rgba(61, 56, 50, 0.35);
  margin-bottom: 1.5rem;
}

.page-bookshelf-hall .scriptorium-nav {
  padding: 0.5rem 0 0.35rem;
  margin-bottom: 0.5rem;
}

.page-bookshelf-hall .scriptorium-nav-link {
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
}
.scriptorium-nav-link {
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  border: 1px solid rgba(61, 56, 50, 0.5);
  color: rgba(244, 232, 208, 0.85);
  text-decoration: none;
  font-family: var(--font-accent);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.scriptorium-nav-link:hover,
.scriptorium-nav-link.is-active {
  color: var(--candlelight);
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(212, 165, 116, 0.1);
}
.scriptorium-nav-badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: .3rem;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  vertical-align: middle;
}

.feed-filter-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
}
.feed-filter-tabs .scriptorium-nav-link {
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
}
.feed {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  transition: opacity .15s ease;
}
.feed[aria-busy="true"] {
  opacity: .45;
  pointer-events: none;
}

.feed-salon-picker {
  margin: 0 0 1.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(139, 115, 85, 0.35);
  border-radius: 10px;
  background: rgba(26, 20, 16, 0.45);
}
.feed-salon-picker__label {
  display: block;
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--candlelight);
}
.feed-salon-picker__hint {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--mist);
}
.feed-salon-picker__select {
  width: 100%;
  max-width: 100%;
}
.feed-salon-picker__status {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: rgba(244, 232, 208, 0.78);
}
.feed-salon-picker__status a {
  color: var(--candlelight);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.feed-composer {
  margin-bottom: 0;
}
.feed-composer .feed-composer-label {
  display: none;
}
.feed-composer.is-expanded .feed-composer-label {
  display: block;
}
.feed-composer:not(.is-expanded) .feed-composer-extras {
  display: none !important;
}
.feed-composer:not(.is-expanded) .feed-composer-input {
  min-height: 2.6rem;
  resize: none;
  cursor: text;
}
.feed-composer.is-expanded .feed-composer-input {
  min-height: 6.5rem;
}
.feed-composer.is-expanded .composer-field .emoji-picker-btn {
  display: inline-flex;
}
.feed-composer:not(.is-expanded) .composer-field .emoji-picker-btn {
  display: none;
}
.feed-stream-label {
  margin: 1.65rem 0 0.85rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, 0.78);
  text-align: center;
}
.feed-stream-label::before,
.feed-stream-label::after {
  content: '';
  display: inline-block;
  width: 2.25rem;
  height: 1px;
  margin: 0 0.65rem;
  vertical-align: middle;
  background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.45), transparent);
}

/* The Feed / My Guild / Messages all stack .scriptorium-nav directly above
   a .section — the nav's own bottom spacing plus the section's full
   padding-top compounded into an oversized dead zone before any real
   content. Tighten just that seam (leave .section's padding alone
   everywhere else it's used, including Studio). */
body:not(.page-studio) .scriptorium-nav + .section {
  padding-top: 0.5rem;
}

/* Shared empty-state treatment (Feed, Guild, Messages) — a small glyph
   above the hint text so "nothing here yet" reads as an intentional,
   quiet moment rather than missing content. */
.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
}
.empty-state-icon {
  display: block;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  opacity: 0.85;
}

/* A small ornamental flourish under a card's heading — echoes the
   laurel-wreath/quatrefoil motif used in the logo and site wallpaper,
   used sparingly under the primary "compose" heading of a card. */
.card-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1.25rem;
}
.card-divider::before,
.card-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.4), transparent);
}
.card-divider-glyph {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--gold);
}

.studio-header { background: rgba(44,24,16,.4); border-bottom: 1px solid rgba(61,56,50,.3); padding: 1rem 0; }
.studio-header-inner { display: flex; justify-content: space-between; align-items: center; }

/* Immersive studio */
.page-studio main { padding-bottom: 0; }

.studio-page {
  --studio-accent: var(--candlelight);
  --studio-glow: rgba(212, 165, 116, 0.35);
}

.studio-scene {
  position: relative;
  min-height: 62vh;
  overflow: hidden;
  border-bottom: 1px solid rgba(61, 56, 50, 0.35);
}

.studio-scene-bg,
.studio-scene-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.studio-scene-bg {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 165, 116, 0.12), transparent 55%),
    linear-gradient(180deg, #1a1410 0%, #0d0a08 100%);
  transition: background 0.8s ease, filter 0.8s ease;
}

.studio-scene-fx {
  z-index: 1;
}

.studio-prop {
  position: absolute;
  opacity: 0.55;
  transition: transform 0.6s ease, opacity 0.6s ease, box-shadow 0.6s ease;
}

.studio-prop--left {
  left: 4%;
  bottom: 8%;
  width: 120px;
  height: 180px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, rgba(61, 56, 50, 0.5), rgba(26, 20, 16, 0.8));
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.45);
}

.studio-prop--right {
  right: 6%;
  bottom: 12%;
  width: 90px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(201, 162, 39, 0.35), rgba(26, 20, 16, 0.9) 70%);
  box-shadow: 0 0 40px rgba(201, 162, 39, 0.15);
}

.studio-prop--desk {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(720px, 92%);
  height: 110px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(44, 24, 16, 0.85), rgba(26, 20, 16, 0.95));
  border: 1px solid rgba(212, 165, 116, 0.15);
  border-bottom: 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.35);
}

.studio-scene-content {
  position: relative;
  z-index: 2;
  padding: 2rem 1rem 2.5rem;
}

.studio-scene-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.studio-scene-eyebrow {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--mist);
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.studio-scene-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.studio-new-work {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: min(220px, 70vw);
  min-height: 120px;
  margin: 0 auto 2rem;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--parchment);
  border: 1px solid rgba(212, 165, 116, 0.45);
  border-radius: 10px;
  background: rgba(44, 24, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 24px var(--studio-glow);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  z-index: 3;
}

.studio-new-work-glow {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--studio-glow), transparent 70%);
  opacity: 0.6;
  z-index: -1;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.studio-new-work-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--studio-glow));
}

.studio-new-work-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--studio-accent);
}

.studio-page--new-work-hover .studio-new-work,
.studio-new-work:hover,
.studio-new-work:focus-visible {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--studio-accent);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 36px var(--studio-glow);
  outline: none;
}

.studio-page--new-work-hover .studio-new-work-glow,
.studio-new-work:hover .studio-new-work-glow {
  opacity: 1;
  transform: scale(1.1);
}

.studio-page--new-work-hover .studio-prop--desk,
.studio-new-work:hover ~ .studio-works-panel .studio-prop--desk {
  opacity: 0.75;
}

.studio-works-panel {
  position: relative;
  padding: 1.25rem;
  border-radius: 10px;
  background: rgba(13, 10, 8, 0.55);
  border: 1px solid rgba(61, 56, 50, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.studio-layout.is-hidden { display: none; }

.studio-empty {
  text-align: center;
  color: var(--mist);
  font-style: italic;
  margin: 0;
  padding: 1.5rem 0;
}

.studio-theme-panel {
  padding: 1.5rem 1rem 2.5rem;
}

.studio-theme-panel-inner {
  display: grid;
  gap: 1rem;
}

.studio-theme-panel h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--candlelight);
  margin: 0;
}

.studio-theme-status {
  min-height: 1.2rem;
  margin: 0;
  text-align: center;
}

.theme-grid { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 0; }
.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 108px;
  padding: .75rem;
  border: 1px solid rgba(61,56,50,.4);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  background: rgba(13, 10, 8, 0.45);
  color: var(--parchment);
  font-family: var(--font-body);
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
}
.theme-btn:hover:not(:disabled) {
  border-color: rgba(212, 165, 116, 0.45);
  transform: translateY(-2px);
}
.theme-btn.active {
  border-color: var(--candlelight);
  background: rgba(212,165,116,.12);
  box-shadow: 0 0 18px rgba(212, 165, 116, 0.15);
}
.theme-btn:disabled { opacity: 0.6; cursor: wait; }
.theme-btn-icon { font-size: 1.35rem; }
.theme-btn-name { font-size: 0.72rem; line-height: 1.3; }

.studio-scene--pulse .studio-scene-bg {
  animation: studio-theme-pulse 0.9s ease;
}

@keyframes studio-theme-pulse {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.15); }
  100% { filter: brightness(1); }
}

/* Theme: Ancient Library */
.studio-page[data-studio-theme="ancient_library"] {
  --studio-accent: #d4a574;
  --studio-glow: rgba(212, 165, 116, 0.4);
}
.studio-page[data-studio-theme="ancient_library"] .studio-scene-bg {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(139, 69, 19, 0.25), transparent 45%),
    radial-gradient(ellipse at 80% 20%, rgba(201, 162, 39, 0.12), transparent 40%),
    linear-gradient(180deg, #2a1f18 0%, #120e0b 100%);
}
.studio-page[data-studio-theme="ancient_library"] .studio-prop--left {
  background: linear-gradient(180deg, #4a3728, #2c1810);
  box-shadow: inset -8px 0 16px rgba(0,0,0,.4);
}
.studio-page[data-studio-theme="ancient_library"] .studio-new-work {
  margin-bottom: 3rem;
}

/* Theme: Modern Library */
.studio-page[data-studio-theme="modern_library"] {
  --studio-accent: #b8c5d6;
  --studio-glow: rgba(184, 197, 214, 0.35);
}
.studio-page[data-studio-theme="modern_library"] .studio-scene-bg {
  background:
    linear-gradient(135deg, rgba(90, 108, 125, 0.25), transparent 50%),
    linear-gradient(180deg, #1c2228 0%, #0a0d10 100%);
}
.studio-page[data-studio-theme="modern_library"] .studio-prop--left,
.studio-page[data-studio-theme="modern_library"] .studio-prop--right {
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(220, 228, 236, 0.08), rgba(90, 108, 125, 0.15));
  box-shadow: 0 0 30px rgba(184, 197, 214, 0.08);
}
.studio-page[data-studio-theme="modern_library"] .studio-prop--desk {
  background: linear-gradient(180deg, rgba(40, 48, 56, 0.9), rgba(20, 24, 28, 0.95));
  border-color: rgba(184, 197, 214, 0.2);
}
.studio-page[data-studio-theme="modern_library"] .bookshelf {
  background: linear-gradient(180deg, #2a323a, #151a1f);
}

/* Theme: Cinema */
.studio-page[data-studio-theme="cinema"] {
  --studio-accent: #c9a227;
  --studio-glow: rgba(201, 162, 39, 0.45);
}
.studio-page[data-studio-theme="cinema"] .studio-scene-bg {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(201, 162, 39, 0.22), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(120, 20, 20, 0.35), transparent 55%),
    linear-gradient(180deg, #180c0c 0%, #050303 100%);
}
.studio-page[data-studio-theme="cinema"] .studio-prop--left {
  width: 0;
  height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-bottom: 100px solid rgba(201, 162, 39, 0.12);
  background: none;
  bottom: 35%;
  opacity: 0.35;
}
.studio-page[data-studio-theme="cinema"] .studio-prop--right {
  width: 140px;
  height: 8px;
  border-radius: 50%;
  bottom: 72%;
  background: radial-gradient(ellipse, rgba(255, 240, 200, 0.35), transparent 70%);
  opacity: 0.8;
}
.studio-page[data-studio-theme="cinema"] .studio-new-work {
  min-height: 140px;
  border-width: 3px;
  border-color: rgba(201, 162, 39, 0.65);
  background: repeating-linear-gradient(
    -12deg,
    rgba(26, 20, 16, 0.95),
    rgba(26, 20, 16, 0.95) 10px,
    rgba(44, 24, 16, 0.95) 10px,
    rgba(44, 24, 16, 0.95) 20px
  );
  transform: rotate(-2deg);
}
.studio-page[data-studio-theme="cinema"] .studio-page--new-work-hover .studio-new-work,
.studio-page[data-studio-theme="cinema"] .studio-new-work:hover {
  transform: rotate(0deg) translateY(-8px) scale(1.04);
}

/* Theme: Vintage Parchment */
.studio-page[data-studio-theme="vintage_parchment"] {
  --studio-accent: #c4a574;
  --studio-glow: rgba(196, 165, 116, 0.35);
}
.studio-page[data-studio-theme="vintage_parchment"] .studio-scene-bg {
  background:
    radial-gradient(ellipse at 70% 30%, rgba(196, 165, 116, 0.15), transparent 45%),
    linear-gradient(180deg, #3d3020 0%, #1f1810 100%);
}
.studio-page[data-studio-theme="vintage_parchment"] .studio-prop--left {
  background: linear-gradient(180deg, #e8dcc8, #c4a574);
  opacity: 0.2;
  width: 80px;
  height: 100px;
  border-radius: 2px;
}
.studio-page[data-studio-theme="vintage_parchment"] .studio-works-panel {
  background: rgba(232, 220, 200, 0.06);
  border-color: rgba(196, 165, 116, 0.25);
}

/* Theme: Cozy Dark Academia */
.studio-page[data-studio-theme="cozy_dark_academia"] {
  --studio-accent: #e8b86d;
  --studio-glow: rgba(232, 184, 109, 0.4);
}
.studio-page[data-studio-theme="cozy_dark_academia"] .studio-scene-bg {
  background:
    radial-gradient(ellipse at 75% 65%, rgba(232, 184, 109, 0.18), transparent 40%),
    radial-gradient(ellipse at 15% 40%, rgba(80, 50, 30, 0.35), transparent 45%),
    linear-gradient(180deg, #221810 0%, #0d0907 100%);
}
.studio-page[data-studio-theme="cozy_dark_academia"] .studio-prop--right {
  width: 24px;
  height: 60px;
  border-radius: 50% 50% 4px 4px;
  background: linear-gradient(180deg, #fff4d6, #e8b86d 40%, #8b4513 100%);
  box-shadow: 0 0 30px rgba(232, 184, 109, 0.45);
  animation: flicker 4s infinite;
  opacity: 0.85;
}
.studio-page[data-studio-theme="cozy_dark_academia"] .studio-page--new-work-hover .studio-prop--right {
  animation-duration: 2s;
  box-shadow: 0 0 45px rgba(232, 184, 109, 0.65);
}

.bookshelf { display: flex; gap: 4px; align-items: flex-end; min-height: 140px; padding: .5rem; background: linear-gradient(180deg, #2c1810, #1a1410); border-radius: 4px; margin-bottom: 1.5rem; }
.shelf-book { width: 40px; border-radius: 2px; background: linear-gradient(90deg, #2c1810, #3d2820, #2c1810); box-shadow: 2px 0 4px rgba(0,0,0,.5); cursor: pointer; transition: transform .3s; }
.shelf-book:hover { transform: translateY(-8px); }
.shelf-label { font-family: var(--font-display); font-size: .85rem; color: var(--candlelight); border-bottom: 1px solid rgba(61,56,50,.3); padding-bottom: .5rem; }
.cinema-reels { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: center; padding: 2rem; }
.film-reel { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--gold); background: radial-gradient(circle, #1a1410 30%, #3d3832 70%); box-shadow: 0 0 15px rgba(201,162,39,.3); text-align: center; cursor: pointer; }
.film-reel p { font-size: .65rem; margin-top: 90px; white-space: nowrap; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.editor-area { min-height: 400px; font-size: 1.1rem; line-height: 1.8; }

/* Subscribe */
.subscribe-card { padding: 2rem; }
.price { font-family: var(--font-display); font-size: 3rem; color: var(--gold); margin: 0; }
.price-unit { font-size: 1.1rem; font-weight: 400; opacity: .85; margin-left: .15rem; }
.price-box { padding: 1rem 0; border-block: 1px solid rgba(61,56,50,.3); margin: 1rem 0; }
.subscribe-plan-picker {
  display: grid;
  gap: .65rem;
  margin: 1rem 0 1.25rem;
  padding: 0;
  border: none;
  text-align: left;
}
.subscribe-plan-option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin: 0;
  padding: .75rem .9rem;
  border: 1px solid rgba(61,56,50,.28);
  border-radius: 8px;
  background: rgba(61,56,50,.06);
  cursor: pointer;
}
.subscribe-plan-option--featured {
  border-color: rgba(201,162,39,.45);
  background: rgba(201,162,39,.08);
}
.subscribe-plan-option:has(input:checked),
.subscribe-plan-option.is-selected {
  border-color: rgba(201,162,39,.75);
  background: rgba(201,162,39,.16);
  box-shadow: 0 0 0 1px rgba(201,162,39,.35);
}
.subscribe-plan-option input {
  margin-top: .2rem;
  flex-shrink: 0;
}
.subscribe-plan-copy {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.subscribe-plan-copy strong { color: var(--parchment, inherit); }
.subscribe-disclosure { background: rgba(61,56,50,.08); border: 1px solid rgba(61,56,50,.2); border-radius: 6px; padding: .75rem 1rem; margin: 1rem 0; }
.subscribe-config-alert {
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(139, 69, 19, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 8px;
  text-align: left;
}
.subscribe-config-alert p { margin: 0 0 .5rem; }
.subscribe-config-alert p:last-child { margin-bottom: 0; }
.subscribe-checkout-lock { display: block; }
.subscribe-checkout-frame-wrap {
  margin: 1.25rem 0;
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(13, 10, 8, 0.35);
  min-height: 560px;
  box-shadow: 0 0 20px rgba(212, 165, 116, .12), inset 0 1px 0 rgba(244, 232, 208, .06);
}
.subscribe-checkout-frame-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem .75rem;
  background: linear-gradient(180deg, rgba(52, 30, 20, 0.94), rgba(36, 20, 13, 0.94));
  border-bottom: 1px solid rgba(212, 165, 116, 0.25);
  font-family: var(--font-display);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}
.subscribe-checkout-frame {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
  background: #fff;
}
.subscribe-checkout-footnote { margin-top: 1rem; }
.subscribe-return-url {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: .85em;
}
.subscribe-nmi-form { margin-top: 1rem; text-align: left; }
.subscribe-nmi-fields { margin: 1rem 0; }
.subscribe-nmi-field {
  /* Collect.js mounts iframes here. Cream + dark ink so digits stay visible. */
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-height: 2.75rem;
  margin-bottom: .85rem;
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(61, 56, 50, 0.28);
  border-radius: 6px;
  background: #fffcf5;
  color: #1a1410;
  color-scheme: light;
  box-sizing: border-box;
}
.subscribe-nmi-field iframe {
  display: block !important;
  width: 100% !important;
  min-height: 2.75rem !important;
  max-width: 100%;
  border: 0 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  position: relative !important;
  z-index: 2 !important;
  background: transparent !important;
}
.subscribe-nmi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  align-items: start;
}
.subscribe-nmi-row > div {
  min-width: 0;
}
.subscribe-nmi-row .subscribe-nmi-field {
  margin-bottom: 0;
}
#nmi-checkout-status { min-height: 1.25rem; margin: 0.35rem 0 0.75rem; }
#nmi-checkout-status.is-error {
  color: #e8a090;
  font-weight: 600;
}
#nmi-pay-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Floating a11y control can sit over CVV / Pay on iPhone. */
body.page-subscribe-checkout .a11y-toggle,
body.page-subscribe-checkout .a11y-panel {
  display: none !important;
}

body.page-subscribe-checkout {
  overflow-x: hidden;
}
body.page-subscribe-checkout .subscribe-checkout {
  width: 100%;
  max-width: 520px;
  box-sizing: border-box;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
body.page-subscribe-checkout .subscribe-card {
  box-sizing: border-box;
  max-width: 100%;
}
body.page-subscribe-checkout .subscribe-nmi-form .input {
  margin-bottom: 0.85rem;
}
body.page-subscribe-checkout #nmi-pay-button {
  margin-top: 0.25rem;
  margin-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 959px) {
  body.page-subscribe-checkout .subscribe-card {
    padding: 1.25rem 1rem 1.5rem;
  }
  body.page-subscribe-checkout .section-title {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
  }
  .subscribe-nmi-row {
    gap: 0.65rem;
  }
  .subscribe-nmi-field,
  .subscribe-nmi-field iframe {
    min-height: 3rem !important;
  }
  /* Android + iOS: avoid 300ms tap delay / accidental gesture steal on Pay. */
  body.page-subscribe-checkout #nmi-pay-button {
    touch-action: manipulation;
    min-height: 2.75rem;
  }
  body.page-subscribe-checkout .subscribe-nmi-field {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* iPhone / narrow phone: stack exp + CVV so each iframe is full-width and typeable */
@media (max-width: 480px) {
  body.page-subscribe-checkout .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  body.page-subscribe-checkout .subscribe-card {
    padding: 1.1rem 0.85rem 1.35rem;
  }
  body.page-subscribe-checkout .subscribe-nmi-row {
    grid-template-columns: 1fr;
  }
  body.page-subscribe-checkout .subscribe-nmi-row .subscribe-nmi-field {
    margin-bottom: 0.85rem;
  }
}
.feature-list { list-style: none; padding: 0; margin: 1rem 0; }
.feature-list li::before { content: '✦ '; color: var(--gold); }

/* Feed */
.feed-item { margin-bottom: 0; }
.feed-author { display: flex; gap: .75rem; align-items: center; margin-bottom: .75rem; }

/* Shared bookshelf volume on The Feed */
.feed-work-card {
  display: flex;
  gap: 0.85rem;
  align-items: stretch;
  margin: 0.75rem 0 0.35rem;
  padding: 0.65rem;
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 8px;
  background: rgba(12, 8, 5, 0.55);
  text-decoration: none;
  color: inherit;
  max-width: 28rem;
}
.feed-work-card--link:hover,
.feed-work-card--link:focus-visible {
  border-color: rgba(212, 165, 116, 0.7);
  background: rgba(26, 18, 12, 0.72);
  outline: none;
}
.feed-work-card--locked {
  opacity: 0.88;
  cursor: default;
}
.feed-work-cover {
  flex: 0 0 4.6rem;
  width: 4.6rem;
  min-height: 6.6rem;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  background: #1a1410;
  position: relative;
}
.feed-work-cover .tome-cover-mini {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.feed-work-cover-art,
.feed-work-cover-fallback {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 6.6rem;
  background-size: cover;
  background-position: center;
}
.feed-work-cover-fallback {
  display: flex;
  align-items: flex-end;
  padding: 0.4rem;
  background: linear-gradient(160deg, #3a2a22, #1a1410);
}
.feed-work-cover-fallback-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.62rem;
  line-height: 1.2;
  color: #f4e8d0;
}
.feed-work-cover--scroll {
  flex: 0 0 3.35rem;
  width: 3.35rem;
  min-height: 6.6rem;
  border-radius: 2px 8px 8px 2px;
}
.feed-work-cover-fallback--scroll {
  background: linear-gradient(180deg, #4a3828 0%, #2a1e16 45%, #1a1410 100%);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem 0.3rem;
}
.feed-work-cover-fallback--scroll .feed-work-cover-fallback-title {
  font-size: 0.58rem;
  writing-mode: horizontal-tb;
}
.feed-work-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  justify-content: center;
}
.feed-work-kicker {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, 0.85);
}
.feed-work-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--parchment, #f4ece0);
}
.feed-work-author {
  font-size: 0.82rem;
  color: rgba(244, 236, 224, 0.82);
}
.feed-work-cta {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--candlelight, #d4a574);
}
.feed-work-locked-note {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: rgba(232, 213, 181, 0.7);
}

/* Inline scroll reader on The Feed */
.feed-scroll-reader {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem 0.75rem;
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 6px;
  background:
    linear-gradient(165deg, rgba(42, 30, 22, 0.95), rgba(22, 16, 12, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 230, 180, 0.06);
}
.feed-scroll-reader__head {
  margin-bottom: 0.65rem;
}
.feed-scroll-reader__kicker {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, 0.85);
  margin-bottom: 0.2rem;
}
.feed-scroll-reader__title {
  margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--parchment, #f4ece0);
  line-height: 1.25;
}
.feed-scroll-reader__by {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: rgba(232, 213, 181, 0.75);
}
.feed-scroll-reader__stage {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 100%;
}
/* Poetry art stage fills the wider feed post so line structure holds. */
.feed-scroll-reader__stage--poetry-art {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  aspect-ratio: var(--feed-scroll-ratio, 8.5 / 11);
}
/* Widen to authored line length (Studio / Bookshelf match) when needed. */
.feed-scroll-reader.is-poetry-verse-fitted {
  overflow-x: auto;
}
.feed-scroll-reader.is-poetry-verse-fitted .feed-scroll-reader__stage--poetry-art,
.feed-scroll-reader.is-poetry-verse-fitted .feed-scroll-reader__stage {
  width: var(--poetry-scroll-fit-width, 100%);
  max-width: min(var(--poetry-scroll-fit-width, 100%), 100vw);
  margin-inline: auto;
}
.feed-scroll-page {
  position: relative;
  min-height: 10rem;
  max-height: min(36rem, 78vh);
  overflow: auto;
  padding: 1.15rem 1.35rem 1.35rem;
  color: var(--feed-scroll-ink, #1a1410);
  -webkit-overflow-scrolling: touch;
}
.feed-scroll-page[hidden] {
  display: none !important;
}
.feed-scroll-page.is-active {
  animation: feed-scroll-turn 0.28s ease;
}
@keyframes feed-scroll-turn {
  from { opacity: 0.35; transform: translateX(0.4rem); }
  to { opacity: 1; transform: none; }
}
.feed-scroll-page__label {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(26, 20, 16, 0.55);
}
.feed-scroll-page__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.28;
  pointer-events: none;
}
.feed-scroll-page__bg--ill {
  opacity: 0.35;
}
.feed-scroll-page--poetry-bg {
  background: #0a0810 !important;
  color: var(--feed-scroll-ink, #f4e8d0);
  padding: 0;
  overflow: hidden;
}
.feed-scroll-reader__stage--poetry-art .feed-scroll-page--poetry-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
}
/* Embed the real bookshelf poetry page so title/stanza gaps match the studio. */
/* Full-bleed background poems: mount fills the art stage. */
.feed-scroll-page--poetry-bg .feed-scroll-poetry-mount {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.feed-scroll-page--poetry-bg .feed-scroll-page__text--poetry-fallback {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 1.25rem 1.4rem;
  color: var(--feed-scroll-ink, #f4e8d0);
  font-family: var(--feed-scroll-font, Georgia, serif);
  font-size: var(--feed-scroll-size, 1rem);
  line-height: var(--feed-scroll-line-height, 1.15);
  white-space: pre-wrap;
}
.feed-scroll-page--poetry-bg .feed-scroll-bookshelf-page,
.feed-scroll-page--poetry-bg .bookshelf-reader__content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
}
/* Below-text / side / margin poems: flow in the page (not a fake background).
   Paper fills the feed card width — bleed the stage past the card’s side padding.
   Must kill aspect-ratio: a mixed scroll can keep .stage--poetry-art, and
   width:auto + aspect-ratio + fixed page height collapses to a narrow strip. */
.feed-scroll-reader:has(.feed-scroll-page--poetry-layout.is-active) .feed-scroll-reader__stage,
.feed-scroll-reader:has(.feed-scroll-page--poetry-completed.is-active) .feed-scroll-reader__stage {
  margin-left: -1rem;
  margin-right: -1rem;
  width: 100%;
  max-width: none;
  aspect-ratio: auto !important;
  border-radius: 0;
}
/* Active full-bleed art page: keep the format face at full card width. */
.feed-scroll-reader:has(.feed-scroll-page--poetry-bg.is-active) .feed-scroll-reader__stage--poetry-art {
  width: 100%;
  max-width: 100%;
  aspect-ratio: var(--feed-scroll-ratio, 8.5 / 11);
}
/*
 * Full-width card with a definite height so plateW/plateH % match Studio.
 * Do NOT use aspect-ratio here: with max-height it shrinks the used width and
 * leaves a tall empty gutter beside the page (regression on Feed Beside).
 */
.feed-scroll-page--poetry-layout {
  padding: 0;
  overflow: auto;
  width: 100% !important;
  min-width: 100%;
  max-width: 100%;
  height: min(32rem, 70vh);
  max-height: min(32rem, 70vh);
  aspect-ratio: auto !important;
  box-sizing: border-box;
}
.feed-scroll-page--poetry-layout .feed-scroll-poetry-mount {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
}
.feed-scroll-page--poetry-completed .feed-scroll-poetry-mount {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  min-height: 0;
  padding: 0.65rem 0.75rem 0.85rem;
  overflow: hidden;
}
/* Plate layouts: page box is fixed like Studio; poem scrolls inside its zone. */
.feed-scroll-page--poetry-layout:has(.bookshelf-reader__content--poetry-margin),
.feed-scroll-page--poetry-layout:has(.bookshelf-reader__content--poetry-side-left),
.feed-scroll-page--poetry-layout:has(.bookshelf-reader__content--poetry-side-right),
.feed-scroll-page--poetry-layout:has(.bookshelf-reader__content--poetry-bottom) {
  overflow: hidden;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content.bookshelf-reader__content--poetry-margin,
.feed-scroll-page--poetry-layout .bookshelf-reader__content.bookshelf-reader__content--poetry-side-left,
.feed-scroll-page--poetry-layout .bookshelf-reader__content.bookshelf-reader__content--poetry-side-right {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  height: 100%;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content.bookshelf-reader__content--poetry-bottom {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.feed-scroll-page--poetry-completed .bookshelf-reader__content {
  position: relative;
  inset: auto;
  width: 100%;
  box-sizing: border-box;
  min-height: 0;
  padding: 0.65rem 0.75rem 0.85rem;
  overflow: visible;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poem-title {
  color: var(--reader-ink, var(--feed-scroll-ink, #1a1410)) !important;
  -webkit-text-fill-color: var(--reader-ink, var(--feed-scroll-ink, #1a1410)) !important;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content-body,
.feed-scroll-page--poetry-layout .bookshelf-reader__content-body * {
  font-family: var(--reader-font, var(--feed-scroll-font, var(--font-accent, Georgia, serif)));
  color: var(--reader-ink, var(--feed-scroll-ink, #1a1410)) !important;
  -webkit-text-fill-color: var(--reader-ink, var(--feed-scroll-ink, #1a1410)) !important;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content-body {
  font-size: var(--reader-font-size, var(--feed-scroll-size, 1rem));
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-bottom {
  max-height: 85%;
  margin: 0 0.65rem 0.55rem;
  height: var(--poetry-split, 42%);
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-bottom .bookshelf-reader__poetry-ill-frame {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-bottom img,
.feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-bottom .bookshelf-reader__poetry-ill-frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain !important;
  object-position: center center;
  margin-inline: 0;
}
/* Margin + Beside: same as Studio — frame fills --poetry-split zone. */
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-margin .bookshelf-reader__poetry-ill-frame,
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-side .bookshelf-reader__poetry-ill-frame,
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-side .bookshelf-reader__poetry-ill-frame--cover {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-margin img,
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-margin .bookshelf-reader__poetry-ill-frame img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  margin-inline: 0;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-side img,
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-side .bookshelf-reader__poetry-ill-frame img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover !important;
  object-position: center center;
  margin-inline: 0;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-side-left,
.feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-side-right {
  align-items: stretch;
  gap: 0.5rem;
  height: 100%;
  min-height: 14rem;
  padding: 0.65rem;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-side {
  position: relative;
  flex: 0 0 var(--poetry-split, 46%);
  min-height: 0;
  max-height: none;
  align-self: stretch;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-margin {
  gap: 0;
  height: 100%;
  padding: 0.65rem;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-margin {
  flex: 0 0 var(--poetry-split, 42%);
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-scroll-page--poetry-layout .bookshelf-reader__poetry-frame {
  padding: 0.65rem 0.55rem;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  align-self: stretch;
}

/*
 * Phone only: crop Beside left/right and keep the page height-to-content —
 * the page-shaped aspect-ratio above is for tablet/desktop cards only, so
 * this stays exactly as it was (do not stretch to full poem height). Must
 * stay AFTER the general rules above so it wins the cascade on phones.
 */
@media (max-width: 600px) {
  .feed-scroll-page--poetry-layout {
    aspect-ratio: auto;
    height: auto;
    max-height: none;
  }

  .feed-scroll-page--poetry-layout .feed-scroll-poetry-mount,
  .feed-scroll-page--poetry-layout .bookshelf-reader__content {
    height: auto;
  }

  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-side-left,
  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-side-right {
    align-items: flex-start;
    height: auto;
    min-height: 0;
  }

  .feed-scroll-page--poetry-layout .bookshelf-reader__poetry-side {
    flex: 0 0 40%;
    align-self: flex-start;
    max-height: 11rem;
    min-height: 11rem;
  }

  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-margin {
    height: auto;
  }

  /* Below-text (and other paper plates): do not let flex:1 1 0 collapse the
     poem to 0 inside an auto-height column — old posts showed only the photo. */
  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-bottom .bookshelf-reader__content-body,
  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-side-left .bookshelf-reader__content-body,
  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-side-right .bookshelf-reader__content-body,
  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-margin .bookshelf-reader__content-body {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
  }

  .feed-scroll-page--poetry-layout .bookshelf-reader__poetry-bottom {
    height: auto;
    max-height: 12rem;
  }

  .feed-scroll-page--poetry-layout .bookshelf-reader__content--poetry-bottom .bookshelf-reader__poetry-ill-frame,
  .feed-scroll-page--poetry-layout .bookshelf-reader__poetry-bottom img {
    height: auto;
    max-height: 12rem;
    width: auto;
    max-width: 100%;
  }
}
.feed-scroll-page--poetry-completed {
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: min(32rem, 70vh);
  background: #0a0810 !important;
}
.feed-scroll-page--poetry-completed .bookshelf-reader__content--completed {
  padding: 0;
  min-height: 12rem;
  overflow: visible;
}
.feed-scroll-page--poetry-completed .bookshelf-reader__content-img--completed {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  max-height: none;
  object-fit: contain !important;
}
/* Feed only sizes/positions the shared reader; typography comes from bookshelf-reader.css. */
.feed-scroll-page--poetry-bg .bookshelf-reader__content--poetry-background .bookshelf-reader__content-body {
  font-family: var(--reader-font, var(--feed-scroll-font, var(--font-accent, Georgia, serif)));
  font-size: var(--reader-font-size, var(--feed-scroll-size, 1rem));
  justify-content: flex-start;
}
.feed-scroll-page__stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.feed-scroll-page__bg--full {
  opacity: 1;
  background-repeat: no-repeat;
}
.feed-scroll-page__scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 5, 3, 0.55);
  pointer-events: none;
}
.feed-scroll-page__text {
  position: relative;
  z-index: 1;
  font-family: var(--feed-scroll-font, var(--font-body, Georgia, serif));
  font-size: var(--feed-scroll-size, 1rem);
  line-height: var(--feed-scroll-line-height, 1.15);
  /* Highlight is inline on glyphs — never a full text-block plate. */
  background: transparent;
}
.feed-scroll-page__text .ink-text-highlight,
.feed-scroll-page__text span[style*="background-color"],
.feed-scroll-page__text mark,
.feed-scroll-bookshelf-page .ink-text-highlight,
.feed-scroll-bookshelf-page span[style*="background-color"],
.feed-scroll-bookshelf-page mark {
  display: inline !important;
  width: auto !important;
  max-width: none;
  align-self: auto !important;
  flex: none !important;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0.05em 0.18em;
  border-radius: 2px;
}

.feed-scroll-page__text .ink-text-effect--none,
.feed-scroll-bookshelf-page .ink-text-effect--none {
  text-shadow: none !important;
}
.feed-scroll-page__text .ink-text-effect--shadow,
.feed-scroll-bookshelf-page .ink-text-effect--shadow {
  --ink-fx-c: var(--ink-fx-color, #000000);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    calc(0.08em * var(--ink-fx-s)) calc(0.1em * var(--ink-fx-s)) calc(0.14em * var(--ink-fx-s))
      color-mix(in srgb, var(--ink-fx-c) 50%, transparent)
  ) !important;
}
.feed-scroll-page__text .ink-text-effect--outline,
.feed-scroll-bookshelf-page .ink-text-effect--outline {
  --ink-fx-c: var(--ink-fx-color, #c9a227);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    calc(-0.045em * var(--ink-fx-s)) calc(-0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(0.045em * var(--ink-fx-s)) calc(-0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(-0.045em * var(--ink-fx-s)) calc(0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(0.045em * var(--ink-fx-s)) calc(0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    0 calc(-0.055em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    0 calc(0.055em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(-0.055em * var(--ink-fx-s)) 0 0 var(--ink-fx-c),
    calc(0.055em * var(--ink-fx-s)) 0 0 var(--ink-fx-c)
  ) !important;
}
.feed-scroll-page__text .ink-text-effect--glow,
.feed-scroll-bookshelf-page .ink-text-effect--glow {
  --ink-fx-c: var(--ink-fx-color, #c9a227);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    0 0 calc(0.12em * var(--ink-fx-s)) var(--ink-fx-c),
    0 0 calc(0.28em * var(--ink-fx-s)) var(--ink-fx-c),
    0 0 calc(0.52em * var(--ink-fx-s)) color-mix(in srgb, var(--ink-fx-c) 72%, transparent)
  ) !important;
}
.feed-scroll-page__text .ink-text-effect--raised,
.feed-scroll-bookshelf-page .ink-text-effect--raised {
  --ink-fx-c: var(--ink-fx-color, #5a371c);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    0 calc(-0.035em * var(--ink-fx-s)) 0 rgba(255, 255, 255, 0.42),
    0 calc(0.09em * var(--ink-fx-s)) 0 color-mix(in srgb, var(--ink-fx-c) 70%, transparent),
    0 calc(0.15em * var(--ink-fx-s)) calc(0.2em * var(--ink-fx-s)) color-mix(in srgb, var(--ink-fx-c) 45%, transparent)
  ) !important;
}
.feed-scroll-page__text > div[style*="background"],
.feed-scroll-page__text div[style*="background-color"],
.feed-scroll-page__text p[style*="background"],
.feed-scroll-bookshelf-page .bookshelf-reader__content-text > div[style*="background"],
.feed-scroll-bookshelf-page .bookshelf-reader__content-text div[style*="background-color"],
.feed-scroll-bookshelf-page .bookshelf-reader__content-text p[style*="background"] {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
}
.feed-scroll-page__text--on-art {
  z-index: 2;
  height: 100%;
  max-height: inherit;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.15rem 1.2rem 1.4rem;
  box-sizing: border-box;
  text-align: center;
  color: inherit;
  background: transparent;
  white-space: pre-wrap;
  line-height: var(--feed-scroll-line-height, 1.15);
}
.feed-scroll-page__label--on-art {
  color: rgba(244, 232, 208, 0.7);
}
.feed-scroll-poem-title {
  margin: 0 0 0.85em;
  font-family: var(--feed-scroll-font, var(--font-display, Georgia, serif));
  font-size: 1.15em;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: inherit;
}
.feed-scroll-page__text p {
  margin: 0 0 0.65em;
}
.feed-scroll-page__text div {
  margin: 0;
}
/* Poetry on art: Word Spacing Before/After = 0 — Multiple alone sets rhythm. */
.feed-scroll-page__text--on-art p,
.feed-scroll-page__text--on-art div {
  margin: 0;
  padding: 0;
  min-height: 0;
}
.feed-scroll-page__text p:last-child {
  margin-bottom: 0;
}
.feed-scroll-page__art {
  display: block;
  width: 100%;
  max-height: min(26rem, 65vh);
  object-fit: contain;
  margin: 0 auto;
}
.feed-scroll-reader__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
}
.feed-scroll-nav-btn {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1px solid rgba(212, 165, 116, 0.45);
  background: rgba(12, 8, 5, 0.65);
  color: var(--candlelight, #d4a574);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.feed-scroll-nav-btn:hover:not(:disabled),
.feed-scroll-nav-btn:focus-visible:not(:disabled) {
  border-color: rgba(212, 165, 116, 0.85);
  background: rgba(26, 18, 12, 0.9);
  outline: none;
}
.feed-scroll-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.feed-scroll-reader__pos {
  font-size: 0.78rem;
  color: rgba(232, 213, 181, 0.8);
  min-width: 3.5rem;
  text-align: center;
}
.feed-scroll-reader__open {
  margin: 0.55rem 0 0;
  text-align: right;
  font-size: 0.78rem;
}
.feed-scroll-reader__open a {
  color: var(--candlelight, #d4a574);
  text-decoration: none;
}
.feed-scroll-reader__open a:hover,
.feed-scroll-reader__open a:focus-visible {
  text-decoration: underline;
}

.avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(139,69,19,.4); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); flex-shrink: 0; overflow: hidden; }
/* A user's uploaded headshot, when they have one — fills the same circle
   the lettered-initial fallback uses, so every existing size override
   (.post-reply-item .avatar, .messenger-list-link .avatar, etc.) still applies. */
.avatar-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 96px; height: 96px; font-size: 2.2rem; flex-shrink: 0; }

/* Scriptorium feed — author row + connect button */
.feed-author-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.feed-author-row .feed-author { margin-bottom: 0; }
.feed-post-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.feed-post-actions form { display: inline-flex; margin: 0; }

/* Reactions */
.post-reactions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .85rem; }
.reaction-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .55rem; border-radius: 999px;
  border: 1px solid rgba(212, 165, 116, .3);
  background: rgba(0, 0, 0, .2);
  color: var(--parchment, #f4ece0);
  font-size: .8rem; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.reaction-btn:hover,
.reaction-btn:focus-visible {
  border-color: rgba(212, 165, 116, .6);
  background: rgba(212, 165, 116, .15);
  transform: translateY(-2px) scale(1.06);
}
.reaction-btn.is-mine { background: rgba(212, 165, 116, .25); border-color: var(--candlelight, #d4a574); }
.reaction-btn-emoji { font-size: .95rem; line-height: 1; }
.reaction-btn-count { font-size: .72rem; opacity: .85; }

.post-reactions--reply { margin-top: .5rem; gap: .25rem; }
.reaction-btn--sm { padding: .15rem .4rem; }
.reaction-btn--sm .reaction-btn-emoji { font-size: .8rem; }
.reaction-btn--sm .reaction-btn-count { font-size: .66rem; }

/* Custom hover/focus label — shows instantly, unlike the browser's native
   title tooltip which is slow to appear and easy to miss. */
.reaction-btn::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 8, 6, 0.96);
  color: var(--candlelight, #d4a574);
  border: 1px solid rgba(212, 165, 116, .4);
  padding: .25rem .55rem;
  border-radius: 4px;
  font-size: .68rem;
  font-family: var(--font-display);
  letter-spacing: .04em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .1s, visibility .1s;
  z-index: 5;
}
.reaction-btn::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(212, 165, 116, .4);
  opacity: 0;
  visibility: hidden;
  transition: opacity .1s, visibility .1s;
  z-index: 5;
}
.reaction-btn:hover::after,
.reaction-btn:hover::before,
.reaction-btn:focus-visible::after,
.reaction-btn:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

/* Replies */
.post-replies { margin-top: .85rem; padding-top: .75rem; border-top: 1px solid rgba(255,255,255,.08); }
.post-reply-list { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.post-reply-item { display: flex; gap: .55rem; align-items: flex-start; }
.post-reply-item .avatar { width: 28px; height: 28px; font-size: .75rem; }
.post-reply-body { flex: 1; }
.post-reply-body p { margin: .1rem 0 0; font-size: .88rem; }
.post-reply-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.post-reply-meta form { display: inline-flex; margin: 0; }
.post-reply-delete,
.post-reply-edit-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  margin: 0;
  padding: .28rem .7rem;
  border: 1px solid rgba(212, 165, 116, .28);
  border-radius: 999px;
  background: rgba(26, 18, 12, .45);
  color: var(--parchment, #f4e8d0);
  font-family: var(--font-display, Cinzel, serif);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.2;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.post-reply-delete:hover,
.post-reply-edit-btn:hover {
  color: var(--candlelight, #d4a574);
  border-color: rgba(212, 165, 116, .55);
  background: rgba(44, 24, 16, .75);
  box-shadow: 0 0 0 1px rgba(212, 165, 116, .12);
}
.post-reply-delete:focus-visible,
.post-reply-edit-btn:focus-visible {
  outline: 2px solid var(--candlelight, #d4a574);
  outline-offset: 2px;
}
.post-reply-delete:not(.post-reply-edit-btn):hover {
  color: #f0c9b0;
  border-color: rgba(196, 120, 90, .55);
  background: rgba(72, 28, 20, .55);
}
.post-reply-form { display: flex; gap: .5rem; align-items: flex-start; }
.post-reply-form textarea { min-height: 2.4rem; max-height: 9.5rem; overflow-y: auto; resize: vertical; }

/* Quietly editable replies — no "(edited)" marker or history, by design */
.post-reply-edit-form { margin-top: .35rem; display: none; flex-direction: column; gap: .4rem; align-items: flex-start; }
.post-reply-edit-form:not([hidden]) { display: flex; }
.post-reply-edit-form[hidden] { display: none !important; }
.post-reply-edit-form textarea { min-height: 2.4rem; max-height: 9.5rem; overflow-y: auto; resize: vertical; }
.post-reply-edit-form .composer-field { width: 100%; }

/* Emoji picker — Lighthouse/WCAG need ~44×44px touch targets */
.composer-field { position: relative; flex: 1 1 auto; }
.composer-field .input { padding-right: 3.1rem; }
.emoji-picker-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
  opacity: .85;
  transition: opacity .15s, background .15s;
}
.emoji-picker-btn:hover,
.emoji-picker-btn:focus-visible,
.emoji-picker-btn[aria-expanded="true"] {
  opacity: 1;
  background: rgba(212, 165, 116, .15);
}
/* Fixed (not absolute) and appended straight to <body> by emoji-picker.js —
   several cards on this page (.card) use backdrop-filter, which quietly
   creates its own stacking context and traps any absolutely-positioned
   descendant behind later sibling cards regardless of z-index. Anchoring to
   the body and using viewport coordinates sidesteps that entirely. */
/* Setting `display` unconditionally on this element would otherwise beat the
   browser's own `[hidden] { display: none }` UA rule (author styles always
   outrank user-agent styles regardless of specificity), silently defeating
   panel.hidden = true in JS. This explicit override restores it. */
.emoji-picker-panel[hidden] {
  display: none;
}

.emoji-picker-panel {
  position: fixed;
  z-index: 150;
  width: 264px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 241, 224, 0.05), transparent 45%),
    linear-gradient(165deg, rgba(46, 27, 18, 0.99), rgba(24, 14, 10, 0.99));
  border: 1px solid rgba(212, 165, 116, .3);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.2);
  animation: emoji-picker-pop .16s ease-out;
}

@keyframes emoji-picker-pop {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.emoji-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem .75rem;
  border-bottom: 1px solid rgba(212, 165, 116, .16);
}

.emoji-picker-title {
  font-family: var(--font-display);
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, .8);
}

.emoji-picker-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--mist);
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.emoji-picker-close:hover,
.emoji-picker-close:focus-visible {
  background: rgba(212, 165, 116, .15);
  color: var(--candlelight);
}

.emoji-picker-recent {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .2rem;
  padding: .5rem .5rem 0;
}

.emoji-picker-recent[hidden] { display: none; }

.emoji-picker-recent-label {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: .58rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, .55);
  margin: 0 0 .3rem;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .2rem;
  padding: .6rem;
  max-height: 208px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 165, 116, .5) transparent;
}

.emoji-picker-grid::-webkit-scrollbar { width: 7px; }
.emoji-picker-grid::-webkit-scrollbar-track { background: transparent; }
.emoji-picker-grid::-webkit-scrollbar-thumb {
  background: rgba(212, 165, 116, .45);
  border: none;
  border-radius: 6px;
}
.emoji-picker-grid::-webkit-scrollbar-thumb:hover { background: rgba(212, 165, 116, .7); }

.emoji-picker-option {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.emoji-picker-option:hover,
.emoji-picker-option:focus-visible {
  background: rgba(212, 165, 116, .18);
  transform: scale(1.15);
}
.emoji-picker-option:active {
  transform: scale(.95);
  background: rgba(212, 165, 116, .3);
}

/* Connect button variants */
.connect-btn--pending { opacity: .7; cursor: default; }
.connect-btn--connected { color: #86efac; border-color: rgba(134, 239, 172, .4); }

/* My Guild page */
#guild-app {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.guild-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  align-items: center;
  margin: .75rem 0 1rem;
}
.guild-search-form input { flex: 1 1 220px; min-width: 0; }
.guild-search-live-hint { flex: 1 1 100%; margin: 0; }
.guild-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.guild-list-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-bottom: .75rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.guild-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.guild-list-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.feed-author--link {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.feed-author--link:hover strong,
.feed-author--link:focus-visible strong { color: var(--candlelight); }
.feed-author--inline {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  text-decoration: none;
  color: inherit;
}
.feed-author--inline:hover strong { color: var(--candlelight); }

/* Member profile + shared bookshelf */
.avatar-xl { width: 120px; height: 120px; font-size: 2.6rem; flex-shrink: 0; }
.member-profile {
  position: relative;
  z-index: 2;
  margin: 0.75rem auto 0.35rem;
}
.member-profile-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1.75rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.35rem 1.5rem;
  background:
    linear-gradient(145deg, rgba(44, 28, 18, 0.94), rgba(18, 12, 10, 0.96)),
    radial-gradient(ellipse at 12% 0%, rgba(201, 162, 39, 0.12), transparent 55%);
}
.member-profile-identity {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 280px;
}
.member-profile-avatar {
  border: 1px solid rgba(201, 162, 39, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.member-profile-eyebrow {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, 0.78);
}
.member-profile-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--candlelight);
}
.member-profile-handle {
  margin: 0.15rem 0 0.65rem;
  color: rgba(244, 232, 208, 0.72);
  font-family: var(--font-accent);
}
.member-profile-bio {
  margin: 0 0 0.85rem;
  max-width: 38rem;
  color: var(--parchment);
  font-family: var(--font-accent);
  line-height: 1.55;
}
.member-profile-bio--empty { color: rgba(244, 232, 208, 0.62); font-style: italic; }
.member-profile-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  color: rgba(212, 165, 116, 0.85);
  font-size: 0.82rem;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
.member-profile-disciplines {
  margin: 0.65rem 0 0;
  color: rgba(244, 232, 208, 0.62);
  font-size: 0.82rem;
}
.member-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}
.member-profile-image-report {
  margin: 0.85rem 0 0;
  width: 100%;
  text-align: right;
}
.member-profile-image-report .btn-link,
.member-report-image-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--gold, #d4a574);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.admin-report-avatar-preview {
  margin: 0.75rem 0;
}
.admin-report-avatar-preview img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(212, 165, 116, 0.35);
}
.account-bio-input { resize: vertical; min-height: 4.5rem; }
.account-privacy-fieldset {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid rgba(201, 162, 39, 0.28);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}
.account-privacy-fieldset legend { padding: 0 0.35rem; }
.account-location-timezone {
  display: grid;
  gap: 0.55rem;
}
.account-location-timezone > .hint {
  margin: -0.15rem 0 0.25rem;
}
.account-timezone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(212, 165, 116, 0.22);
  border-radius: 5px;
  background: rgba(13, 10, 8, 0.35);
}
.account-timezone-row .ink-label {
  display: block;
  margin-bottom: 0.15rem;
}
.account-timezone-row strong {
  color: var(--candlelight);
  font-size: 0.9rem;
  word-break: break-word;
}
@media (max-width: 520px) {
  .account-timezone-row {
    align-items: stretch;
    flex-direction: column;
  }
}
.account-check {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0.55rem 0 0.25rem;
  color: var(--parchment);
  font-family: var(--font-accent);
  cursor: pointer;
}
.account-check input { margin-top: 0.2rem; flex-shrink: 0; }
.page-member-profile .bookshelf-hall-heading { margin-top: 0.35rem; }
.messenger-thread-identity-link { flex: 1; min-width: 0; }
.member-profile-craft {
  margin: 0 0 0.55rem;
  color: rgba(212, 165, 116, 0.92);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}
.member-profile-craft--empty { color: rgba(244, 232, 208, 0.55); font-style: italic; }
.member-profile-posts,
.member-profile-milestones {
  position: relative;
  z-index: 2;
  margin: 0.35rem auto 0.85rem;
}
.member-profile-posts-card,
.member-profile-milestones-card { padding: 1rem 1.25rem 1.1rem; }
.member-profile-milestone-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.member-profile-milestone-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border-radius: 4px;
  border: 1px solid rgba(201, 162, 39, 0.22);
  background: rgba(201, 162, 39, 0.05);
}
.member-profile-milestone-seal {
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.55);
  color: var(--gold);
  font-size: 0.75rem;
  line-height: 1;
  margin-top: 0.1rem;
}
.member-profile-milestone-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.member-profile-milestone-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.member-profile-milestone-body {
  margin: 0;
  font-family: var(--font-accent);
  color: var(--parchment);
  line-height: 1.45;
  font-size: 0.98rem;
}
.member-profile-milestone-time {
  margin-top: 0.15rem;
}
.member-profile-posts-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.member-profile-posts-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--candlelight);
  letter-spacing: 0.04em;
}
.member-profile-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.member-profile-post-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  color: inherit;
  padding: 0.55rem 0.65rem;
  border-radius: 4px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}
.member-profile-post-link:hover,
.member-profile-post-link:focus-visible {
  border-color: rgba(201, 162, 39, 0.35);
  background: rgba(201, 162, 39, 0.06);
}
.member-profile-post-excerpt {
  font-family: var(--font-accent);
  color: var(--parchment);
  line-height: 1.45;
}
.member-profile-posts--hidden,
.member-profile-locked-note {
  margin: 0.5rem auto 1rem;
}
@media (max-width: 700px) {
  .member-profile-identity { flex-direction: column; align-items: center; text-align: center; }
  .member-profile-actions { width: 100%; justify-content: center; }
  .member-profile-image-report { text-align: center; }
  .member-profile-meta { justify-content: center; }
}

/* Notification bell */
.notif-bell-wrap { position: relative; }
.notif-bell {
  position: relative;
  background: none;
  border: none;
  font-size: 1.15rem;
  line-height: 1;
  padding: .4rem;
  cursor: pointer;
  color: var(--parchment);
  border-radius: 6px;
  transition: background .15s;
}
.notif-bell:hover, .notif-bell:focus-visible { background: rgba(212, 165, 116, .12); }
.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--mahogany);
}
.notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: rgba(15, 11, 9, 0.98);
  border: 1px solid rgba(212, 165, 116, .3);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  z-index: 40;
  padding: .5rem 0;
}
/* Side-dock / Panels toggle is z-index 90–240; raise the sticky header only
   while the bell is open so the desktop dropdown isn't covered. */
body.notif-dropdown-open .site-header {
  z-index: 260;
}
/* Phone portal: moved to <body> so header backdrop-filter cannot trap it. */
.notif-dropdown.notif-dropdown--portal {
  position: fixed !important;
  z-index: 280;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.notif-dropdown-title {
  margin: 0;
  padding: .4rem .9rem .6rem;
  font-family: var(--font-display);
  font-size: .8rem;
  letter-spacing: .04em;
  color: var(--candlelight);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item a {
  display: block;
  padding: .6rem .9rem;
  color: var(--parchment);
  font-size: .82rem;
  line-height: 1.35;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.notif-item:last-child a { border-bottom: none; }
.notif-item a:hover { background: rgba(212, 165, 116, .1); }
.notif-item.is-unread a { color: var(--candlelight); font-weight: 600; position: relative; padding-left: 1.3rem; }
.notif-item.is-unread a::before {
  content: '';
  position: absolute;
  left: .9rem;
  top: 1.05rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--candlelight, #d4a574);
}
.notif-empty { padding: .8rem .9rem; font-size: .8rem; color: var(--mist); }

@media (max-width: 959px) {
  /* Absolute width alone still hangs off the left edge — phones use the
     JS portal (.notif-dropdown--portal) for full on-screen placement. */
  .notif-dropdown:not(.notif-dropdown--portal) {
    width: min(320px, calc(100vw - 2rem));
    max-height: min(70dvh, 420px);
    -webkit-overflow-scrolling: touch;
  }
}

/* Legal */
.admin-report-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.admin-report-item { padding: 1rem; border: 1px solid rgba(201,162,39,.2); border-radius: 6px; background: rgba(61,56,50,.08); }
.admin-report-meta { margin-bottom: .5rem; }
.admin-report-content { margin: .5rem 0; padding: .5rem .75rem; border-left: 3px solid var(--gold); background: rgba(0,0,0,.15); font-style: italic; }
.admin-report-content cite { display: block; margin-top: .35rem; font-size: .8rem; color: var(--mist); font-style: normal; }
.admin-report-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.admin-report-action-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.admin-report-screenshots { margin-top: .75rem; }
.admin-report-screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .65rem;
  margin-top: .4rem;
}
.admin-report-screenshot-link {
  display: block;
  border: 1px solid rgba(201,162,39,.25);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0,0,0,.2);
}
.admin-report-screenshot-link img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.conversation-report-card { max-width: 32rem; }
.conversation-report-hint { margin: 0 0 .75rem; }
.conversation-report-file-label { display: block; margin: .75rem 0 .35rem; }
.conversation-report-error { color: #e8a090; margin: .5rem 0 0; font-size: .9rem; }
.messenger-thread-header { justify-content: flex-start; }
.messenger-thread-identity { flex: 1; min-width: 0; }
.messenger-report-btn,
.messenger-delete-btn { flex-shrink: 0; }
.messenger-thread-header .messenger-report-btn { margin-left: auto; }
.messenger-dock-header .messenger-report-btn,
.messenger-dock-header .messenger-delete-btn { margin-left: 0; }
.messenger-dock-actions {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.messenger-dock-actions:has(button:not([hidden])) {
  display: flex;
}
.messenger-dock-actions .messenger-report-btn,
.messenger-dock-actions .messenger-delete-btn,
.messenger-dock-actions #messenger-dock-new-group {
  margin-left: 0;
  flex-shrink: 0;
  padding: 0.25rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
}
.admin-member-controls {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(201,162,39,.15);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.admin-member-controls--page {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.admin-member-directory {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.admin-member-directory-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(201, 162, 39, 0.14);
}
.admin-member-directory-item:last-child {
  border-bottom: 0;
}
.admin-member-directory-name {
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.05rem;
  color: var(--candlelight, #d4a574);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.admin-member-directory-name:hover,
.admin-member-directory-name:focus-visible {
  color: var(--gold, #c9a227);
  border-bottom-color: rgba(201, 162, 39, 0.55);
}
.admin-member-directory-meta {
  flex: 1 1 100%;
  margin: 0;
}
.admin-member-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}
.admin-member-header-name {
  font-size: 1.15rem;
}
.admin-member-back {
  margin-bottom: 0.75rem;
}
.admin-member-block { margin: 0; }
.admin-member-block form { margin: 0; }
.admin-member-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.9rem;
}

.admin-member-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: stretch;
}
.admin-member-field-row .admin-member-input,
.admin-member-field-row .input {
  flex: 1 1 16rem;
  min-width: 0;
  width: auto;
  margin-bottom: 0;
}
.admin-member-field-row .btn {
  flex: 0 0 auto;
  align-self: center;
}
.admin-member-name-row .admin-member-input {
  flex: 1 1 8rem;
}
.admin-member-demote {
  margin-top: .25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(201,162,39,.2);
}
.admin-member-staff-role {
  margin-top: .25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(201,162,39,.2);
}
.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: .85rem;
  margin: 0 0 1.5rem;
}
.admin-action-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(201, 162, 39, 0.28);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-action-card:hover {
  border-color: var(--candlelight);
  box-shadow: 0 0 0 1px rgba(212, 165, 116, 0.2);
}
.admin-action-card--warn {
  border-color: rgba(212, 165, 116, 0.55);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.15);
}
.admin-action-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--gold);
  line-height: 1.1;
}
.admin-action-label {
  font-family: var(--font-accent);
  font-size: 0.95rem;
  color: var(--parchment);
}
.admin-prompt-live {
  font-family: var(--font-accent);
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--parchment);
  margin: 0.35rem 0 0.5rem;
}
.admin-prompt-rules-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  color: var(--mist);
  line-height: 1.55;
}
.admin-prompt-rules-list li { margin-bottom: 0.35rem; }

.admin-prompt-calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  max-width: 1100px;
  margin: 0 auto 1.5rem;
}

@media (max-width: 860px) {
  .admin-prompt-calendar-layout {
    grid-template-columns: 1fr;
  }
}

.admin-prompt-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.admin-prompt-cal-nav h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--gold);
  text-align: center;
  flex: 1;
}

.admin-prompt-cal-nav .btn.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.admin-prompt-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin: 0 0 0.85rem;
}

.admin-prompt-cal-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  margin-right: 0.3rem;
  vertical-align: middle;
  border: 1px solid rgba(212, 165, 116, 0.45);
  background: transparent;
}
.admin-prompt-cal-swatch.is-set {
  background: var(--gold);
  border-color: var(--gold);
}
.admin-prompt-cal-swatch.is-today {
  box-shadow: inset 0 0 0 2px rgba(244, 232, 208, 0.85);
}
.admin-prompt-cal-swatch.is-selected {
  background: rgba(212, 165, 116, 0.35);
  border-color: var(--candlelight);
}

.admin-prompt-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.admin-prompt-cal-dow {
  text-align: center;
  font-family: var(--font-accent);
  font-size: 0.78rem;
  color: var(--mist);
  padding: 0.25rem 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-prompt-cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.35rem 0.2rem;
  text-decoration: none;
  color: var(--parchment);
  background: rgba(13, 10, 8, 0.45);
  border: 1px solid rgba(212, 165, 116, 0.18);
  border-radius: 6px;
  font-family: var(--font-accent);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.admin-prompt-cal-cell.is-empty {
  visibility: hidden;
  pointer-events: none;
  border: 0;
  background: transparent;
}

.admin-prompt-cal-cell:hover {
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(70, 42, 28, 0.45);
}

.admin-prompt-cal-cell.is-today {
  box-shadow: inset 0 0 0 1px rgba(244, 232, 208, 0.55);
}

.admin-prompt-cal-cell.is-selected {
  border-color: var(--candlelight);
  background: linear-gradient(160deg, rgba(70, 42, 28, 0.95), rgba(36, 22, 16, 0.98));
  color: var(--candlelight);
}

.admin-prompt-cal-cell.has-ink .admin-prompt-cal-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  margin-top: 0.2rem;
  background: var(--gold);
  box-shadow: 0 0 0 1px rgba(212, 165, 116, 0.35);
}

.admin-prompt-cal-cell.is-past {
  opacity: 0.55;
}

.admin-prompt-cal-cell.is-blocked {
  opacity: 0.4;
}

.admin-prompt-cal-day {
  font-size: 0.95rem;
  line-height: 1;
}

.admin-prompt-day .admin-prompt-create,
.admin-prompt-day .admin-prompt-edit {
  margin-top: 0.75rem;
}

.admin-prompt-dates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin: 0.65rem 0;
}
.admin-prompt-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.admin-prompt-item {
  padding: 1rem;
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: 6px;
  background: rgba(61, 56, 50, 0.08);
}
.admin-prompt-item.is-live {
  border-color: rgba(201, 162, 39, 0.5);
}
.admin-prompt-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.55rem;
}
.admin-prompt-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: var(--candlelight);
}
.admin-prompt-status--active {
  background: rgba(201, 162, 39, 0.18);
  color: var(--gold);
}
.admin-prompt-status--upcoming { opacity: 0.95; }
.admin-prompt-status--ended { opacity: 0.65; }
.admin-prompt-delete { margin-top: 0.5rem; }
.admin-prompt-history {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.admin-prompt-history li {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.15);
}
.admin-prompt-history li:last-child { border-bottom: 0; padding-bottom: 0; }
.admin-prompt-history strong {
  display: block;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.two-factor-steps { padding-left: 1.25rem; }
.two-factor-steps li { margin-bottom: .6rem; line-height: 1.5; }
.two-factor-setup .account-card {
  overflow-x: hidden;
  overflow-wrap: anywhere;
}
.two-factor-qr {
  margin: .85rem 0 .35rem;
  padding: .75rem;
  width: fit-content;
  max-width: 100%;
  background: #fff;
  border-radius: 8px;
}
.two-factor-qr svg { display: block; width: 196px; height: 196px; max-width: 100%; }
.two-factor-manual { margin: 1rem 0 1.25rem; }
.two-factor-manual summary { cursor: pointer; color: var(--gold, #c4a574); }
.two-factor-secret { display: inline-block; padding: .3rem .6rem; background: rgba(61,56,50,.15); border-radius: 4px; font-family: monospace; font-size: 1rem; letter-spacing: 1px; word-break: break-all; }
.two-factor-rotate-form { margin: 0.75rem 0 1.25rem; }
.two-factor-codes-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.two-factor-codes-list code { display: block; padding: .5rem .75rem; background: rgba(61,56,50,.15); border-radius: 4px; font-size: .95rem; text-align: center; }
.legal-content h2 { font-family: var(--font-display); color: var(--candlelight); margin-top: 2rem; }
.legal-content h3 { color: var(--candlelight); margin-top: 1.25rem; font-size: 1.05rem; }
.legal-content ul, .legal-content ol { padding-left: 1.5rem; }
.legal-content li { margin-bottom: .4rem; }
.legal-content .legal-callout { background: rgba(61,56,50,.08); border: 1px solid rgba(212,165,116,.25); border-radius: 6px; padding: 1rem 1.25rem; margin: 1.25rem 0; }
.legal-content .legal-toc { background: rgba(61,56,50,.06); border-radius: 6px; padding: 1rem 1.5rem; margin: 1.5rem 0; }
.legal-content .legal-toc a { color: var(--candlelight); }

/* Accessibility */
.a11y-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 400;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--mahogany);
  border: 1px solid rgba(212,165,116,.4);
  color: var(--candlelight);
  cursor: pointer;
  font-size: 1.25rem;
  transition: right .25s ease;
}
.a11y-panel {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  z-index: 400;
  width: 260px;
  padding: 1rem;
  background: rgba(44,24,16,.97);
  border: 1px solid rgba(212,165,116,.35);
  border-radius: 8px;
  transition: right .25s ease;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
.a11y-panel.hidden { display: none; }
.a11y-panel h3,
.a11y-panel-title {
  margin: 0 0 .75rem;
  font-family: var(--font-display);
  color: var(--candlelight);
  font-size: 1rem;
}
.a11y-group { margin-bottom: .85rem; }
.a11y-label {
  display: block;
  margin: 0 0 .4rem;
  font-size: .8rem;
  color: var(--mist);
}
.a11y-btns { display: flex; flex-wrap: wrap; gap: .25rem; }
.a11y-btns button {
  flex: 1;
  padding: .4rem .25rem;
  font-size: .7rem;
  background: transparent;
  border: 1px solid var(--stone);
  color: var(--candlelight);
  cursor: pointer;
  border-radius: 3px;
}
.a11y-btns button.is-active,
.a11y-btns button[aria-pressed="true"] {
  background: rgba(201,162,39,.22);
  border-color: var(--gold);
  color: var(--parchment);
}
.a11y-toggle-pref {
  display: block;
  width: 100%;
  margin: 0 0 .5rem;
  text-align: left;
}
.a11y-toggle-pref.is-active,
.a11y-toggle-pref[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--parchment);
}

/* The messenger dock's compose bar shares this exact bottom-right corner
   of the screen — when the dock is open, slide the a11y toggle/panel clear
   of the 360px panel (+ inset) so it does not cover the message field. */
body.messenger-dock-open .a11y-toggle,
body.messenger-dock-open .a11y-panel {
  right: calc(360px + 0.65rem + 3.75rem);
}
@media (max-width: 860px) {
  /* The dock itself is hidden below this width, so the corner is free again. */
  body.messenger-dock-open .a11y-toggle,
  body.messenger-dock-open .a11y-panel {
    right: 1rem;
  }
}

/* Animations */
@keyframes flicker { 0%,100%{opacity:1} 50%{opacity:.92} 75%{opacity:.97} }

/* A11y overrides — text size scales rem-based UI across the site */
html[data-font-size="large"] { font-size: 18px; }
html[data-font-size="xlarge"] { font-size: 22px; }
html[data-font-size="xxlarge"] { font-size: 26px; }

.a11y-note {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--mist);
}

/* Stay above immersive studio chrome in CSS fullscreen / immersive modes */
body.writing-immersive-mode .a11y-toggle,
body.writing-immersive-mode .a11y-panel,
body.art-immersive-mode .a11y-toggle,
body.art-immersive-mode .a11y-panel,
body.art-tutorial-active .a11y-toggle,
body.art-tutorial-active .a11y-panel,
:fullscreen .a11y-toggle,
:fullscreen .a11y-panel,
:-webkit-full-screen .a11y-toggle,
:-webkit-full-screen .a11y-panel {
  z-index: 2147483000;
}

body.art-tutorial-active .a11y-toggle,
body.art-tutorial-active .a11y-panel {
  display: none !important;
}

/* Writing effects store the finished text-shadow on the span (TipTap / Word
   pattern). --ink-fx-shadow is the !important carrier; legacy --ink-fx-color
   recipes remain as fallback. */
.ink-text-effect--none {
  text-shadow: none !important;
}

.ink-text-effect--shadow {
  --ink-fx-c: var(--ink-fx-color, #000000);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    calc(0.08em * var(--ink-fx-s)) calc(0.1em * var(--ink-fx-s)) calc(0.14em * var(--ink-fx-s))
      color-mix(in srgb, var(--ink-fx-c) 50%, transparent)
  ) !important;
}

.ink-text-effect--outline {
  --ink-fx-c: var(--ink-fx-color, #c9a227);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    calc(-0.045em * var(--ink-fx-s)) calc(-0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(0.045em * var(--ink-fx-s)) calc(-0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(-0.045em * var(--ink-fx-s)) calc(0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(0.045em * var(--ink-fx-s)) calc(0.045em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    0 calc(-0.055em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    0 calc(0.055em * var(--ink-fx-s)) 0 var(--ink-fx-c),
    calc(-0.055em * var(--ink-fx-s)) 0 0 var(--ink-fx-c),
    calc(0.055em * var(--ink-fx-s)) 0 0 var(--ink-fx-c)
  ) !important;
}

.ink-text-effect--glow {
  --ink-fx-c: var(--ink-fx-color, #c9a227);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    0 0 calc(0.12em * var(--ink-fx-s)) var(--ink-fx-c),
    0 0 calc(0.28em * var(--ink-fx-s)) var(--ink-fx-c),
    0 0 calc(0.52em * var(--ink-fx-s)) color-mix(in srgb, var(--ink-fx-c) 72%, transparent)
  ) !important;
}

.ink-text-effect--raised {
  --ink-fx-c: var(--ink-fx-color, #5a371c);
  --ink-fx-s: var(--ink-fx-strength, 1);
  text-shadow: var(
    --ink-fx-shadow,
    0 calc(-0.035em * var(--ink-fx-s)) 0 rgba(255, 255, 255, 0.42),
    0 calc(0.09em * var(--ink-fx-s)) 0 color-mix(in srgb, var(--ink-fx-c) 70%, transparent),
    0 calc(0.15em * var(--ink-fx-s)) calc(0.2em * var(--ink-fx-s)) color-mix(in srgb, var(--ink-fx-c) 45%, transparent)
  ) !important;
}

/* Effects must never reduce legibility when high contrast is explicitly on. */
html[data-contrast="high"] .ink-text-effect {
  text-shadow: none !important;
}

html[data-contrast="high"] .print-page-area,
html[data-contrast="high"] .immersive-editor-area,
html[data-contrast="high"] .work-novel-text,
html[data-contrast="high"] .work-poetry-text,
html[data-contrast="high"] .work-poetry-framed-text {
  color: #000 !important;
}
html[data-contrast="high"] .print-page--dark-paper .print-page-area,
html[data-contrast="high"] .print-page--dark-paper .immersive-editor-area {
  color: #fff !important;
}
html[data-contrast="high"] .page-fmt-btn {
  border-color: #fff;
  color: #fff;
  background: #000;
}

/* High contrast: force readable tokens everywhere, including auth glass UI */
html[data-contrast="high"] {
  --parchment: #ffffff;
  --ink: #000000;
  --candlelight: #ffe08a;
  --mist: #f3f3f3;
  --mahogany: #111111;
  --stone: #ffffff;
  --gold: #ffd700;
  --ember: #2a2a2a;
  --shadow: #000000;
}
html[data-contrast="high"] body {
  background: #000;
  color: #fff;
}
html[data-contrast="high"] a {
  color: #ffe08a;
  text-decoration: underline;
}
html[data-contrast="high"] .auth-overlay {
  background: rgba(0, 0, 0, 0.55);
}
html[data-contrast="high"] .auth-form-wrap,
html[data-contrast="high"] .auth-academy-link {
  background: #000;
  color: #fff;
  text-shadow: none;
  border-color: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
html[data-contrast="high"] .auth-card,
html[data-contrast="high"] .auth-card h1,
html[data-contrast="high"] .auth-card h2,
html[data-contrast="high"] .auth-card .subtitle,
html[data-contrast="high"] .auth-page .ink-label,
html[data-contrast="high"] .auth-page .hint,
html[data-contrast="high"] .switch-mode a,
html[data-contrast="high"] .auth-academy-link .hint,
html[data-contrast="high"] .auth-academy-link .btn-ghost {
  color: #fff;
  text-shadow: none;
}
html[data-contrast="high"] .auth-page .ink-input {
  background: #fff;
  color: #000;
  border: 2px solid #fff;
  text-shadow: none;
}
html[data-contrast="high"] .auth-page .ink-input::placeholder {
  color: #444;
}
html[data-contrast="high"] .auth-page .ink-input:focus {
  color: #000;
  outline: 3px solid #ffd700;
  border-color: #ffd700;
}
html[data-contrast="high"] .auth-page .btn,
html[data-contrast="high"] .auth-page .btn:hover {
  background: #ffd700;
  color: #000;
  border: 2px solid #fff;
}
html[data-contrast="high"] .auth-academy-link {
  border-top: 2px solid #fff;
}
html[data-contrast="high"] .auth-academy-link .btn-ghost {
  border: 2px solid #fff;
}
html[data-contrast="high"] .a11y-panel,
html[data-contrast="high"] .a11y-toggle {
  background: #000;
  border: 2px solid #fff;
  color: #fff;
}
html[data-contrast="high"] .a11y-btns button,
html[data-contrast="high"] .a11y-toggle-pref {
  border-color: #fff;
  color: #fff;
}
html[data-contrast="high"] .card,
html[data-contrast="high"] .site-header,
html[data-contrast="high"] .site-footer {
  background: #000;
  color: #fff;
  border-color: #fff;
}

/* Reduced motion: kill animations/transitions (auth background video still plays) */
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
/* Copyright plaque & ownership pledge */
.ownership-pledge {
  display: flex; gap: 1rem; padding: 1.25rem;
  background: rgba(44,24,16,.7); border: 1px solid rgba(201,162,39,.35);
  border-radius: 8px;
}
.ownership-pledge--compact { flex-direction: column; gap: .5rem; padding: 1rem; }
.signup-pledge { margin: 1rem 0; background: rgba(13,10,8,.5); }
.pledge-icon { font-size: 2rem; color: var(--gold); line-height: 1; }
.pledge-title { font-family: var(--font-display); color: var(--candlelight); font-size: 1rem; letter-spacing: .08em; margin: 0 0 .5rem; }
.pledge-list { margin: .75rem 0; padding-left: 1.25rem; color: var(--mist); font-size: .9rem; }
.pledge-footnote { font-size: .75rem; color: var(--mist); margin: .75rem 0 0; font-style: italic; }
.pledge-checkbox { display: flex; align-items: flex-start; gap: .5rem; font-size: .85rem; color: var(--parchment); cursor: pointer; margin-top: .5rem; }
.pledge-checkbox input { margin-top: .2rem; }
.ownership-welcome-modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(13,10,8,.85);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}

/* Styled stand-ins for the browser's native alert()/confirm() — see notify.js */
.toast-stack {
  position: fixed; top: 1rem; right: 1rem; z-index: 300;
  display: flex; flex-direction: column; gap: .6rem; max-width: 340px;
}
.toast {
  display: flex; align-items: flex-start; gap: .6rem;
  background: linear-gradient(135deg, rgba(44,24,16,.97), rgba(26,20,16,.97));
  border: 1px solid rgba(201,162,39,.4); border-radius: 6px;
  padding: .85rem 1rem; box-shadow: 0 6px 24px rgba(0,0,0,.4);
  color: var(--parchment); font-family: var(--font-accent); font-size: .9rem;
  opacity: 0; transform: translateX(24px); transition: opacity .25s ease, transform .25s ease;
}
.toast.is-visible { opacity: 1; transform: translateX(0); }
.toast--error { border-color: rgba(248,113,113,.5); }
.toast--success { border-color: rgba(134,239,172,.5); }
.toast-icon { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }
.toast--error .toast-icon { color: #f87171; }
.toast--success .toast-icon { color: #86efac; }
.toast--info .toast-icon { color: var(--gold); }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close {
  background: none; border: none; color: var(--mist); cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 0 0 0 .25rem; flex-shrink: 0;
}
.toast-close:hover { color: var(--candlelight); }
@media (max-width: 480px) {
  .toast-stack { left: 1rem; right: 1rem; max-width: none; }
}

body.confirm-modal-open { overflow: hidden; }

.confirm-modal-overlay {
  position: fixed; inset: 0; z-index: 720; background: rgba(13,10,8,.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  animation: confirm-modal-in .22s ease;
}
@media (max-width: 959px) {
  /* Above writing immersive chrome / dock (≤260) and art overlays. */
  .confirm-modal-overlay {
    z-index: 980;
  }
}
.confirm-modal-card {
  max-width: 420px; width: 100%;
  background: linear-gradient(145deg, rgba(44,24,16,.98), rgba(22,16,12,.98));
  border: 1px solid rgba(201,162,39,.45); border-radius: 6px; padding: 1.35rem 1.5rem 1.25rem;
  box-shadow:
    0 12px 40px rgba(0,0,0,.55),
    0 0 0 1px rgba(201,162,39,.12),
    inset 0 1px 0 rgba(255,220,160,.06);
}
.confirm-modal-eyebrow {
  margin: 0 0 .35rem;
  font-family: var(--font-display);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(212,165,116,.75);
}
.confirm-modal-title {
  margin: 0 0 .65rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: .03em;
  color: var(--candlelight);
}
.confirm-modal-message {
  color: var(--parchment); font-family: var(--font-accent); font-size: 1rem;
  margin: 0 0 1.25rem; line-height: 1.55;
}
.confirm-modal-input { width: 100%; margin: 0 0 1.25rem; box-sizing: border-box; }
.confirm-modal-actions { display: flex; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; }
.confirm-modal-actions--stack {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
.confirm-modal-actions--stack .btn,
.confirm-modal-actions--stack .btn-ghost {
  width: 100%;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}
.confirm-modal-ok--danger {
  border-color: rgba(232,140,120,.55);
  background: linear-gradient(180deg, rgba(120,48,40,.55), rgba(70,28,24,.75));
  color: #f6e6df;
}
.confirm-modal-ok--danger:hover {
  border-color: rgba(248,170,150,.75);
  background: linear-gradient(180deg, rgba(140,56,46,.65), rgba(80,32,28,.85));
}
.confirm-modal-card .report-reason-select { width: 100%; margin-bottom: .75rem; }
.confirm-modal-card .report-details-input { width: 100%; margin-bottom: 1.25rem; resize: vertical; font-family: var(--font-accent); }
@keyframes confirm-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ownership-welcome-card { max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.copyright-plaque {
  display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; padding: 1.5rem; margin-bottom: 1.5rem;
  background: linear-gradient(135deg, rgba(44,24,16,.95), rgba(26,20,16,.95));
  border: 2px solid rgba(201,162,39,.5); border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,.4), inset 0 1px 0 rgba(201,162,39,.15); position: relative;
}
.copyright-plaque::before, .copyright-plaque::after {
  content: ''; position: absolute; width: 24px; height: 24px; border: 2px solid rgba(201,162,39,.4);
}
.copyright-plaque::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.copyright-plaque::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }
.plaque-seal {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 35% 35%, #a0522d, #6b2d15 60%, #4a1a0a);
  border: 3px solid var(--gold); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.seal-inner { font-family: var(--font-display); font-size: 1.75rem; color: var(--gold); font-weight: 700; }
.plaque-header { font-family: var(--font-display); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 0 0 .75rem; text-align: center; border-bottom: 1px solid rgba(201,162,39,.3); padding-bottom: .5rem; }
.plaque-copyright { font-family: var(--font-display); font-size: 1.15rem; color: var(--candlelight); margin: 0; }
.plaque-title { font-family: var(--font-accent); font-style: italic; font-size: 1.05rem; color: var(--parchment); margin: .25rem 0; }
.plaque-rights { font-family: var(--font-display); font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--mist); margin: .25rem 0 .75rem; }
.plaque-divider { height: 1px; background: linear-gradient(to right, transparent, rgba(201,162,39,.4), transparent); margin: .75rem 0; }
.plaque-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; font-size: .75rem; }
.plaque-meta div { text-align: center; }
.plaque-meta dt { color: var(--mist); font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; }
.plaque-meta dd { color: var(--candlelight); font-family: var(--font-display); margin: 0; font-size: .8rem; }
.plaque-fingerprint { font-family: monospace; font-size: .7rem !important; }
.plaque-pledge { font-size: .8rem; color: var(--mist); margin: .75rem 0 0; text-align: center; font-style: italic; border-top: 1px solid rgba(61,56,50,.4); padding-top: .75rem; }
.work-view-header { padding: 1.5rem 0; border-bottom: 1px solid rgba(61,56,50,.3); background: rgba(44,24,16,.2); }
.work-content { padding: 2rem; font-family: var(--font-accent); font-size: 1.1rem; line-height: 1.9; margin: 1.5rem 0; }
.registry-badge, .book-copyright {
  position: absolute; top: -8px; right: -4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); color: var(--ink); font-size: .6rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display);
}
.shelf-book, .film-reel { position: relative; text-decoration: none; color: inherit; }
.registry-toast { text-align: center; padding: .75rem; margin-bottom: 1rem; background: rgba(201,162,39,.15); border: 1px solid rgba(201,162,39,.3); border-radius: 4px; color: var(--candlelight); }

/* Messenger */
.messenger {
  display: grid;
  grid-template-columns: 280px 1fr;
  /* Without this, the implicit row sizes to fit ALL of its content (the
     whole message thread) instead of the box below — as a conversation
     grows past max-height, overflow:hidden then clips the compose bar
     right off the bottom instead of the thread scrolling internally. */
  grid-template-rows: minmax(0, 1fr);
  gap: 1.25rem;
  background: rgba(44,24,16,.85);
  border: 1px solid rgba(212,165,116,.2);
  border-radius: 8px;
  overflow: hidden;
  min-height: 60vh;
  max-height: 75vh;
}
@media (max-width: 720px) {
  .messenger { grid-template-columns: 1fr; max-height: none; }
  .messenger-thread-pane { min-height: 50vh; }
}
.messenger-list-pane {
  min-height: 0;
  border-right: 1px solid rgba(255,255,255,.08);
  overflow-y: auto;
  padding: 1rem 0;
}
@media (max-width: 720px) { .messenger-list-pane { border-right: none; border-bottom: 1px solid rgba(255,255,255,.08); } }
.messenger-pane-title {
  margin: 0 1rem .5rem;
  font-family: var(--font-display);
  font-size: .85rem;
  letter-spacing: .04em;
  color: var(--candlelight);
}
.messenger-pane-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: 0 1rem .5rem;
}
.messenger-pane-title-row .messenger-pane-title { margin: 0; }
.messenger-search {
  margin: 0 1rem .75rem;
}
.messenger-search-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}
.messenger-search-empty {
  padding: .75rem 1rem;
  font-size: .82rem;
  color: var(--mist);
  list-style: none;
}
.messenger-dock-search {
  flex-shrink: 0;
  margin: .35rem .75rem .25rem;
}
.messenger-dock-search[hidden] {
  display: none;
}
.messenger-new-group {
  margin: 0 1rem 1rem;
  padding: .75rem;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.2);
}
.messenger-new-group .input { margin-bottom: .5rem; }
.messenger-group-pick-list {
  list-style: none;
  margin: 0 0 .75rem;
  padding: 0;
  max-height: 10rem;
  overflow-y: auto;
}
.messenger-group-pick {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem 0;
  cursor: pointer;
  font-size: .88rem;
}
.messenger-new-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.avatar.avatar--group {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 165, 116, .15);
  font-size: .95rem;
}
.messenger-bubble-sender {
  font-size: .72rem;
  color: var(--candlelight);
  margin-bottom: .15rem;
  padding: 0 .25rem;
}
.messenger-list { list-style: none; margin: 0; padding: 0; }
.messenger-list-item.is-active { background: rgba(212, 165, 116, .1); }
.messenger-list-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1rem;
  text-decoration: none;
  color: var(--parchment);
  position: relative;
}
.messenger-list-link:hover { background: rgba(212, 165, 116, .08); }
.messenger-list-link .avatar { width: 36px; height: 36px; font-size: .85rem; }
.messenger-list-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.messenger-list-meta strong { font-size: .9rem; }
.messenger-list-preview {
  font-size: .78rem;
  color: var(--mist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messenger-list-item.has-unread .messenger-list-preview { color: var(--parchment); }
.messenger-list-item.has-unread strong { color: var(--candlelight); }
.messenger-unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}
.messenger-thread-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.messenger-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mist);
  font-style: italic;
  padding: 2rem;
  text-align: center;
}
.messenger-thread-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.messenger-thread {
  list-style: none;
  margin: 0;
  padding: 1rem 1.25rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.messenger-thread-empty { text-align: center; color: var(--mist); font-style: italic; padding: 1rem 0; list-style: none; }
.messenger-bubble-row { display: flex; flex-direction: column; max-width: 72%; }
.messenger-bubble-row.is-mine { align-self: flex-end; align-items: flex-end; }
.messenger-bubble-row.is-theirs { align-self: flex-start; align-items: flex-start; }
.messenger-bubble {
  padding: .6rem .9rem;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.45;
  word-break: break-word;
}
.messenger-bubble-row.is-mine .messenger-bubble {
  background: linear-gradient(to bottom, var(--ember), var(--mahogany));
  color: var(--parchment);
  border-bottom-right-radius: 4px;
}
.messenger-bubble-row.is-theirs .messenger-bubble {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--parchment);
  border-bottom-left-radius: 4px;
}
.messenger-bubble-time { font-size: .68rem; color: var(--mist); margin-top: .2rem; padding: 0 .25rem; }
.messenger-bubble-meta {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-top: .15rem;
  padding: 0 .25rem;
}
.messenger-bubble-row.is-mine .messenger-bubble-meta { justify-content: flex-end; }
.messenger-msg-delete,
.messenger-msg-edit {
  all: unset;
  cursor: pointer;
  font-size: .68rem;
  color: var(--mist);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.messenger-msg-delete:hover,
.messenger-msg-edit:hover { color: var(--candlelight); }
.messenger-compose {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
  padding: .9rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.messenger-compose .composer-field { margin-bottom: 0; }
.messenger-compose textarea.input {
  margin-bottom: 0;
  resize: none;
  /* Grows with typed content (see the auto-grow JS) up to this cap, then
     scrolls internally instead of pushing the Send button off-screen. */
  max-height: 9.5rem;
  overflow-y: auto;
}

/* Messenger dock — persistent right-hand chat sidebar shown on the feed.
   The tab and panel are positioned independently (not nested) because a
   `transform` on an ancestor would make that ancestor the containing block
   for any `position: fixed` descendant, breaking the panel's full-height
   sizing against the viewport. */
.side-dock {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

/* When no panel is open, shrink the dock to the tab strip so a full-viewport
   overlay cannot sit above the canvas and eat drag / resize hits (fullscreen). */
.side-dock:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open) {
  inset: auto;
  top: 0;
  right: 0;
  bottom: 0;
  width: calc(3.25rem + var(--side-dock-inset, 0px));
}

.side-dock:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open) .messenger-dock {
  inset: auto;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
}

/* Keep Messages / Notes reachable in every studio fullscreen / focus mode */
body.writing-immersive-mode .side-dock,
body.writing-focus-mode .side-dock,
body.art-immersive-mode .side-dock,
body.art-focus-mode .side-dock,
:fullscreen .side-dock,
:-webkit-full-screen .side-dock {
  display: block !important;
  z-index: 230;
}

/* Unlocked art fullscreen: don’t let the closed tab strip steal NE/SE grabs.
   Open panels keep pointer-events; Lock restores the strip for Messages/Notes. */
body.art-immersive-mode.art-easel-unlocked .side-dock:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open),
body.art-focus-mode.art-easel-unlocked .side-dock:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open) {
  pointer-events: none;
}

/* Nested art-stage scrollbars sit inside the viewport (themed ~11px bar).
   Writing fullscreen often has no gutter there — do not force an inset gap.
   JS sets --side-dock-inset on <html> to the live overlap (or 0). */
html:has(body.art-immersive-mode),
html:has(body.art-focus-mode) {
  --side-dock-inset: 11px;
}
.messenger-dock { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.side-dock .messenger-dock { position: absolute; inset: 0; z-index: auto; }
.messenger-dock-tab,
.side-dock-tab--notes,
.side-dock-tab--craft,
.side-dock-tab--thesaurus {
  position: absolute;
  /* Classic body scrollbars sit outside the layout viewport — keep 0.
     Nested fullscreen scrollbars (art stage, etc.) set --side-dock-inset. */
  right: var(--side-dock-inset, 0px);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  box-sizing: border-box;
  background: var(--mahogany);
  border: 1px solid rgba(212,165,116,.4);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: .65rem 0;
  width: 2.85rem;
  min-width: 2.85rem;
  max-width: 2.85rem;
  /* Equal height so % stack overlaps match (Messages label is longer than Notes/Craft). */
  height: 8.1rem;
  min-height: 8.1rem;
  max-height: 8.1rem;
  overflow: hidden;
  cursor: pointer;
  color: var(--candlelight);
  box-shadow: -2px 2px 10px rgba(0,0,0,.35);
}
.messenger-dock-tab {
  top: 50%;
  transform: translateY(-50%);
}
/* Binder-tab stack: each upper tab overlaps the next by the same amount */
.side-dock .messenger-dock-tab.side-dock-tab--messages {
  top: 50%;
  /* Two-tab stack (no Craft): bottom overlaps Notes */
  transform: translateY(calc(-100% + 0.55rem));
  z-index: 3;
}
body:has(.side-dock-tab--craft) .side-dock .messenger-dock-tab.side-dock-tab--messages {
  /* Three-tab: Messages → Notes overlap matches Notes → Craft */
  transform: translateY(calc(-150% + 0.55rem));
}
.side-dock-tab--notes {
  top: 50%;
  transform: translateY(0);
  z-index: 2;
}
body:has(.side-dock-tab--craft) .side-dock-tab--notes {
  transform: translateY(-50%);
}
.side-dock-tab--craft {
  top: 50%;
  transform: translateY(calc(50% - 0.55rem));
  z-index: 1;
}
/* Craft lives in #side-dock with Messages/Notes — keep identical edge flush */
.side-dock .side-dock-tab--craft {
  position: absolute;
  right: var(--side-dock-inset, 0px);
  left: auto;
}


/* Four-tab stack when Thesaurus is present (under Craft on writing desks). */
body:has(.side-dock-tab--thesaurus) .side-dock .messenger-dock-tab.side-dock-tab--messages {
  transform: translateY(calc(-200% + 1.05rem));
  z-index: 4;
}
body:has(.side-dock-tab--thesaurus) .side-dock-tab--notes {
  transform: translateY(calc(-100% + 0.55rem));
  z-index: 3;
}
body:has(.side-dock-tab--thesaurus) .side-dock-tab--craft,
body:has(.side-dock-tab--thesaurus) .studio-craft-toggle.side-dock-tab--craft {
  transform: translateY(0);
  z-index: 2;
}
.side-dock-tab--thesaurus {
  top: 50%;
  transform: translateY(calc(100% - 0.55rem));
  z-index: 1;
  right: var(--side-dock-inset, 0px);
  left: auto;
}
/* Mobile hamburger — hidden on desktop; shown ≤860px via media query below. */
.side-dock-menu-toggle {
  display: none;
  position: absolute;
  right: var(--side-dock-inset, 0px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  pointer-events: auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  box-sizing: border-box;
  width: 2.85rem;
  min-width: 2.85rem;
  max-width: 2.85rem;
  height: 8.1rem;
  min-height: 8.1rem;
  max-height: 8.1rem;
  margin: 0;
  padding: .65rem 0;
  border: 1px solid rgba(212,165,116,.4);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--mahogany);
  color: var(--candlelight);
  box-shadow: -2px 2px 10px rgba(0,0,0,.35);
  cursor: pointer;
  overflow: hidden;
}
.side-dock-menu-toggle:hover,
.side-dock-menu-toggle:focus-visible {
  background: var(--ember);
  outline: none;
}
.side-dock-menu-toggle-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.side-dock-menu-toggle-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-accent);
  font-size: .78rem;
  letter-spacing: .05em;
}

.messenger-dock-tab:hover,
.side-dock-tab--notes:hover,
.side-dock-tab--craft:hover,
.side-dock-tab--thesaurus:hover { background: var(--ember); }
.messenger-dock-tab-icon { font-size: 1.05rem; line-height: 1; width: 1.2rem; text-align: center; flex-shrink: 0; }
.messenger-dock-tab-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-accent);
  font-size: .78rem;
  letter-spacing: .05em;
  max-height: 5.2rem;
  overflow: hidden;
}
.messenger-dock-tab-badge {
  position: absolute;
  top: .35rem;
  left: .2rem;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  z-index: 1;
}
.messenger-dock.is-open .messenger-dock-tab,
.side-dock.is-messages-open .side-dock-tab--notes,
.side-dock.is-messages-open .side-dock-tab--craft,
.side-dock.is-notes-open .messenger-dock-tab,
.side-dock.is-notes-open .side-dock-tab--notes,
.side-dock.is-notes-open .side-dock-tab--craft,
.side-dock.is-messages-open .side-dock-tab--thesaurus,
.side-dock.is-notes-open .side-dock-tab--thesaurus,
.side-dock.is-thesaurus-open .messenger-dock-tab,
.side-dock.is-thesaurus-open .side-dock-tab--notes,
.side-dock.is-thesaurus-open .side-dock-tab--craft,
.side-dock.is-thesaurus-open .side-dock-tab--thesaurus,
body.craft-panel-open .messenger-dock-tab,
body.craft-panel-open .side-dock-tab--notes,
body.craft-panel-open .side-dock-tab--craft,
body.craft-panel-open .side-dock-tab--thesaurus,
body.thesaurus-panel-open .messenger-dock-tab,
body.thesaurus-panel-open .side-dock-tab--notes,
body.thesaurus-panel-open .side-dock-tab--craft,
body.thesaurus-panel-open .side-dock-tab--thesaurus { display: none; }

.messenger-dock-panel {
  position: fixed;
  top: 0;
  /* Pull the dock slightly off the raw edge so the close control isn’t clipped */
  right: 0.65rem;
  bottom: 0;
  width: 360px;
  max-width: calc(100vw - 1.3rem);
  background: rgba(26,20,16,.97);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(212,165,116,.25);
  border-radius: 10px 0 0 10px;
  box-shadow: -6px 0 24px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 0.65rem));
  visibility: hidden;
  /* Closed panels must not sit above the canvas and eat drag/resize hits. */
  pointer-events: none;
  transition: transform .25s ease, visibility 0s linear .25s;
  z-index: 95;
}
.messenger-dock.is-open .messenger-dock-panel,
.notes-dock-panel.is-open,
.thesaurus-dock-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform .25s ease, visibility 0s linear 0s;
}
.notes-dock-panel[hidden],
.thesaurus-dock-panel[hidden] {
  display: none !important;
}
.notes-dock-panel:not([hidden]),
.thesaurus-dock-panel:not([hidden]) {
  display: flex;
}
.messenger-dock-header {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .85rem .75rem .75rem .85rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  min-width: 0;
}
.messenger-dock-back, .messenger-dock-close, .messenger-dock-expand {
  background: none;
  border: none;
  color: var(--mist);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: .25rem .35rem;
  text-decoration: none;
  flex-shrink: 0;
}
.messenger-dock-close {
  /* Keep ✕ fully inside the panel and easy to hit */
  margin-right: .1rem;
  min-width: 1.75rem;
  min-height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messenger-dock-back:hover, .messenger-dock-close:hover, .messenger-dock-expand:hover { color: var(--candlelight); }
.messenger-dock-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--candlelight);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.messenger-dock-new-group {
  flex-shrink: 0;
  margin: .65rem .75rem 0;
}

.messenger-dock-list { list-style: none; margin: 0; padding: .5rem 0; overflow-y: auto; flex: 1; }
button.messenger-list-link {
  all: unset;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1rem;
  color: var(--parchment);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}
button.messenger-list-link:hover { background: rgba(212, 165, 116, .08); }
.messenger-dock-empty { padding: 1.5rem 1rem; color: var(--mist); font-style: italic; text-align: center; }
.messenger-dock-empty a { color: var(--gold); }

.messenger-dock-thread { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.messenger-dock-thread .messenger-thread { padding: 1rem; }
.messenger-dock-thread .messenger-compose { padding: .75rem 1rem; }
/* Setting `display` unconditionally above beats the browser's own
   `[hidden] { display: none }` rule, silently defeating the dock's
   threadWrap.hidden = true when backing out to the conversation list. */
.messenger-dock-thread[hidden] {
  display: none;
}

.notes-dock-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.notes-surface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.notes-mode-toggle {
  display: inline-flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.notes-mode-btn.is-active {
  border-color: rgba(212, 165, 116, 0.75);
  color: var(--candlelight);
  background: rgba(212, 165, 116, 0.14);
}
.notes-surface {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.notes-scratchpad-input,
.notes-editor-body {
  width: 100%;
  resize: vertical;
  min-height: 6rem;
}
.notes-ink-layer {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.notes-ink-layer[hidden] {
  display: none !important;
}
.notes-ink-canvas {
  width: 100%;
  height: 11rem;
  display: block;
  touch-action: none;
  cursor: crosshair;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.06), rgba(13, 10, 8, 0.35)),
    rgba(18, 12, 8, 0.85);
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
#notes-editor-ink {
  height: 16rem;
}
.notes-ink-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.notes-ink-hint,
.notes-ink-migrate {
  margin: 0;
  font-size: 0.72rem;
}
.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}
.notes-list-toolbar {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-bottom: .65rem;
}
.notes-search-label { display: block; }
.notes-search-input {
  width: 100%;
  box-sizing: border-box;
}
.notes-scope-label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.notes-scope-label .ink-label {
  margin: 0;
  font-size: .72rem;
}
.notes-scope-select {
  width: 100%;
  box-sizing: border-box;
}
.notes-list-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: .95rem;
  color: var(--candlelight);
}
.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notes-list-open {
  all: unset;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  width: 100%;
  box-sizing: border-box;
  padding: .55rem .65rem;
  border: 1px solid rgba(212,165,116,.2);
  border-radius: 6px;
  margin-bottom: .45rem;
  cursor: pointer;
  color: var(--parchment);
}
.notes-list-open:hover { background: rgba(212,165,116,.08); }
.notes-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .6rem;
}
.notes-work-links {
  margin: .55rem 0 .75rem;
  padding: .55rem .6rem;
  border: 1px solid rgba(212,165,116,.22);
  border-radius: 6px;
  background: rgba(0,0,0,.18);
}
.notes-work-links-hint { margin: .15rem 0 .45rem; }
.notes-work-links-list {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  max-height: 9.5rem;
  overflow: auto;
}
.notes-work-link-item {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  font-size: .86rem;
  color: var(--parchment);
  cursor: pointer;
}
.notes-work-link-item input { margin-top: .15rem; flex-shrink: 0; }
.notes-save-status { min-height: 1.1em; margin: .35rem 0 0; }
.notes-dock-disabled { padding: 1rem; }

.feed-search {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin: 0 0 1rem;
}
.feed-search .input { flex: 1; min-width: 12rem; }
.feed-bookmark-type {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 1rem;
}
.feed-bookmark-type .btn.is-active {
  border-color: rgba(212,165,116,.65);
  color: var(--candlelight);
}
.post-bookmark-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(212, 165, 116, .28);
  border-radius: 50%;
  background: rgba(26, 18, 12, .45);
  color: var(--mist, #c4b8a8);
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.post-bookmark-btn:hover {
  color: var(--candlelight, #d4a574);
  border-color: rgba(212, 165, 116, .55);
  background: rgba(44, 24, 16, .75);
  transform: translateY(-1px);
}
.post-bookmark-btn.is-bookmarked {
  color: var(--candlelight, #d4a574);
  border-color: rgba(212, 165, 116, .65);
  background: rgba(72, 48, 24, .55);
  box-shadow: 0 0 10px rgba(212, 165, 116, .18);
}
.post-bookmark-btn:focus-visible {
  outline: 2px solid var(--candlelight, #d4a574);
  outline-offset: 2px;
}
.post-bookmark-btn--sm {
  width: 1.55rem;
  height: 1.55rem;
  font-size: .8rem;
}
.feed-bookmark-context { margin: 0 0 .75rem; }
.feed-item--bookmarked-reply { border-left: 2px solid rgba(212,165,116,.35); }

.feed-quiet-banner {
  margin: 0 0 1rem;
  padding: .65rem .85rem;
  border: 1px solid rgba(201, 162, 39, .35);
  border-radius: 4px;
  background: rgba(44, 24, 16, .45);
  color: var(--candlelight);
  font-size: .95rem;
}
.feed-prompt-card { margin-bottom: 1rem; }
.feed-prompt-card__eyebrow {
  margin: 0 0 .35rem;
  font-family: var(--font-display, Cinzel, serif);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .72rem;
  color: var(--gold);
}
.feed-prompt-card__body {
  margin: 0;
  font-size: 1.15rem;
  font-style: italic;
  color: var(--parchment);
}
.feed-pin-card {
  margin-bottom: 1rem;
  border-color: rgba(201, 162, 39, .45);
}
.feed-pin-card__eyebrow {
  margin: 0 0 .35rem;
  font-family: var(--font-display, Cinzel, serif);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .72rem;
  color: var(--gold);
}
.feed-pin-card__title {
  margin: 0 0 .5rem;
  font-family: var(--font-display, Cinzel, serif);
  font-size: 1.2rem;
  color: var(--candlelight);
}
.feed-pin-card__body {
  margin: 0;
  color: var(--parchment);
  line-height: 1.55;
}
.feed-survey-card { margin-bottom: 1rem; }
.feed-survey-card__eyebrow {
  margin: 0 0 .35rem;
  font-family: var(--font-display, Cinzel, serif);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .72rem;
  color: var(--gold);
}
.feed-survey-card__title {
  margin: 0 0 .4rem;
  font-size: 1.1rem;
  color: var(--candlelight);
}
.feed-survey-card__body {
  margin: 0 0 .75rem;
  color: var(--mist);
}
.feed-survey-choices {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.admin-board-form .label { margin-top: .85rem; }
.admin-board-form .label:first-of-type { margin-top: 0; }
.admin-board-check { display: flex; align-items: center; gap: .5rem; margin: .85rem 0 1rem; }
.admin-survey-list { list-style: none; margin: 0; padding: 0; }
.admin-survey-item {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: .85rem 0;
  border-bottom: 1px solid rgba(201, 162, 39, .2);
}
.admin-survey-item:last-child { border-bottom: 0; }
.admin-survey-results { list-style: none; margin: 0; padding: 0; }
.admin-survey-results li { margin: 0 0 .85rem; }
.admin-survey-bar {
  display: block;
  height: .4rem;
  margin-top: .35rem;
  border-radius: 999px;
  background: rgba(44, 24, 16, .35);
  overflow: hidden;
}
.admin-survey-bar > span {
  display: block;
  height: 100%;
  background: var(--gold);
}
.feed-salon-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 1rem;
}
.feed-salon-chip {
  display: inline-block;
  padding: .35rem .7rem;
  border: 1px solid rgba(201, 162, 39, .35);
  border-radius: 999px;
  color: var(--mist);
  text-decoration: none;
  font-size: .85rem;
}
.feed-salon-chip:hover,
.feed-salon-chip.is-active {
  color: var(--ink);
  background: var(--candlelight);
  border-color: var(--candlelight);
}
.feed-composer-options {
  display: grid;
  gap: .55rem;
  margin: .75rem 0 1rem;
}
.feed-check {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--mist);
  font-size: .92rem;
}
.feed-select-label {
  display: grid;
  gap: .3rem;
  color: var(--candlelight);
  font-size: .85rem;
}
.feed-post-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 .55rem;
}
.feed-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, .35);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--candlelight);
  text-decoration: none;
}
.feed-badge--critique { border-color: rgba(212, 165, 116, .55); color: #f0d2a8; }
.feed-badge--milestone { border-color: rgba(201, 162, 39, .6); color: var(--gold); }
.feed-badge--quill { border-color: rgba(126, 180, 140, .5); color: #b7dfc0; }
.feed-badge--prompt { border-color: rgba(140, 160, 200, .5); color: #c5d4f0; }
.feed-badge--ink { border-color: rgba(201, 162, 39, .55); color: var(--gold); }
.feed-item--ink { box-shadow: inset 3px 0 0 rgba(201, 162, 39, .45); }
.feed-ink-quote {
  margin: 0 0 .65rem;
  padding: .55rem .75rem;
  border-left: 3px solid rgba(201, 162, 39, .45);
  background: rgba(201, 162, 39, .06);
}
.feed-ink-quote__label {
  margin: 0 0 .2rem;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--gold);
}
.feed-ink-quote__body {
  margin: 0;
  color: var(--mist);
  font-style: italic;
}
.feed-item--milestone {
  background: linear-gradient(165deg, rgba(54, 34, 22, .98), rgba(28, 20, 14, .98));
  border-color: rgba(201, 162, 39, .45);
}
.feed-item--critique { box-shadow: inset 3px 0 0 rgba(212, 165, 116, .55); }
.feed-pass-quill-form {
  margin: .75rem 0 1rem;
  padding: .75rem;
  border: 1px dashed rgba(201, 162, 39, .35);
  border-radius: 4px;
}
.feed-mention { color: var(--gold); text-decoration: none; }
.feed-mention:hover { color: var(--candlelight); text-decoration: underline; }
.feed-older-wrap { display: flex; justify-content: center; margin: 1.25rem 0 .5rem; }
.account-quiet-hours-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  margin-top: .5rem;
}

@media (max-width: 860px) {
  /* Collapse edge tabs behind a hamburger so canvas side-resize isn’t covered.
     Immersive/focus still force the dock visible via higher-specificity rules. */
  .side-dock {
    display: block;
    pointer-events: none;
  }
  .side-dock:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open) {
    width: calc(3.25rem + var(--side-dock-inset, 0px));
  }

  /* Keep Help / header links clear of the fixed Panels toggle:
     put main nav on its own row under the logo/actions so Help isn’t
     trapped against the top-right hamburger. */
  body:has(#side-dock) .site-header .header-inner {
    padding-right: calc(4.6rem + env(safe-area-inset-right, 0px));
  }
  body:has(#side-dock) .site-header .logo {
    order: 1;
  }
  body:has(#side-dock) .site-header .header-actions {
    order: 2;
    flex: 1 1 auto;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  body:has(#side-dock) .site-header .main-nav {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    gap: 1rem;
    padding-top: 0.15rem;
  }

  /* Default: compact corner hamburger — keeps mid-edge free for canvas resize.
     Fixed to the viewport so it never rides a centered desk column.
     Inset from the right + full border so the control isn’t clipped by the
     viewport edge (border-right:none flush tabs read as cut off on phones). */
  .side-dock-menu-toggle {
    display: flex;
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    right: max(0.5rem, env(safe-area-inset-right, 0px));
    transform: none;
    width: 2.85rem;
    min-width: 2.85rem;
    max-width: 2.85rem;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 0.55rem 0.35rem;
    gap: 0.25rem;
    z-index: 240;
    border-right: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  }
  .side-dock-menu-toggle-label {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .side-dock:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open):not(.is-menu-open) {
    /* Narrow hit strip only — don’t reserve a tall full-height dock over the paper. */
    inset: auto;
    top: 0;
    right: 0;
    bottom: auto;
    width: calc(3.25rem + var(--side-dock-inset, 0px));
    height: 4.5rem;
  }
  .side-dock .messenger-dock-tab.side-dock-tab--messages,
  .side-dock .side-dock-tab--notes,
  .side-dock .side-dock-tab--craft,
  .side-dock .studio-craft-toggle.side-dock-tab--craft,
  .side-dock .side-dock-tab--thesaurus {
    display: none !important;
  }

  /* Menu open: full-height dock + binder tabs pop out like desktop. */
  .side-dock.is-menu-open:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open) {
    inset: auto;
    top: 0;
    right: 0;
    bottom: 0;
    width: calc(3.25rem + var(--side-dock-inset, 0px));
    height: auto;
  }
  .side-dock.is-menu-open .messenger-dock-tab.side-dock-tab--messages,
  .side-dock.is-menu-open .side-dock-tab--notes,
  .side-dock.is-menu-open .side-dock-tab--craft,
  .side-dock.is-menu-open .studio-craft-toggle.side-dock-tab--craft,
  .side-dock.is-menu-open .side-dock-tab--thesaurus {
    display: flex !important;
    pointer-events: auto;
    position: fixed !important;
    top: 50% !important;
    bottom: auto !important;
    right: max(0.5rem, env(safe-area-inset-right, 0px));
    left: auto !important;
    border-right: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: 8px;
  }
  /* Phone menu stack must match desktop binder math (3-tab or 4-tab).
     Explicit here so studio-craft / immersive rules cannot leave Craft on the
     old 3-tab offset while Thesaurus sits in the 4-tab slot. */
  .side-dock.is-menu-open .messenger-dock-tab.side-dock-tab--messages {
    transform: translateY(calc(-150% + 0.55rem)) !important;
    z-index: 3;
  }
  .side-dock.is-menu-open .side-dock-tab--notes {
    transform: translateY(-50%) !important;
    z-index: 2;
  }
  .side-dock.is-menu-open .side-dock-tab--craft,
  .side-dock.is-menu-open .studio-craft-toggle.side-dock-tab--craft {
    transform: translateY(calc(50% - 0.55rem)) !important;
    z-index: 1;
  }
  body:has(.side-dock-tab--thesaurus) .side-dock.is-menu-open .messenger-dock-tab.side-dock-tab--messages {
    transform: translateY(calc(-200% + 1.05rem)) !important;
    z-index: 4;
  }
  body:has(.side-dock-tab--thesaurus) .side-dock.is-menu-open .side-dock-tab--notes {
    transform: translateY(calc(-100% + 0.55rem)) !important;
    z-index: 3;
  }
  body:has(.side-dock-tab--thesaurus) .side-dock.is-menu-open .side-dock-tab--craft,
  body:has(.side-dock-tab--thesaurus) .side-dock.is-menu-open .studio-craft-toggle.side-dock-tab--craft {
    transform: translateY(0) !important;
    z-index: 2;
  }
  body:has(.side-dock-tab--thesaurus) .side-dock.is-menu-open .side-dock-tab--thesaurus {
    transform: translateY(calc(100% - 0.55rem)) !important;
    z-index: 1;
  }
  .side-dock.is-menu-open .side-dock-menu-toggle {
    display: none;
  }

  /* While a panel is open, hide the hamburger (panel has its own close). */
  .side-dock.is-messages-open .side-dock-menu-toggle,
  .side-dock.is-notes-open .side-dock-menu-toggle,
  .side-dock.is-craft-open .side-dock-menu-toggle,
  .side-dock.is-thesaurus-open .side-dock-menu-toggle,
  body.craft-panel-open .side-dock-menu-toggle,
  body.messenger-dock-open .side-dock-menu-toggle,
  body.thesaurus-panel-open .side-dock-menu-toggle {
    display: none !important;
  }
}

/* Phones only — do not alter tablets (641–860) or desktop. */
@media (max-width: 640px) {
  /* Keep a Close control while Messages/Notes/Craft tabs are popped out.
     (≤860 hides the hamburger when the menu is open, which trapped phones.) */
  .side-dock.is-menu-open:not(.is-messages-open):not(.is-notes-open):not(.is-craft-open):not(.is-thesaurus-open) .side-dock-menu-toggle {
    display: flex !important;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    right: max(0.5rem, env(safe-area-inset-right, 0px));
    z-index: 241;
  }
}

/*
 * Self-hosted fonts (not available on Google Fonts).
 * Each font here has a license that explicitly permits commercial use —
 * see the accompanying license file next to the font in public/assets/fonts/.
 *
 * Pinewood — licensed under the 1001fonts "Free For Commercial Use" (FFC) license.
 * See public/assets/fonts/pinewood/1001fonts-pinewood-eula.txt for the full text.
 */
@font-face {
    font-family: 'Pinewood';
    src: url('../fonts/pinewood/Pinewood.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.thesaurus-dock-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.85rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.account-subhead {
  font-family: var(--font-display);
  color: var(--candlelight);
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}
.account-family-link-form {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(212, 165, 116, 0.15);
}
.family-access-picker {
  margin: 0.75rem 0 0.5rem;
  padding: 0;
  border: 0;
}
.family-access-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.35rem 0;
  font-size: 0.95rem;
}
.family-access-form {
  margin: 0.5rem 0 0.25rem;
}
.family-member-row {
  padding: 0.85rem 0;
}
.family-member-profile-link {
  margin: 0.35rem 0 0;
}
.member-profile-family {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
}
.member-profile-family .family-approvals {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.member-profile-family-title {
}
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}
.family-approvals {
  margin-top: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 8px;
  background: rgba(20, 14, 10, 0.35);
}
.family-approvals-list {
  list-style: none;
  margin: 0.5rem 0 0.75rem;
  padding: 0;
}
.family-approvals-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-top: none;
}
.family-approvals-search-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.family-approvals-search-row .ink-input {
  flex: 1 1 12rem;
}
.family-approvals-results {
  list-style: none;
  margin: 0;
  padding: 0;
}
.family-approvals-results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-top: 1px solid rgba(212, 165, 116, 0.1);
}
