/* Voice-over dock (voiceover.js): bottom left, above every screen, foldable to a round button. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.narrator { position: fixed; z-index: 95; left: 16px; bottom: 16px; width: min(560px, calc(100vw - 32px)); font-family: Manrope, sans-serif; color: var(--paper, #eef1e8); pointer-events: none; }
.narrator > * { pointer-events: auto; }
.narrator__bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; background: rgba(5, 18, 28, .93); border: 1px solid rgba(84, 223, 215, .32); border-radius: 16px; box-shadow: 0 14px 40px rgba(0, 0, 0, .35); backdrop-filter: blur(12px); }
.narrator__fold { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(84, 223, 215, .45); border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(84, 223, 215, .28), rgba(7, 33, 46, .9)); cursor: pointer; }
.narrator__fold:focus-visible, .narrator__controls button:focus-visible, .narrator__settings input:focus-visible { outline: 2px solid var(--cyan, #54dfd7); outline-offset: 2px; }
.narrator__wave { display: flex; align-items: center; gap: 3px; height: 18px; }
.narrator__wave i { width: 3px; height: 6px; border-radius: 2px; background: var(--cyan, #54dfd7); opacity: .75; }
.narrator[data-status="playing"] .narrator__wave i { animation: narrator-wave .9s ease-in-out infinite; }
.narrator[data-status="playing"] .narrator__wave i:nth-child(2) { animation-delay: .15s; }
.narrator[data-status="playing"] .narrator__wave i:nth-child(3) { animation-delay: .3s; }
@keyframes narrator-wave { 0%, 100% { height: 5px; } 50% { height: 18px; } }
.narrator[data-status="paused"] .narrator__fold { border-color: #f5b84b; }
.narrator__info { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.narrator__info small { color: var(--cyan, #54dfd7); font: 500 9.5px DM Mono, monospace; letter-spacing: .16em; }
.narrator[data-status="paused"] .narrator__info small { color: #f5b84b; }
.narrator__info strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13.5px; }
.narrator.is-empty .narrator__info strong { color: #7f939c; font-weight: 600; }
.narrator__track { display: block; height: 3px; margin-top: 3px; border-radius: 3px; background: rgba(150, 206, 212, .16); overflow: hidden; }
.narrator__track b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan, #54dfd7), var(--mint, #b4f9dc)); transition: width .25s linear; }
.narrator__controls { flex: 0 0 auto; display: flex; gap: 5px; }
.narrator__controls button { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 10px; border: 1px solid rgba(150, 206, 212, .24); border-radius: 10px; background: rgba(12, 33, 50, .9); font: 700 12px Manrope, sans-serif; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.narrator__controls button:hover:not(:disabled) { border-color: var(--cyan, #54dfd7); background: rgba(84, 223, 215, .12); }
.narrator__controls button:active:not(:disabled) { transform: scale(.96); }
.narrator__controls button:disabled { opacity: .35; cursor: default; }
.narrator__controls button[hidden] { display: none; }
.narrator__controls [data-act="play"], .narrator__controls [data-act="resume"] { color: #04161c; background: var(--cyan, #54dfd7); border-color: var(--cyan, #54dfd7); }
.narrator__controls [data-act="play"]:hover:not(:disabled), .narrator__controls [data-act="resume"]:hover:not(:disabled) { background: var(--mint, #b4f9dc); }
.narrator__more { padding: 0 9px !important; }
.narrator__settings { margin-top: 6px; padding: 10px 14px; display: grid; gap: 8px; background: rgba(5, 18, 28, .95); border: 1px solid rgba(150, 206, 212, .22); border-radius: 14px; font-size: 13px; }
.narrator__settings[hidden] { display: none; }
.narrator__settings label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.narrator__settings input { width: 17px; height: 17px; accent-color: var(--cyan, #54dfd7); }
.narrator__caption { margin: 0 0 6px; padding: 10px 14px; max-height: 30vh; overflow: auto; background: rgba(3, 14, 22, .95); border: 1px solid rgba(84, 223, 215, .3); border-radius: 14px; font-size: 13.5px; line-height: 1.55; color: #dff7f5; }
.narrator__caption[hidden] { display: none; }

/* Folded (by the user, or by itself while the screen has no voice-over): only the round button. */
.narrator.is-folded, .narrator.is-empty:not(.is-open) { width: auto !important; }
.narrator.is-folded .narrator__bar, .narrator.is-empty:not(.is-open) .narrator__bar { padding: 4px; border-radius: 50%; }
.narrator.is-folded .narrator__info, .narrator.is-folded .narrator__controls, .narrator.is-folded .narrator__settings, .narrator.is-folded .narrator__caption,
.narrator.is-empty:not(.is-open) .narrator__info, .narrator.is-empty:not(.is-open) .narrator__controls, .narrator.is-empty:not(.is-open) .narrator__settings { display: none; }
.narrator.is-empty:not(.is-open) .narrator__fold { opacity: .7; }

/* In the 3D laboratory the labels shrink to icons so the dock stays small. */
body:has(#game-screen.active) .narrator:not(.is-folded) { width: min(420px, calc(100vw - 32px)); }
body:has(#game-screen.active) .narrator__controls button { padding: 0 9px; font-size: 0; gap: 0; }
body:has(#game-screen.active) .narrator__controls button span { font-size: 12px; }

@media (max-width: 620px) {
  .narrator { left: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .narrator__controls button { padding: 0 8px; font-size: 0; gap: 0; min-height: 40px; min-width: 40px; justify-content: center; }
  .narrator__controls button span { font-size: 13px; }
}
@media (pointer: coarse) {
  .narrator__controls button { min-height: 42px; min-width: 42px; justify-content: center; }
  .narrator__fold { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .narrator[data-status="playing"] .narrator__wave i { animation: none; height: 14px; }
}
