*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0a0a0c;
  color: #e8e8ec;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.label-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  overflow: hidden;
}

.machine-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(214, 0, 28, 0.35);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  transform: translate(-50%, -100%);
  user-select: none;
}

.machine-label-series {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #d6001c;
}

.machine-label-series.is-nav {
  cursor: pointer;
  pointer-events: auto;
}

.machine-label-series.is-nav:hover,
.machine-label-series.is-nav:focus-visible {
  color: #a80016;
  outline: none;
}

.machine-label-name {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #2a2a32;
  white-space: normal;
  text-align: center;
  max-width: 24rem;
}

.machine-label-name:empty,
.machine-label.is-proximity:not(.is-near) .machine-label-name {
  display: none;
}

.machine-label-info {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease;
}

.machine-label-info:hover {
  transform: translateY(-50%) scale(1.12);
}

.load-progress {
  position: relative;
  display: grid;
  justify-items: center;
  pointer-events: none;
  user-select: none;
}

.load-progress-svg {
  width: 72px;
  height: 72px;
  grid-area: 1 / 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
}

.load-progress-track,
.load-progress-bar {
  fill: none;
  stroke-width: 2.8;
}

.load-progress-track {
  stroke: rgba(255, 255, 255, 0.22);
}

.load-progress-bar {
  stroke: #7ec8ff;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transform: rotate(-90deg);
  transform-origin: 18px 18px;
  transition: stroke-dashoffset 0.16s linear;
}

.load-progress.is-indeterminate .load-progress-bar {
  stroke-dashoffset: 72;
  animation: load-progress-spin 0.9s linear infinite;
  transition: none;
}

.load-progress-value {
  grid-area: 1 / 1;
  align-self: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f4f8ff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.load-progress-caption {
  grid-area: 2 / 1;
  max-width: 9rem;
  margin-top: 0.28rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(8, 16, 28, 0.62);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes load-progress-spin {
  from {
    transform: rotate(-90deg);
  }
  to {
    transform: rotate(270deg);
  }
}

@media (max-width: 640px) {
  .machine-label {
    padding: 0.45rem 0.85rem;
  }

  .machine-label-series {
    font-size: 1.05rem;
  }

  .machine-label-name {
    font-size: 0.72rem;
  }

  .machine-label-info {
    width: 32px;
    height: 32px;
    left: calc(100% + 6px);
  }
}

.exhibit-label-anchor {
  pointer-events: none;
  width: 0;
  height: 0;
}

.exhibit-label {
  position: absolute;
  left: 0;
  bottom: 8px;
  transform: translate(-50%, -100%);
  display: flex;
  align-items: center;
  padding: 0.38rem 0.8rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(214, 0, 28, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  color: #1a1a22;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.exhibit-inspect {
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease;
}

.exhibit-inspect:hover {
  transform: translateY(-50%) scale(1.1);
}

.exhibit-inspect.hidden {
  display: none;
}

.exhibit-inspect .hotspot-label.material-icons {
  font-size: 18px;
  line-height: 1;
  font-weight: 400;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #14141a 0%, #08080a 70%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay.is-fatal {
  z-index: 50;
}

.overlay.is-fatal .spinner {
  display: none;
}

.overlay-retry {
  display: none;
  margin-top: 1.15rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e8e8ec;
  font-size: 0.85rem;
  pointer-events: auto;
  cursor: pointer;
}

.overlay.is-fatal .overlay-retry:not([hidden]) {
  display: inline-block;
}

.overlay.is-fatal .overlay-sub {
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.overlay-card {
  text-align: center;
  padding: 2rem 2.5rem;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: #7eb8ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.overlay-title {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.overlay-sub {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
}

.protect-overlay {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #08080a;
  transition: opacity 0.14s ease, visibility 0.14s ease;
  pointer-events: none;
}

.protect-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.75rem;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent);
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.hud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6ecfff;
  box-shadow: 0 0 12px rgba(110, 207, 255, 0.6);
}

.hud h1 {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hud-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
}

.hud-toggles {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  flex-shrink: 0;
  width: 11.5rem;
}

.hud-segmented {
  display: flex;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(8, 8, 10, 0.45);
  backdrop-filter: blur(8px);
}

.hud-segmented button {
  flex: 1 1 0;
  min-width: 0;
  width: 50%;
  height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  margin: 0;
  padding: 0 0.35rem;
  font-size: 0.78rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-align: center;
  white-space: nowrap;
  box-sizing: border-box;
  color: rgba(255, 255, 255, 0.62);
  background: transparent;
  cursor: pointer;
}

.hud-segmented button.is-active {
  color: #1a1a1e;
  background: rgba(255, 255, 255, 0.92);
}

.theme-toggle button[data-theme="night"].is-active {
  color: #f3e6d4;
  background: #3a2e24;
}

.hud-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.35), transparent);
}

.hud-footer .sep {
  opacity: 0.35;
}

#coord,
#mem {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

#mem {
  pointer-events: auto;
  cursor: help;
}

@media (max-width: 640px) {
  .hud {
    padding: 1rem;
  }

  .hud-hint {
    font-size: 0.72rem;
  }

  .hud-toggles {
    width: 10.25rem;
  }

  .hud-segmented button {
    height: 2.15rem;
    padding: 0 0.25rem;
    font-size: 0.72rem;
  }
}

#hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.hotspot {
  position: absolute;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease;
}

.hotspot.hidden {
  display: none;
}

.hotspot:hover,
.hotspot.active {
  transform: scale(1.12);
}

.hotspot-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(214, 0, 28, 0.75);
  box-shadow: 0 0 0 0 rgba(214, 0, 28, 0.45);
  animation: hotspot-pulse 2s ease-out infinite;
}

.hotspot.active .hotspot-ring {
  background: rgba(214, 0, 28, 0.95);
  box-shadow: 0 0 16px rgba(214, 0, 28, 0.55);
  animation: none;
}

.hotspot-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  user-select: none;
}

@keyframes hotspot-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(214, 0, 28, 0.5);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(214, 0, 28, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(214, 0, 28, 0);
  }
}

.info-panel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 16;
  width: min(340px, calc(100vw - 2rem));
  max-height: min(42vh, calc(100% - 2rem));
  overflow-y: auto;
  padding: 1.35rem 1.5rem 1.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  color: #1a1a22;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

.info-panel.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.info-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: #555;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.info-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.info-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d6001c;
  margin-bottom: 0.35rem;
}

.info-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.75rem;
  padding-right: 1.5rem;
}

.info-desc {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #444;
}

@media (max-width: 640px) {
  .info-panel {
    width: min(340px, calc(100vw - 1.5rem));
    max-height: min(38vh, calc(100% - 2rem));
  }
}

.glb-preview {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: transparent;
  pointer-events: none;
}

.glb-preview.hidden {
  display: none;
}

.glb-preview-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
  padding: 0.55rem 0.75rem 0.55rem 1.15rem;
  background: #202124;
  color: #e8eaed;
  pointer-events: auto;
}

.glb-preview-heading {
  min-width: 0;
  flex: 1;
}

.glb-preview-kicker {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 234, 237, 0.55);
}

.glb-preview-title {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glb-preview-back {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #e8eaed;
  cursor: pointer;
}

.glb-preview-back svg {
  width: 22px;
  height: 22px;
}

.glb-preview-back:hover,
.glb-preview-back:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.glb-preview-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: transparent;
  pointer-events: none;
}

.glb-preview-hint {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.55);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
}

.glb-preview-meta {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  left: auto;
  z-index: 2;
  width: min(248px, calc(100% - 1.8rem));
  padding: 0.85rem 0.95rem 0.9rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: #1a1a22;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  pointer-events: auto;
  transform: translateY(-50%);
}

.glb-preview-facts {
  display: grid;
  gap: 0.55rem;
}

.glb-preview-fact {
  display: grid;
  gap: 0.12rem;
}

.glb-preview-fact[hidden] {
  display: none;
}

.glb-preview-fact dt {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #d6001c;
}

.glb-preview-fact dd {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1a1a22;
}

.glb-preview-dim-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.48rem 0.62rem;
  border: 1px solid rgba(214, 0, 28, 0.28);
  border-radius: 8px;
  background: #fbf4f5;
  color: #1a1a22;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.glb-preview-dim-toggle::after {
  content: "";
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background-color: #c5c9d0;
  background-image: radial-gradient(circle 7px at 10px 50%, #fff 99%, transparent 101%);
  transition: background-color 0.18s ease, background-position 0.18s ease;
}

.glb-preview-dim-toggle.is-on {
  border-color: rgba(214, 0, 28, 0.55);
  background: #fbe8ea;
}

.glb-preview-dim-toggle.is-on::after {
  background-color: #d6001c;
  background-image: radial-gradient(circle 7px at 26px 50%, #fff 99%, transparent 101%);
}

.glb-preview-dim-toggle:hover,
.glb-preview-dim-toggle:focus-visible {
  outline: none;
  border-color: rgba(214, 0, 28, 0.55);
}

.glb-preview-dim-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.glb-preview-dim-labels.hidden {
  display: none;
}

.glb-preview-dim-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0.14rem 0.42rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.glb-preview-dim-label.is-off {
  visibility: hidden;
}

.glb-preview-dim-label[data-axis="x"] {
  color: #c62828;
}

.glb-preview-dim-label[data-axis="y"] {
  color: #2e7d32;
}

.glb-preview-dim-label[data-axis="z"] {
  color: #1565c0;
}

@media (max-width: 640px) {
  .glb-preview-meta {
    width: min(210px, calc(100% - 1.4rem));
    top: 50%;
    right: 0.65rem;
    left: auto;
    padding: 0.7rem 0.75rem 0.75rem;
  }

  .glb-preview-fact dd {
    font-size: 0.82rem;
  }
}

#app.glb-preview-open .hud,
#app.glb-preview-open .hud-footer,
#app.glb-preview-open .label-layer,
#app.glb-preview-open #hotspot-layer,
#app.glb-preview-open .info-panel,
#app.glb-preview-open .virtual-pad,
#app.glb-preview-open .chat-launch,
#app.glb-preview-open .chat-panel,
#app.video-modal-open .chat-launch,
#app.video-modal-open .chat-panel {
  visibility: hidden;
  pointer-events: none;
}

.video-modal {
  position: absolute;
  inset: 0;
  z-index: 36;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 16, 0.62);
}

.video-modal.hidden {
  display: none;
}

.video-modal-dialog {
  width: 80vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: #111318;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.video-modal-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 52px;
  padding: 0.45rem 0.7rem 0.45rem 1.15rem;
  background: #202124;
  color: #e8eaed;
}

.video-modal-title {
  min-width: 0;
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #e8eaed;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.video-modal-close:hover,
.video-modal-close:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.video-modal-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}

.video-modal-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

#app.video-modal-open .virtual-pad {
  visibility: hidden;
  pointer-events: none;
}

.virtual-pad {
  --joystick-size: min(9.6rem, 26vh);
  --knob-size: calc(var(--joystick-size) * 0.385);
  --joystick-inset: calc(var(--joystick-size) * 0.14);
  position: absolute;
  right: max(3vh, env(safe-area-inset-right, 0px));
  bottom: max(3vh, env(safe-area-inset-bottom, 0px));
  z-index: 18;
  width: var(--joystick-size);
  height: var(--joystick-size);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
}

.virtual-joystick-base {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06), transparent 58%),
    rgba(8, 12, 20, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    inset 0 0 0 var(--joystick-inset) rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(10px);
}

.virtual-joystick-base::before {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.virtual-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--knob-size);
  height: var(--knob-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.55), rgba(210, 224, 236, 0.22) 42%, rgba(120, 150, 175, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform 0.14s ease-out, background 0.14s ease, border-color 0.14s ease;
}

.virtual-pad.is-active {
  cursor: grabbing;
}

.virtual-pad.is-active .virtual-joystick-base {
  border-color: rgba(110, 207, 255, 0.55);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(110, 207, 255, 0.16),
    inset 0 0 0 var(--joystick-inset) rgba(110, 207, 255, 0.08);
}

.virtual-pad.is-active .virtual-joystick-knob {
  background:
    radial-gradient(circle at 32% 28%, rgba(240, 251, 255, 0.85), rgba(110, 207, 255, 0.62) 46%, rgba(70, 150, 200, 0.45));
  border-color: rgba(180, 236, 255, 0.9);
  transition: background 0.14s ease, border-color 0.14s ease;
}

@supports (height: 1dvh) {
  .virtual-pad {
    --joystick-size: min(9.6rem, 26dvh);
    right: max(3dvh, env(safe-area-inset-right, 0px));
    bottom: max(3dvh, env(safe-area-inset-bottom, 0px));
  }
}

.chat-launch {
  position: absolute;
  z-index: 19;
  left: max(1rem, env(safe-area-inset-left, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  width: 4.5rem;
  height: 4.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.38));
  transition: transform 0.15s ease;
}

.chat-launch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.chat-launch:hover,
.chat-launch:focus-visible {
  transform: scale(1.06);
  outline: none;
}

.chat-launch:active {
  transform: scale(0.96);
}

#app.chat-panel-open .chat-launch {
  display: none;
}

.chat-panel {
  position: absolute;
  z-index: 34;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: #f4f5f7;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

.chat-panel.hidden {
  display: none;
}

@media (orientation: landscape) {
  .chat-panel {
    right: auto;
    width: calc(100% / 3 - max(12px, env(safe-area-inset-left, 0px)));
  }
}

.chat-panel-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 48px;
  padding: 0.4rem 0.55rem 0.4rem 1rem;
  background: #202124;
  color: #e8eaed;
}

.chat-panel-title {
  min-width: 0;
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.chat-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-panel-btn {
  height: 32px;
  padding: 0 0.75rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.chat-panel-btn-icon {
  width: 32px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.chat-panel-btn:hover,
.chat-panel-btn:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}

.chat-panel-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}
