/* 锁屏 (static/lock.js). Its own colours, never the outfit's: it shows before any outfit loads,
   and an outfit's CSS must never make it unreadable. Light glass over a pastel wallpaper,
   in the family of 液态玻璃. */
#lock {
  --lk-ink: #1D1C30;
  --lk-soft: rgba(29, 28, 48, 0.62);
  --lk-warn: #C2394A;
  --lk-glass: linear-gradient(160deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.26));
  --lk-glass-hi: rgba(255, 255, 255, 0.9);
  --lk-edge: rgba(255, 255, 255, 0.6);
  --lk-key: 78px;
  --lk-gap-x: min(28px, 6.5vw);
  --lk-gap-y: 16px;
  --lk-ease: cubic-bezier(0.32, 0.72, 0, 1);
  position: fixed; inset: 0; z-index: 9999;
  overflow: hidden;
  overflow: clip;   /* never a scroll container: focus or scrollIntoView must not shift the screen */
  color: var(--lk-ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  background:
    radial-gradient(at 12% 8%, #D8D2FF 0, transparent 50%),
    radial-gradient(at 92% 14%, #FFD3E8 0, transparent 46%),
    radial-gradient(at 14% 90%, #C6E6FF 0, transparent 50%),
    radial-gradient(at 88% 94%, #FFE2CB 0, transparent 44%),
    #EEF0FA;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.35s ease, transform 0.55s var(--lk-ease);
}
#lock[hidden] { display: none; }
#lock:focus { outline: none; }
#lock.is-leaving { opacity: 0; pointer-events: none; }
#lock.is-open.is-leaving { opacity: 0.4; transform: translateY(-100%); }

/* Light drifting across the wallpaper, slow enough to feel still. */
#lock .lock-wall { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
#lock .lock-wall i { position: absolute; border-radius: 50%; opacity: 0.75; }
#lock .lock-wall i:nth-child(1) { width: 70vmax; height: 70vmax; left: -22vmax; top: -18vmax;
  background: radial-gradient(circle, rgba(200, 190, 255, 0.85) 0, rgba(200, 190, 255, 0) 68%); }
#lock .lock-wall i:nth-child(2) { width: 62vmax; height: 62vmax; right: -24vmax; top: 18vh;
  background: radial-gradient(circle, rgba(255, 196, 224, 0.8) 0, rgba(255, 196, 224, 0) 68%); }
#lock .lock-wall i:nth-child(3) { width: 66vmax; height: 66vmax; left: -10vmax; bottom: -26vmax;
  background: radial-gradient(circle, rgba(184, 224, 255, 0.85) 0, rgba(184, 224, 255, 0) 68%); }
@media (prefers-reduced-motion: no-preference) {
  #lock .lock-wall i:nth-child(1) { animation: lock-drift 28s ease-in-out infinite alternate; }
  #lock .lock-wall i:nth-child(2) { animation: lock-drift 34s ease-in-out -9s infinite alternate-reverse; }
  #lock .lock-wall i:nth-child(3) { animation: lock-drift 31s ease-in-out -17s infinite alternate; }
}
@keyframes lock-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(9vmax, 6vmax, 0) scale(1.12); }
}

/* The keypad sits on frosted glass. */
#lock .lock-veil {
  position: absolute; inset: 0; z-index: 0; opacity: 0;
  background: rgba(238, 240, 250, 0.3);
  -webkit-backdrop-filter: blur(30px) saturate(150%); backdrop-filter: blur(30px) saturate(150%);
  transition: opacity 0.4s ease;
}
#lock.is-entry .lock-veil { opacity: 1; }

#lock .lock-icon {
  position: absolute; z-index: 2; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 22px);
  width: 18px; height: 22px; margin-left: -9px; opacity: 0;
  transition: opacity 0.4s ease;
}
#lock.is-shown .lock-icon { opacity: 0.82; }
#lock .lock-shackle { transform-box: fill-box; transform-origin: 100% 100%; transition: transform 0.38s cubic-bezier(0.3, 1.5, 0.5, 1); }
#lock.is-open .lock-shackle { transform: translateY(-2.5px) rotate(-26deg); }

#lock > section {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 62px) max(16px, env(safe-area-inset-right, 0px))
           calc(env(safe-area-inset-bottom, 0px) + 22px) max(16px, env(safe-area-inset-left, 0px));
  transition: opacity 0.35s ease, transform 0.5s var(--lk-ease), visibility 0s linear 0.5s;
}
#lock p { margin: 0; }
#lock button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
#lock button:focus-visible { outline: 2px solid var(--lk-ink); outline-offset: 3px; }

/* The clock face. */
#lock .lock-face { opacity: 0; visibility: hidden; cursor: pointer; }
#lock.is-shown .lock-face { opacity: 1; visibility: visible; transition-delay: 0s; }
#lock.is-entry .lock-face { opacity: 0; visibility: hidden; transform: translateY(-48px) scale(0.96); transition-delay: 0s, 0s, 0.5s; }
#lock .lock-date { font-size: 18px; font-weight: 500; letter-spacing: 0.03em; color: var(--lk-soft); }
#lock .lock-time {
  margin-top: 2px;
  font-size: clamp(76px, 25vw, 112px); font-weight: 200; line-height: 1.05;
  letter-spacing: -0.015em; font-variant-numeric: tabular-nums;
}
#lock .lock-brand {
  margin-top: 10px;
  font-family: 'Noto Serif SC', 'Songti SC', serif; font-size: 13px; letter-spacing: 0.42em;
  padding-left: 0.42em; color: var(--lk-soft);
}
#lock .lock-hint {
  margin-top: auto; margin-bottom: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 18px; border: 0; background: none; cursor: pointer;
  font-size: 14px; letter-spacing: 0.08em; color: var(--lk-soft);
}
#lock .lock-hint svg { width: 22px; height: 11px; }
@media (prefers-reduced-motion: no-preference) {
  #lock .lock-hint svg { animation: lock-bob 2.6s ease-in-out infinite; }
}
@keyframes lock-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* The keypad. */
#lock .lock-entry { justify-content: center; opacity: 0; visibility: hidden; transform: translateY(28px); }
#lock.is-entry .lock-entry { opacity: 1; visibility: visible; transform: none; transition-delay: 0.05s, 0s, 0s; }
#lock .lock-title { font-size: 17px; font-weight: 500; letter-spacing: 0.02em; }
#lock .lock-code { display: flex; justify-content: center; min-height: 48px; align-items: center; margin-top: 12px; width: 100%; }
#lock .lock-dots { display: flex; gap: 20px; }
#lock .lock-dots i {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid var(--lk-ink); box-sizing: border-box;
  transition: background-color 0.12s ease, transform 0.12s ease;
}
#lock .lock-dots i.on { background: var(--lk-ink); transform: scale(1.06); }
#lock.is-locked .lock-dots { visibility: hidden; }
#lock .lock-code.is-shake { animation: lock-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@media (prefers-reduced-motion: reduce) { #lock .lock-code.is-shake { animation: none; } }
@keyframes lock-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-9px); }
  40%, 60% { transform: translateX(9px); }
}
#lock .lock-text { display: flex; gap: 10px; width: min(300px, 100%); }
#lock .lock-text[hidden] { display: none; }
#lock .lock-input {
  flex: 1; min-width: 0; height: 48px; padding: 0 18px;
  border: 1px solid var(--lk-edge); border-radius: 24px; background: var(--lk-glass);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.9), 0 8px 22px rgba(70, 70, 140, 0.1);
  font: inherit; font-size: 17px; color: var(--lk-ink); text-align: center; outline: none;
  -webkit-user-select: text; user-select: text;
}
#lock .lock-input::placeholder { color: var(--lk-soft); }
#lock .lock-input:focus { border-color: rgba(29, 28, 48, 0.35); }
#lock .lock-go {
  flex: none; width: 48px; height: 48px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--lk-ink); color: #FFFFFF;
}
#lock .lock-go svg { width: 22px; height: 22px; }
#lock .lock-note { min-height: 20px; margin-top: 8px; font-size: 13px; color: var(--lk-soft); text-align: center; font-variant-numeric: tabular-nums; }
#lock .lock-note.is-warn { color: var(--lk-warn); }

#lock .lock-pad {
  display: grid; grid-template-columns: repeat(3, var(--lk-key));
  gap: var(--lk-gap-y) var(--lk-gap-x); margin-top: 22px;
}
#lock .lock-pad[hidden] { display: none; }
#lock .lock-key {
  width: var(--lk-key); height: var(--lk-key); padding: 0; border-radius: 50%; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid var(--lk-edge); background: var(--lk-glass);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.95), inset 0 -1px 1px rgba(255, 255, 255, 0.3),
              0 8px 22px rgba(70, 70, 140, 0.11);
  transition: background-color 0.3s ease, transform 0.18s ease, opacity 0.3s ease;
}
#lock .lock-key b { font-size: 34px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
#lock .lock-key small { margin-top: 3px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.2em; padding-left: 0.2em; color: var(--lk-soft); }
#lock .lock-key.is-pressed { background: var(--lk-glass-hi); transform: scale(0.96); transition: none; }
#lock .lock-key:disabled { opacity: 0.38; cursor: default; }
#lock .lock-key[hidden] { visibility: hidden; display: flex; }
#lock .lock-ok { grid-column: 1; }
#lock .lock-ok svg { width: 26px; height: 26px; }
#lock .lock-pad .lock-key[data-key="0"] { grid-column: 2; }
#lock.is-busy .lock-pad { pointer-events: none; }

#lock .lock-actions {
  display: flex; justify-content: space-between;
  width: calc(var(--lk-key) * 3 + var(--lk-gap-x) * 2); max-width: 100%; margin-top: 20px;
}
#lock .lock-actions button { padding: 10px 6px; border: 0; background: none; cursor: pointer; font-size: 16px; }
#lock .lock-alt[hidden] { visibility: hidden; display: block; }
#lock .lock-back { margin-left: auto; }

@media (max-height: 720px) {
  #lock { --lk-key: 68px; --lk-gap-y: 12px; }
  #lock .lock-key b { font-size: 30px; }
  #lock > section { padding-top: calc(env(safe-area-inset-top, 0px) + 52px); }
}
@media (max-height: 600px) {
  #lock { --lk-key: 58px; --lk-gap-y: 10px; }
  #lock .lock-key b { font-size: 26px; }
  #lock .lock-key small { display: none; }
  #lock .lock-time { font-size: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  #lock, #lock > section, #lock .lock-veil { transition-duration: 0.01s; }
  #lock.is-open.is-leaving { transform: none; }
}
