/* CaveRush Auth UI */
.auth-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(99, 219, 255, 0.22);
  border-radius: 999px;
  background: rgba(3, 10, 24, 0.42);
  color: rgba(239, 249, 255, 0.86);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(83, 216, 255, 0.28);
  backdrop-filter: blur(12px);
}

.auth-status-pill.is-registered {
  border-color: rgba(94, 255, 197, 0.36);
  box-shadow: 0 0 24px rgba(94, 255, 197, 0.12);
}

.auth-status-pill.is-guest {
  border-color: rgba(255, 216, 111, 0.26);
}

.auth-modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(1, 5, 16, 0.78);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.auth-modal-scrim.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal {
  width: min(430px, 100%);
  max-height: min(720px, calc(100vh - 28px));
  overflow: auto;
  border: 1px solid rgba(99, 219, 255, 0.34);
  border-radius: 26px;
  padding: 22px;
  background:
    radial-gradient(circle at 16% 8%, rgba(83, 216, 255, 0.18), transparent 34%),
    radial-gradient(circle at 88% 92%, rgba(255, 57, 231, 0.13), transparent 34%),
    rgba(7, 13, 30, 0.96);
  box-shadow: 0 28px 90px rgba(0,0,0,0.58), inset 0 1px 0 rgba(255,255,255,0.08);
  color: #f7fcff;
}

.auth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.auth-modal-kicker {
  margin: 0 0 6px;
  color: #8ff1ff;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-modal h2 {
  margin: 0;
  font-size: clamp(1.45rem, 6vw, 2.1rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.auth-modal-copy {
  margin: 8px 0 0;
  color: #a5bad0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  color: #f7fcff;
  font-size: 1.35rem;
  font-weight: 900;
  cursor: pointer;
}

.auth-player-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
}

.auth-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(83, 216, 255, 0.36);
  border-radius: 16px;
  background: rgba(83, 216, 255, 0.1);
  box-shadow: 0 0 24px rgba(83, 216, 255, 0.14);
  font-size: 1.2rem;
}

.auth-player-name {
  overflow: hidden;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-player-type {
  margin-top: 2px;
  color: #a5bad0;
  font-size: 0.75rem;
  font-weight: 800;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid rgba(99, 219, 255, 0.28);
  border-radius: 14px;
  outline: none;
  background: rgba(255,255,255,0.06);
  color: #f7fcff;
  font: inherit;
  font-weight: 800;
}

.auth-input:focus {
  border-color: rgba(83, 216, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(83, 216, 255, 0.12);
}

.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.auth-button {
  min-height: 45px;
  border: 1px solid rgba(99, 219, 255, 0.34);
  border-radius: 15px;
  padding: 12px 14px;
  color: #f7fcff;
  background: rgba(42, 197, 255, 0.12);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.auth-button:hover,
.auth-button:focus-visible {
  border-color: rgba(99, 219, 255, 0.8);
  box-shadow: 0 0 28px rgba(42, 197, 255, 0.14);
}

.auth-button.primary {
  border-color: rgba(99, 219, 255, 0.72);
  background: linear-gradient(135deg, rgba(83, 216, 255, 0.95), rgba(44, 124, 255, 0.88));
  color: #03101d;
}

.auth-button.google {
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.09);
}

.auth-button.ghost {
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.045);
  color: #cfe9f4;
}

.auth-button.danger {
  border-color: rgba(255, 99, 99, 0.32);
  background: rgba(255, 99, 99, 0.08);
  color: #ffd2d2;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: #7890aa;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: rgba(255,255,255,0.12);
}

.auth-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: #a5bad0;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.auth-message.error { color: #ffbbb1; }
.auth-message.ok { color: #9dffd7; }

.lb-registered-badge {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  color: #41efff;
  filter: drop-shadow(0 0 7px rgba(65, 239, 255, 0.75));
  vertical-align: -4px;
}

.lb-registered-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 520px) {
  .auth-modal { padding: 18px; border-radius: 22px; }
  .auth-modal-header { gap: 10px; }
}


.auth-modal {
  width: min(500px, 100%);
  border-color: rgba(83, 216, 255, 0.48);
  background:
    radial-gradient(circle at 18% 8%, rgba(83, 216, 255, 0.24), transparent 34%),
    radial-gradient(circle at 82% 16%, rgba(255, 77, 229, 0.16), transparent 34%),
    radial-gradient(circle at 48% 100%, rgba(255, 216, 111, 0.11), transparent 36%),
    linear-gradient(180deg, rgba(8, 16, 38, 0.98), rgba(4, 7, 18, 0.98));
  box-shadow:
    0 34px 110px rgba(0, 0, 0, 0.68),
    0 0 52px rgba(83, 216, 255, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.auth-modal::before {
  content: "";
  position: sticky;
  top: -22px;
  display: block;
  height: 3px;
  margin: -22px -22px 18px;
  background: linear-gradient(90deg, #53d8ff, #ff4de5, #ffd86f);
  box-shadow: 0 0 24px rgba(83, 216, 255, 0.34);
}

.auth-provider-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.auth-button.provider {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.04));
}

.auth-button.provider::before {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1rem;
}

.auth-button.apple::before { content: ""; }
.auth-button.google::before { content: "G"; color: #ffffff; }
.auth-button.facebook::before { content: "f"; color: #ffffff; }

/* Apple Sign-In is only available on iOS/iPadOS.
   Hidden by default; restored only when the html element carries
   capacitor-ios (native Capacitor iOS app) or apple-platform
   (set by inline script for iOS Safari / PWA). */
#authAppleBtn,
#profileAppleBtn,
#enterCaveAppleBtn {
  display: none !important;
}

html.capacitor-ios #authAppleBtn,
html.apple-platform #authAppleBtn,
html.capacitor-ios #profileAppleBtn,
html.apple-platform #profileAppleBtn,
html.capacitor-ios #enterCaveAppleBtn,
html.apple-platform #enterCaveAppleBtn {
  display: grid !important;
}

.auth-button.apple {
  border-color: rgba(255, 255, 255, 0.3);
}

.auth-button.google {
  border-color: rgba(83, 216, 255, 0.36);
}

.auth-button.facebook {
  border-color: rgba(93, 142, 255, 0.42);
}

.auth-button.x-twitter::before { content: "𝕏"; color: #ffffff; font-size: 1.05rem; }

.auth-button.x-twitter {
  border-color: rgba(255, 255, 255, 0.26);
}

.auth-name-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 216, 111, 0.26);
  border-radius: 18px;
  background: rgba(255, 216, 111, 0.065);
}

.auth-name-panel[hidden],
.auth-provider-grid[hidden] {
  display: none;
}

.auth-lock-note {
  margin: 0;
  color: #ffdca2;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.4;
}

.auth-status-pill {
  text-transform: none;
}

.auth-status-pill.is-guest {
  border-color: rgba(255, 77, 229, 0.3);
  box-shadow: 0 0 22px rgba(255, 77, 229, 0.11);
}

@media (max-height: 520px) and (orientation: landscape) {
  .auth-modal {
    width: min(760px, 100%);
    padding: 18px;
  }

  .auth-modal-header {
    margin-bottom: 10px;
  }

  .auth-player-card {
    margin: 10px 0;
  }
}
