/* Companion AR UI — glow button + video modal */

.ar-action-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.ar-glow-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.88);
  pointer-events: auto;
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
  --glow-a: #00f5ff;
  --glow-b: #5b9fd4;
  --glow-ring: #00f5ff8c;
  --glow-ring-2: #5b9fd473;
  --glow-shadow-a: #00f5ffb3;
  --glow-shadow-b: #00b4ff59;
}

.ar-glow-btn--circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: transparent;
}

.ar-glow-btn__core {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, var(--glow-a) 45%, var(--glow-b) 100%);
  box-shadow:
    0 0 16px var(--glow-shadow-a),
    0 0 32px var(--glow-shadow-b);
  animation: glow-btn-pulse 2.2s ease-in-out infinite;
}

.ar-glow-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.ar-glow-btn:active {
  transform: translate(-50%, -50%) scale(0.92);
}

.ar-glow-btn__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--glow-ring);
  animation: glow-ring 2.2s ease-out infinite;
  pointer-events: none;
}

.ar-glow-btn__ring--2 {
  animation-delay: 1.1s;
  border-color: var(--glow-ring-2);
}

/* Achievement-style companion toast */
.companion-toast {
  position: fixed;
  left: 50%;
  bottom: max(22vh, 6.5rem);
  transform: translateX(-50%) translateY(24px) scale(0.92);
  width: min(92vw, 440px);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.15rem 1rem 1rem;
  border-radius: 14px;
  border: 2px solid rgba(255, 214, 96, 0.55);
  background:
    linear-gradient(135deg, rgba(18, 28, 42, 0.94) 0%, rgba(8, 14, 24, 0.96) 100%);
  box-shadow:
    0 0 0 1px rgba(0, 245, 255, 0.15) inset,
    0 0 28px rgba(0, 245, 255, 0.22),
    0 0 48px rgba(255, 200, 64, 0.12),
    0 12px 32px rgba(0, 0, 0, 0.45);
  color: #eef8ff;
  pointer-events: none;
  z-index: 22;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
}

.companion-toast.visible {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.companion-toast.is-entering {
  animation: companion-toast-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.companion-toast__shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.14) 48%,
    transparent 62%
  );
  transform: translateX(-120%);
  animation: companion-toast-shine 2.8s ease-in-out 0.35s infinite;
  pointer-events: none;
}

.companion-toast__badge {
  position: relative;
  z-index: 1;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: #1a1200;
  background: radial-gradient(circle at 30% 25%, #fff6c8, #ffd54a 45%, #e6a820 100%);
  box-shadow:
    0 0 18px rgba(255, 210, 70, 0.65),
    0 0 0 3px rgba(255, 230, 140, 0.35);
  animation: companion-badge-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.companion-toast__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.companion-toast__eyebrow {
  font: 700 0.72rem/1.2 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffd86a;
  text-shadow: 0 0 12px rgba(255, 210, 80, 0.45);
}

.companion-toast__title {
  font: 700 1.15rem/1.25 "Segoe UI", system-ui, sans-serif;
  color: #f4fbff;
  text-shadow: 0 0 16px rgba(0, 245, 255, 0.35);
}

@keyframes companion-toast-in {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(28px) scale(0.88);
  }
  55% {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes companion-badge-pop {
  0% {
    transform: scale(0.4) rotate(-18deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.12) rotate(6deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes companion-toast-shine {
  0%,
  72% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes glow-btn-pulse {
  0%,
  100% {
    box-shadow:
      0 0 16px var(--glow-shadow-a),
      0 0 32px var(--glow-shadow-b);
  }
  50% {
    box-shadow:
      0 0 24px var(--glow-shadow-a),
      0 0 48px var(--glow-shadow-b);
  }
}

@keyframes glow-ring {
  0% {
    transform: scale(1);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* Video modal */
.companion-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  background: rgba(6, 10, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.companion-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.companion-modal.hidden {
  display: none;
}

.companion-modal__panel {
  width: min(96vw, 720px);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(0, 245, 255, 0.25);
  background: linear-gradient(160deg, #141c28 0%, #0b1118 100%);
  box-shadow:
    0 0 40px rgba(0, 245, 255, 0.12),
    0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: modal-in 0.35s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.companion-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.companion-modal__header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e8edf4;
}

.companion-modal__actions {
  display: flex;
  gap: 0.4rem;
}

.companion-modal__btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #c8d4e0;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.companion-modal__btn:hover {
  border-color: rgba(0, 245, 255, 0.4);
  color: #fff;
}

.companion-modal__body {
  padding: 0;
  background: #000;
}

.companion-modal__body video {
  display: block;
  width: 100%;
  max-height: min(72vh, 640px);
  background: #000;
}

.companion-mini {
  position: fixed;
  right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  background: rgba(15, 22, 32, 0.92);
  color: #d8ebfb;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
  animation: glow-btn-pulse 2.2s ease-in-out infinite;
}

.companion-mini.hidden {
  display: none;
}

.companion-mini__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00f5ff, #5b9fd4);
  display: grid;
  place-items: center;
  font-size: 0.6rem;
  color: #041018;
}

@media (max-width: 480px) {
  .ar-glow-btn--circle {
    width: 68px;
    height: 68px;
  }

  .ar-glow-btn__core {
    inset: 16px;
  }

  .companion-toast {
    bottom: max(24vh, 7rem);
    padding: 0.95rem 1rem 0.95rem 0.9rem;
    gap: 0.75rem;
  }

  .companion-toast__badge {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }

  .companion-toast__eyebrow {
    font-size: 0.68rem;
  }

  .companion-toast__title {
    font-size: 1.05rem;
  }
}

/* Wavy AR hotspot outlines (operator scheme) */
.ar-wavy-hotspot {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease;
  --wavy-color: #b44dff;
}

.ar-wavy-hotspot.visible {
  opacity: 1;
  visibility: visible;
}

.ar-wavy-hotspot__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 8px var(--wavy-color));
}

.ar-wavy-hotspot__path {
  fill: none;
  stroke: var(--wavy-color);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.ar-wavy-hotspot__path--a {
  stroke-dasharray: 7 9 4 11;
  animation: wavy-dash-a 2.8s linear infinite;
}

.ar-wavy-hotspot__path--b {
  stroke-dasharray: 5 12 3 8;
  stroke-opacity: 0.55;
  animation: wavy-dash-b 3.4s linear infinite reverse;
}

.ar-wavy-hotspot:active .ar-wavy-hotspot__svg {
  transform: scale(0.97);
  transition: transform 0.15s ease;
}

@keyframes wavy-dash-a {
  to {
    stroke-dashoffset: -58;
  }
}

@keyframes wavy-dash-b {
  to {
    stroke-dashoffset: 62;
  }
}

/* Prompt modal */
.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  background: rgba(6, 10, 16, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.prompt-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.prompt-modal.hidden {
  display: none;
}

.prompt-modal__panel {
  width: min(96vw, 720px);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(180, 77, 255, 0.35);
  background: linear-gradient(160deg, #141c28 0%, #0b1118 100%);
  box-shadow:
    0 0 40px rgba(180, 77, 255, 0.14),
    0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: modal-in 0.35s ease;
}

.prompt-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.prompt-modal__header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e8edf4;
}

.prompt-modal__body {
  padding: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.prompt-modal__text {
  margin: 0;
  padding: 1rem 1.1rem 1.2rem;
  font: 0.74rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #d4e2f0;
  white-space: pre-wrap;
  word-break: break-word;
}
