/* Dream Stasis — inhabit the vision; chrome dissolves */

#panel-dream {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  background: #05040a;
}

#panel-dream.panel.active,
#panel-dream:not([hidden]) {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
}

.ds-chamber {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  display: flex;
  flex-direction: column;
  color: #f0ebe8;
}

.ds-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background: #0a0812;
  /* Always fills chamber — gate used to steal height; without this, enter looks blank */
  min-height: 100%;
}

.ds-layer {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2.4s ease, transform 0.6s ease-out;
  will-change: transform, opacity;
  filter: saturate(1.08) contrast(1.04);
}

.ds-layer.active {
  opacity: 1;
}

.ds-layer.video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ds-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, transparent 20%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.55) 100%);
  transition: opacity 1.2s ease, background 2s ease;
}

.ds-bloom {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(
    circle at var(--ds-px, 50%) var(--ds-py, 45%),
    rgba(var(--ds-glow-rgb, 180, 140, 220), 0.28),
    transparent 42%
  );
  opacity: var(--ds-presence, 0.55);
  transition: opacity 0.8s ease;
  mix-blend-mode: soft-light;
}

.ds-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  animation: ds-grain 0.35s steps(2) infinite;
}

@keyframes ds-grain {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(-1.5%, 1%);
  }
}

.ds-iris {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(72vmin, 640px);
  height: min(72vmin, 640px);
  margin: calc(min(72vmin, 640px) / -2) 0 0 calc(min(72vmin, 640px) / -2);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  box-shadow:
    0 0 60px rgba(var(--ds-glow-rgb, 160, 130, 210), 0.25),
    inset 0 0 80px rgba(0, 0, 0, 0.35);
  opacity: 0.35;
  transition: opacity 1.5s ease, transform 2s ease;
}

body.ds-absent .ds-iris {
  opacity: 0.55;
  transform: scale(1.04);
}

body.ds-absent .ds-bloom {
  opacity: 0.22;
}

body.ds-absent .ds-veil {
  opacity: 1.15;
}

.ds-whisper {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 18%;
  z-index: 5;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.1rem, 2.8vw, 1.85rem);
  line-height: 1.45;
  letter-spacing: 0.04em;
  color: rgba(255, 248, 240, 0.82);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 1.8s ease;
  pointer-events: none;
  max-height: 28vh;
  overflow: hidden;
}

.ds-whisper.show {
  opacity: 1;
}

.ds-time {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(240, 230, 210, 0.45);
  pointer-events: none;
}

.ds-presence-meter {
  position: absolute;
  top: 1.1rem;
  right: 1.25rem;
  z-index: 6;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(200, 220, 255, 0.5);
  pointer-events: none;
}

/* Privacy pip — proves camera is on; mirrored; never uploaded */
.ds-cam-pip {
  position: absolute;
  left: 1rem;
  bottom: 5.5rem;
  z-index: 16;
  width: 88px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  background: #0a0810;
  pointer-events: none;
  opacity: 0.85;
}

.ds-cam-pip[hidden] {
  display: none !important;
}

.ds-cam-pip video {
  display: block;
  width: 100%;
  height: 66px;
  object-fit: cover;
  filter: saturate(0.85) brightness(0.95);
}

/* Front/selfie = mirror; back camera = natural (no flip) */
.ds-cam-pip video.ds-cam-mirror {
  transform: scaleX(-1) !important;
  -webkit-transform: scaleX(-1) !important;
}

.ds-cam-pip video.ds-cam-rear {
  transform: none !important;
  -webkit-transform: none !important;
}

.ds-cam-pip span {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.2rem 0.25rem 0.28rem;
  color: rgba(200, 220, 255, 0.65);
  background: rgba(0, 0, 0, 0.45);
}

body.ds-cam-on .ds-presence-meter {
  color: rgba(160, 220, 190, 0.75);
}

body.ds-cam-on .ds-bloom {
  transition: opacity 0.35s ease;
}

.ds-hud {
  position: relative;
  z-index: 8;
  margin-top: auto;
  padding: 1rem 1.25rem 1.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  justify-content: center;
  background: linear-gradient(0deg, rgba(5, 4, 10, 0.82), transparent);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Full immerse: hide main HUD */
body.ds-hud-hidden #ds-hud {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.ds-float-dock {
  position: absolute;
  z-index: 14;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(8, 6, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
}

.ds-float-dock[hidden] {
  display: none !important;
}

.ds-float-dock button {
  min-height: 44px;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 16, 30, 0.65);
  color: rgba(245, 240, 232, 0.95);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  touch-action: manipulation;
}

.ds-float-dock button:active,
.ds-talk-btn.active {
  border-color: rgba(180, 150, 255, 0.65);
  background: rgba(100, 70, 160, 0.4);
}

body.ds-talking .ds-talk-btn,
body.ds-talking #ds-btn-talk-float {
  border-color: rgba(120, 220, 180, 0.7);
  background: rgba(40, 120, 90, 0.45);
  animation: ds-talk-pulse 1.2s ease infinite;
}

@keyframes ds-talk-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(120, 220, 180, 0.35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(120, 220, 180, 0);
  }
}

body.ds-hud-hidden .ds-live-prompt-panel {
  display: none !important;
}

.ds-hud button {
  min-height: 42px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 10, 18, 0.55);
  color: rgba(245, 240, 232, 0.9);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, background 0.2s;
}

.ds-hud button:hover,
.ds-hud button:focus-visible {
  border-color: rgba(var(--ds-glow-rgb, 180, 150, 220), 0.55);
  outline: none;
}

.ds-hud button.active {
  border-color: rgba(var(--ds-glow-rgb, 180, 150, 220), 0.7);
  background: rgba(var(--ds-glow-rgb, 180, 150, 220), 0.15);
}

.ds-hud .ds-enter {
  border-color: rgba(201, 162, 39, 0.45);
  color: #f0e6c8;
}

.ds-cam-select {
  min-height: 42px;
  max-width: 14rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 10, 18, 0.75);
  color: rgba(245, 240, 232, 0.92);
  font: inherit;
  font-size: 0.72rem;
  backdrop-filter: blur(8px);
}

.ds-cam-select[hidden] {
  display: none !important;
}

.ds-jump-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(230, 220, 200, 0.65);
}

.ds-jump-num {
  width: 6.5rem;
  min-height: 42px;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 10, 18, 0.7);
  color: #f5f0e8;
  font: inherit;
  font-size: 0.8rem;
}

.ds-jump-num:focus {
  outline: none;
  border-color: rgba(201, 162, 39, 0.55);
}

.ds-status {
  width: 100%;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(220, 210, 195, 0.55);
  margin: 0;
  min-height: 1.2em;
}

.ds-live-toggle.active {
  border-color: rgba(120, 200, 255, 0.55);
  background: rgba(60, 100, 160, 0.25);
  color: #c8e4ff;
}

.ds-live-prompt-panel {
  width: min(100%, 42rem);
  margin: 0.35rem auto 0;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: 14px;
  border: 1px solid rgba(140, 180, 255, 0.22);
  background: rgba(8, 10, 18, 0.72);
  backdrop-filter: blur(10px);
  text-align: left;
}

.ds-live-prompt-panel[hidden] {
  display: none !important;
}

.ds-live-prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(180, 210, 255, 0.7);
}

.ds-live-tick {
  color: rgba(160, 200, 170, 0.65);
  letter-spacing: 0.06em;
  text-transform: none;
}

.ds-live-tick.busy {
  color: #9fd4ff;
  animation: ds-tick-pulse 1s ease-in-out infinite;
}

@keyframes ds-tick-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.ds-live-prompt {
  width: 100%;
  box-sizing: border-box;
  min-height: 6.5rem;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(4, 6, 12, 0.85);
  color: #eef4ff;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0.55rem 0.65rem;
}

.ds-live-prompt:focus {
  outline: none;
  border-color: rgba(140, 190, 255, 0.45);
}

.ds-live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.ds-live-actions button {
  min-height: 34px;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
}

.ds-live-actions button.active {
  border-color: rgba(180, 150, 255, 0.55);
  background: rgba(100, 70, 160, 0.28);
  color: #e8dcff;
}

.ds-live-hint {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(200, 195, 220, 0.55);
}

body.ds-subject-locked .ds-live-hint {
  color: rgba(210, 190, 255, 0.75);
}

body.ds-subject-locked .ds-iris {
  opacity: 0.5;
  box-shadow:
    0 0 80px rgba(var(--ds-glow-rgb, 160, 130, 210), 0.4),
    inset 0 0 90px rgba(0, 0, 0, 0.3);
}

body.ds-subject-locked .ds-whisper {
  color: rgba(245, 235, 255, 0.9);
}

.ds-gate {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  gap: 0.75rem;
  background: rgba(5, 4, 10, 0.88);
  backdrop-filter: blur(10px);
}

/* Author display:flex must not override HTML hidden / .hidden */
.ds-gate[hidden],
.ds-gate.hidden,
#ds-gate[hidden],
#ds-gate.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ds-gate-simple {
  max-width: 22rem !important;
  font-size: 0.9rem !important;
}

.ds-gate-jump {
  margin: 0.35rem 0;
}

body.ds-inhabiting .ds-hud {
  z-index: 12;
}

.ds-counter {
  min-width: 5.5rem;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: rgba(240, 230, 200, 0.9);
  font-variant-numeric: tabular-nums;
}

/* Inventory overlay */
.ds-inv {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.5rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.ds-inv[hidden] {
  display: none !important;
}

.ds-inv-panel {
  width: min(100%, 520px);
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 16px 16px 12px 12px;
  background: rgba(12, 10, 20, 0.96);
  border: 1px solid rgba(180, 160, 220, 0.25);
  overflow: hidden;
}

.ds-inv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ds-inv-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #f0e8d8;
}

.ds-inv-close {
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #eee;
  font: inherit;
  cursor: pointer;
}

.ds-inv-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
}

.ds-inv-tab {
  flex: 1;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(240, 230, 220, 0.85);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.ds-inv-tab.active {
  border-color: rgba(180, 150, 255, 0.5);
  background: rgba(100, 70, 160, 0.35);
}

.ds-inv-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem 0.45rem;
  font-size: 0.78rem;
  color: rgba(220, 210, 200, 0.75);
}

.ds-inv-pager button {
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.35);
  color: #eee;
  font: inherit;
  cursor: pointer;
}

.ds-inv-grid {
  flex: 1;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  padding: 0.5rem 0.65rem 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.ds-inv-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  background: #0a0810;
  color: rgba(240, 230, 220, 0.85);
  font: inherit;
  font-size: 0.62rem;
  cursor: pointer;
  touch-action: manipulation;
}

.ds-inv-cell img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #15121c;
}

.ds-inv-cell span {
  padding: 0.15rem 0.2rem 0.3rem;
  text-align: center;
}

.ds-inv-cell:active {
  border-color: rgba(180, 150, 255, 0.55);
}

@media (min-width: 520px) {
  .ds-inv-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.ds-gate h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #f0e6d0;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

.ds-gate p {
  margin: 0;
  max-width: 36rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(230, 220, 205, 0.72);
}

.ds-gate.hidden,
body.ds-phone .ds-gate.hidden,
html.is-phone .ds-gate.hidden,
body.ds-inhabiting .ds-gate {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Dim chrome in dream — but NEVER disable tab clicks (pointer-events:none froze navigation) */
body.ds-inhabiting .money-hud,
body.ds-inhabiting .site-footer {
  opacity: 0.2;
  transition: opacity 1.2s ease;
}

body.ds-inhabiting .site-header {
  opacity: 0.55;
  transition: opacity 0.4s ease;
  pointer-events: auto;
  z-index: 50;
  position: relative;
}

body.ds-inhabiting .site-header .site-tabs,
body.ds-inhabiting .site-header .site-tabs .tab {
  pointer-events: auto;
  cursor: pointer;
}

body.ds-inhabiting #panel-dream {
  min-height: 100vh;
}

body.ds-inhabiting .ds-chamber {
  min-height: 100vh;
}

#panel-dream.ds-immersive .ds-hud {
  opacity: 0.2;
  transition: opacity 0.8s ease;
}

#panel-dream.ds-immersive .ds-hud:hover,
#panel-dream.ds-immersive .ds-hud:focus-within {
  opacity: 1;
}

.ds-gate-phone-note {
  margin: 0.25rem 0 0.5rem;
  max-width: 28rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(200, 220, 255, 0.78);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(140, 180, 255, 0.25);
  background: rgba(20, 30, 50, 0.45);
  text-align: left;
}

.ds-gate-phone-note code {
  font-size: 0.75em;
  color: #c8e0ff;
}

.ds-gate-phone-note .ds-phone-steps,
.ds-gate-phone-note .ds-phone-links {
  margin: 0.35rem 0 0.25rem;
  padding-left: 1.15rem;
}

.ds-gate-phone-note .ds-phone-steps li,
.ds-gate-phone-note .ds-phone-links li {
  margin: 0.2rem 0;
}

.ds-gate-phone-note .ds-phone-link {
  color: #9ec8ff;
  word-break: break-all;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ds-gate-phone-note .ds-phone-link-primary {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(140, 190, 255, 0.45);
  background: rgba(40, 80, 140, 0.35);
  font-weight: 600;
  color: #dff0ff;
  text-decoration: none;
}

.ds-gate-phone-note .ds-phone-tip {
  margin: 0.45rem 0 0;
  font-size: 0.74rem;
  opacity: 0.85;
}

.ds-always-cam {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 28rem;
  margin: 0.65rem 0 0.35rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: rgba(200, 220, 255, 0.85);
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.ds-always-cam input {
  margin-top: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  accent-color: #7eb6ff;
}

.ds-cam-prime {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.55rem;
  min-height: 2.75rem;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(140, 190, 255, 0.55);
  background: rgba(50, 100, 180, 0.45);
  color: #eef6ff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ds-cam-prime:active {
  transform: scale(0.98);
}

body.ds-phone .ds-cam-prime,
html.is-phone .ds-cam-prime {
  width: min(100%, 22rem);
  min-height: 3rem;
}

.ds-hud-primary,
.ds-hud-more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.ds-whisper-btn.active {
  border-color: rgba(180, 150, 255, 0.55);
  background: rgba(100, 70, 160, 0.28);
}

/* —— Phone layout —— */
body.ds-phone #panel-dream,
html.is-phone #panel-dream {
  min-height: 100dvh;
  min-height: 100vh;
}

body.ds-phone .ds-chamber,
html.is-phone .ds-chamber {
  min-height: 100dvh;
  min-height: 100vh;
}

body.ds-phone .ds-hud,
html.is-phone .ds-hud {
  position: sticky;
  bottom: 0;
  padding: 0.55rem 0.65rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(5, 4, 10, 0.94) 40%, rgba(5, 4, 10, 0.55) 100%);
  max-height: 48vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.ds-phone .ds-hud button,
html.is-phone .ds-hud button {
  min-height: 48px;
  min-width: 48px;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  touch-action: manipulation;
}

body.ds-phone .ds-hud-primary button,
html.is-phone .ds-hud-primary button {
  flex: 1 1 auto;
  max-width: 7.5rem;
}

body.ds-phone .ds-cam-pip,
html.is-phone .ds-cam-pip {
  width: 120px;
  bottom: auto;
  top: calc(3.2rem + env(safe-area-inset-top, 0px));
  left: 0.75rem;
  opacity: 0.95;
  z-index: 18;
}

body.ds-phone .ds-cam-pip video,
html.is-phone .ds-cam-pip video {
  height: 84px;
}

body.ds-phone .ds-cam-pip video.ds-cam-mirror,
html.is-phone .ds-cam-pip video.ds-cam-mirror {
  transform: scaleX(-1) !important;
  -webkit-transform: scaleX(-1) !important;
}

body.ds-phone .ds-cam-pip video.ds-cam-rear,
html.is-phone .ds-cam-pip video.ds-cam-rear {
  transform: none !important;
  -webkit-transform: none !important;
}

body.ds-phone .ds-time,
html.is-phone .ds-time {
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  font-size: 0.65rem;
  max-width: 70%;
  text-align: center;
}

body.ds-phone .ds-presence-meter,
html.is-phone .ds-presence-meter {
  top: calc(0.7rem + env(safe-area-inset-top, 0px));
  right: 0.65rem;
  font-size: 0.62rem;
  max-width: 40%;
  text-align: right;
}

body.ds-phone .ds-whisper,
html.is-phone .ds-whisper {
  bottom: 38%;
  left: 5%;
  right: 5%;
  font-size: 1.05rem;
}

body.ds-phone .ds-live-prompt-panel,
html.is-phone .ds-live-prompt-panel {
  width: 100%;
  max-width: none;
}

body.ds-phone .ds-live-prompt,
html.is-phone .ds-live-prompt {
  min-height: 5.5rem;
  font-size: 16px; /* prevent iOS zoom on focus */
}

body.ds-phone .ds-jump-num,
html.is-phone .ds-jump-num {
  font-size: 16px;
  min-height: 48px;
  width: 7.5rem;
}

body.ds-phone .ds-gate,
html.is-phone .ds-gate {
  padding: 1.25rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
  justify-content: flex-end;
  padding-bottom: 28vh;
}

body.ds-phone .ds-gate h2,
html.is-phone .ds-gate h2 {
  font-size: 2.1rem;
}

body.ds-phone .ds-enter,
html.is-phone .ds-enter {
  min-height: 52px;
  min-width: 12rem;
  font-size: 1rem;
  touch-action: manipulation;
}

/* Phone: compact header still clickable for tab changes */
body.ds-phone.ds-inhabiting .site-header,
html.is-phone body.ds-inhabiting .site-header {
  opacity: 0.75;
  pointer-events: auto;
  max-height: none;
  overflow: visible;
}

body.ds-immersive-body .site-header,
body.ds-immersive-body .money-hud {
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 640px) {
  .ds-whisper {
    bottom: 36%;
    font-size: 1.05rem;
  }
  .ds-hud {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  .ds-hud-primary {
    gap: 0.4rem;
  }
}
