:root {
  --esw-pz-size: 52px;
  --esw-pz-mobile-size: 48px;
  --esw-pz-offset-x: 18px;
  --esw-pz-offset-y: 18px;
}

html.esw-pz-mode,
html.esw-pz-mode body {
  overscroll-behavior: none !important;
}

body.esw-pz-camera {
  transform-origin: 0 0 !important;
  will-change: transform;
  backface-visibility: hidden;
}

#esw-pz-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: transparent;
  pointer-events: none;
  touch-action: none;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

html.esw-pz-mode #esw-pz-overlay {
  pointer-events: auto;
  cursor: crosshair;
}

#esw-pz-controls {
  position: fixed;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#esw-pz-controls.esw-pz-bottom-center { left: 50%; bottom: var(--esw-pz-offset-y); transform: translateX(-50%); }
#esw-pz-controls.esw-pz-bottom-left   { left: var(--esw-pz-offset-x); bottom: var(--esw-pz-offset-y); }
#esw-pz-controls.esw-pz-bottom-right  { right: var(--esw-pz-offset-x); bottom: var(--esw-pz-offset-y); }
#esw-pz-controls.esw-pz-top-center    { left: 50%; top: var(--esw-pz-offset-y); transform: translateX(-50%); }
#esw-pz-controls.esw-pz-top-left      { left: var(--esw-pz-offset-x); top: var(--esw-pz-offset-y); }
#esw-pz-controls.esw-pz-top-right     { right: var(--esw-pz-offset-x); top: var(--esw-pz-offset-y); }

.esw-pz-btn {
  width: var(--esw-pz-size);
  height: var(--esw-pz-size);
  min-width: var(--esw-pz-size);
  border-radius: 50%;
  border: 1px solid #111;
  background: rgba(255,255,255,.96);
  color: #111;
  box-shadow: 0 3px 14px rgba(0,0,0,.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: calc(var(--esw-pz-size) * .43);
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.esw-pz-btn:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
.esw-pz-side { display: none; }
#esw-pz-controls.esw-pz-active .esw-pz-side { display: inline-flex; }
#esw-pz-toggle svg { width: 48%; height: 48%; pointer-events:none; }

#esw-pz-hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--esw-pz-offset-y) + var(--esw-pz-size) + 14px);
  transform: translateX(-50%);
  z-index: 2147483645;
  max-width: min(520px, calc(100vw - 28px));
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid #111;
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  color: #111;
  font: 600 13px/1.35 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  text-align:center;
  box-shadow: 0 3px 14px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
#esw-pz-hint.esw-pz-show { opacity: 1; }

@media (max-width: 700px) {
  .esw-pz-btn {
    width: var(--esw-pz-mobile-size);
    height: var(--esw-pz-mobile-size);
    min-width: var(--esw-pz-mobile-size);
    font-size: calc(var(--esw-pz-mobile-size) * .43);
  }
}

@media (prefers-color-scheme: dark) {
  .esw-pz-btn, #esw-pz-hint {
    background: rgba(20,20,20,.96);
    color: #fff;
    border-color: #fff;
  }
}

/* Footer-trigger activation mode: keep the floating magnifier completely
   hidden until Presentation Zoom has been activated from the footer trigger. */
#esw-pz-controls.esw-pz-mode-trigger:not(.esw-pz-active) {
  display: none;
}

#esw-pz-controls.esw-pz-mode-trigger .esw-pz-close {
  font-size: 1.25em;
  font-weight: 500;
  line-height: 1;
}

.esw-pz-footer-trigger {
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* Pause / standby control. While paused the shield is inactive, normal page
   interaction is restored, and zoom +/- controls are intentionally disabled. */
#esw-pz-pause {
  font-size: calc(var(--esw-pz-size) * .31);
  letter-spacing: -0.08em;
}
#esw-pz-controls.esw-pz-paused #esw-pz-pause {
  letter-spacing: 0;
  font-size: calc(var(--esw-pz-size) * .38);
}
.esw-pz-btn:disabled {
  opacity: .42;
  cursor: default;
}
@media (max-width: 700px) {
  #esw-pz-pause { font-size: calc(var(--esw-pz-mobile-size) * .31); }
  #esw-pz-controls.esw-pz-paused #esw-pz-pause { font-size: calc(var(--esw-pz-mobile-size) * .38); }
}

/* Help button and gesture guide. */
#esw-pz-help-btn {
  font-size: calc(var(--esw-pz-size) * .38);
  font-weight: 800;
}
#esw-pz-help {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(0,0,0,.28);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#esw-pz-help.esw-pz-show { display: flex; }
.esw-pz-help-card {
  width: min(620px, 100%);
  max-height: min(78vh, 720px);
  overflow: auto;
  box-sizing: border-box;
  background: rgba(255,255,255,.98);
  color: #111;
  border: 1px solid #111;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
}
.esw-pz-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 18px;
}
#esw-pz-help-close {
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: 500 25px/1 sans-serif;
  cursor: pointer;
}
.esw-pz-help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px 16px;
}
.esw-pz-help-grid > div {
  min-width: 0;
  border-top: 1px solid rgba(0,0,0,.22);
  padding-top: 9px;
}
.esw-pz-help-grid b,
.esw-pz-help-grid span { display: block; }
.esw-pz-help-grid span { margin-top: 3px; font-size: 13px; line-height: 1.4; }
.esw-pz-help-tip {
  margin: 15px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,.22);
  font-size: 13px;
  line-height: 1.45;
}
@media (max-width: 700px) {
  #esw-pz-help-btn { font-size: calc(var(--esw-pz-mobile-size) * .38); }
  .esw-pz-help-grid { grid-template-columns: 1fr; }
  .esw-pz-help-card { max-height: 76vh; padding: 14px; }
}
@media (max-width: 360px) {
  #esw-pz-controls { gap: 5px; }
}
@media (prefers-color-scheme: dark) {
  .esw-pz-help-card {
    background: rgba(20,20,20,.98);
    color: #fff;
    border-color: #fff;
  }
  .esw-pz-help-grid > div,
  .esw-pz-help-tip { border-color: rgba(255,255,255,.28); }
}

.esw-pz-help-credit {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid currentColor;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  opacity: .78;
}
.esw-pz-help-credit a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.esw-pz-help-credit a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}


/* Continuous movement compass / clock navigator. */
#esw-pz-compass-btn {
  font-size: calc(var(--esw-pz-size) * .36);
  font-weight: 700;
}
#esw-pz-compass {
  position: fixed;
  z-index: 2147483645;
  display: none;
  left: 50%;
  bottom: calc(var(--esw-pz-offset-y) + var(--esw-pz-size) + 14px);
  transform: translateX(-50%);
  --esw-pz-compass-scale: 1;
  width: calc(188px * var(--esw-pz-compass-scale));
  height: calc(188px * var(--esw-pz-compass-scale));
  pointer-events: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#esw-pz-compass.esw-pz-show { display: block; }
.esw-pz-compass-face {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 1px solid #111;
  border-radius: 50%;
  background: rgba(255,255,255,.97);
  box-shadow: 0 5px 20px rgba(0,0,0,.24);
}
.esw-pz-dir {
  position: absolute;
  transform: translate(-50%,-50%);
  width: calc(36px * var(--esw-pz-compass-scale));
  height: calc(36px * var(--esw-pz-compass-scale));
  min-width: calc(36px * var(--esw-pz-compass-scale));
  padding: 0;
  margin: 0;
  border: 1px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 calc(10px * var(--esw-pz-compass-scale))/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  box-sizing: border-box;
}

.esw-pz-dir > * { pointer-events: none; }
.esw-pz-dir.esw-pz-moving {
  outline: 3px solid currentColor;
  outline-offset: 2px;
  font-weight: 900;
  transform: translate(-50%,-50%) scale(1.08);
}
.esw-pz-compass-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  width: calc(52px * var(--esw-pz-compass-scale));
  height: calc(52px * var(--esw-pz-compass-scale));
  min-width: calc(52px * var(--esw-pz-compass-scale));
  padding: 0;
  border: 1px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 calc(24px * var(--esw-pz-compass-scale))/1 sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.esw-pz-dir:focus-visible,
.esw-pz-compass-center:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}
@media (max-width: 700px) {
  #esw-pz-compass-btn { font-size: calc(var(--esw-pz-mobile-size) * .36); }
  #esw-pz-compass {
    width: calc(174px * var(--esw-pz-compass-scale));
    height: calc(174px * var(--esw-pz-compass-scale));
    bottom: calc(var(--esw-pz-offset-y) + var(--esw-pz-mobile-size) + 12px);
  }
  .esw-pz-dir {
    width: calc(34px * var(--esw-pz-compass-scale));
    height: calc(34px * var(--esw-pz-compass-scale));
    min-width: calc(34px * var(--esw-pz-compass-scale));
  }
  .esw-pz-compass-center {
    width: calc(48px * var(--esw-pz-compass-scale));
    height: calc(48px * var(--esw-pz-compass-scale));
    min-width: calc(48px * var(--esw-pz-compass-scale));
  }
}
@media (prefers-color-scheme: dark) {
  .esw-pz-compass-face,
  .esw-pz-dir,
  .esw-pz-compass-center {
    background: rgba(20,20,20,.98);
    color: #fff;
    border-color: #fff;
  }
}


.esw-pz-compass-tools {
  position: absolute;
  left: 50%;
  top: -38px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border: 1px solid #111;
  border-radius: 999px;
  background: rgba(255,255,255,.97);
  z-index: 5;
  box-sizing: border-box;
}
.esw-pz-compass-tools button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 1px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 800 16px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  cursor: pointer;
  touch-action: none;
  box-sizing: border-box;
}
.esw-pz-compass-drag { cursor: grab !important; }
.esw-pz-compass-dragging .esw-pz-compass-drag { cursor: grabbing !important; }
.esw-pz-compass-dragging { user-select: none; }
@media (prefers-color-scheme: dark) {
  .esw-pz-compass-tools,
  .esw-pz-compass-tools button {
    background: rgba(20,20,20,.98);
    color: #fff;
    border-color: #fff;
  }
}


/* Continuous movement speed selector. */
#esw-pz-speed-btn {
  font-size: calc(var(--esw-pz-size) * .30);
  font-weight: 800;
}
#esw-pz-speed {
  position: fixed;
  z-index: 2147483645;
  display: none;
  left: 50%;
  bottom: calc(var(--esw-pz-offset-y) + var(--esw-pz-size) + 14px);
  transform: translateX(-50%);
  pointer-events: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#esw-pz-speed.esw-pz-show { display: block; }
.esw-pz-speed-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #111;
  border-radius: 999px;
  background: rgba(255,255,255,.97);
  color: #111;
  box-shadow: 0 5px 20px rgba(0,0,0,.20);
}
.esw-pz-speed-label { font-size: 12px; font-weight: 700; }
.esw-pz-speed-options { display: flex; gap: 5px; }
.esw-pz-speed-option {
  width: 34px; height: 34px; min-width: 34px; padding: 0; margin: 0;
  border: 1px solid #111; border-radius: 50%; background: #fff; color: #111;
  font: 700 12px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  cursor: pointer; touch-action: manipulation;
}
.esw-pz-speed-option.esw-pz-selected {
  background: #111; color: #fff;
}
.esw-pz-speed-option:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
@media (max-width: 700px) {
  #esw-pz-speed-btn { font-size: calc(var(--esw-pz-mobile-size) * .30); }
  #esw-pz-speed { bottom: calc(var(--esw-pz-offset-y) + var(--esw-pz-mobile-size) + 12px); }
  .esw-pz-speed-card { gap: 6px; padding: 7px 8px; }
  .esw-pz-speed-option { width: 32px; height: 32px; min-width: 32px; }
}
@media (prefers-color-scheme: dark) {
  .esw-pz-speed-card, .esw-pz-speed-option { background: rgba(20,20,20,.98); color: #fff; border-color: #fff; }
  .esw-pz-speed-option.esw-pz-selected { background: #fff; color: #111; }
}


/* Screen annotation tools */
#esw-pz-annotate-btn {
  font-size: calc(var(--esw-pz-size) * .36);
  font-weight: 800;
}
#esw-pz-annotation-canvas {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: none;
  cursor: crosshair;
}
#esw-pz-annotation-canvas.esw-pz-active {
  pointer-events: auto;
}
#esw-pz-annotation-canvas[data-mode="eraser"] { cursor: cell; }

#esw-pz-annotation-tools {
  position: fixed;
  z-index: 2147483645;
  display: none;
  left: 50%;
  bottom: calc(var(--esw-pz-offset-y) + var(--esw-pz-size) + 14px);
  transform: translateX(-50%);
  pointer-events: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#esw-pz-annotation-tools.esw-pz-show { display: block; }

.esw-pz-annotation-card {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 7px 9px;
  border: 1px solid #111;
  border-radius: 14px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 5px 20px rgba(0,0,0,.22);
  color: #111;
}
.esw-pz-annotation-modes,
.esw-pz-annotation-colors,
.esw-pz-annotation-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.esw-pz-annotation-card button {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #111;
  border-radius: 9px;
  background: #fff;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 15px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  cursor: pointer;
  box-sizing: border-box;
}
.esw-pz-annotation-card button.is-active,
#esw-pz-annotate-btn.esw-pz-selected {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}
.esw-pz-color {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: var(--esw-pz-swatch) !important;
}
.esw-pz-color[data-annotate-color="#ffffff"] {
  box-shadow: inset 0 0 0 1px #777;
}
#esw-pz-annotation-clear {
  min-width: 48px;
  font-size: 11px;
}
@media (max-width: 700px) {
  #esw-pz-annotate-btn { font-size: calc(var(--esw-pz-mobile-size) * .36); }
  #esw-pz-annotation-tools {
    left: 8px;
    right: 8px;
    bottom: calc(var(--esw-pz-offset-y) + var(--esw-pz-mobile-size) + 12px);
    transform: none;
  }
  .esw-pz-annotation-card {
    gap: 6px;
    padding: 6px;
  }
  .esw-pz-annotation-card button {
    min-width: 32px;
    height: 32px;
  }
}
@media (max-width: 380px) {
  .esw-pz-annotation-card {
    max-width: 100%;
  }
  .esw-pz-annotation-colors {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}
@media (prefers-color-scheme: dark) {
  .esw-pz-annotation-card,
  .esw-pz-annotation-card button {
    background: rgba(20,20,20,.98);
    color: #fff;
    border-color: #fff;
  }
  .esw-pz-color[data-annotate-color="#ffffff"] {
    box-shadow: inset 0 0 0 1px #bbb;
  }
}


#esw-pz-attribution {
  position: fixed;
  z-index: 2147483644;
  left: 50%;
  bottom: max(3px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font: 500 10px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: currentColor;
  opacity: .55;
  text-decoration: none;
  pointer-events: auto;
  white-space: nowrap;
}
#esw-pz-attribution:hover,
#esw-pz-attribution:focus-visible { opacity: .9; text-decoration: underline; }
