:root {
  --accent: #e9a19a;
  --accent-rgb: 233, 161, 154;
  --panel-rgb: 244, 235, 229;
  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
  --hud-bg: rgba(250, 247, 243, 0.72);
  --hud-border: rgba(67, 50, 44, 0.12);
  --hud-ink: #342c29;
  --hud-muted: rgba(52, 44, 41, 0.58);
  --panel-bg: rgba(248, 245, 240, 0.94);
  color-scheme: dark;
}

body[data-room="nexus"] {
  --hud-bg: rgba(13, 18, 23, 0.66);
  --hud-border: rgba(255, 255, 255, 0.13);
  --hud-ink: #f4f8fb;
  --hud-muted: rgba(235, 245, 250, 0.55);
  --panel-bg: rgba(16, 21, 26, 0.95);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0c0e10;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

#stage {
  position: fixed;
  inset: 0;
  background: #111519;
}

#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.vignette,
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.vignette {
  background:
    radial-gradient(circle at 50% 42%, transparent 53%, rgba(5, 7, 9, 0.18) 100%),
    linear-gradient(180deg, rgba(5, 8, 11, 0.08), transparent 18%, transparent 78%, rgba(4, 6, 8, 0.17));
}

.grain {
  opacity: 0.027;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.83' numOctaves='3' stitchTiles='stitchTiles'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.top-hud {
  position: fixed;
  top: var(--safe-top);
  left: var(--safe-left);
  right: var(--safe-right);
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.top-hud > * {
  pointer-events: auto;
}

.glass-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  min-width: 42px;
  padding: 0 13px;
  border: 1px solid var(--hud-border);
  border-radius: 999px;
  color: var(--hud-ink);
  background: var(--hud-bg);
  box-shadow: 0 10px 28px rgba(4, 7, 10, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  cursor: pointer;
  transition: transform 0.24s ease, background 0.24s ease, border-color 0.24s ease, opacity 0.3s ease;
}

.glass-button::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.glass-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.84);
}

body[data-room="nexus"] .glass-button:hover {
  background: rgba(24, 33, 40, 0.86);
}

.glass-button:active {
  transform: scale(0.96);
}

.glass-button:focus-visible,
.enter-button:focus-visible,
.inspect-button:focus-visible,
.panel-close:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 3px;
}

.glass-button svg,
.reset-button svg,
.inspect-button svg,
.panel-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.glass-button span {
  font-size: 9px;
  font-weight: 820;
  letter-spacing: 0.12em;
}

.home-button {
  padding: 0 15px;
}

.room-identity {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  padding: 9px 14px 9px 12px;
  border: 1px solid var(--hud-border);
  border-radius: 17px;
  color: var(--hud-ink);
  background: var(--hud-bg);
  box-shadow: 0 12px 36px rgba(4, 7, 10, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
}

.room-identity > i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.13), 0 0 18px rgba(var(--accent-rgb), 0.55);
}

.room-identity div {
  min-width: 0;
}

.room-identity small,
.scene-status small {
  display: block;
  color: var(--hud-muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.room-identity strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-row {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.scene-status {
  position: fixed;
  left: var(--safe-left);
  bottom: calc(var(--safe-bottom) + 14px);
  z-index: 31;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(310px, 42vw);
  padding: 10px 14px 10px 11px;
  border: 1px solid var(--hud-border);
  border-radius: 17px;
  color: var(--hud-ink);
  background: var(--hud-bg);
  box-shadow: 0 14px 38px rgba(4, 7, 10, 0.13);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.8);
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(var(--accent-rgb), 0.38);
  border-radius: inherit;
  animation: statusPulse 2.4s ease-out infinite;
}

.scene-status strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 26;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 12px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.crosshair span,
.crosshair i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 1px;
  background: rgba(255, 255, 255, 0.82);
  transform: translate(-50%, -50%);
}

.crosshair i {
  width: 1px;
  height: 4px;
}

.crosshair.active {
  width: 35px;
  height: 35px;
  border-color: var(--accent);
  box-shadow: 0 0 0 7px rgba(var(--accent-rgb), 0.12), 0 0 28px rgba(var(--accent-rgb), 0.55);
}

.crosshair.active::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-top: 2px solid #fff;
  border-right: 2px solid transparent;
  border-radius: 50%;
  animation: reticleSpin 2.2s linear infinite;
}

.focus-prompt {
  position: fixed;
  top: calc(50% + 34px);
  left: 50%;
  z-index: 27;
  min-width: 210px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  color: #fff;
  text-align: center;
  background: rgba(12, 16, 20, 0.58);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(17px) saturate(1.3);
  -webkit-backdrop-filter: blur(17px) saturate(1.3);
  opacity: 0;
  transform: translate(-50%, 9px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.focus-prompt.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.focus-prompt small {
  display: block;
  color: var(--accent);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.focus-prompt strong {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 720;
}

.focus-prompt span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.inspect-button {
  position: fixed;
  right: var(--safe-right);
  bottom: calc(var(--safe-bottom) + 10px);
  z-index: 35;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 45vw;
  height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 20, 25, 0.62);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(17px);
  -webkit-backdrop-filter: blur(17px);
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.inspect-button span {
  overflow: hidden;
  font-size: 10px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspect-button.ready {
  color: #14171a;
  background: var(--accent);
  box-shadow: 0 14px 38px rgba(var(--accent-rgb), 0.36);
  opacity: 1;
  pointer-events: auto;
  animation: inspectReady 1.8s ease-in-out infinite;
}

.reset-button {
  position: fixed;
  right: var(--safe-right);
  bottom: calc(var(--safe-bottom) + 14px);
  z-index: 31;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--hud-border);
  border-radius: 999px;
  color: var(--hud-ink);
  background: var(--hud-bg);
  box-shadow: 0 12px 32px rgba(5, 8, 11, 0.13);
  backdrop-filter: blur(17px);
  -webkit-backdrop-filter: blur(17px);
  cursor: pointer;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reset-button span {
  font-size: 9px;
  font-weight: 780;
}

.joystick,
.look-hint {
  display: none;
}

.look-zone {
  position: fixed;
  inset: 0 0 0 36%;
  z-index: 12;
  touch-action: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 72px);
  z-index: 70;
  max-width: min(520px, calc(100vw - 34px));
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-align: center;
  background: rgba(11, 15, 18, 0.68);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.orientation-tip {
  position: fixed;
  top: calc(var(--safe-top) + 76px);
  left: 50%;
  z-index: 75;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(10, 14, 18, 0.68);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.orientation-tip.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.orientation-tip > span {
  color: var(--accent);
  font-size: 23px;
}

.orientation-tip b,
.orientation-tip small {
  display: block;
  white-space: nowrap;
}

.orientation-tip b {
  font-size: 10px;
}

.orientation-tip small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.53);
  font-size: 8px;
}

.loading-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: auto;
  transition: opacity 0.75s ease, visibility 0.75s ease;
}

.loading-layer.leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(var(--accent-rgb), 0.35), transparent 35%),
    radial-gradient(circle at 82% 74%, rgba(var(--accent-rgb), 0.22), transparent 40%),
    linear-gradient(145deg, rgba(19, 18, 18, 0.62), rgba(7, 10, 13, 0.82));
  backdrop-filter: blur(16px) saturate(0.72);
  -webkit-backdrop-filter: blur(16px) saturate(0.72);
}

.entry-card {
  position: relative;
  width: min(560px, 100%);
  padding: clamp(24px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 34px;
  color: #fff;
  background: linear-gradient(145deg, rgba(25, 27, 29, 0.87), rgba(12, 14, 17, 0.91));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
}

.entry-card::before {
  content: "";
  position: absolute;
  width: 290px;
  height: 290px;
  top: -170px;
  right: -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.38), transparent 68%);
  pointer-events: none;
}

.entry-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.entry-line b {
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.entry-orbit {
  position: relative;
  width: 116px;
  height: 116px;
  margin: 26px 0 20px;
}

.entry-orbit::before,
.entry-orbit::after,
.entry-orbit > i {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(var(--accent-rgb), 0.33);
  border-radius: 50%;
}

.entry-orbit::before {
  animation: orbitSpin 8s linear infinite;
  border-top-color: var(--accent);
  border-right-color: transparent;
}

.entry-orbit::after {
  inset: 16px;
  border-style: dashed;
  animation: orbitSpin 10s linear reverse infinite;
}

.entry-orbit > i {
  inset: 37px;
  border: 0;
  background: radial-gradient(circle at 36% 30%, #fff, var(--accent) 36%, rgba(var(--accent-rgb), 0.16) 70%);
  box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.58);
}

.entry-orbit > span,
.entry-orbit > b {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 16px var(--accent);
}

.entry-orbit > span {
  top: 4px;
  left: 53px;
  animation: orbitDot 6s ease-in-out infinite;
}

.entry-orbit > b {
  right: 12px;
  bottom: 19px;
  width: 4px;
  height: 4px;
  animation: orbitDot 5s 0.7s ease-in-out infinite reverse;
}

.entry-kicker,
.panel-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 8px;
  font-weight: 840;
  letter-spacing: 0.2em;
}

.entry-card h1 {
  position: relative;
  max-width: 480px;
  margin: 8px 0 13px;
  font-size: clamp(30px, 6.7vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.entry-copy {
  max-width: 480px;
  margin: 0;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 510;
  line-height: 1.85;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
}

.entry-meta span {
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.53);
  background: rgba(255, 255, 255, 0.035);
  font-size: 7px;
  font-weight: 760;
  letter-spacing: 0.1em;
}

.loading-track {
  height: 3px;
  margin-top: 28px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.loading-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.35), var(--accent), #fff);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.7);
  transition: width 0.12s linear;
}

.enter-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 57px;
  margin-top: 17px;
  padding: 0 9px 0 19px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.045);
  cursor: wait;
  transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.enter-button span {
  font-size: 12px;
  font-weight: 760;
}

.enter-button b {
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  border-radius: 13px;
  color: #17191b;
  background: rgba(255, 255, 255, 0.25);
  transition: transform 0.3s ease, background 0.3s ease;
}

.enter-button.ready {
  color: #16191b;
  background: linear-gradient(135deg, var(--accent), rgba(255, 255, 255, 0.94));
  box-shadow: 0 15px 42px rgba(var(--accent-rgb), 0.25);
  cursor: pointer;
}

.enter-button.ready b {
  background: rgba(255, 255, 255, 0.67);
}

.enter-button.ready:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(var(--accent-rgb), 0.35);
}

.enter-button.ready:hover b {
  transform: translateX(3px);
}

.panel-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  visibility: hidden;
  pointer-events: none;
}

.panel-layer.open {
  visibility: visible;
  pointer-events: auto;
}

.panel-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 9, 0.34);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.panel-layer.open .panel-scrim {
  opacity: 1;
}

.info-panel,
.help-panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100% - 24px));
  height: 100%;
  padding: calc(var(--safe-top) + 36px) 29px calc(var(--safe-bottom) + 25px);
  overflow: auto;
  color: var(--hud-ink);
  background: var(--panel-bg);
  box-shadow: -28px 0 90px rgba(0, 0, 0, 0.25), inset 1px 0 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(30px) saturate(1.25);
  -webkit-backdrop-filter: blur(30px) saturate(1.25);
  transform: translateX(105%);
  transition: transform 0.46s cubic-bezier(0.21, 0.8, 0.26, 1);
}

.panel-layer.open .info-panel,
.panel-layer.open .help-panel {
  transform: translateX(0);
}

.panel-close {
  position: absolute;
  top: calc(var(--safe-top) + 8px);
  right: 17px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--hud-border);
  border-radius: 50%;
  color: var(--hud-ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.panel-number {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  border: 1px solid rgba(var(--accent-rgb), 0.36);
  border-radius: 18px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(var(--accent-rgb), 0.1);
}

.info-panel h2,
.help-panel h2 {
  margin: 8px 0 17px;
  font-size: clamp(27px, 6vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.panel-body {
  margin: 0;
  color: var(--hud-muted);
  font-size: 12px;
  font-weight: 530;
  line-height: 1.9;
}

.panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 24px;
}

.panel-tags span {
  padding: 7px 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 999px;
  color: var(--hud-ink);
  background: rgba(var(--accent-rgb), 0.09);
  font-size: 8px;
  font-weight: 760;
}

.panel-tip,
.help-note {
  margin-top: 28px;
  padding: 15px;
  border: 1px solid var(--hud-border);
  border-radius: 18px;
  color: var(--hud-muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 9px;
  line-height: 1.65;
}

.panel-tip span {
  margin-right: 6px;
  color: var(--accent);
}

.help-grid {
  display: grid;
  gap: 9px;
  margin-top: 24px;
}

.help-grid > div {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 1px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--hud-border);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.045);
}

.help-grid i {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
  font-size: 10px;
  font-style: normal;
  font-weight: 820;
}

.help-grid b {
  font-size: 10px;
}

.help-grid span {
  color: var(--hud-muted);
  font-size: 8px;
}

.fatal-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #11161a;
}

.fatal-layer article {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

.fatal-layer article > span {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto;
  border-radius: 18px;
  color: #11161a;
  background: var(--accent);
  font-size: 15px;
  font-weight: 850;
}

.fatal-layer h2 {
  margin: 18px 0 8px;
  font-size: 22px;
}

.fatal-layer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  line-height: 1.7;
}

.fatal-layer button {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  border-radius: 15px;
  color: #11161a;
  background: var(--accent);
  font-weight: 760;
}

body:not(.exploring) .top-hud,
body:not(.exploring) .scene-status,
body:not(.exploring) .crosshair,
body:not(.exploring) .focus-prompt,
body:not(.exploring) .reset-button,
body:not(.exploring) .joystick,
body:not(.exploring) .look-hint,
body:not(.exploring) .inspect-button {
  opacity: 0;
  pointer-events: none;
}

body.ui-idle .top-hud {
  opacity: 0.12;
  transform: translateY(-8px);
}

body.ui-idle .scene-status,
body.ui-idle .reset-button,
body.ui-idle .look-hint {
  opacity: 0;
  transform: translateY(8px);
}

body.ui-idle .crosshair:not(.active) {
  opacity: 0.26;
}

@keyframes statusPulse {
  0% { opacity: 0.8; transform: scale(0.55); }
  70%, 100% { opacity: 0; transform: scale(1.45); }
}

@keyframes reticleSpin {
  to { transform: rotate(360deg); }
}

@keyframes orbitSpin {
  to { transform: rotate(360deg); }
}

@keyframes orbitDot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.3); }
}

@keyframes inspectReady {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (max-width: 900px), (pointer: coarse) {
  .top-hud {
    grid-template-columns: auto 1fr auto;
    gap: 7px;
  }

  .room-identity {
    min-width: 0;
    max-width: 230px;
    padding: 8px 10px;
  }

  .room-identity small {
    display: none;
  }

  .room-identity strong {
    margin: 0;
    font-size: 9px;
  }

  .glass-button {
    width: 41px;
    height: 41px;
    padding: 0;
  }

  .glass-button span {
    display: none;
  }

  .home-button span {
    display: none;
  }

  .optional-tool {
    display: none;
  }

  .scene-status {
    display: none;
  }

  .reset-button {
    top: calc(var(--safe-top) + 54px);
    right: var(--safe-right);
    bottom: auto;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }

  .reset-button span {
    display: none;
  }

  .joystick {
    position: fixed;
    left: calc(var(--safe-left) + 3px);
    bottom: calc(var(--safe-bottom) + 8px);
    z-index: 36;
    display: block;
    width: 112px;
    height: 112px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0 27%, rgba(10, 15, 19, 0.3) 29% 100%);
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.025), 0 16px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    touch-action: none;
    transition: opacity 0.35s ease;
  }

  .joystick::before,
  .joystick::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: rgba(255, 255, 255, 0.12);
    transform: translate(-50%, -50%);
  }

  .joystick::before {
    width: 64%;
    height: 1px;
  }

  .joystick::after {
    width: 1px;
    height: 64%;
  }

  .joystick > i {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 47px;
    height: 47px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(15, 20, 24, 0.66));
    box-shadow: 0 9px 25px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .joy-arrows {
    position: absolute;
    top: 8px;
    left: 50%;
    color: rgba(255, 255, 255, 0.35);
    font-size: 9px;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .joystick small {
    position: absolute;
    left: 50%;
    bottom: -17px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 7px;
    font-weight: 780;
    letter-spacing: 0.16em;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .look-hint {
    position: fixed;
    right: calc(var(--safe-right) + 6px);
    bottom: calc(var(--safe-bottom) + 66px);
    z-index: 28;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: opacity 0.35s ease;
  }

  .look-hint span {
    width: 33px;
    height: 33px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18), transparent 70%);
  }

  .look-hint small {
    font-size: 6px;
    font-weight: 760;
    letter-spacing: 0.1em;
  }

  .inspect-button {
    display: flex;
  }

  .focus-prompt span {
    display: none;
  }

  .toast {
    bottom: calc(var(--safe-bottom) + 129px);
  }
}

@media (max-width: 600px) {
  .top-hud {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .room-identity {
    justify-self: stretch;
  }

  .tool-row {
    gap: 5px;
  }

  .entry-card {
    border-radius: 28px;
  }

  .entry-orbit {
    width: 92px;
    height: 92px;
    margin: 18px 0 15px;
  }

  .entry-orbit > i {
    inset: 29px;
  }

  .entry-orbit > span {
    left: 42px;
  }

  .entry-copy {
    font-size: 11px;
    line-height: 1.75;
  }

  .entry-meta {
    margin-top: 15px;
  }

  .loading-track {
    margin-top: 20px;
  }

  .info-panel,
  .help-panel {
    width: min(92vw, 420px);
    padding-left: 22px;
    padding-right: 22px;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .entry-card {
    display: grid;
    grid-template-columns: 116px 1fr;
    grid-template-rows: auto auto auto auto auto;
    column-gap: 24px;
    width: min(790px, 100%);
    padding: 22px 26px;
  }

  .entry-line {
    grid-column: 1 / -1;
  }

  .entry-orbit {
    grid-column: 1;
    grid-row: 2 / span 4;
    align-self: center;
    margin: 0;
  }

  .entry-kicker,
  .entry-card h1,
  .entry-copy,
  .entry-meta {
    grid-column: 2;
  }

  .entry-kicker {
    margin-top: 12px;
  }

  .entry-card h1 {
    margin: 5px 0 7px;
    font-size: clamp(27px, 5.5vw, 43px);
  }

  .entry-copy {
    font-size: 10px;
    line-height: 1.6;
  }

  .entry-meta {
    margin-top: 10px;
  }

  .loading-track,
  .enter-button {
    grid-column: 1 / -1;
  }

  .loading-track {
    margin-top: 14px;
  }

  .enter-button {
    min-height: 48px;
    margin-top: 10px;
  }

  .joystick {
    width: 94px;
    height: 94px;
  }

  .look-hint {
    bottom: calc(var(--safe-bottom) + 47px);
  }

  .toast {
    bottom: calc(var(--safe-bottom) + 22px);
  }
}

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