.apps-buggiman-rail,
.apps-shell-return-handoff,
.apps-buggiman-modal,
.apps-first-use-modal {
  --apps-shell-return-safe-top: var(--mig-safe-area-top, env(safe-area-inset-top, 0px));
  --apps-shell-return-safe-right: var(--mig-safe-area-right, env(safe-area-inset-right, 0px));
  --apps-shell-return-safe-bottom: var(--mig-safe-area-bottom, env(safe-area-inset-bottom, 0px));
  --apps-shell-return-safe-left: var(--mig-safe-area-left, env(safe-area-inset-left, 0px));
}

.apps-provider-overlay-root[data-overlay-root] {
  position: fixed;
  z-index: 1190;
  top: var(--mig-overlay-visual-top, 0px);
  left: var(--mig-overlay-visual-left, 0px);
  width: var(--mig-overlay-visual-width, 100%);
  height: var(--mig-overlay-visual-height, 100%);
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.apps-provider-overlay-root[data-overlay-root] > .apps-buggiman-modal,
.apps-provider-overlay-root[data-overlay-root] > .apps-first-use-modal,
[data-overlay-root][data-modal-active="provider-buggiman"] > .apps-buggiman-modal,
[data-overlay-root][data-modal-active="provider-first-use"] > .apps-first-use-modal {
  pointer-events: auto;
}

body[data-overlay-root] > .apps-buggiman-modal,
body[data-overlay-root] > .apps-first-use-modal {
  position: fixed;
  inset: auto;
  top: var(--mig-overlay-visual-top, 0px);
  left: var(--mig-overlay-visual-left, 0px);
  width: var(--mig-overlay-visual-width, 100%);
  height: var(--mig-overlay-visual-height, 100%);
  max-width: 100%;
  max-height: 100%;
}

[data-apps-provider-modal-suppressed="true"] {
  pointer-events: none !important;
}

.apps-buggiman-rail {
  position: fixed;
  z-index: 59;
  right: max(0px, var(--apps-shell-return-safe-right));
  top: 50%;
  width: 44px;
  min-width: 44px;
  min-height: 58px;
  box-sizing: border-box;
  border: 1px solid rgba(236, 203, 137, 0.5);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  background: rgba(18, 18, 16, 0.7);
  color: rgba(255, 247, 224, 0.92);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.22), 0 0 18px rgba(236, 203, 137, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  opacity: 0.82;
  transform: translateY(-50%);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition:
    opacity 160ms ease,
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.apps-buggiman-rail:hover,
.apps-buggiman-rail:focus-visible {
  opacity: 0.96;
  transform: translateY(-50%);
  background: rgba(18, 18, 16, 0.82);
  border-color: rgba(236, 203, 137, 0.62);
  outline: 2px solid rgba(255, 239, 196, 0.86);
  outline-offset: -4px;
}

.apps-buggiman-rail:active {
  transform: translateY(-50%) scale(0.98);
}

.apps-buggiman-rail:disabled {
  cursor: wait;
  opacity: 0.65;
}

.apps-buggiman-rail[data-reporter-state="sending"] {
  color: #fff4cf;
  border-color: rgba(255, 216, 122, 0.82);
}

.apps-buggiman-rail[data-reporter-state="success"] {
  color: #9ef1bd;
  border-color: rgba(94, 218, 139, 0.76);
  background: rgba(9, 41, 25, 0.9);
}

.apps-buggiman-rail[data-reporter-state="error"] {
  color: #ffb3b3;
  border-color: rgba(255, 107, 107, 0.76);
  background: rgba(54, 13, 18, 0.92);
}

.apps-buggiman-rail[data-suppressed="true"],
.apps-buggiman-rail[data-suppressed="true"]:hover,
.apps-buggiman-rail[data-suppressed="true"]:focus-visible {
  opacity: 0;
  pointer-events: none;
  transform: translateX(44px) translateY(-50%);
}

.apps-shell-return-handoff {
  --apps-shell-return-origin-x: calc(100vw - 48px);
  --apps-shell-return-origin-y: 28px;
  --apps-shell-return-accent: #f5d889;
  --apps-shell-return-accent-2: #d4b978;
  --apps-shell-return-accent-rgb: 245, 216, 137;
  --apps-shell-return-accent-2-rgb: 212, 185, 120;
  --apps-shell-return-safe-y: max(22px, var(--apps-shell-return-safe-top), var(--apps-shell-return-safe-bottom));
  --apps-shell-return-safe-x: max(18px, var(--apps-shell-return-safe-left), var(--apps-shell-return-safe-right));
  position: fixed;
  z-index: 2147482900;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--apps-shell-return-safe-y) var(--apps-shell-return-safe-x);
  pointer-events: auto;
  opacity: 0;
  overflow: hidden;
  color: #fff3d2;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1;
  letter-spacing: 0;
  transform: none;
  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.apps-shell-return-handoff[data-ready="true"] {
  opacity: 1;
  transform: none;
}

.apps-shell-return-handoff__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--apps-shell-return-accent-rgb), 0.14), transparent 38%),
    radial-gradient(circle at 50% 58%, rgba(var(--apps-shell-return-accent-2-rgb), 0.08), transparent 42%),
    linear-gradient(180deg, rgba(7, 8, 12, 0.985), rgba(8, 9, 13, 1));
}

.apps-shell-return-handoff__stage {
  position: relative;
  z-index: 1;
  width: min(320px, 100%);
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
  opacity: 0;
  transform: translateY(0) scale(1);
  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.apps-shell-return-handoff[data-ready="true"] .apps-shell-return-handoff__stage {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Apps loader mark motion v1 */
.apps-shell-return-handoff__mark {
  position: relative;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(7, 8, 12, 0.72);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.34),
    0 0 42px rgba(var(--apps-shell-return-accent-rgb), 0.18);
}

.apps-shell-return-handoff__mark::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from 0deg, rgba(var(--apps-shell-return-accent-rgb), 0.15), rgba(var(--apps-shell-return-accent-rgb), 0.92), rgba(var(--apps-shell-return-accent-2-rgb), 0.14), rgba(var(--apps-shell-return-accent-rgb), 0.15));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: apps-shell-return-handoff-mark-spin 2.8s linear infinite;
  pointer-events: none;
}

.apps-shell-return-handoff__mark span {
  display: none;
}

.apps-shell-return-handoff__mark img {
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  padding: 3px;
  border-radius: inherit;
  object-fit: contain;
  transform: none;
  transform-origin: 50% 50%;
}

.apps-shell-return-handoff__copy {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.apps-shell-return-handoff__copy span {
  color: rgba(var(--apps-shell-return-accent-rgb), 0.78);
  font-size: 11.52px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.apps-shell-return-handoff__copy strong {
  color: #fff3d2;
  font-size: 24.8px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.apps-shell-return-handoff__copy p {
  min-height: 1.25em;
  margin: 0;
  color: rgba(255, 247, 225, 0.72);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.apps-shell-return-handoff__bar {
  width: min(210px, 68vw);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.apps-shell-return-handoff__bar span {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--apps-shell-return-accent), var(--apps-shell-return-accent-2), transparent);
  animation: apps-shell-return-handoff-bar 1.45s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes apps-shell-return-handoff-bar {
  from {
    transform: translateX(-115%);
  }
  to {
    transform: translateX(230%);
  }
}

@keyframes apps-shell-return-handoff-mark-spin {
  to {
    transform: rotate(360deg);
  }
}

[data-apps-shell-return-navigating="true"] {
  pointer-events: none;
  opacity: 0.72;
}

.apps-buggiman-modal {
  position: absolute;
  z-index: 80;
  inset: 0;
  box-sizing: border-box;
  display: grid;
  place-items: end center;
  padding: 18px max(16px, var(--apps-shell-return-safe-right)) max(18px, var(--apps-shell-return-safe-bottom)) max(16px, var(--apps-shell-return-safe-left));
  background: rgba(0, 0, 0, 0.18);
}

.apps-buggiman-modal__panel {
  width: min(520px, 100%);
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(236, 203, 137, 0.42);
  border-radius: 8px;
  background: rgba(15, 16, 16, 0.92);
  color: rgba(255, 247, 224, 0.95);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.apps-buggiman-modal__copy {
  display: grid;
  gap: 5px;
}

.apps-buggiman-modal__copy strong,
.apps-buggiman-modal__copy p {
  margin: 0;
}

.apps-buggiman-modal__copy strong {
  color: #fff7e0;
  font-size: 17px;
}

.apps-buggiman-modal__copy p {
  color: rgba(255, 247, 224, 0.68);
  font-size: 12px;
  line-height: 1.45;
}

.apps-buggiman-modal__choice,
.apps-buggiman-modal__comment {
  display: grid;
  gap: 8px;
}

.apps-buggiman-modal__choice {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.apps-buggiman-modal__comment[hidden] {
  display: none;
}

.apps-buggiman-modal textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid rgba(236, 203, 137, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  padding: 10px 12px;
  font: inherit;
  letter-spacing: 0;
}

.apps-buggiman-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.apps-buggiman-modal button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(236, 203, 137, 0.38);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  padding: 8px 12px;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0;
}

.apps-buggiman-modal button[type="submit"] {
  background: rgba(236, 203, 137, 0.92);
  color: #18150e;
}

.apps-buggiman-modal [data-buggiman-quick] {
  background: rgba(236, 203, 137, 0.92);
  color: #18150e;
}

@media (max-width: 480px) {
  .apps-buggiman-modal__choice {
    grid-template-columns: minmax(0, 1fr);
  }

  .apps-buggiman-modal textarea {
    font-size: 16px;
  }
}

.apps-buggiman-modal [data-buggiman-message] {
  min-height: 18px;
  margin: 0;
  color: rgba(255, 247, 224, 0.72);
  font-size: 12px;
}

.apps-buggiman-modal [data-buggiman-message][data-tone="error"] {
  color: #ff9b9b;
}

.apps-buggiman-modal [data-buggiman-message][data-tone="warn"] {
  color: #f7c46c;
}

.apps-first-use-modal {
  position: absolute;
  z-index: 79;
  inset: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: max(14px, var(--apps-shell-return-safe-top)) 14px max(14px, var(--apps-shell-return-safe-bottom));
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
}

.apps-first-use-modal__panel {
  display: grid;
  width: min(480px, 100%);
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(236, 203, 137, 0.34);
  border-radius: 18px;
  color: #fff7e0;
  background: rgba(13, 13, 16, 0.97);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.64);
}

.apps-first-use-modal__panel:focus { outline: none; }
.apps-first-use-modal__eyebrow { color: rgba(236, 203, 137, 0.82); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.apps-first-use-modal h2, .apps-first-use-modal p { margin: 0; }
.apps-first-use-modal h2 { font-size: 24px; }
.apps-first-use-modal p { color: rgba(255, 247, 224, 0.72); font-size: 14px; line-height: 1.5; }
.apps-first-use-modal__facts { display: grid; gap: 8px; }
.apps-first-use-modal__facts span { padding: 10px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 11px; color: rgba(255, 247, 224, 0.72); font-size: 12px; line-height: 1.45; }
.apps-first-use-modal__facts strong { color: #f7c46c; }
.apps-first-use-modal button {
  min-height: 44px;
  border: 1px solid rgba(236, 203, 137, 0.4);
  border-radius: 11px;
  color: #18150e;
  background: rgba(236, 203, 137, 0.94);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 720px) {
  .apps-buggiman-rail {
    width: 40px;
    min-width: 40px;
    min-height: 58px;
    border-radius: 13px 0 0 13px;
    opacity: 0.54;
    transform: translateX(23px) translateY(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .apps-buggiman-rail,
  .apps-shell-return-handoff,
  .apps-shell-return-handoff__stage,
  .apps-shell-return-handoff__mark::before,
  .apps-shell-return-handoff__bar span {
    animation: none;
    transition: none;
  }

  .apps-shell-return-handoff__veil {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .apps-shell-return-handoff__bar span {
    width: 100%;
    opacity: 0.48;
    transform: none;
  }
}

/* v6 reporter: one required comment + private layout snapshot; no quick action. */
.apps-buggiman-modal__comment { display: grid; gap: 10px; }
