:root {
  color-scheme: dark;
  --hsvr-ink: #190d08;
  --hsvr-panel: rgba(25, 13, 8, 0.88);
  --hsvr-paper: #fff1c7;
  --hsvr-gold: #f4b942;
  --hsvr-red: #a93322;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--hsvr-ink);
  color: var(--hsvr-paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hsvr-hud {
  position: fixed;
  z-index: 10;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  width: min(430px, calc(100vw - 28px));
  padding: 13px 14px 12px;
  border: 1px solid rgba(244, 185, 66, 0.32);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(25, 13, 8, 0.92), rgba(46, 24, 14, 0.74));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.hsvr-hud__topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--hsvr-gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hsvr-hud__title {
  margin-top: 6px;
  color: #fff8e6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(17px, 2.4vw, 23px);
  font-weight: 700;
  line-height: 1.12;
}

.hsvr-hud__state {
  min-height: 15px;
  margin-top: 4px;
  color: rgba(255, 241, 199, 0.75);
  font-size: 11px;
  line-height: 1.3;
}

.hsvr-hud__guide {
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 226, 122, 0.46);
  border-radius: 10px;
  background: rgba(98, 50, 18, 0.72);
  color: #ffe89c;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hsvr-hud__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
  pointer-events: auto;
}

.hsvr-hud button,
.hsvr-exit {
  appearance: none;
  border: 1px solid rgba(244, 185, 66, 0.4);
  border-radius: 999px;
  background: rgba(41, 22, 13, 0.88);
  color: var(--hsvr-paper);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.hsvr-hud button {
  min-height: 34px;
  padding: 7px 12px;
}

.hsvr-hud button:hover,
.hsvr-hud button:focus-visible,
.hsvr-exit:hover,
.hsvr-exit:focus-visible {
  outline: 2px solid rgba(255, 226, 122, 0.78);
  outline-offset: 2px;
  background: rgba(121, 50, 31, 0.94);
}

.hsvr-hud button[hidden] { display: none; }

.hsvr-hud button:disabled {
  opacity: 0.38;
  cursor: default;
}

.hsvr-hud__help {
  margin-top: 8px;
  color: rgba(255, 241, 199, 0.56);
  font-size: 9px;
  line-height: 1.35;
}

.hsvr-exit {
  position: fixed;
  z-index: 11;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  padding: 10px 15px;
  background: rgba(25, 13, 8, 0.78);
}

.hsvr-gamepad {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(760px, calc(100vw - 28px));
  padding: 9px;
  border: 1px solid rgba(244, 185, 66, 0.32);
  border-radius: 16px;
  background: rgba(25, 13, 8, 0.82);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.hsvr-gamepad[hidden] { display: none; }

.hsvr-gamepad button {
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid rgba(244, 185, 66, 0.42);
  border-radius: 999px;
  background: #71301f;
  color: #fff4d2;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.hsvr-gamepad button:hover,
.hsvr-gamepad button:focus-visible {
  outline: 2px solid #ffe27a;
  outline-offset: 2px;
  background: #9c3b25;
}

.hsvr-gamepad button[data-kind="skip"] { background: #3f3934; }

.hsvr-gamepad button:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 720px) {
  .hsvr-hud {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    width: min(360px, calc(100vw - 16px));
    padding: 10px 11px;
    border-radius: 13px;
  }

  .hsvr-hud__state,
  .hsvr-hud__help { display: none; }

  .hsvr-hud__guide { margin-top: 6px; padding: 6px 8px; font-size: 8px; }

  .hsvr-hud__controls { margin-top: 7px; }
  .hsvr-hud button { min-height: 32px; padding: 6px 10px; font-size: 10px; }
  .hsvr-exit { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); padding: 8px 12px; font-size: 10px; }
  .hsvr-gamepad { bottom: 54px; width: calc(100vw - 16px); padding: 7px; gap: 6px; }
  .hsvr-gamepad button { min-height: 38px; padding: 7px 11px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
