/* 2026-11-30: draggable English tools FAB + spring menu.
 *
 * The inline .puf-eng-tools bar is kept as a hidden template so the case's
 * peer/converse availability still comes from pu_choice/mobile_noncoding.
 * body.eng-fab-ready is set by english_tools_fab.js; if that script fails to
 * load, the old toolbar stays visible as a fallback.
 */
body.eng-fab-ready .puf-eng-tools {
  display: none !important;
}

.eng-fab {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  z-index: 1050;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.eng-fab[hidden] { display: none !important; }

.eng-fab-btn {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .3);
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .2), rgba(20, 20, 26, .9));
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform .38s cubic-bezier(.2, 1.65, .45, 1), box-shadow .25s ease;
}
.eng-fab-btn:hover { box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
.eng-fab-btn:active { cursor: grabbing; transform: scale(.94); }
.eng-fab-btn:focus-visible { outline: 2px solid #7aa2ff; outline-offset: 3px; }
.eng-fab.open .eng-fab-btn { transform: rotate(10deg) scale(1.02); }

.eng-fab-ico {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .2s ease, transform .42s cubic-bezier(.2, 1.7, .45, 1);
  pointer-events: none;
}
.eng-fab-ico-close {
  opacity: 0;
  transform: scale(.35) rotate(-90deg);
  font-size: 19px;
}
.eng-fab.open .eng-fab-ico-tools { opacity: 0; transform: scale(.35) rotate(90deg); }
.eng-fab.open .eng-fab-ico-close { opacity: 1; transform: scale(1) rotate(0deg); }

.eng-fab-menu {
  position: absolute;
  right: 0;
  bottom: 62px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  /* Closed menu must not swallow clicks on the page underneath. */
  pointer-events: none;
}
.eng-fab.open .eng-fab-menu { pointer-events: auto; }
.eng-fab.align-left .eng-fab-menu {
  right: auto;
  left: 0;
  align-items: flex-start;
}
.eng-fab.below .eng-fab-menu {
  top: 62px;
  bottom: auto;
  flex-direction: column-reverse;
}

.eng-fab-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(24, 24, 30, .88);
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px) scale(.72);
  transform-origin: 100% 100%;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform .45s cubic-bezier(.18, 1.75, .5, 1), opacity .16s ease;
  transition-delay: 0ms;
}
.eng-fab.below .eng-fab-item { transform: translateY(-16px) scale(.72); transform-origin: 100% 0; }
.eng-fab.align-left .eng-fab-item { transform-origin: 0 100%; }
.eng-fab.below.align-left .eng-fab-item { transform-origin: 0 0; }
.eng-fab.open .eng-fab-item {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition-delay: var(--d, 0ms);
}
.eng-fab-item:hover { background: rgba(50, 50, 60, .94); }
.eng-fab-item:focus-visible { outline: 2px solid #7aa2ff; outline-offset: 2px; }
.eng-fab-item-ico { font-size: 16px; line-height: 1; }
.eng-fab-item-lbl { line-height: 1; }

@media (max-width: 600px) {
  /* Clear the fixed Submit bar at the bottom of mobile.html. */
  .eng-fab { right: 12px; bottom: 150px; }
  .eng-fab-item { padding: 9px 14px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .eng-fab-btn,
  .eng-fab-ico,
  .eng-fab-item { transition: none !important; }
}

/* 2026-11-30 P4-S: English report/dashboard modals.
 * The mobile page injects SweetAlert's white CSS after its dark overrides,
 * leaving inherited text light on white. Pin these modals to a light card
 * with explicit dark text so both desktop and mobile stay readable. */
.swal2-popup.engdb-popup { background: #fff; color: #24292f; }
.swal2-popup.engdb-popup .swal2-title,
.swal2-popup.engdb-popup .swal2-html-container { color: #24292f; }
.swal2-popup.engdb-popup .swal2-confirm { background: #0d6efd; color: #fff; }
