html.pw-auth-locked,
html.pw-auth-locked body {
  overflow: hidden !important;
}

.pw-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  overflow: auto;
  background: #0a1020;
  color: #e9eef8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pw-auth-overlay[hidden] { display: none !important; }

.pw-auth-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 12%, rgba(70, 104, 186, .27), transparent 34%),
    radial-gradient(circle at 88% 82%, rgba(46, 125, 111, .22), transparent 36%),
    linear-gradient(145deg, #0b1224, #080d18 62%, #111827);
}

.pw-auth-grid {
  position: absolute;
  inset: 0;
  opacity: .13;
  background-image:
    linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 86%);
}

.pw-auth-orbit {
  position: absolute;
  border: 1px solid rgba(156, 183, 232, .16);
  border-radius: 50%;
}
.pw-auth-orbit-one { width: 520px; height: 520px; top: -260px; right: -110px; }
.pw-auth-orbit-two { width: 390px; height: 390px; bottom: -210px; left: -90px; }

.pw-auth-card {
  position: relative;
  width: min(100%, 440px);
  padding: 30px;
  border: 1px solid rgba(171, 190, 224, .22);
  border-radius: 22px;
  background: rgba(15, 23, 42, .92);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .48), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(20px);
}

.pw-auth-header {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 15px;
  align-items: start;
  margin-bottom: 26px;
}

.pw-auth-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: linear-gradient(145deg, #5e78b7, #3e588e);
  box-shadow: inset 0 1px rgba(255,255,255,.28), 0 10px 28px rgba(26, 48, 93, .42);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
}

.pw-auth-kicker {
  margin: 0 0 3px;
  color: #98a8c7;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.pw-auth-header h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.1;
  letter-spacing: -.025em;
}

.pw-auth-header p:last-child {
  margin: 8px 0 0;
  color: #aebbd1;
  font-size: 14px;
  line-height: 1.45;
}

.pw-auth-form { display: grid; gap: 16px; }
.pw-auth-field { display: grid; gap: 7px; }
.pw-auth-field > span {
  color: #c7d1e2;
  font-size: 13px;
  font-weight: 650;
}

.pw-auth-field input {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #34425c;
  border-radius: 11px;
  outline: none;
  background: #0b1324;
  color: #f4f7fc;
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.pw-auth-field input:focus {
  border-color: #7593cf;
  background: #0c1629;
  box-shadow: 0 0 0 3px rgba(117, 147, 207, .18);
}

.pw-auth-status {
  min-height: 18px;
  margin: 0;
  color: #b8c4d8;
  font-size: 12px;
  line-height: 1.45;
}
.pw-auth-status[data-kind="error"] { color: #ff9a9a; }
.pw-auth-status[data-kind="loading"] { color: #a9c0ef; }

.pw-auth-submit {
  min-height: 49px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, #6f8dcc, #5874ad);
  color: white;
  font: inherit;
  font-weight: 750;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(48, 76, 135, .32), inset 0 1px rgba(255,255,255,.2);
}
.pw-auth-submit:hover { filter: brightness(1.06); }

.pw-auth-footer {
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid rgba(166, 185, 218, .12);
  color: #67758d;
  font-size: 10px;
  text-align: center;
  letter-spacing: .03em;
}

/* The only gesture target. It is anchored to the actual viewport corner and
   is never larger than 100 by 100 CSS pixels on any screen. */
.pw-auth-unlock-zone {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 3;
  width: 100px;
  height: 100px;
  width: min(100px, 30vw);
  height: min(100px, 30vh);
  max-width: 100px;
  max-height: 100px;
  background: transparent;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pw-auth-lock-button {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2147480000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(104, 117, 137, .35);
  border-radius: 9px;
  background: rgba(255, 255, 255, .88);
  color: #364152;
  font: 650 12px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  backdrop-filter: blur(10px);
}
.pw-auth-lock-button-inline {
  position: static;
  z-index: auto;
  min-height: 34px;
  box-shadow: none;
  background: transparent;
}

.pw-auth-trust-prompt {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 2147482500;
  width: min(340px, calc(100vw - 28px));
  box-sizing: border-box;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, .14);
  border-radius: 18px;
  background: rgba(255, 255, 255, .98);
  color: #172033;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  backdrop-filter: blur(18px);
  transform: translate(-50%, -50%);
}
.pw-auth-trust-prompt > strong { display: block; font-size: 15px; }
.pw-auth-trust-prompt > p { margin: 7px 0 14px; color: #64748b; font-size: 12px; line-height: 1.45; }
.pw-auth-trust-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pw-auth-trust-actions button {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #d5dce7;
  border-radius: 11px;
  background: #f8fafc;
  color: #172033;
  font: 750 11px/1.2 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}
.pw-auth-trust-actions button:first-child { border-color: #172033; background: #172033; color: #fff; }
.pw-auth-trust-actions button:disabled { opacity: .62; cursor: wait; }

@media (max-width: 820px) {
  .pw-auth-overlay { place-items: center; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); }
  .pw-auth-card { padding: 25px 21px; border-radius: 19px; }
  .pw-auth-header { grid-template-columns: 46px 1fr; gap: 13px; margin-bottom: 23px; }
  .pw-auth-mark { width: 46px; height: 46px; border-radius: 13px; }
  .pw-auth-field input { min-height: 51px; font-size: 16px; }
  .pw-auth-submit { min-height: 52px; font-size: 15px; }
  .pw-auth-lock-label { display: none; }
  .pw-auth-lock-button { width: 36px; padding: 0; }
  .pw-auth-trust-prompt { width: calc(100vw - 30px); max-width: 340px; }
  .pw-auth-trust-actions { grid-template-columns: 1fr; }
}
