/* The access code screen, the PIN screen and the damaged-plan screen.
   Goes with: js/ui/unlock.js. */
/* Both screens share one layout: the brown band from Setup with the logo, a
   white card with the form, and a privacy note. They show before settings are
   unlocked, so they use the default theme color, not the user's choice. */

@keyframes gshake{20%,60%{transform:translateX(-8px)}40%,80%{transform:translateX(8px)}}

.gate {
  --gate-accent: #cf640d;
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
}
#access-gate {
  z-index: 100000;
}
#access-gate[hidden] {
  display: none;
}
.gate-band {
  flex: none;
  background: var(--band);
  color: var(--band-ink);
  text-align: center;
  padding: calc(28px + env(safe-area-inset-top,0px)) 24px 30px;
}
.gate-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #fff8f4;
  box-shadow: 0 4px 14px rgba(0,0,0,.14);
}
.gate-logo img {
  display: block;
  width: 30px;
  height: auto;
}
.gate-word {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -.03em;
  line-height: 1.05;
}
.gate-word b {
  font-weight: 800;
  color: #ffc9a3;
}
.gate-tag {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--band-ink2);
}
.gate-body {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px calc(20px + env(safe-area-inset-bottom,0px));
}
.gate-card {
  width: min(100%,420px);
  margin-top: 20px;
  padding: 26px 24px 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--sh);
}
.gate-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}
.gate-copy {
  margin: 0 auto 20px;
  max-width: 320px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink2);
}
.gate-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.gate .gate-code {
  display: block;
  width: 100%;
  height: 54px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}
.gate .gate-code::placeholder {
  color: var(--mute);
  font-weight: 500;
}
.gate .gate-code::selection {
  background: color-mix(in srgb,var(--gate-accent) 24%,transparent);
}
.gate .gate-code:focus {
  outline: none;
  border-color: var(--gate-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb,var(--gate-accent) 18%,transparent);
}
.gate .gate-code[aria-invalid=true] {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb,var(--warn) 14%,transparent);
}
.gate-error {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--warn);
}
.gate-btn {
  display: block;
  width: 100%;
  height: 50px;
  margin: 8px 0 0;
  border: 0;
  border-radius: 11px;
  background: var(--gate-accent);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  opacity: .5;
  box-shadow: 0 2px 5px color-mix(in srgb,var(--gate-accent) 18%,transparent);
  transition: opacity .15s;
}
.gate-btn.ready {
  opacity: 1;
}
.gate-btn:disabled {
  cursor: default;
}
.gate-btn:focus-visible {
  outline: 2px solid var(--gate-accent);
  outline-offset: 2px;
}
/* A damaged saved plan: restore or start over instead of the PIN form. */
.gate-damaged .btn {
  display: block;
  width: 100%;
  height: 46px;
  margin: 10px 0 0;
}
.gate-more {
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  text-align: left;
}
.gate-more p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink2);
}
.gate-more p + p {
  margin-top: 10px;
}
.gate-more b {
  color: var(--ink);
  font-weight: 650;
}
.gate-help {
  display: none;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--mute);
}
#privacy-gate.creating .gate-help {
  display: block;
}
.gate-row {
  margin: 0 0 10px;
}
.gate-row b {
  display: block;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}
.gate-row span {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--mute);
}
.gate-row1 {
  display: none;
}
#privacy-gate.creating .gate-row1 {
  display: block;
}
#gate-confirm-wrap {
  margin-top: 20px;
}
.pinbox {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 10px;
  max-width: 248px;
  margin: 0 auto;
}
.pinbox input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  opacity: 0;
  font-size: 16px;
  caret-color: transparent;
  cursor: pointer;
  background: transparent;
}
.pinbox i {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
  max-height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.pinbox i::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
  transition: transform .15s;
}
.pinbox i.on::after {
  transform: scale(1);
}
.pinbox i.cur {
  border-color: var(--gate-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb,var(--gate-accent) 18%,transparent);
}
.pinbox.shake {
  animation: gshake .38s;
}
.gate-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 400px;
  margin: auto 0 0;
  padding: 28px 8px 0;
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
  color: var(--mute);
}
.gate-note svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  fill: none;
  stroke: var(--mute);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media print, screen and (min-width:701px) {
  .gate-band {
    padding-top: calc(44px + env(safe-area-inset-top,0px));
    padding-bottom: 40px;
  }
  .gate-card {
    margin-top: 32px;
  }
  .gate-word {
    font-size: 32px;
  }
  .gate-card {
    padding: 32px 36px 30px;
  }
  .gate-card h2 {
    font-size: 24px;
  }
  .gate-note {
    margin-top: 22px;
    margin-bottom: auto;
  }
}
@media (prefers-reduced-motion:reduce) {
  .pinbox.shake {
    animation: none;
  }
}

