/* ═══════════════════════════════════════════
   Den Crawler Bear — crawl panel
   Same corner as CY-Bear, bigger, darker.
   Stays under achievement pop-ins (1000+).
   ═══════════════════════════════════════════ */

.crawl {
  --cr-bg: #09080d;
  --cr-bg-2: #121019;
  --cr-bg-3: #1a1724;
  --cr-line: #2a2536;
  --cr-text: #ece8f4;
  --cr-text-2: #a59fb4;
  --cr-amber: #ffb347;
  --cr-cyan: #8fd3ff;
  --cr-red: #ff5d6c;
  --cr-green: #5fe39a;
  --cr-purple: #c49bff;
  --cr-accent: var(--accent-bright, #e07a2f);
  font-family: var(--font-body, Inter, sans-serif);
  color: var(--cr-text);
}

/* Component display rules below would otherwise override the hidden attribute. */
.crawl [hidden] { display: none !important; }

.crawl-panel {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 965;
  width: min(640px, calc(100vw - 2.5rem));
  height: min(820px, calc(100dvh - 6.5rem));
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    radial-gradient(120% 60% at 50% 0%, #1b1426 0%, var(--cr-bg) 60%);
  border: 1px solid var(--cr-line);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 179, 71, 0.05), 0 0 60px rgba(196, 155, 255, 0.06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom left;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1), visibility 0s linear 0.24s;
}
.crawl-panel.open {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1), visibility 0s;
}
body.crawl-open .cybear-panel,
body.crawl-open .cybear-launcher,
body.crawl-open .cybear-hello { visibility: hidden; }

/* ── Header + HUD ─────────────────────── */

.crawl-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.7rem 0.6rem 1rem;
  border-bottom: 1px solid var(--cr-line);
}
.crawl-head-text { flex: 1; min-width: 0; }
.crawl-title {
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--cr-amber);
  text-shadow: 0 0 12px rgba(255, 179, 71, 0.35);
}
.crawl-title span { color: var(--cr-text); }
.crawl-sub {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--cr-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.crawl-icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--cr-text-2);
  cursor: pointer;
}
.crawl-icon-btn:hover, .crawl-icon-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.06); color: var(--cr-text); }
.crawl-icon-btn:focus-visible { outline: 2px solid var(--cr-amber); outline-offset: 1px; }
.crawl-icon-btn svg { width: 1.1rem; height: 1.1rem; }

.crawl-hud {
  display: grid;
  grid-template-columns: 1.4fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--cr-line);
  background: rgba(18, 16, 25, 0.7);
  font-size: 0.75rem;
}

.crawl-ally { display: grid; grid-template-columns: 4.6rem 1fr; gap: 0.4rem; align-items: center; color: var(--cr-text-2); }
.crawl-ally.down { opacity: 0.45; text-decoration: line-through; }

.crawl-bar { position: relative; display: block; height: 7px; border-radius: 999px; background: #241f30; overflow: hidden; }
.crawl-bar > span { display: block; height: 100%; border-radius: inherit; transition: width 0.45s cubic-bezier(0.2, 0.9, 0.3, 1); }
.crawl-bar.hp > span { background: linear-gradient(90deg, #2fbf71, var(--cr-green)); }
.crawl-bar.hp.low > span { background: linear-gradient(90deg, #c2273a, var(--cr-red)); animation: crawlPulse 1s ease-in-out infinite; }
.crawl-bar.xp > span { background: linear-gradient(90deg, #7a4cff, var(--cr-purple)); }
.crawl-bar.ally > span { background: linear-gradient(90deg, #3a8fd1, var(--cr-cyan)); }
.crawl-bar.foe > span { background: linear-gradient(90deg, #b3202f, var(--cr-red)); }
@keyframes crawlPulse { 50% { opacity: 0.55; } }

@keyframes crawlGlow { 50% { box-shadow: 0 0 20px rgba(196, 155, 255, 0.6); } }
@keyframes crawlShake { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

/* Enemies */
.crawl-foes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(255, 93, 108, 0.25);
  background: linear-gradient(180deg, rgba(255, 93, 108, 0.08), transparent);
}
.crawl-foe { flex: 1 1 8.5rem; min-width: 0; padding: 0.4rem 0.55rem; border: 1px solid rgba(255, 93, 108, 0.3); border-radius: 9px; background: rgba(9, 8, 13, 0.6); }
.crawl-foe.boss { border-color: var(--cr-amber); box-shadow: 0 0 14px rgba(255, 179, 71, 0.25); }
.crawl-foe.dead { opacity: 0.35; filter: grayscale(1); }
.crawl-foe-name { font-size: 0.78rem; font-weight: 600; margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crawl-foe-meta { margin-top: 0.25rem; font-size: 0.68rem; color: var(--cr-text-2); font-variant-numeric: tabular-nums; }
.crawl-round { align-self: center; font-family: 'VT323', monospace; font-size: 1rem; color: var(--cr-red); letter-spacing: 0.05em; }

/* ── Log ──────────────────────────────── */

.crawl-body { position: relative; flex: 1; min-height: 0; display: flex; }
.crawl-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scrollbar-width: thin;
  scrollbar-color: var(--cr-line) transparent;
}

.crawl-narr { font-size: 0.92rem; line-height: 1.62; color: var(--cr-text); }
.crawl-narr p { margin: 0 0 0.6em; color: inherit; max-width: none; }
.crawl-narr p:last-child { margin-bottom: 0; }
.crawl-narr ul, .crawl-narr ol { margin: 0.2em 0 0.6em 1.2em; }
.crawl-narr strong { color: var(--cr-amber); font-weight: 600; }
.crawl-narr em { color: #d8d2e6; }
.crawl-narr a { color: var(--cr-cyan); }
.crawl-narr.streaming > .crawl-chunk:last-child::after, .crawl-narr.streaming > .crawl-chunk:last-child > :not(:last-child)::after { content: none !important; }
.crawl-narr.streaming > :last-child:not(.crawl-chunk)::after, .crawl-narr.streaming > .crawl-chunk:last-child > p:last-child::after {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.12em;
  background: var(--cr-amber);
  animation: crawlCaret 0.9s steps(1) infinite;
}
@keyframes crawlCaret { 50% { opacity: 0; } }
.crawl-typing { color: var(--cr-text-2); font-style: italic; font-size: 0.85rem; }
.crawl-typing span { animation: crawlDot 1.2s infinite; }
.crawl-typing span:nth-child(2) { animation-delay: 0.2s; }
.crawl-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes crawlDot { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.crawl-you {
  align-self: flex-end;
  max-width: 80%;
  padding: 0.5rem 0.8rem;
  border-radius: 12px 12px 4px 12px;
  background: var(--accent-cta, #b4500e);
  color: #fff;
  font-size: 0.88rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.crawl-roll {
  display: grid;
  grid-template-columns: 2.1rem 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--cr-line);
  border-radius: 10px;
  background: var(--cr-bg-2);
  font-size: 0.78rem;
  animation: crawlIn 0.25s ease-out;
}
.crawl-roll.hostile { border-color: rgba(255, 93, 108, 0.25); }
.crawl-d20 {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  font-family: 'VT323', monospace;
  font-size: 1.25rem;
  color: #0b0a0f;
  background: var(--cr-cyan);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: crawlSpin 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.crawl-roll.hostile .crawl-d20 { background: #ff8c96; }
.crawl-roll.crit .crawl-d20 { background: var(--cr-amber); box-shadow: 0 0 16px var(--cr-amber); }
.crawl-roll.fumble .crawl-d20 { background: #5a5468; color: var(--cr-text); }
.crawl-roll-text small { color: var(--cr-text-2); font-variant-numeric: tabular-nums; }
.crawl-verdict { font-family: 'VT323', monospace; font-size: 1.1rem; letter-spacing: 0.05em; }
.crawl-roll.ok .crawl-verdict { color: var(--cr-green); }
.crawl-roll.no .crawl-verdict { color: var(--cr-red); }
.crawl-roll.hostile.ok .crawl-verdict { color: var(--cr-red); }
.crawl-roll.hostile.no .crawl-verdict { color: var(--cr-text-2); }
.crawl-roll.crit .crawl-verdict { color: var(--cr-amber); }
@keyframes crawlSpin { from { transform: rotate(-200deg) scale(0.4); } to { transform: none; } }
@keyframes crawlIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.crawl-sys {
  padding: 0.55rem 0.8rem;
  border-left: 3px solid var(--cr-amber);
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.1), transparent 80%);
  animation: crawlIn 0.3s ease-out;
}
.crawl-sys-title { font-family: 'VT323', monospace; font-size: 1.15rem; letter-spacing: 0.06em; color: var(--cr-amber); line-height: 1.1; }
.crawl-sys-text { font-size: 0.8rem; color: var(--cr-text-2); margin-top: 0.15rem; }
.crawl-sys.tone-achievement { border-color: var(--cr-purple); background: linear-gradient(90deg, rgba(196, 155, 255, 0.12), transparent 80%); }
.crawl-sys.tone-achievement .crawl-sys-title, .crawl-sys.tone-loot .crawl-sys-title { color: var(--cr-purple); }
.crawl-sys.tone-loot { border-color: var(--cr-purple); background: linear-gradient(90deg, rgba(196, 155, 255, 0.08), transparent 80%); }
.crawl-sys.tone-good { border-color: var(--cr-green); background: linear-gradient(90deg, rgba(95, 227, 154, 0.08), transparent 80%); }
.crawl-sys.tone-good .crawl-sys-title { color: var(--cr-green); }
.crawl-sys.tone-bad, .crawl-sys.tone-combat, .crawl-sys.tone-death { border-color: var(--cr-red); background: linear-gradient(90deg, rgba(255, 93, 108, 0.1), transparent 80%); }
.crawl-sys.tone-bad .crawl-sys-title, .crawl-sys.tone-combat .crawl-sys-title, .crawl-sys.tone-death .crawl-sys-title { color: var(--cr-red); }
.crawl-sys.tone-boss { border-color: var(--cr-amber); box-shadow: 0 0 24px rgba(255, 179, 71, 0.18); }
.crawl-sys.tone-level { border-color: var(--cr-cyan); background: linear-gradient(90deg, rgba(143, 211, 255, 0.1), transparent 80%); }
.crawl-sys.tone-level .crawl-sys-title { color: var(--cr-cyan); }
.crawl-sys.tone-room { border-color: #4a4458; background: none; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.crawl-sys.tone-room .crawl-sys-title { color: var(--cr-text-2); font-size: 1rem; }

/* ── Character sheet ──────────────────── */

.crawl-sheet {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(320px, 100%);
  overflow-y: auto;
  padding: 1rem;
  background: var(--cr-bg-2);
  border-left: 1px solid var(--cr-line);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.45);
  font-size: 0.82rem;
  z-index: 2;
}
.crawl-sheet h3 { font-family: 'VT323', monospace; font-size: 1.5rem; color: var(--cr-amber); margin: 0; line-height: 1; }
.crawl-sheet h4 { font-family: 'VT323', monospace; font-size: 1.05rem; letter-spacing: 0.05em; color: var(--cr-cyan); margin: 0.9rem 0 0.3rem; }
.crawl-sheet h4 small { color: var(--cr-text-2); font-family: var(--font-body, sans-serif); font-size: 0.72rem; }
.crawl-sheet p { margin: 0; color: var(--cr-text); max-width: none; }
.crawl-sheet ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.crawl-sheet li small { display: block; color: var(--cr-text-2); font-size: 0.74rem; }
.crawl-muted { color: var(--cr-text-2) !important; font-size: 0.78rem; }
.crawl-abils { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin-top: 0.7rem; }
.crawl-abil { display: flex; flex-direction: column; align-items: center; padding: 0.35rem; border: 1px solid var(--cr-line); border-radius: 8px; background: var(--cr-bg); }
.crawl-abil b { font-family: 'VT323', monospace; font-size: 0.95rem; color: var(--cr-text-2); font-weight: 400; }
.crawl-abil span { font-size: 1.05rem; font-weight: 600; }
.crawl-abil small { color: var(--cr-cyan); font-size: 0.72rem; }
.crawl-inv li { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; }
.crawl-inv li > div { flex: 1; min-width: 0; }
.crawl-pet-face { width: 96px; height: 96px; border-radius: 12px; image-rendering: pixelated; background: #130f1d; }
.crawl-sheet-head { display: flex; gap: 0.8rem; align-items: center; margin: 0.4rem 0 0.8rem; }
.crawl-plate.npc { border-color: rgba(120, 220, 160, 0.4); color: #9fe6bd; }
.crawl-plate.npc.awake { border-color: rgba(255, 210, 120, 0.6); color: var(--cr-amber); }
.crawl-shop .crawl-confirm-card { width: min(520px, 100%); max-height: 85%; overflow: auto; text-align: left; }
.crawl-shop-head { display: flex; gap: 0.7rem; align-items: center; margin-bottom: 0.6rem; }
.crawl-shop-head img { border-radius: 10px; image-rendering: pixelated; background: #130f1d; }
.crawl-shop-head { position: sticky; top: 0; z-index: 1; background: inherit; padding: 0.9rem 0 0.5rem; }
.crawl-shop .crawl-confirm-card { padding-top: 0; }
.crawl-shop-head > div:nth-child(2) { flex: 1; min-width: 0; }
.crawl-shop-gold { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.35rem 0.6rem; border: 1px solid rgba(255, 196, 70, 0.45); border-radius: 12px; background: rgba(255, 196, 70, 0.1); color: #ffc446; flex: none; }
.crawl-shop-gold img { width: 28px; height: 28px; background: none; }
.crawl-shop-gold b { font-size: 1.05rem; line-height: 1; font-variant-numeric: tabular-nums; }
.crawl-shop-gold small { font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; }
.crawl-shop-msg { color: var(--cr-amber); margin: 0.5rem 0 0; }
.crawl-shop .crawl-shelf { margin: 0.9rem 0 0.4rem; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cr-text-2); }
.crawl-shop .crawl-inv li { padding: 0.45rem; border-radius: 10px; background: rgba(255, 255, 255, 0.03); align-items: center; }
.crawl-shop .crawl-inv li.tier-2 { box-shadow: inset 3px 0 0 rgba(143, 211, 255, 0.6); }
.crawl-shop .crawl-inv li.tier-3 { box-shadow: inset 3px 0 0 rgba(255, 179, 71, 0.8); }
.crawl-shop .crawl-item-ico { width: 40px; height: 40px; }
.crawl-shop .crawl-have { display: inline; color: var(--cr-cyan); font-size: 0.72rem; }
.crawl-shop .crawl-buy { min-width: 4rem; min-height: 40px; font-weight: 700; }
.crawl-shop-foot { margin-top: 0.8rem; font-size: 0.75rem; }
@media (max-width: 640px) { .crawl-panel .crawl-confirm.crawl-shop { padding: 0; align-items: end; place-items: end stretch; } .crawl-panel .crawl-shop .crawl-confirm-card { width: 100%; max-width: none; max-height: 88%; border-radius: 16px 16px 0 0; } }
.crawl-shop .crawl-inv { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.crawl-shop .crawl-inv small { display: block; color: var(--cr-text-2); font-size: 0.78rem; line-height: 1.35; }
.crawl-shop .crawl-inv .crawl-mini { flex: none; min-width: 3.4rem; }
.crawl-mini[disabled] { opacity: 0.45; cursor: default; }
.crawl-item-ico { width: 34px; height: 34px; flex: none; border-radius: 6px; object-fit: cover; image-rendering: pixelated; background: #130f1d; }
.crawl-mini, .crawl-btn {
  flex: none;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--cr-line);
  border-radius: 7px;
  background: var(--cr-bg-3);
  color: var(--cr-text);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.crawl-mini:hover, .crawl-btn:hover { border-color: var(--cr-amber); }

/* ── Suggestions + composer ───────────── */

.crawl-suggest { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.4rem 1rem 0.55rem; }
.crawl-suggest:empty { display: none; }
.crawl-chip {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 179, 71, 0.35);
  background: rgba(255, 179, 71, 0.05);
  color: var(--cr-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.crawl-chip::before { content: '▸ '; color: var(--cr-amber); }
.crawl-chip:hover { background: rgba(255, 179, 71, 0.12); border-color: var(--cr-amber); }
.crawl-chip:focus-visible, .crawl-send:focus-visible { outline: 2px solid var(--cr-amber); outline-offset: 2px; }
.crawl-panel.busy .crawl-chip { opacity: 0.4; pointer-events: none; }

.crawl-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0 0.75rem 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.8rem;
  border: 1px solid var(--cr-line);
  border-radius: 12px;
  background: var(--cr-bg-2);
}
.crawl-form:focus-within { border-color: rgba(255, 179, 71, 0.55); }
.crawl-input {
  flex: 1;
  min-width: 0;
  max-height: 7rem;
  padding: 0.45rem 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--cr-text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
}
.crawl-input::placeholder { color: #6f6980; }
.crawl-send {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: var(--accent-cta, #b4500e);
  color: #fff;
  cursor: pointer;
}
.crawl-send.stop { background: #2e2939; }
.crawl-send svg { width: 1.05rem; height: 1.05rem; }

.crawl-foot { padding: 0 1rem 0.6rem; font-size: 0.66rem; color: #7a7489; text-align: center; }
.crawl-foot em { color: var(--cr-text-2); }
.crawl-foot button { border: 0; background: none; color: var(--cr-text-2); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.crawl-foot button:hover { color: var(--cr-amber); }

.crawl-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Death ────────────────────────────── */

.crawl-death {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(circle, rgba(60, 0, 8, 0.85), rgba(5, 0, 2, 0.95));
  animation: crawlIn 0.8s ease-out;
}
.crawl-death-card { max-width: 340px; text-align: center; }
.crawl-death-title {
  font-family: 'VT323', monospace;
  font-size: 3.4rem;
  letter-spacing: 0.12em;
  color: var(--cr-red);
  text-shadow: 0 0 24px rgba(255, 93, 108, 0.6);
  margin-bottom: 0.6rem;
}
.crawl-death-card p { margin: 0 auto 0.6rem; color: var(--cr-text); max-width: none; }
.crawl-death .crawl-btn { margin-top: 0.6rem; padding: 0.55rem 1.1rem; font-size: 0.85rem; border-color: var(--cr-red); }
.crawl-death .crawl-death-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 11rem; margin-top: 1.1rem; padding: 0.75rem 1.8rem; border-radius: 10px; background: rgba(255, 93, 108, 0.16); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.04em; }
.crawl-death .crawl-death-cta:hover, .crawl-death .crawl-death-cta:focus-visible { background: var(--cr-red); color: #fff; border-color: var(--cr-red); }
.crawl-death .crawl-death-cta:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Bear's locked-door card */
.cybear-dungeon-lock { font-size: 0.78rem; color: var(--text-secondary, #9494a3); }

/* ── Phones ───────────────────────────── */

@media (max-width: 640px) {
  .crawl-panel { left: 0; right: 0; bottom: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .crawl-hud { grid-template-columns: 1fr auto; }

  .crawl-suggest { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .crawl-chip { flex: none; white-space: nowrap; }
  .crawl-input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .crawl-panel, .crawl-bar > span { transition: none; }
  .crawl-roll, .crawl-sys, .crawl-d20, .crawl-bar.hp.low > span, .crawl-death { animation: none; }
}

/* ── Art ──────────────────────────────── */

.crawl-backdrop {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  opacity: 0;
  transition: opacity 0.8s ease, background-image 0.8s ease;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%);
}
.crawl-backdrop.on { opacity: 0.14; }
.crawl-log { position: relative; }

.crawl-scene {
  display: block;
  width: calc(100% + 1.6rem);
  height: auto;
  margin: -0.55rem -0.8rem 0.55rem -0.8rem;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  object-position: center 55%;
  border-radius: 6px 6px 0 0;
  image-rendering: pixelated;
}
.crawl-sys-row { display: flex; align-items: center; gap: 0.7rem; }
.crawl-sys-faces { display: flex; flex: none; }
.crawl-sys-face {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: cover;
  background: #000;
  image-rendering: pixelated;
}
.crawl-sys-face + .crawl-sys-face { margin-left: -10px; box-shadow: -4px 0 8px rgba(0, 0, 0, 0.5); }
.crawl-sys.tone-boss_down { border-color: var(--cr-amber); background: linear-gradient(90deg, rgba(255, 179, 71, 0.16), transparent 80%); box-shadow: 0 0 24px rgba(255, 179, 71, 0.2); }

.crawl-ally span { display: inline-flex; align-items: center; white-space: nowrap; }
.crawl-foe { display: grid; grid-template-columns: 44px 1fr; column-gap: 0.55rem; align-items: center; }
.crawl-foe-face {
  grid-row: 1 / span 3;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 93, 108, 0.35);
  image-rendering: pixelated;
}
.crawl-foe.boss .crawl-foe-face { border-color: var(--cr-amber); }

.crawl-death { background-image: radial-gradient(circle, rgba(60, 0, 8, 0.72), rgba(5, 0, 2, 0.94)), url('/img/crawl/death.webp'); background-size: cover; background-position: center; }
.crawl-foot a { color: var(--cr-text-2); text-decoration: underline; text-underline-offset: 2px; }
.crawl-foot a:hover { color: var(--cr-amber); }

/* ── Maximized (desktop) ──────────────── */

/* Full screen means full screen: edge to edge, no frame. */
.crawl-panel.max {
  left: 0;
  bottom: 0;
  width: 100vw;
  height: 100dvh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform-origin: bottom center;
  translate: none;

}
.crawl-panel.max .crawl-log { padding: 1.25rem 2rem; }
.crawl-panel.max .crawl-narr { font-size: 1rem; max-width: 72ch; }
.crawl-panel.max .crawl-scene { aspect-ratio: 16 / 5; }
.crawl-panel.max .crawl-backdrop.on { opacity: 0.2; }
.crawl-panel.max .crawl-sheet { width: 340px; }

/* ── Achievement ticker ───────────────── */

.crawl-ticker {
  position: fixed;
  left: 0;
  right: 0;
  top: 22vh;
  z-index: 10070; /* over everything, including the achievement toasts */
  pointer-events: none;
  animation: tickerIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.crawl-ticker.out { animation: tickerOut 0.45s ease-in both; }
.crawl-ticker-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(196, 155, 255, 0.35), transparent 60%);
  animation: tickerFlash 0.7s ease-out both;
}
.crawl-ticker.boss .crawl-ticker-flash { background: radial-gradient(circle at 50% 30%, rgba(255, 179, 71, 0.45), transparent 60%); }
.crawl-ticker-band {
  position: relative;
  overflow: hidden;
  padding: 0.55rem 0;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 0 12px, transparent 12px 24px),
    linear-gradient(90deg, #2a0f4d, #5b21b6 50%, #2a0f4d);
  border-top: 3px solid #ffd29a;
  border-bottom: 3px solid #ffd29a;
  box-shadow: 0 0 40px rgba(196, 155, 255, 0.55), 0 12px 40px rgba(0, 0, 0, 0.6);
  transform: rotate(-2deg) scale(1.04);
}
.crawl-ticker.boss .crawl-ticker-band { background: repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 12px, transparent 12px 24px), linear-gradient(90deg, #5a2a00, #d97706 50%, #5a2a00); }
.crawl-ticker-track {
  display: flex;
  gap: 1.6rem;
  width: max-content;
  white-space: nowrap;
  font-family: 'VT323', monospace;
  font-size: clamp(1.8rem, 4.4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 210, 154, 0.8), 3px 3px 0 #1a0833;
  animation: tickerScroll 4.6s linear both;
}
.crawl-ticker-track span { color: #ffd29a; }
.crawl-ticker-track b { font-weight: 400; color: #fff; }
.crawl-ticker-sub {
  width: fit-content;
  max-width: min(640px, 90vw);
  margin: 0.9rem auto 0;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  background: rgba(9, 8, 13, 0.92);
  border: 1px solid rgba(196, 155, 255, 0.5);
  color: #ece8f4;
  font-size: 0.95rem;
  text-align: center;
  animation: tickerSub 0.5s 0.25s ease-out both;
}
.crawl-ticker-sparks i {
  position: absolute;
  top: 1.6rem;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #ffd29a;
  box-shadow: 0 0 8px #ffd29a;
  animation: tickerSpark 1.1s ease-out both;
}
.crawl-ticker-sparks i:nth-child(odd) { background: #c49bff; box-shadow: 0 0 8px #c49bff; }
.crawl-ticker-sparks i:nth-child(1) { --dx: -38vw; --dy: -12vh; }
.crawl-ticker-sparks i:nth-child(2) { --dx: -30vw; --dy: 14vh; animation-delay: 0.05s; }
.crawl-ticker-sparks i:nth-child(3) { --dx: -22vw; --dy: -18vh; animation-delay: 0.1s; }
.crawl-ticker-sparks i:nth-child(4) { --dx: -14vw; --dy: 18vh; }
.crawl-ticker-sparks i:nth-child(5) { --dx: -6vw; --dy: -20vh; animation-delay: 0.08s; }
.crawl-ticker-sparks i:nth-child(6) { --dx: 2vw; --dy: 16vh; animation-delay: 0.12s; }
.crawl-ticker-sparks i:nth-child(7) { --dx: 9vw; --dy: -16vh; }
.crawl-ticker-sparks i:nth-child(8) { --dx: 16vw; --dy: 20vh; animation-delay: 0.06s; }
.crawl-ticker-sparks i:nth-child(9) { --dx: 23vw; --dy: -12vh; animation-delay: 0.14s; }
.crawl-ticker-sparks i:nth-child(10) { --dx: 30vw; --dy: 12vh; }
.crawl-ticker-sparks i:nth-child(11) { --dx: 37vw; --dy: -20vh; animation-delay: 0.1s; }
.crawl-ticker-sparks i:nth-child(12) { --dx: -44vw; --dy: 4vh; animation-delay: 0.04s; }
.crawl-ticker-sparks i:nth-child(13) { --dx: 44vw; --dy: 6vh; animation-delay: 0.09s; }
.crawl-ticker-sparks i:nth-child(14) { --dx: 0; --dy: 24vh; animation-delay: 0.16s; }

@keyframes tickerIn { from { opacity: 0; transform: scaleY(0.2); } to { opacity: 1; transform: none; } }
@keyframes tickerOut { to { opacity: 0; transform: translateY(-20px) scaleY(0.6); } }
@keyframes tickerFlash { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tickerScroll { from { transform: translateX(40vw); } to { transform: translateX(-60%); } }
@keyframes tickerSub { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tickerSpark {
  0% { transform: translate(0, 0) scale(1.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(180deg); opacity: 0; }
}

@media (max-width: 640px) {
  .crawl-max-btn { display: none; }
  .crawl-panel.max { width: 100%; }
  .crawl-ticker { top: 16vh; }
}

@media (prefers-reduced-motion: reduce) {
  .crawl-ticker, .crawl-ticker.out, .crawl-ticker-sub { animation: none; }
  .crawl-ticker-track { animation: none; justify-content: center; width: auto; font-size: 1.8rem; }
  .crawl-ticker-track > :nth-child(n + 4) { display: none; }
  .crawl-ticker-sparks, .crawl-ticker-flash { display: none; }
}

/* ── Loot box reveal ──────────────────── */

.crawl-loot {
  --tier: #d08a4a;
  position: fixed;
  inset: 0;
  z-index: 10065;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--tier) 22%, transparent), rgba(4, 3, 8, 0.94) 62%);
  backdrop-filter: blur(6px);
  animation: crawlIn 0.3s ease-out both;
}
.crawl-loot.tier-silver { --tier: #8fd3ff; }
.crawl-loot.tier-gold { --tier: #ffc94d; }
.crawl-loot.rarity-gear { --tier: #c49bff; }

.crawl-loot-rays {
  position: fixed;
  left: 50%;
  top: 38%;
  width: 160vmax;
  height: 160vmax;
  translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--tier) 16%, transparent) 0 8deg, transparent 8deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 45%);
          mask-image: radial-gradient(circle, #000 0%, transparent 45%);
  opacity: 0.35;
  animation: lootSpin 18s linear infinite;
  pointer-events: none;
}
.crawl-loot.revealed .crawl-loot-rays { opacity: 0.9; transition: opacity 0.4s; }

.crawl-loot-stage { position: relative; width: min(520px, 100%); text-align: center; }
.crawl-loot-kicker {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  color: var(--tier);
  text-shadow: 0 0 14px var(--tier);
}
.crawl-loot-art { position: relative; width: min(260px, 60vw); aspect-ratio: 1; margin: 0.6rem auto 0.4rem; }
.crawl-loot-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 72%);
          mask-image: radial-gradient(circle, #000 55%, transparent 72%);
}
.crawl-loot-box { animation: lootShake 0.16s linear infinite, lootHover 1.2s ease-in-out infinite alternate; filter: drop-shadow(0 0 22px var(--tier)); }
.crawl-loot.revealed .crawl-loot-box { animation: lootPop 0.35s ease-in forwards; }
.crawl-loot-item { opacity: 0; transform: scale(0.3); filter: drop-shadow(0 0 26px var(--tier)); }
.crawl-loot.revealed .crawl-loot-item { animation: lootItem 0.6s 0.15s cubic-bezier(0.2, 1.4, 0.4, 1) forwards, lootHover 2.4s 0.8s ease-in-out infinite alternate; }

.crawl-loot-burst i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: var(--tier);
  box-shadow: 0 0 10px var(--tier);
  opacity: 0;
}
.crawl-loot.revealed .crawl-loot-burst i { animation: lootBurst 0.9s ease-out forwards; }
.crawl-loot-burst i:nth-child(odd) { background: #fff; }
.crawl-loot-burst i:nth-child(1) { --a: 0deg; } .crawl-loot-burst i:nth-child(2) { --a: 22deg; }
.crawl-loot-burst i:nth-child(3) { --a: 45deg; } .crawl-loot-burst i:nth-child(4) { --a: 67deg; }
.crawl-loot-burst i:nth-child(5) { --a: 90deg; } .crawl-loot-burst i:nth-child(6) { --a: 112deg; }
.crawl-loot-burst i:nth-child(7) { --a: 135deg; } .crawl-loot-burst i:nth-child(8) { --a: 157deg; }
.crawl-loot-burst i:nth-child(9) { --a: 180deg; } .crawl-loot-burst i:nth-child(10) { --a: 202deg; }
.crawl-loot-burst i:nth-child(11) { --a: 225deg; } .crawl-loot-burst i:nth-child(12) { --a: 247deg; }
.crawl-loot-burst i:nth-child(13) { --a: 270deg; } .crawl-loot-burst i:nth-child(14) { --a: 292deg; }
.crawl-loot-burst i:nth-child(15) { --a: 315deg; } .crawl-loot-burst i:nth-child(16) { --a: 337deg; }

.crawl-loot-name {
  min-height: 2.2rem;
  font-family: 'VT323', monospace;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 16px var(--tier), 2px 2px 0 #000;
}
.crawl-loot.revealed .crawl-loot-name { animation: lootItem 0.5s 0.2s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.crawl-loot-desc { min-height: 1.2rem; margin-top: 0.3rem; color: var(--cr-text-2); font-size: 0.88rem; }
.crawl-loot-talk {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--tier) 45%, transparent);
  border-radius: 10px;
  background: rgba(9, 8, 13, 0.88);
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--cr-text);
  max-height: 34vh;
  overflow-y: auto;
}
.crawl-loot-talk p { margin: 0 0 0.5em; max-width: none; color: inherit; }
.crawl-loot-talk p:last-child { margin-bottom: 0; }
.crawl-loot-talk strong { color: var(--tier); }
.crawl-loot-ok { margin-top: 0.9rem; padding: 0.55rem 1.4rem; font-size: 0.9rem; border-color: var(--tier); }
.crawl-loot-ok:disabled { opacity: 0.4; cursor: default; }

@keyframes lootSpin { to { rotate: 360deg; } }
@keyframes lootShake { 0%, 100% { translate: 0 0; rotate: 0deg; } 25% { translate: -3px 1px; rotate: -3deg; } 75% { translate: 3px -1px; rotate: 3deg; } }
@keyframes lootHover { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
@keyframes lootPop { to { transform: scale(1.5); opacity: 0; filter: brightness(3) drop-shadow(0 0 40px var(--tier)); } }
@keyframes lootItem { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
@keyframes lootBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) translateX(0) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateX(min(42vw, 260px)) scale(0.3); }
}

@media (prefers-reduced-motion: reduce) {
  .crawl-loot-rays, .crawl-loot-box, .crawl-loot.revealed .crawl-loot-item, .crawl-loot.revealed .crawl-loot-name, .crawl-loot.revealed .crawl-loot-burst i { animation: none; }
  .crawl-loot.revealed .crawl-loot-box { opacity: 0; }
  .crawl-loot.revealed .crawl-loot-item { opacity: 1; transform: none; }
}

.crawl-narr hr, .crawl-loot-talk hr { border: 0; height: 1px; margin: 0.7rem 0; background: linear-gradient(90deg, transparent, var(--cr-line), transparent); }

/* ── Help, stat points, crawler record ── */

.crawl-help-btn { font-family: 'VT323', monospace; font-size: 1.35rem; line-height: 1; }
.crawl-help {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow-y: auto;
  padding: 1.4rem 1.6rem 1.6rem;
  background: rgba(12, 10, 18, 0.97);
  font-size: 0.9rem;
  line-height: 1.6;
}
.crawl-help > * { max-width: 62ch; margin-left: auto; margin-right: auto; }
.crawl-help h3 { font-family: 'VT323', monospace; font-size: 1.6rem; letter-spacing: 0.05em; color: var(--cr-amber); margin: 0.2rem auto 0.4rem; }
.crawl-help h3 + p { margin-top: 0; }
.crawl-help p { color: var(--cr-text); margin: 0 auto 0.8rem; }
.crawl-help ul { padding-left: 1.2rem; margin: 0 auto 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; color: var(--cr-text); }
.crawl-help b { color: #fff; }
.crawl-help a { color: var(--cr-amber); }
.crawl-help-x { position: sticky; top: 0; float: right; margin: -0.6rem -0.8rem 0 0; }

.crawl-points {
  margin: 0.6rem 0 0 !important;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: var(--cr-amber) !important;
  animation: crawlPulse 1.4s ease-in-out infinite;
}
.crawl-abil { position: relative; }
.crawl-plus {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border: 1px solid var(--cr-amber);
  border-radius: 6px;
  background: rgba(255, 179, 71, 0.12);
  color: var(--cr-amber);
  font: inherit;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.crawl-plus:hover { background: var(--cr-amber); color: #120c02; }

.crawl-record { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 0.9rem; font-size: 0.78rem; }
.crawl-record div { display: flex; justify-content: space-between; gap: 0.5rem; border-bottom: 1px dotted var(--cr-line); padding: 0.1rem 0; }
.crawl-record span { color: var(--cr-text-2); }
.crawl-record b { color: var(--cr-text); font-variant-numeric: tabular-nums; font-weight: 600; }
.crawl-record.compact { margin-top: 0.6rem; text-align: left; }
.crawl-kills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; font-size: 0.78rem; color: var(--cr-text-2); }
.crawl-kills span { display: inline-flex; align-items: center; gap: 0.2rem; }
.crawl-kills img { border-radius: 5px; image-rendering: pixelated; }
.crawl-death-card .crawl-record { max-width: 360px; margin: 0.8rem auto 0; }
.crawl-sys .crawl-record { margin-top: 0.5rem; }

/* ── Who's talking ────────────────────── */

.crawl { --who-luke: #ffae6b; --who-cybear: #ff8fbf; --who-system: #8fd3ff; }

.crawl-say {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 0.6rem;
  align-items: start;
  margin: 0.45rem 0;
  padding: 0.45rem 0.65rem 0.5rem;
  border-radius: 10px;
  background: rgba(18, 16, 25, 0.72);
  border-left: 3px solid var(--who, var(--cr-line));
}
.crawl-say.who-luke { --who: var(--who-luke); }
.crawl-say.who-cybear { --who: var(--who-cybear); }
.crawl-say.who-system { --who: var(--who-system); background: rgba(10, 24, 34, 0.75); }
.crawl-say-face { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; border: 1px solid var(--who); image-rendering: pixelated; }
.crawl-say-name { font-family: 'VT323', monospace; font-size: 1.05rem; letter-spacing: 0.05em; line-height: 1; color: var(--who); margin-bottom: 0.15rem; }
.crawl-say-text p { margin: 0; }
.crawl-say.who-system .crawl-say-text { color: #cfeaff; }
.crawl-narr > p { color: #d9d4e6; }
.crawl-panel.max .crawl-say { max-width: 72ch; }

/* ── Always-on actions ────────────────── */

.crawl-core { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.5rem 1rem 0; }
.crawl-core:empty { display: none; }

/* ── Party chat (texting) ─────────────── */

.crawl-chat-btn { position: relative; font-size: 1rem; }
.crawl-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--who-cybear); box-shadow: 0 0 6px var(--who-cybear); }
.crawl-chat {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 3;
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  background: #0d0c13;
  border-left: 1px solid var(--cr-line);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.5);
}
.crawl-chat-head { padding: 0.7rem 0.8rem 0.5rem; border-bottom: 1px solid var(--cr-line); background: #121019; }
.crawl-chat-title { font-weight: 600; font-size: 0.85rem; text-align: center; margin-bottom: 0.5rem; }
.crawl-chat-to { display: flex; justify-content: space-around; gap: 0.3rem; }
.crawl-chat-to button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.4rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--cr-text-2);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}
.crawl-chat-to button img, .crawl-group-face { border-radius: 50%; object-fit: cover; }
.crawl-chat-to button[aria-selected="true"] { color: #fff; background: rgba(90, 160, 255, 0.14); }
.crawl-chat-to button[aria-selected="true"] img, .crawl-chat-to button[aria-selected="true"] .crawl-group-face { box-shadow: 0 0 0 2px #3b82f6; }
.crawl-group-face { position: relative; display: inline-block; overflow: hidden; background: #222; }
.crawl-group-face img { position: absolute; width: 60%; height: 60%; border-radius: 50%; border: 1px solid #0d0c13; }
.crawl-group-face img:nth-child(1) { left: 0; top: 0; }
.crawl-group-face img:nth-child(2) { right: 0; top: 10%; }
.crawl-group-face img:nth-child(3) { left: 20%; bottom: 0; }

.crawl-chat-log { flex: 1; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.35rem; }
.crawl-chat-empty { margin: auto; max-width: 26ch; text-align: center; font-size: 0.78rem; color: var(--cr-text-2); }
.crawl-bubble { display: flex; gap: 0.4rem; align-items: flex-end; max-width: 86%; font-size: 0.86rem; line-height: 1.4; }
.crawl-bubble > div { padding: 0.45rem 0.7rem; border-radius: 18px; overflow-wrap: anywhere; }
.crawl-bubble.me { align-self: flex-end; }
.crawl-bubble.me > div { background: linear-gradient(180deg, #3b8bff, #2563eb); color: #fff; border-bottom-right-radius: 5px; }
.crawl-bubble.them { align-self: flex-start; }
.crawl-bubble.them > div { background: #26232f; color: var(--cr-text); border-bottom-left-radius: 5px; }
.crawl-bubble.them img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; }
.crawl-bubble.them b { display: block; font-size: 0.68rem; font-weight: 600; margin-bottom: 0.1rem; }
.crawl-bubble.who-luke b { color: var(--who-luke); }
.crawl-bubble.who-cybear b { color: var(--who-cybear); }
.crawl-bubble.who-system b { color: var(--who-system); }
.crawl-bubble.who-system > div { background: #13242f; font-family: 'VT323', monospace; font-size: 1.02rem; }
.crawl-bubble.typing span { display: inline-block; animation: crawlDot 1.2s infinite; font-size: 1.1rem; line-height: 0.6; }
.crawl-bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.crawl-bubble.typing span:nth-child(3) { animation-delay: 0.4s; }
.crawl-chat-form { display: flex; gap: 0.4rem; padding: 0.6rem; border-top: 1px solid var(--cr-line); }
.crawl-chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--cr-line);
  background: #17151f;
  color: var(--cr-text);
  font: inherit;
  font-size: 0.88rem;
  outline: 0;
}
.crawl-chat-input:focus { border-color: #3b82f6; }
.crawl-chat-send { width: 2.1rem; height: 2.1rem; border: 0; border-radius: 50%; background: #2563eb; color: #fff; display: grid; place-items: center; cursor: pointer; }
.crawl-chat-send svg { width: 1rem; height: 1rem; }
@media (max-width: 640px) { .crawl-chat { width: 100%; } .crawl-chat-input { font-size: 16px; } }

/* Loot rays stay inside the overlay (they were widening the page). */
.crawl-loot { overflow: hidden; }
.crawl-loot-rays { position: absolute; }
.crawl-loot-stage { max-height: 100%; overflow-y: auto; }

/* ── Drama: staged dice ───────────────── */

.crawl-roll { grid-template-columns: 2.1rem 1fr auto auto; }
.crawl-roll.pending .crawl-verdict, .crawl-roll.pending .crawl-roll-text small, .crawl-roll.pending .crawl-pips { visibility: hidden; }
.crawl-roll.pending .crawl-d20 { background: #3a3448; color: var(--cr-text); animation: none; }
.crawl-roll.awaiting { border-color: var(--cr-amber); box-shadow: 0 0 0 1px rgba(255, 179, 71, 0.35), 0 0 22px rgba(255, 179, 71, 0.18); }
.crawl-roll.rolling .crawl-d20 { animation: rollTumble 0.18s linear infinite; background: var(--cr-cyan); color: #0b0a0f; }
.crawl-roll.revealed .crawl-d20 { animation: rollLand 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
.crawl-roll.revealed .crawl-verdict { animation: rollLand 0.35s 0.05s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.crawl-roll-btn {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 0.35rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--cr-amber);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 179, 71, 0.22), rgba(255, 179, 71, 0.06));
  color: #fff;
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  animation: rollNudge 1.2s ease-in-out infinite;
}
.crawl-roll-btn:hover, .crawl-roll-btn:focus-visible { background: var(--cr-amber); color: #120c02; outline: none; }
.crawl-dmg { color: #ff8c96; font-weight: 600; }
.crawl-pips { display: inline-flex; align-items: center; gap: 3px; }
.crawl-pips i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--cr-line); }
.crawl-pips i.ok { background: var(--cr-green); border-color: var(--cr-green); }
.crawl-pips i.no { background: var(--cr-red); border-color: var(--cr-red); }
.crawl-pips b { color: var(--cr-text-2); margin: 0 2px; font-weight: 400; }
@keyframes rollTumble { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(0.86); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes rollLand { 0% { transform: scale(1.8); } 100% { transform: scale(1); } }
@keyframes rollNudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); box-shadow: 0 0 16px rgba(255, 179, 71, 0.45); } }

/* Crits, fumbles, getting hit */
.crawl-panel.fx-crit { animation: fxShake 0.45s linear; }
.crawl-panel.fx-crit::after, .crawl-panel.fx-hurt::after, .crawl-panel.fx-fumble::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  animation: fxFlash 0.6s ease-out forwards;
}
.crawl-panel.fx-crit::after { background: radial-gradient(circle, rgba(255, 210, 120, 0.35), transparent 70%); }
.crawl-panel.fx-hurt::after { box-shadow: inset 0 0 90px rgba(255, 40, 60, 0.55); }
.crawl-panel.fx-fumble::after { background: repeating-linear-gradient(0deg, rgba(160, 150, 190, 0.12) 0 2px, transparent 2px 5px); }
.crawl-panel.fx-fumble { animation: fxGlitch 0.4s steps(3); }
@keyframes fxShake { 0%, 100% { translate: 0 0; } 20% { translate: -6px 2px; } 40% { translate: 6px -2px; } 60% { translate: -4px 1px; } 80% { translate: 3px 0; } }
@keyframes fxGlitch { 33% { filter: hue-rotate(40deg) saturate(1.6); } 66% { filter: hue-rotate(-30deg) contrast(1.3); } }
@keyframes fxFlash { from { opacity: 1; } to { opacity: 0; } }

.crawl-sting {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 7;
  translate: -50% -50%;
  pointer-events: none;
  font-family: 'VT323', monospace;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: #ffd29a;
  text-shadow: 0 0 22px rgba(255, 179, 71, 0.9), 4px 4px 0 #2a0f00;
  animation: stingIn 1.3s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
.crawl-sting.fumble { color: #c9c2dc; text-shadow: 0 0 12px rgba(160, 150, 190, 0.7), 3px 3px 0 #111; }
@keyframes stingIn { 0% { opacity: 0; scale: 2.2; } 18% { opacity: 1; scale: 1; } 75% { opacity: 1; } 100% { opacity: 0; scale: 0.9; translate: -50% -70%; } }

/* Floating damage and heal numbers */
.crawl-foe, .crawl-hud-me, .crawl-ally { position: relative; }
.crawl-pop {
  position: absolute;
  right: 10%;
  top: -4px;
  z-index: 2;
  pointer-events: none;
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  animation: popUp 1.15s ease-out forwards;
}
.crawl-pop.dmg { color: #ff5d6c; text-shadow: 2px 2px 0 #2a0008; }
.crawl-pop.heal { color: #5fe39a; text-shadow: 2px 2px 0 #00240f; }
.crawl-foe.flash { animation: chipFlash 0.5s ease-out; }
@keyframes popUp { 0% { opacity: 0; transform: translateY(8px) scale(0.6); } 20% { opacity: 1; transform: translateY(-4px) scale(1.2); } 100% { opacity: 0; transform: translateY(-26px) scale(1); } }
@keyframes chipFlash { 0% { background: rgba(255, 93, 108, 0.45); } 100% { background: rgba(9, 8, 13, 0.6); } }

/* Fight splash */
.crawl-splash {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: radial-gradient(circle at 50% 45%, rgba(120, 10, 25, 0.55), rgba(5, 3, 8, 0.93) 65%);
  animation: crawlIn 0.2s ease-out both;
  pointer-events: none;
}
.crawl-splash.boss { background: radial-gradient(circle at 50% 45%, rgba(160, 90, 0, 0.55), rgba(5, 3, 8, 0.95) 65%); }
.crawl-splash.out { animation: fxFlash 0.26s ease-in forwards; }
.crawl-splash-faces { display: flex; gap: 0.8rem; }
.crawl-splash-faces img {
  width: min(150px, 26vw);
  height: min(150px, 26vw);
  border-radius: 14px;
  border: 2px solid #ff5d6c;
  object-fit: cover;
  image-rendering: pixelated;
  box-shadow: 0 0 40px rgba(255, 93, 108, 0.5);
  animation: slamIn 0.45s calc(var(--i) * 0.12s) cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.crawl-splash.boss .crawl-splash-faces img { width: min(240px, 44vw); height: min(240px, 44vw); border-color: #ffc94d; box-shadow: 0 0 60px rgba(255, 201, 77, 0.55); }
.crawl-splash-title {
  font-family: 'VT323', monospace;
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 93, 108, 0.9), 4px 4px 0 #300008;
  animation: slamIn 0.5s 0.3s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.crawl-splash.boss .crawl-splash-title { text-shadow: 0 0 26px rgba(255, 201, 77, 0.95), 4px 4px 0 #3a2000; }
.crawl-splash-sub { font-family: 'VT323', monospace; font-size: 1.4rem; letter-spacing: 0.08em; color: var(--cr-amber); animation: crawlIn 0.4s 0.55s both; }
@keyframes slamIn { from { opacity: 0; transform: scale(2.4) rotate(-6deg); } to { opacity: 1; transform: none; } }

.crawl-toggle { display: flex; align-items: center; gap: 0.5rem; margin: 0 auto 1.2rem; color: var(--cr-text); font-size: 0.85rem; cursor: pointer; }
.crawl-toggle input { accent-color: #ffb347; width: 1rem; height: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .crawl-roll-btn, .crawl-pop, .crawl-sting { animation: none; }
}

/* ── Tool rail (sheet + chat) in the story area's top-right ── */

.crawl-log { padding-right: 4.4rem; }
.crawl-rail {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.crawl-rail-btn {
  position: relative;
  width: 3.2rem;
  padding: 0.45rem 0 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid var(--cr-line);
  border-radius: 12px;
  background: rgba(18, 16, 25, 0.88);
  backdrop-filter: blur(4px);
  color: var(--cr-text-2);
  font: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.crawl-rail-btn svg { width: 1.15rem; height: 1.15rem; }
.crawl-rail-btn b { font-size: 1.05rem; line-height: 1.1; font-weight: 400; }
.crawl-rail-btn:hover { color: var(--cr-text); border-color: var(--cr-amber); }
.crawl-rail-btn[aria-expanded="true"] { color: #fff; border-color: var(--cr-amber); background: rgba(255, 179, 71, 0.14); }
.crawl-rail-btn:focus-visible { outline: 2px solid var(--cr-amber); outline-offset: 2px; }
.crawl-rail-btn .crawl-dot { top: 4px; right: 6px; }
.crawl-rail-btn .sheet-dot { background: var(--cr-amber); box-shadow: 0 0 6px var(--cr-amber); }

/* Overlays open beside the rail, each with its own bar and ✕ */
.crawl-sheet, .crawl-chat { right: 4.4rem; border-right: 1px solid var(--cr-line); }
.crawl-help { right: 4.4rem; }
.crawl-overlay-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: -1rem -1rem 0.8rem;
  padding: 0.45rem 0.4rem 0.45rem 1rem;
  border-bottom: 1px solid var(--cr-line);
  background: inherit;
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--cr-text-2);
}
.crawl-sheet .crawl-overlay-bar { background: var(--cr-bg-2); }
.crawl-help .crawl-overlay-bar { margin: -1.4rem -1.6rem 1rem; padding-left: 1.6rem; background: rgba(12, 10, 18, 0.98); max-width: none; }
.crawl-chat-head .crawl-overlay-bar { margin: -0.7rem -0.8rem 0.5rem; padding-left: 0.8rem; background: #121019; }
.crawl-chat-head .crawl-chat-title { margin: 0; font-family: var(--font-body, Inter, sans-serif); font-size: 0.85rem; font-weight: 600; letter-spacing: 0; color: var(--cr-text); }
.crawl-overlay-x { width: 2rem; height: 2rem; }
.crawl-help-x { position: static; float: none; margin: 0; }
.crawl-sheet.spending .crawl-plus { opacity: 0.35; pointer-events: none; }

@media (max-width: 640px) {
  .crawl-log { padding-right: 3.8rem; }
  .crawl-rail { top: 0.4rem; right: 0.4rem; }
  .crawl-rail-btn { width: 2.8rem; }
  .crawl-sheet, .crawl-chat, .crawl-help { right: 0; width: 100%; z-index: 5; }
}

/* ── Scrollbars that match the dungeon ── */

.crawl, .crawl * { scrollbar-width: thin; scrollbar-color: #4a3d66 transparent; }
.crawl ::-webkit-scrollbar { width: 9px; height: 9px; }
.crawl ::-webkit-scrollbar-track { background: transparent; }
.crawl ::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, #6b4fa3, #3d2f5c) padding-box;
}
.crawl ::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ffb347, #b4500e) padding-box; }
.crawl ::-webkit-scrollbar-corner { background: transparent; }

/* ── One actions row: story suggestions + icon basics ── */

.crawl-actions { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 1rem 0.55rem; }
.crawl-actions .crawl-suggest { flex: 1; min-width: 0; padding: 0; }
.crawl-actions .crawl-core { flex: none; padding: 0; gap: 0.25rem; flex-wrap: nowrap; margin-left: auto; }
.crawl-actions .crawl-core:not(:empty) { padding-left: 0.6rem; border-left: 1px solid var(--cr-line); }

@media (max-width: 640px) {
  .crawl-actions { flex-direction: column-reverse; align-items: stretch; gap: 0.35rem; }
  .crawl-actions .crawl-core { margin-left: 0; justify-content: flex-start; }
  .crawl-actions .crawl-core:not(:empty) { padding-left: 0; border-left: 0; }
}

/* ── Voice input ── */

.crawl-mic, .crawl-chat-mic {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cr-line);
  border-radius: 10px;
  background: transparent;
  color: var(--cr-text-2);
  cursor: pointer;
}
.crawl-chat-mic { width: 2.1rem; height: 2.1rem; border-radius: 50%; }
.crawl-mic svg { width: 1.05rem; height: 1.05rem; }
.crawl-mic:hover { color: var(--cr-text); border-color: var(--cr-amber); }
.crawl-mic.listening { color: #fff; background: #c2273a; border-color: #ff5d6c; animation: micPulse 1s ease-in-out infinite; }
@keyframes micPulse { 50% { box-shadow: 0 0 0 6px rgba(255, 93, 108, 0.25); } }

/* ── Reset confirmation ── */

.crawl-confirm {
  position: absolute;
  inset: 0;
  z-index: 60; /* above the drawers (30), since it can open from the character sheet */
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(5, 3, 8, 0.82);
  backdrop-filter: blur(4px);
  animation: crawlIn 0.2s ease-out;
}
.crawl-confirm-card {
  width: min(420px, 100%);
  padding: 1.3rem 1.4rem;
  border: 1px solid rgba(255, 93, 108, 0.5);
  border-radius: 14px;
  background: var(--cr-bg-2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.crawl-confirm-title { font-family: 'VT323', monospace; font-size: 1.8rem; letter-spacing: 0.06em; color: var(--cr-red); margin-bottom: 0.5rem; line-height: 1; }
.crawl-confirm-card p { margin: 0 0 0.7rem; color: var(--cr-text); font-size: 0.9rem; max-width: none; }
.crawl-confirm-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.crawl-btn.keep { border-color: var(--cr-green); }
.crawl-btn.danger { border-color: var(--cr-red); color: #ffb3bb; }
.crawl-btn.danger:hover { background: var(--cr-red); color: #fff; }

/* Sticky overlay bars sit flush with the top (the containers' padding left a gap). */
.crawl-sheet .crawl-overlay-bar { top: -1rem; }
.crawl-help .crawl-overlay-bar { top: -1.4rem; }

/* ── HUD strip v2: me · party · tools ── */

.crawl-hudbar {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto;
  grid-template-areas: "me party rail";
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem 0.8rem 0.55rem 1rem;
  border-bottom: 1px solid var(--cr-line);
  background: rgba(18, 16, 25, 0.72);
}
.crawl-hud { display: contents; }
.crawl-hud-me { grid-area: me; min-width: 0; }

.crawl-hudbar .crawl-rail { grid-area: rail; position: static; flex-direction: row; gap: 0.35rem; }

.crawl-ally { grid-template-columns: 5.2rem 1fr; }
.crawl-rail-btn { width: 2.7rem; padding: 0.35rem 0 0.3rem; font-size: 0.56rem; }
/* The rail no longer covers the story */
.crawl-log { padding-right: 1rem; }
.crawl-panel.max .crawl-log { padding: 1.25rem 2rem; }
.crawl-sheet, .crawl-chat, .crawl-help { right: 0; }

@media (max-width: 640px) {
  .crawl-hudbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "me me" "party rail"; gap: 0.45rem 0.6rem; padding: 0.5rem 0.7rem; }

  .crawl-rail-btn span:not(.crawl-dot) { display: none; }
  .crawl-rail-btn { width: 2.2rem; height: 2.2rem; padding: 0; justify-content: center; }
  .crawl-log { padding-right: 0.9rem; }
}

/* ── Continue / auto ── */

.crawl-continue {
  display: grid;
  grid-template-rows: 0fr;
  justify-items: center;
  opacity: 0;
  transition: grid-template-rows 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
  cursor: pointer;
}
.crawl-continue > div { min-height: 0; overflow: hidden; padding: 0 1rem; display: flex; justify-content: center; }
.crawl-continue.show { grid-template-rows: 1fr; opacity: 1; }
.crawl-continue-text {
  display: inline-block;
  margin: 0.35rem 0 0.1rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  scale: 0.92;
  transition: scale 0.28s cubic-bezier(0.2, 1.3, 0.4, 1);
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 71, 0.35);
  background: rgba(9, 8, 13, 0.88);
  color: var(--cr-amber);
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  animation: continuePulse 1.6s ease-in-out infinite;
}
.crawl-continue.show .crawl-continue-text { scale: 1; }
@keyframes continuePulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
.crawl-body { cursor: default; }
.crawl-log { padding-bottom: 1rem; }
.crawl-chunk { animation: chunkIn 0.6s ease-out both; }
@keyframes chunkIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.crawl-chunk + .crawl-chunk { margin-top: 0.6em; }
.crawl-chunk > p { margin: 0; }

.crawl-auto {
  flex: none;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--cr-line);
  background: transparent;
  color: var(--cr-text-2);
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}
.crawl-auto:hover { color: var(--cr-text); border-color: var(--cr-cyan); }
.crawl-auto.on { color: #0b0a0f; background: var(--cr-cyan); border-color: var(--cr-cyan); }
.crawl-panel.busy .crawl-auto { opacity: 1; pointer-events: auto; }

/* Scenes fade in like a cut */
.crawl-sys.cinematic .crawl-scene { opacity: 0; filter: brightness(0.3) blur(4px); transform: scale(1.04); transition: opacity 0.9s ease, filter 1.1s ease, transform 1.6s ease; }
.crawl-sys.cinematic.in .crawl-scene { opacity: 1; filter: none; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .crawl-chunk { animation: none; opacity: 1; }
  .crawl-continue-text { animation: none; }
  .crawl-sys.cinematic .crawl-scene { transition: none; }
}

/* Phones: suggestions, Auto and the basics share one horizontally scrolling strip. */
@media (max-width: 640px) {
  .crawl-actions { flex-direction: row; align-items: center; overflow-x: auto; scrollbar-width: none; gap: 0.4rem; padding: 0.4rem 0.7rem 0.5rem; }
  .crawl-actions::-webkit-scrollbar { display: none; }
  .crawl-actions .crawl-suggest { flex: none; flex-wrap: nowrap; overflow: visible; }
  .crawl-actions .crawl-core { flex: none; margin-left: 0; padding-left: 0.4rem; border-left: 1px solid var(--cr-line); }
  .crawl-actions .crawl-core:not(:empty) { padding-left: 0.4rem; border-left: 1px solid var(--cr-line); }
  .crawl-auto { flex: none; }
}

/* Speaker arrivals + typing + ally sheets */
.crawl-say.arriving { animation: crawl-say-in .38s cubic-bezier(.2,.8,.2,1) both; }
@keyframes crawl-say-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.crawl-say-dots { display: inline-flex; gap: 3px; opacity: .75; }
.crawl-say-dots span { animation: crawl-dot 1s infinite ease-in-out; }
.crawl-say-dots span:nth-child(2) { animation-delay: .15s; }
.crawl-say-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes crawl-dot { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.crawl-say-text.fade-words { animation: crawl-words .45s ease both; }
@keyframes crawl-words { from { opacity: 0; filter: blur(2px); } to { opacity: 1; filter: none; } }
button.crawl-ally { all: unset; box-sizing: border-box; display: grid; cursor: pointer; border-radius: 6px; }
button.crawl-ally:hover { background: rgba(255,255,255,.05); }
button.crawl-ally:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.crawl-ally small { opacity: .6; font-weight: 500; }
.crawl-ally-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.crawl-ally-head img { border-radius: 10px; object-fit: cover; }
.crawl-ally-head h3 { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .crawl-say.arriving, .crawl-say-text.fade-words, .crawl-say-dots span { animation: none; }
}

/* Loot talk: no inner window, just the cast fading out at the edges. */
.crawl-loot-stage { overflow-x: hidden; scrollbar-width: none; }
.crawl-loot-stage::-webkit-scrollbar { display: none; }
.crawl-loot-talk {
  border: 0;
  border-radius: 0;
  background: none;
  padding: 1.4rem 0.25rem 1rem;
  max-height: 38vh;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 2.2rem, #000 calc(100% - 1.2rem), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 2.2rem, #000 calc(100% - 1.2rem), transparent 100%);
}
.crawl-loot-talk::-webkit-scrollbar { display: none; }
.crawl-loot-talk .crawl-chunk + .crawl-chunk { margin-top: 0.5rem; }

/* ── Scale-ins: nothing should just pop ── */
@keyframes crawlScaleIn { from { opacity: 0; transform: scale(0.86) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes crawlScaleOut { to { opacity: 0; transform: scale(0.9); } }
@keyframes crawlRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes crawlSlideIn { from { opacity: 0; transform: translateX(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.crawl-chip { animation: crawlScaleIn 0.42s cubic-bezier(0.2, 1.25, 0.4, 1) both; animation-delay: calc(var(--i, 0) * 95ms); transition: opacity 0.2s ease, background 0.15s, border-color 0.15s; }
.crawl-chip.leaving { animation: crawlScaleOut 0.18s ease-in forwards; pointer-events: none; }
.crawl-panel.open .crawl-form { animation: crawlRise 0.4s 0.15s ease-out both; }
.crawl-panel.open .crawl-actions { animation: crawlRise 0.4s 0.08s ease-out both; }
.crawl-send svg { transition: transform 0.2s ease; }
.crawl-send.stop svg { animation: crawlScaleIn 0.25s ease-out; }
.crawl-foes:not([hidden]) { animation: crawlRise 0.35s ease-out both; }
.crawl-sheet:not([hidden]), .crawl-help:not([hidden]), .crawl-chat:not([hidden]) { animation: crawlSlideIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.crawl-you, .crawl-roll, .crawl-sys:not(.cinematic) { animation: crawlScaleIn 0.3s cubic-bezier(0.2, 1.2, 0.4, 1) both; transform-origin: left center; }
.crawl-you { transform-origin: right center; }
.crawl-death:not([hidden]) { animation: crawlRise 0.5s ease-out both; }
.crawl-ally { transition: opacity 0.2s ease; }
@media (prefers-reduced-motion: reduce) {
  .crawl-chip, .crawl-panel.open .crawl-form, .crawl-panel.open .crawl-actions, .crawl-foes, .crawl-sheet, .crawl-help, .crawl-chat, .crawl-you, .crawl-roll, .crawl-sys, .crawl-death { animation: none !important; }
  .crawl-continue { transition: none; }
}

/* No-shift guard: reserved space the story grows into instead of being dragged down. */
.crawl-log::after { content: ""; flex: none; height: var(--hold, 0px); margin-top: -0.7rem; pointer-events: none; }
.crawl-say.arriving { animation-duration: 0.5s; }
.crawl-say-text.fade-words { animation-duration: 0.6s; }
.crawl-chip.leaving { animation-duration: 0.26s; }

/* "typing" state: the model is still writing; nothing to tap. */
.crawl-continue.waiting { cursor: default; }
.crawl-continue.waiting .crawl-continue-text { color: var(--cr-text-2); border-color: var(--cr-line); animation: none; }
.crawl-continue.waiting .crawl-continue-text::after { content: '…'; display: inline-block; width: 1.1em; text-align: left; animation: crawlEllipsis 1.2s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes crawlEllipsis { from { width: 0; } to { width: 1.1em; } }

/* ── Registration terminal ── */
.crawl-reg {
  position: absolute; inset: 0; z-index: 9;
  display: grid; place-items: center; padding: 1rem;
  background: rgba(5, 3, 8, 0.86); backdrop-filter: blur(5px);
  animation: crawlIn 0.3s ease-out;
}
.crawl-reg-card {
  width: min(640px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  border: 1px solid rgba(143, 211, 255, 0.35); border-radius: 14px;
  background: linear-gradient(180deg, #0d1420, var(--cr-bg-2) 40%);
  box-shadow: 0 0 0 1px rgba(143, 211, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(143, 211, 255, 0.05);
  animation: crawlScaleIn 0.4s cubic-bezier(0.2, 1.1, 0.4, 1) both;
}
.crawl-reg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1rem 1.1rem 0.4rem; }
.crawl-reg-kicker { font-family: 'VT323', monospace; font-size: 0.95rem; letter-spacing: 0.12em; color: var(--cr-cyan); opacity: 0.8; }
.crawl-reg-title { font-family: 'VT323', monospace; font-size: 1.7rem; line-height: 1.1; color: var(--cr-amber); text-shadow: 0 0 12px rgba(255, 179, 71, 0.35); }
.crawl-reg-body { padding: 0.3rem 1.1rem 0.8rem; overflow-y: auto; }
.crawl-reg-note { margin: 0 0 0.8rem; color: var(--cr-text-2); font-size: 0.88rem; }
.crawl-reg-note.warn { margin-top: 0.7rem; color: var(--cr-amber); }
.crawl-reg-name {
  box-sizing: border-box; width: 100%; padding: 0.75rem 0.9rem; border-radius: 10px;
  border: 1px solid rgba(143, 211, 255, 0.4); background: #070a10; color: var(--cr-text);
  font-family: 'VT323', monospace; font-size: 1.6rem; letter-spacing: 0.04em;
}
.crawl-reg-name:focus { outline: 2px solid var(--cr-cyan); outline-offset: 2px; }
.crawl-reg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.crawl-reg-opt {
  display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto 1fr; column-gap: 0.7rem; align-items: start;
  padding: 0.6rem; text-align: left; cursor: pointer;
  border: 1px solid var(--cr-line); border-radius: 10px; background: var(--cr-bg-3); color: var(--cr-text); font: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.crawl-reg-opt img { grid-row: 1 / span 3; width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #000; }
.crawl-reg-opt b { font-size: 0.95rem; }
.crawl-reg-opt small { display: block; font-size: 0.74rem; color: var(--cr-text-2); line-height: 1.35; }
.crawl-reg-opt:hover { border-color: rgba(143, 211, 255, 0.5); transform: translateY(-1px); }
.crawl-reg-opt.on { border-color: var(--cr-amber); background: rgba(255, 179, 71, 0.08); box-shadow: 0 0 0 1px var(--cr-amber) inset; }
.crawl-reg-opt:focus-visible, .crawl-reg-pic:focus-visible { outline: 2px solid var(--cr-cyan); outline-offset: 2px; }
.crawl-reg-portraits { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.crawl-reg-pic { padding: 0; border: 2px solid var(--cr-line); border-radius: 12px; background: #000; cursor: pointer; overflow: hidden; transition: border-color 0.15s, transform 0.15s; animation: crawlScaleIn 0.35s ease-out both; }
.crawl-reg-pic img { display: block; width: 120px; height: 120px; object-fit: cover; }
.crawl-reg-pic.on { border-color: var(--cr-amber); box-shadow: 0 0 18px rgba(255, 179, 71, 0.35); transform: scale(1.03); }
.crawl-reg-gen { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px dashed var(--cr-line); }
.crawl-reg-gen label { display: block; margin-bottom: 0.4rem; font-size: 0.82rem; color: var(--cr-text-2); }
.crawl-reg-gen-row { display: flex; gap: 0.5rem; }
.crawl-reg-gen-row input { flex: 1; min-width: 0; padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--cr-line); background: #070a10; color: var(--cr-text); font: inherit; font-size: 16px; }
.crawl-reg-status { min-height: 1.2em; margin: 0.4rem 0 0; font-size: 0.82rem; color: var(--cr-cyan); }
.crawl-reg-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.7rem 1.1rem 1rem; border-top: 1px solid var(--cr-line); }
.crawl-reg-next { border-color: var(--cr-amber); color: var(--cr-amber); min-width: 7rem; }
.crawl-reg-next:disabled { opacity: 0.4; cursor: default; }
.crawl-reg-back[hidden] { display: inline-block !important; visibility: hidden; }
.crawl-reg-dots { display: flex; gap: 0.35rem; }
.crawl-reg-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--cr-line); transition: background 0.2s; }
.crawl-reg-dots i.on { background: var(--cr-cyan); box-shadow: 0 0 6px var(--cr-cyan); }

.crawl-sheet-me { display: flex; align-items: center; gap: 0.8rem; }
.crawl-sheet-me h3 { margin: 0; }
.crawl-sheet-face { position: relative; padding: 0; border: 1px solid var(--cr-line); border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; }
.crawl-sheet-face img { display: block; width: 72px; height: 72px; object-fit: cover; }
.crawl-sheet-face span { position: absolute; inset: auto 0 0; padding: 0.1rem 0; font-size: 0.65rem; text-align: center; background: rgba(0, 0, 0, 0.7); color: var(--cr-text); opacity: 0; transition: opacity 0.15s; }
.crawl-sheet-face:hover span, .crawl-sheet-face:focus-visible span { opacity: 1; }
@media (max-width: 560px) {
  .crawl-reg { padding: 0.5rem; align-items: end; }
  .crawl-reg-grid { grid-template-columns: 1fr; }
  .crawl-reg-opt { grid-template-columns: 52px 1fr; }
  .crawl-reg-opt img { width: 52px; height: 52px; }
  .crawl-reg-pic img { width: 96px; height: 96px; }
}
@media (prefers-reduced-motion: reduce) { .crawl-reg, .crawl-reg-card, .crawl-reg-pic { animation: none; } }
.crawl-reg-opt { display: flex; gap: 0.7rem; align-items: flex-start; }
.crawl-reg-opt img { flex: none; }
.crawl-reg-opt-text { display: grid; gap: 0.15rem; min-width: 0; }
.crawl-say.who-npc { border-left-color: var(--cr-green); }
.crawl-say.who-npc .crawl-say-name { color: var(--cr-green); }
.crawl-ally.guest { cursor: default; }

/* ── Pacing toggles + docked hint (batch A) ── */
.crawl-autos { display: flex; gap: 0.25rem; flex: none; }
.crawl-auto-btn {
  width: 2rem; height: 2rem; padding: 0; display: grid; place-items: center; flex: none;
  border-radius: 8px; border: 1px solid var(--cr-line); background: transparent; color: var(--cr-text-2); cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.crawl-auto-btn svg { width: 1rem; height: 1rem; }
.crawl-auto-btn:hover { color: var(--cr-text); border-color: var(--cr-cyan); }
.crawl-auto-btn.on { color: #0b0a0f; background: var(--cr-cyan); border-color: var(--cr-cyan); }
.crawl-auto-btn:focus-visible { outline: 2px solid var(--cr-cyan); outline-offset: 2px; }
.crawl-panel.busy .crawl-auto-btn { opacity: 1; pointer-events: auto; }
.crawl-actions .crawl-continue {
  display: flex; align-items: center; flex: none; grid-template-rows: none;
  min-width: 0; max-width: 14rem; padding: 0 0.2rem;
  opacity: 0; transition: opacity 0.35s ease; cursor: pointer;
}
.crawl-actions .crawl-continue.show { opacity: 1; }
.crawl-actions .crawl-continue-text {
  margin: 0; padding: 0; border: 0; background: none; box-shadow: none; scale: 1;
  font-family: 'VT323', monospace; font-size: 1rem; letter-spacing: 0.04em; color: var(--cr-amber);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crawl-actions .crawl-continue.waiting .crawl-continue-text { color: var(--cr-text-2); }

/* Character shots: whole 3:2 frame, a little narrower than the log. */
.crawl-sys.has-cast { max-width: 720px; }
.crawl-scene.cast { aspect-ratio: 3 / 2; object-position: center; }
.crawl-panel.max .crawl-scene.cast { aspect-ratio: 3 / 2; }

/* Bigger portraits in the terminal */
.crawl-reg-card { width: min(720px, 100%); }
.crawl-reg-portraits { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
.crawl-reg-pic img { width: 100%; height: auto; aspect-ratio: 1; }
.crawl-reg-opt img { width: 88px; height: 88px; }
@media (max-width: 560px) {
  .crawl-reg-portraits { grid-template-columns: repeat(2, 1fr); }
  .crawl-reg-opt img { width: 60px; height: 60px; }
  .crawl-actions .crawl-continue { max-width: 9rem; }
}

/* Generated (Blob) art is real pixel art: keep the pixels square when scaled. */
img[src*="blob.vercel-storage.com"] { image-rendering: pixelated; }

/* ── DMs and nudges (batch C) ── */
.crawl-dm, .crawl-widget {
  display: flex; align-items: center; gap: 0.7rem; max-width: 560px;
  padding: 0.6rem 0.75rem; border-radius: 12px;
  border: 1px solid var(--cr-line); background: var(--cr-bg-3);
  animation: crawlScaleIn 0.4s cubic-bezier(0.2, 1.2, 0.4, 1) both; transform-origin: left center;
}
.crawl-dm { border-color: rgba(37, 99, 235, 0.55); background: linear-gradient(90deg, rgba(37, 99, 235, 0.14), var(--cr-bg-3) 70%); }
.crawl-dm-face { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.crawl-dm-body { flex: 1; min-width: 0; }
.crawl-dm-kicker { font-family: 'VT323', monospace; font-size: 0.95rem; letter-spacing: 0.05em; color: #8fb8ff; }
.crawl-dm-text { font-size: 0.86rem; color: var(--cr-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crawl-dm.fresh .crawl-dm-kicker::after { content: ' · new'; color: var(--cr-amber); }
.crawl-widget { flex-wrap: wrap; border-color: rgba(255, 179, 71, 0.4); background: linear-gradient(90deg, rgba(255, 179, 71, 0.1), var(--cr-bg-3) 70%); }
.crawl-widget.done { animation: crawlScaleOut 0.25s ease-in forwards; }
.crawl-widget-main { display: flex; align-items: center; gap: 0.65rem; flex: 1; min-width: 12rem; }
.crawl-widget-main img { width: 40px; height: 40px; object-fit: contain; flex: none; filter: drop-shadow(0 0 8px rgba(255, 179, 71, 0.5)); }
.crawl-widget-main b { display: block; font-size: 0.9rem; }
.crawl-widget-main small { display: block; font-size: 0.76rem; color: var(--cr-text-2); }
.crawl-widget-star { font-size: 1.6rem; color: var(--cr-amber); text-shadow: 0 0 10px rgba(255, 179, 71, 0.6); width: 40px; text-align: center; }
.crawl-widget-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.crawl-mini.primary { border-color: var(--cr-amber); color: var(--cr-amber); }
.crawl-rail-btn.ping { animation: crawlPing 0.7s ease-in-out 3; }
@keyframes crawlPing { 0%, 100% { transform: none; } 20% { transform: rotate(-12deg) scale(1.1); } 40% { transform: rotate(10deg) scale(1.1); } 60% { transform: rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .crawl-dm, .crawl-widget, .crawl-rail-btn.ping { animation: none; } }
.crawl-chat-status { margin: 0.2rem auto 0.4rem; max-width: 85%; text-align: center; font-size: 0.72rem; color: var(--cr-text-2); font-style: italic; opacity: 0.85; animation: crawlScaleIn 0.3s ease-out both; }

/* ── Stage: the scene across the top, header + HUD overlaid (WoW-style top HUD) ── */
.crawl-panel { --stage-h: 188px; }
.crawl-panel.max { --stage-h: clamp(210px, 30vh, 340px); }
.crawl-stage { display: flex; flex-direction: column; justify-content: space-between; min-height: var(--stage-h); flex: none; }
.crawl-stage > .crawl-head, .crawl-stage > .crawl-hudbar { position: relative; z-index: 2; }
.crawl-stage-art {
  position: absolute; left: 0; right: 0; top: 0; height: calc(var(--stage-h) + 72px);
  z-index: 0; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 130px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 130px), transparent 100%);
}
.crawl-stage-art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 55%;
  opacity: 0; transition: opacity 1.1s ease;
}
.crawl-stage-art img.on { opacity: 1; }
.crawl-stage-art img.from-black { transition: opacity 2.6s cubic-bezier(0.4, 0, 0.2, 1), transform 6s ease-out; transform: scale(1.04); }
.crawl-stage-art img.from-black.on { transform: none; }
/* Scrims keep the header and HUD readable over any art. */
.crawl-stage-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(9, 8, 13, 0.82) 0%, rgba(9, 8, 13, 0.1) 28%, rgba(9, 8, 13, 0.05) 50%, rgba(9, 8, 13, 0.62) 78%, rgba(9, 8, 13, 0.2) 100%);
}
.crawl-stage .crawl-head { border-bottom: 0; background: none; }
.crawl-stage .crawl-title, .crawl-stage .crawl-sub { text-shadow: 0 1px 3px #000, 0 0 12px rgba(0, 0, 0, 0.8); }
.crawl-stage .crawl-hudbar {
  border-bottom: 0; background: none;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr) minmax(0, 220px) auto;
  grid-template-areas: "me . party rail";
  padding-top: 0.4rem; padding-bottom: 0.6rem;
  text-shadow: 0 1px 2px #000;
}

.crawl-stage .crawl-ally { grid-template-columns: 4.6rem 1fr; }
.crawl-stage .crawl-bar { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.crawl-stage .crawl-rail-btn { background: rgba(9, 8, 13, 0.55); backdrop-filter: blur(3px); }
.crawl-stage .crawl-icon-btn { background: rgba(9, 8, 13, 0.4); }
/* The story sits on top of the stage's fade; the old faint backdrop is retired. */
.crawl-foes, .crawl-body { position: relative; z-index: 1; }
.crawl-backdrop { display: none; }
/* Scene cards in the story: compact, with a thumbnail (the stage shows the big version). */
.crawl-sys-thumb { width: 72px; height: 40px; flex: none; object-fit: cover; border-radius: 6px; border: 1px solid var(--cr-line); }
.crawl-sys.tone-loot .crawl-sys-face { width: 56px; height: 56px; }
@media (max-height: 720px) { .crawl-panel, .crawl-panel.max { --stage-h: 150px; } }
@media (max-width: 640px) {
  .crawl-panel, .crawl-panel.max { --stage-h: 176px; }
  .crawl-stage .crawl-hudbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "me me" "party rail"; }
  .crawl-stage .crawl-ally { grid-template-columns: auto 1fr; }
}
@media (prefers-reduced-motion: reduce) { .crawl-stage-art img, .crawl-stage-art img.from-black { transition: none; transform: none; } }

/* ── Unit frames (WoW-style): you on top, the party stacked below ── */
.crawl-stage .crawl-head { padding-bottom: 0.2rem; }
.crawl-stage .crawl-head-text { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.crawl-stage .crawl-title { font-size: 1.15rem; opacity: 0.9; }
.crawl-stage .crawl-hudbar {
  grid-template-columns: minmax(0, 290px) minmax(0, 1fr) auto;
  grid-template-areas: "frames . rail";
  align-items: start; padding: 0.15rem 0.8rem 0.7rem;
}
.crawl-frames { grid-area: frames; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.crawl-stage .crawl-frame, .crawl-stage button.crawl-frame {
  all: unset; box-sizing: border-box;
  display: flex; align-items: center; gap: 0.55rem; min-width: 0; color: var(--cr-text);
}
.crawl-stage button.crawl-frame { cursor: pointer; border-radius: 8px; }
.crawl-stage button.crawl-frame:focus-visible { outline: 2px solid var(--cr-cyan); outline-offset: 2px; }
.crawl-frame-face {
  position: relative; flex: none; width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid #c9a24a; background: #000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.65), 0 3px 10px rgba(0, 0, 0, 0.6);
}
.crawl-frame-face img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.crawl-frame-face.small { width: 30px; height: 30px; border-width: 1.5px; }
.crawl-frame-lvl {
  position: absolute; left: -5px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 3px;
  border-radius: 9px; background: #1a1422; border: 1px solid #c9a24a;
  font: 400 0.85rem/16px 'VT323', monospace; color: #ffd98a; text-align: center;
}
.crawl-frame-face.small .crawl-frame-lvl { min-width: 14px; height: 14px; font-size: 0.72rem; line-height: 12px; left: -6px; bottom: -5px; }
.crawl-frame-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.crawl-frame-name { font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.crawl-frame-name small { font-weight: 400; color: var(--cr-text-2); }
.crawl-frame-bar { position: relative; display: block; }
.crawl-frame-bar.hp .crawl-bar { height: 13px; border-radius: 3px; background: rgba(20, 16, 28, 0.85); }
.crawl-frame-bar i { position: absolute; inset: 0; font: 400 0.9rem/13px 'VT323', monospace; text-align: center; color: #fff; text-shadow: 0 1px 1px #000, 0 0 3px #000; pointer-events: none; }
.crawl-frame-bar.xp .crawl-bar { height: 4px; }
.crawl-stage .crawl-hud-me { width: 100%; }
.crawl-stage .crawl-frame.crawl-ally { width: min(210px, 100%); margin-left: 14px; }
.crawl-stage .crawl-frame.crawl-ally .crawl-frame-name { font-size: 0.72rem; font-weight: 500; }
.crawl-stage .crawl-frame.crawl-ally .crawl-bar { height: 6px; background: rgba(20, 16, 28, 0.85); }
.crawl-stage .crawl-frame.down { opacity: 0.5; filter: grayscale(0.85); }
.crawl-stage .crawl-hudbar .crawl-rail { grid-area: rail; }

/* Sheet: currencies moved here */
.crawl-sheet-cur { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; margin: 0.2rem 0 0.8rem; font-size: 0.82rem; font-variant-numeric: tabular-nums; }

/* Actions row: suggestions + contextual basics on the left, pacing on the right */
.crawl-actions .crawl-suggest { flex: 0 1 auto; }
.crawl-actions .crawl-core { flex: 0 1 auto; margin-left: 0; padding-left: 0; border-left: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.crawl-actions .crawl-core:not(:empty) { padding-left: 0; border-left: 0; }
.crawl-actions .crawl-continue { margin-left: auto; }
.crawl-actions .crawl-autos { margin-left: 0.3rem; }
.crawl-chip.crawl-basic { border-color: rgba(143, 211, 255, 0.35); color: var(--cr-text); }
.crawl-chip.crawl-basic::before { content: none; }
.crawl-chip.crawl-basic:hover { border-color: var(--cr-cyan); background: rgba(143, 211, 255, 0.1); }
@media (max-width: 640px) {
  .crawl-stage .crawl-hudbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "frames rail"; }
  .crawl-frame-face { width: 42px; height: 42px; }
  .crawl-stage .crawl-frames { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .crawl-stage .crawl-hud-me { flex: 1 1 100%; }
  .crawl-stage .crawl-frame.crawl-ally { width: auto; flex: 1 1 0; margin-left: 0; }
  .crawl-actions .crawl-core { flex-wrap: nowrap; }
  .crawl-actions .crawl-chip.crawl-basic { flex: none; }
}
/* Frames: undo the old ally-row span rules. */
.crawl-stage .crawl-frame .crawl-frame-body { display: flex; flex-direction: column; align-items: stretch; }
.crawl-stage .crawl-frame .crawl-frame-body > .crawl-bar, .crawl-stage .crawl-frame .crawl-bar { display: block; width: 100%; }
.crawl-stage .crawl-frame .crawl-frame-name { display: block; }
.crawl-stage .crawl-frame .crawl-frame-face { display: block; }
.crawl-frame-bar.xp .crawl-bar { background: rgba(20, 16, 28, 0.85); }
/* One flowing row of chips (story suggestions, then contextual basics); pacing toggles at the end. */
.crawl-actions { flex-wrap: wrap; align-items: center; row-gap: 0.4rem; }
.crawl-actions .crawl-suggest, .crawl-actions .crawl-core { display: contents; }
@media (max-width: 640px) { .crawl-actions { flex-wrap: nowrap; } }
.crawl-stage .crawl-frame .crawl-bar > span { display: block; height: 100%; }
@media (max-width: 640px) { .crawl-actions .crawl-autos { position: sticky; right: 0; z-index: 1; padding-left: 0.35rem; background: linear-gradient(90deg, transparent, var(--cr-bg) 0.35rem); } .crawl-actions .crawl-continue { display: none; } }

/* ── HUD v3: pixel unit frames top-left, tools stacked right ── */
.crawl-panel { --stage-h: 210px; }
.crawl-panel.max { --stage-h: clamp(240px, 34vh, 380px); }
.crawl-stage { justify-content: flex-start; }
.crawl-stage .crawl-hudbar { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "frames . rail"; padding: 0.1rem 0.8rem 0.5rem; align-items: start; }

/* Taller art, longer fade into the story. */
.crawl-stage-art { height: calc(var(--stage-h) + 150px); }
.crawl-stage-art { -webkit-mask-image: linear-gradient(180deg, #000 0, #000 45%, rgba(0, 0, 0, 0.55) 72%, transparent 100%); mask-image: linear-gradient(180deg, #000 0, #000 45%, rgba(0, 0, 0, 0.55) 72%, transparent 100%); }
.crawl-stage-art::after { background: linear-gradient(180deg, rgba(9, 8, 13, 0.8) 0%, rgba(9, 8, 13, 0.25) 22%, rgba(9, 8, 13, 0.05) 45%, rgba(9, 8, 13, 0.15) 100%); }
/* Story text fades out before it reaches the HUD. */
.crawl-log {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.35) 36px, #000 110px);
  mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.35) 36px, #000 110px);
}

/* Frames: portrait + bars on one dark pixel plate; names on hover only. */
.crawl-frames { gap: 0.35rem; }
.crawl-stage .crawl-frame, .crawl-stage button.crawl-frame {
  gap: 0.45rem; padding: 3px 7px 3px 3px; width: auto !important; margin-left: 0 !important;
  background: rgba(9, 8, 13, 0.62);
  box-shadow: 0 0 0 1px #0a0810, 0 0 0 2px rgba(201, 162, 74, 0.55), 0 3px 8px rgba(0, 0, 0, 0.5);
  border-radius: 0;
}
.crawl-stage .crawl-frame-name { display: none !important; }
.crawl-frame-face { width: 40px; height: 40px; border-radius: 0; border: 2px solid #c9a24a; box-shadow: none; image-rendering: pixelated; }
.crawl-frame-face img { border-radius: 0; }
.crawl-frame-face.small { width: 26px; height: 26px; border-width: 2px; }
.crawl-frame-lvl { border-radius: 0; left: -6px; bottom: -6px; }
.crawl-frame-body { gap: 3px; }
/* Pixel bars: square, framed, segmented, one health colour for everyone. */
.crawl-stage .crawl-frame .crawl-bar {
  height: 10px; width: 132px !important; border-radius: 0;
  background: #120e18; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.crawl-stage .crawl-frame.crawl-ally .crawl-bar { height: 7px; width: 88px !important; }
.crawl-stage .crawl-frame .crawl-bar > span { border-radius: 0; }
.crawl-stage .crawl-frame .crawl-bar.hp > span,
.crawl-stage .crawl-frame .crawl-bar.ally > span {
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(0, 0, 0, 0.35) 7px 8px),
    linear-gradient(180deg, #7dff9f 0 35%, #2fbf71 35% 100%);
}
.crawl-stage .crawl-frame .crawl-bar.hp.low > span { background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(0, 0, 0, 0.35) 7px 8px), linear-gradient(180deg, #ff8a95 0 35%, #c2273a 35% 100%); }
.crawl-stage .crawl-frame-bar.hp .crawl-bar { height: 12px; }
.crawl-frame-bar i { font-size: 0.85rem; line-height: 12px; }
.crawl-stage .crawl-frame-bar.xp .crawl-bar { height: 4px; }
.crawl-stage .crawl-frame-bar.xp .crawl-bar > span { background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(0, 0, 0, 0.35) 7px 8px), #9b6bff; }

/* Sheet + Chat stacked on the right. */
.crawl-stage .crawl-hudbar .crawl-rail { flex-direction: column; gap: 0.35rem; align-items: flex-end; }
.crawl-stage .crawl-rail-btn { border-radius: 0; box-shadow: 0 0 0 1px #0a0810, 0 0 0 2px rgba(201, 162, 74, 0.4); }

@media (max-width: 640px) {
  .crawl-panel, .crawl-panel.max { --stage-h: 170px; }
  .crawl-stage .crawl-frames { flex-direction: column; align-items: flex-start; }
  .crawl-stage .crawl-hud-me { flex: none; }
  .crawl-stage .crawl-frame.crawl-ally { flex: none; }
  .crawl-stage .crawl-frame .crawl-bar { width: 110px !important; }
  .crawl-stage .crawl-frame.crawl-ally .crawl-bar { width: 76px !important; }
}
@media (max-height: 720px) { .crawl-panel, .crawl-panel.max { --stage-h: 170px; } }
.crawl-stage .crawl-frames { align-items: flex-start; }
.crawl-stage .crawl-frame.crawl-ally { margin-left: 8px !important; }

/* The story rides up into the scene (below the unit frames) and fades as it scrolls into it. */
.crawl-stage + .crawl-foes[hidden] + .crawl-body,
.crawl-stage + .crawl-foes:not([hidden]) { margin-top: min(0px, calc(200px - var(--stage-h))); }
.crawl-log {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.3) 40px, #000 130px);
  mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.3) 40px, #000 130px);
}

/* ── HUD v4: no plates, no strokes; portraits that react ── */
.crawl-stage .crawl-frame, .crawl-stage button.crawl-frame { background: none; box-shadow: none; padding: 0; }
.crawl-frame-face { border: 0; box-shadow: none; background: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)); animation: frameIdle 4.2s ease-in-out infinite; }
.crawl-frame.crawl-ally:nth-child(2) .crawl-frame-face { animation-delay: -1.4s; }
.crawl-frame.crawl-ally:nth-child(3) .crawl-frame-face { animation-delay: -2.8s; }
.crawl-frame-lvl { border: 0; background: none; box-shadow: none; left: -4px; bottom: -6px; color: #ffd98a; text-shadow: 0 0 2px #000, 0 1px 2px #000, 0 0 6px #000; }
.crawl-stage .crawl-icon-btn { background: none; border-color: transparent; }
.crawl-stage .crawl-icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
/* Sheet + Chat: small, icon-only, no chrome. */
.crawl-stage .crawl-rail-btn { width: 2rem; height: 2rem; padding: 0; justify-content: center; background: none; border: 0; box-shadow: none; backdrop-filter: none; color: var(--cr-text); filter: drop-shadow(0 1px 3px #000); border-radius: 6px; }
.crawl-stage .crawl-rail-btn span:not(.crawl-dot) { display: none; }
.crawl-stage .crawl-rail-btn:hover, .crawl-stage .crawl-rail-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); color: #fff; }
.crawl-stage .crawl-rail-btn .crawl-dot { top: 1px; right: 1px; }
/* Portrait states */
@keyframes frameIdle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@keyframes frameHurt { 0% { transform: translateX(0); filter: drop-shadow(0 0 0 #f00) brightness(1.6) sepia(1) hue-rotate(-50deg) saturate(4); } 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-1px); } 100% { transform: none; } }
@keyframes frameHeal { 0% { filter: drop-shadow(0 0 0 #5fe39a); } 40% { filter: drop-shadow(0 0 10px #5fe39a) brightness(1.3); } 100% { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)); } }
@keyframes frameLow { 0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 60, 80, 0.4)); } 50% { filter: drop-shadow(0 0 9px rgba(255, 60, 80, 0.95)); } }
@keyframes frameTalk { 0%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(-3px) scale(1.06); } 60% { transform: translateY(0) scale(0.98); } }
.crawl-frame.hurt .crawl-frame-face { animation: frameHurt 0.45s ease-out; }
.crawl-frame.healed .crawl-frame-face { animation: frameHeal 0.7s ease-out; }
.crawl-frame.low .crawl-frame-face { animation: frameLow 1.1s ease-in-out infinite; }
.crawl-frame.speaking .crawl-frame-face { animation: frameTalk 0.42s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(143, 211, 255, 0.8)); }
.crawl-stage .crawl-frame.down .crawl-frame-face { animation: none; transform: translateY(2px) rotate(-8deg); filter: grayscale(1) brightness(0.6); }
@media (prefers-reduced-motion: reduce) {
  .crawl-frame-face, .crawl-frame.low .crawl-frame-face, .crawl-frame.speaking .crawl-frame-face, .crawl-frame.hurt .crawl-frame-face { animation: none; }
}

/* ── Footer: tiny pacing toggles + hint bottom-left, credit right ── */
.crawl-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0 0.85rem 0.5rem; text-align: left; }
.crawl-foot-left { display: flex; align-items: center; gap: 0.45rem; min-width: 0; flex: 0 1 auto; }
.crawl-foot .crawl-autos { order: -1; gap: 0.2rem; margin: 0; }
.crawl-foot .crawl-auto-btn { width: 1.4rem; height: 1.4rem; border-radius: 5px; border-color: transparent; color: #7a7489; }
.crawl-foot .crawl-auto-btn svg { width: 0.78rem; height: 0.78rem; }
.crawl-foot .crawl-auto-btn:hover { color: var(--cr-text); border-color: var(--cr-line); }
.crawl-foot .crawl-auto-btn.on { color: var(--cr-cyan); background: rgba(143, 211, 255, 0.12); border-color: rgba(143, 211, 255, 0.3); }
.crawl-foot .crawl-continue { display: flex; align-items: center; min-width: 0; opacity: 0; transition: opacity 0.35s ease; cursor: pointer; }
.crawl-foot .crawl-continue.show { opacity: 1; }
.crawl-foot .crawl-continue-text { margin: 0; padding: 0; border: 0; background: none; scale: 1; font-family: 'VT323', monospace; font-size: 0.92rem; letter-spacing: 0.04em; color: var(--cr-amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 13rem; }
.crawl-foot .crawl-continue.waiting .crawl-continue-text { color: var(--cr-text-2); }
.crawl-foot-credit { margin-left: auto; text-align: right; min-width: 0; }
/* New crawler: bottom of the sheet, with a warning. */
.crawl-sheet-danger { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.4rem; padding-top: 0.9rem; border-top: 1px dashed rgba(255, 93, 108, 0.35); }
.crawl-sheet-danger small { color: var(--cr-text-2); font-size: 0.72rem; }
.crawl-mini.danger { border-color: rgba(255, 93, 108, 0.6); color: var(--cr-red); }
.crawl-mini.danger:hover { background: rgba(255, 93, 108, 0.12); }
@media (max-width: 640px) {
  .crawl-foot { padding: 0 0.6rem 0.45rem; }
  .crawl-foot-credit { font-size: 0.58rem; line-height: 1.3; }
  .crawl-foot .crawl-continue-text { max-width: 7.5rem; }
}
/* Less overlap: the story only dips into the bottom of the scene, and fades out sooner. */
.crawl-stage + .crawl-foes[hidden] + .crawl-body,
.crawl-stage + .crawl-foes:not([hidden]) { margin-top: min(0px, calc(290px - var(--stage-h))); }
.crawl-log {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.15) 30px, rgba(0, 0, 0, 0.6) 80px, #000 150px);
  mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.15) 30px, rgba(0, 0, 0, 0.6) 80px, #000 150px);
}

/* Cards shed their chrome before they fade into the scene (no muddy boxes over the art). */
.crawl-say, .crawl-sys, .crawl-roll, .crawl-dm, .crawl-widget, .crawl-you { transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease; }
.crawl-log .chrome-off { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
.crawl-log .chrome-off .crawl-sys-thumb { opacity: 0.4; transition: opacity 0.5s ease; }
.crawl-log .chrome-off .crawl-say-name, .crawl-log .chrome-off .crawl-say-text, .crawl-log .chrome-off .crawl-sys-title, .crawl-log .chrome-off .crawl-sys-text { text-shadow: 0 1px 3px #000; }

/* Crawlers you know (sheet) */
.crawl-known { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.crawl-known li { display: flex; align-items: center; gap: 0.6rem; }
.crawl-known img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex: none; }
.crawl-known div { flex: 1; min-width: 0; }
.crawl-known b { font-size: 0.86rem; }
.crawl-known em { font-style: normal; font-size: 0.65rem; padding: 0 0.3rem; border-radius: 4px; background: var(--cr-green); color: #07130c; vertical-align: 1px; }
.crawl-known small { display: block; font-size: 0.72rem; color: var(--cr-text-2); }

/* ── System AI: glitchy holographic transmission ── */
.crawl-say.who-system, .crawl-bubble.who-system > div { position: relative; overflow: hidden; isolation: isolate; }
.crawl-say.who-system { box-shadow: inset 0 0 18px rgba(143, 211, 255, 0.08), 0 0 14px rgba(143, 211, 255, 0.06); animation: holoFlicker 5.5s steps(1) infinite; }
/* Scanlines + a slow sweep band */
.crawl-say.who-system::before, .crawl-bubble.who-system > div::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(143, 211, 255, 0.07) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, transparent 0%, rgba(143, 211, 255, 0.12) 48%, transparent 56%);
  background-size: 100% 100%, 100% 300%;
  animation: holoSweep 4.2s linear infinite;
}
/* Static noise speckle */
.crawl-say.who-system::after, .crawl-bubble.who-system > div::after {
  content: ''; position: absolute; inset: -50%; z-index: -1; pointer-events: none; opacity: 0.07;
  background-image: radial-gradient(rgba(255, 255, 255, 0.9) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
  animation: holoStatic 0.35s steps(3) infinite;
}
/* Colour split on the words, and a rare slice glitch */
.crawl-say.who-system .crawl-say-text, .crawl-say.who-system .crawl-say-name {
  text-shadow: 1px 0 rgba(255, 60, 170, 0.45), -1px 0 rgba(0, 240, 255, 0.45), 0 0 8px rgba(143, 211, 255, 0.35);
}
.crawl-say.who-system .crawl-say-text { animation: holoGlitch 6.5s steps(1) infinite; }
.crawl-say.who-system .crawl-say-face { filter: drop-shadow(0 0 4px rgba(143, 211, 255, 0.7)); animation: holoFlicker 3.7s steps(1) infinite; }
@keyframes holoSweep { from { background-position: 0 0, 0 100%; } to { background-position: 0 0, 0 -200%; } }
@keyframes holoStatic { 0% { transform: translate(0, 0); } 33% { transform: translate(-1px, 2px); } 66% { transform: translate(2px, -1px); } }
@keyframes holoFlicker { 0%, 100% { opacity: 1; } 41% { opacity: 0.82; } 42% { opacity: 1; } 77% { opacity: 0.9; } 78% { opacity: 1; } }
@keyframes holoGlitch {
  0%, 88%, 100% { transform: none; clip-path: none; }
  89% { transform: translateX(-3px); clip-path: inset(10% 0 55% 0); }
  90% { transform: translateX(3px); clip-path: inset(55% 0 12% 0); }
  91% { transform: translateX(-1px); clip-path: inset(30% 0 40% 0); }
  92% { transform: none; clip-path: none; }
}
/* The fade-to-scene state keeps it subtle. */
.crawl-log .crawl-say.who-system.chrome-off { animation: none; }
.crawl-log .crawl-say.who-system.chrome-off::before, .crawl-log .crawl-say.who-system.chrome-off::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .crawl-say.who-system, .crawl-say.who-system::before, .crawl-say.who-system::after,
  .crawl-bubble.who-system > div::before, .crawl-bubble.who-system > div::after,
  .crawl-say.who-system .crawl-say-text, .crawl-say.who-system .crawl-say-face { animation: none; }
}

/* System AI v2: calmer flicker, terminal font. */
.crawl-say.who-system .crawl-say-text,
.crawl-bubble.who-system > div { font-family: 'Share Tech Mono', 'VT323', ui-monospace, monospace; font-size: 0.95rem; letter-spacing: 0.01em; line-height: 1.5; }
.crawl-say.who-system { animation: holoFlickerSoft 7s steps(1) infinite; }
.crawl-say.who-system .crawl-say-text {
  text-shadow: 0.5px 0 rgba(255, 60, 170, 0.3), -0.5px 0 rgba(0, 240, 255, 0.3), 0 0 6px rgba(143, 211, 255, 0.25);
  animation: holoGlitchSoft 12s steps(1) infinite;
}
.crawl-say.who-system .crawl-say-face { animation: holoFlickerSoft 5s steps(1) infinite; }
@keyframes holoFlickerSoft { 0%, 100% { opacity: 1; } 63% { opacity: 0.94; } 64% { opacity: 1; } }
@keyframes holoGlitchSoft {
  0%, 94%, 100% { transform: none; clip-path: none; }
  95% { transform: translateX(-1.5px); clip-path: inset(20% 0 55% 0); }
  96% { transform: translateX(1px); clip-path: inset(50% 0 20% 0); }
  97% { transform: none; clip-path: none; }
}
@media (prefers-reduced-motion: reduce) { .crawl-say.who-system, .crawl-say.who-system .crawl-say-text, .crawl-say.who-system .crawl-say-face { animation: none; } }

/* System AI v3: slower sheen; hologram power-on intro. */
.crawl-say.who-system::before, .crawl-bubble.who-system > div::before {
  background:
    repeating-linear-gradient(180deg, rgba(143, 211, 255, 0.06) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, transparent 0%, rgba(143, 211, 255, 0.07) 48%, transparent 56%);
  background-size: 100% 100%, 100% 300%;
  animation-duration: 11s;
}
.crawl-say.who-system.materialize { transform-origin: center; animation: holoPowerOn 0.75s cubic-bezier(0.2, 0.9, 0.3, 1) both, holoFlickerSoft 7s steps(1) 0.75s infinite; }
.crawl-say.who-system.materialize::after { animation: holoStatic 0.35s steps(3) infinite, holoBurst 0.9s ease-out both; }
@keyframes holoPowerOn {
  0% { opacity: 0; transform: scale(0.35, 0.02); filter: brightness(3) saturate(0.4); }
  30% { opacity: 1; transform: scale(1, 0.03); filter: brightness(2.6); }
  55% { transform: scale(1, 1.08); filter: brightness(1.6); }
  70% { transform: scale(1, 0.95); }
  82% { transform: scale(1, 1.02); filter: brightness(1.15); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes holoBurst { 0% { opacity: 0.55; } 60% { opacity: 0.2; } 100% { opacity: 0.07; } }
.crawl-say-tx { font-family: 'VT323', monospace; font-size: 1rem; letter-spacing: 0.12em; color: var(--cr-cyan); text-shadow: 0 0 8px rgba(143, 211, 255, 0.7); animation: holoBlink 0.9s steps(1) infinite; }
@keyframes holoBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .crawl-say.who-system.materialize, .crawl-say.who-system.materialize::after, .crawl-say-tx { animation: none; }
}

/* ── Boss battle: marquee, heavy shake, splash art ── */
.crawl-ticker.battle .crawl-ticker-flash { background: radial-gradient(circle at 50% 30%, rgba(255, 40, 60, 0.5), transparent 62%); }
.crawl-ticker.battle .crawl-ticker-band {
  background: repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.18) 0 12px, transparent 12px 24px), linear-gradient(90deg, #3a0008, #d11a2f 50%, #3a0008);
  box-shadow: 0 0 40px rgba(255, 40, 60, 0.55);
}
.crawl-ticker.battle .crawl-ticker-track span { color: #ffd0d4; }
.crawl-panel.fx-boss { animation: fxBossShake 1.1s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.crawl-panel.fx-boss::after {
  content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none;
  background: radial-gradient(circle, transparent 35%, rgba(200, 10, 30, 0.45) 100%);
  animation: fxBossVignette 1.3s ease-out both;
}
@keyframes fxBossShake {
  0%, 100% { transform: none; }
  8% { transform: translate(-7px, 3px) rotate(-0.4deg); } 16% { transform: translate(7px, -4px) rotate(0.4deg); }
  24% { transform: translate(-6px, -2px); } 32% { transform: translate(6px, 3px); } 42% { transform: translate(-4px, 2px); }
  54% { transform: translate(3px, -2px); } 68% { transform: translate(-2px, 1px); } 82% { transform: translate(1px, 0); }
}
@keyframes fxBossVignette { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.crawl-splash.boss { background: radial-gradient(circle at 50% 45%, rgba(120, 10, 25, 0.35), rgba(5, 3, 8, 0.85) 70%); }
.crawl-splash-art {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover;
  opacity: 0.85; animation: splashArt 2.4s ease-out both; image-rendering: auto;
}
.crawl-splash.boss { isolation: isolate; }
@keyframes splashArt { 0% { transform: scale(1.18); filter: brightness(2.2) saturate(0.4); opacity: 0; } 20% { opacity: 0.9; } 100% { transform: scale(1.02); filter: brightness(0.75); opacity: 0.85; } }
.crawl-splash.boss .crawl-splash-title { text-shadow: 0 0 20px rgba(255, 40, 60, 0.8), 0 3px 0 #000; }
@media (prefers-reduced-motion: reduce) { .crawl-panel.fx-boss, .crawl-panel.fx-boss::after, .crawl-splash-art { animation: none; } }
.crawl-foe-name .crawl-round { display: inline; margin-left: 0.5rem; font-size: 0.95rem; font-weight: 400; vertical-align: 1px; }

/* ── You in the banter ── */
.crawl-say.who-you { --who: #ff9a3c; margin-left: auto; max-width: min(72ch, 88%); background: rgba(194, 65, 12, 0.14); border-left: 0; border-right: 3px solid var(--who); grid-template-columns: 1fr 30px; }
.crawl-say.who-you .crawl-say-face { grid-column: 2; grid-row: 1; }
.crawl-say.who-you .crawl-say-body { grid-column: 1; grid-row: 1; text-align: right; }
.crawl-say-toggle {
  width: 2.25rem; height: 2.25rem; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--cr-line); border-radius: 10px; background: transparent; cursor: pointer;
  font-size: 1rem; line-height: 1; filter: grayscale(1) opacity(0.7); transition: filter 0.2s, border-color 0.2s, background 0.2s;
}
.crawl-say-toggle:hover { filter: none; border-color: var(--cr-cyan); }
.crawl-say-toggle[aria-pressed="true"] { filter: none; border-color: var(--cr-cyan); background: rgba(143, 211, 255, 0.14); }
.crawl-form.saying { border-color: rgba(143, 211, 255, 0.6); box-shadow: 0 0 0 1px rgba(143, 211, 255, 0.25); }
.crawl-form.saying .crawl-send { background: #2563eb; }

/* Act/Say toggle: left of the input, labeled with the current mode. */
.crawl-form { position: relative; padding-left: 0.4rem; }
.crawl-say-toggle { width: auto; gap: 0.3rem; padding: 0 0.55rem; filter: none; color: var(--cr-text-2); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; }
.crawl-say-toggle .crawl-mode-icon { font-size: 0.95rem; }
.crawl-say-toggle[aria-pressed="true"] { color: var(--cr-cyan); }
@media (max-width: 330px) { .crawl-say-toggle .crawl-mode-label { display: none; } .crawl-say-toggle { padding: 0; width: 2.25rem; } }

/* The tap-to-continue hint sits over the input (you can't type while it shows), leaving the stop button free. */
.crawl-form .crawl-continue {
  position: absolute; top: 0; bottom: 0; left: 0; right: calc(2.25rem + 0.4rem + 0.2rem);
  display: flex; align-items: center; justify-content: center; grid-template-rows: none;
  border-radius: 12px 0 0 12px; background: var(--cr-bg-2); z-index: 2;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease; cursor: pointer;
}
.crawl-form .crawl-continue.show { opacity: 1; pointer-events: auto; }
.crawl-form .crawl-continue-text {
  margin: 0; padding: 0.2rem 0.9rem; max-width: 100%; scale: 1;
  font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crawl-form .crawl-continue.waiting { cursor: default; }

/* ── Safe room: Bearsconian cabinet + Hall of Crawlers ── */
.crawl-arcade {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem;
  background: rgba(8, 7, 14, 0.98);
}
.crawl-arcade:not([hidden]) { animation: crawlSlideIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.crawl-arcade iframe { flex: 1; width: 100%; min-height: 0; border: 1px solid rgba(143, 211, 255, 0.35); border-radius: 10px; background: #000; }

.crawl-ranks-table { width: 100%; max-width: 62ch; border-collapse: collapse; margin: 0.4rem auto 0.8rem; }
.crawl-ranks-table td { padding: 0.45rem 0.4rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; }
.crawl-ranks-table td:first-child { width: 2.2rem; text-align: center; font-weight: 700; color: var(--cr-amber); }
.crawl-ranks-table td:last-child { white-space: nowrap; text-align: right; color: var(--cr-text); font-size: 0.85rem; }
.crawl-ranks-table img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; vertical-align: middle; margin-right: 0.5rem; image-rendering: pixelated; }
.crawl-ranks-table small { display: block; color: var(--cr-muted, #a79fb8); font-size: 0.75rem; margin-top: 0.1rem; }
.crawl-ranks-table em { font-style: normal; font-size: 0.7rem; padding: 0.05rem 0.35rem; border-radius: 999px; background: var(--cr-amber); color: #120c05; margin-left: 0.3rem; }
.crawl-ranks-table tr.you td { background: rgba(255, 179, 71, 0.08); }
.crawl-ranks-table tr.dead b { text-decoration: line-through; opacity: 0.7; }

/* ── Patch notes: a management broadcast in the story ── */
.crawl-sys.tone-patch {
  position: relative;
  overflow: hidden;
  flex-shrink: 0; /* the log is a flex column; overflow: hidden would let it collapse */
  border: 1px solid rgba(143, 211, 255, 0.55);
  border-left-width: 1px;
  border-radius: 10px;
  padding-top: 1.7rem;
  background:
    repeating-linear-gradient(0deg, rgba(143, 211, 255, 0.05) 0 1px, transparent 1px 3px),
    linear-gradient(135deg, rgba(143, 211, 255, 0.14), rgba(196, 155, 255, 0.12) 60%, rgba(255, 93, 180, 0.08));
  box-shadow: 0 0 22px rgba(143, 211, 255, 0.15), inset 0 0 18px rgba(143, 211, 255, 0.08);
  animation: patchIn 0.6s steps(6, end) both;
}
.crawl-sys.tone-patch::before {
  content: '📡 INCOMING TRANSMISSION · MANAGEMENT';
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 0.25rem 0.7rem;
  font-family: 'Share Tech Mono', 'VT323', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: #0b0a12;
  background: linear-gradient(90deg, var(--cr-cyan), var(--cr-purple));
}
.crawl-sys.tone-patch .crawl-sys-title { color: var(--cr-cyan); text-shadow: 0 0 8px rgba(143, 211, 255, 0.6); }
.crawl-sys.tone-patch .crawl-sys-text { font-family: 'Share Tech Mono', 'VT323', ui-monospace, monospace; color: var(--cr-text); line-height: 1.5; }
@keyframes patchIn {
  0% { opacity: 0; transform: scaleY(0.05); filter: hue-rotate(90deg); }
  40% { opacity: 1; transform: scaleY(1.04); }
  60% { transform: translateX(-3px); filter: hue-rotate(-40deg); }
  80% { transform: translateX(2px); }
  100% { transform: none; filter: none; }
}
@media (prefers-reduced-motion: reduce) { .crawl-sys.tone-patch { animation: none; } }

/* ── Petition form ── */
.crawl-petition-kind { display: flex; gap: 0.5rem; margin: 0.4rem auto 0.7rem; }
.crawl-petition-kind button { flex: 1; padding: 0.55rem; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); color: var(--cr-text); font: inherit; cursor: pointer; }
.crawl-petition-kind button[aria-checked="true"] { border-color: var(--cr-cyan); background: rgba(143, 211, 255, 0.12); color: #fff; }
.crawl-petition-text { display: block; width: 100%; resize: vertical; min-height: 110px; padding: 0.6rem 0.7rem; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(0, 0, 0, 0.35); color: var(--cr-text); font: inherit; font-size: 16px; }
.crawl-petition-text:focus-visible { outline: 2px solid var(--cr-cyan); outline-offset: 1px; }

/* ── Side quests ── */
.crawl-sys.tone-quest { border-color: #f5c96b; background: linear-gradient(90deg, rgba(245, 201, 107, 0.14), rgba(143, 211, 255, 0.05) 70%, transparent); box-shadow: 0 0 16px rgba(245, 201, 107, 0.12); }
.crawl-sys.tone-quest .crawl-sys-title { color: #f5c96b; }
.crawl-sys.tone-quest .crawl-sys-title::before { content: '📜 '; }
.crawl-quests li { list-style: none; margin-left: -1rem; }
.crawl-quests li small { display: block; color: var(--cr-text-2); }
.crawl-quests li.done b { opacity: 0.75; }

/* ── Name plates for fellow crawlers ── */
.crawl-plate { display: inline-block; margin-left: 0.45rem; padding: 0.05rem 0.4rem; border-radius: 4px; border: 1px solid rgba(95, 227, 154, 0.35); color: var(--cr-green); font: 600 0.62rem/1.4 var(--font-body, system-ui, sans-serif); letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 0.1em; white-space: nowrap; }
.crawl-plate.real { border-color: rgba(245, 201, 107, 0.55); color: #f5c96b; background: rgba(245, 201, 107, 0.1); }
.crawl-say.who-npc.is-real { border-left-color: #f5c96b; background: linear-gradient(90deg, rgba(245, 201, 107, 0.09), transparent 80%); }
.crawl-say.who-npc.is-real .crawl-say-name { color: #f5c96b; }
.crawl-say.who-npc.is-real .crawl-say-face { box-shadow: 0 0 0 2px #f5c96b, 0 0 12px rgba(245, 201, 107, 0.45); }
.crawl-bubble.is-real img { box-shadow: 0 0 0 2px #f5c96b; }

/* ── Drawers: full-panel screens that slide in from the right ── */
.crawl .crawl-panel > .crawl-drawer {
  position: absolute;
  inset: 0;
  left: 0;
  right: 0;
  width: auto;
  max-width: none;
  z-index: 30;
  border: 0;
  border-radius: 0;
  transform: translate3d(100%, 0, 0);
  transition: transform 0.34s cubic-bezier(0.22, 0.9, 0.24, 1);
  animation: none;
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.55);
  overscroll-behavior: contain;
  will-change: transform;
}
.crawl .crawl-panel > .crawl-drawer.open { transform: none; }
.crawl .crawl-panel > .crawl-drawer.dragging { transition: none; }
.crawl .crawl-panel > .crawl-drawer:focus { outline: none; }
/* Full width on a phone; on a wide (maximized) panel, keep reading widths sane. */
.crawl .crawl-panel > .crawl-sheet { padding-inline: max(1rem, calc((100% - 760px) / 2)); }
.crawl .crawl-panel > .crawl-chat > .crawl-chat-log, .crawl .crawl-panel > .crawl-chat > .crawl-chat-form { width: 100%; max-width: 760px; margin-inline: auto; box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) {
  .crawl .crawl-panel > .crawl-drawer { transform: none; opacity: 0; transition: opacity 0.15s ease; }
  .crawl .crawl-panel > .crawl-drawer.open { opacity: 1; }
}

/* A clear strip at the top of the story: the first lines start below the stage fade
   (and the top-card fade) instead of under them. It scrolls away as the story grows. */
.crawl-log::before { content: ''; display: block; flex: none; height: clamp(112px, 20vh, 184px); }

/* ── While a turn plays: visibly paused (not silently dead) ── */
.crawl-chip, .crawl-say-toggle, .crawl-form .crawl-mic, .crawl-input { transition: opacity 0.2s ease, filter 0.2s ease; }
/* (The chips' entrance animation pins opacity, so dim with a filter instead.) */
.crawl-panel.busy .crawl-chip { filter: saturate(0.35) brightness(0.55); cursor: default; }
.crawl-panel.busy .crawl-say-toggle, .crawl-panel.busy .crawl-form .crawl-mic { opacity: 0.4; pointer-events: none; }
.crawl-panel.busy .crawl-input { opacity: 0.6; }
.crawl-panel.busy .crawl-input::placeholder { font-style: italic; }
.crawl-form { position: relative; }
.crawl-form::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(160, 156, 172, 0.55), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.crawl-panel.busy .crawl-form::before { opacity: 0.6; animation: crawlBusyBar 1.8s ease-in-out infinite; }
@keyframes crawlBusyBar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.crawl-form.nudge { animation: crawlNudge 0.32s ease; }
@keyframes crawlNudge { 25% { transform: translateX(-4px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }
@media (prefers-reduced-motion: reduce) {
  .crawl-panel.busy .crawl-form::before { animation: none; background: rgba(160, 156, 172, 0.4); opacity: 0.35; }
  .crawl-form.nudge { animation: none; }
}

.crawl-ranks-table tr.party td { background: rgba(143, 211, 255, 0.06); }
.crawl-ranks-table tr.party em { background: var(--cr-cyan); }
.crawl-ranks-table tr.party:last-of-type td, .crawl-ranks-table tr.party + tr:not(.party) td { border-top: 0; }

/* The arcade takes the whole screen, not just the game panel. */
.crawl .crawl-panel > .crawl-arcade {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  padding: 0;
  gap: 0;
  background: #000;
  border-radius: 0;
}
.crawl-arcade-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: max(0.35rem, env(safe-area-inset-top)) max(0.6rem, env(safe-area-inset-right)) 0.35rem max(0.6rem, env(safe-area-inset-left));
  background: #07060b;
  border-bottom: 1px solid rgba(143, 211, 255, 0.2);
  font-size: 0.72rem;
  color: var(--cr-text-2);
}
.crawl-arcade-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crawl .crawl-arcade iframe { border: 0; border-radius: 0; }

/* The arcade, portaled to <body> while open. */
.crawl-arcade.portal {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  background: #000;
  transform: translate3d(100%, 0, 0);
  transition: transform 0.34s cubic-bezier(0.22, 0.9, 0.24, 1);
}
.crawl-arcade.portal.open { transform: none; }
.crawl-arcade.portal[hidden] { display: none; }
.crawl-arcade.portal iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #000; }
@media (prefers-reduced-motion: reduce) { .crawl-arcade.portal { transform: none; transition: opacity 0.15s ease; opacity: 0; } .crawl-arcade.portal.open { opacity: 1; } }

/* ── Combat texture: weaknesses, wind-ups, freezes ── */
.crawl-weak { color: #ffcf6b; }
.crawl-charging { color: #ff6b7a; letter-spacing: 0.04em; animation: crawlPulse 0.9s ease-in-out infinite; }
.crawl-foe.charging { box-shadow: 0 0 0 1px rgba(255, 93, 108, 0.7), 0 0 18px rgba(255, 93, 108, 0.35); }
.crawl-foe.frozen .crawl-foe-face { filter: hue-rotate(180deg) saturate(0.6) brightness(1.2); }
@media (prefers-reduced-motion: reduce) { .crawl-charging { animation: none; } }

/* ── UX audit pass (2026-09-25): tap targets, a quieter header, readable status, clearer chips ── */
.crawl-icon-btn { min-width: 44px; min-height: 44px; }

/* Always-there actions look solid; story suggestions stay outlined with the ▸. */
.crawl-chip.crawl-basic { background: rgba(143, 211, 255, 0.1); border-color: rgba(143, 211, 255, 0.45); font-weight: 600; }
.crawl-chip { min-height: 40px; }
.crawl-sub-mech:empty { display: none; }
.crawl-sub-mech:not(:empty)::before { content: ' · '; }
.crawl-help-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0 0.2rem; }
.crawl-more-rules { margin: 0.6rem 0; }
.crawl-more-rules summary { cursor: pointer; color: var(--cr-amber); font-weight: 600; padding: 0.4rem 0; }
@media (max-width: 640px) {
  /* Two quick controls on the rail; Ranks and Petitions live in Help. */
  .crawl-rail-btn[data-act="ranks"], .crawl-rail-btn[data-act="petition"] { display: none; }
  .crawl-rail-btn { width: 44px; height: 44px; }
  /* Status: where you are on one line, the floor meter below it, no viewer count. */
  .crawl-sub { white-space: normal; display: flex; flex-direction: column; gap: 0.1rem; }
  .crawl-sub > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .crawl-sub-mech { font-size: 0.68rem; }
  .crawl-sub-mech:not(:empty)::before { content: ''; }
  .crawl-sub-fol { display: none; }
  /* Swipeable suggestions fade at the edge so it reads as "more this way". */
  .crawl-suggest { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 1.5rem; }
  /* Enemy cards: name and HP at a glance; the details are on the portrait tooltip. */
  .crawl-foe-meta { display: none; }
}

.crawl-ui-ico { width: 22px; height: 22px; vertical-align: -6px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6)); }

/* ── Knockouts ── */
.crawl-roll.damage .crawl-dmg-box { background: rgba(255, 93, 108, 0.18); color: #ff8c96; font-size: 0.95rem; }
.crawl-foe.dying { animation: foeDie 1.1s steps(1) forwards; }
.crawl-foe.dying .crawl-bar > span { transition: width 0.5s ease-out; }
.crawl-foe.dying .crawl-foe-face { animation: foeFlash 0.5s ease-out; }
@keyframes foeFlash { 0% { filter: brightness(3) saturate(0); } 100% { filter: grayscale(1) brightness(0.5); } }
@keyframes foeDie {
  0% { transform: translateX(0); } 10% { transform: translateX(-5px); } 20% { transform: translateX(5px); } 30% { transform: translateX(-3px); } 40% { transform: none; opacity: 1; }
  55% { clip-path: inset(0 0 25% 0); opacity: 0.85; } 70% { clip-path: inset(0 0 50% 0); opacity: 0.6; } 85% { clip-path: inset(0 0 75% 0); opacity: 0.35; } 100% { clip-path: inset(0 0 100% 0); opacity: 0; }
}
.crawl-stage { position: relative; }
.crawl-ko { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; pointer-events: none; animation: koIn 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
.crawl-ko.out { animation: koOut 0.35s ease-in forwards; }
.crawl-ko-face { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; image-rendering: pixelated; filter: grayscale(1) contrast(1.2) brightness(0.8); box-shadow: 0 0 0 3px #0b0a0f, 0 0 0 5px #ff5d6c, 0 0 40px rgba(255, 93, 108, 0.55); animation: koFace 0.6s ease-out both; }
.crawl-ko.boss .crawl-ko-face { width: 128px; height: 128px; box-shadow: 0 0 0 3px #0b0a0f, 0 0 0 6px #ffc446, 0 0 60px rgba(255, 196, 70, 0.7); }
.crawl-ko-text { position: absolute; bottom: 12%; text-align: center; font-family: 'VT323', monospace; font-size: 2.2rem; letter-spacing: 0.12em; color: #ff5d6c; text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 93, 108, 0.8); transform: rotate(-4deg); animation: koStamp 0.45s 0.15s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.crawl-ko.boss .crawl-ko-text { color: #ffc446; font-size: 2.6rem; text-shadow: 0 2px 0 #000, 0 0 24px rgba(255, 196, 70, 0.9); }
.crawl-ko-text small { display: block; font-size: 0.9rem; letter-spacing: 0.06em; color: var(--cr-text); transform: rotate(4deg); }
.crawl-ko-burst { position: absolute; width: 0; height: 0; }
.crawl-ko-burst i { position: absolute; width: 6px; height: 6px; background: #ffc446; box-shadow: 0 0 8px #ff8c3a; animation: koSpark 0.9s ease-out forwards; }
@keyframes koIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes koOut { to { opacity: 0; transform: scale(1.05); } }
@keyframes koFace { 0% { transform: scale(1.4); filter: brightness(3); } 100% { transform: scale(1); } }
@keyframes koStamp { 0% { transform: rotate(-4deg) scale(2.2); opacity: 0; } 100% { transform: rotate(-4deg) scale(1); opacity: 1; } }
@keyframes koSpark { 0% { transform: rotate(var(--a)) translateX(0); opacity: 1; } 100% { transform: rotate(var(--a)) translateX(var(--d)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .crawl-foe.dying, .crawl-ko, .crawl-ko-face, .crawl-ko-text, .crawl-ko-burst i { animation: none !important; } .crawl-foe.dying { opacity: 0.3; } }

/* ── Mana ── */
.crawl-frame-bar.mp .crawl-bar { height: 5px; }
.crawl-bar.mp > span, .crawl-bar > span.mp { background: linear-gradient(90deg, #3b82f6, #60a5fa); box-shadow: 0 0 6px rgba(96, 165, 250, 0.6); }
.crawl-frame-bar.mp { position: relative; }
.crawl-frame-bar.mp i { position: absolute; right: 2px; top: -3px; font-size: 0.55rem; font-style: normal; color: #bfdbfe; text-shadow: 0 1px 1px #000; }

/* ── Action cards ── */
.crawl-act { margin: 0.35rem 0; padding: 0.4rem 0.55rem; border-radius: 12px; border: 1px solid var(--cr-line); background: linear-gradient(90deg, rgba(143, 211, 255, 0.07), rgba(20, 16, 28, 0.6)); animation: actIn 0.3s cubic-bezier(0.2, 1.2, 0.4, 1) both; max-width: 640px; }
.crawl-act.hostile { background: linear-gradient(90deg, rgba(255, 93, 108, 0.1), rgba(20, 16, 28, 0.6)); border-color: rgba(255, 93, 108, 0.3); }
.crawl-act.no { opacity: 0.72; }
.crawl-act.crit { border-color: rgba(255, 196, 70, 0.7); box-shadow: 0 0 18px rgba(255, 196, 70, 0.25); }
.crawl-act-row { display: flex; align-items: center; gap: 0.35rem; }
.crawl-act-row > img:not(.crawl-act-ico), .crawl-act-blank { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; image-rendering: pixelated; background: #130f1d; flex: none; }
.crawl-act-blank { display: inline-block; }
.crawl-act-ico { width: 28px; height: 28px; object-fit: contain; flex: none; filter: drop-shadow(0 1px 2px #000); }
.crawl-act.hostile .crawl-act-ico { filter: drop-shadow(0 1px 2px #000) hue-rotate(160deg) saturate(2); }
.crawl-act-text { flex: 1; min-width: 0; font-size: 0.8rem; line-height: 1.25; }
.crawl-act-text span { color: var(--cr-text-2); }
.crawl-act-text small { display: block; color: var(--cr-text-2); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.crawl-act-out { flex: none; display: grid; justify-items: center; min-width: 3rem; font-family: 'VT323', monospace; }
.crawl-act-out b { font-size: 1.6rem; line-height: 1; color: #ff8c96; }
.crawl-act.mine .crawl-act-out b { color: #ffc446; }
.crawl-act-out small { font-size: 0.7rem; color: var(--cr-text-2); margin-top: -2px; }
.crawl-act-d20 { font-size: 1.3rem; line-height: 1; color: var(--cr-text-2); }
.crawl-act-out em { font-style: normal; font-size: 0.8rem; letter-spacing: 0.08em; color: var(--cr-cyan); }
.crawl-act.no .crawl-act-out em { color: var(--cr-text-2); }
.crawl-act.crit .crawl-act-out em { color: #ffc446; }
@keyframes actIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

/* ── Skillstop ── */
.crawl-stop { position: absolute; inset: 0; z-index: 55; display: grid; place-items: center; background: rgba(5, 4, 9, 0.55); cursor: pointer; outline: 0; touch-action: manipulation; }
.crawl-stop-card { width: min(420px, 90%); padding: 1rem 1.1rem 0.9rem; border-radius: 16px; border: 1px solid rgba(255, 196, 70, 0.5); background: #120f1b; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); text-align: center; }
.crawl-stop-title { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: 'VT323', monospace; font-size: 1.6rem; letter-spacing: 0.1em; color: #ffc446; margin-bottom: 0.7rem; }
.crawl-stop-title img { image-rendering: pixelated; }
.crawl-stop-bar { position: relative; height: 26px; border-radius: 13px; background: #1f1a2c; overflow: hidden; border: 1px solid var(--cr-line); }
.crawl-stop-bar .z { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); }
.crawl-stop-bar .good { width: 48%; background: rgba(143, 211, 255, 0.18); }
.crawl-stop-bar .great { width: 24%; background: rgba(143, 211, 255, 0.35); }
.crawl-stop-bar .perfect { width: 8%; background: #ffc446; box-shadow: 0 0 12px #ffc446; }
.crawl-stop-marker { position: absolute; top: -3px; bottom: -3px; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 10px #fff; border-radius: 2px; }
.crawl-stop-hint { margin-top: 0.6rem; font-family: 'VT323', monospace; font-size: 1.2rem; letter-spacing: 0.06em; color: var(--cr-text-2); }
.crawl-stop.g3 .crawl-stop-hint { color: #ffc446; font-size: 1.6rem; }
.crawl-stop.g2 .crawl-stop-hint { color: var(--cr-cyan); }
.crawl-stop.g0 .crawl-stop-hint { color: #ff8c96; }
.crawl-stop.g3 .crawl-stop-card { animation: stopFlash 0.5s ease-out; }
@keyframes stopFlash { 0% { box-shadow: 0 0 0 0 rgba(255, 196, 70, 0.9); } 100% { box-shadow: 0 0 0 30px rgba(255, 196, 70, 0); } }

.crawl-frame-bar.ally-mp { display: block; margin-top: 2px; }
.crawl-frame-bar.ally-mp .crawl-bar { height: 3px; }
.crawl-act:not(.hostile):not(.mine) .crawl-act-out b { color: #9fe6bd; }

/* Action cards: the die spins first, then the damage and verdict show. */
.crawl-act.pending .crawl-act-out b, .crawl-act.pending .crawl-act-out small, .crawl-act.pending .crawl-act-out em, .crawl-act.rolling .crawl-act-out b, .crawl-act.rolling .crawl-act-out small, .crawl-act.rolling .crawl-act-out em { visibility: hidden; }
.crawl-act.revealed .crawl-act-out b ~ em, .crawl-act .crawl-act-out b ~ em { visibility: visible; }
.crawl-act:not(.pending):not(.rolling) .crawl-act-d20:has(~ b) { display: none; }
.crawl-act.rolling .crawl-act-d20 { color: #fff; }

/* Mana bars match the pixel HP bars: square, framed, segmented, in blue. */
.crawl-stage .crawl-frame-bar.mp .crawl-bar { height: 8px; }
.crawl-stage .crawl-frame.crawl-ally .crawl-frame-bar.ally-mp .crawl-bar { height: 5px; }
.crawl-stage .crawl-frame .crawl-bar.mp > span { background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(0, 0, 0, 0.35) 7px 8px), linear-gradient(180deg, #9fd4ff 0 35%, #2f7fd6 35% 100%); box-shadow: none; }
.crawl-stage .crawl-frame-bar.mp i { inset: 0; top: 0; right: 0; text-align: center; font: 400 0.7rem/8px 'VT323', monospace; color: #fff; text-shadow: 0 1px 1px #000, 0 0 3px #000; }
/* Action cards: a plain die number in the same type as the damage column (no big hexagon). */
.crawl-act .crawl-act-d20.crawl-d20 { all: unset; display: block; font-family: 'VT323', monospace; font-size: 1.5rem; line-height: 1; color: var(--cr-text-2); text-align: center; }
.crawl-act .crawl-act-d20.crawl-d20::after { content: 'd20'; display: block; font-size: 0.65rem; letter-spacing: 0.08em; opacity: 0.8; }
.crawl-act.rolling .crawl-act-d20.crawl-d20 { color: #fff; }
.crawl-act.crit .crawl-act-d20.crawl-d20 { color: #ffc446; }

/* Chat contacts: a scrolling strip instead of a row that runs off the drawer. */
.crawl-chat-to { justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; padding-bottom: 2px; }
.crawl-chat-to::-webkit-scrollbar { display: none; }
.crawl-chat-to.scrolls { -webkit-mask-image: linear-gradient(90deg, #000 0 88%, transparent); mask-image: linear-gradient(90deg, #000 0 88%, transparent); }
.crawl-chat-to button { position: relative; flex: 0 0 auto; width: 3.9rem; scroll-snap-align: start; }
.crawl-chat-to button > span:last-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crawl-chat-unread { position: absolute; top: 0.25rem; right: 0.7rem; width: 9px; height: 9px; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 0 2px #121019; }

/* Story images stay card-sized; the big version plays on the stage. */
.crawl-log .crawl-sys .crawl-scene.cast { width: min(100%, 360px); margin: 0 0 0.55rem; border-radius: 6px; aspect-ratio: 3 / 2; }
.crawl-panel.max .crawl-log .crawl-sys .crawl-scene.cast { width: min(100%, 400px); aspect-ratio: 3 / 2; }
/* A new scene punches onto the stage: zooms in hot, then settles. */
.crawl-stage-art img.punch { transform: scale(1.14); filter: brightness(1.9) saturate(1.4); transition: opacity 0.3s ease, transform 1.5s cubic-bezier(0.16, 1, 0.3, 1), filter 1.1s ease-out; }
.crawl-stage-art img.punch.on { transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) { .crawl-stage-art img.punch { transform: none; filter: none; transition: none; } }
/* ── Cold open: Luke and CyBear crash into the first fight ── */
.crawl-panel.fx-join, .crawl-panel.fx-join-cybear { animation: fxShake 0.5s linear; }
.crawl-panel.fx-join::after, .crawl-panel.fx-join-cybear::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  animation: fxFlash 0.7s ease-out forwards;
}
.crawl-panel.fx-join::after { background: radial-gradient(circle at 30% 45%, rgba(255, 236, 200, 0.55), rgba(255, 120, 40, 0.18) 45%, transparent 75%); }
.crawl-panel.fx-join-cybear::after { background: linear-gradient(100deg, transparent 30%, rgba(255, 190, 90, 0.5) 48%, rgba(255, 245, 220, 0.8) 50%, rgba(255, 190, 90, 0.5) 52%, transparent 70%); }
.crawl-sting.join, .crawl-sting.join-cybear { font-style: italic; letter-spacing: 0.04em; color: #fff3dc; text-shadow: 0 0 18px rgba(255, 140, 50, 0.95), 4px 4px 0 #3a0c00; }
.crawl-sting.join-cybear { color: #e9f6ff; text-shadow: 0 0 18px rgba(143, 211, 255, 0.95), 4px 4px 0 #04213a; }

.crawl-sys.tone-join {
  flex: none;
  position: relative;
  overflow: hidden;
  border-left-width: 4px;
  border-color: var(--cr-amber);
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.16), transparent 85%);
  animation: joinSlam 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.crawl-sys.tone-join[data-who="cybear"] { border-color: var(--cr-cyan); background: linear-gradient(90deg, rgba(143, 211, 255, 0.14), transparent 85%); animation-name: joinSlamRight; }
.crawl-sys.tone-join .crawl-sys-title { font-size: 1.45rem; font-style: italic; letter-spacing: 0.05em; color: #ffd29a; text-shadow: 0 0 10px rgba(255, 179, 71, 0.55); }
.crawl-sys.tone-join[data-who="cybear"] .crawl-sys-title { color: var(--cr-cyan); text-shadow: 0 0 10px rgba(143, 211, 255, 0.55); }
.crawl-sys.tone-join .crawl-scene { animation: joinPush 2.4s ease-out both; }
/* A light sweep across the card as it lands */
.crawl-sys.tone-join::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  translate: -100% 0;
  animation: joinSweep 0.9s 0.2s ease-out forwards;
}
@keyframes joinSlam { 0% { opacity: 0; transform: translateX(-40px) skewX(-8deg); } 60% { opacity: 1; transform: translateX(6px) skewX(2deg); } 100% { transform: none; } }
@keyframes joinSlamRight { 0% { opacity: 0; transform: translateX(40px) skewX(8deg); } 60% { opacity: 1; transform: translateX(-6px) skewX(-2deg); } 100% { transform: none; } }
@keyframes joinPush { from { scale: 1.12; } to { scale: 1; } }
@keyframes joinSweep { to { translate: 100% 0; } }

/* ── Tap to skip, right under the words being typed ── */
.crawl-tap-hint {
  display: flex;
  margin: 0.35rem 0 0.2rem;
  padding: 0.2rem 0.75rem;
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 999px;
  background: rgba(9, 8, 13, 0.7);
  color: var(--cr-amber);
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
  cursor: pointer;
  width: fit-content;
  animation: continuePulse 1.6s ease-in-out infinite;
}
.crawl-tap-hint:hover, .crawl-tap-hint:focus-visible { border-color: var(--cr-amber); outline: none; }
.crawl-tap-hint.learned { border-color: transparent; background: none; color: var(--cr-text-2); animation: none; opacity: 0.55; padding-left: 0; }
/* The inline hint replaces the docked one; the dock keeps only the "typing…" wait. */
.crawl-actions .crawl-continue:not(.waiting), .crawl-form .crawl-continue:not(.waiting) { display: none; }

@media (prefers-reduced-motion: reduce) {
  .crawl-sys.tone-join, .crawl-sys.tone-join .crawl-scene, .crawl-sys.tone-join::after, .crawl-tap-hint { animation: none; }
  .crawl-sys.tone-join::after { display: none; }
}

/* A clip that finished (or couldn't play) settles on its still. */
.crawl-scene.clip-still { animation: clipSettle 0.5s ease-out both; }
@keyframes clipSettle { from { filter: brightness(1.4); } to { filter: none; } }
@media (prefers-reduced-motion: reduce) { .crawl-scene.clip-still { animation: none; } }

.crawl-splash.has-art { isolation: isolate; }



/* Photo upload row in the portrait step. */
.crawl-reg-upload { display: grid; gap: 0.3rem; justify-items: start; margin-top: 0.8rem; }
.crawl-reg-upload small { font-size: 0.72rem; color: var(--cr-text-2); }
.crawl-reg-upload .crawl-reg-status:empty { display: none; }

/* Open all: the haul as a grid, each item popping in turn. */
.crawl-loot.multi .crawl-loot-art { display: none; }
.crawl-loot-grid { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; width: min(440px, 86vw); }
.crawl-loot-grid li { display: grid; justify-items: center; gap: 0.3rem; padding: 0.5rem 0.4rem; border-radius: 10px; border: 1px solid var(--cr-line); background: rgba(0, 0, 0, 0.35); animation: crawlLootPop 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both; animation-delay: calc(var(--n, 0) * 180ms); }
.crawl-loot-grid li.tier-silver { border-color: rgba(200, 214, 230, 0.55); }
.crawl-loot-grid li.tier-gold, .crawl-loot-grid li.rarity-gear { border-color: rgba(255, 196, 70, 0.7); box-shadow: 0 0 14px rgba(255, 196, 70, 0.25); }
.crawl-loot-grid img { width: 56px; height: 56px; image-rendering: pixelated; }
.crawl-loot-grid b { font-size: 0.72rem; line-height: 1.2; text-align: center; color: var(--cr-text); }
@keyframes crawlLootPop { from { opacity: 0; transform: scale(0.6) translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .crawl-loot-grid li { animation: none; } }

/* Area moves: one card, each target's damage as a chip. */
.crawl-act-targets { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.35rem 0 0 2.6rem; }
.crawl-act-targets span { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.45rem 0.15rem 0.15rem; border-radius: 999px; border: 1px solid var(--cr-line); background: rgba(0, 0, 0, 0.3); font-size: 0.72rem; }
.crawl-act-targets img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.crawl-act-targets i { font-style: normal; color: var(--cr-text-2); max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crawl-act-targets b { font-family: 'VT323', monospace; font-size: 1rem; color: var(--cr-text); }

/* A fight clip plays edge to edge as the intro; the title rides the bottom so the monster stays visible. */
.crawl-splash.has-clip { justify-content: flex-end; padding-bottom: 12vh; background: #000; }
.crawl-splash.has-clip .crawl-splash-art { animation: none; opacity: 1; filter: none; object-fit: cover; }
.crawl-splash.has-clip .crawl-splash-faces { display: none; }
.crawl-splash.has-clip .crawl-splash-title, .crawl-splash.has-clip .crawl-splash-sub { position: relative; z-index: 1; text-shadow: 0 2px 0 #000, 0 0 18px #000; }

/* ── Hard stage edge: a taller scene with a crisp bottom line; the story starts right under it. ──
   (The long fade into the story cost more room than it gave: the top ~150px of the log was masked out.) */
.crawl-panel { --stage-h: 240px; }
.crawl-panel.max { --stage-h: clamp(250px, 32vh, 380px); }
@media (max-width: 640px) { .crawl-panel, .crawl-panel.max { --stage-h: 236px; } }
@media (max-height: 720px) { .crawl-panel, .crawl-panel.max { --stage-h: 196px; } }
.crawl-stage-art { height: var(--stage-h); -webkit-mask-image: none; mask-image: none; box-shadow: 0 1px 0 rgba(201, 162, 74, 0.35); }
.crawl-stage-art::after { background: linear-gradient(180deg, rgba(9, 8, 13, 0.82) 0%, rgba(9, 8, 13, 0.12) 30%, rgba(9, 8, 13, 0) 55%, rgba(9, 8, 13, 0.35) 100%); }
.crawl-stage { overflow: hidden; }
.crawl-stage + .crawl-foes[hidden] + .crawl-body,
.crawl-stage + .crawl-foes:not([hidden]) { margin-top: 0; }
.crawl-log { -webkit-mask-image: none; mask-image: none; }

/* ── Boss-only big bar (#191): regular enemies are compact frames; the floor boss gets the full-width named bar. ── */
.crawl-foes { align-items: center; }
.crawl-foe.compact { flex: 0 1 10.5rem; grid-template-columns: 30px 1fr; column-gap: 0.45rem; padding: 0.3rem 0.45rem; border-radius: 7px; }
.crawl-foe.compact .crawl-foe-face { width: 30px; height: 30px; border-radius: 5px; grid-row: 1 / span 2; }
.crawl-foe.compact .crawl-foe-name { font-size: 0.7rem; margin-bottom: 0.2rem; }
.crawl-foe.compact .crawl-bar { height: 5px; }
.crawl-foe.compact .crawl-foe-meta { display: none; }
.crawl-foe.compact.charging .crawl-foe-name::after { content: ' ⚠'; color: var(--cr-red); }
.crawl-foes-round { margin-left: auto; font-family: 'VT323', monospace; font-size: 0.95rem; letter-spacing: 0.04em; color: var(--cr-red); white-space: nowrap; }
.crawl-foes.boss-fight .crawl-foe.boss { flex: 1 1 100%; }
.crawl-foes.boss-fight .crawl-foe.boss .crawl-bar { height: 12px; }
.crawl-foes-round .rs { display: none; }
/* Phones: up to three frames share one row; the round shrinks to a tag. */
@media (max-width: 640px) {
  .crawl-foes:not(.boss-fight) { flex-wrap: nowrap; }
  .crawl-foes { padding: 0.4rem 0.6rem; gap: 0.3rem; }
  .crawl-foe.compact { flex: 1 1 0; min-width: 0; grid-template-columns: 26px 1fr; column-gap: 0.35rem; padding: 0.28rem 0.35rem; }
  .crawl-foe.compact .crawl-foe-face { width: 26px; height: 26px; }
  .crawl-foe.compact .crawl-foe-name { font-size: 0.66rem; }
  .crawl-foes-round { font-size: 0.8rem; }
  .crawl-foes-round .rw { display: none; }
  .crawl-foes-round .rs { display: inline; }
}

/* ── Portrait step: your own face first (#193) ── */
.crawl-reg-now { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.7rem; }
.crawl-reg-now img { width: 112px; height: 112px; flex: none; image-rendering: pixelated; border-radius: 6px; box-shadow: 0 0 0 2px rgba(201, 162, 74, 0.6); }
.crawl-reg-now .crawl-reg-note { margin: 0; }
.crawl-reg-photo { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.crawl-reg-photo .crawl-btn { flex: 1 1 10rem; }
.crawl-reg-gen summary { cursor: pointer; color: var(--cr-text-2); font-size: 0.82rem; margin: 0.6rem 0 0.4rem; }
.crawl-studio { display: flex; gap: 0.9rem; align-items: center; padding: 0.7rem; margin: 0.2rem 0 0.6rem; border: 1px solid rgba(143, 211, 255, 0.35); border-radius: 8px; background: rgba(143, 211, 255, 0.06); }
.crawl-studio-pic { position: relative; width: 96px; height: 96px; flex: none; overflow: hidden; border-radius: 6px; }
.crawl-studio-pic img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.6) contrast(1.1); }
.crawl-studio-scan { position: absolute; left: 0; right: 0; height: 18%; background: linear-gradient(180deg, transparent, rgba(143, 211, 255, 0.55), transparent); animation: studioScan 1.6s linear infinite; }
@keyframes studioScan { from { top: -20%; } to { top: 100%; } }
.crawl-studio-side { min-width: 0; flex: 1; }
.crawl-studio-who { font-family: 'VT323', monospace; font-size: 0.9rem; letter-spacing: 0.06em; color: var(--cr-cyan); }
.crawl-studio-line { margin: 0.2rem 0 0.45rem; font-size: 0.9rem; }
.crawl-studio-bar { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; }
.crawl-studio-bar span { display: block; height: 100%; width: 0; background: var(--cr-cyan); transition: width 0.25s linear; }
.crawl-studio small { display: block; margin-top: 0.4rem; color: var(--cr-text-2); font-size: 0.7rem; }
@media (prefers-reduced-motion: reduce) { .crawl-studio-scan { animation: none; top: 40%; } }

/* ── Paperwork: registration as a full-screen System AI chat (#192) ── */
.crawl-paper { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; background: radial-gradient(120% 60% at 50% 0%, rgba(143, 211, 255, 0.08), transparent 60%), var(--cr-bg); animation: crawlIn 0.25s ease-out both; }
.crawl-paper-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.8rem 1rem 0.6rem; border-bottom: 1px solid rgba(143, 211, 255, 0.18); }
.crawl-paper-kicker { font-family: 'VT323', monospace; font-size: 1.05rem; letter-spacing: 0.08em; color: var(--cr-cyan); }
.crawl-paper-dots { display: flex; gap: 0.3rem; margin-top: 0.3rem; }
.crawl-paper-dots i { width: 1.4rem; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.crawl-paper-dots i.on { background: var(--cr-amber); }
.crawl-paper-log { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1rem 1.4rem; display: flex; flex-direction: column; gap: 0.7rem; }
.crawl-paper-log > * { max-width: 44rem; width: 100%; margin-inline: auto; }
.crawl-paper-say { animation: crawlRise 0.3s ease-out both; }
.crawl-paper-step { padding: 0.8rem; border: 1px solid var(--cr-line); border-radius: 10px; background: var(--cr-bg-2); animation: crawlRise 0.3s ease-out both; }
/* animation: none, or crawlRise's fill (both) keeps opacity 1 and the step never dims. */
.crawl-paper-step.done { animation: none; opacity: 0.45; pointer-events: none; filter: saturate(0.6); }
.crawl-paper-step .crawl-reg-note { margin: 0.6rem 0 0; }
.crawl-paper-name { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.crawl-paper-name input, .crawl-paper-ask input { flex: 1; min-width: 0; padding: 0.55rem 0.7rem; border: 1px solid var(--cr-line); border-radius: 8px; background: rgba(0, 0, 0, 0.35); color: var(--cr-text); font: inherit; }
.crawl-paper-name input:focus, .crawl-paper-ask input:focus { outline: 2px solid var(--cr-cyan); outline-offset: 1px; }
.crawl-paper-pick { margin-top: 0.6rem; }
.crawl-paper-looks { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.crawl-paper-looks .crawl-reg-pic img { width: 56px; height: 56px; }
.crawl-paper-studio:empty { display: none; }
.crawl-paper-next { width: 100%; margin-top: 0.4rem; }
.crawl-paper-choice { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.crawl-paper-choice .crawl-btn { flex: 1 1 12rem; }
.crawl-paper-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; margin-bottom: 0.6rem; }
.crawl-paper-stat { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 0 0.4rem; padding: 0.5rem 0.55rem; border: 1px solid var(--cr-line); border-radius: 8px; background: rgba(0, 0, 0, 0.3); color: var(--cr-text); text-align: left; cursor: pointer; font: inherit; }
.crawl-paper-stat b { font-family: 'VT323', monospace; font-size: 1.05rem; letter-spacing: 0.05em; }
.crawl-paper-stat .v { font-size: 1.15rem; font-weight: 700; justify-self: end; }
.crawl-paper-stat .m { font-size: 0.78rem; color: var(--cr-text-2); }
.crawl-paper-stat small { grid-column: 1 / -1; font-size: 0.66rem; color: var(--cr-text-2); line-height: 1.3; }
.crawl-paper-stat.main { border-color: rgba(255, 179, 71, 0.55); }
.crawl-paper-stat.sel { border-color: var(--cr-cyan); box-shadow: 0 0 0 1px var(--cr-cyan) inset; background: rgba(143, 211, 255, 0.08); }
.crawl-paper-ask { display: flex; gap: 0.5rem; padding: 0.6rem 1rem calc(0.7rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--cr-line); background: var(--cr-bg-2); }
.crawl-paper-ask[hidden] { display: none; }
@media (max-width: 640px) {
  .crawl-paper-log { padding: 0.8rem 0.7rem 1.2rem; }
  .crawl-paper-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crawl-paper .crawl-reg-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .crawl-paper, .crawl-paper-say, .crawl-paper-step { animation: none; } }

/* ── Pet intake chat (#195) ── */
.crawl-paper-pet { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.5rem; align-items: end; }
.crawl-paper-pet label, .crawl-paper-move { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--cr-text-2); }
.crawl-paper-pet input, .crawl-paper-move input, .crawl-paper-own input { padding: 0.5rem 0.65rem; border: 1px solid var(--cr-line); border-radius: 8px; background: rgba(0, 0, 0, 0.35); color: var(--cr-text); font: inherit; min-width: 0; }
.crawl-paper-opts, .crawl-paper-roles { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.crawl-paper-roles .crawl-mini { display: flex; flex-direction: column; align-items: flex-start; text-align: left; flex: 1 1 9rem; }
.crawl-paper-roles small { color: var(--cr-text-2); font-size: 0.68rem; }
.crawl-paper-own { display: flex; gap: 0.4rem; }
.crawl-paper-own input { flex: 1; }
.crawl-paper-move { margin-bottom: 0.6rem; }
@media (max-width: 640px) { .crawl-paper-pet { grid-template-columns: 1fr; } }

/* Phones zoom into inputs under 16px: keep the chat inputs at 16px. */
.crawl-paper input { font-size: 16px; }

/* ── Party bars match the enemy bars (#220): rounded track, smooth gradient fill, same tween.
   (A pixel overhaul of every bar can come later; for now one style everywhere.) ── */
.crawl-stage .crawl-frame .crawl-bar { border-radius: 999px; background: #241f30; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.crawl-stage .crawl-frame .crawl-bar > span { border-radius: inherit; }
.crawl-stage .crawl-frame .crawl-bar.hp > span,
.crawl-stage .crawl-frame .crawl-bar.ally > span { background: linear-gradient(90deg, #2fbf71, var(--cr-green)); }
.crawl-stage .crawl-frame .crawl-bar.hp.low > span { background: linear-gradient(90deg, #c2273a, var(--cr-red)); }
.crawl-stage .crawl-frame-bar.xp .crawl-bar > span { background: linear-gradient(90deg, #7c4dff, #9b6bff); }
.crawl-stage .crawl-frame-bar.hp .crawl-bar { height: 12px; }
.crawl-stage .crawl-frame.crawl-ally .crawl-bar { height: 7px; }
.crawl-foe .crawl-bar { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }

/* ── Wide screens (#221): scene column on the left, story on the right; drawers dock over the scene ──
   Desktop and landscape tablets past ~1100px and wider than tall, plus phones held sideways (short
   landscape screens, where a stacked scene would leave no room for the story). Portrait stays stacked. */
@media (min-width: 1100px) and (min-aspect-ratio: 5/4), (min-width: 640px) and (max-height: 520px) and (orientation: landscape) {
  .crawl-panel.max {
    /* The scene takes whatever the story column (capped at ~72ch of narration) does not need. */
    --wide-left: clamp(290px, max(40vw, 100vw - 860px), 62vw);
    display: grid;
    grid-template-columns: var(--wide-left) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto auto;
  }
  .crawl-panel.max > .crawl-stage { grid-column: 1; grid-row: 1 / -1; height: 100%; min-height: 0; --stage-h: 100%; }
  .crawl-panel.max .crawl-stage-art { height: 100%; box-shadow: 1px 0 0 rgba(201, 162, 74, 0.35); }
  .crawl-panel.max .crawl-stage-art img { object-position: center 45%; }
  .crawl-panel.max .crawl-stage-art::after { background: linear-gradient(180deg, rgba(9, 8, 13, 0.82) 0%, rgba(9, 8, 13, 0.1) 22%, rgba(9, 8, 13, 0) 55%, rgba(9, 8, 13, 0.55) 100%); }
  /* Enemies sit at the foot of the scene, over the art. */
  .crawl-panel.max > .crawl-foes { grid-column: 1; grid-row: 1 / -1; align-self: end; z-index: 2; border-bottom: 0; padding: 2.4rem 1rem 1rem; background: linear-gradient(180deg, transparent, rgba(9, 8, 13, 0.9) 45%); }
  .crawl-panel.max > .crawl-body { grid-column: 2; grid-row: 1; }
  .crawl-panel.max > .crawl-actions { grid-column: 2; grid-row: 2; }
  .crawl-panel.max > .crawl-form { grid-column: 2; grid-row: 3; }
  .crawl-panel.max > .crawl-foot { grid-column: 2; grid-row: 4; }
  /* Sheet, chat, help: docked drawers over the scene column, so the story stays readable beside them. */
  .crawl .crawl-panel.max > .crawl-drawer { left: 0; right: auto; width: var(--wide-left); box-sizing: border-box; transform: translate3d(-100%, 0, 0); box-shadow: 24px 0 48px rgba(0, 0, 0, 0.55); }
  .crawl .crawl-panel.max > .crawl-drawer.open { transform: none; }
  .crawl .crawl-panel.max > .crawl-sheet { padding-inline: 1.25rem; }
  /* Story images don't need to be letterbox-thin when the story has its own column. */
  .crawl-panel.max .crawl-scene { aspect-ratio: 16 / 7; }
}
/* Phones held sideways: every row of height counts, so the action chips become one swipeable row. */
@media (min-width: 640px) and (max-height: 520px) and (orientation: landscape) {
  .crawl-panel.max .crawl-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .crawl-panel.max .crawl-actions > .crawl-suggest, .crawl-panel.max .crawl-actions > .crawl-core { flex-wrap: nowrap; flex: none; }
  .crawl-panel.max .crawl-actions .crawl-chip { flex: none; white-space: nowrap; }
  .crawl-panel.max .crawl-actions::-webkit-scrollbar { display: none; }
}

/* Art review (admin only): 👍/👎 on game images */
.crawl-rate { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; background: rgba(9, 8, 13, 0.72); border: 1px solid rgba(201, 162, 74, 0.35); border-radius: 999px; padding: 1px 4px; }
.crawl-rate[hidden] { display: none; }
.crawl-rate button { all: unset; cursor: pointer; padding: 2px 4px; border-radius: 999px; opacity: 0.55; filter: grayscale(1); line-height: 1; }
.crawl-rate button:hover, .crawl-rate button:focus-visible { opacity: 1; filter: none; }
.crawl-rate button:focus-visible { outline: 2px solid #c9a24a; }
.crawl-rate button.on { opacity: 1; filter: none; background: rgba(201, 162, 74, 0.28); }
.crawl-rate.err { border-color: #d05050; }
.crawl-rate-stage { margin-right: 6px; flex: none; }
.crawl-rate-float { position: fixed; z-index: 60; }

/* While the System AI is narrating, the action buttons can't be used yet: say so, like the chips. */
.crawl-panel.busy .crawl-core > button { filter: saturate(0.35) brightness(0.6); cursor: progress; }

/* Pet intake: ready-made looks instead of a photo */
.crawl-pet-looks { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0.6rem; }
.crawl-pet-look { padding: 2px; border: 2px solid var(--cr-line); border-radius: 10px; background: rgba(0, 0, 0, 0.35); cursor: pointer; line-height: 0; }
.crawl-pet-look img { width: 56px; height: 56px; border-radius: 7px; object-fit: cover; }
.crawl-pet-look:hover, .crawl-pet-look:focus-visible { border-color: rgba(201, 162, 74, 0.6); outline: none; }
.crawl-pet-look[aria-pressed="true"] { border-color: #c9a24a; box-shadow: 0 0 0 2px rgba(201, 162, 74, 0.35); }

/* The panel never scrolls sideways: with overflow: hidden, focusing an input in an overflowing drawer
   could still scroll it, and the drawer slid off the left edge on phones (petition #15). */
.crawl .crawl-panel { overflow: clip; }

/* Gear role tag on the sheet (#667) */
.crawl-gear-role { font-size: 0.66rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cr-amber, #c9a24a); border: 1px solid rgba(201, 162, 74, 0.4); border-radius: 999px; padding: 0 0.4rem; margin-left: 0.3rem; white-space: nowrap; }

/* Loot reveal: the button stays in reach while the commentary scrolls (#668) */
.crawl-loot-ok { position: sticky; bottom: 0.6rem; z-index: 2; background: var(--cr-bg, #0b0a10); box-shadow: 0 -10px 18px rgba(9, 8, 13, 0.85); }
@media (max-height: 760px) { .crawl-loot-talk { max-height: 24vh; } }

/* While a sheet is open the story is inert: say so, and a tap on it closes the sheet (#678) */
.crawl-panel.drawer-on > .crawl-body, .crawl-panel.drawer-on > .crawl-actions, .crawl-panel.drawer-on > .crawl-form { filter: brightness(0.55) saturate(0.6); transition: filter 0.2s ease; }
.crawl-panel.drawer-on { cursor: pointer; }
.crawl-panel.drawer-on > .crawl-drawer { cursor: auto; }

/* Foe threat tags (#672) */
.crawl-threat { font-weight: 700; letter-spacing: 0.02em; }
.crawl-threat.easy { color: var(--cr-text-2, #9a96a8); font-weight: 500; }
.crawl-threat.dangerous { color: #ffb347; }
.crawl-threat.deadly { color: #ff5d6c; }

/* Drop buttons on the sheet: quiet until hovered */
.crawl-drop { opacity: 0.55; margin-left: auto; }
.crawl-drop:hover, .crawl-drop:focus-visible { opacity: 1; border-color: #ff5d6c; color: #ff8f99; }

/* Sheet tabs + settings (difficulty, the System AI dials) */
.crawl-sheet-tabs { display: flex; gap: 0.3rem; margin: 0.2rem 0 0.8rem; }
.crawl-sheet-tabs button { flex: 1; padding: 0.45rem 0.6rem; border: 1px solid var(--cr-line); border-radius: 8px; background: transparent; color: var(--cr-text-2); font: inherit; font-size: 0.82rem; cursor: pointer; }
.crawl-sheet-tabs button[aria-selected="true"] { color: var(--cr-text); border-color: var(--cr-amber, #c9a24a); background: rgba(201, 162, 74, 0.12); }
.crawl-set-row { display: grid; gap: 0.25rem; margin: 0 0 0.85rem; }
.crawl-set-name { font-size: 0.86rem; }
.crawl-set-row input[type="range"] { width: 100%; accent-color: var(--cr-amber, #c9a24a); }
.crawl-set-row small { font-size: 0.72rem; }
.crawl-set-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.crawl-set-credit { font-size: 0.72rem; margin-top: 0.8rem; }

/* Party tab */
.crawl-party-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--cr-line); }
.crawl-party-row > div { flex: 1; min-width: 0; display: grid; }
.crawl-party-row small { color: var(--cr-text-2); font-size: 0.74rem; }
.crawl-party-row.away .crawl-party-faces img { filter: grayscale(1) brightness(0.7); }
.crawl-party-faces { display: flex; }
.crawl-party-faces img { border-radius: 8px; margin-right: -6px; border: 1px solid var(--cr-line); }
.crawl-party-lock { white-space: nowrap; }
.crawl-party-note { font-size: 0.74rem; margin-top: 0.8rem; }

/* Death card: come back in on the floor you fell on */
.crawl-death-late { margin-top: 0.5rem; }
