:root {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #0a1220;
  color: #182533;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }

/* The cover stays fully opaque: it is the privacy shield as well as the lock screen. */
.cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  color: #f2f6fb;
  background:
    radial-gradient(120% 70% at 50% 112%, #6a4130 0%, transparent 62%),
    radial-gradient(90% 60% at 12% -5%, #2b4c75 0%, transparent 65%),
    radial-gradient(70% 50% at 100% 20%, #23405c 0%, transparent 70%),
    linear-gradient(180deg, #101d31 0%, #0a1220 100%);
}

/* Soft lights drifting behind the glass. */
.glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.glow i {
  position: absolute;
  border-radius: 50%;
  animation: drift 24s ease-in-out infinite alternate;
}
.glow i:nth-child(-n+4) { filter: blur(34px); opacity: .6; }
.glow i:nth-child(1) { width: 46vmin; height: 46vmin; left: -8%; top: 8%; background: #3d78b8; }
.glow i:nth-child(2) { width: 52vmin; height: 52vmin; right: -12%; top: 38%; background: #d98a4e; animation-duration: 31s; animation-delay: -9s; }
.glow i:nth-child(3) { width: 38vmin; height: 38vmin; left: 18%; bottom: -8%; background: #c2607a; animation-duration: 27s; animation-delay: -15s; }
.glow i:nth-child(4) { width: 30vmin; height: 30vmin; right: 22%; top: -6%; background: #4fa3a0; animation-duration: 35s; animation-delay: -4s; }
.glow i:nth-child(n+5) {
  background: radial-gradient(circle, rgba(255, 236, 205, .34) 0%, rgba(255, 236, 205, .2) 62%, rgba(255, 236, 205, .32) 68%, transparent 71%);
  animation-name: drift, shimmer;
  animation-duration: 29s, 6s;
}
.glow i:nth-child(5) { width: 15vmin; height: 15vmin; left: 12%; top: 58%; }
.glow i:nth-child(6) { width: 9vmin; height: 9vmin; right: 14%; top: 16%; animation-delay: -12s, -2s; }
.glow i:nth-child(7) { width: 20vmin; height: 20vmin; right: 6%; bottom: 8%; animation-delay: -20s, -4s; }
.glow i:nth-child(8) { width: 7vmin; height: 7vmin; left: 30%; top: 12%; animation-delay: -6s, -1s; }

@keyframes drift {
  from { transform: translate3d(-4vmin, 3vmin, 0) scale(1); }
  to { transform: translate3d(6vmin, -5vmin, 0) scale(1.15); }
}
@keyframes shimmer {
  0%, 100% { opacity: .35; }
  50% { opacity: .8; }
}

.cover-stack {
  display: grid;
  justify-items: center;
  gap: clamp(20px, 5vh, 40px);
  width: 100%;
}

.cover-clock { text-align: center; text-shadow: 0 2px 24px rgba(4, 10, 22, .5); }
.cover-clock p { margin: 0; }
#clock-date {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  opacity: .78;
  min-height: 1.2em;
}
#clock-time {
  font-size: clamp(3.6rem, 19vw, 5.6rem);
  font-weight: 200;
  line-height: 1.05;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  min-height: 1.05em;
}

/* Frosted glass card. */
.cover-inner {
  position: relative;
  width: min(100%, 380px);
  padding: 30px 28px 26px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .05) 45%, rgba(255, 255, 255, .1));
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow:
    0 24px 60px rgba(3, 8, 18, .55),
    inset 0 1px 0 rgba(255, 255, 255, .38),
    inset 0 -1px 0 rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  animation: settle .5s cubic-bezier(.2, .8, .2, 1) both;
}
.cover-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, .1) 44%, transparent 58%),
    radial-gradient(80% 50% at 50% 0%, rgba(255, 255, 255, .12), transparent 70%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cover-inner { background: rgba(32, 48, 72, .94); }
}
@keyframes settle {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
}

.cover-inner > * { position: relative; }
.cover img {
  display: block;
  margin: 0 auto;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(3, 8, 18, .5), 0 0 0 1px rgba(255, 255, 255, .25);
}
.greeting {
  margin: 16px 0 0;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #ffd9a8;
  min-height: 1.2em;
}
.cover h1 { font-size: 1.9rem; font-weight: 650; letter-spacing: -.01em; margin: 4px 0 24px; }
.cover label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .8;
}
.cover input, .cover button {
  display: block;
  width: 100%;
  border-radius: 16px;
  margin-top: 12px;
}

.cover input {
  min-height: 58px;
  color: #fff;
  caret-color: #ffd9a8;
  text-align: center;
  background: rgba(6, 12, 24, .38);
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .35);
  padding: 10px 14px 10px calc(14px + .45em);
  font-size: 1.5rem;
  letter-spacing: .45em;
  transition: border-color .2s, box-shadow .2s;
}
.cover input:focus {
  outline: none;
  border-color: rgba(255, 217, 168, .75);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .35), 0 0 0 4px rgba(255, 200, 130, .2);
}

.cover button {
  min-height: 54px;
  border: 0;
  color: #13233a;
  background: linear-gradient(180deg, #ffffff, #e4ebf5);
  box-shadow: 0 10px 24px rgba(3, 8, 18, .4), inset 0 1px 0 #fff;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.cover button:hover { transform: translateY(-1px); }
.cover button:active { transform: translateY(1px) scale(.99); }
.cover button:focus-visible { outline: 3px solid #ffd9a8; outline-offset: 3px; }
.cover button:disabled { cursor: wait; animation: waiting 1s ease-in-out infinite alternate; }
@keyframes waiting {
  from { opacity: .55; }
  to { opacity: .85; }
}

#pin-error { margin: 14px 0 0; font-size: .9rem; color: #ffb9ad; }
#pin-error:empty { margin: 0; }
.shake { animation: shake .4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@media (max-height: 620px) {
  .cover-clock { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .glow i, .cover-inner, .cover button:disabled, .shake { animation: none; }
}
