:root {
  color-scheme: dark;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  background: #07090d;
  color: #f7fbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #07090d;
}

.shell {
  position: relative;
  width: 100vw;
  min-height: 100dvh;
  overflow: hidden;
  background: #07090d;
}

#plaza-scene {
  display: block;
  width: 100vw;
  height: 100dvh;
  outline: none;
}

.hud {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
  padding: 18px 20px;
  pointer-events: none;
}

.chat-overlay {
  position: absolute;
  left: 50%;
  top: clamp(176px, 34vh, 284px);
  width: min(610px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(110px, 1fr) auto;
  max-height: min(360px, calc(100dvh - 210px));
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(246, 250, 255, 0.93);
  color: #111827;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  pointer-events: auto;
  transition: opacity 160ms ease, transform 160ms ease;
}

.shell[data-mode="world"] .chat-panel {
  opacity: 0.26;
  pointer-events: none;
  transform: scale(0.92);
}

.chat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  background: #ca2226;
  color: #ffffff;
}

.chat-panel-head h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0;
}

.chat-panel-head span {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.82;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  margin: 0;
  padding: 12px 14px;
  list-style: none;
  overflow: auto;
  background: #eef4ff;
}

.chat-message {
  display: grid;
  grid-template-columns: minmax(76px, 112px) 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 0.86rem;
  line-height: 1.3;
}

.chat-message-user {
  color: #ca2226;
  font-weight: 800;
  white-space: nowrap;
}

.chat-message-text {
  color: #26313f;
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  gap: 6px;
  padding: 10px 14px 12px;
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
}

.chat-form label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #26313f;
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-compose textarea {
  width: 100%;
  min-height: 44px;
  max-height: 92px;
  resize: vertical;
  border: 1px solid #98a2b3;
  border-radius: 6px;
  padding: 9px 10px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.25;
}

.chat-compose textarea:focus {
  outline: 3px solid rgba(202, 34, 38, 0.3);
  border-color: #ca2226;
}

.chat-compose textarea:disabled {
  background: #e5eaf1;
  color: #667085;
  cursor: not-allowed;
}

.chat-compose button {
  min-width: 72px;
  min-height: 44px;
  border: 1px solid #9f1d20;
  border-radius: 6px;
  background: #ca2226;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
}

.chat-compose button:disabled {
  border-color: #a7b0be;
  background: #cbd5e1;
  color: #526071;
  cursor: not-allowed;
  transform: none;
}

.chat-compose button:active {
  transform: translateY(1px);
}

.chat-compose button:focus-visible {
  outline: 3px solid rgba(202, 34, 38, 0.34);
  outline-offset: 2px;
}

.chat-help {
  margin: 0;
  color: #4b5563;
  font-size: 0.75rem;
  line-height: 1.25;
}

.brand-lockup {
  justify-self: start;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  min-height: 40px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.brand-mark {
  color: #ca2226;
}

.launch-actions {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  pointer-events: auto;
}

.enter-button,
.exit-button,
.om-client-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 172px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  padding: 0 22px;
  background: #f5f8fb;
  color: #111827;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.exit-button,
.om-client-button {
  background: #111827;
  color: #f7fbff;
}

.enter-button:hover,
.exit-button:hover,
.om-client-button:hover {
  background: #ffffff;
  color: #111827;
}

.enter-button:active,
.exit-button:active,
.om-client-button:active {
  transform: translateY(1px);
}

.enter-button:focus-visible,
.exit-button:focus-visible,
.om-client-button:focus-visible {
  outline: 3px solid #ca2226;
  outline-offset: 3px;
}

.entry-status {
  justify-self: end;
  max-width: 260px;
  min-height: 40px;
  margin: 0;
  color: rgba(247, 251, 255, 0.82);
  font-size: 0.88rem;
  line-height: 1.35;
  text-align: right;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.world-controls {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.world-controls[hidden] {
  display: none;
}

.move-pad,
.look-pad {
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.move-pad {
  grid-template-columns: repeat(3, 44px);
  grid-template-areas:
    ". forward ."
    "left backward right";
}

.look-pad {
  grid-template-columns: repeat(2, minmax(70px, auto));
}

.move-pad [data-world-control="forward"] {
  grid-area: forward;
}

.move-pad [data-world-control="left"] {
  grid-area: left;
}

.move-pad [data-world-control="backward"] {
  grid-area: backward;
}

.move-pad [data-world-control="right"] {
  grid-area: right;
}

.world-controls button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(17, 24, 39, 0.88);
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.world-controls button:active,
.world-controls button[data-active="true"] {
  background: #ca2226;
}

.world-controls button:focus-visible {
  outline: 3px solid #ca2226;
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .hud {
    grid-template-columns: 1fr;
    align-content: start;
    justify-items: center;
    gap: 10px;
    padding: 14px;
  }

  .brand-lockup,
  .entry-status {
    justify-self: center;
    text-align: center;
  }

  .brand-lockup {
    min-height: 28px;
    font-size: 1rem;
  }

  .entry-status {
    max-width: min(320px, calc(100vw - 28px));
    min-height: 22px;
    font-size: 0.8rem;
  }

  .launch-actions {
    gap: 8px;
  }

  .enter-button,
  .exit-button,
  .om-client-button {
    min-width: 164px;
    min-height: 42px;
    padding: 0 18px;
    font-size: 0.84rem;
  }

  .chat-overlay {
    top: 208px;
    width: calc(100vw - 20px);
  }

  .chat-panel {
    max-height: min(420px, calc(100dvh - 236px));
  }

  .chat-panel-head {
    min-height: 40px;
    padding: 0 10px;
  }

  .chat-panel-head h1 {
    font-size: 0.92rem;
  }

  .chat-panel-head span {
    display: none;
  }

  .chat-messages {
    padding: 10px;
  }

  .chat-message {
    grid-template-columns: 90px 1fr;
    gap: 8px;
    font-size: 0.78rem;
  }

  .chat-form {
    padding: 9px 10px 10px;
  }

  .chat-compose {
    grid-template-columns: 1fr;
  }

  .chat-compose button {
    width: 100%;
  }

  .world-controls {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .move-pad {
    grid-template-columns: repeat(3, 42px);
  }

  .look-pad {
    grid-template-columns: 1fr;
  }
}
