*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0f17;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#viewport-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  background: #ffffff;
}

.hud {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483647;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.4);
  color: #f8fafc;
  font-size: 12px;
  line-height: 1;
  user-select: none;
}

.hud-collapsible {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hud.is-collapsed .hud-collapsible {
  display: none;
}

.hud-roles {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.hud-btn,
.hud-role-btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 6px 9px;
  border-radius: 999px;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease, color 120ms ease;
}

.hud-btn:hover,
.hud-role-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.hud-role-btn[aria-pressed="true"] {
  background: #0ea5e9;
  color: #062133;
  font-weight: 600;
}

.hud-btn:focus-visible,
.hud-role-btn:focus-visible,
.hud-select:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 1px;
}

.hud-nav-btn {
  width: 28px;
  height: 26px;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
}

.hud-select {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  padding: 4px 10px;
  cursor: pointer;
  max-width: 190px;
}

.hud-select option {
  background: #0f172a;
  color: #f8fafc;
}

.hud-style {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 0 4px;
}

.hud-counter {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  padding: 0 4px;
  white-space: nowrap;
}

.hud-hub-link {
  font-size: 11px;
  color: #94a3b8;
  padding: 6px 8px;
}

.hud-toggle {
  width: 26px;
  height: 26px;
  padding: 0;
  color: #94a3b8;
}

@media (max-width: 640px) {
  .hud {
    right: 8px;
    bottom: 8px;
    max-width: calc(100vw - 16px);
    flex-wrap: wrap;
    border-radius: 14px;
    gap: 4px;
    padding: 6px;
  }

  .hud-style {
    display: none;
  }

  .hud-select {
    max-width: 140px;
  }
}
