.heaven-audio-trigger {
  position: fixed;
  z-index: 9310;
  top: max(10px, env(safe-area-inset-top));
  right: calc(max(12px, env(safe-area-inset-right)) + 122px);
  display: grid;
  grid-template-columns: 26px auto;
  align-items: center;
  gap: 6px;
  min-width: 92px;
  min-height: 46px;
  padding: 4px 9px;
  border: 2px solid #5cecff;
  border-right-color: #162742;
  border-bottom-color: #162742;
  color: #dffeff;
  background: linear-gradient(145deg, #253b64, #10152b 58%, #351852);
  box-shadow: 0 0 0 2px #02040b, inset 0 0 0 1px #ffffff2b, 0 0 13px #4eeeff73;
  font: 900 8px/1 "Courier New", monospace;
  letter-spacing: .07em;
  cursor: pointer;
  image-rendering: pixelated;
}
.heaven-audio-trigger i { color: #ffe35f; font-style: normal; font-size: 21px; text-shadow: 0 0 7px #62f5ff; }
.heaven-audio-trigger span { text-align: left; }
.heaven-audio-trigger b { display: block; margin-top: 3px; color: #7df6ff; font-size: 6px; }
.heaven-audio-trigger.is-muted { filter: grayscale(.75); }
.heaven-audio-panel {
  position: fixed;
  z-index: 15100;
  top: calc(max(10px, env(safe-area-inset-top)) + 54px);
  right: max(12px, env(safe-area-inset-right));
  width: min(330px, calc(100vw - 24px));
  border: 3px solid #6af0ff;
  border-right-color: #263259;
  border-bottom-color: #263259;
  padding: 13px;
  color: #eaffff;
  background: linear-gradient(155deg, #182d55f5, #070a18f8 60%, #351046f5);
  box-shadow: 0 0 0 3px #01030a, inset 0 0 28px #4eeeff1f, 0 0 24px #b04cff4d;
  clip-path: polygon(0 7px,7px 7px,7px 0,calc(100% - 7px) 0,calc(100% - 7px) 7px,100% 7px,100% calc(100% - 7px),calc(100% - 7px) calc(100% - 7px),calc(100% - 7px) 100%,7px 100%,7px calc(100% - 7px),0 calc(100% - 7px));
  font-family: "Courier New", monospace;
}
.heaven-audio-panel[hidden] { display: none !important; }
.heaven-audio-panel header { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #365579; padding-bottom: 9px; }
.heaven-audio-panel h2 { margin: 0; color: #fff4a3; font-size: 15px; letter-spacing: .11em; text-shadow: 2px 2px #a52a72,0 0 8px #58efff; }
.heaven-audio-close { width: 31px; height: 29px; border: 2px solid #7ef4ff; color: #fff; background: #101a35; font-size: 18px; cursor: pointer; }
.heaven-audio-row { display: grid; grid-template-columns: 27px 72px 1fr 34px; align-items: center; gap: 7px; margin-top: 12px; color: #bdfaff; font-size: 8px; font-weight: 900; }
.heaven-audio-row i { color: #ffe261; font-style: normal; font-size: 18px; text-align: center; }
.heaven-audio-row output { color: #fff0a1; text-align: right; }
.heaven-audio-row input { width: 100%; accent-color: #63edff; }
.heaven-audio-master { width: 100%; min-height: 38px; margin-top: 13px; border: 2px solid #ffcf57; color: #160b02; background: linear-gradient(#ffe879,#ef7c32); font-weight: 900; cursor: pointer; }
.game-open .heaven-audio-trigger, .passport-open .heaven-audio-trigger { display: none; }
.audio-open .heaven-passport-trigger { display:none; }
@media (max-width:620px) {
  .heaven-audio-trigger { top:max(8px,env(safe-area-inset-top)); right:calc(max(8px,env(safe-area-inset-right)) + 94px); min-width:58px; min-height:38px; grid-template-columns:20px auto; gap:3px; padding:3px 5px; }
  .heaven-audio-trigger i { font-size:16px; }
  .heaven-audio-trigger span { font-size:6px; }
  .heaven-audio-trigger b { font-size:5px; }
}

.heaven-audio-trigger,.heaven-audio-panel { font-family:"Lucida Console","Courier New",monospace; }
.heaven-audio-trigger { overflow:hidden; clip-path:polygon(0 5px,5px 5px,5px 0,calc(100% - 5px) 0,calc(100% - 5px) 5px,100% 5px,100% calc(100% - 5px),calc(100% - 5px) calc(100% - 5px),calc(100% - 5px) 100%,5px 100%,5px calc(100% - 5px),0 calc(100% - 5px)); }
.heaven-audio-panel::before { content:"AUDIO DEVICE // HEAVEN.WAV"; display:block; margin-bottom:8px; color:#ff71d4; font-size:6px; letter-spacing:.12em; }

/* V14 compact mixer icon and late-90s black media deck. */
.heaven-audio-trigger {
  top:max(10px,env(safe-area-inset-top));
  right:calc(max(12px,env(safe-area-inset-right)) + 126px);
  display:grid;
  place-items:center;
  width:46px;
  min-width:46px;
  height:46px;
  min-height:46px;
  padding:0;
  border-color:#7b7f88;
  color:#f8e55b;
  background:linear-gradient(#1b1c20,#040405);
  box-shadow:0 0 0 2px #000,inset 0 0 0 1px #ffffff24,0 0 8px #e5cc344d;
}
.audio-fader-icon { position:relative; display:block; width:28px; height:32px; color:inherit; font-size:0!important; filter:none!important; text-shadow:none!important; }
.audio-fader-icon b { position:absolute; top:2px; bottom:2px; width:3px; background:#8b8e94; box-shadow:1px 0 #050505; }
.audio-fader-icon b:nth-child(1) { left:4px; }
.audio-fader-icon b:nth-child(2) { left:13px; }
.audio-fader-icon b:nth-child(3) { right:3px; }
.audio-fader-icon b::after { content:""; position:absolute; left:-3px; top:var(--knob,8px); width:9px; height:5px; border:1px solid #fff; background:#d2d4d5; box-shadow:1px 1px #171717; }
.audio-fader-icon b:nth-child(2)::after { --knob:19px; }
.audio-fader-icon b:nth-child(3)::after { --knob:12px; }
.audio-fader-icon em { position:absolute; right:-2px; bottom:-4px; color:#ffe531; font:900 10px/1 "Lucida Console",monospace; text-shadow:0 0 4px #ffe14d; }
.heaven-audio-trigger.is-muted .audio-fader-icon { opacity:.48; filter:grayscale(1)!important; }
.heaven-audio-panel {
  top:calc(max(10px,env(safe-area-inset-top)) + 54px);
  border-color:#74777e;
  border-right-color:#1a1b1e;
  border-bottom-color:#1a1b1e;
  background:linear-gradient(180deg,#1a1b1f,#050506 62%,#0b0b0d);
  box-shadow:0 0 0 3px #000,inset 0 0 20px #ffffff0b,0 0 17px #e0c93038;
}
.heaven-audio-panel::before { content:"HEAVEN.WAV // MASTER DECK"; color:#e5ce39; }
.heaven-audio-panel h2 { color:#f1e15b; text-shadow:1px 1px #000,0 0 6px #ddc52f; }
.heaven-audio-meter { position:relative; display:flex; align-items:center; justify-content:center; gap:5px; height:44px; margin-top:10px; border:2px inset #4e5056; background:#020203; overflow:hidden; }
.heaven-audio-meter::before { content:""; position:absolute; left:7%; right:7%; top:50%; height:2px; background:#d5bd2f; box-shadow:0 0 4px #ffe64f; }
.heaven-audio-meter i { z-index:1; width:4px; height:var(--m,12px); background:#f2dc42; box-shadow:0 0 3px #ffe64f; animation:audio-meter .8s steps(4) infinite alternate; }
.heaven-audio-meter i:nth-child(2n) { --m:25px; animation-delay:-.2s; }
.heaven-audio-meter i:nth-child(3n) { --m:17px; animation-delay:-.4s; }
.heaven-audio-meter span { position:absolute; left:62%; top:0; width:3px; height:100%; background:#aeb0b4; }
.heaven-audio-row input { accent-color:#dec734; }
.heaven-audio-master { border-color:#85888f; color:#f7e55c; background:linear-gradient(#202125,#060607); }
@keyframes audio-meter { to { transform:scaleY(.45); opacity:.7; } }
@media (max-width:620px) {
  .heaven-audio-trigger { top:calc(max(8px,env(safe-area-inset-top)) + 82px); right:max(8px,env(safe-area-inset-right)); width:38px; min-width:38px; height:38px; min-height:38px; padding:0; }
  .audio-fader-icon { transform:scale(.78); }
  .heaven-audio-panel { top:calc(max(8px,env(safe-area-inset-top)) + 124px); }
}
@media (max-height:560px) and (orientation:landscape) {
  .heaven-audio-trigger { top:calc(max(6px,env(safe-area-inset-top)) + 80px); right:max(8px,env(safe-area-inset-right)); }
  .heaven-audio-panel { top:max(6px,env(safe-area-inset-top)); max-height:calc(100dvh - 12px); overflow:auto; }
}

/* V15 icon: gray Bible-page cross with the yellow speaker from the supplied reference. */
.heaven-audio-trigger { position:fixed; }
.audio-sheet-speaker-icon { position:relative; display:block; width:32px; height:32px; font-size:0!important; filter:none!important; }
.audio-sheet-speaker-icon b { position:absolute; left:2px; top:2px; width:22px; height:27px; border:2px solid #777; border-right-color:#111; border-bottom-color:#111; background:#c9c9c9; box-shadow:inset 0 0 0 2px #f0f0f0,2px 2px #020202; }
.audio-sheet-speaker-icon b::before,.audio-sheet-speaker-icon b::after { content:""; position:absolute; left:9px; top:4px; width:4px; height:17px; background:#111; }
.audio-sheet-speaker-icon b::after { left:4px; top:10px; width:14px; height:4px; }
.audio-sheet-speaker-icon em { position:absolute; z-index:2; right:0; bottom:2px; width:13px; height:15px; border:2px solid #111; background:#fff23f; clip-path:polygon(0 31%,35% 31%,100% 0,100% 100%,35% 69%,0 69%); filter:drop-shadow(1px 1px #6f7100); }
.audio-sheet-speaker-icon em::after { content:""; position:absolute; right:-6px; top:2px; width:7px; height:8px; border-right:2px solid #fff83e; border-radius:50%; }
.heaven-audio-trigger.is-muted::after { content:"×"; position:absolute; z-index:4; right:1px; top:-1px; display:grid; place-items:center; width:17px; height:17px; color:#fff; background:#c51c31; border:2px solid #fff; box-shadow:1px 1px #000,0 0 5px #ff344f; font:900 15px/13px "Lucida Console",monospace; }

/* V17: the supplied master-volume sprite is used verbatim on every page. */
.heaven-audio-trigger {
  overflow:hidden;
  border:0;
  background:transparent;
  box-shadow:none;
  clip-path:none;
}
.audio-master-icon {
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  image-rendering:pixelated;
  transform:scale(1.88);
  filter:drop-shadow(2px 2px #000) drop-shadow(0 0 3px #fff94d5c);
  pointer-events:none;
}
.heaven-audio-trigger.is-muted { filter:none; }
.heaven-audio-trigger.is-muted .audio-master-icon { filter:grayscale(.75) brightness(.72) drop-shadow(2px 2px #000); }

/* V18 transparent supplied sprite, scaled to the same visual weight as the HUD controls. */
.heaven-audio-trigger { width:52px; height:52px; min-width:52px; min-height:52px; }
.audio-master-icon { transform:none; object-fit:contain; filter:drop-shadow(2px 2px #000) drop-shadow(0 0 3px #fff94d5c); }
@media (max-width:700px), (pointer:coarse) {
  .heaven-audio-trigger { width:44px; height:44px; min-width:44px; min-height:44px; }
}

/* V19: requested three-times mobile master-volume control, docked beneath the upper-right HUD. */
.heaven-audio-trigger { grid-template-columns:1fr; }
@media (max-width:700px), (pointer:coarse) {
  .heaven-audio-trigger {
    top:calc(max(8px,env(safe-area-inset-top)) + 78px);
    right:max(4px,env(safe-area-inset-right));
    width:132px;
    height:132px;
    min-width:132px;
    min-height:132px;
    overflow:visible;
  }
  .heaven-audio-panel { top:calc(max(8px,env(safe-area-inset-top)) + 214px); }
}

/* V20: return the mobile master-volume sprite to the HUD button scale. */
@media (max-width:700px), (pointer:coarse) {
  .heaven-audio-trigger {
    top:calc(max(8px,env(safe-area-inset-top)) + 78px);
    right:max(8px,env(safe-area-inset-right));
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px;
    overflow:hidden;
  }
  .heaven-audio-panel { top:calc(max(8px,env(safe-area-inset-top)) + 126px); }
}

/* V21: requested three-pixel rightward nudge while preserving safe-area padding. */
@media (max-width:700px), (pointer:coarse) {
  .heaven-audio-trigger { right:max(5px,env(safe-area-inset-right)); }
}

/* V22: dock the master control beneath motion and make mobile placement edge-exact. */
@media (min-width:701px) and (pointer:fine) {
  .heaven-audio-trigger {
    top:calc(max(10px,env(safe-area-inset-top)) + 82px);
    right:max(12px,env(safe-area-inset-right));
  }
  .heaven-audio-panel {
    top:calc(max(10px,env(safe-area-inset-top)) + 138px);
    right:max(12px,env(safe-area-inset-right));
  }
}
@media (max-width:700px), (pointer:coarse) {
  .heaven-audio-trigger { right:env(safe-area-inset-right); }
  .heaven-audio-panel { right:max(4px,env(safe-area-inset-right)); }
}

/* V32 final placement: raise without changing the proven compact hit target. */
@media (min-width:701px) and (pointer:fine) {
  .heaven-audio-trigger { top:calc(max(10px,env(safe-area-inset-top)) + 80px); }
  .heaven-audio-panel { top:calc(max(10px,env(safe-area-inset-top)) + 136px); }
}
@media (max-width:700px), (pointer:coarse) {
  .heaven-audio-trigger { top:calc(max(8px,env(safe-area-inset-top)) + 73px); right:env(safe-area-inset-right); }
  .heaven-audio-panel { top:calc(max(8px,env(safe-area-inset-top)) + 121px); }
}
@media (max-height:560px) and (orientation:landscape) {
  .heaven-audio-trigger { top:calc(max(6px,env(safe-area-inset-top)) + 75px); }
}

/* V34 exact requested lift: 21px desktop, 6px mobile. */
@media (min-width:701px) and (pointer:fine) {
  .heaven-audio-trigger { top:calc(max(10px,env(safe-area-inset-top)) + 59px); }
  .heaven-audio-panel { top:calc(max(10px,env(safe-area-inset-top)) + 115px); }
}
@media (max-width:700px), (pointer:coarse) {
  .heaven-audio-trigger { top:calc(max(8px,env(safe-area-inset-top)) + 67px); }
  .heaven-audio-panel { top:calc(max(8px,env(safe-area-inset-top)) + 115px); }
}
@media (max-height:560px) and (orientation:landscape) {
  .heaven-audio-trigger { top:calc(max(6px,env(safe-area-inset-top)) + 69px); }
}

/* V35 home-page-only placement. Room pages use the final high-specificity rules
   in world-room-v29.css so the two contexts can be tuned independently. */
@media (min-width:701px) and (pointer:fine) {
  body:not([data-room]) .heaven-audio-trigger {
    top:calc(max(10px,env(safe-area-inset-top)) + 70px);
    right:max(10px,env(safe-area-inset-right));
  }
  body:not([data-room]) .heaven-audio-panel {
    top:calc(max(10px,env(safe-area-inset-top)) + 126px);
    right:max(10px,env(safe-area-inset-right));
  }
}
@media (max-width:700px), (pointer:coarse) {
  body:not([data-room]) .heaven-audio-trigger {
    top:calc(max(8px,env(safe-area-inset-top)) + 71px);
    right:calc(env(safe-area-inset-right) - 2px);
  }
  body:not([data-room]) .heaven-audio-panel {
    top:calc(max(8px,env(safe-area-inset-top)) + 119px);
  }
}
@media (max-height:560px) and (orientation:landscape) {
  body:not([data-room]) .heaven-audio-trigger { top:calc(max(6px,env(safe-area-inset-top)) + 73px); }
}

/* V36 home-only nudge: four pixels down and three pixels toward the right edge. */
@media (min-width:701px) and (pointer:fine) {
  body:not([data-room]) .heaven-audio-trigger {
    top:calc(max(10px,env(safe-area-inset-top)) + 74px);
    right:max(7px,env(safe-area-inset-right));
  }
  body:not([data-room]) .heaven-audio-panel {
    top:calc(max(10px,env(safe-area-inset-top)) + 130px);
    right:max(7px,env(safe-area-inset-right));
  }
}
