/* 2026-04-28: shared IM scene chrome baseline.
   Scene-first pixel map overrides.
   Keep generated pixel art visible; UI frames the scene instead of hiding it.
   Day/night switching uses body[data-time-of-day] with separate day/night assets.
   Do not fake day scenes with light screen overlays. */

:root {
  --scene-z-base: 0;
  --scene-z-hotspot: 3;
  --scene-z-chat: 6;
  --scene-z-popover: 12;
  --scene-z-rail-mobile: 20;
  --scene-z-hud-mobile: 21;
  --scene-z-hotspot-clear: 30;
  --creative-scene-aspect: 16 / 9;
}

body[data-shell-page="hub"][data-shell-variant="public-square"],
body[data-shell-variant="creative-terminal"] {
  min-height: 100vh;
  overflow: hidden;
  color: #fff2c9;
  background: #120d08;
}

body[data-shell-page="hub"][data-shell-variant="public-square"]::before,
body[data-shell-variant="creative-terminal"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  image-rendering: auto;
}

body[data-shell-page="hub"][data-shell-variant="public-square"]::before {
  background: #120d08;
}

body[data-shell-variant="creative-terminal"]::before {
  background: #100b07;
}

body[data-shell-page="hub"][data-shell-variant="public-square"]::after,
body[data-shell-variant="creative-terminal"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 5, 4, 0.06), rgba(7, 5, 4, 0) 38%, rgba(7, 5, 4, 0.24));
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .city-hub-shell,
body[data-shell-variant="creative-terminal"] .creative-shell {
  width: min(100vw, 1640px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  background: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud,
body[data-shell-variant="creative-terminal"] .creative-hud {
  min-height: 50px;
  padding: 8px 14px;
  background:
    linear-gradient(90deg, rgba(42, 27, 14, 0.94), rgba(77, 48, 22, 0.88)),
    repeating-linear-gradient(90deg, rgba(255, 232, 159, 0.10) 0 2px, transparent 2px 18px);
  border: 2px solid #f1c978;
  box-shadow: 0 0 0 3px rgba(28, 16, 8, 0.92), 0 8px 0 rgba(0, 0, 0, 0.32);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-layout,
body[data-shell-variant="creative-terminal"] .creative-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--im-scene-rail-width, 220px) minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail,
body[data-shell-variant="creative-terminal"] .creative-rail {
  min-width: 0;
  padding: 10px 8px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(45, 28, 15, 0.96), rgba(24, 14, 8, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 230, 150, 0.07) 0 1px, transparent 1px 22px);
  border: 2px solid var(--scene-gold, #f1c978);
  box-shadow: 0 0 0 3px rgba(28, 16, 8, 0.92), 0 8px 0 rgba(0, 0, 0, 0.32);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail-head,
body[data-shell-page="hub"][data-shell-variant="public-square"] .square-rail-note,
body[data-shell-page="hub"][data-shell-variant="public-square"] .rail-title,
body[data-shell-page="hub"][data-shell-variant="public-square"] .rail-section,
body[data-shell-variant="creative-terminal"] .creative-rail-head,
body[data-shell-variant="creative-terminal"] .creative-rail-status,
body[data-shell-variant="creative-terminal"] .creative-rail-note {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .square-tab,
body[data-shell-page="hub"][data-shell-variant="public-square"] .square-shortcut,
body[data-shell-page="hub"][data-shell-variant="public-square"] .rail-item,
body[data-shell-page="hub"][data-shell-variant="public-square"] .rail-list button,
body[data-shell-variant="creative-terminal"] .creative-nav-item,
body[data-shell-variant="creative-terminal"] .rail-item,
body[data-shell-variant="creative-terminal"] .rail-list button {
  min-height: 50px;
  padding: 6px 4px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff2c9;
  font-size: 15px;
  background: rgba(255, 242, 201, 0.08);
  border: 2px solid rgba(241, 201, 120, 0.62);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .square-tab.is-active,
body[data-shell-page="hub"][data-shell-variant="public-square"] .square-shortcut.is-active,
body[data-shell-page="hub"][data-shell-variant="public-square"] .rail-list button.is-active,
body[data-shell-variant="creative-terminal"] .creative-nav-item.is-active,
body[data-shell-variant="creative-terminal"] .rail-list button.is-active {
  color: #23150b;
  background: linear-gradient(180deg, #ffe9a9, #d69d4c);
  border-color: #fff1aa;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage,
body[data-shell-variant="creative-terminal"] .creative-stage {
  position: relative;
  height: 100%;
  min-height: calc(100vh - 86px);
  overflow: hidden;
  border: 3px solid #27190f;
  box-shadow: 0 0 0 3px #f1c978, 0 12px 0 rgba(0, 0, 0, 0.34);
  image-rendering: auto;
}

/* Night scenes */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
  background:
    url("assets/pixel/composed/hub-main-city-scene-v1-256.png") center / cover no-repeat,
    #21150c;
}

body[data-time-of-day="day"][data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
  background:
    url("assets/pixel/composed/hub-main-city-scene-v1-day-256.png") center / cover no-repeat,
    #c7b88c;
}

body[data-shell-variant="creative-terminal"] .creative-stage {
  background:
    var(--creative-scene-image, url("assets/pixel/composed/creative-room-scene-v2-256.png")) center / contain no-repeat,
    #1b110a;
}

body[data-time-of-day="day"][data-shell-variant="creative-terminal"] .creative-stage {
  background:
    var(--creative-scene-image, url("assets/pixel/composed/creative-room-scene-v2-day-256.png")) center / contain no-repeat,
    #c9b58c;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage::before,
body[data-shell-variant="creative-terminal"] .creative-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.22)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0) 18%, rgba(0, 0, 0, 0) 74%, rgba(0, 0, 0, 0.16));
}

.pixel-map {
  position: absolute;
  inset: 0;
  z-index: var(--scene-z-base);
  overflow: hidden;
  display: none;
}

.pixel-map--city {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(180deg, #ddd8c9 0%, #ddd8c9 44%, #8d8f87 44%, #8d8f87 47%, #3d4245 47%, #33393d 100%);
}

.pixel-map--creative {
  background:
    linear-gradient(90deg, rgba(61, 35, 21, 0.28) 1px, transparent 1px) 0 31% / 76px 76px,
    linear-gradient(180deg, rgba(61, 35, 21, 0.22) 1px, transparent 1px) 0 31% / 76px 76px,
    linear-gradient(180deg, #623c2a 0%, #623c2a 30%, #c08b5a 30%, #9f693f 100%);
}

.pixel-road,
.pixel-plaza,
.creative-wall,
.creative-floor {
  position: absolute;
  pointer-events: none;
}

.pixel-road--main {
  left: 0;
  right: 0;
  bottom: 7%;
  height: 24%;
  background:
    linear-gradient(90deg, transparent 0 9%, rgba(255, 220, 99, 0.82) 9% 10%, transparent 10% 28%, rgba(255, 220, 99, 0.78) 28% 29%, transparent 29% 100%),
    linear-gradient(180deg, #474b4e, #2f363b);
  border-top: 6px solid rgba(232, 226, 206, 0.72);
  border-bottom: 6px solid rgba(24, 24, 24, 0.48);
}

.pixel-road--cross {
  left: 41%;
  top: 20%;
  width: 15%;
  bottom: 0;
  background:
    linear-gradient(180deg, transparent 0 16%, rgba(255, 220, 99, 0.72) 16% 17%, transparent 17% 34%, rgba(255, 220, 99, 0.72) 34% 35%, transparent 35% 100%),
    linear-gradient(90deg, #3d4347, #30363b);
  border-left: 6px solid rgba(232, 226, 206, 0.62);
  border-right: 6px solid rgba(25, 25, 25, 0.36);
}

.pixel-plaza {
  left: 3%;
  top: 4%;
  width: 34%;
  height: 44%;
  background:
    linear-gradient(90deg, rgba(116, 103, 84, 0.16) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(180deg, rgba(116, 103, 84, 0.14) 1px, transparent 1px) 0 0 / 32px 32px,
    #d2cabb;
  border: 5px solid #6a655a;
  box-shadow: 0 0 0 4px rgba(232, 220, 184, 0.42), 14px 18px 0 rgba(0, 0, 0, 0.12);
}

.creative-wall {
  inset: 0 0 auto 0;
  height: 31%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 72px 46px,
    linear-gradient(180deg, #623d2b, #4a2b1e);
  border-bottom: 8px solid rgba(43, 24, 14, 0.56);
}

.creative-floor {
  left: 0;
  right: 0;
  bottom: 0;
  height: 69%;
  background:
    linear-gradient(90deg, rgba(92, 53, 28, 0.18) 2px, transparent 2px) 0 0 / 112px 100%,
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(77, 42, 22, 0.16)),
    #bb7f4c;
}

.map-sprite {
  --sheet-w: 1536;
  --sheet-h: 864;
  position: absolute;
  z-index: var(--z);
  left: calc(var(--left) * 100% / var(--sheet-w));
  top: calc(var(--top) * 100% / var(--sheet-h));
  width: calc(var(--w) * 100% / var(--sheet-w));
  height: calc(var(--h) * 100% / var(--sheet-h));
  overflow: hidden;
  pointer-events: none;
}

.map-sprite::before {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: calc(var(--sheet-w) * 100% / var(--w)) calc(var(--sheet-h) * 100% / var(--h));
  background-position:
    calc(var(--x) * 100% / (var(--sheet-w) - var(--w)))
    calc(var(--y) * 100% / (var(--sheet-h) - var(--h)));
}

.map-sprite--city::before {
  background-image: url("assets/pixel/chinese-modern-city/backgrounds/hub_desktop_16x9.avif");
}

.map-sprite--creative::before {
  background-image: url("assets/pixel/creative-interior.avif");
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hero,
body[data-shell-variant="creative-terminal"] .creative-stage-top {
  position: absolute;
  inset: 12px 12px auto 12px;
  z-index: 2;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-copy,
body[data-shell-variant="creative-terminal"] .creative-stage-copy {
  width: min(392px, 42vw);
  padding: 10px 12px;
  background: rgba(18, 11, 7, 0.60);
  border: 2px solid rgba(255, 229, 149, 0.88);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-copy h1,
body[data-shell-variant="creative-terminal"] .creative-stage-copy h1 {
  margin: 4px 0;
  font-size: 30px;
  line-height: 1.05;
  text-shadow: 2px 2px 0 #281205;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-copy p,
body[data-shell-variant="creative-terminal"] .creative-stage-copy p {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-meta,
body[data-shell-variant="creative-terminal"] .creative-stage-meta,
body[data-shell-variant="creative-terminal"] .creative-stage-tags {
  margin-top: 8px;
  gap: 6px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-meta span,
body[data-shell-variant="creative-terminal"] .creative-stage-meta span,
body[data-shell-variant="creative-terminal"] .creative-stage-tags span {
  background: rgba(255, 236, 164, 0.82);
  color: #28170b;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview,
body[data-shell-variant="creative-terminal"] .creative-scene-plate {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview-frame,
body[data-shell-variant="creative-terminal"] .creative-scene-frame {
  min-height: 118px;
  padding: 7px;
  border: 2px solid rgba(255, 231, 151, 0.88);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview-frame {
  background:
    url("assets/pixel/chinese-modern-city/backgrounds/hub_mid_scene_band.avif") center / cover no-repeat,
    #1e130b;
}

body[data-shell-variant="creative-terminal"] .creative-scene-frame {
  background:
    url("assets/pixel/creative-scene.avif") center / cover no-repeat,
    #1e130b;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview-frame::before,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview-frame::after,
body[data-shell-variant="creative-terminal"] .creative-scene-frame::before,
body[data-shell-variant="creative-terminal"] .creative-scene-frame::after {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-strip {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .square-panel {
  min-height: 82px;
  padding: 10px 12px;
  background: rgba(18, 11, 7, 0.64);
  border: 2px solid rgba(255, 224, 143, 0.86);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.24);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .square-panel p {
  font-size: 14px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  position: absolute;
  right: 14px;
  bottom: 96px;
  z-index: 4;
  width: min(560px, 47%);
  max-height: 38vh;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

body[data-shell-variant="creative-terminal"] .creative-chat-toolbar {
  justify-content: flex-end;
  padding: 0 2px 6px;
  background: transparent;
}

body[data-shell-variant="creative-terminal"] .creative-chat-pill {
  color: #fff2c9;
  background: rgba(19, 11, 7, 0.72);
  border: 2px solid rgba(255, 224, 143, 0.78);
}

body[data-shell-variant="creative-terminal"] .creative-chat-bar {
  max-height: 38vh;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
body[data-shell-variant="creative-terminal"] .creative-chat-log {
  max-height: 36vh;
  padding: 4px 2px 8px;
  overflow: auto;
  scrollbar-width: thin;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message {
  width: fit-content;
  max-width: 88%;
  padding: 10px 12px;
  color: #fff6df;
  background: rgba(20, 12, 8, 0.78);
  border: 2px solid rgba(255, 224, 143, 0.82);
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message--own,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message--own {
  margin-left: auto;
  background: rgba(92, 43, 21, 0.82);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer,
body[data-shell-variant="creative-terminal"] .creative-composer {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: var(--scene-z-chat);
  padding: 8px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  background:
    linear-gradient(180deg, rgba(255, 236, 171, 0.96), rgba(214, 165, 84, 0.94)),
    repeating-linear-gradient(90deg, rgba(46, 28, 13, 0.10) 0 2px, transparent 2px 28px);
  border: 3px solid #f2c879;
  box-shadow: 0 0 0 3px rgba(33, 19, 10, 0.94), 0 7px 0 rgba(0, 0, 0, 0.32);
}

body[data-shell-variant="creative-terminal"] .creative-composer-actions {
  display: contents;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .square-tool,
body[data-shell-variant="creative-terminal"] .creative-tool {
  min-width: 48px;
  min-height: 42px;
  background: rgba(255, 233, 168, 0.84);
  border: 2px solid #321d0d;
  color: #2a1709;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field,
body[data-shell-variant="creative-terminal"] .creative-composer-field {
  min-height: 44px;
  padding: 6px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  background: rgba(255, 244, 208, 0.88);
  border: 2px solid #2f1d0f;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field-label,
body[data-shell-variant="creative-terminal"] .creative-channel-pill {
  color: #5f3313;
  background: transparent;
  border: 0;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer textarea {
  min-height: 30px;
  padding: 4px 0;
  color: #241409;
  background: transparent;
}

body[data-shell-variant="creative-terminal"] .creative-composer textarea {
  min-height: 30px;
  padding: 4px 0;
  color: #241409;
  background: transparent;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer #composer-send,
body[data-shell-variant="creative-terminal"] .creative-composer #composer-send {
  min-width: 86px;
  min-height: 44px;
  color: #fff3cc;
  background: #963f19;
  border: 2px solid #ffd987;
}

@media (max-width: 820px) {
  body[data-shell-page="hub"][data-shell-variant="public-square"]::before {
    background: #120d08;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .city-hub-shell,
  body[data-shell-variant="creative-terminal"] .creative-shell {
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud,
  body[data-shell-variant="creative-terminal"] .creative-hud {
    min-height: 44px;
    padding: 7px 9px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-layout,
  body[data-shell-variant="creative-terminal"] .creative-layout {
    display: block;
    min-height: 0;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail,
  body[data-shell-variant="creative-terminal"] .creative-rail {
    position: absolute;
    top: 58px;
    left: 8px;
    z-index: var(--scene-z-rail-mobile);
    width: 78px;
    max-height: calc(100vh - 156px);
    padding: 7px 5px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage,
  body[data-shell-variant="creative-terminal"] .creative-stage {
    min-height: calc(100vh - 68px);
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
    background:
      url("assets/pixel/composed/hub-main-city-scene-v1-256.png") center / cover no-repeat,
      #21150c;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hero,
  body[data-shell-variant="creative-terminal"] .creative-stage-top {
    inset: 8px 8px auto 78px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-copy,
  body[data-shell-variant="creative-terminal"] .creative-stage-copy {
    width: auto;
    max-width: none;
    padding: 8px 9px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-copy h1,
  body[data-shell-variant="creative-terminal"] .creative-stage-copy h1 {
    font-size: 22px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-copy p,
  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-meta,
  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview,
  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-strip,
  body[data-shell-variant="creative-terminal"] .creative-stage-copy p,
  body[data-shell-variant="creative-terminal"] .creative-stage-meta,
  body[data-shell-variant="creative-terminal"] .creative-stage-tags,
  body[data-shell-variant="creative-terminal"] .creative-scene-plate,
  body[data-shell-variant="creative-terminal"] .creative-chat-toolbar {
    display: none;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
  body[data-shell-variant="creative-terminal"] .creative-chat-frame {
    left: 76px;
    right: 8px;
    bottom: 82px;
    width: auto;
    max-height: 36vh;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
  body[data-shell-variant="creative-terminal"] .creative-chat-log {
    max-height: 36vh;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message,
  body[data-shell-variant="creative-terminal"] .creative-chat-log .message {
    max-width: 100%;
    padding: 8px 9px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer,
  body[data-shell-variant="creative-terminal"] .creative-composer {
    left: 8px;
    right: 8px;
    bottom: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .square-tool,
  body[data-shell-variant="creative-terminal"] .creative-tool {
    display: none;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field,
  body[data-shell-variant="creative-terminal"] .creative-composer-field {
    min-height: 42px;
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field-label,
  body[data-shell-variant="creative-terminal"] .creative-channel-pill {
    display: none;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer textarea,
  body[data-shell-variant="creative-terminal"] .creative-composer textarea {
    min-height: 34px;
  }
}

/* Creative v2: generated full-scene background first, minimal game HUD second. */
body[data-shell-variant="creative-terminal"] .creative-layout {
  grid-template-columns: var(--im-scene-rail-width, 220px) minmax(0, 1fr);
  gap: 10px;
}

body[data-shell-variant="creative-terminal"] .creative-rail {
  padding: 8px 6px;
}

body[data-shell-variant="creative-terminal"] .creative-rail::after {
  display: none;
}

body[data-shell-variant="creative-terminal"] .creative-stage {
  aspect-ratio: var(--creative-scene-aspect);
  background:
    var(--creative-scene-image, url("assets/pixel/composed/creative-room-scene-v2-256.png")) center / contain no-repeat,
    #1b110a;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"],
body[data-shell-variant="creative-terminal"] {
  overflow-x: hidden;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspots,
body[data-shell-variant="creative-terminal"] .scene-hotspots {
  position: absolute;
  inset: 0;
  z-index: var(--scene-z-hotspot);
  pointer-events: none;
}

body[data-shell-variant="creative-terminal"] .scene-hotspots {
  aspect-ratio: var(--creative-scene-aspect);
  width: 100%;
  max-height: 100%;
  margin: auto;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot,
body[data-shell-variant="creative-terminal"] .scene-hotspot {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  pointer-events: none;
  cursor: pointer;
  color: transparent;
  text-decoration: none;
  background: rgba(255, 216, 122, 0);
  border: 2px solid rgba(255, 216, 122, 0);
  border-radius: 0;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot span,
body[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 0;
  transition: opacity 0.15s ease;
  padding: 2px 6px;
  color: #fff2c9;
  font-family: var(--creative-font-body, "Noto Sans SC", sans-serif);
  font-size: 12px;
  font-weight: 700;
  background: rgba(20, 12, 7, 0.86);
  border: 1px solid rgba(247, 210, 118, 0.78);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:hover,
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:focus-visible,
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot[aria-expanded="true"],
body[data-shell-variant="creative-terminal"] .scene-hotspot:hover,
body[data-shell-variant="creative-terminal"] .scene-hotspot:focus-visible,
body[data-shell-variant="creative-terminal"] .scene-hotspot[aria-expanded="true"] {
  outline: none;
  background: transparent;
  border-color: transparent;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:hover span,
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:focus-visible span,
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot[aria-expanded="true"] span,
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot span,
body[data-shell-variant="creative-terminal"] .scene-hotspot:hover span,
body[data-shell-variant="creative-terminal"] .scene-hotspot:focus-visible span,
body[data-shell-variant="creative-terminal"] .scene-hotspot[aria-expanded="true"] span,
body[data-shell-variant="creative-terminal"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 1;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot--window {
  left: 2%;
  top: 9%;
  width: 22%;
  height: 32%;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot--desk {
  left: 26%;
  top: 16%;
  width: 22%;
  height: 24%;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot--coffee {
  left: 65%;
  top: 14%;
  width: 22%;
  height: 25%;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot--shelf {
  left: 88%;
  top: 5%;
  width: 10%;
  height: 42%;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot--stairs {
  left: 0%;
  top: 58%;
  width: 21%;
  height: 36%;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot--gate {
  left: 6%;
  top: 12%;
  width: 26%;
  height: 30%;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot--metro {
  left: 2%;
  top: 31%;
  width: 17%;
  height: 28%;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot--plaza {
  left: 39%;
  top: 52%;
  width: 18%;
  height: 20%;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot--board {
  left: 34%;
  top: 31%;
  width: 13%;
  height: 12%;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot--shop {
  left: 75%;
  top: 29%;
  width: 18%;
  height: 23%;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot-popover,
body[data-shell-variant="creative-terminal"] .scene-hotspot-popover {
  position: absolute;
  z-index: var(--scene-z-popover);
  width: min(260px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 10px 12px;
  color: #fff2c9;
  background:
    linear-gradient(180deg, rgba(42, 24, 12, 0.94), rgba(16, 9, 5, 0.96));
  border: 2px solid rgba(247, 210, 118, 0.86);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.34);
  pointer-events: auto;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot-title,
body[data-shell-variant="creative-terminal"] .scene-hotspot-title {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 800;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot-copy,
body[data-shell-variant="creative-terminal"] .scene-hotspot-copy {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 242, 201, 0.82);
}

body[data-shell-variant="creative-terminal"] .creative-stage::before {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0) 54%, rgba(0, 0, 0, 0.16)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0) 74%, rgba(0, 0, 0, 0.08));
}

body[data-shell-variant="creative-terminal"] .creative-stage-top {
  inset: 14px auto auto 14px;
  width: auto;
}

body[data-shell-variant="creative-terminal"] .creative-stage-copy {
  width: auto;
  min-width: 160px;
  padding: 8px 11px;
  background: rgba(18, 10, 6, 0.58);
  border: 2px solid rgba(247, 210, 118, 0.86);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.24);
}

body[data-shell-variant="creative-terminal"] .creative-stage-copy h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.05;
}

body[data-shell-variant="creative-terminal"] .creative-stage-copy p {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.2;
  opacity: 0.86;
}

body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  right: 18px;
  bottom: 96px;
  width: min(360px, 30vw);
  max-height: 24vh;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .scroll-to-bottom,
body[data-shell-variant="creative-terminal"] .creative-chat-frame .scroll-to-bottom {
  display: none !important;
}

body[data-shell-variant="creative-terminal"] .creative-chat-bar,
body[data-shell-variant="creative-terminal"] .creative-chat-log {
  max-height: 24vh;
}

body[data-shell-variant="creative-terminal"] .creative-chat-log {
  overflow: hidden;
}

body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row {
  display: block;
  margin: 0 0 8px;
}

body[data-shell-variant="creative-terminal"] .creative-chat-log .message-avatar {
  display: none;
}

body[data-shell-variant="creative-terminal"] .creative-chat-log .message-stack {
  width: 100%;
  max-width: 100%;
}

body[data-shell-variant="creative-terminal"] .creative-chat-log .message {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
  background: rgba(25, 14, 9, 0.70);
  border-color: rgba(247, 210, 118, 0.74);
  overflow-wrap: anywhere;
}

body[data-shell-variant="creative-terminal"] .creative-composer {
  left: clamp(132px, 16vw, 228px);
  right: 12px;
  bottom: 12px;
  padding: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  background:
    linear-gradient(180deg, rgba(255, 231, 157, 0.94), rgba(209, 153, 70, 0.92)),
    repeating-linear-gradient(90deg, rgba(46, 28, 13, 0.10) 0 2px, transparent 2px 28px);
}

body[data-shell-variant="creative-terminal"] .creative-composer-actions {
  display: none;
}

body[data-shell-variant="creative-terminal"] .creative-composer-field {
  grid-column: auto;
  min-height: 40px;
  padding: 5px 10px;
}

body[data-shell-variant="creative-terminal"] .creative-composer textarea {
  min-height: 28px;
}

body[data-shell-variant="creative-terminal"] .creative-composer #composer-send {
  grid-column: auto;
  min-width: 76px;
  min-height: 40px;
}

@media (max-width: 820px) {
  body[data-shell-page="hub"][data-shell-variant="public-square"] .rail-item,
  body[data-shell-variant="creative-terminal"] .rail-item {
    min-width: 0;
    font-size: 14px !important;
    white-space: nowrap;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .rail-item-label,
  body[data-shell-variant="creative-terminal"] .rail-label {
    white-space: nowrap;
  }

  body[data-shell-variant="creative-terminal"] .creative-rail {
    width: 78px;
  }

  body[data-shell-variant="creative-terminal"] .creative-stage {
    background-position: 34% center;
  }

  body[data-shell-variant="creative-terminal"] .creative-stage-top {
    inset: 10px auto auto 92px;
  }

  body[data-shell-variant="creative-terminal"] .creative-stage-copy {
    min-width: 128px;
    padding: 7px 9px;
  }

  body[data-shell-variant="creative-terminal"] .creative-stage-copy h1 {
    font-size: 22px;
  }

  body[data-shell-variant="creative-terminal"] .creative-stage-copy p {
    display: none;
  }

  body[data-shell-variant="creative-terminal"] .creative-chat-frame {
    position: fixed;
    left: auto;
    right: 12px;
    bottom: 82px;
    z-index: var(--scene-z-rail-mobile);
    width: 172px;
    max-height: 24vh;
  }

  body[data-shell-variant="creative-terminal"] .creative-chat-log {
    max-height: 24vh;
  }

  body[data-shell-variant="creative-terminal"] .creative-chat-log .message {
    padding: 7px 8px;
    font-size: 13px;
  }

  body[data-shell-variant="creative-terminal"] .creative-composer {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: var(--scene-z-hud-mobile);
    padding: 7px;
    grid-template-columns: minmax(0, 1fr) 56px;
  }

  body[data-shell-variant="creative-terminal"] .creative-composer-field {
    grid-column: auto !important;
    min-width: 0;
  }

  body[data-shell-variant="creative-terminal"] .creative-composer #composer-send {
    display: block;
    grid-column: auto !important;
    min-width: 56px;
    padding: 0 6px;
  }
}

/* Creative v2.1: remove leftover sprite-sheet UI chrome from the generated scene. */
body[data-shell-variant="creative-terminal"] .creative-hud {
  min-height: 54px;
  background:
    linear-gradient(180deg, rgba(63, 40, 20, 0.96), rgba(29, 18, 10, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 230, 150, 0.08) 0 1px, transparent 1px 24px) !important;
  border-color: #f1c978;
}

body[data-shell-variant="creative-terminal"] .creative-hud::before {
  content: none !important;
  display: none !important;
  background: none !important;
}

body[data-shell-variant="creative-terminal"] .hud-kicker {
  font-family: var(--creative-font-pixel);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 2px;
}

body[data-shell-variant="creative-terminal"] .hud-title {
  font-family: var(--creative-font-body);
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: 0.02em;
}

body[data-shell-variant="creative-terminal"] .creative-rail .rail-actions {
  gap: 8px;
}

body[data-shell-variant="creative-terminal"] .creative-rail .rail-item {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 4px;
  box-sizing: border-box;
  color: #2b1c11;
  font-family: var(--creative-font-body) !important;
  font-size: 15px !important;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

body[data-shell-variant="creative-terminal"] .creative-rail .rail-glyph {
  display: none !important;
}

body[data-shell-variant="creative-terminal"] .creative-rail .rail-label {
  display: block;
  overflow: visible;
  font-family: var(--creative-font-body) !important;
  line-height: 1;
  text-overflow: clip;
  white-space: nowrap;
}

body[data-shell-variant="creative-terminal"] .creative-composer {
  align-items: center;
}

body[data-shell-variant="creative-terminal"] .creative-composer-field {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  background: #fff0bf !important;
  border: 2px solid #3a2412;
}

body[data-shell-variant="creative-terminal"] .creative-channel-pill {
  display: none !important;
}

body[data-shell-variant="creative-terminal"] .creative-composer textarea {
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  padding: 0;
  overflow: hidden;
  color: #2d1b0e;
  font-family: var(--creative-font-body);
  font-size: 15px;
  line-height: 24px !important;
}

body[data-shell-variant="creative-terminal"] .creative-composer textarea::placeholder {
  color: rgba(96, 62, 31, 0.46);
}

/* Fixed message windows: more text scrolls instead of consuming scene space. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  overflow: hidden !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
body[data-shell-variant="creative-terminal"] .creative-chat-log {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-color: rgba(247, 210, 118, 0.58) rgba(25, 14, 9, 0.22);
  scrollbar-width: thin;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log::-webkit-scrollbar,
body[data-shell-variant="creative-terminal"] .creative-chat-log::-webkit-scrollbar,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message::-webkit-scrollbar,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message::-webkit-scrollbar {
  width: 6px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log::-webkit-scrollbar-thumb,
body[data-shell-variant="creative-terminal"] .creative-chat-log::-webkit-scrollbar-thumb,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message::-webkit-scrollbar-thumb,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message::-webkit-scrollbar-thumb {
  background: rgba(247, 210, 118, 0.62);
  border: 1px solid rgba(52, 31, 15, 0.92);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message {
  max-height: 9.5em;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: rgba(247, 210, 118, 0.52) transparent;
  scrollbar-width: thin;
}

/* Chat-active mode: when people are typing/reading, text outranks the scenery. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  top: 96px;
  left: 18px;
  right: 24px;
  bottom: 88px;
  width: auto;
  height: auto;
  max-height: none;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(28, 16, 9, 0.90), rgba(12, 7, 4, 0.94)),
    repeating-linear-gradient(0deg, rgba(247, 210, 118, 0.06) 0 1px, transparent 1px 18px);
  border: 2px solid rgba(247, 210, 118, 0.86);
  box-shadow: 0 0 0 3px rgba(33, 18, 8, 0.72), 0 8px 0 rgba(0, 0, 0, 0.30);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
body[data-shell-variant="creative-terminal"] .creative-chat-log {
  height: 100%;
  max-height: 100%;
  padding: 0 6px 0 0;
  align-content: flex-start;
  scroll-behavior: auto;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message {
  max-height: none;
  overflow: visible;
}

@media (max-width: 820px) {
  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
  body[data-shell-variant="creative-terminal"] .creative-chat-frame {
    top: 142px;
    left: 8px;
    right: 8px;
    bottom: 78px;
    width: auto;
    height: auto;
    max-height: none;
    padding: 8px;
  }
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-composer {
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-chat-frame,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-chat-log {
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

/* Main city v1: full generated modern Chinese district scene. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
  background:
    url("assets/pixel/composed/hub-main-city-scene-v1-256.png") center / cover no-repeat,
    #15130f;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .pixel-map--city {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspots,
body[data-shell-variant="creative-terminal"] .scene-hotspots {
  z-index: var(--scene-z-hotspot);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  z-index: var(--scene-z-chat);
}

/* Absolute final overrides for the scene-layer contract. Keep these last. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
  background:
    url("assets/pixel/composed/hub-main-city-scene-v1-256.png") center / cover no-repeat,
    #15130f;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .pixel-map--city {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspots,
body[data-shell-variant="creative-terminal"] .scene-hotspots {
  z-index: var(--scene-z-hotspot);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  z-index: var(--scene-z-chat);
}

/* Final layer contract: text layer is topmost and toggles off/on by clicking empty scene space. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspots,
body[data-shell-variant="creative-terminal"] .scene-hotspots {
  z-index: var(--scene-z-hotspot);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  z-index: var(--scene-z-chat);
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-composer {
  opacity: 0;
  pointer-events: none;
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-chat-log {
  display: none;
}

/* WeChat-style overlay: the scroll plane can be tall, but each line stays a left/right bubble. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  top: 72px;
  left: 18px;
  right: 24px;
  bottom: 88px;
  width: auto;
  height: auto;
  max-height: none;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
  background: transparent !important;
  border: 0;
  box-shadow: none;
}

body[data-shell-variant="creative-terminal"] .creative-chat-bar {
  height: 100%;
  max-height: none;
  pointer-events: none;
  background: transparent;
  border: 0;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
body[data-shell-variant="creative-terminal"] .creative-chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  max-height: none;
  padding: 0 12px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: auto;
  background: transparent;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  gap: 8px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row.self,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row.self {
  justify-content: flex-end;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row.self .message-avatar,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row.self .message-avatar {
  order: 2;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-stack,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: auto;
  max-width: min(68%, 680px);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row.self .message-stack,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row.self .message-stack {
  align-items: flex-end;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message {
  width: auto;
  max-width: 100%;
  max-height: none;
  padding: 9px 12px 10px;
  overflow: visible;
  color: #fff6df;
  background: rgba(25, 15, 9, 0.86);
  border: 2px solid rgba(255, 224, 143, 0.84);
  border-radius: 0;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.34);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message.self,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message.self {
  color: #2b1607;
  background: rgba(255, 211, 111, 0.92);
  border-color: rgba(88, 49, 17, 0.88);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row[data-message-kind="system"],
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row[data-message-kind="system"] {
  justify-content: center;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row[data-message-kind="system"] .message-stack,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row[data-message-kind="system"] .message-stack {
  max-width: min(76%, 720px);
  align-items: center;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row[data-message-kind="system"] .message-avatar,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row[data-message-kind="system"] .message-avatar {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-row[data-message-kind="system"] .message,
body[data-shell-variant="creative-terminal"] .creative-chat-log .message-row[data-message-kind="system"] .message {
  color: #f8ddb0;
  text-align: center;
  background: rgba(34, 21, 12, 0.72);
  border-color: rgba(218, 172, 86, 0.64);
}

@media (max-width: 820px) {
  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
  body[data-shell-variant="creative-terminal"] .creative-chat-frame {
    top: 142px;
    left: 8px;
    right: 8px;
    bottom: 78px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
  body[data-shell-variant="creative-terminal"] .creative-chat-log {
    padding: 0 8px 10px;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log .message-stack,
  body[data-shell-variant="creative-terminal"] .creative-chat-log .message-stack {
    max-width: 78%;
  }
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-log,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-chat-frame,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-chat-log {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 820px) {
  body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
}

/* Absolute final overrides for the scene-layer contract. Keep these last. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
  background:
    url("assets/pixel/composed/hub-main-city-scene-v1-256.png") center / cover no-repeat,
    #15130f;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .pixel-map--city {
  display: none;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspots,
body[data-shell-variant="creative-terminal"] .scene-hotspots {
  z-index: var(--scene-z-hotspot);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-chat,
body[data-shell-variant="creative-terminal"] .creative-chat-frame {
  z-index: var(--scene-z-chat);
}

body[data-shell-page="hub"][data-shell-variant="public-square"],
body[data-shell-variant="creative-terminal"] {
  max-width: 100vw;
  overflow-x: hidden !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .city-hub-shell,
body[data-shell-variant="creative-terminal"] .creative-shell {
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
}

body[data-shell-page="hub"][data-shell-variant="public-square"],
body[data-shell-variant="creative-terminal"] {
  background: #090706 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"]::before,
body[data-shell-page="hub"][data-shell-variant="public-square"]::after,
body[data-shell-variant="creative-terminal"]::before,
body[data-shell-variant="creative-terminal"]::after {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  background: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud::before,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail::after,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage::before,
body[data-shell-variant="creative-terminal"] .creative-stage::before,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview-frame::before,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-preview-frame::after {
  content: none !important;
  display: none !important;
  background: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
  overflow: hidden;
  background:
    url("assets/pixel/composed/hub-main-city-scene-v1-256.png") center / cover no-repeat,
    #15130f !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer {
  background-image: none !important;
}

/* Clear-screen mode: only composer hides; rail + HUD stay visible. */
body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-composer {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Hotspots should label the scene, not tint large pieces of the artwork. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:hover,
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:focus-visible,
body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot[aria-expanded="true"],
body[data-shell-variant="creative-terminal"] .scene-hotspot:hover,
body[data-shell-variant="creative-terminal"] .scene-hotspot:focus-visible,
body[data-shell-variant="creative-terminal"] .scene-hotspot[aria-expanded="true"] {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot span,
body[data-shell-variant="creative-terminal"] .scene-hotspot span {
  width: max-content !important;
  max-width: max-content !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.38);
}

/* Clear-screen mode keeps rail + HUD visible; only chat log + composer hide. */

/* Main-city chat must remain WeChat-like bubbles; the SFC fallback forces #timeline to block. */
body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  width: 100% !important;
  gap: 8px !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row.self {
  justify-content: flex-end !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row.self .message-avatar {
  order: 2 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  width: auto !important;
  max-width: min(68%, 680px) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row.self .message-stack {
  align-items: flex-end !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message {
  width: auto !important;
  max-width: 100% !important;
  padding: 9px 12px 10px !important;
  color: #17110b !important;
  background: rgba(255, 245, 221, 0.94) !important;
  border: 2px solid rgba(96, 61, 28, 0.72) !important;
  border-radius: 0 !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.34) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message.self {
  color: #14100b !important;
  background: rgba(255, 221, 137, 0.96) !important;
  border-color: rgba(88, 49, 17, 0.88) !important;
}

/* Composer final contract: one long adaptive input field plus a send button. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer {
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: stretch !important;
  gap: 10px !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 52px !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: start !important;
  column-gap: 12px !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field-label {
  padding-top: 6px !important;
  white-space: nowrap !important;
  line-height: 1.25 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer textarea {
  width: 100% !important;
  min-height: 36px !important;
  max-height: 118px !important;
  padding-top: 6px !important;
  color: #241409 !important;
  caret-color: #241409 !important;
  overflow-y: auto !important;
  align-self: start !important;
  line-height: 1.45 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer textarea::placeholder {
  color: rgba(36, 20, 9, 0.44) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer #composer-send {
  align-self: stretch !important;
}

@media (max-width: 820px) {
  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer {
    grid-template-columns: minmax(0, 1fr) 76px !important;
    align-items: stretch !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: auto !important;
    grid-template-columns: 1fr !important;
    row-gap: 3px !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field-label {
    padding-top: 0 !important;
    font-size: 12px !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer #composer-send {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 76px !important;
    min-width: 76px !important;
    min-height: 100% !important;
  }

  /* Mobile uses cropped scene art today; keep only non-interactive visible-scene labels. */
  body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspots,
  body[data-shell-variant="creative-terminal"] .scene-hotspots {
    display: block !important;
    pointer-events: none !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot,
  body[data-shell-variant="creative-terminal"] .scene-hotspot {
    display: none !important;
    pointer-events: none !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot--plaza {
    left: 38% !important;
    top: 17% !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: grid !important;
    background: transparent !important;
    border: 0 !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot--plaza span {
    opacity: 1 !important;
  }
}

@media (max-width: 820px) {
  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
    background:
      url("assets/pixel/composed/hub-main-city-scene-v1-mobile-256.png") center / cover no-repeat,
      #15130f !important;
  }

  body[data-time-of-day="day"][data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
    background:
      url("assets/pixel/composed/hub-main-city-scene-v1-mobile-day-256.png") center / cover no-repeat,
      #c7b88c !important;
  }

  body[data-shell-variant="creative-terminal"] .creative-stage {
    background:
      linear-gradient(180deg, rgba(12, 8, 5, 0.04), rgba(12, 8, 5, 0.1)),
      url("assets/pixel/composed/creative-room-scene-v2-mobile-256.png") center / cover no-repeat,
      #15130f !important;
  }

  body[data-time-of-day="day"][data-shell-variant="creative-terminal"] .creative-stage {
    background:
      linear-gradient(180deg, rgba(255, 231, 178, 0.03), rgba(255, 231, 178, 0.08)),
      var(--creative-scene-image, url("assets/pixel/composed/creative-room-scene-v2-mobile-day-256.png")) center / cover no-repeat,
      #c9b58c !important;
  }
}

/* Interaction polish: clear-screen mode becomes the explicit scene/hotspot mode. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage,
body[data-shell-variant="creative-terminal"] .creative-stage {
  cursor: zoom-out;
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .creative-stage {
  cursor: zoom-in;
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspots,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspots {
  z-index: var(--scene-z-hotspot-clear) !important;
  pointer-events: auto !important;
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot {
  pointer-events: auto !important;
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 0;
}

body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:hover span,
body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot:focus-visible span,
body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot[aria-expanded="true"] span,
body.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible.scene-clear-mode[data-shell-page="hub"][data-shell-variant="public-square"] .scene-hotspot span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot:hover span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot:focus-visible span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot[aria-expanded="true"] span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 1;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message,
body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message *,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message * {
  opacity: 1 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-header,
body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-meta,
body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-time,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-header,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-meta,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-time {
  color: rgba(36, 22, 10, 0.72) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message:not(.self),
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message:not(.self) {
  color: #17110b !important;
  background: rgba(255, 245, 221, 0.96) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message:not(.self) .message-body,
body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message:not(.self) .message-body *,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message:not(.self) .message-body,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message:not(.self) .message-body * {
  color: #17110b !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message.self,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message.self {
  color: #14100b !important;
  background: rgba(255, 221, 137, 0.96) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message.self .message-body,
body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message.self .message-body *,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message.self .message-body,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message.self .message-body * {
  color: #14100b !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row[data-message-kind="system"] .message,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row[data-message-kind="system"] .message {
  color: #fff2c9 !important;
  background: rgba(30, 18, 10, 0.88) !important;
  border-color: rgba(247, 210, 118, 0.82) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row[data-message-kind="system"] .message *,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row[data-message-kind="system"] .message * {
  color: #fff2c9 !important;
}

/* Review polish 2026-04-25: scene pages keep art clear, title chrome centralized, chat reads like IM. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hero,
body[data-shell-variant="creative-terminal"] .creative-stage-top {
  display: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud,
body[data-shell-variant="creative-terminal"] .creative-hud {
  position: relative !important;
  justify-content: flex-end !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud .hud-left,
body[data-shell-variant="creative-terminal"] .creative-hud .hud-left {
  display: contents !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud .hud-rail-toggle,
body[data-shell-variant="creative-terminal"] .creative-hud .hud-rail-toggle {
  position: absolute !important;
  left: 14px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .hub-hud-copy,
body[data-shell-variant="creative-terminal"] .creative-hud-copy {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  align-items: center !important;
  text-align: center !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud .hud-title,
body[data-shell-variant="creative-terminal"] .creative-hud .hud-title {
  line-height: 0.95 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log {
  gap: 14px !important;
  padding-inline: 16px !important;
  scroll-padding-block: 18px !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row {
  gap: 10px !important;
  margin: 0 0 clamp(8px, 1vh, 12px) !important;
  animation: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row[data-grouped="true"],
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row[data-grouped="true"] {
  margin-top: 0 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row[data-grouped="true"] .message-avatar,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row[data-grouped="true"] .message-avatar {
  opacity: 1 !important;
  visibility: visible !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-avatar,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-avatar {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  display: grid !important;
  place-items: center !important;
  color: #fff5ce !important;
  background: linear-gradient(180deg, #d88a2d, #945016) !important;
  border: 2px solid rgba(255, 231, 166, 0.88) !important;
  border-radius: 50% !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.34) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row.self .message-avatar,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row.self .message-avatar {
  order: 2 !important;
  background: linear-gradient(180deg, #19a177, #096b5d) !important;
  border-color: rgba(178, 255, 225, 0.86) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-stack,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-stack {
  max-width: min(72%, 680px) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message {
  padding: 8px 12px 9px !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.26), 0 10px 22px rgba(18, 10, 4, 0.12) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message:not(.self),
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message:not(.self) {
  border-top-left-radius: 6px !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message.self,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message.self {
  border-top-right-radius: 6px !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-header,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-header {
  margin-bottom: 5px !important;
  gap: 12px !important;
  align-items: center !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-meta,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-meta {
  gap: 6px !important;
  align-items: center !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-sender,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-sender {
  color: #9b5b16 !important;
  font-weight: 800 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-role,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-role {
  color: rgba(36, 22, 10, 0.48) !important;
  font-weight: 700 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-time,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-time {
  color: rgba(36, 22, 10, 0.58) !important;
  font-weight: 700 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-body,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-body {
  line-height: 1.58 !important;
}

/* 2026-04-26: keep main-city chrome consistent with room/world-entry and let room clear-screen open fully. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud {
  background:
    linear-gradient(90deg, rgba(42, 27, 14, 0.96), rgba(77, 48, 22, 0.90)),
    repeating-linear-gradient(90deg, rgba(255, 232, 159, 0.10) 0 2px, transparent 2px 18px) !important;
  border: 2px solid #f1c978 !important;
  box-shadow: 0 0 0 3px rgba(28, 16, 8, 0.92), 0 8px 0 rgba(0, 0, 0, 0.32) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail {
  background:
    linear-gradient(180deg, rgba(242, 218, 151, 0.96), rgba(181, 139, 73, 0.92)),
    repeating-linear-gradient(0deg, rgba(43, 27, 14, 0.10) 0 2px, transparent 2px 24px) !important;
  border: 2px solid #2b1c11 !important;
  box-shadow: 0 0 0 3px rgba(246, 219, 151, 0.55), 0 8px 0 rgba(0, 0, 0, 0.28) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail .rail-item {
  color: #21140b !important;
  background: rgba(255, 239, 178, 0.72) !important;
  border: 2px solid rgba(40, 25, 13, 0.84) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail .rail-item.is-active {
  color: #fff4c9 !important;
  background: #8d3d1b !important;
  border-color: #fff1aa !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer {
  align-items: end !important;
  background:
    linear-gradient(180deg, rgba(255, 232, 159, 0.96), rgba(202, 151, 80, 0.92)) !important;
  border: 2px solid #2b1c11 !important;
  box-shadow: 0 0 0 3px rgba(246, 219, 151, 0.60), 0 8px 0 rgba(0, 0, 0, 0.28) !important;
}

/* 2026-04-28: shared IM scene chrome baseline. */
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud,
body[data-shell-variant="creative-terminal"] .creative-hud {
  min-height: 56px !important;
  display: flex !important;
  align-items: center !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .hub-hud-copy,
body[data-shell-variant="creative-terminal"] .creative-hud-copy {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 0 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-hud .hud-title,
body[data-shell-variant="creative-terminal"] .creative-hud .hud-title {
  min-height: 34px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: var(--creative-font-body, "Noto Sans SC", "PingFang SC", sans-serif) !important;
  font-size: clamp(28px, 3.2vw, 34px) !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0.02em !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .hub-hud-kicker,
body[data-shell-variant="creative-terminal"] .hud-kicker {
  font-family: var(--creative-font-pixel, "VT323", "Noto Sans SC", monospace) !important;
  line-height: 1 !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail,
body[data-shell-variant="creative-terminal"] .creative-rail {
  background:
    linear-gradient(180deg, rgba(45, 28, 15, 0.96), rgba(24, 14, 8, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 230, 150, 0.07) 0 1px, transparent 1px 22px) !important;
  border: 2px solid #f1c978 !important;
  box-shadow: 0 0 0 3px rgba(28, 16, 8, 0.92), 0 8px 0 rgba(0, 0, 0, 0.32) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail .rail-item,
body[data-shell-variant="creative-terminal"] .creative-rail .rail-item {
  color: #fff2c9 !important;
  background: rgba(255, 242, 201, 0.08) !important;
  border: 2px solid rgba(241, 201, 120, 0.62) !important;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail .rail-item:hover,
body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail .rail-item:focus-visible,
body[data-shell-variant="creative-terminal"] .creative-rail .rail-item:hover,
body[data-shell-variant="creative-terminal"] .creative-rail .rail-item:focus-visible {
  color: #fff8d8 !important;
  background: rgba(255, 242, 201, 0.16) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail .rail-item.is-active,
body[data-shell-variant="creative-terminal"] .creative-rail .rail-item.is-active {
  color: #23150b !important;
  background: linear-gradient(180deg, #ffe9a9, #d69d4c) !important;
  border-color: #fff1aa !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage::after,
body[data-shell-variant="creative-terminal"] .creative-stage::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  pointer-events: none !important;
  opacity: 0 !important;
  transition: opacity 180ms ease;
}

/* Day scenes must come from separate assets; do not add a white/screen tint over the art. */
body[data-time-of-day="day"][data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage::after,
body[data-time-of-day="day"][data-shell-variant="creative-terminal"] .creative-stage::after {
  opacity: 0 !important;
  background: none !important;
  mix-blend-mode: normal !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field,
body[data-shell-variant="creative-terminal"] .creative-composer-field {
  min-height: 44px !important;
  max-height: min(28vh, 190px) !important;
  grid-template-columns: auto auto minmax(0, 1fr) !important;
  align-items: center !important;
  overflow: hidden !important;
}

body[data-shell-variant="creative-terminal"] .creative-composer-field {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  gap: 8px !important;
  justify-content: stretch !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-field-label.public-square-mention-chip {
  min-width: 76px;
  min-height: 30px;
  padding: 4px 10px;
  display: inline-grid;
  place-items: center;
  color: #1c1209 !important;
  background: rgba(255, 226, 145, 0.90) !important;
  border: 2px solid rgba(67, 37, 16, 0.86) !important;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 rgba(120, 70, 25, 0.22);
  cursor: pointer;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer textarea,
body[data-shell-variant="creative-terminal"] .creative-composer textarea {
  min-height: 34px !important;
  max-height: 120px !important;
  resize: vertical !important;
  overflow-y: auto !important;
  padding-block: 5px !important;
  align-self: center !important;
  line-height: 24px !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-pending-failed,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-pending-failed {
  animation: none !important;
  background-image: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .message-pending-actions,
body[data-shell-variant="creative-terminal"] .message-pending-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .message-actions,
body[data-shell-variant="creative-terminal"] .message-actions {
  gap: 4px;
  margin-top: 8px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .message-action,
body[data-shell-variant="creative-terminal"] .message-action {
  min-height: 26px;
  padding: 3px 8px;
  border: 2px solid rgba(255, 213, 128, 0.46);
  border-radius: 0;
  color: #fff2c9;
  background: rgba(43, 28, 17, 0.82);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
  font: 700 11px/1 var(--creative-font-pixel);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .message-pending-retry,
body[data-shell-variant="creative-terminal"] .message-pending-retry {
  min-height: 28px;
  padding: 4px 10px;
  border: 2px solid rgba(255, 213, 128, 0.74);
  border-radius: 0;
  color: #fff2c9;
  background: #8f4025;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
  font: 700 12px/1 var(--creative-font-pixel);
  cursor: pointer;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .message-pending-retry:disabled,
body[data-shell-variant="creative-terminal"] .message-pending-retry:disabled {
  cursor: wait;
  opacity: 0.62;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-trigger,
body[data-shell-variant="creative-terminal"] .composer-symbol-trigger {
  min-width: 34px;
  min-height: 30px;
  padding: 3px 8px;
  color: #21140b;
  background: rgba(255, 236, 169, 0.92);
  border: 2px solid rgba(67, 37, 16, 0.86);
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(120, 70, 25, 0.22);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-trigger:hover,
body[data-shell-variant="creative-terminal"] .composer-symbol-trigger:hover,
body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-trigger[aria-expanded="true"],
body[data-shell-variant="creative-terminal"] .composer-symbol-trigger[aria-expanded="true"] {
  color: #fff4c9;
  background: #8d3d1b;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-menu,
body[data-shell-variant="creative-terminal"] .composer-symbol-menu {
  position: fixed !important;
  left: clamp(170px, 16vw, 320px) !important;
  bottom: 94px !important;
  z-index: var(--scene-z-popover) !important;
  width: min(620px, calc(100% - 150px)) !important;
  max-height: min(58vh, 520px) !important;
  padding: 10px !important;
  display: block !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-color: rgba(92, 51, 20, 0.62) rgba(255, 239, 178, 0.36);
  scrollbar-width: thin;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none !important;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans Symbols 2", "Apple Color Emoji", sans-serif !important;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.98), rgba(225, 181, 104, 0.96)) !important;
  border: 2px solid #2b1c11 !important;
  box-shadow: 0 0 0 3px rgba(246, 219, 151, 0.55), 0 10px 0 rgba(0, 0, 0, 0.32) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-menu[hidden],
body[data-shell-variant="creative-terminal"] .composer-symbol-menu[hidden] {
  display: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-category,
body[data-shell-variant="creative-terminal"] .composer-symbol-category {
  padding: 8px;
  background: rgba(255, 248, 222, 0.42);
  border: 1px solid rgba(72, 42, 18, 0.36);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-menu.is-tabbed .composer-symbol-category[hidden],
body[data-shell-variant="creative-terminal"] .composer-symbol-menu.is-tabbed .composer-symbol-category[hidden] {
  display: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-menu.is-tabbed .composer-symbol-category,
body[data-shell-variant="creative-terminal"] .composer-symbol-menu.is-tabbed .composer-symbol-category {
  margin-top: 8px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-category + .composer-symbol-category,
body[data-shell-variant="creative-terminal"] .composer-symbol-category + .composer-symbol-category {
  margin-top: 8px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-tabs,
body[data-shell-variant="creative-terminal"] .composer-symbol-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -2px -2px 8px;
  padding: 2px 2px 8px;
  background: linear-gradient(180deg, rgba(255, 240, 190, 0.98), rgba(244, 217, 151, 0.92));
  border-bottom: 1px solid rgba(72, 42, 18, 0.42);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-heading,
body[data-shell-variant="creative-terminal"] .composer-symbol-heading {
  margin: 0 0 6px;
  color: #5b3214;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-grid,
body[data-shell-variant="creative-terminal"] .composer-symbol-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-menu button,
body[data-shell-variant="creative-terminal"] .composer-symbol-menu button {
  min-height: 34px;
  padding: 5px 8px;
  color: #21140b;
  background: rgba(255, 248, 222, 0.82);
  border: 2px solid rgba(58, 35, 15, 0.70);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans Symbols 2", "Apple Color Emoji", sans-serif !important;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-menu button:hover,
body[data-shell-variant="creative-terminal"] .composer-symbol-menu button:hover {
  background: rgba(255, 226, 145, 0.96);
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-tabs .composer-symbol-tab,
body[data-shell-variant="creative-terminal"] .composer-symbol-tabs .composer-symbol-tab {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 9px;
  color: #4f2a11;
  background: rgba(255, 248, 222, 0.88);
  border-color: rgba(82, 47, 18, 0.72);
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-tabs .composer-symbol-tab.is-active,
body[data-shell-variant="creative-terminal"] .composer-symbol-tabs .composer-symbol-tab.is-active {
  color: #fff4c9;
  background: #8d3d1b;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

/* Creative clear-screen: keep layout, only hide chat + composer. */
}

body.scene-intro-seen[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row[data-message-kind="system"],
body.scene-intro-seen[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row[data-message-kind="system"] {
  display: none !important;
}

body.scene-intro-first[data-shell-variant="creative-terminal"] .creative-stage::after {
  content: "点击空白处收起界面" !important;
  position: absolute !important;
  inset: auto auto clamp(154px, 23vh, 220px) 50% !important;
  z-index: calc(var(--scene-z-chat) + 1) !important;
  width: max-content !important;
  max-width: min(240px, calc(100% - 32px)) !important;
  padding: 7px 10px !important;
  color: #fff2c9 !important;
  font: 700 12px/1.2 var(--creative-font-body, "Noto Sans SC", "PingFang SC", sans-serif) !important;
  text-align: center !important;
  background: rgba(31, 18, 9, 0.88) !important;
  border: 2px solid rgba(241, 201, 120, 0.82) !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.34) !important;
  opacity: 1 !important;
  pointer-events: none !important;
  transform: translateX(-50%) !important;
  animation: scene-intro-pulse 1800ms ease-in-out 2;
}

body.scene-intro-seen[data-shell-variant="creative-terminal"] .creative-stage::after {
  content: "" !important;
  opacity: 0 !important;
}

@keyframes scene-intro-pulse {
  0%, 100% { opacity: 0.48; }
  50% { opacity: 1; }
}

@media (max-width: 820px) {
  body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log,
  body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log {
    padding-inline: 10px !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-menu,
  body[data-shell-variant="creative-terminal"] .composer-symbol-menu {
    left: 12px !important;
    right: 12px !important;
    bottom: 74px !important;
    width: auto !important;
    max-height: min(52vh, 430px) !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .composer-symbol-grid,
  body[data-shell-variant="creative-terminal"] .composer-symbol-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-avatar,
  body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-avatar {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    font-size: 11px !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-stack,
  body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-stack {
    max-width: 76% !important;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .message-pending-retry,
  body[data-shell-variant="creative-terminal"] .message-pending-retry {
    min-height: 44px !important;
    padding: 8px 14px !important;
    font-size: 14px !important;
  }
}

/* Phase 1 IM hardening: keep the composed room image and hotspots in the same
   16:9 coordinate space, and keep the mobile composer above safe areas. */
body[data-shell-variant="creative-terminal"] .creative-stage {
  min-height: 0;
  width: 100%;
  height: 100%;
  justify-self: stretch;
  align-self: stretch;
  background:
    var(--creative-scene-image, url("assets/pixel/composed/creative-room-scene-v2-256.png")) center / contain no-repeat,
    #1b110a !important;
}

body[data-shell-variant="creative-terminal"] .scene-hotspots {
  aspect-ratio: var(--creative-scene-aspect);
  width: 100%;
  max-height: 100%;
  margin: auto;
}

body[data-shell-variant="creative-terminal"] .creative-composer textarea {
  max-height: 120px !important;
  resize: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .timeline-skeleton-row,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-row {
  opacity: 0.82 !important;
  pointer-events: none !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .timeline-skeleton-avatar,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-avatar {
  color: transparent !important;
  background:
    linear-gradient(90deg, rgba(255, 242, 201, 0.12), rgba(255, 242, 201, 0.24), rgba(255, 242, 201, 0.12)) !important;
  background-size: 180% 100% !important;
  border-color: rgba(241, 201, 120, 0.34) !important;
  animation: timeline-skeleton-pulse 1500ms ease-in-out infinite;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .timeline-skeleton-bubble,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-bubble {
  width: var(--skeleton-width, 68%) !important;
  min-width: 124px !important;
  max-width: 100% !important;
  padding: 10px 12px !important;
  display: grid !important;
  gap: 8px !important;
  justify-self: start !important;
  background: rgba(25, 15, 9, 0.70) !important;
  border: 2px solid rgba(255, 224, 143, 0.36) !important;
  border-radius: 0 !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .message-row.self .timeline-skeleton-bubble,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row.self .timeline-skeleton-bubble {
  justify-self: end !important;
  background: rgba(142, 64, 37, 0.48) !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .timeline-skeleton-line,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-line {
  height: 9px !important;
  display: block !important;
  background:
    linear-gradient(90deg, rgba(255, 242, 201, 0.12), rgba(255, 242, 201, 0.30), rgba(255, 242, 201, 0.12)) !important;
  background-size: 180% 100% !important;
  animation: timeline-skeleton-pulse 1500ms ease-in-out infinite;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .timeline-skeleton-line-primary,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-line-primary {
  width: 100% !important;
}

body[data-shell-page="hub"][data-shell-variant="public-square"] #timeline.public-square-log .timeline-skeleton-line-secondary,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-line-secondary {
  width: 58% !important;
}

@keyframes timeline-skeleton-pulse {
  0% { background-position: 120% 0; }
  100% { background-position: -80% 0; }
}

/* Phase 2 IM rail: keep conversations visible as a compact session list. */
body[data-shell-variant="creative-terminal"] .creative-layout {
  grid-template-columns: var(--im-scene-rail-width, 220px) minmax(0, 1fr) !important;
}

body[data-shell-variant="creative-terminal"] .creative-rail {
  width: auto !important;
  min-width: 0 !important;
}

body[data-shell-variant="creative-terminal"] .rail-title,
body[data-shell-variant="creative-terminal"] .creative-rail-divider {
  display: block !important;
}

body[data-shell-variant="creative-terminal"] .creative-room-list,
body[data-shell-variant="creative-terminal"] .creative-rail .room-section-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

body[data-shell-variant="creative-terminal"] .creative-room-list {
  flex: 1 1 auto !important;
  min-height: 112px !important;
  overflow: auto !important;
}

@media (max-width: 820px) {
  body[data-shell-variant="creative-terminal"] .creative-shell {
    position: relative;
  }

  body[data-shell-variant="creative-terminal"] .creative-layout {
    grid-template-columns: 1fr !important;
  }

  body.rail-drawer-open[data-shell-variant="creative-terminal"] .creative-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: calc(var(--scene-z-rail-mobile) - 1);
    background: rgba(10, 6, 4, 0.48);
    pointer-events: none;
  }

  body[data-shell-variant="creative-terminal"] .creative-rail {
    position: fixed !important;
    top: calc(56px + env(safe-area-inset-top)) !important;
    left: 8px !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    width: min(232px, calc(100vw - 28px)) !important;
    max-height: none !important;
    transform: translateX(calc(-100% - 16px)) !important;
    transition: transform 180ms ease;
  }

  body[data-shell-variant="creative-terminal"] .creative-rail.open {
    transform: translateX(0) !important;
  }

  body.rail-drawer-open[data-shell-page="hub"][data-shell-variant="public-square"] .city-hub-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: calc(var(--scene-z-rail-mobile) - 1);
    background: rgba(10, 6, 4, 0.48);
    pointer-events: none;
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail {
    position: fixed;
    top: 58px;
    left: 8px;
    bottom: 8px;
    width: 186px;
    z-index: 40;
    transform: translateX(-108%);
    transition: transform 160ms ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.42);
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-rail.open {
    transform: translateX(0);
  }

  body[data-shell-page="hub"][data-shell-variant="public-square"] .public-square-composer,
body[data-shell-variant="creative-terminal"] .creative-composer {
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding-bottom: calc(7px + env(safe-area-inset-bottom));
  }

  body[data-shell-variant="creative-terminal"] .chat-focus-toggle {
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* 2026-05-18 IM layout hardening:
   keep the rail and stage frame aligned while the scene art remains contained. */
body[data-shell-variant="creative-terminal"] .creative-shell {
  --im-scene-rail-width: 220px;
}

body[data-shell-variant="creative-terminal"] .creative-layout {
  grid-template-columns: var(--im-scene-rail-width) minmax(0, 1fr) !important;
  align-items: stretch !important;
  min-height: 0 !important;
}

body[data-shell-variant="creative-terminal"] .creative-stage {
  min-height: 0 !important;
  height: 100% !important;
  aspect-ratio: auto !important;
}

body[data-shell-variant="creative-terminal"] .scene-hotspots {
  inset: 0 !important;
  width: min(100%, calc(100vh * var(--creative-scene-aspect))) !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 90ms linear, visibility 90ms linear !important;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot:hover span,
body[data-shell-variant="creative-terminal"] .scene-hotspot:focus-visible span,
body[data-shell-variant="creative-terminal"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 1 !important;
  visibility: visible !important;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot[aria-expanded="true"]:not(:hover):not(:focus-visible) span {
  opacity: 0 !important;
  visibility: hidden !important;
}

body.scene-hotspot-labels-visible[data-shell-variant="creative-terminal"] .scene-hotspot[aria-expanded="true"]:not(:hover):not(:focus-visible) span {
  opacity: 1 !important;
  visibility: visible !important;
}

body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 0;
  visibility: visible;
}

body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot:hover span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot:focus-visible span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot[aria-expanded="true"] span,
body.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible.scene-clear-mode[data-shell-variant="creative-terminal"] .scene-hotspot span {
  opacity: 1 !important;
  visibility: visible !important;
}

/* 2026-05-20 realness fix:
   message bubbles remain clickable, but the transparent chat plane no longer
   blocks hover/click access to room hotspots behind empty chat space. */
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log {
  pointer-events: none !important;
}

body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-row,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-stack {
  pointer-events: none !important;
}

body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message-avatar,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message button,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .message a {
  pointer-events: auto !important;
}

body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-row,
body[data-shell-variant="creative-terminal"] #timeline.creative-chat-log .timeline-skeleton-row * {
  pointer-events: none !important;
}

body[data-shell-variant="creative-terminal"] .scene-hotspots {
  pointer-events: none !important;
}

body[data-shell-variant="creative-terminal"] .scene-hotspot {
  pointer-events: auto !important;
}

/* Final day-scene overrides sit after legacy scene rules so computed backgrounds
   actually switch assets instead of being overwritten by older fallbacks. */
body[data-time-of-day="day"][data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
  background:
    url("assets/pixel/composed/hub-main-city-scene-v1-day-256.png") center / cover no-repeat,
    #c7b88c !important;
}

body[data-time-of-day="day"][data-shell-variant="creative-terminal"] .creative-stage {
  background:
    var(--creative-scene-image, url("assets/pixel/composed/creative-room-scene-v2-day-256.png")) center / contain no-repeat,
    #c9b58c !important;
}

@media (max-width: 820px) {
  body[data-shell-variant="creative-terminal"] .creative-shell {
    --im-scene-rail-width: min(232px, calc(100vw - 28px));
  }

  body[data-shell-variant="creative-terminal"] .creative-layout {
    grid-template-columns: 1fr !important;
  }

  body[data-shell-variant="creative-terminal"] .creative-stage {
    min-height: calc(100svh - 74px) !important;
  }

  body[data-time-of-day="day"][data-shell-page="hub"][data-shell-variant="public-square"] .public-square-stage {
    background:
      url("assets/pixel/composed/hub-main-city-scene-v1-mobile-day-256.png") center / cover no-repeat,
      #c7b88c !important;
  }

  body[data-time-of-day="day"][data-shell-variant="creative-terminal"] .creative-stage {
    background:
      linear-gradient(180deg, rgba(255, 231, 178, 0.03), rgba(255, 231, 178, 0.08)),
      var(--creative-scene-image, url("assets/pixel/composed/creative-room-scene-v2-mobile-day-256.png")) center / cover no-repeat,
      #c9b58c !important;
  }
}
