.home-sound {
  --sound-size: 38px;
  --sound-right: max(16px, calc(env(safe-area-inset-right) + 12px));
  position: fixed;
  z-index: 30;
  right: var(--sound-right);
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px));
  display: grid;
  gap: 6px;
  color: #fff4e4;
}

.home-sound [hidden], .home-sound[hidden] { display: none; }

.sound-button, .sound-dial {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--sound-size);
  height: var(--sound-size);
  padding: 0;
  border: 1px solid #fff7e673;
  border-radius: 50%;
  background: #2c2119a6;
  color: inherit;
  cursor: pointer;
}

.sound-button:hover, .sound-dial:hover, .sound-button[aria-pressed="true"] {
  border-color: #fff1d1c2;
  background: #312318d4;
}

.sound-button:focus-visible, .sound-dial:focus-within {
  outline: 1px solid #fff1d1;
  outline-offset: 3px;
}

.home-sound svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-dial-mark {
  position: absolute;
  width: 17px;
  height: 17px;
  transform: rotate(var(--volume-angle, 0deg));
  pointer-events: none;
}

.sound-dial-mark::before {
  content: "";
  position: absolute;
  top: 2px;
  left: calc(50% - 1px);
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
}

.sound-dial input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: grab;
  touch-action: none;
}

.sound-dial input[type="range"]:active { cursor: grabbing; }

.sound-dial:has(input:disabled) { opacity: .62; }
.sound-dial input:disabled { cursor: default; }

.sound-status {
  position: absolute;
  right: calc(100% + 9px);
  top: 0;
  width: max-content;
  max-width: min(220px, calc(100vw - 78px));
  padding: 7px 10px;
  border-radius: 5px;
  background: #2c2119ed;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
}

@media (pointer: coarse) { .home-sound { --sound-size: 44px; } }

@media (min-width: 1121px) { .intro-skip { right: max(72px, calc(env(safe-area-inset-right) + 65px)); } }

@media (max-width: 1120px) {
  .home-sound { bottom: calc(max(44px, calc(env(safe-area-inset-bottom) + 34px)) + 72px); }
}

@media (max-width: 700px) and (orientation: portrait) {
  .home-sound { bottom: calc(max(24px, calc(env(safe-area-inset-bottom) + 16px)) + 126px); }
}

@media (max-width: 1120px) and (max-height: 450px) and (orientation: landscape) {
  .home-sound { bottom: calc(max(27px, calc(env(safe-area-inset-bottom) + 12px)) + 55px); }
}

.study-entry {
  position: absolute;
  inset: 0;
  z-index: 12;
  width: 100%;
  display: grid;
  place-items: center;
  border: 0;
  background: rgb(255 247 231 / 28%);
  color: #44372a;
  cursor: pointer;
  animation: entry-arrival .9s ease both;
  transition: opacity .9s ease;
}
.study-entry[hidden], .entry-cue[hidden] { display: none; }
.study-entry.entered { opacity: 0; pointer-events: none; animation: none; }
.entry-label {
  padding: .64rem 1.15rem;
  border: 1px solid #fff5dfd6;
  border-radius: 999px;
  background: #f4ead7dc;
  font: 400 16px/1.2 var(--serif);
  letter-spacing: .16em;
}
.study-entry:focus-visible .entry-label { outline: 2px solid #705b3d; outline-offset: 4px; }
.entry-cue {
  position: fixed;
  pointer-events: none;
  padding: 2px 6px;
  border-radius: 4px;
  background: #30251bd9;
  color: #fff4e4;
  font: 12px/1.4 Georgia, serif;
}
.entry-active .dock { opacity: 0; pointer-events: none; }
.entry-active .home-sound { visibility: hidden; }
.sub-active .home-sound { bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)); }
@keyframes entry-arrival { from { background-color: #fff7e7; } }
