:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f2f1ed;
  background: #19191d;
  color-scheme: dark;
  font-synthesis: none;
  --muted: #aaa9ac;
  --line: #ffffff20;
  --surface: #222225f5;
  --accent: #d9d6e3;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid #ece4ff;
  outline-offset: 3px;
}
button, a, select { -webkit-tap-highlight-color: transparent; }
#experience { position: relative; width: 100%; height: var(--mobile-viewport-height, 100dvh); top: var(--mobile-viewport-top, 0px); overflow: hidden; }
#world { display: block; width: 100%; height: 100%; outline: 0; touch-action: none; }
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, #10101b26, transparent 18%, transparent 76%, #10101b33);
}
header {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  pointer-events: none;
  z-index: 2;
}
.brand {
  color: #f6f4ef;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.6px;
  text-decoration: none;
  text-shadow: 0 1px 8px #0005;
  pointer-events: auto;
}
.bottom-ui {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 6;
}
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #efecf2;
  font-size: 11px;
  text-shadow: 0 1px 5px #000a;
  transition: opacity .4s;
}
.controls > span { display: flex; align-items: center; gap: 6px; }
.controls.quiet { opacity: 0; pointer-events: none; }
kbd {
  padding: 3px 5px;
  border: 1px solid #ffffff40;
  border-radius: 4px;
  background: #23232875;
  font: inherit;
  font-size: 10px;
  color: #f2f1ed;
  white-space: nowrap;
}
.composer-wrap { position: relative; width: min(100%, 640px); pointer-events: auto; }
#composer {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 54px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 14px;
  box-shadow: 0 3px 16px #0003;
}
#composer:focus-within { border-color: transparent; }
#menu-button, #composer-submit {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
#menu-button { color: #bdbcc1; }
#menu-button:hover, #menu-button[aria-expanded="true"] { background: #ffffff10; color: #fff; }
#menu-button svg, #composer-submit svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#composer-submit { flex-basis: 36px; width: 36px; height: 36px; margin-right: 3px; background: #e8e5ec; color: #242329; }
#composer-submit:hover { background: #fff; }
#composer-submit:disabled { background: #aaa8b0; }
.composer-mode-wrap { position: relative; flex: 0 0 auto; }
#composer-mode {
  appearance: none;
  width: 81px;
  height: 38px;
  padding: 0 23px 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dcd9e1;
  font-size: 12px;
  cursor: pointer;
}
#composer-mode:focus:not(:focus-visible) { outline: none; box-shadow: none; }
#composer-mode:hover { background: #ffffff08; }
#composer-mode option { color: #f2f1ed; background: #29282e; }
.composer-mode-wrap > svg { position: absolute; right: 7px; top: 13px; width: 12px; height: 12px; fill: none; stroke: #aaa6b3; stroke-width: 1.4; stroke-linecap: round; pointer-events: none; }
#composer-input {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  max-height: 120px;
  padding: 10px 8px;
  resize: none;
  border: 0;
  border-radius: 5px;
  outline: none;
  background: transparent;
  color: #f2f1ed;
  font-size: 14px;
  line-height: 20px;
  scrollbar-width: thin;
}
#composer-input::placeholder { color: #aaa7af; opacity: 1; }
#composer-input:focus-visible { outline: none; }
#tool-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 170px;
  padding: 5px;
  background: #242427;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 6px 24px #0003;
  z-index: 2;
}
#tool-menu button {
  display: block;
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #dddbe0;
  text-align: left;
  font-size: 13px;
}
#tool-menu button:hover, #tool-menu button.active, #tool-menu button[aria-pressed="true"] { background: #ffffff10; color: #fff; }
#conversation {
  width: min(100%, 640px);
  max-height: 170px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 11px 14px;
  border: 1px solid #ffffff18;
  border-radius: 11px;
  background: #222225ed;
  font-size: 12px;
  line-height: 1.5;
  color: #d9d6dd;
  pointer-events: auto;
  scrollbar-width: thin;
}
#conversation p, #conversation .conversation-message, #conversation .message { margin: 0 0 8px; overflow-wrap: anywhere; }
#conversation > :last-child { margin-bottom: 0; }
#conversation strong { color: #f4f2f7; font-weight: 600; }
#conversation .notice, #conversation small { color: var(--muted); }
#conversation button { border: 0; border-bottom: 1px solid #d8d3e264; padding: 0; background: none; color: #e1dce9; }
.panel {
  position: absolute;
  top: max(66px, calc(env(safe-area-inset-top) + 44px));
  right: max(20px, env(safe-area-inset-right));
  width: 320px;
  max-height: calc(100dvh - 164px - env(safe-area-inset-bottom));
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #242427f7;
  box-shadow: 0 5px 24px #0003;
  scrollbar-width: thin;
  scrollbar-color: #68666f transparent;
  z-index: 5;
}
.panel-top { display: flex; align-items: center; justify-content: space-between; min-height: 26px; margin-bottom: 8px; gap: 12px; }
#panel-eyebrow { font-size: 11px; color: var(--muted); }
#panel-close { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; margin: -5px -6px -5px auto; border: 0; border-radius: 6px; background: none; font-size: 23px; font-weight: 300; color: #bbb8c1; }
#panel-close:hover { background: #ffffff10; color: #fff; }
.panel h2 { margin: 0 0 10px; font-size: 20px; font-weight: 600; letter-spacing: -.4px; }
.panel h3 { margin: 19px 0 9px; color: #dedbe3; font-size: 12px; font-weight: 600; }
.panel p { margin: 0 0 14px; color: #bbb8c2; font-size: 12px; line-height: 1.6; }
.panel label { display: block; margin: 16px 0 7px; color: #d6d2dc; font-size: 12px; }
.panel input, .panel textarea, .panel select { width: 100%; padding: 10px; border: 1px solid #ffffff24; border-radius: 7px; background: #1c1c20; color: #f0edf3; font-size: 13px; }
.panel textarea { min-height: 85px; resize: vertical; line-height: 1.5; }
.panel .primary, .panel .secondary { width: 100%; min-height: 38px; margin-top: 10px; padding: 9px 12px; border: 1px solid transparent; border-radius: 7px; background: #dedbe4; color: #242328; font-size: 12px; font-weight: 550; }
.panel .secondary { border-color: #ffffff25; background: #ffffff06; color: #dedbe5; }
.panel .primary:hover { background: #f1eef5; }
.panel .secondary:hover { background: #ffffff10; }
.panel .note { margin: 10px 0; color: #aaa5b1; font-size: 11px; line-height: 1.5; }
.panel details { margin-top: 16px; color: #b9b4c2; font-size: 12px; }
.panel summary { padding: 4px 0; cursor: pointer; }
.panel .patch-field { height: 130px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.separator { height: 1px; margin: 18px 0; background: var(--line); }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch { width: 28px; height: 28px; border: 2px solid transparent; border-radius: 50%; box-shadow: 0 0 0 1px #ffffff20; }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 3px #aaa0bc70; }
.avatar-preview { position: relative; height: 140px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #ffffff03; }
.avatar-preview canvas[hidden] { display: none; }
.avatar-preview canvas { display: block; width: 100%; height: 100%; }
.avatar-preview small { position: absolute; bottom: 10px; left: 12px; color: #aba6b5; font-size: 10px; }
.directory-tabs { display: flex; gap: 3px; margin: 0 0 14px; padding: 3px; border-radius: 8px; background: #18181c; }
.directory-tabs button { flex: 1; min-height: 33px; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: #a9a5b1; font-size: 12px; }
.directory-tabs button.active, .directory-tabs button[aria-selected="true"], .directory-tabs button[aria-pressed="true"] { background: #36353b; color: #f3eff8; }
.world-card, .directory-card, .avatar-card { display: block; width: 100%; margin-top: 9px; padding: 12px; border: 1px solid #ffffff1a; border-radius: 8px; background: #ffffff04; text-align: left; }
.world-card:hover, .directory-card:hover, .avatar-card:hover { border-color: #ffffff3d; background: #ffffff08; }
.world-card strong, .directory-card strong, .avatar-card strong { display: block; color: #ede9f2; font-size: 13px; font-weight: 550; }
.world-card .tag { color: #b0a7c0; font-size: 9px; }
.world-card .tag:empty { display: none; }
.world-card .tag:not(:empty) + strong { margin-top: 5px; }
.world-card small, .directory-card small, .avatar-card small { display: block; margin-top: 5px; color: #aaa5b3; font-size: 11px; line-height: 1.5; }
.world-card .card-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; color: #b9b2c5; font-size: 10px; }
.legend-list { margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.help-grid { display: grid; grid-template-columns: 70px 1fr; align-items: start; gap: 11px; color: #c2bccb; font-size: 11px; line-height: 1.5; }
.help-grid kbd { text-align: center; }
.offline-label { margin: 13px 0; color: #c3b59c; font-size: 11px; line-height: 1.5; }
.capabilities { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.capabilities span { color: #b4adbf; font-size: 10px; }
#chat-list { color: #cbc5d3; font-size: 12px; line-height: 1.5; }
#chat-list p { margin: 8px 0; }
.error { color: #f0b5bb !important; }
#interaction {
  position: absolute;
  left: 50%;
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 98px);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 40px);
  padding: 8px 11px;
  border: 1px solid #ffffff25;
  border-radius: 8px;
  background: #222225e8;
  transform: translateX(-50%);
  font-size: 12px;
  pointer-events: none;
  z-index: 3;
}
#interaction kbd { border: 0; background: #ded9e8; color: #2c2735; }
#toast { position: absolute; top: max(65px, calc(env(safe-area-inset-top) + 44px)); left: 50%; max-width: min(440px, calc(100% - 32px)); padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: #242427f5; color: #e2dce9; transform: translateX(-50%); text-align: center; font-size: 12px; line-height: 1.5; pointer-events: none; z-index: 9; }
#mobile-controls { display: none; }
/* Arrival styles are inline in index.html so the scene can paint before this file loads. */
@media (max-width: 760px), (pointer: coarse) {
  header { top: max(17px, env(safe-area-inset-top)); left: max(18px, env(safe-area-inset-left)); }
  .brand { font-size: 17px; }
  .bottom-ui { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); gap: 8px; }
  .controls { display: none; }
  #composer { min-height: 52px; gap: 0; padding: 4px; }
  #menu-button { flex-basis: 44px; width: 44px; height: 44px; }
  #composer-mode { width: 75px; height: 44px; padding-left: 6px; font-size: 12px; }
  #composer-input { font-size: 16px; padding-left: 4px; padding-right: 4px; }
  #composer-input::placeholder { font-size: 13px; }
  #composer-submit { flex-basis: 44px; width: 44px; height: 44px; margin-right: 2px; }
  #conversation { position: absolute; bottom: calc(100% + 220px); max-height: 130px; padding: 10px 12px; }
  .panel { top: max(58px, calc(env(safe-area-inset-top) + 39px)); right: max(12px, env(safe-area-inset-right)); width: min(300px, calc(100vw - 68px)); max-height: min(52dvh, calc(100dvh - 352px - env(safe-area-inset-bottom))); padding: 15px; border-radius: 11px; }
  .panel input, .panel textarea, .panel select { font-size: 16px; }
  .panel .patch-field { font-size: 13px; }
  #mobile-controls { display: flex; position: absolute; left: max(18px, env(safe-area-inset-left)); right: max(18px, env(safe-area-inset-right)); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 76px); justify-content: space-between; align-items: flex-end; pointer-events: none; z-index: 4; }
  .analog-stick { position: relative; flex: 0 0 112px; width: 112px; height: 112px; border: 1px solid #ffffff38; border-radius: 50%; background: #24242a65; box-shadow: inset 0 0 22px #0002; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .stick-thumb { position: absolute; width: 46px; height: 46px; top: calc(50% - 23px); left: calc(50% - 23px); border-radius: 50%; border: 1px solid #ffffff64; background: #d8d4e451; box-shadow: 0 2px 9px #0003; pointer-events: none; }
  .stick-label { position: absolute; bottom: 8px; left: 0; width: 100%; color: #f2eff7c9; text-align: center; font-size: 10px; pointer-events: none; }
  .analog-stick.pressed { background: #33303988; border-color: #ffffff75; }
  .analog-stick.pressed .stick-thumb { background: #e4deed85; }
  .mobile-right { display: flex; flex-direction: column; align-items: flex-end; gap: 13px; }
  .mobile-actions { display: flex; gap: 10px; align-items: flex-end; }
  .mobile-actions button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 66px; min-height: 58px; padding: 6px 4px; border: 1px solid #ffffff45; border-radius: 18px; background: #24242bd4; color: #f2eef7; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; pointer-events: auto; }
  .mobile-actions strong { font-size: 20px; font-weight: 650; line-height: 24px; }
  .mobile-actions [data-action-label] { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 9px; line-height: 14px; }
  .mobile-actions button[data-mobile-action="a"] { border-color: #cfe9d77d; }
  .mobile-actions button.pressed { background: #696171eb; }
  .mobile-actions button:disabled { opacity: .36; }
  #mobile-controls.input-suspended { visibility: hidden; pointer-events: none; }
  body:has(#composer-input:focus) #mobile-controls, body:has(.panel input:focus) #mobile-controls, body:has(.panel textarea:focus) #mobile-controls, body:has(.panel select:focus) #mobile-controls { visibility: hidden; }
  body:has(#composer-input:focus) #conversation { bottom: calc(100% + 8px); }
  #interaction { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 276px); font-size: 11px; }
  #toast { top: max(58px, calc(env(safe-area-inset-top) + 39px)); font-size: 11px; }
}
@media (max-width: 380px) {
  .bottom-ui { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); }
  #composer-mode { width: 70px; font-size: 11px; }
  #composer-input::placeholder { font-size: 12px; }
  .panel { width: calc(100vw - 64px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

#placement-controls{position:absolute;left:50%;bottom:calc(118px + env(safe-area-inset-bottom));transform:translateX(-50%);max-width:min(520px,calc(100vw - 32px));padding:10px 12px;background:#242426e8;border:1px solid #ffffff20;border-radius:10px;font-size:12px;text-align:center;z-index:7}#placement-controls>div{display:flex;justify-content:center;gap:8px;margin-top:8px}#placement-controls button{border:1px solid #ffffff24;background:#ffffff0b;border-radius:7px;padding:6px 10px;color:inherit}.card-actions{display:flex;gap:8px}.card-actions .secondary{margin-top:10px}
@media(pointer:coarse){#placement-controls{bottom:calc(300px + env(safe-area-inset-bottom));font-size:11px;}}
.import-offer button{border:1px solid #ffffff25;border-radius:6px;background:#ffffff10;color:inherit;padding:6px 9px;margin-right:7px;margin-top:7px}.signin-link{color:#f2f1ed;border:1px solid #ffffff35;padding:12px 18px;border-radius:8px;text-decoration:none;margin-top:15px}

@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  #mobile-controls { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 64px); }
  .mobile-right { flex-direction: row; align-items: flex-end; gap: 14px; }
  .analog-stick { width: 96px; height: 96px; flex-basis: 96px; }
  .mobile-actions { gap: 8px; }
  .mobile-actions button { width: 58px; min-height: 54px; }
  .bottom-ui { bottom: max(8px, env(safe-area-inset-bottom)); }
  .composer-wrap { width: min(100%, 520px); }
  #interaction { bottom: auto; top: max(14px, env(safe-area-inset-top)); max-width: 50%; }
  #conversation { max-height: 76px; bottom: calc(100% + 110px); width: min(440px, 65%); }
  .panel { max-height: calc(100dvh - 240px - env(safe-area-inset-bottom)); }
  #placement-controls { bottom: auto; top: max(50px, env(safe-area-inset-top)); max-width: 44%; font-size: 10px; }
}
@media (max-width: 350px) {
  #mobile-controls { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); }
  .analog-stick { width: 98px; height: 98px; flex-basis: 98px; }
  .mobile-actions button { width: 60px; }
}

@media (max-width: 760px), (pointer: coarse) {
  .panel:has(input:focus), .panel:has(textarea:focus), .panel:has(select:focus) { max-height: calc(var(--mobile-viewport-height, 100dvh) - 90px - env(safe-area-inset-bottom)); }
}

.request-card strong { white-space: pre-wrap; overflow-wrap: anywhere; }
.request-card p, .request-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.request-card small { color: var(--muted); }

/* Public world activity stays distinct from private creation replies. */
#world-activity { position:fixed; left:50%; top:max(10px,env(safe-area-inset-top)); transform:translateX(-50%); width:156px; max-width:calc(100vw - 32px); color:#dddbe0; background:#222225ed; border:1px solid #ffffff26; border-radius:12px; pointer-events:auto; font-size:12px; z-index:4; box-shadow:0 4px 18px #0002; }
#world-activity summary { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-height:44px; padding:6px 12px; cursor:pointer; font-weight:600; list-style:none; }
#world-activity summary::-webkit-details-marker { display:none; }
#world-activity summary:focus-visible { outline:2px solid #dcc7f3; outline-offset:3px; border-radius:10px; }
/* Stack the label above a geometric chevron so the arrow itself sits on the viewport centerline. */
.activity-arrow { display:flex; align-items:center; justify-content:center; width:16px; height:12px; flex:none; font-size:0; }
.activity-arrow::before { content:""; width:7px; height:7px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:translateY(-2px) rotate(45deg); }
#world-activity[open] { width:min(380px,calc(100vw - 32px)); }
#world-activity[open] .activity-arrow { transform:rotate(180deg); }
#activity-entries { max-height:min(220px,calc(100dvh - 380px)); overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; padding:0 14px 10px; border-top:1px solid #ffffff14; }
#activity-entries p { margin:10px 0; overflow-wrap:anywhere; line-height:1.5; }
#activity-entries time { color:#aba6b2; font-size:10px; }
/* In compact layouts, panels and typing take priority over optional HUD. */
@media(max-width:1020px),(pointer:coarse) {
  body.panel-open #world-activity, body.panel-open #world-minimap,
  body:has(#composer-input:focus) #world-activity, body:has(#composer-input:focus) #world-minimap { visibility:hidden; pointer-events:none; }
}


#composer-availability { margin: 6px 8px 0; color: #d1cdd9; font-size: 11px; line-height: 1.4; text-shadow: 0 1px 4px #000; }

/* Always-available north-up local navigation, away from thumb controls. */
#world-minimap { position:absolute; bottom:max(20px,env(safe-area-inset-bottom)); left:max(16px,env(safe-area-inset-left)); width:154px; z-index:5; border:1px solid #ffffff30; border-radius:12px; background:#1a222dee; box-shadow:0 4px 18px #0003; overflow:hidden; }
#world-minimap button { border:0; background:none; color:inherit; }
#world-minimap .map-toggle { display:flex; align-items:center; justify-content:space-between; gap:5px; width:100%; min-height:44px; padding:7px 10px; text-align:left; }
.map-title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.map-expand { color:#b8c3d4; font-size:10px; }
#world-minimap .map-surface { position:relative; display:block; padding:0; width:100%; aspect-ratio:1; }
.map-surface svg { display:block; width:100%; height:100%; }
.map-north { position:absolute; left:7px; top:5px; font-size:10px; color:#fff; text-shadow:0 1px 3px #000; }
#world-minimap.expanded { width:min(340px,calc(100vw - 32px)); max-height:calc(var(--mobile-viewport-height,100dvh) - 110px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow:auto; overscroll-behavior:contain; z-index:8; }
#world-minimap.expanded .map-surface { width:min(100%,270px); margin:auto; }
#map-details { padding:10px 12px 12px; font-size:11px; }
.map-extent { display:flex; align-items:center; gap:10px; }
.map-extent select { min-height:44px; flex:1; padding:6px; border:1px solid #ffffff30; border-radius:6px; background:#283342; color:inherit; }
.map-legend,.map-note,.map-position { color:#c3cbd7; font-size:10px; line-height:1.5; }
.map-routes { display:grid; gap:5px; }
#world-minimap .map-routes button,#world-minimap .map-directory { min-height:44px; padding:7px 10px; text-align:left; border:1px solid #ffffff25; border-radius:6px; }
#world-minimap .map-directory { margin-top:8px; width:100%; }
/* Keep navigation above chat at mid-width, above the left stick on touch. */
@media(max-width:1020px) { #world-minimap { bottom:calc(max(20px,env(safe-area-inset-bottom)) + 110px); } }
@media(max-width:760px),(pointer:coarse) {
  #world-minimap { width:100px; bottom:calc(max(12px,env(safe-area-inset-bottom)) + 200px); left:max(12px,env(safe-area-inset-left)); }
  #world-minimap .map-toggle { padding:5px 7px; }
  #world-minimap .map-title { font-size:10px; }
  #world-minimap .map-expand { font-size:9px; }
  #world-minimap.expanded { bottom:calc(max(12px,env(safe-area-inset-bottom)) + 330px); max-height:calc(var(--mobile-viewport-height,100dvh) - 400px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); width:min(300px,calc(100vw - 32px)); }
  #world-minimap.expanded .map-surface { width:min(100%,180px); }
  #world-activity { width:148px; }
  #world-activity[open] { top:max(56px,calc(env(safe-area-inset-top) + 44px)); }
}
@media(max-height:600px) and (orientation:landscape) {
  #world-minimap { width:100px; }
  #world-minimap:not(.expanded) .map-surface { display:none; }
  #world-minimap.expanded .map-surface { width:130px; }
  #activity-entries { max-height:100px; }
}
@media(max-width:760px),(pointer:coarse) { body:has(#world-activity[open]) #world-minimap { visibility:hidden; pointer-events:none; } }
@media(min-width:761px) and (pointer:fine) { #world-minimap.expanded { bottom:calc(max(20px,env(safe-area-inset-bottom)) + 110px); } }
@media(max-width:1020px),(pointer:coarse) { body:has(#tool-menu:not([hidden])) #world-minimap { visibility:hidden; pointer-events:none; } }
@media(max-width:1020px) { body:has(#conversation:not([hidden])) #world-minimap { visibility:hidden; pointer-events:none; } }

@media(max-width:760px),(pointer:coarse) {
  .mobile-actions { position:relative; }
  .mobile-actions [data-mobile-boost] { position:absolute; right:0; bottom:calc(100% + 8px); min-height:44px; width:66px; border-radius:14px; font-size:12px; }
  .mobile-actions [data-mobile-boost][hidden] { display:none; }
}
@media(max-height:500px) and (orientation:landscape) and (pointer:coarse) {
  #world-minimap.expanded { bottom:calc(max(8px,env(safe-area-inset-bottom)) + 190px); max-height:calc(var(--mobile-viewport-height,100dvh) - 250px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}

.activity-title-short { display:none; }
@media(max-width:360px) {
  #world-activity:not([open]) { width:104px; }
  #world-activity summary { padding:6px 8px; }
  #world-activity:not([open]) .activity-title-full { display:none; }
  #world-activity:not([open]) .activity-title-short { display:inline; }
}

/* Shared directory: bounded card pages and a single, focused preview. */
.panel:has(.catalog-browser) { width:min(820px,calc(100vw - 80px)); }
.catalog-heading h2 { font-size:23px; letter-spacing:-.6px; }
.catalog-heading p { max-width:56ch; }
.catalog-tools { display:grid; grid-template-columns:minmax(130px,1fr) 150px 130px; gap:8px; }
.catalog-count { margin:12px 0!important; font-size:11px!important; color:#a7a4b1!important; }
.catalog-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.catalog-tile { min-width:0; padding:0 0 12px; overflow:hidden; border:1px solid #ffffff20; border-radius:12px; background:#1c1c22; color:#eae8f0; text-align:left; cursor:pointer; }
.catalog-tile:hover { border-color:#a5a0bb; background:#292731; }
.catalog-tile[aria-pressed="true"] { border-color:#c6b6ec; box-shadow:0 0 0 1px #c6b6ec; }
.catalog-tile:focus-visible,.catalog-pager button:focus-visible { outline:2px solid #e0c8ff; outline-offset:3px; }
.catalog-cover { height:92px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; background:radial-gradient(ellipse at bottom,#59526955,transparent 75%),#27252f; color:#bcb0d0; }
.catalog-cover-avatar { background:radial-gradient(ellipse at bottom,#49636455,transparent 75%),#242b2c; color:#adc8c8; }
.catalog-symbol { font-size:36px; line-height:1; font-weight:300; }
.catalog-cover-label { font-size:9px; letter-spacing:1.3px; text-transform:uppercase; opacity:.75; }
.catalog-name { display:block; margin:10px 12px 4px; font-size:13px; overflow-wrap:anywhere; line-height:1.4; }
.catalog-badge { display:block; margin:0 12px; color:#b0aab9; font-size:10px; line-height:1.5; }
.catalog-empty { padding:28px 12px; border:1px dashed #ffffff25; border-radius:12px; color:#bbb7c5; font-size:13px; }
.catalog-empty[hidden],.catalog-pager[hidden] { display:none; }
.catalog-pager { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:14px 0; font-size:12px; }
.catalog-pager button { min-height:40px; padding:8px 16px; border:1px solid #ffffff25; border-radius:8px; background:#ffffff08; color:#ece9f3; }
.catalog-pager button:disabled { opacity:.4; }
.catalog-detail { margin-top:16px; color:#aaa5b1; font-size:12px; }
.catalog-detail .world-card { margin:0; padding:18px; background:#ffffff06; border-radius:12px; }
.catalog-detail .world-card strong { font-size:17px; }
.catalog-detail .world-card p { margin:10px 0; }
.avatar-catalog .avatar-card { margin-top:16px; border-radius:12px; }
.avatar-catalog .avatar-preview { background:radial-gradient(ellipse at bottom,#79718630,transparent 70%); border-radius:8px; }
.avatar-catalog [role="group"][hidden] { display:none; }
@media(min-width:900px) { .avatar-catalog { display:grid; grid-template-columns:minmax(0,1fr) 250px; gap:18px; align-items:start; } .avatar-catalog .catalog-tools { grid-template-columns:1fr 1fr; } .avatar-catalog .catalog-tools input { grid-column:1/-1; } .avatar-catalog .catalog-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .avatar-catalog .avatar-card { margin-top:0; position:sticky; top:0; } }
@media(max-width:600px) { .panel:has(.catalog-browser) { width:calc(100vw - 32px); right:16px; max-height:calc(100dvh - 180px - env(safe-area-inset-bottom)); } .catalog-tools { grid-template-columns:1fr 1fr; } .catalog-tools input { grid-column:1/-1; } .catalog-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; } .catalog-cover { height:76px; } .catalog-tile { min-height:130px; } .catalog-heading h2 { font-size:21px; } }
.catalog-cover { position:relative; height:120px; overflow:hidden; }
.catalog-thumbnail { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.catalog-cover-avatar { height:166px; }
.catalog-cover-avatar .catalog-thumbnail { object-fit:contain; background:#646970; }
.catalog-thumbnail[hidden] { display:none; }
@media(max-width:600px) { .catalog-cover { height:100px; } .catalog-cover-avatar { height:150px; } }
.catalog-back { min-height:36px; padding:6px 0; margin:0 0 8px; border:0; background:transparent; color:#cbbbe5; font-size:12px; cursor:pointer; }
@media(min-width:900px) { .world-catalog { display:grid; grid-template-columns:minmax(0,1fr) 240px; gap:18px; align-items:start; } .world-catalog .catalog-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .world-catalog .catalog-tools { grid-template-columns:1fr 1fr; } .world-catalog .catalog-tools input { grid-column:1/-1; } .world-catalog .catalog-detail { margin:0; position:sticky; top:0; } }
