.world-system-shell {
  --world-accent: #ff2244;
  --world-secondary: #00e5ff;
  --world-gold: #f5c842;
  --world-bg: #050506;
  --world-panel: rgba(10, 10, 12, 0.78);
  --world-line: rgba(255, 255, 255, 0.12);
  --world-muted: #84848c;
  background: var(--world-bg);
  color: #f7f3f5;
  font-family: "Space Grotesk", system-ui, sans-serif;
  letter-spacing: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.world-system-shell * {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.world-hero {
  position: relative;
  min-height: 94svh;
  overflow: hidden;
  display: grid;
  align-items: end;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  isolation: isolate;
}

.world-hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.62;
  filter: contrast(1.1) saturate(0.85);
  z-index: -3;
}

.world-hero:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 5, 6, 0.96) 0%, rgba(5, 5, 6, 0.72) 42%, rgba(5, 5, 6, 0.34) 100%),
    linear-gradient(0deg, #050506 0%, rgba(5, 5, 6, 0.28) 44%, rgba(5, 5, 6, 0.62) 100%);
  z-index: -2;
}

.world-hero:after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(90deg, #000 0%, transparent 72%);
  z-index: -1;
}

.world-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 5, 6, 0.42);
  backdrop-filter: blur(18px);
}

.world-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Mono", monospace;
  font-weight: 700;
  font-size: 18px;
}

.world-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #050506;
  background: var(--world-accent);
  clip-path: polygon(0 0, 100% 0, 100% 74%, 74% 100%, 0 100%);
}

.world-nav a,
.world-nav button,
.world-button,
.world-chip,
.effect-button {
  font-family: "Space Mono", monospace;
  letter-spacing: 0;
}

.world-nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: #bcbcc3;
  font-size: 12px;
}

.world-nav-links a:hover {
  color: white;
}

.world-hero-grid {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 112px 0 54px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.72fr);
  gap: clamp(28px, 5vw, 68px);
  align-items: end;
}

.world-hero-grid > * {
  min-width: 0;
}

.world-title {
  max-width: 760px;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.92;
  font-weight: 700;
}

.world-title span {
  color: var(--world-accent);
}

.world-copy {
  max-width: 590px;
  margin-top: 24px;
  color: #c6c0c4;
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.world-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.world-button {
  min-height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f7f3f5;
  font-size: 12px;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.world-button.primary {
  background: var(--world-accent);
  border-color: var(--world-accent);
  color: #050506;
}

.world-button:hover,
.effect-button:hover {
  transform: translateY(-2px);
  border-color: var(--world-accent);
}

.world-command {
  background: rgba(5, 5, 6, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.48);
  padding: 14px;
  backdrop-filter: blur(18px);
}

.world-feed {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--world-accent), transparent 55%);
  background: #08080a;
}

.world-feed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.78;
}

.world-feed:after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 58% 44%, color-mix(in srgb, var(--world-accent), transparent 78%), transparent 28%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.86), transparent 48%);
  pointer-events: none;
}

.world-hud {
  position: absolute;
  inset: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.world-chip {
  width: max-content;
  padding: 6px 8px;
  color: var(--world-secondary);
  background: rgba(0, 0, 0, 0.64);
  border: 1px solid rgba(0, 229, 255, 0.28);
  font-size: 10px;
  font-weight: 700;
}

.world-metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.world-metric {
  min-height: 72px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.world-metric strong {
  display: block;
  color: #fff;
  font-family: "Space Mono", monospace;
  font-size: 20px;
  line-height: 1;
}

.world-metric span {
  display: block;
  margin-top: 8px;
  color: var(--world-muted);
  font-size: 10px;
  font-family: "Space Mono", monospace;
}

.world-system-section {
  padding: 76px clamp(16px, 4vw, 54px);
}

.world-system-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.system-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 0.52fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 26px;
}

.system-heading h2 {
  font-size: clamp(30px, 4vw, 58px);
  line-height: 1;
  font-weight: 700;
}

.system-heading p {
  color: #aaa5aa;
  line-height: 1.6;
}

.system-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}

.system-panel {
  background: var(--world-panel);
  border: 1px solid var(--world-line);
  padding: 16px;
  min-height: 220px;
}

.system-panel h3 {
  font-size: 13px;
  font-family: "Space Mono", monospace;
  font-weight: 700;
  color: #f7f3f5;
  margin-bottom: 12px;
}

.wireframe-board {
  position: relative;
  height: 330px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.wire-block {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--world-accent), transparent 36%);
  background: color-mix(in srgb, var(--world-accent), transparent 90%);
  color: #ddd;
  font: 10px "Space Mono", monospace;
  padding: 8px;
}

.wire-hero { left: 4%; top: 8%; width: 54%; height: 42%; }
.wire-portal { right: 5%; top: 8%; width: 30%; height: 62%; }
.wire-chat { left: 4%; bottom: 8%; width: 34%; height: 28%; }
.wire-schema { left: 42%; bottom: 8%; width: 24%; height: 28%; }
.wire-stripe { right: 5%; bottom: 8%; width: 25%; height: 18%; }

.world-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.world-tabs button {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #999;
  background: rgba(255, 255, 255, 0.04);
  font: 11px "Space Mono", monospace;
}

.world-tabs button[aria-selected="true"] {
  color: #050506;
  background: var(--world-secondary);
  border-color: var(--world-secondary);
}

.code-window {
  min-height: 274px;
  overflow: auto;
  padding: 14px;
  background: #050507;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d6d6de;
  font: 12px/1.65 "Space Mono", monospace;
  white-space: pre;
}

.interaction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.world-chat-log {
  height: 230px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.world-message {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  padding: 10px;
  color: #c9c7cc;
  font-size: 13px;
}

.world-message.system {
  border-color: color-mix(in srgb, var(--world-accent), transparent 60%);
  color: #fff;
}

.world-chat-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.world-chat-form input {
  flex: 1;
  min-width: 0;
  background: #070709;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 11px 12px;
  font: 12px "Space Mono", monospace;
}

.world-state {
  position: relative;
  min-height: 292px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--world-accent), transparent 52%);
  background:
    radial-gradient(circle at var(--pulse-x, 52%) var(--pulse-y, 44%), color-mix(in srgb, var(--world-accent), transparent 68%), transparent 24%),
    linear-gradient(135deg, rgba(255, 34, 68, 0.08), rgba(0, 229, 255, 0.06)),
    #070709;
}

.world-state:before,
.world-state:after {
  content: "";
  position: absolute;
  inset: 16%;
  border: 1px solid color-mix(in srgb, var(--world-accent), transparent 50%);
  transform: rotate(45deg) scale(var(--portal-scale, 0.72));
  animation: portalSpin 8s linear infinite;
}

.world-state:after {
  inset: 28%;
  animation-duration: 5s;
  animation-direction: reverse;
}

.state-readout {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  z-index: 2;
}

.state-readout div {
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.state-readout span {
  display: block;
  color: #85858c;
  font: 10px "Space Mono", monospace;
}

.state-readout strong {
  display: block;
  margin-top: 5px;
  color: #fff;
  font: 13px "Space Mono", monospace;
}

.effect-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.horror-buddy-section {
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 34, 68, 0.12), transparent 28%),
    linear-gradient(180deg, #050506, #09070a 52%, #050506);
}

.horror-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.horror-portrait {
  display: grid;
  gap: 14px;
}

.horror-silhouette {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(255, 255, 255, 0.14), transparent 7%),
    radial-gradient(ellipse at 50% 42%, rgba(0, 0, 0, 0.1), transparent 12%),
    linear-gradient(90deg, transparent 0%, rgba(255, 34, 68, 0.12) 48%, transparent 100%),
    #020203;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.horror-silhouette:before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12%;
  width: 56%;
  height: 86%;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse at 50% 19%, rgba(20, 20, 24, 0.98) 0 22%, transparent 23%),
    radial-gradient(ellipse at 50% 72%, rgba(9, 9, 12, 0.98) 0 48%, transparent 49%);
  filter: blur(0.2px);
}

.horror-silhouette:after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 8px),
    linear-gradient(90deg, transparent, rgba(255, 34, 68, 0.22), transparent);
  mix-blend-mode: screen;
  opacity: 0.55;
  animation: horrorFlicker 3.8s steps(2, end) infinite;
}

.horror-eye {
  position: absolute;
  top: 28%;
  z-index: 2;
  width: 14px;
  height: 5px;
  background: #fff;
  box-shadow: 0 0 18px #ff2244;
  opacity: 0.82;
  animation: eyeBlink 5.6s infinite;
}

.horror-eye.left { left: calc(50% - 34px); }
.horror-eye.right { left: calc(50% + 20px); }

.horror-namebar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.horror-namebar strong {
  color: #fff;
  font: 700 34px/1 "Space Mono", monospace;
}

.horror-namebar span {
  color: var(--world-muted);
  font-size: 12px;
  text-align: right;
}

.horror-names,
.horror-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.horror-names button,
.horror-traits span {
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cfcfd6;
  font: 11px "Space Mono", monospace;
}

.horror-prompt-panel p,
.memory-stack p {
  color: #bbb7bd;
  font-size: 15px;
  line-height: 1.65;
}

.horror-traits {
  margin: 14px 0;
}

.horror-traits span {
  color: #ffb6c1;
  border-color: rgba(255, 34, 68, 0.28);
}

.horror-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.horror-mode-grid button {
  min-height: 112px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease;
}

.horror-mode-grid button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 34, 68, 0.72);
}

.horror-mode-grid strong,
.horror-mode-grid span {
  display: block;
}

.horror-mode-grid strong {
  color: white;
  font: 700 13px "Space Mono", monospace;
}

.horror-mode-grid span {
  margin-top: 10px;
  color: #aaa4aa;
  font-size: 13px;
  line-height: 1.45;
}

.horror-trigger-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.trigger-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.trigger-list div {
  padding: 10px;
  min-height: 78px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trigger-list strong,
.trigger-list span {
  display: block;
}

.trigger-list strong {
  color: white;
  font: 700 12px "Space Mono", monospace;
}

.trigger-list span {
  margin-top: 8px;
  color: #a8a3aa;
  font-size: 12px;
  line-height: 1.45;
}

.rare-line {
  margin-top: 14px;
  color: #fff !important;
  font-family: "Space Mono", monospace;
}

.brief-builder {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.identity-output-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 16px;
}

.identity-output-row span {
  padding: 7px 9px;
  color: #050506;
  background: #f7f3f5;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font: 700 11px "Space Mono", monospace;
}

.brief-upload {
  display: grid;
  gap: 10px;
}

.brief-upload input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.brief-upload label {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.brief-upload label span {
  color: white;
  font: 700 12px "Space Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brief-upload label small {
  color: var(--world-muted);
  font-size: 12px;
}

.reference-preview {
  min-height: 230px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #050507;
  background-size: 22px 22px;
  color: #777780;
  font: 12px "Space Mono", monospace;
}

.reference-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brief-form {
  display: grid;
  gap: 10px;
}

.brief-form textarea {
  width: 100%;
  min-height: 242px;
  resize: vertical;
  padding: 14px;
  color: white;
  background: #050507;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font: 13px/1.6 "Space Mono", monospace;
}

.prompt-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.prompt-examples button {
  min-height: 70px;
  padding: 10px;
  text-align: left;
  color: #d8d5da;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  line-height: 1.35;
  transition: border-color 180ms ease, transform 180ms ease;
}

.prompt-examples button:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--world-accent), transparent 35%);
}

.persona-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.persona-profile-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: 12px;
  text-align: left;
  color: white;
  background: #050507;
  border: 1px solid color-mix(in srgb, var(--profile-accent), transparent 48%);
  transition: transform 180ms ease, border-color 180ms ease;
}

.persona-profile-card:hover {
  transform: translateY(-4px);
  border-color: var(--profile-accent);
}

.persona-profile-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  transition: transform 500ms ease, opacity 180ms ease;
}

.persona-profile-card:hover img {
  transform: scale(1.04);
  opacity: 0.94;
}

.persona-profile-card:after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.42) 45%, rgba(0, 0, 0, 0.9)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px);
  pointer-events: none;
}

.persona-profile-card > *:not(img) {
  position: relative;
  z-index: 2;
}

.profile-live {
  width: max-content;
  margin-bottom: auto;
  padding: 6px 8px;
  color: #050506;
  background: var(--profile-accent);
  font: 700 10px "Space Mono", monospace;
}

.persona-profile-card strong {
  margin-top: 280px;
  color: white;
  font: 700 24px/1 "Space Mono", monospace;
}

.persona-profile-card small {
  display: block;
  margin-top: 7px;
  color: color-mix(in srgb, var(--profile-accent), white 35%);
  font: 11px/1.35 "Space Mono", monospace;
}

.persona-profile-card p {
  margin-top: 10px;
  color: #d4d0d5;
  font-size: 13px;
  line-height: 1.45;
}

.side-ai {
  position: fixed;
  top: 90px;
  right: 0;
  z-index: 9998;
  display: flex;
  align-items: stretch;
  transform: translateX(calc(100% - 48px));
  transition: transform 260ms cubic-bezier(0.7, 0, 0.16, 1);
}

.side-ai.open {
  transform: translateX(0);
}

.side-ai-tab {
  width: 48px;
  min-height: 180px;
  padding: 10px 6px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  color: #050506;
  background: var(--world-accent);
  border: 1px solid var(--world-accent);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: "Space Mono", monospace;
}

.side-ai-tab span {
  font-weight: 700;
  font-size: 14px;
}

.side-ai-tab strong {
  font-size: 10px;
}

.side-ai-panel {
  width: min(390px, calc(100vw - 48px));
  max-height: calc(100svh - 110px);
  overflow: auto;
  background: rgba(5, 5, 7, 0.96);
  border: 1px solid color-mix(in srgb, var(--world-accent), transparent 42%);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.65);
}

.side-ai-media {
  position: relative;
  height: 360px;
  overflow: hidden;
  background: #020203;
}

.side-ai-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-ai-media:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(5, 5, 7, 0.94));
  pointer-events: none;
}

.side-ai-media button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 7px 9px;
  color: white;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font: 10px "Space Mono", monospace;
}

.side-ai-body {
  padding: 14px;
}

.side-ai-body h3 {
  margin-top: 14px;
  color: white;
  font: 700 30px/1 "Space Mono", monospace;
}

.side-ai-body p {
  margin-top: 10px;
  color: #c9c4ca;
  font-size: 14px;
  line-height: 1.5;
}

.side-ai-lines {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.side-ai-lines span {
  display: block;
  padding: 10px;
  color: #eee;
  background: color-mix(in srgb, var(--world-accent), transparent 88%);
  border: 1px solid color-mix(in srgb, var(--world-accent), transparent 65%);
  font: 12px/1.4 "Space Mono", monospace;
}

.side-ai-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.brief-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.effect-button {
  min-height: 86px;
  padding: 12px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: white;
  transition: transform 180ms ease, border-color 180ms ease;
}

.effect-button strong,
.effect-button span {
  display: block;
}

.effect-button strong {
  font-size: 12px;
}

.effect-button span {
  margin-top: 8px;
  color: var(--world-muted);
  font-size: 10px;
}

.portal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  background: #050506;
}

.portal-overlay.active {
  animation: portalEnter 1400ms cubic-bezier(0.7, 0, 0.16, 1) forwards;
}

.portal-ring {
  width: min(62vw, 480px);
  aspect-ratio: 1;
  border: 2px solid var(--world-accent);
  box-shadow: 0 0 70px color-mix(in srgb, var(--world-accent), transparent 40%);
  transform: rotate(45deg);
}

.world-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  background: #0b0b0d;
  border: 1px solid var(--world-accent);
  color: #fff;
  font: 12px "Space Mono", monospace;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.world-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes portalSpin {
  to { transform: rotate(405deg) scale(var(--portal-scale, 0.72)); }
}

@keyframes portalEnter {
  0% { opacity: 0; clip-path: circle(0% at 50% 50%); }
  25% { opacity: 1; clip-path: circle(22% at 50% 50%); }
  70% { opacity: 1; clip-path: circle(78% at 50% 50%); }
  100% { opacity: 0; clip-path: circle(150% at 50% 50%); }
}

@keyframes horrorFlicker {
  0%, 80%, 100% { opacity: 0.42; transform: translateX(0); }
  82% { opacity: 0.9; transform: translateX(-3px); }
  84% { opacity: 0.3; transform: translateX(4px); }
}

@keyframes eyeBlink {
  0%, 91%, 100% { opacity: 0.82; transform: scaleY(1); }
  93% { opacity: 0.05; transform: scaleY(0.08); }
  95% { opacity: 0.92; transform: scaleY(1); }
}

@media (max-width: 860px) {
  .world-hero {
    min-height: auto;
    align-items: start;
  }

  .world-nav-links {
    display: none;
  }

  .world-hero-grid,
  .system-heading,
  .system-grid,
  .interaction-grid,
  .horror-grid,
  .horror-trigger-grid,
  .brief-builder,
  .persona-profile-grid {
    grid-template-columns: 1fr;
  }

  .world-hero-grid {
    width: min(100% - 28px, 560px);
    padding-top: 92px;
    padding-bottom: 34px;
    gap: 22px;
    align-items: start;
  }

  .world-title {
    font-size: clamp(38px, 13vw, 58px);
    line-height: 0.95;
    max-width: 9ch;
  }

  .world-title span {
    display: block;
  }

  .world-copy {
    margin-top: 18px;
    font-size: 15px;
    line-height: 1.5;
    max-width: 100%;
  }

  .world-command {
    max-width: 520px;
    padding: 10px;
  }

  .world-feed {
    aspect-ratio: 16 / 10;
  }

  .world-metric-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .world-metric {
    min-height: 58px;
    padding: 9px 8px;
  }

  .world-metric strong {
    font-size: 16px;
  }

  .world-metric span {
    margin-top: 6px;
    font-size: 8px;
    white-space: nowrap;
  }

  .world-system-section {
    padding: 48px 14px;
  }

  .system-heading {
    gap: 14px;
    margin-bottom: 18px;
  }

  .system-heading h2 {
    font-size: clamp(28px, 9vw, 40px);
    line-height: 1.04;
  }

  .system-heading p {
    font-size: 14px;
  }

  .effect-row,
  .state-readout {
    grid-template-columns: 1fr;
  }

  .wireframe-board {
    height: 280px;
  }

  .horror-silhouette {
    min-height: 320px;
  }

  .persona-profile-card {
    min-height: 440px;
  }

  .persona-profile-card strong {
    margin-top: 220px;
  }
}

@media (max-width: 560px) {
  .world-nav {
    padding: 12px 14px;
  }

  .world-brand {
    font-size: 15px;
  }

  .world-mark {
    width: 26px;
    height: 26px;
  }

  .world-hero-grid {
    width: calc(100% - 24px);
    max-width: calc(100vw - 24px);
    padding-top: 76px;
  }

  .world-title,
  .world-copy,
  .world-actions,
  .world-command {
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
  }

  .world-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    margin-top: 24px;
  }

  .world-button {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    font-size: 11px;
  }

  .world-command {
    margin-top: 4px;
  }

  .world-hud {
    inset: 8px;
  }

  .world-chip {
    max-width: 100%;
    font-size: 8px;
    padding: 5px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .system-panel {
    padding: 12px;
    min-height: 0;
  }

  .world-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .world-tabs button {
    min-height: 36px;
    padding: 7px 6px;
    font-size: 10px;
  }

  .code-window {
    min-height: 230px;
    max-height: 320px;
    font-size: 10.5px;
    line-height: 1.58;
    white-space: pre;
    overflow: auto;
  }

  .interaction-grid {
    gap: 10px;
  }

  .world-chat-log {
    height: 190px;
  }

  .world-chat-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .world-chat-form input {
    min-height: 42px;
    font-size: 11px;
  }

  .world-state {
    min-height: 250px;
  }

  .state-readout {
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 6px;
  }

  .state-readout div {
    padding: 8px;
  }

  .effect-row {
    gap: 7px;
  }

  .effect-button {
    min-height: 66px;
    padding: 10px;
  }

  .horror-silhouette {
    min-height: 260px;
  }

  .horror-namebar {
    align-items: start;
    flex-direction: column;
  }

  .horror-namebar span {
    text-align: left;
  }

  .horror-mode-grid,
  .trigger-list,
  .brief-controls,
  .prompt-examples {
    grid-template-columns: 1fr;
  }

  .identity-output-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .identity-output-row span {
    text-align: center;
    font-size: 9px;
    padding: 7px 5px;
  }

  .brief-controls {
    display: grid;
  }

  .reference-preview {
    min-height: 190px;
  }

  .brief-form textarea {
    min-height: 190px;
    font-size: 11px;
  }

  .side-ai {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 0;
    display: block;
    transform: translateY(calc(100% - 46px));
  }

  .side-ai.open {
    transform: translateY(0);
  }

  .side-ai-tab {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: horizontal-tb;
    gap: 8px;
  }

  .side-ai-panel {
    width: 100%;
    max-height: min(78svh, 680px);
  }

  .side-ai-media {
    height: 260px;
  }

  .side-ai-body h3 {
    font-size: 24px;
  }

  .side-ai-actions {
    grid-template-columns: 1fr;
  }

  .horror-mode-grid button {
    min-height: 86px;
  }

  .wireframe-board {
    height: 244px;
  }

  .wire-block {
    font-size: 8px;
    padding: 6px;
  }
}

@media (max-width: 420px) {
  .world-title {
    font-size: clamp(33px, 13vw, 43px);
    max-width: 9ch;
  }

  .world-copy {
    font-size: 14px;
  }

  .world-feed {
    aspect-ratio: 4 / 3;
  }

  .world-metric-row {
    grid-template-columns: 1fr;
  }

  .world-metric {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .world-metric span {
    margin-top: 0;
  }

  .wire-hero { left: 5%; top: 6%; width: 52%; height: 32%; }
  .wire-portal { right: 5%; top: 6%; width: 31%; height: 48%; }
  .wire-chat { left: 5%; bottom: 30%; width: 52%; height: 20%; }
  .wire-schema { left: 5%; bottom: 7%; width: 41%; height: 18%; }
  .wire-stripe { right: 5%; bottom: 7%; width: 42%; height: 18%; }
}

@media (prefers-reduced-motion: reduce) {
  .world-state:before,
  .world-state:after,
  .portal-overlay.active {
    animation: none;
  }
}

/* Production stream route mobile repair layer. */
.mltx-stream-page,
.mltx-stream-page body {
  max-width: 100%;
  overflow-x: hidden;
  background: #0a0a0a;
}

.mltx-stream-page #root {
  max-width: 100vw;
  overflow-x: hidden;
}

.mltx-stream-page .mltx-cart-toggle {
  right: 10px;
  bottom: 10px;
  z-index: 60;
}

.mltx-stream-page .mltx-cart-drawer {
  z-index: 70;
}

.mltx-recovered-stream {
  min-height: 100svh;
  color: #f7f3f5;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 34, 68, 0.14), transparent 32%),
    linear-gradient(180deg, #070708, #0a0a0a);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow-x: hidden;
}

.recovered-stream-nav {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(14px, 4vw, 44px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 5, 6, 0.82);
  position: sticky;
  top: 0;
  z-index: 3;
}

.recovered-brand {
  color: white;
  font: 700 20px "Space Mono", monospace;
}

.recovered-brand span {
  color: #ff2244;
}

.recovered-stream-nav nav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #b7b2b8;
  font: 12px "Space Mono", monospace;
}

.recovered-stream-hero {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: stretch;
}

.recovered-video {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  background: #020203;
  border: 1px solid rgba(255, 34, 68, 0.42);
}

.recovered-video video,
.recovered-video img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recovered-video video {
  opacity: 0.46;
  filter: contrast(1.08) saturate(0.8);
}

.recovered-video img {
  opacity: 0.76;
}

.recovered-video:after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 38%, rgba(0, 0, 0, 0.82)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px);
  pointer-events: none;
}

.recovered-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: #00e5ff;
  font: 10px "Space Mono", monospace;
}

.recovered-hud span,
.recovered-hud strong {
  padding: 7px 8px;
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.recovered-side,
.recovered-panels article {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.recovered-side {
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.recovered-live {
  width: max-content;
  padding: 7px 9px;
  color: #050506;
  background: #ff2244;
  font: 700 10px "Space Mono", monospace;
}

.recovered-side h1 {
  margin-top: 18px;
  color: white;
  font: 700 clamp(36px, 5vw, 56px)/0.95 "Space Mono", monospace;
}

.recovered-side p {
  margin-top: 14px;
  color: #c9c4ca;
  line-height: 1.55;
}

.recovered-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 18px;
}

.recovered-stats div {
  padding: 12px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.recovered-stats strong,
.recovered-stats span {
  display: block;
  font-family: "Space Mono", monospace;
}

.recovered-stats strong {
  color: white;
  font-size: 22px;
}

.recovered-stats span {
  margin-top: 5px;
  color: #8c8790;
  font-size: 10px;
}

.recovered-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: auto;
  padding-top: 18px;
}

.recovered-button {
  min-height: 44px;
  display: grid;
  place-items: center;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font: 700 12px "Space Mono", monospace;
}

.recovered-button.primary {
  background: #ff2244;
  border-color: #ff2244;
  color: #050506;
}

.recovered-panels {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0 0 40px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.recovered-panels article {
  padding: 16px;
}

.recovered-panels h2 {
  color: white;
  font: 700 14px "Space Mono", monospace;
}

.recovered-panels p {
  margin-top: 10px;
  color: #aaa5ab;
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .mltx-stream-page header.fixed .h-14 {
    height: 48px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .mltx-stream-page header.fixed .bg-\[\#ff2244\] {
    height: 20px;
  }

  .mltx-stream-page header.fixed .text-xl {
    font-size: 16px;
  }

  .mltx-stream-page .pt-24 {
    padding-top: 78px !important;
  }

  .mltx-stream-page .px-4 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .mltx-stream-page .mb-8 > .flex,
  .mltx-stream-page #stream > .flex,
  .mltx-stream-page #stream .mt-4.flex {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .mltx-stream-page h1,
  .mltx-stream-page .text-3xl {
    font-size: 26px !important;
    line-height: 1.05 !important;
  }

  .mltx-stream-page .grid {
    min-width: 0;
  }

  .mltx-stream-page .grid.grid-cols-1 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .mltx-stream-page .glass-card,
  .mltx-stream-page [class*="glass-card"] {
    max-width: 100%;
    overflow: hidden;
  }

  .mltx-stream-page .mltx-livecam-frame,
  .mltx-stream-page .scanline-overlay {
    height: auto !important;
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .mltx-stream-page .h-36.mltx-livecam-frame,
  .mltx-stream-page .h-36.scanline-overlay {
    height: auto !important;
  }

  .mltx-stream-page .p-3.flex.items-center.gap-3 {
    gap: 10px !important;
  }

  .mltx-stream-page .p-3.flex.items-center.gap-3 > img {
    width: 42px !important;
    height: 42px !important;
  }

  .mltx-stream-page #stream {
    padding-top: 18px !important;
    padding-bottom: 28px !important;
  }

  .mltx-stream-page #stream .flex.items-center.gap-3,
  .mltx-stream-page #stream .flex.items-center.gap-2 {
    flex-wrap: wrap;
    min-width: 0;
  }

  .mltx-stream-page #stream button,
  .mltx-stream-page #stream a {
    min-height: 42px;
  }

  .mltx-stream-page #stream > div:first-child > div:last-child {
    width: 100%;
  }

  .mltx-stream-page #stream > div:first-child > div:last-child button {
    width: 100%;
    justify-content: center;
  }

  .mltx-stream-page .max-w-6xl {
    max-width: 100% !important;
  }

  .mltx-stream-page .mltx-cart-toggle {
    min-height: 42px;
    right: 8px;
    bottom: 8px;
    padding: 0 12px;
    font-size: 11px;
  }

  .mltx-stream-page .mltx-cart-drawer {
    left: 8px;
    right: 8px;
    bottom: 58px;
    width: auto;
    max-width: none;
    max-height: 72svh;
  }

  .recovered-stream-nav {
    min-height: 56px;
    padding: 12px;
  }

  .recovered-stream-nav nav {
    gap: 10px;
    font-size: 11px;
  }

  .recovered-stream-hero,
  .recovered-panels {
    width: calc(100% - 24px);
    grid-template-columns: 1fr;
  }

  .recovered-stream-hero {
    padding-top: 14px;
  }

  .recovered-video {
    min-height: 0;
    aspect-ratio: 9 / 14;
  }

  .recovered-side {
    padding: 14px;
  }

  .recovered-side h1 {
    font-size: 34px;
  }

  .recovered-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .recovered-stats div {
    padding: 9px;
  }

  .recovered-stats strong {
    font-size: 16px;
  }

  .recovered-stats span {
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .mltx-stream-page .mltx-livecam-frame,
  .mltx-stream-page .scanline-overlay {
    aspect-ratio: 4 / 3;
  }

  .mltx-stream-page .mltx-livecam-time {
    display: none;
  }

  .recovered-stats {
    grid-template-columns: 1fr;
  }
}
