.world {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: #2e3160;
}

.world[hidden] {
  display: none;
}

.world canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-2);
  padding: calc(var(--s-3) + env(safe-area-inset-top)) var(--s-3) calc(var(--s-4) + env(safe-area-inset-bottom));
  pointer-events: none;
}

.hud button,
.hud .joy {
  pointer-events: auto;
}

.world.is-covered .hud,
.world.is-covered .nametags {
  visibility: hidden;
}

.nametags {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.nametag {
  position: absolute;
  top: 0;
  left: 0;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow: var(--shadow-lift), inset 0 0 0 1.5px var(--line);
  will-change: transform;
}

/* 말풍선 꼬리 */
.nametag::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 2px;
  background: inherit;
  transform: rotate(45deg);
}

.nametag--me {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-lift);
}

.hud__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2);
}

.hud__pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  min-height: 36px;
  padding: 0 var(--s-3);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 700;
  box-shadow: var(--shadow-lift);
}

.hud__pill[hidden] {
  display: none;
}

.hud__top-right {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.hud .sound-btn {
  box-shadow: var(--shadow-lift);
}

.hud__pill--tickets {
  background: var(--butter);
}

.hud__pill svg {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.hud__tree {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  width: min(100%, 360px);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lift);
  font-size: var(--t-caption);
  font-weight: 700;
  color: var(--ink-2);
}

.hud__tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.orn-row--mini {
  gap: var(--s-1);
}

.orn-row--mini span {
  width: 28px;
  height: 28px;
}

.orn-row--mini span svg {
  width: 20px;
  height: 20px;
}

.meter--tree {
  height: 8px;
}

.meter--tree .meter__fill {
  background: var(--gold);
}

.hud__notice {
  width: min(100%, 360px);
  margin-top: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--surface);
  font-size: var(--t-caption);
  font-weight: 700;
}

.hud__notice[hidden] {
  display: none;
}

.hud__live[hidden] {
  display: none;
}

.hud__live .btn {
  min-height: var(--tap-min);
  padding: 0 var(--s-4);
  box-shadow: var(--shadow-lift);
  white-space: nowrap;
  pointer-events: auto;
}

.hud__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  margin-top: auto;
  margin-bottom: var(--s-3);
}

.hud__prompt {
  min-width: 240px;
  box-shadow: var(--shadow-float);
  animation: pop var(--dur-standard) var(--ease-standard);
  transform: none;
}

.hud__prompt[hidden] {
  display: none;
}

.hud__hint {
  max-width: 320px;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  background: rgba(58, 48, 44, 0.6);
  color: var(--surface);
  font-size: var(--t-caption);
  font-weight: 600;
  text-align: center;
}

.hud__hint:empty {
  display: none;
}

.hud__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-2);
}

.joy {
  position: relative;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.3);
  touch-action: none;
}

.joy__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lift);
}

.hud__emotes {
  display: flex;
  gap: var(--s-2);
}

.hud__emotes .btn--icon {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-lift);
}

.hud__emotes svg {
  width: 22px;
  height: 22px;
}

.hud__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-2);
}

.hud__actions .btn {
  min-height: var(--tap-min);
  padding: 0 var(--s-4);
  box-shadow: var(--shadow-lift);
  white-space: nowrap;
}

.hud__actions .btn[hidden] {
  display: none;
}

.shell--overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  max-width: none;
  margin: 0;
  padding: var(--s-2) var(--s-4) var(--s-8);
  overflow-y: auto;
  background: rgba(46, 49, 96, 0.6);
  border-radius: 0;
  box-shadow: none;
}

.shell--overlay > * {
  width: 100%;
  max-width: var(--col-max);
  margin-left: auto;
  margin-right: auto;
}

.shell--overlay .view > .t-h1,
.shell--overlay .view > p {
  color: var(--surface);
  text-shadow: 0 1px 2px rgba(46, 49, 96, 0.5);
}

.shell[hidden] {
  display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 640px) {
  .joy {
    display: none;
  }
}

@media (min-width: 640px) {
  .hud {
    padding: var(--s-4) var(--s-6);
  }

  .shell--overlay {
    padding-top: var(--s-6);
  }
}
