/* =====================================================================
   R56-P1 — the RoleModel pages: Discovery, GlobalChain, Archival, the
   character sheet and the Studio, in the app's design language
   (`dochi-design`), ported to the web.

   ⚠️ A SEPARATE FILE, deliberately. style.css carries a NUL byte and can only
   be appended to; this one is plain text and loads after it, so its rules win
   ties. Bump `rolemodel.css?v=` in index.html with every change.

   Rules carried over from the app, and why:
   - ONE set of durations and curves (160 / 260 / 380 ms; easeOutCubic,
     easeOutQuint). An untokenised 180 ms is how two things beside each other
     settle out of step.
   - A rim is a BORDER, never a glow. A shadow on every tile of a scrolling grid
     is paid on every frame; glow belongs on one hero element.
   - Entrances only for genuinely new content; grids stagger by ROW.
   - Loading keeps the frame (skeletons where the cards will be), and a
     number that is not known yet is an em-dash, never a confident 0.
   - prefers-reduced-motion switches every decorative animation off.
   ===================================================================== */

:root {
  --dur-fast: 160ms;
  --dur-base: 260ms;
  --dur-slow: 380ms;
  --ease: cubic-bezier(.33, 1, .68, 1);        /* easeOutCubic */
  --ease-emph: cubic-bezier(.22, 1, .36, 1);   /* easeOutQuint */
  --rm-radius: 20px;
  --rm-radius-sm: 12px;
  --rm-tap: 48px;
  --rm-cyan: var(--primary-color, #00F0FF);
  --rm-pink: var(--secondary-color, #FF00E6);
  /* Ink that carries TEXT on the light ground must reach 4.5:1 — the neon
     itself does not, so light mode reads these instead (test pinned). */
  --rm-cyan-ink: var(--rm-cyan);
  --rm-pink-ink: var(--rm-pink);
  --rm-on-image: #ffffff;
  --rm-surface: #141414;
  --rm-surface-2: #1b1b22;
  --rm-hair: rgba(255, 255, 255, 0.09);
  --rm-hair-strong: rgba(255, 255, 255, 0.16);
  --rm-muted: #a4a7b4;
  --rm-skel-a: rgba(255, 255, 255, 0.05);
  --rm-skel-b: rgba(255, 255, 255, 0.11);
  --rm-toolbar-bg: rgba(8, 8, 12, 0.94);
}
[data-theme="light"] {
  --rm-cyan-ink: #006b7a;
  --rm-pink-ink: #a3008f;
  --rm-surface: #ffffff;
  --rm-surface-2: #eef1f7;
  --rm-hair: rgba(10, 20, 40, 0.10);
  --rm-hair-strong: rgba(10, 20, 40, 0.18);
  --rm-muted: #555b6e;
  --rm-skel-a: rgba(10, 20, 40, 0.05);
  --rm-skel-b: rgba(10, 20, 40, 0.10);
  --rm-toolbar-bg: rgba(244, 246, 251, 0.95);
}

/* ---- Route entrance: ONE mechanism --------------------------------------
   ⚠️⚠️ The old `.fade-in` left `transform: translateY(0)` on #dynamic-content
   FOR GOOD. Any transform — even a zero one — makes an element the containing
   block of its `position: fixed` descendants, so every overlay inside a tab
   (the Studio's guest gate, the chat's panels) was pinned to the content area
   instead of the screen. The entrance below ends on `transform: none`, and the
   router no longer runs a GSAP tween on top of the CSS one.
   ⚠️ Fill mode `backwards`, never `both`/`forwards`: an animation that ENDS
   on `transform: none` is interpolated to an identity matrix, and a filled
   identity matrix is still a transform — the same trap, one level down. */
#dynamic-content.fade-out {
  opacity: 0;
  transform: none;
  transition: opacity 120ms var(--ease);
}
#dynamic-content.fade-in {
  opacity: 1;
  transform: none;
  transition: none;
  animation: rmRouteIn var(--dur-base) var(--ease-emph) backwards;
}
@keyframes rmRouteIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---- Holding a gated route while the gates are being read ---------------- */
.rm-holding {
  min-height: 50vh; display: grid; place-items: center; color: var(--rm-muted);
  font-size: .95rem;
}
.rm-holding-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  margin-right: 10px; vertical-align: middle;
  background: var(--gradient-accent);
  animation: rmPulse 1.1s var(--ease) infinite alternate;
}
@keyframes rmPulse { from { opacity: .35; transform: scale(.8); } to { opacity: 1; transform: none; } }

/* ---- Page shell ---------------------------------------------------------- */
.rm-page { max-width: 1480px; margin: 0 auto; padding: 0 0 48px; }
.rm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.rm-title {
  font-family: 'Outfit', sans-serif; font-weight: 800; font-size: clamp(1.7rem, 2.6vw, 2.35rem);
  letter-spacing: -.02em; line-height: 1.1; color: var(--text-primary); margin: 0;
}
.rm-title .rm-grad { background: var(--gradient-accent); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.rm-sub { color: var(--rm-muted); margin: 6px 0 0; font-size: .98rem; max-width: 60ch; }
.rm-toolbar {
  position: sticky; top: -2rem; z-index: 20;
  margin: 0 -12px 18px; padding: 12px;
  border-radius: 0 0 16px 16px; border: 1px solid transparent; border-top: 0;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
/* Only once it is actually pinned does the bar get a ground of its own — a
   band painted over the page's gradient while it sits in place reads as a box. */
.rm-toolbar.stuck { background: var(--rm-toolbar-bg); border-color: var(--rm-hair); }
.rm-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rm-row + .rm-row { margin-top: 12px; }

/* ---- Search ---------------------------------------------------------------- */
.rm-search {
  position: relative; flex: 1 1 280px; min-width: 220px; max-width: 560px;
}
.rm-search input {
  width: 100%; height: var(--rm-tap); border-radius: var(--rm-radius-sm);
  padding: 0 44px 0 44px; font: 500 .98rem 'Inter', sans-serif; color: var(--text-primary);
  background: var(--rm-surface); border: 1px solid var(--rm-hair);
  outline: none; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.rm-search input::placeholder { color: var(--rm-muted); }
.rm-search input:focus { border-color: var(--rm-cyan); }
.rm-search svg { position: absolute; left: 15px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); stroke: var(--rm-muted); fill: none; stroke-width: 2; pointer-events: none; }
.rm-search .rm-clear {
  position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: var(--rm-muted); cursor: pointer; font-size: 1.15rem;
}
.rm-search .rm-clear:hover { color: var(--text-primary); background: var(--rm-hair); }

/* ---- Sliding segmented control -----------------------------------------
   The indicator is positioned from the MEASURED button (JS writes --x/--w),
   never from index/count: translated labels differ in width. */
.rm-seg {
  position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 14px;
  background: var(--rm-surface); border: 1px solid var(--rm-hair);
}
.rm-seg button {
  position: relative; z-index: 1; min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px;
  background: transparent; color: var(--rm-muted); cursor: pointer;
  font: 700 .9rem 'Inter', sans-serif; white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
}
.rm-seg button:hover { color: var(--text-primary); }
.rm-seg button[aria-selected="true"], .rm-seg button[aria-pressed="true"] { color: var(--text-primary); }
.rm-seg-ind {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0;
  width: var(--w, 0px); transform: translateX(var(--x, 0px));
  border-radius: 10px; background: var(--rm-surface-2);
  box-shadow: inset 0 -2px 0 0 var(--rm-cyan);
  transition: transform var(--dur-base) var(--ease-emph), width var(--dur-base) var(--ease-emph);
}

/* ---- Tag pills ---------------------------------------------------------- */
.rm-tags { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.rm-tags::-webkit-scrollbar { display: none; }
.rm-tag {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rm-hair-strong); background: transparent; color: var(--text-primary);
  font: 600 .85rem 'Inter', sans-serif; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.rm-tag small { color: var(--rm-muted); font-weight: 600; margin-left: 6px; }
.rm-tag:hover { border-color: var(--rm-cyan); }
.rm-tag[aria-pressed="true"] { background: var(--rm-cyan); border-color: var(--rm-cyan); color: #001417; }
.rm-tag[aria-pressed="true"] small { color: rgba(0, 20, 23, .7); }
[data-theme="light"] .rm-tag[aria-pressed="true"] { background: var(--rm-cyan-ink); border-color: var(--rm-cyan-ink); color: #fff; }
[data-theme="light"] .rm-tag[aria-pressed="true"] small { color: rgba(255, 255, 255, .8); }

/* ---- Buttons ------------------------------------------------------------- */
.rm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--rm-tap); padding: 0 20px; border-radius: var(--rm-radius-sm);
  border: 1px solid var(--rm-hair-strong); background: var(--rm-surface); color: var(--text-primary);
  font: 700 .95rem 'Inter', sans-serif; cursor: pointer; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.rm-btn:hover { border-color: var(--rm-cyan); }
.rm-btn:active { transform: scale(.97); }
.rm-btn[disabled] { opacity: .5; cursor: default; transform: none; }
.rm-btn.primary { border: 0; background: var(--gradient-accent); color: #fff; }
.rm-btn.primary:hover { filter: brightness(1.08); }
.rm-btn.ghost { background: transparent; }
.rm-btn.danger { color: var(--danger-color); }
.rm-btn.danger:hover { border-color: var(--danger-color); }
.rm-icon-btn {
  width: var(--rm-tap); height: var(--rm-tap); border-radius: 50%; border: 1px solid var(--rm-hair-strong);
  background: var(--rm-surface); color: var(--text-primary); cursor: pointer;
  display: inline-grid; place-items: center; font-size: 1.15rem;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.rm-icon-btn:hover { border-color: var(--rm-cyan); }
.rm-icon-btn:active { transform: scale(.94); }
.rm-icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rm-icon-btn.on { color: var(--rm-pink); border-color: var(--rm-pink); }
.rm-icon-btn.on svg { fill: currentColor; }
:where(.rm-page, .cs-overlay, .st-page) :focus-visible { outline: 2px solid var(--rm-cyan); outline-offset: 2px; }

/* ---- The woven grid ------------------------------------------------------
   Placement is arithmetic in shared/feed_rules.js (`wovenSlot`): each card
   gets explicit grid lines. --rm-unit is set from the measured column width,
   so a tall card is ~4:5 and a short one near square at any column count. */
.rm-grid {
  --rm-gap: 14px;
  --rm-unit: 92px;
  display: grid; gap: var(--rm-gap);
  grid-template-columns: repeat(var(--rm-cols, 2), minmax(0, 1fr));
  grid-auto-rows: var(--rm-unit);
}
.rm-card {
  position: relative; overflow: hidden; border-radius: var(--rm-radius);
  background: var(--rm-surface-2); color: var(--rm-on-image); cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--rm-rim) 42%, transparent);
  isolation: isolate; outline: none;
  transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
  --rm-rim: var(--rm-pink);
  --mx: 50%; --my: 30%;
}
.rm-card[data-tall="1"] { --rm-rim: var(--rm-cyan); }
.rm-card:hover, .rm-card:focus-visible { transform: translateY(-3px); border-color: var(--rm-rim); }
.rm-card:focus-visible { outline: 2px solid var(--rm-rim); outline-offset: 2px; }
.rm-card-art, .rm-card-art img, .rm-card-art video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.rm-card-art img, .rm-card-art video { transition: transform var(--dur-slow) var(--ease); }
.rm-card:hover .rm-card-art img, .rm-card:hover .rm-card-art video { transform: scale(1.035); }
.rm-card-art .rm-initial {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 800 clamp(2rem, 5vw, 3.4rem) 'Outfit', sans-serif; color: rgba(255,255,255,.85);
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--rm-rim) 45%, #111), #0b0b10 70%);
}
.rm-card::before {
  /* The pointer light: one soft spot that follows the mouse. Transform-free,
     cheap, and only drawn while hovered. */
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background: radial-gradient(240px circle at var(--mx) var(--my), rgba(255, 255, 255, .16), transparent 60%);
  transition: opacity var(--dur-base) var(--ease);
}
.rm-card:hover::before { opacity: 1; }
.rm-card::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0) 38%, rgba(0,0,0,.35) 58%, rgba(0,0,0,.88) 100%);
}
.rm-card-body {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 14px 14px 13px;
  display: flex; flex-direction: column; gap: 4px; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.rm-card-name { font: 800 1.05rem/1.2 'Outfit', sans-serif; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-card-line {
  font-size: .82rem; line-height: 1.35; color: rgba(255,255,255,.82); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rm-card[data-tall="0"] .rm-card-line { -webkit-line-clamp: 1; }
.rm-card-meta { display: flex; align-items: center; gap: 10px; font-size: .76rem; color: rgba(255,255,255,.78); margin-top: 2px; }
.rm-card-meta .rm-chip {
  padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.45);
  border: 1px solid color-mix(in srgb, var(--rm-rim) 60%, transparent); color: #fff; font-weight: 600;
}
.rm-card-actions {
  position: absolute; z-index: 3; top: 10px; right: 10px; display: flex; gap: 6px;
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.rm-card:hover .rm-card-actions, .rm-card:focus-within .rm-card-actions, .rm-card-actions.pinned { opacity: 1; transform: none; }
.rm-card-actions button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22);
  background: rgba(10, 10, 14, .6); color: #fff; display: grid; place-items: center; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.rm-card-actions button:hover { background: rgba(10, 10, 14, .85); transform: scale(1.06); }
.rm-card-actions button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rm-card-actions button.on { color: var(--rm-pink); }
.rm-card-actions button.on svg { fill: currentColor; }
.rm-card-actions button.on[data-act="save"] { color: var(--rm-cyan); }

/* Skeleton: the card's own frame, shimmering where the art will be. */
.rm-skel {
  border-radius: var(--rm-radius); border: 1px solid var(--rm-hair);
  background: linear-gradient(100deg, var(--rm-skel-a) 30%, var(--rm-skel-b) 50%, var(--rm-skel-a) 70%);
  background-size: 300% 100%; animation: rmShimmer 1.4s linear infinite;
}
@keyframes rmShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Entrance: rows rise together (per ROW, not per index — a per-index stagger
   zig-zags across the columns and hides the weave). */
.rm-enter { animation: rmRise var(--dur-slow) var(--ease-emph) backwards; animation-delay: var(--d, 0ms); }
@keyframes rmRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.rm-sentinel { height: 1px; }
.rm-more { display: flex; justify-content: center; padding: 24px 0 8px; color: var(--rm-muted); font-size: .9rem; }

/* ---- Honest states ------------------------------------------------------ */
.rm-state {
  grid-column: 1 / -1; text-align: center; padding: 56px 20px; color: var(--rm-muted);
  border: 1px dashed var(--rm-hair-strong); border-radius: var(--rm-radius);
}
.rm-state h3 { font: 800 1.25rem 'Outfit', sans-serif; color: var(--text-primary); margin: 0 0 6px; }
.rm-state p { margin: 0 auto 16px; max-width: 46ch; }
.rm-state .rm-row { justify-content: center; }
.rm-state.error h3 { color: var(--text-primary); }

/* ---- Discovery's deck ------------------------------------------------------ */
.rm-disc { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 22px; }
.rm-deck {
  /* Sized from the HEIGHT the window has left after the header and the
     controls, so Chat and the choose/pass buttons are never below the fold. */
  position: relative; height: clamp(360px, calc(100vh - 340px), 640px); height: clamp(340px, calc(100dvh - 330px), 640px); aspect-ratio: 3 / 4.35;
  width: auto; max-width: 92vw;
  user-select: none; -webkit-user-select: none;
}
.rm-disc { gap: 18px; }
.rm-deck > .rm-state { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 28px; }
.rm-dcard {
  position: absolute; inset: 0; border-radius: 26px; overflow: hidden; background: var(--rm-surface-2);
  color: var(--rm-on-image); border: 1.5px solid color-mix(in srgb, var(--rm-cyan) 40%, transparent);
  touch-action: pan-y; cursor: grab; will-change: transform;
  transition: transform var(--dur-base) var(--ease-emph), opacity var(--dur-base) var(--ease);
  --mx: 50%; --my: 30%;
}
.rm-dcard.dragging { transition: none; cursor: grabbing; }
.rm-dcard[data-depth="1"] { transform: translateY(14px) scale(.955); pointer-events: none; }
.rm-dcard[data-depth="2"] { transform: translateY(28px) scale(.91); pointer-events: none; opacity: .7; }
.rm-dcard[data-depth="3"] { transform: translateY(28px) scale(.91); pointer-events: none; opacity: 0; }
.rm-dcard .rm-card-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 45%, rgba(0,0,0,.92) 100%);
}
.rm-dcard .rm-card-art img, .rm-dcard .rm-card-art video { object-position: 50% 27.5%; }
.rm-dcard::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background: radial-gradient(320px circle at var(--mx) var(--my), rgba(255,255,255,.14), transparent 60%);
  transition: opacity var(--dur-base) var(--ease);
}
.rm-dcard[data-depth="0"]:hover::before { opacity: 1; }
.rm-dcard-body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 8px; }
.rm-dcard-name { font: 800 1.75rem/1.1 'Outfit', sans-serif; margin: 0; text-shadow: 0 2px 8px rgba(0,0,0,.45); }
.rm-dcard-name span { font-weight: 600; opacity: .8; font-size: 1.2rem; }
.rm-dcard-hook {
  margin: 0; font-size: .98rem; line-height: 1.45; color: rgba(255,255,255,.9);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rm-dcard-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-dcard-tags span { padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.18); }
.rm-dcard-meta { display: flex; gap: 12px; font-size: .8rem; color: rgba(255,255,255,.75); }
.rm-stamp {
  position: absolute; top: 26px; z-index: 3; padding: 6px 14px; border-radius: 10px;
  font: 800 1.3rem 'Outfit', sans-serif; letter-spacing: .08em; text-transform: uppercase;
  border: 3px solid currentColor; opacity: 0; pointer-events: none; background: rgba(0,0,0,.25);
}
.rm-stamp.choose { left: 22px; color: var(--rm-pink); transform: rotate(-12deg); }
.rm-stamp.pass { right: 22px; color: #e9edf5; transform: rotate(12deg); }
.rm-deck-ctl { display: flex; align-items: center; justify-content: center; gap: 14px; }
.rm-deck-ctl .rm-icon-btn { width: 56px; height: 56px; font-size: 1.3rem; }
.rm-deck-ctl .rm-icon-btn.pass:hover { border-color: #e9edf5; }
.rm-deck-ctl .rm-icon-btn.choose { color: var(--rm-pink); }
.rm-deck-ctl .rm-icon-btn.choose:hover { border-color: var(--rm-pink); }
.rm-deck-ctl .rm-icon-btn.undo { width: 46px; height: 46px; }
.rm-chat-cta {
  min-height: 56px; padding: 0 30px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--gradient-accent); color: #fff; font: 800 1.05rem 'Outfit', sans-serif;
  display: inline-flex; align-items: center; gap: 10px; letter-spacing: .01em;
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--rm-pink) 70%, transparent);
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.rm-chat-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.rm-chat-cta:active { transform: scale(.97); }
.rm-chat-cta svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rm-keys { color: var(--rm-muted); font-size: .8rem; text-align: center; }
.rm-keys kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 2px; border-radius: 6px;
  border: 1px solid var(--rm-hair-strong); background: var(--rm-surface); font: 600 .75rem 'Inter', sans-serif; color: var(--text-primary);
}

/* ---- The character sheet ---------------------------------------------------- */
.cs-overlay {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 24px;
  background: rgba(3, 3, 6, .72);
  opacity: 0; transition: opacity var(--dur-base) var(--ease);
}
.cs-overlay.visible { opacity: 1; }
.cs-sheet {
  position: relative; width: min(1040px, 100%); height: min(760px, calc(100vh - 48px));
  display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  border-radius: 24px; overflow: hidden; background: var(--rm-surface); color: var(--text-primary);
  border: 1px solid var(--rm-hair-strong);
  transform: translateY(14px) scale(.985); opacity: 0;
  transition: transform var(--dur-base) var(--ease-emph), opacity var(--dur-base) var(--ease);
}
.cs-overlay.visible .cs-sheet { transform: none; opacity: 1; }
.cs-hero { position: relative; overflow: hidden; background: #0b0b10; }
.cs-hero-art { position: absolute; inset: -6% 0; will-change: transform; }
.cs-hero-art img, .cs-hero-art video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 27.5%; display: block; }
.cs-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25), transparent 30%, transparent 62%, rgba(0,0,0,.75)); pointer-events: none; }
.cs-hero-id { position: absolute; left: 22px; right: 22px; bottom: 20px; z-index: 1; color: #fff; display: flex; align-items: center; gap: 14px; }
.cs-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: none; overflow: hidden; border: 2px solid rgba(255,255,255,.85);
  background: var(--gradient-accent); display: grid; place-items: center; font: 800 1.5rem 'Outfit', sans-serif;
}
.cs-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cs-name { font: 800 1.85rem/1.1 'Outfit', sans-serif; margin: 0; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.cs-name span { font-weight: 600; font-size: 1.15rem; opacity: .85; }
.cs-by { font-size: .85rem; opacity: .85; margin-top: 4px; }
.cs-side { display: flex; flex-direction: column; min-height: 0; }
.cs-scroll { flex: 1; overflow-y: auto; padding: 26px 28px 20px; overscroll-behavior: contain; }
.cs-title { font-size: 1.08rem; line-height: 1.5; margin: 0 0 16px; color: var(--text-primary); font-weight: 600; }
.cs-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cs-stat { padding: 10px 14px; border-radius: 14px; background: var(--rm-surface-2); border: 1px solid var(--rm-hair); min-width: 92px; }
.cs-stat strong { display: block; font: 800 1.1rem 'Outfit', sans-serif; }
.cs-stat span { color: var(--rm-muted); font-size: .78rem; }
.cs-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.cs-tags span { padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid var(--rm-hair-strong); color: var(--text-primary); }
.cs-section { margin-bottom: 18px; }
.cs-section h4 { margin: 0 0 6px; font: 800 .78rem 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--rm-cyan-ink); }
.cs-section p { margin: 0; line-height: 1.6; color: var(--text-primary); white-space: pre-line; }
.cs-section p.cs-wait { color: var(--rm-muted); }
.cs-foot {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px 16px; border-top: 1px solid var(--rm-hair);
  background: var(--rm-surface);
}
.cs-foot .rm-chat-cta { margin-left: auto; }
.cs-close {
  position: absolute; top: 14px; right: 14px; z-index: 5; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); background: rgba(8, 8, 12, .55); color: #fff; font-size: 1.4rem; cursor: pointer;
  display: grid; place-items: center; transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.cs-close:hover { background: rgba(8, 8, 12, .85); transform: rotate(90deg); }
.cs-menu { position: relative; }
.cs-menu-list {
  position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 210px; z-index: 6; padding: 6px;
  border-radius: 14px; background: var(--rm-surface-2); border: 1px solid var(--rm-hair-strong);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.cs-menu-list button {
  width: 100%; min-height: 44px; text-align: left; padding: 0 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--text-primary); font: 600 .9rem 'Inter', sans-serif;
}
.cs-menu-list button:hover { background: var(--rm-hair); }
.cs-menu-list button.danger { color: var(--danger-color); }
.cs-overlay .char-reviews { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--rm-hair); }
.cs-overlay .char-reviews-title { font: 800 1.1rem 'Outfit', sans-serif; margin: 0 0 10px; }

/* ---- Archival ---------------------------------------------------------------- */
.ar-list { display: flex; flex-direction: column; gap: 10px; }
.ar-row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 16px; background: var(--rm-surface); border: 1px solid var(--rm-hair);
  cursor: pointer; transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.ar-row:hover { border-color: var(--rm-hair-strong); background: var(--rm-surface-2); }
.ar-row:active { transform: scale(.995); }
.ar-ava {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--gradient-accent);
  display: grid; place-items: center; font: 800 1.3rem 'Outfit', sans-serif; color: #fff; position: relative;
}
.ar-ava img { width: 100%; height: 100%; object-fit: cover; }
.ar-ava.group { border-radius: 16px; }
.ar-text { min-width: 0; }
.ar-name { display: flex; align-items: center; gap: 8px; font: 700 1rem 'Inter', sans-serif; color: var(--text-primary); }
.ar-name span.ar-badge { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: var(--rm-cyan-ink); border: 1px solid currentColor; }
.ar-last { color: var(--rm-muted); font-size: .88rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-side { display: flex; align-items: center; gap: 8px; color: var(--rm-muted); font-size: .8rem; white-space: nowrap; }
.ar-del { width: 40px; height: 40px; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--rm-muted); cursor: pointer; display: grid; place-items: center; }
.ar-del:hover { color: var(--danger-color); border-color: var(--rm-hair-strong); }
.ar-del svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ar-row.leaving { opacity: 0; transform: translateX(24px); transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease); }
.ar-row.gone .ar-name { color: var(--rm-muted); }
.ar-skel-row { height: 82px; }
.ar-panel { animation: rmPanelIn var(--dur-base) var(--ease-emph) backwards; }
.ar-panel.out { animation: rmPanelOut 117ms var(--ease) both; }
@keyframes rmPanelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rmPanelOut { from { opacity: 1; } to { opacity: 0; } }
.ar-count { margin-left: 6px; color: var(--rm-muted); font-weight: 600; }
.ar-uniform { --rm-unit: 92px; }

/* ---- Light theme: photography keeps its dark scrim and white ink ------------- */
/* ⚠️ Site-wide: #premium-bg (index.html) is a fixed, full-screen DARK gradient
   behind every tab with no light variant, so in the light theme every page's
   dark ink sat on near-black ("Global" vanished from GlobalChain's title, the
   Feedback heading too). The light theme gets its own quiet ground. */
[data-theme="light"] #premium-bg {
  background: radial-gradient(circle at 85% 0%, rgba(0, 180, 255, 0.07), transparent 45%),
              radial-gradient(circle at 0% 100%, rgba(255, 0, 160, 0.05), transparent 45%),
              var(--bg-color);
  animation: none;
}
[data-theme="light"] .rm-card, [data-theme="light"] .rm-dcard { background: #dfe4ee; }

[data-theme="light"] .cs-overlay { background: rgba(20, 24, 40, .45); }

/* ---- Reduced motion --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #dynamic-content.fade-in, #dynamic-content.fade-out { animation: none; transition: none; }
  .rm-enter, .ar-panel, .ar-panel.out, .rm-holding-dot, .rm-skel { animation: none !important; }
  .rm-card, .rm-card-art img, .rm-card-art video, .rm-dcard, .rm-seg-ind, .cs-sheet, .cs-overlay,
  .rm-card-actions, .rm-btn, .rm-icon-btn, .ar-row { transition: none !important; }
  .rm-card:hover, .rm-card:focus-visible { transform: none; }
  #premium-bg { animation: none !important; }
  .rm-card:hover .rm-card-art img, .rm-card:hover .rm-card-art video { transform: none; }
}

/* `hidden` must win over every display rule above (.rm-tags is flex, etc.). */
:where(.rm-page, .cs-overlay, .st-page) [hidden] { display: none !important; }

/* R56-P1 — a failed reply offers Retry for the same turn. */
.msg-retry-btn {
  display: inline-flex; align-items: center; margin-top: 10px; min-height: 36px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--rm-hair-strong, rgba(255,255,255,.16)); background: transparent;
  color: var(--text-primary); font: 700 .85rem 'Inter', sans-serif; cursor: pointer;
}
.msg-retry-btn:hover { border-color: var(--primary-color); }

/* =====================================================================
   R56-P1 — the Studio
   ===================================================================== */
.st-page .rm-head { margin-bottom: 22px; }
.st-quota { color: var(--rm-muted); font: 600 .9rem 'Inter', sans-serif; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--rm-hair); }
.st-quota.over { color: #f5b942; border-color: color-mix(in srgb, #f5b942 50%, transparent); }
.st-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; padding: 14px 18px;
  border-radius: 16px; border: 1px solid var(--rm-hair-strong); background: var(--rm-surface); color: var(--text-primary);
}
.st-banner.warn { border-color: color-mix(in srgb, #f5b942 55%, transparent); }
.st-banner.ok { border-color: color-mix(in srgb, var(--rm-cyan) 55%, transparent); }
.st-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 34px; }
.st-mode {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  min-height: 210px; padding: 22px; border-radius: var(--rm-radius); cursor: pointer; overflow: hidden;
  background: var(--rm-surface); color: var(--text-primary); border: 1.5px solid var(--rm-hair-strong);
  transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.st-mode::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background: radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--st-tint) 22%, transparent), transparent 60%);
}
.st-mode.fast { --st-tint: var(--rm-pink); }
.st-mode.slow { --st-tint: var(--rm-cyan); }
.st-mode.manual { --st-tint: #8a7dff; }
.st-mode:hover:not([disabled]) { transform: translateY(-3px); border-color: var(--st-tint); }
.st-mode[disabled] { opacity: .55; cursor: default; }
.st-mode > * { position: relative; }
.st-mode-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: color-mix(in srgb, var(--st-tint) 20%, transparent); color: var(--text-primary); }
.st-mode-name { font: 800 1.2rem 'Outfit', sans-serif; }
.st-mode-desc { color: var(--rm-muted); font-size: .9rem; line-height: 1.45; flex: 1; }
.st-price { font: 800 1rem 'Outfit', sans-serif; color: var(--text-primary); }
.st-mode-note { color: var(--rm-muted); font-size: .76rem; margin-top: -6px; }
.st-h2 { font: 800 1.25rem 'Outfit', sans-serif; margin: 0 0 6px; color: var(--text-primary); }
.st-lib-head { justify-content: space-between; margin-bottom: 14px; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.st-card {
  display: flex; flex-direction: column; border-radius: var(--rm-radius); overflow: hidden; background: var(--rm-surface);
  border: 1px solid var(--rm-hair); transition: border-color var(--dur-fast) var(--ease), opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.st-card:hover { border-color: var(--rm-hair-strong); }
.st-card.leaving { opacity: 0; transform: scale(.97); }
.st-card-art { height: 150px; background: var(--rm-surface-2); display: grid; place-items: center; font: 800 2.2rem 'Outfit', sans-serif; color: var(--rm-muted); }
.st-card-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 27.5%; }
.st-card-body { padding: 14px 16px 6px; flex: 1; }
.st-card-body h3 { margin: 0; font: 800 1.02rem 'Outfit', sans-serif; color: var(--text-primary); }
.st-card-body p { margin: 4px 0 0; color: var(--rm-muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-card-meta { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.st-vis { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--rm-hair-strong); color: var(--rm-muted); }
.st-vis.draft { color: #f5b942; border-color: color-mix(in srgb, #f5b942 45%, transparent); }
.st-card-actions { display: flex; gap: 8px; padding: 12px 14px 14px; align-items: center; }
.st-card-actions .rm-btn { min-height: 40px; padding: 0 14px; font-size: .88rem; }
.st-card-actions .st-del { margin-left: auto; width: 40px; height: 40px; }
.st-card-actions .st-del:hover { color: var(--danger-color); border-color: var(--danger-color); }
.st-card-skel { height: 290px; }
.st-note { color: var(--rm-muted); font-size: .88rem; margin-top: 14px; }

/* Flows: Fast mode, the job, the result — one question per screen. */
.st-flow { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; min-height: 60vh; }
.st-flow-head { display: flex; align-items: center; gap: 14px; }
.st-progress { flex: 1; height: 6px; border-radius: 999px; background: var(--rm-hair); overflow: hidden; }
.st-progress span { display: block; height: 100%; border-radius: inherit; background: var(--gradient-accent); transition: width var(--dur-slow) var(--ease-emph); }
.st-progress.big { flex: none; width: min(420px, 80%); height: 8px; margin: 6px auto; }
.st-step-of { color: var(--rm-muted); font: 600 .85rem 'Inter', sans-serif; }
.st-flow-body { flex: 1; padding: 10px 2px; }
.st-in { animation: rmRise var(--dur-base) var(--ease-emph) backwards; }
.st-q { font: 800 clamp(1.4rem, 2.2vw, 1.9rem) 'Outfit', sans-serif; margin: 6px 0 4px; color: var(--text-primary); }
.st-q3 { font: 700 1.05rem 'Outfit', sans-serif; margin: 22px 0 10px; }
.st-qsub { color: var(--rm-muted); margin: 0 0 16px; line-height: 1.5; }
.st-opt { font: 600 .75rem 'Inter', sans-serif; color: var(--rm-muted); vertical-align: middle; margin-left: 6px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rm-hair-strong); }
.st-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.st-chip {
  min-height: 44px; padding: 8px 16px; border-radius: 14px; cursor: pointer; text-align: left;
  border: 1px solid var(--rm-hair-strong); background: var(--rm-surface); color: var(--text-primary); font: 600 .9rem 'Inter', sans-serif;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.st-chip:hover { border-color: var(--rm-cyan); }
.st-chip.on { border-color: var(--rm-cyan); background: color-mix(in srgb, var(--rm-cyan) 14%, var(--rm-surface)); }
.st-more-ideas { align-self: flex-start; }
.st-toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
.st-traits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.st-trait { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--rm-surface); border: 1px solid var(--rm-hair); }
.st-trait button {
  min-height: 40px; border: 0; border-radius: 10px; cursor: pointer; background: transparent; color: var(--rm-muted);
  font: 700 .85rem 'Inter', sans-serif; padding: 0 10px; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.st-trait button.on { background: var(--rm-surface-2); color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--rm-cyan); }
.st-trait button[data-v=""] { font-weight: 600; font-size: .78rem; }
.st-switch { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--rm-hair); background: var(--rm-surface); margin-bottom: 10px; cursor: pointer; font-weight: 600; }
.st-switch input { width: 20px; height: 20px; accent-color: var(--rm-cyan); }
.st-review { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 10px 0 18px; padding: 18px; border-radius: 16px; background: var(--rm-surface); border: 1px solid var(--rm-hair); }
.st-review dt { color: var(--rm-muted); font-weight: 700; font-size: .85rem; }
.st-review dd { margin: 0; color: var(--text-primary); }
.st-balance { font-weight: 700; }
.st-balance.warn { color: #f5b942; }
/* The pinned action dock: a surface with an edge (dochi-design: "a colour
   cast is not a surface"), kept in view while a long step scrolls under it. */
.st-flow-foot, .st-ed-foot {
  position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding: 10px 12px; border-radius: 16px;
  background: var(--rm-toolbar-bg); border: 1px solid var(--rm-hair);
}
.st-foot-hint { flex: 1; min-width: 200px; color: var(--rm-muted); font-size: .88rem; }
.st-undo { margin-left: 6px; border: 0; background: none; color: var(--rm-cyan-ink); font-weight: 700; cursor: pointer; text-decoration: underline; }
.st-job { align-items: center; justify-content: center; text-align: center; }
.st-orb { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--gradient-accent); color: #fff; font-size: 2.2rem; }
.st-orb.spin span { animation: stSpin 2.4s linear infinite; display: inline-block; }
@keyframes stSpin { to { transform: rotate(360deg); } }
.st-done-art { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; object-position: 50% 27.5%; border: 2px solid var(--rm-cyan); }

/* The editor */
.st-editor { display: flex; flex-direction: column; gap: 16px; }
.st-ed-title { flex: 1; display: flex; flex-direction: column; }
.st-ed-title strong { font: 800 1.15rem 'Outfit', sans-serif; color: var(--text-primary); }
.st-ed-status { color: var(--rm-muted); font-size: .82rem; }
.st-ed-status.warn { color: #f5b942; }
.st-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.st-steps button {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rm-hair); background: transparent;
  color: var(--rm-muted); font: 700 .85rem 'Inter', sans-serif; cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.st-steps button[aria-current="step"] { color: var(--text-primary); border-color: var(--rm-cyan); background: color-mix(in srgb, var(--rm-cyan) 10%, transparent); }
.st-steps li.bad button { border-color: color-mix(in srgb, #f5b942 70%, transparent); color: #f5b942; }
.st-ed-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.st-form .form-section { padding: 22px; border-radius: var(--rm-radius); background: var(--rm-surface); border: 1px solid var(--rm-hair); }
.st-form .form-section.st-in { animation: rmRise var(--dur-base) var(--ease-emph) backwards; }
.st-field { position: relative; display: flex; flex-direction: column; gap: 6px; margin-top: 16px; flex: 1; min-width: 0; }
.st-row { display: flex; gap: 14px; flex-wrap: wrap; }
.st-row > .st-field { flex: 1 1 180px; }
.st-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-field label { font: 700 .9rem 'Inter', sans-serif; color: var(--text-primary); }
.st-req, .st-help-inline { font-weight: 600; font-size: .74rem; color: var(--rm-muted); margin-left: 4px; }
.st-help { color: var(--rm-muted); font-size: .84rem; margin: 0; line-height: 1.45; }
.st-field input, .st-field textarea, .st-field select, .st-try textarea {
  width: 100%; border-radius: var(--rm-radius-sm); border: 1px solid var(--rm-hair-strong); background: var(--rm-surface-2);
  color: var(--text-primary); font: 500 .95rem/1.5 'Inter', sans-serif; padding: 12px 14px; outline: none; resize: vertical;
  transition: border-color var(--dur-fast) var(--ease);
}
.st-field input, .st-field select { min-height: var(--rm-tap); }
.st-field input:focus, .st-field textarea:focus, .st-field select:focus, .st-try textarea:focus { border-color: var(--rm-cyan); }
.st-field.bad input, .st-field.bad textarea, .st-field.bad select { border-color: #f5b942; }
.st-field .char-count { align-self: flex-end; font-size: .76rem; color: var(--rm-muted); }
.st-field .char-count.short { color: #f5b942; }
.st-err { margin: 0; color: #f5b942; font-size: .84rem; font-weight: 600; }
[data-theme="light"] .st-err, [data-theme="light"] .st-field .char-count.short { color: #8a5a00; }
.st-pencil {
  min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--rm-cyan) 45%, transparent);
  background: transparent; color: var(--rm-cyan-ink); font: 700 .8rem 'Inter', sans-serif; cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.st-pencil:hover { background: color-mix(in srgb, var(--rm-cyan) 12%, transparent); }
.st-pencil.busy { opacity: .7; cursor: progress; }
.st-slots { display: grid; grid-template-columns: 0.7fr 1.6fr 0.75fr; gap: 16px; align-items: end; margin-top: 16px; }
.st-slot-frame {
  position: relative; width: 100%; border-radius: 16px; overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--rm-hair-strong); background: var(--rm-surface-2);
  transition: border-color var(--dur-fast) var(--ease);
}
.st-slot-frame.circle { border-radius: 50%; }
.st-slot-frame:hover, .st-slot-frame.drop { border-color: var(--rm-cyan); }
.st-slot.has .st-slot-frame { border-style: solid; }
.st-slot.bad .st-slot-frame { border-color: #f5b942; }
.st-slot-media, .st-slot-media img, .st-slot-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.st-slot-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 10px; color: var(--rm-muted); font: 700 .85rem 'Inter', sans-serif; }
.st-slot-empty span { font-size: 1.6rem; color: var(--text-primary); }
.st-slot-empty small { font-weight: 500; font-size: .72rem; }
.st-slot.has .st-slot-empty { display: none; }
.st-slot-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.2rem; cursor: pointer; }
.st-slot-frame.circle .st-slot-x { top: 12%; right: 12%; }
.st-slot-label { margin: 8px 0 0; font: 700 .85rem 'Inter', sans-serif; text-align: center; color: var(--text-primary); }
.st-check { margin-top: 20px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--rm-hair); }
.st-check h3 { margin: 0 0 8px; font: 800 1rem 'Outfit', sans-serif; }
.st-check h3.ok { color: var(--rm-cyan-ink); margin: 0; }
.st-check ul { margin: 0; padding-left: 18px; }
.st-check li { margin: 4px 0; }
.st-check li button { border: 0; background: none; color: var(--text-primary); text-align: left; cursor: pointer; padding: 2px 0; font: 500 .9rem 'Inter', sans-serif; text-decoration: underline dotted; }
.st-preview { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 14px; }
.st-preview-chat { padding: 14px; border-radius: 16px; background: #0b0b10; border: 1px solid var(--rm-hair); display: flex; flex-direction: column; gap: 8px; }
.st-bubble { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.5; color: #f3f4f8; }
.st-bubble.ai { background: #1d1d26; border-top-left-radius: 4px; align-self: flex-start; }
.st-bubble.user { background: color-mix(in srgb, var(--rm-cyan) 22%, #10141a); border-top-right-radius: 4px; align-self: flex-end; }
.st-bubble .rp-action { color: #b9bccb; }
.st-bubble .rp-speech { color: #fff; font-weight: 600; }
.st-bubble.typing { display: inline-flex; gap: 4px; }
.st-bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa0b5; animation: rmPulse .9s var(--ease) infinite alternate; }
.st-bubble.typing span:nth-child(2) { animation-delay: .15s; }
.st-bubble.typing span:nth-child(3) { animation-delay: .3s; }

/* Try this companion */
.st-try {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 2600; width: min(440px, 100vw); display: flex; flex-direction: column;
  background: #0d0d12; border-left: 1px solid var(--rm-hair-strong); color: #f3f4f8;
  transform: translateX(100%); transition: transform var(--dur-base) var(--ease-emph);
}
.st-try.open { transform: none; }
.st-try-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.st-try-head > div { flex: 1; display: flex; flex-direction: column; }
.st-try-head small { color: #9aa0b5; font-size: .76rem; }
.st-try-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.st-try-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.st-try-form textarea { flex: 1; resize: none; background: #16161f; color: #f3f4f8; border-color: rgba(255,255,255,.16); }

/* The cropper */
.st-crop { position: fixed; inset: 0; z-index: 10070; display: grid; place-items: center; background: rgba(3,3,6,.8); padding: 16px; }
.st-crop-card { background: var(--rm-surface); border: 1px solid var(--rm-hair-strong); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; max-width: 100%; }
.st-crop-card h3 { margin: 0; font: 800 1.1rem 'Outfit', sans-serif; color: var(--text-primary); }
.st-crop-stage { position: relative; overflow: hidden; border-radius: 12px; background: #000; touch-action: none; cursor: grab; align-self: center; }
.st-crop-stage canvas { display: block; }
.st-crop-stage.circle::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.55); }
.st-crop-card input[type="range"] { accent-color: var(--rm-cyan); }

@media (max-width: 1100px) {
  .st-ed-grid { grid-template-columns: minmax(0, 1fr); }
  .st-preview { display: none; }
}
@media (max-width: 900px) {
  .st-modes { grid-template-columns: minmax(0, 1fr); }
  .st-traits { grid-template-columns: minmax(0, 1fr); }
  .st-slots { grid-template-columns: 1fr 1fr; }
  .st-slot-background { grid-column: 1 / -1; order: -1; }
}
@media (prefers-reduced-motion: reduce) {
  .st-in, .st-form .form-section.st-in, .st-orb.spin span, .st-bubble.typing span { animation: none !important; }
  .st-mode, .st-card, .st-try, .st-progress span { transition: none !important; }
}

/* The R5 Studio stylesheet styles `#character-studio-form …` by id, which
   outranks the classes above; these restate the new look one id higher. */
#st-root .st-form .form-section {
  background: var(--rm-surface); border: 1px solid var(--rm-hair); border-radius: var(--rm-radius);
  padding: 22px; margin-bottom: 0; box-shadow: none;
}
#st-root .st-field input, #st-root .st-field textarea, #st-root .st-field select {
  width: 100%; border-radius: var(--rm-radius-sm); border: 1px solid var(--rm-hair-strong); background: var(--rm-surface-2);
  color: var(--text-primary); font: 500 .95rem/1.5 'Inter', sans-serif; padding: 12px 14px; box-shadow: none; min-height: 0;
}
#st-root .st-field input, #st-root .st-field select { min-height: var(--rm-tap); }
#st-root .st-field input:focus, #st-root .st-field textarea:focus, #st-root .st-field select:focus { border-color: var(--rm-cyan); box-shadow: none; }
#st-root .st-field.bad input, #st-root .st-field.bad textarea, #st-root .st-field.bad select { border-color: #f5b942; }
#st-root .st-field .char-count { margin-top: 0; font-size: .76rem; }

/* R56-P1 — global search follows the RoleModel gate (applyMode sets `hidden`),
   and `.topbar-search-btn { display: flex }` would otherwise outrank it. */
#global-search-btn[hidden] { display: none !important; }

/* R56-P3 — keyboard hints mean nothing on a touch screen. */
@media (pointer: coarse) and (hover: none) { .rm-keys { display: none; } }

/* =====================================================================
   R57-P2 — the Picture check (picture-check-ui.js): a chip under each
   Studio picture, and the full-screen page it grows out of. The app has the
   same page. Tokens only; no blur; the moving light respects reduced motion.
   ===================================================================== */
:root { --pc-amber: #f5b942; --pc-good: #00ff66; --pc-bad: #ff7a93; }
[data-theme="light"] { --pc-amber: #9a6700; --pc-good: #1a8f4c; --pc-bad: #b3261e; }

.st-slot-check { margin-top: 4px; }
.st-slot-check[hidden] { display: none; }
.pc-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 8px 3px 9px;
  border-radius: 999px; border: 1px solid var(--rm-hair-strong); background: var(--rm-surface-2);
  color: var(--text-primary); font: 600 .78rem 'Inter', sans-serif; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.pc-chip:hover { border-color: var(--rm-cyan); }
.pc-chip:active { transform: scale(.97); }
.pc-chip:focus-visible, .pc-back:focus-visible { outline: 2px solid var(--rm-cyan); outline-offset: 2px; }
.pc-chip-failed { border-color: color-mix(in srgb, var(--pc-amber) 55%, transparent); }
.pc-chip-warn { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--pc-amber); color: #000; font-size: .7rem; font-weight: 800; }
.pc-chev { color: var(--rm-muted); font-size: 1rem; line-height: 1; }
.pc-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font: 800 .68rem 'Inter', sans-serif; letter-spacing: .02em; }
.pc-everyone { color: var(--rm-cyan-ink); background: color-mix(in srgb, var(--rm-cyan) 16%, transparent); border: 1px solid color-mix(in srgb, var(--rm-cyan) 55%, transparent); }
.pc-adult { color: #fff; background: color-mix(in srgb, var(--rm-pink) 85%, transparent); }
.pc-refused { color: var(--pc-bad); background: color-mix(in srgb, var(--pc-bad) 14%, transparent); border: 1px solid color-mix(in srgb, var(--pc-bad) 55%, transparent); }
.pc-spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--rm-cyan) 30%, transparent); border-top-color: var(--rm-cyan); animation: pc-spin .8s linear infinite; vertical-align: -2px; }
@keyframes pc-spin { to { transform: rotate(360deg); } }

.pc-page {
  position: fixed; inset: 0; z-index: 10060; display: flex; flex-direction: column;
  background: var(--bg-color); color: var(--text-primary);
  clip-path: circle(0 at var(--pc-x, 50%) var(--pc-y, 50%));
  transition: clip-path var(--dur-slow) var(--ease-emph);
}
.pc-page.open { clip-path: circle(150% at var(--pc-x, 50%) var(--pc-y, 50%)); }
.pc-page.still { transition: none; clip-path: none; }
.pc-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--rm-hair); }
.pc-back { width: var(--rm-tap); height: var(--rm-tap); border: 0; border-radius: 50%; background: transparent; color: var(--text-primary); font-size: 1.3rem; cursor: pointer; }
.pc-back:hover { background: var(--rm-surface-2); }
.pc-eyebrow { margin: 0; font: 800 .74rem 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--rm-muted); }
.pc-scroll { flex: 1; overflow-y: auto; padding: 24px 16px 32px; }
.pc-scroll > * { max-width: 560px; margin-left: auto; margin-right: auto; }

.pc-frame { position: relative; display: grid; place-items: center; margin-bottom: 28px; }
.pc-pic { position: relative; z-index: 1; overflow: hidden; display: grid; place-items: center; background: var(--rm-surface-2); border-radius: var(--rm-radius); color: var(--rm-muted); font-size: 2rem; }
.pc-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-frame-avatar .pc-pic { width: 128px; height: 128px; border-radius: 50%; }
.pc-frame-background .pc-pic { width: 264px; max-width: 80vw; aspect-ratio: 16 / 9; }
.pc-frame-backgroundMobile .pc-pic { width: 104px; aspect-ratio: 9 / 16; }
.pc-ring { position: absolute; z-index: 0; inset: -7px; border-radius: calc(var(--rm-radius) + 7px); border: 3px solid var(--rm-hair-strong); transition: border-color var(--dur-base) var(--ease); }
.pc-frame-avatar .pc-ring { border-radius: 50%; }
.pc-frame > .pc-ring { left: 50%; top: 50%; transform: translate(-50%, -50%); inset: auto; }
.pc-frame-avatar > .pc-ring { width: 142px; height: 142px; }
.pc-frame-background > .pc-ring { width: calc(min(264px, 80vw) + 14px); height: calc(min(264px, 80vw) * 9 / 16 + 14px); }
.pc-frame-backgroundMobile > .pc-ring { width: 118px; height: calc(104px * 16 / 9 + 14px); }
.pc-frame.scanning .pc-ring {
  border-color: transparent;
  background: conic-gradient(from var(--pc-turn, 0deg), transparent 0 10%, var(--rm-cyan) 35%, var(--rm-pink) 60%, transparent 90%) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  animation: pc-turn 1.6s linear infinite;
}
@property --pc-turn { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes pc-turn { to { --pc-turn: 360deg; } }
.pc-frame.pc-tone-everyone .pc-ring { border-color: var(--rm-cyan); }
.pc-frame.pc-tone-adult .pc-ring { border-color: var(--rm-pink); }
.pc-frame.pc-tone-refused .pc-ring { border-color: var(--pc-bad); }
.pc-frame.pc-tone-failed .pc-ring { border-color: var(--pc-amber); }

.pc-steps { list-style: none; margin: 0; padding: 0; }
.pc-step { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.pc-step.last { padding-bottom: 0; }
.pc-step:not(.last)::after { content: ''; position: absolute; left: 13px; top: 28px; bottom: 4px; width: 2px; border-radius: 1px; background: var(--rm-hair); transition: background var(--dur-base) var(--ease); }
.pc-step.pc-done:not(.last)::after { background: color-mix(in srgb, var(--pc-good) 55%, transparent); }
.pc-node { flex: 0 0 28px; height: 24px; display: grid; place-items: center; }
.pc-wait { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--rm-hair-strong); }
.pc-tick, .pc-skip, .pc-fail { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 800 .72rem 'Inter', sans-serif; animation: pc-pop var(--dur-fast) var(--ease-emph); }
.pc-tick { background: var(--pc-good); color: #000; }
.pc-skip { border: 1.5px solid var(--rm-hair-strong); color: var(--rm-muted); }
.pc-fail { background: var(--pc-amber); color: #000; }
@keyframes pc-pop { from { transform: scale(.6); opacity: 0; } }
.pc-step-text { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.pc-step-title { font: 600 .95rem 'Inter', sans-serif; }
.pc-waiting .pc-step-title, .pc-skipped .pc-step-title { color: var(--rm-muted); }
.pc-running .pc-step-title { font-weight: 700; }
.pc-step-sub { color: var(--rm-muted); font-size: .82rem; line-height: 1.35; }
.pc-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pc-thumbs figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pc-thumbs img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; animation: pc-fade var(--dur-fast) var(--ease); }
.pc-thumbs figcaption { display: none; }
.pc-thumbs-big img { width: 64px; height: 64px; }
.pc-thumbs-big figcaption { display: block; color: var(--rm-muted); font-size: .72rem; }
@keyframes pc-fade { from { opacity: 0; } }

.pc-main.pc-enter > * { animation: pc-rise var(--dur-base) var(--ease-emph) backwards; }
.pc-main.pc-enter > *:nth-child(2) { animation-delay: 60ms; }
.pc-main.pc-enter > *:nth-child(3) { animation-delay: 120ms; }
.pc-main.pc-enter > *:nth-child(n+4) { animation-delay: 180ms; }
@keyframes pc-rise { from { opacity: 0; transform: translateY(8px); } }
.pc-verdict { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.pc-verdict-icon { font: 800 1.05rem 'Inter', sans-serif; }
.pc-verdict.pc-tone-everyone .pc-verdict-icon { color: var(--rm-cyan-ink); }
.pc-verdict.pc-tone-adult .pc-verdict-icon { color: var(--rm-pink-ink); }
.pc-verdict.pc-tone-refused .pc-verdict-icon { color: var(--pc-bad); }
.pc-verdict-head { margin: 0; font: 800 1.45rem 'Outfit', sans-serif; text-wrap: balance; }
.pc-verdict-body { margin: 0; color: var(--rm-muted); line-height: 1.45; }
.pc-notice { padding: 12px; border-radius: var(--rm-radius-sm); border: 1px solid var(--rm-hair-strong); background: var(--rm-surface-2); line-height: 1.4; font-size: .9rem; margin-bottom: 14px; }
.pc-notice-warn { border-color: color-mix(in srgb, var(--pc-amber) 50%, transparent); margin-top: 16px; }
.pc-notice.pc-tone-adult { border-color: color-mix(in srgb, var(--rm-pink) 45%, transparent); }
.pc-note { color: var(--rm-muted); font-size: .86rem; line-height: 1.45; margin: 0 0 14px; }
.pc-note.pc-err { color: var(--pc-bad); }
.pc-card { padding: 12px 16px; border-radius: var(--rm-radius); background: var(--rm-surface); border: 1px solid var(--rm-hair); margin-bottom: 14px; }
.pc-card h3 { margin: 0 0 8px; color: var(--rm-muted); font: 700 .78rem 'Inter', sans-serif; letter-spacing: .04em; }
.pc-checks, .pc-fixes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pc-checks li { display: flex; gap: 8px; align-items: baseline; font-size: .92rem; }
.pc-checks li span { flex: 0 0 auto; font-weight: 800; }
.pc-checks li.ok span { color: var(--pc-good); }
.pc-checks li.bad { font-weight: 700; }
.pc-checks li.bad span { color: var(--pc-bad); }
.pc-fixes li { line-height: 1.4; font-size: .92rem; padding-left: 14px; position: relative; }
.pc-fixes li::before { content: ''; position: absolute; left: 0; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--rm-cyan); }
.pc-second { display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }
.pc-second .rm-btn { min-height: var(--rm-tap); }
.pc-actions { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rm-hair); }
.pc-actions .rm-btn { min-height: var(--rm-tap); width: 100%; max-width: 560px; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .pc-page { transition: none; clip-path: none; }
  .pc-frame.scanning .pc-ring, .pc-spin, .pc-tick, .pc-skip, .pc-fail, .pc-thumbs img, .pc-main.pc-enter > * { animation: none; }
}

/* R57-P2 — the owner's Pictures tab (reports-ui.js): the picture beside its request. */
.rpi-pic { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: start; }
.rpi-pic-img { width: 132px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--rm-surface-2); color: var(--rm-muted); font-size: .8rem; text-align: center; padding: 6px; }
.rpi-pic-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.rpi-pic-body { min-width: 0; }
@media (max-width: 520px) { .rpi-pic { grid-template-columns: 1fr; } .rpi-pic-img { width: 100%; max-width: 260px; } }

/* ---- R57-P4 — the Browse card: picture on top, details below ---------------
   The app's CharacterGridCard. The weave lives in the PICTURES; the details are
   the same height on every card (--rm-details, set by wovenGrid from rem so it
   follows the reader's text size). The grid runs on fine rows (--rm-unit = 4px)
   with NO row-gap: each card's span includes the 8px gap, which its bottom
   margin keeps empty (a row-gap between every 4px row would multiply). */
.rm-grid { --rm-gap: 8px; row-gap: 0; column-gap: var(--rm-gap); }
.rm-grid > .rm-card, .rm-grid > .rm-skel { margin-bottom: var(--rm-gap); }
.rm-card {
  display: flex; flex-direction: column;
  background: var(--rm-surface); color: var(--text-primary, #fff);
}
.rm-card::after { display: none; }   /* no scrim: nothing is drawn on the picture now */
.rm-card-pic { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.rm-card-body {
  position: relative; inset: auto; z-index: 2; flex: 0 0 var(--rm-details, 172px); height: var(--rm-details, 172px);
  padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 0;
  background: var(--rm-surface); text-shadow: none; min-width: 0;
}
.rm-card-name { display: flex; align-items: baseline; gap: 6px; color: var(--text-primary, #fff); min-width: 0; }
.rm-card-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-card-name small { flex: 0 0 auto; font: 500 .84rem 'Inter', sans-serif; color: var(--rm-muted); }
.rm-card-line, .rm-card[data-tall="0"] .rm-card-line {
  margin: 2px 0 0; color: var(--rm-muted); font-size: .78rem; line-height: 1.25; -webkit-line-clamp: 2;
}
/* Whole chips: only the first may shorten; fitTags() moves the rest into "+N". */
.rm-card-tags { display: flex; align-items: center; gap: 4px; margin-top: 6px; min-width: 0; overflow: hidden; }
.rm-card-tags .rm-chip:first-child { flex-shrink: 1; min-width: 0; }
.rm-card-tags .rm-chip {
  flex: 0 0 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 2px 7px; border-radius: 999px; font-size: .66rem; font-weight: 700; line-height: 1.2;
  color: var(--rm-muted); background: color-mix(in srgb, var(--rm-muted) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--rm-muted) 25%, transparent);
}
.rm-card-tags .rm-chip.g {
  color: var(--rm-cyan-ink); background: color-mix(in srgb, var(--rm-cyan-ink) 14%, transparent);
  border-color: color-mix(in srgb, var(--rm-cyan-ink) 55%, transparent);
}
.rm-card-tags b { flex: 0 0 auto; font-size: .66rem; color: var(--rm-muted); }
.rm-card-by { display: flex; align-items: center; gap: 4px; margin-top: 5px; min-width: 0; font-size: .72rem; line-height: 1.3; color: var(--rm-muted); }
.rm-card-by .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-card-by .n { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; font-weight: 600; }
.rm-sayhi {
  margin-top: auto; width: 100%; min-height: 36px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, #00F0FF, #FF00E6);
  color: #0b0b10;   /* dark ink: white is 1.3:1 on the cyan end */
  font: 800 .84rem 'Inter', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.rm-sayhi:hover { filter: brightness(1.08); }
.rm-sayhi:active { transform: scale(.97); }
.rm-sayhi:focus-visible { outline: 2px solid var(--rm-cyan-ink); outline-offset: 2px; }

/* The spark seam: cyan → magenta light (magenta-led on the weave's short
   slots), Dochi's ✦ sitting on it. Paint only — no blur, no filter. */
.rm-card { --seam-a: var(--rm-pink); --seam-b: var(--rm-cyan-ink); }
.rm-card[data-tall="1"] { --seam-a: var(--rm-cyan-ink); --seam-b: var(--rm-pink); }
.rm-seam {
  position: absolute; left: 0; right: 0; top: -1px; height: 2px; pointer-events: none; overflow: visible;
  background: linear-gradient(90deg, color-mix(in srgb, var(--seam-a) 90%, transparent), color-mix(in srgb, var(--seam-b) 75%, transparent));
}
.rm-seam i { position: absolute; left: 9px; top: -8px; font: normal 15px/1 sans-serif; color: var(--seam-a); }
.rm-seam::after {
  content: ''; position: absolute; top: -1px; left: -35%; width: 35%; height: 4px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.95), transparent);
}
.rm-card.sweep .rm-seam::after { animation: rmSweep 750ms cubic-bezier(.215, .61, .355, 1); }
@keyframes rmSweep { from { left: -35%; opacity: 1; } to { left: 100%; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .rm-card.sweep .rm-seam::after { animation: none; }
  .rm-sayhi { transition: none; }
}
