.pwva,
.pwva * {
  box-sizing: border-box;
}

.pwva {
  --pwva-accent: #2563eb;
  --pwva-bg: #0d1117;
  --pwva-border: #293140;
  --pwva-text: #f8fafc;
  color: var(--pwva-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

.pwva--floating {
  position: fixed;
  bottom: 22px;
  z-index: 2147483000;
}

.pwva--position-right { right: 22px; }
.pwva--position-left { left: 22px; }

.pwva__launcher {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--pwva-accent);
  color: #fff;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .38);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  transition: filter 160ms ease, transform 160ms ease;
}

.pwva__launcher:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.pwva__launcher-icon,
.pwva__brand-icon {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
}

.pwva__launcher-icon {
  width: 27px;
  height: 27px;
  background: rgba(255,255,255,.12);
}

.pwva__panel {
  overflow: hidden;
  width: min(430px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 112px));
  min-height: 520px;
  border: 1px solid var(--pwva-border);
  border-radius: 22px;
  background: var(--pwva-bg);
  box-shadow: 0 24px 75px rgba(0,0,0,.5);
}

.pwva--floating .pwva__panel {
  position: absolute;
  bottom: 68px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.985);
  transition: opacity 170ms ease, transform 170ms ease, visibility 170ms ease;
}

.pwva--position-right .pwva__panel { right: 0; }
.pwva--position-left .pwva__panel { left: 0; }

.pwva--floating .pwva__panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.pwva--inline {
  width: 100%;
  max-width: 760px;
  margin: 24px auto;
}

.pwva--inline .pwva__panel {
  width: 100%;
  height: min(760px, 80vh);
}

.pwva__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid rgba(148,163,184,.16);
  background: #111722;
}

.pwva__brand,
.pwva__header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwva__brand-icon {
  width: 32px;
  height: 32px;
  border-color: color-mix(in srgb, var(--pwva-accent) 55%, transparent);
  background: color-mix(in srgb, var(--pwva-accent) 20%, transparent);
  color: #fff;
}

.pwva__title {
  overflow: hidden;
  max-width: 235px;
  color: #fff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pwva__external,
.pwva__close {
  appearance: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(148,163,184,.11);
  color: #cbd5e1;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.pwva__close { font-size: 24px; }
.pwva__external { font-size: 17px; }

.pwva__external:hover,
.pwva__close:hover {
  background: rgba(148,163,184,.22);
  color: #fff;
}

.pwva__launcher:focus-visible,
.pwva__external:focus-visible,
.pwva__close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pwva-accent) 45%, transparent);
  outline-offset: 2px;
}

.pwva__frame-area {
  position: relative;
  height: calc(100% - 62px);
  background: #0d1117;
}

.pwva__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0d1117;
}

.pwva__loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #0d1117;
  color: #cbd5e1;
  font-size: 13px;
}

.pwva__loading[hidden] { display: none; }

.pwva__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #334155;
  border-top-color: var(--pwva-accent);
  border-radius: 50%;
  animation: pwva-spin .8s linear infinite;
}

@keyframes pwva-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .pwva--floating {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .pwva--position-left .pwva__launcher { margin-right: auto; }
  .pwva--position-right .pwva__launcher { margin-left: auto; }

  .pwva--floating .pwva__panel {
    position: fixed;
    inset: 8px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pwva__launcher,
  .pwva__panel,
  .pwva__spinner {
    animation: none;
    transition: none;
  }
}
