.speech-caption {
  position: absolute;
  z-index: 3;
  top: 20%;
  right: 2%;
  width: min(78%, 370px);
  max-height: 58%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  pointer-events: none;
  color: #fff;
  text-align: right;
}
.speech-caption-toggle {
  flex: none;
  align-self: flex-end;
  max-width: 100%;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: right;
  font-size: 12px;
  line-height: 1.5;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
  cursor: pointer;
  pointer-events: auto;
}
.speech-caption-toggle span { color: #e0e5e8; font-size: 9px; }
.speech-caption-log {
  overflow-y: auto;
  max-height: 42vh;
  padding: 2px 3px 4px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ffffff70 transparent;
  pointer-events: auto;
}
.speech-caption-log::-webkit-scrollbar { width: 4px; }
.speech-caption-log::-webkit-scrollbar-thumb { background: #ffffff70; border-radius: 3px; }
.speech-caption-line {
  padding: 3px 1px;
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
}
.speech-caption-line > span { display: block; color: #edf0f1; font-size: 9px; }
.speech-caption-line p { margin: 0; overflow-wrap: anywhere; }
.speech-caption-demo {
  flex: none;
  align-self: flex-end;
  color: #fff9;
  font-size: 8px;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
  pointer-events: none;
}
.device-lines .maglock-state { display: flex; align-items: center; gap: 3px; width: fit-content; padding: 2px 4px; border: 1px solid #ffffff45; border-radius: 3px; background: #06110dbb; }
.maglock-state .maglock-led { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #48dc86; box-shadow: 0 0 7px #48dc86; }
.maglock-state b { font-weight: 600; }
.device-lines .maglock-open { border-color: #ff606a; background: #651c29e8; color: #fff; animation: maglock-alert-pulse 1s ease-in-out infinite alternate; }
.maglock-state.maglock-open .maglock-led { background: #ff3447; box-shadow: 0 0 9px #ff3447; }
.maglock-warning { position: absolute; z-index: 4; top: 31%; right: 2%; display: grid; gap: 4px; padding: 7px 9px; border-left: 3px solid #ff3649; background: #641622d9; color: #fff; text-shadow: 0 1px 2px #26060a; font-size: 10px; pointer-events: none; animation: maglock-alert-pulse 1s ease-in-out infinite alternate; }
.maglock-warning span { font-size: 9px; }
@keyframes maglock-alert-pulse { from { opacity: .82; } to { opacity: 1; } }
@media(max-width:800px) {
  .speech-caption { top: 24%; width: 83%; max-height: 55%; }
  .speech-caption-toggle { font-size: 9px; }
  .speech-caption-line { font-size: 9px; }
  .speech-caption-log { max-height: 36vh; }
}
@media(max-width:520px) {
  .speech-caption { top: 28%; right: 2%; width: 88%; }
  .speech-caption-line { font-size: 8px; }
}
