:is(#identity-card, .pbx-confirm-card) {
  position: absolute;
  z-index: 5;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  width: min(380px, calc(100% - 32px));
  max-height: calc(100dvh - 32px - env(safe-area-inset-bottom));
  overflow: auto;
  padding: 24px;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 26px;
  background: rgb(255 255 255 / 94%);
  color: #20242c;
  box-shadow: 0 18px 70px rgb(0 0 0 / 20%);
  backdrop-filter: blur(24px);
  text-align: center;
  font: 14px/1.5 "Panel Google Emoji", system-ui, -apple-system, "Segoe UI", sans-serif;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  animation: identity-enter 760ms cubic-bezier(.16,1,.3,1) both;
}
:is(#identity-card, .pbx-confirm-card)[hidden], :is(#identity-card, .pbx-confirm-card) [hidden] { display: none; }
#identity-avatars { display: flex; justify-content: center; padding: 0 8px; margin-bottom: 12px; }
.identity-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  margin: 0 -5px;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #e8edf9;
  color: #415584;
  font-size: 22px;
}
.identity-avatar img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.identity-extra { font-size: 15px; }
#identity-names { max-height: 64px; overflow: auto; overflow-wrap: anywhere; font-weight: 600; margin: 0 0 8px; }
:is(#identity-heading, .pbx-confirm-heading) { font-size: 23px; letter-spacing: -.5px; margin: 0 0 20px; }
:is(#identity-card, .pbx-confirm-card) button {
  width: 100%; min-height: 44px; border: 0; border-radius: 14px;
  font: inherit; font-weight: 600; cursor: pointer;
}
:is(#identity-confirm, .pbx-confirm-primary) { background: #2874ed; color: white; }
:is(#identity-card, .pbx-confirm-card) button:focus-visible { outline: 3px solid #90b8ff; outline-offset: 3px; }
#identity-prompt {
  transition: opacity 300ms ease, transform 600ms cubic-bezier(.22,1,.36,1);
}
#identity-result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(18px) scale(.96);
  transition: opacity 420ms ease, transform 600ms cubic-bezier(.16,1,.3,1);
}
#identity-success-heading { font-size: 23px; letter-spacing: -.5px; margin: 0; }
#identity-check { display: block; width: 60px; height: 60px; margin: 0 auto 14px; color: #26a775; filter: drop-shadow(0 8px 18px rgb(38 167 117 / 28%)); }
#identity-check circle { fill: currentColor; opacity: .12; }
#identity-check path { fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; opacity: 0; transform: scale(.72) rotate(-12deg); transform-origin: 50% 50%; }
:is(#identity-card, .pbx-confirm-card).identity-success #identity-prompt { opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; }
:is(#identity-card, .pbx-confirm-card).identity-success #identity-result { opacity: 1; transform: translateY(0) scale(1); }
:is(#identity-card, .pbx-confirm-card).identity-success #identity-check path { animation: identity-performance-pop 600ms cubic-bezier(.16,1,.3,1) forwards; }
@keyframes identity-enter {
  from { opacity: 0; transform: translate(-50%, calc(100% + 28px)) scale(.98); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes identity-performance-pop {
  0% { opacity: 0; transform: scale(.72) rotate(-12deg); }
  55% { opacity: 1; transform: scale(1.12) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@media (prefers-color-scheme: dark) {
  :is(#identity-card, .pbx-confirm-card) { background: rgb(29 32 39 / 95%); color: #f2f4f8; border-color: rgb(255 255 255 / 12%); }
  .identity-avatar { border-color: #252932; background: #36435d; color: #e6edff; }
}
@media (orientation: landscape) and (max-height: 500px) {
  :is(#identity-card, .pbx-confirm-card) { padding: 16px 22px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .identity-avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: 18px; }
  #identity-avatars { margin-bottom: 4px; }
  :is(#identity-heading, .pbx-confirm-heading) { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  :is(#identity-card, .pbx-confirm-card), :is(#identity-card, .pbx-confirm-card).identity-success #identity-check path { animation: none; }
  #identity-prompt, #identity-result { transition: none; }
  #identity-check path { opacity: 1; transform: none; }
}

/* Error recovery shares the account confirmation surface above. Only content
   layout and secondary actions are added here; card/theme/motion stay shared. */
.pbx-error-card { pointer-events: auto; }
.pbx-error-reason { margin: 0 0 12px; font-weight: 600; overflow-wrap: anywhere; }
.pbx-error-help { margin: 0 0 20px; opacity: .75; overflow-wrap: anywhere; }
.pbx-error-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pbx-error-actions a {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; border-radius: 14px; text-decoration: none;
  font: inherit; font-weight: 600;
}
.pbx-error-card .pbx-confirm-secondary {
  background: rgb(40 116 237 / 10%); color: inherit;
}
.pbx-error-card .pbx-error-continue { grid-column: 1 / -1; }
.pbx-error-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.pbx-error-card .pbx-error-tools button {
  width: auto; min-height: 36px; padding: 6px 8px; background: transparent;
  color: inherit; opacity: .75; font-size: 12px; font-weight: 400;
}
.pbx-error-card pre {
  margin: 12px 0 0; padding: 12px; max-height: 25dvh; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: left;
  user-select: text; border-radius: 14px; background: rgb(127 127 127 / 8%);
  font: 12px/1.6 "Panel Google Emoji", monospace;
}
.pbx-error-card a:focus-visible { outline: 3px solid #90b8ff; outline-offset: 3px; }
.pbx-error-card [hidden] { display: none; }
