/* ============================================================
   shared.css — Vagabond Character Sheet Shared Styles
   Used by modular.html + blocks/ folder system

   Styled to evoke the faction boards from Root (Leder Games):
   warm woodland field, hand-torn inked panel edges, aged
   parchment, watercolor phase bands, and fiddlehead flourishes.

   The rough panel edge relies on the SVG filter #rough-edge
   defined inline in modular.html.
   ============================================================ */

:root {
  --parchment:      #f4e7c4;
  --parchment-dark: #e7d3a0;
  --parchment-mid:  #cdae72;
  --parchment-edge: #b8975a;
  --ink:            #2a1d0c;
  --ink-light:      #5a4326;
  --ink-soft:       #7a6038;

  --birdsong:       #f0a93a;
  --birdsong-dark:  #c47815;
  --daylight:       #6fb6cc;
  --daylight-dark:  #357f9e;
  --evening:        #8274ab;
  --evening-dark:   #463a6e;

  --hostile-red:    #b23a1c;
  --gold-accent:    #b8902a;
  --gold-bright:    #e6c25a;

  --radius:         10px;
  --shadow:         3px 6px 16px rgba(0,0,0,0.38);
  --shadow-soft:    2px 3px 8px rgba(0,0,0,0.22);
  --font-title:     'Cinzel', serif;
  --font-body:      'IM Fell English', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   PAGE FIELD — a dim forest floor the boards rest on.
   Deep mossy green with a faint repeating fern sprig and a
   warm radial glow drawing the eye to the centre of the sheet.
   ============================================================ */
body {
  background-color: #21301f;
  background-image:
    radial-gradient(ellipse 90% 70% at 50% 18%, rgba(120,95,40,0.30), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23000000' stroke-opacity='0.16' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M30 12 q6 18 0 38'/%3E%3Cpath d='M30 18 q-9 -2 -13 6 M30 24 q9 -2 13 6 M30 30 q-9 0 -12 8 M30 37 q9 0 12 8'/%3E%3Cpath d='M88 70 q6 18 0 38'/%3E%3Cpath d='M88 76 q-9 -2 -13 6 M88 82 q9 -2 13 6 M88 88 q-9 0 -12 8 M88 95 q9 0 12 8'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(circle at 30% 40%, #2a3b27, #1b271a 80%);
  background-attachment: fixed, fixed, fixed;
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh;
  padding: 22px 16px 40px;
}

/* ============================================================
   DESKTOP GRID — mirrors the original card layout
   Left column phases are wrapped in #left-col so they
   fill naturally when any phase block is hidden/removed.
   ============================================================ */
#sheet {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  grid-template-columns: 2fr 3fr;
  grid-template-areas:
    "header    header"
    "traits    traits"
    "left-col  right-col";
  align-items: start;
  /* Hidden until every block is in the DOM, then faded in as one piece — so
     the page doesn't visibly assemble block-by-block as each fetch lands. */
  opacity: 0;
  transition: opacity 0.4s ease;
}
body.blocks-ready #sheet { opacity: 1; }

/* grid area assignments */
#block-header  { grid-area: header; }
#block-traits  { grid-area: traits; }
#left-col      { grid-area: left-col; }
#right-col     { grid-area: right-col; }

/* Left column: transparent flex container — phase blocks stack and
   fill naturally; hide any block and the others close the gap. */
#left-col {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#left-col::before, #left-col::after { display: none !important; }

/* Right column: same transparent wrapper pattern */
#right-col {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#right-col::before, #right-col::after { display: none !important; }

/* bottom-right: satchel + char-card side by side inside #right-col */
#block-bottom-right {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible;
  padding: 0;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
  align-items: stretch;
}
#block-bottom-right::before, #block-bottom-right::after { display: none !important; }

/* ============================================================
   BLOCK BASE — aged parchment panel with a hand-torn inked edge.

   The fill, paper grain AND the inked border all live on a single
   ::before pseudo-element, which is displaced as one shape by the
   #rough-edge SVG filter. Because fill + border are the same layer,
   the parchment can never peek out past the ink line — the torn
   paper edge and the drawn outline are always the same curve.
   Content sits on the element itself (z-index 1), unfiltered/crisp.
   ============================================================ */
.block, .inner-block {
  background: none;
  border-radius: var(--radius);
  position: relative;
  overflow: visible;
}

/* the torn parchment card: fill + stains + grain + inked border,
   all wobbled together by the filter, with a shadow that hugs it */
.block::before, .inner-block::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 78% 12%, rgba(150,110,40,0.10), transparent 42%),
    radial-gradient(circle at 12% 88%, rgba(120,80,30,0.10), transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"),
    var(--parchment);
  border: 2.5px solid var(--ink);
  filter: url(#rough-edge) drop-shadow(2px 4px 6px rgba(0,0,0,0.42));
  pointer-events: none; z-index: 0;
}

.block > *, .inner-block > * { position: relative; z-index: 1; }

.block-content { padding: 15px 17px; }
.inner-block .block-content { padding: 13px 15px; }
.hidden { display: none !important; }

/* ============================================================
   HEADER — a Root-style title banner: dark woodgrain field,
   gold rule, big inked title flanked by fiddlehead flourishes.
   ============================================================ */
#block-header { background: none; }
#block-header::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #2c1d0d 0%, #4a3318 50%, #6a4d24 100%);
  border-color: var(--gold-accent);
  border-width: 3px;
}

.header-inner { padding: 20px 24px 16px; text-align: center; position: relative; }
.header-title {
  font-family: var(--font-title);
  /* scales with viewport so the title + flourishes always fit on one line,
     from small phones up to the 2.7rem desktop cap */
  font-size: clamp(1.5rem, 6.5vw, 2.7rem);
  font-weight: 700;
  color: var(--parchment);
  text-shadow: 2px 2px 8px rgba(0,0,0,0.75), 0 0 26px rgba(230,194,90,0.35);
  letter-spacing: 0.1em;
  display: inline-block;
  white-space: nowrap;   /* keep the flourishes on the same line as the text */
}
/* fiddlehead flourishes flanking the title — sized in em so they scale with
   the title font instead of wrapping on narrow screens */
.header-title::before, .header-title::after {
  content: '';
  display: inline-block;
  width: 0.88em; height: 0.88em;
  vertical-align: middle;
  margin: 0 0.42em;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23e6c25a' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 40 q18 -2 18 -16 q0 -12 -10 -12 q-8 0 -8 8 q0 6 6 6 q4 0 4 -4'/%3E%3Cpath d='M24 40 q18 -2 18 -16 q0 -12 -10 -12 q-8 0 -8 8 q0 6 6 6 q4 0 4 -4' transform='translate(48 0) scale(-1 1)'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.9;
}
.header-divider {
  height: 0;
  border-top: 1.5px solid var(--gold-bright);
  border-bottom: 1.5px solid var(--gold-accent);
  width: 70%;
  margin: 10px auto 2px;
  box-shadow: 0 0 10px rgba(230,194,90,0.3);
}

/* ============================================================
   TRAITS
   ============================================================ */
.traits-row {
  display: flex; gap: 12px; padding: 14px 18px; align-items: stretch;
}
.trait-lore {
  flex: 1.2;
  font-style: italic; font-size: 0.84rem; color: var(--ink-light); line-height: 1.55;
  border-right: 2px solid var(--parchment-mid);
  padding-right: 14px;
}
.trait-cards { flex: 2; display: flex; gap: 12px; }
.trait-card {
  flex: 1;
  background:
    radial-gradient(circle at 80% 15%, rgba(150,110,40,0.10), transparent 45%),
    var(--parchment-dark);
  border: 1.5px solid var(--parchment-edge);
  border-radius: 7px;
  padding: 10px 11px;
  position: relative;
  box-shadow: var(--shadow-soft);
}
.trait-name {
  font-family: var(--font-title); font-size: 0.82rem; font-weight: 700;
  color: var(--ink); margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
/* fiddlehead bullet before each trait name */
.trait-name::before {
  content: ''; flex: 0 0 auto;
  width: 15px; height: 15px;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 20 q9 -1 9 -8 q0 -6 -5 -6 q-4 0 -4 4 q0 3 3 3 q2 0 2 -2' fill='none' stroke='%23b8902a' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}
.trait-desc { font-size: 0.73rem; color: var(--ink-light); font-style: italic; line-height: 1.45; }

/* ============================================================
   PHASE HEADERS — watercolor band with a drifting leafy branch.
   ============================================================ */
.phase-header {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px;
  font-family: var(--font-title); font-size: 1.1rem; font-weight: 700;
  color: white;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.45);
  letter-spacing: 0.06em;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid rgba(0,0,0,0.25);
  /* inset from the panel so the band sits inside the torn paper
     edge (never pokes past it the way a full-bleed band would) */
  margin: 5px 5px 0;
  border-radius: 7px 7px 0 0;
}
/* leafy branch drifting across the right of the band */
.phase-header::after {
  content: '';
  position: absolute; right: 8px; top: 0; bottom: 0;
  width: 130px;
  background: no-repeat center right / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 44'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.5' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M2 22 q40 -10 80 -4 q24 4 46 -8'/%3E%3Cpath d='M30 20 q-4 -10 4 -15 M30 20 q10 -6 16 -3 M55 20 q-3 -11 6 -15 M55 21 q11 -5 16 -1 M80 19 q-2 -11 7 -14 M80 20 q11 -4 16 0'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.phase-header > * { position: relative; z-index: 1; }
.phase-header.birdsong { background: linear-gradient(135deg, var(--birdsong), var(--birdsong-dark)); }
.phase-header.daylight { background: linear-gradient(135deg, var(--daylight), var(--daylight-dark)); }
.phase-header.evening  { background: linear-gradient(135deg, var(--evening), var(--evening-dark)); }

/* ============================================================
   ACTION ROWS
   ============================================================ */
.action-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(80,55,20,0.14);
}
.action-row:last-child { border-bottom: none; }
.action-num {
  font-family: var(--font-title); font-size: 0.66rem; font-weight: 700;
  color: var(--ink-light); min-width: 26px; padding-top: 2px; text-align: center; line-height: 1.2;
}
.action-num sup { font-size: 0.58em; }
.action-icon {
  width: 30px; height: 30px;
  border: 1.5px solid var(--parchment-edge);
  background:
    radial-gradient(circle at 50% 35%, var(--parchment), var(--parchment-dark));
  border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-size: 0.92rem; flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.5), var(--shadow-soft);
}
.action-icon.any, .action-icon.req {
  font-family: var(--font-title); font-size: 0.55rem; font-weight: 700; color: var(--ink-light);
}
.action-arrow { font-size: 0.95rem; color: var(--ink-soft); padding-top: 5px; flex-shrink: 0; }
.action-text  { flex: 1; min-width: 0; }
.action-name  { font-family: var(--font-title); font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.action-sub   { font-size: 0.71rem; color: var(--ink-light); font-style: italic; line-height: 1.35; }

.item-slots { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.item-slot {
  width: 30px; height: 30px;
  border: 1.5px dashed var(--parchment-edge); border-radius: 5px;
  background: rgba(255,255,255,0.28);
  display: flex; align-items: center; justify-content: center; font-size: 0.88rem;
}

.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 21px; height: 21px; border-radius: 50%;
  border: 2px solid var(--gold-accent);
  background: radial-gradient(circle at 50% 35%, var(--gold-bright), var(--parchment-dark));
  font-family: var(--font-title); font-size: 0.62rem; font-weight: 700; color: var(--ink);
  vertical-align: middle;
  box-shadow: var(--shadow-soft);
}

/* ============================================================
   RELATIONSHIPS
   ============================================================ */
.section-title {
  font-family: var(--font-title); font-size: 1.35rem; font-weight: 700;
  text-align: center; color: var(--ink); margin-bottom: 6px; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
/* fiddlehead flourishes flanking section titles */
.section-title::before, .section-title::after {
  content: ''; flex: 0 0 auto;
  width: 22px; height: 22px;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 20 q9 -1 9 -8 q0 -6 -5 -6 q-4 0 -4 4 q0 3 3 3 q2 0 2 -2' fill='none' stroke='%23b8902a' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  opacity: 0.85;
}
.section-title::after { transform: scaleX(-1); }
.rel-intro { font-size: 0.79rem; font-style: italic; color: var(--ink-light); margin-bottom: 12px; text-align: center; }
.rel-track {
  display: flex; align-items: stretch;
  border: 2px solid var(--parchment-edge); border-radius: 7px; overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}
.rel-zone {
  flex: 1; text-align: center; padding: 9px 4px;
  font-family: var(--font-title); font-size: 0.6rem; font-weight: 600;
  border-right: 1px solid var(--parchment-edge);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.rel-zone:last-child { border-right: none; }
.rel-zone.indifferent {
  background: var(--parchment-dark); color: var(--ink-light);
  writing-mode: vertical-rl; font-size: 0.68rem; padding: 12px 5px; flex: 0 0 auto;
}
.rel-zone.step { background: var(--parchment); }
.rel-zone.allied { background: linear-gradient(135deg, var(--gold-bright), #b8a040); }
.rel-zone-num {
  width: 23px; height: 23px; background: var(--ink); color: var(--parchment);
  border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.hostile-box {
  background: #fdf2ec; border: 2px solid var(--hostile-red);
  border-radius: 7px; padding: 11px; margin-top: 6px;
  box-shadow: var(--shadow-soft);
}
.hostile-title {
  font-family: var(--font-title); font-size: 0.92rem; font-weight: 700;
  color: var(--hostile-red); text-align: center; margin-bottom: 6px; letter-spacing: 0.04em;
}
.hostile-rule { font-size: 0.73rem; font-style: italic; color: var(--ink-light); text-align: center; line-height: 1.45; }

/* ============================================================
   SATCHEL
   ============================================================ */
.satchel-grid, .damaged-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 9px;
}
.satchel-slot {
  aspect-ratio: 1; border: 1.5px dashed var(--parchment-edge);
  border-radius: 5px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,0.4), rgba(255,255,255,0.12));
}
.satchel-slot.damaged { border-color: var(--hostile-red); background: rgba(178,58,28,0.06); }
.damaged-label {
  font-family: var(--font-title); font-size: 0.8rem; font-weight: 600;
  color: var(--ink-light); text-align: center; margin-bottom: 3px; letter-spacing: 0.03em;
}
.damaged-note { font-size: 0.69rem; font-style: italic; color: var(--ink-light); text-align: center; margin-bottom: 7px; }

/* ============================================================
   CHARACTER CARD
   ============================================================ */
#char-card-inner { background: none; }
#char-card-inner::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E"),
    linear-gradient(160deg, #463a6e 0%, #2f264c 100%);
  border-color: var(--gold-accent);
}
.char-card-content {
  padding: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 160px; height: 100%;
}
.char-card-label {
  font-family: var(--font-title); font-size: 1.15rem; font-weight: 700;
  color: var(--parchment); text-align: center; letter-spacing: 0.06em;
  text-shadow: 1px 1px 5px rgba(0,0,0,0.55);
}
.char-card-pattern {
  width: 100%; flex: 1;
  background-image: repeating-linear-gradient(
    45deg, rgba(230,194,90,0.07) 0px, rgba(230,194,90,0.07) 2px,
    transparent 2px, transparent 14px
  );
  border-radius: 7px; border: 2px dashed rgba(230,194,90,0.25);
  margin-top: 14px; min-height: 80px;
}

/* ============================================================
   JOURNAL (chat wall) + FRIENDS — extra phase-band colors
   ============================================================ */
.phase-header.journal { background: linear-gradient(135deg, #6aa15a, #2f5d2a); }
.phase-header.friends { background: linear-gradient(135deg, #4f9a93, #2c6460); }
.phase-header .wip {
  font-family: var(--font-body); font-style: italic; font-weight: 400;
  font-size: 0.6rem; letter-spacing: 0.03em;
  border: 1px solid rgba(255,255,255,0.55); border-radius: 10px;
  padding: 1px 7px; margin-left: 4px; opacity: 0.9;
}

/* ---- Journal ---- */
.journal-intro { font-size: 0.8rem; font-style: italic; color: var(--ink-light); margin-bottom: 10px; }
.journal-messages {
  min-height: 380px; max-height: 480px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; margin-bottom: 12px;
  background: rgba(255,255,255,0.22);
  border: 1.5px solid var(--parchment-edge); border-radius: 7px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.08);
}
.msg {
  background: var(--parchment-dark);
  border: 1px solid var(--parchment-edge); border-radius: 6px;
  padding: 7px 10px; box-shadow: var(--shadow-soft);
}
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-name { font-family: var(--font-title); font-weight: 700; font-size: 0.78rem; color: var(--ink); }
.msg-time { font-size: 0.62rem; color: var(--ink-soft); font-style: italic; margin-left: auto; white-space: nowrap; }
.msg-body {
  font-size: 0.8rem; color: var(--ink-light); line-height: 1.4;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.journal-form { display: flex; flex-direction: column; gap: 8px; position: relative; }
.journal-form input, .journal-form textarea {
  font-family: var(--font-body); font-size: 0.85rem; color: var(--ink);
  background: rgba(255,255,255,0.55);
  border: 1.5px solid var(--parchment-edge); border-radius: 6px;
  padding: 8px 10px; width: 100%;
}
.journal-form textarea { min-height: 66px; resize: vertical; line-height: 1.4; }
.journal-form input:focus, .journal-form textarea:focus {
  outline: 2px solid var(--gold-accent); outline-offset: 1px; background: rgba(255,255,255,0.75);
}
/* honeypot: visually & semantically hidden, but bots still fill it */
.hp-field {
  position: absolute !important; left: -9999px !important;
  width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.journal-actions { display: flex; align-items: center; gap: 10px; }
.journal-status { font-size: 0.72rem; color: var(--hostile-red); min-height: 1em; flex: 1; }
.journal-status.ok { color: #2f5d2a; }
.journal-form button {
  margin-left: auto;
  font-family: var(--font-title); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em;
  color: var(--parchment);
  background: linear-gradient(135deg, #6aa15a, #2f5d2a);
  border: 2px solid var(--ink); border-radius: 7px;
  padding: 7px 16px; cursor: pointer; box-shadow: var(--shadow-soft);
}
.journal-form button:hover { filter: brightness(1.08); }
.journal-form button:active { transform: translateY(1px); }
.journal-form button:disabled { opacity: 0.55; cursor: default; }

/* ---- Friends ---- */
.friends-list { font-size: 0.82rem; }

/* ============================================================
   QUEST BOARD — post feed
   ============================================================ */
.feed {
  display: flex; flex-direction: column;
  max-height: 680px; overflow-y: auto;
  padding-right: 6px;   /* breathing room for the scrollbar */
}

/* Root-styled scrollbars for the two scroll panels */
.journal-messages, .feed { scrollbar-width: thin; scrollbar-color: var(--parchment-mid) transparent; }
.journal-messages::-webkit-scrollbar, .feed::-webkit-scrollbar { width: 10px; }
.journal-messages::-webkit-scrollbar-track, .feed::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.06); border-radius: 6px;
}
.journal-messages::-webkit-scrollbar-thumb, .feed::-webkit-scrollbar-thumb {
  background: var(--parchment-mid); border-radius: 6px;
  border: 2px solid transparent; background-clip: padding-box;
}
.journal-messages::-webkit-scrollbar-thumb:hover, .feed::-webkit-scrollbar-thumb:hover {
  background: var(--parchment-edge); background-clip: padding-box;
}
.post { padding: 2px 2px 0; }
.post-date {
  font-family: var(--font-title); font-size: 0.64rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-soft); margin-bottom: 7px;
}
.post-sep {
  position: relative; height: 0;
  border-top: 2px dashed var(--parchment-mid);
  margin: 18px 2px;
}
.post-sep::after {
  content: '❧'; position: absolute; left: 50%; top: -0.72em; transform: translateX(-50%);
  background: var(--parchment); padding: 0 10px;
  color: var(--gold-accent); font-size: 0.95rem;
}
.feed-empty { font-style: italic; color: var(--ink-light); font-size: 0.8rem; text-align: center; padding: 14px 4px; }

/* ============================================================
   MARKDOWN — shared rendering for posts & friends
   ============================================================ */
.markdown { font-size: 0.84rem; color: var(--ink-light); line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  font-family: var(--font-title); color: var(--ink); line-height: 1.2; margin: 0.7em 0 0.35em;
}
.markdown h1 { font-size: 1.3rem; }
.markdown h2 { font-size: 1.1rem; }
.markdown h3 { font-size: 0.96rem; }
.markdown h4 { font-size: 0.86rem; }
.markdown p { margin: 0.55em 0; }
.markdown a { color: var(--birdsong-dark); text-decoration: underline; text-underline-offset: 2px; }
.markdown a:hover { color: var(--hostile-red); }
.markdown ul, .markdown ol { margin: 0.5em 0 0.5em 1.35em; }
.markdown li { margin: 0.2em 0; }
.markdown li::marker { color: var(--gold-accent); }
.markdown blockquote {
  border-left: 3px solid var(--parchment-mid); margin: 0.7em 0; padding: 0.25em 0.9em;
  color: var(--ink-soft); font-style: italic; background: rgba(0,0,0,0.03); border-radius: 0 6px 6px 0;
}
.markdown code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.78em;
  background: rgba(0,0,0,0.07); padding: 0.1em 0.35em; border-radius: 4px;
}
.markdown pre {
  background: #2c2418; color: #f0e3c2; padding: 11px 13px;
  border-radius: 7px; border: 2px solid var(--ink); overflow: auto; margin: 0.7em 0;
}
.markdown pre code { background: none; padding: 0; color: inherit; font-size: 0.78rem; }
.markdown img { max-width: 100%; height: auto; border-radius: 6px; border: 2px solid var(--parchment-edge); }
.markdown hr { border: none; border-top: 2px dashed var(--parchment-mid); margin: 1em 0; }
.markdown table { border-collapse: collapse; width: 100%; margin: 0.7em 0; font-size: 0.78rem; }
.markdown th, .markdown td { border: 1px solid var(--parchment-edge); padding: 5px 9px; text-align: left; }
.markdown th { background: var(--parchment-dark); font-family: var(--font-title); font-weight: 700; }
.markdown input[type="checkbox"] { margin-right: 6px; accent-color: var(--gold-accent); }

/* ============================================================
   MOBILE — single column stack
   ============================================================ */
@media (max-width: 680px) {
  #sheet {
    display: flex;
    flex-direction: column;
    /* stretch (not the desktop grid's align-items:start) so EVERY block spans
       the full column width — otherwise flex items shrink to their content and
       come out ragged / different widths. */
    align-items: stretch;
    max-width: 520px;
    width: 100%;
  }

  /* collapse left and right wrappers to plain vertical stacks; their children
     stretch to full width by default. */
  #left-col,
  #right-col,
  #block-bottom-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .traits-row { flex-direction: column; }
  .trait-lore { border-right: none; border-bottom: 1px solid var(--parchment-mid); padding-right: 0; padding-bottom: 8px; }
  /* header title + flourishes now scale via clamp()/em on the base rule, so no
     fixed mobile overrides are needed here. */
  .char-card-content { min-height: 120px; }

  /* let the feed flow with the page (no awkward nested touch-scroll), and keep
     the journal wall reasonable instead of a tall empty box */
  .feed { max-height: none; overflow-y: visible; padding-right: 0; }
  .journal-messages { min-height: 220px; max-height: 55vh; }
}
