html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-hud {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
}

.game-hud-fps-cluster {
  position: fixed;
  top: clamp(8px, 1.5vmin, 16px);
  right: clamp(8px, 1.5vmin, 16px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.game-hud-fps-cluster.is-enabled {
  opacity: 1;
  visibility: visible;
}

.game-hud-fps-counter {
  margin: 0;
  padding: 4px 8px;
  border: 1px solid rgba(255, 128, 0, 0.22);
  background: rgba(6, 8, 11, 0.62);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  font-size: clamp(0.68rem, 1.35vmin, 0.82rem);
  letter-spacing: 0.12em;
  line-height: 1.2;
  color: rgba(255, 188, 132, 0.9);
  -webkit-text-fill-color: rgba(255, 188, 132, 0.9);
  text-shadow: 0 1px 0 rgba(24, 14, 8, 0.9);
  white-space: nowrap;
}

html.terminal-animations-off .game-hud-fps-cluster {
  transition: none !important;
}

.game-hud-anchor {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.game-hud-chat.os-window {
  --wm-border: rgba(255, 128, 0, 0.32);
  --wm-border-inset: rgba(255, 128, 0, 0.06);
  --wm-chrome-edge: rgba(255, 128, 0, 0.2);
  --wm-control-edge: rgba(255, 128, 0, 0.35);
  position: relative;
  display: none;
  flex-direction: column;
  align-self: flex-start;
  margin-left: 0;
  border-left: none;
  width: min(96vw, 520px);
  max-width: min(96vw, 520px);
  min-height: 140px;
  max-height: min(38vh, 280px);
  pointer-events: none;
  overflow: hidden;
}

.game-hud-chat.os-window::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-image: url("../Web Main Menu/hazard-tile.png");
  background-repeat: repeat;
  background-size: 16px 16px;
  opacity: 0.45;
  pointer-events: none;
  z-index: 1;
}

.game-hud-chat.os-window.is-open {
  display: flex;
  opacity: 0.48;
  transition:
    opacity 0.22s ease,
    border-color 0.14s ease,
    box-shadow 0.22s ease;
}

html.terminal-animations-off .game-hud-chat.os-window.is-open,
html.terminal-animations-off #gameHudRoot.game-hud--chat-focused .game-hud-chat.os-window.is-open {
  transition: none !important;
}

#gameHudRoot.game-hud--chat-focused .game-hud-chat.os-window.is-open {
  opacity: 1;
}

.game-hud-chat .os-window-body-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.game-hud-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(8px, 1.2vmin, 12px);
  gap: 0;
}

.game-hud-chat-log-host {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-hud--chat-interactive .game-hud-chat.is-open {
  pointer-events: auto;
}

.web-standalone .game-hud-chat.is-open {
  pointer-events: auto;
}

#gameHudRoot.game-hud--chat-focused .game-hud-chat.os-window {
  --wm-border: rgba(255, 168, 88, 0.72);
  --wm-border-inset: rgba(255, 168, 88, 0.14);
  --wm-chrome-edge: rgba(255, 168, 88, 0.35);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px var(--wm-border-inset),
    0 0 18px rgba(255, 100, 40, 0.22);
}

.game-hud-chat-log.menu-v-scroll-view {
  flex: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-anchor: auto;
  padding: 4px 6px 2px 8px;
  box-sizing: border-box;
  pointer-events: auto;
  cursor: var(--cursor-default);
  user-select: text;
  -webkit-user-select: text;
}

.game-hud-chat-log-inner,
.game-hud-chat-line {
  cursor: var(--cursor-default);
}

.game-hud-chat-log-inner {
  display: flex;
  flex-direction: column;
  margin-top: auto;
  width: 100%;
  min-height: min-content;
  overflow-anchor: auto;
}

.game-hud-chat-line {
  margin: 0 0 4px;
  font-size: clamp(0.72rem, 1.45vmin, 0.88rem);
  letter-spacing: 0.08em;
  line-height: 1.35;
  word-break: break-word;
  white-space: pre-wrap;
  color: rgba(255, 204, 159, 0.95);
  -webkit-text-fill-color: rgba(255, 204, 159, 0.95);
  text-shadow: 0 1px 0 rgba(24, 14, 8, 0.9);
}

.game-hud-chat-line .game-hud-chat-color {
  background: none;
  background-image: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  filter: none;
}

.game-hud-chat-line .game-hud-chat-size {
  -webkit-text-fill-color: currentColor;
}

.game-hud-chat-line b {
  font-weight: bold;
}

.game-hud-chat-line i {
  font-style: italic;
}

.game-hud-chat-line u {
  text-decoration: underline;
}

.game-hud-chat-line s {
  text-decoration: line-through;
  opacity: 0.85;
}

.game-hud-chat-prefix {
  display: inline;
  color: rgba(255, 160, 80, 0.55);
  -webkit-text-fill-color: rgba(255, 160, 80, 0.55);
  background: none;
  filter: none;
}

.game-hud-chat-input-row.term-prompt {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45em;
  flex-shrink: 0;
  margin: 0;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 128, 0, 0.2);
  box-sizing: border-box;
  pointer-events: auto;
}

.game-hud-chat-input-row .term-prompt-path {
  flex-shrink: 0;
}

.game-hud-chat-input.worlds-compose-input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.3em 0.4em;
  border: none;
  border-bottom: 1px solid rgba(255, 128, 0, 0.35);
  background: rgba(2, 4, 7, 0.6);
  color: rgba(255, 160, 80, 0.95);
  -webkit-text-fill-color: rgba(255, 160, 80, 0.95);
  font: inherit;
  font-size: clamp(0.8rem, 1.6vmin, 0.95rem);
  letter-spacing: 0.06em;
  outline: none;
  pointer-events: auto;
  cursor: var(--cursor-text);
  user-select: text;
  -webkit-user-select: text;
}

.game-hud-chat-input-row .term-prompt-path {
  cursor: var(--cursor-default);
}

.game-hud-chat-input.worlds-compose-input::placeholder {
  color: rgba(255, 128, 0, 0.35);
  -webkit-text-fill-color: rgba(255, 128, 0, 0.35);
}

.game-hud-chat-input.worlds-compose-input:focus {
  border-bottom-color: rgba(255, 128, 0, 0.75);
  background: rgba(2, 4, 7, 0.85);
}

.game-hud-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 128, 0, 0.32);
  background:
    radial-gradient(ellipse 95% 85% at 50% 0%, rgba(255, 100, 40, 0.09) 0%, transparent 58%),
    linear-gradient(180deg, rgba(14, 16, 20, 0.96) 0%, rgba(4, 6, 9, 0.92) 100%);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 128, 0, 0.1),
    inset 0 0 28px rgba(255, 90, 40, 0.07);
}

.game-hud-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-image: url("../Web Main Menu/hazard-tile.png");
  background-repeat: repeat;
  background-size: 16px 16px;
  opacity: 0.5;
  pointer-events: none;
}

.game-hud-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(255, 120, 40, 0.04);
}

.game-hud-health {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  min-height: 8px;
  box-sizing: border-box;
}

.game-hud-health-cell {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 8px;
  border: 1px solid rgba(255, 128, 0, 0.35);
  background: var(--health-empty, rgba(0, 0, 0, 0.55));
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 160, 80, 0.08);
}

.game-hud-health-cell.is-filled {
  background: linear-gradient(180deg,
      rgba(255, 174, 85, 1) 0%,
      rgba(255, 128, 0, 1) 42%,
      rgba(255, 102, 40, 1) 78%,
      rgba(232, 56, 32, 1) 100%);
  border-color: rgba(255, 160, 80, 0.75);
  box-shadow:
    inset 0 0 10px rgba(255, 200, 120, 0.35),
    0 0 8px rgba(255, 100, 40, 0.28);
}

.game-hud-health-cell.is-partial-host {
  flex-grow: 1;
  flex-basis: 0;
  max-width: none;
}

.game-hud-health-partial {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  z-index: 2;
  overflow: hidden;
  background: linear-gradient(180deg,
      rgba(255, 174, 85, 1) 0%,
      rgba(255, 128, 0, 1) 42%,
      rgba(255, 102, 40, 1) 78%,
      rgba(232, 56, 32, 1) 100%);
  box-shadow: inset 0 0 10px rgba(255, 200, 120, 0.35);
}

.game-hud-hotbar {
  display: grid;
  grid-template-columns: repeat(12, minmax(52px, 1fr));
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: min(96vw, 720px);
  box-sizing: border-box;
  pointer-events: auto;
  cursor: var(--cursor-default);
}

.game-hud-hotbar > li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.game-hud-slot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  min-height: 52px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 128, 0, 0.35);
  background:
    radial-gradient(ellipse 80% 70% at 50% 100%, rgba(255, 100, 40, 0.06) 0%, transparent 70%),
    var(--slot-bg, rgba(6, 8, 11, 0.94));
  transition: background-color 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
  box-sizing: border-box;
  box-shadow: inset 0 1px 0 rgba(255, 160, 80, 0.06);
  pointer-events: auto;
  cursor: var(--cursor-pointer);
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.game-hud-slot.is-selected,
.game-hud-slot:hover {
  background:
    radial-gradient(ellipse 90% 80% at 50% 0%, rgba(255, 120, 60, 0.07) 0%, transparent 65%),
    var(--slot-selected, rgba(58, 26, 10, 0.94));
  border-color: rgba(255, 168, 88, 0.9);
  box-shadow:
    inset 0 0 6px rgba(255, 90, 30, 0.1),
    0 0 12px rgba(255, 100, 40, 0.28);
}

.game-hud-slot.is-holstered {
  background:
    radial-gradient(ellipse 80% 70% at 50% 100%, rgba(255, 100, 40, 0.04) 0%, transparent 70%),
    var(--slot-holstered, rgba(255, 128, 64, 0.25));
  border-color: rgba(255, 140, 64, 0.5);
}

.game-hud-slot-index {
  position: absolute;
  top: 2px;
  left: 4px;
  font-family: "IBM3270", "CMFallback", "Courier New", monospace;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.06em;
  color: rgba(255, 160, 80, 0.65);
  -webkit-text-fill-color: rgba(255, 160, 80, 0.65);
  text-shadow: 0 1px 0 rgba(24, 14, 8, 0.9);
  pointer-events: none;
}

.game-hud-slot-icon {
  position: absolute;
  inset: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  object-fit: contain;
  object-position: center;
  opacity: 0;
  z-index: 1;
  transform: scale(1);
  transform-origin: center center;
  transition: opacity 0.05s ease;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(24, 14, 8, 0.65));
}

.game-hud-slot-icon.is-visible {
  opacity: 1;
}

.game-hud-slot-icon.is-visible.is-fading-out {
  opacity: 0;
}

@keyframes game-hud-icon-pop {
  0% {
    transform: scale(0.7);
    filter: drop-shadow(0 0 10px rgba(255, 140, 60, 0.55)) drop-shadow(0 2px 4px rgba(24, 14, 8, 0.65));
  }

  55% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    filter: drop-shadow(0 2px 4px rgba(24, 14, 8, 0.65));
  }
}

.game-hud-slot-icon.is-pop {
  animation: game-hud-icon-pop 0.3s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

.game-hud-slot-stack {
  position: absolute;
  right: 2px;
  bottom: 1px;
  z-index: 2;
  font-family: "IBM3270", "CMFallback", "Courier New", monospace;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #ffcc9f;
  -webkit-text-fill-color: #ffcc9f;
  transform: scale(1);
  transform-origin: 100% 100%;
  text-shadow:
    0 1px 0 rgba(24, 14, 8, 0.95),
    0 0 8px rgba(255, 120, 40, 0.25);
  pointer-events: none;
}

@keyframes game-hud-stack-pulse {
  0% {
    transform: scale(1);
    color: #ffcc9f;
    -webkit-text-fill-color: #ffcc9f;
  }

  45% {
    transform: scale(1.28);
    color: #fff2d8;
    -webkit-text-fill-color: #fff2d8;
    text-shadow:
      0 0 10px rgba(255, 160, 80, 0.85),
      0 1px 0 rgba(24, 14, 8, 0.95);
  }

  100% {
    transform: scale(1);
    color: #ffcc9f;
    -webkit-text-fill-color: #ffcc9f;
  }
}

.game-hud-slot-stack.is-pulse {
  animation: game-hud-stack-pulse 0.28s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {

  .game-hud-slot-icon {
    transition: none;
  }

  .game-hud-slot-icon.is-pop,
  .game-hud-slot-stack.is-pulse {
    animation: none !important;
  }

  .game-hud-health-cell::before,
  .game-hud-health-partial::before {
    animation: none !important;
  }
}

.game-hud-slot-stack[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .game-hud-hotbar {
    grid-template-columns: repeat(6, minmax(48px, 1fr));
    min-width: 0;
  }

  .game-hud-panel,
  .game-hud-chat {
    width: min(96vw, 380px);
    max-width: min(96vw, 380px);
  }
}