/*
 * Boot splash: the CybVault entry instrument shown before the app has loaded.
 * Paper (light) and Pitch (dark) follow the vault's saved theme (data-skin, set by handleOnLoad.js), else the device.
 * Plain CSS and system fonts: nothing else has loaded yet.
 */
:root {
  --ls-paper: #EEEEF3; --ls-soft: #E4E4EB; --ls-rule: #C9C9D3; --ls-grid: rgba(30, 30, 40, 0.05); --ls-ink: #1E1E28;
  --ls-dim: #5A5A66; --ls-raise: #F8F8FB; --ls-sunk: #E0E0E8; --ls-hi: rgba(255, 255, 255, 0.85); --ls-shade: #BDBDC8;
  --ls-fill: #5B4CE0; --ls-tint: rgba(91, 76, 224, 0.10); --ls-violet: #4E3FD6; --ls-logo: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-skin="default"]) {
    --ls-paper: #1E1E28; --ls-soft: #17171E; --ls-rule: #34343F; --ls-grid: rgba(242, 242, 245, 0.045); --ls-ink: #F2F2F5;
    --ls-dim: #9A9AA5; --ls-raise: #262630; --ls-sunk: #141419; --ls-hi: rgba(255, 255, 255, 0.07); --ls-shade: #0E0E13;
    --ls-fill: #6658DD; --ls-tint: rgba(113, 99, 241, 0.12); --ls-violet: #988DF7; --ls-logo: invert(1);
  }
}
:root[data-skin="midnight"] {
  --ls-paper: #1E1E28; --ls-soft: #17171E; --ls-rule: #34343F; --ls-grid: rgba(242, 242, 245, 0.045); --ls-ink: #F2F2F5;
  --ls-dim: #9A9AA5; --ls-raise: #262630; --ls-sunk: #141419; --ls-hi: rgba(255, 255, 255, 0.07); --ls-shade: #0E0E13;
  --ls-fill: #6658DD; --ls-tint: rgba(113, 99, 241, 0.12); --ls-violet: #988DF7; --ls-logo: invert(1);
}

/* No fixed html/body height: the document itself scrolls, as in the design (a fixed height made <body> an inner scroller). */
body,
html {
  margin: 0;
  padding: 0;
}

html {
  background: var(--ls-paper);
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background-color: var(--ls-paper);
  background-image: linear-gradient(var(--ls-grid) 1px, transparent 1px), linear-gradient(90deg, var(--ls-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  font-family: "DM Sans Variable", "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ls-ink);
  animation: ls-in 240ms cubic-bezier(.22, 1, .36, 1);
}

.ls-panel {
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 40px 32px 30px;
  background: var(--ls-paper);
  border: 1px solid var(--ls-rule);
  border-top: 3px solid var(--ls-ink);
  box-shadow: 0 0 0 8px var(--ls-soft), 0 0 0 9px var(--ls-rule);
}

.ls-logo {
  width: 220px;
  max-width: 70%;
  height: auto;
  filter: var(--ls-logo);
}

/* The keypad: eight keys pressed in a scrambled PIN order. */
.ls-keys {
  display: grid;
  grid-template-columns: repeat(4, 20px);
  gap: 7px;
  padding: 10px;
  background: var(--ls-sunk);
  border: 1px solid var(--ls-rule);
}
.ls-keys i {
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border: 1px solid var(--ls-rule);
  background: var(--ls-raise);
  box-shadow: inset 0 1px 0 var(--ls-hi), 0 2px 0 var(--ls-shade);
}
.ls-keys i:nth-child(6), .ls-keys i:nth-child(12), .ls-keys i:nth-child(1), .ls-keys i:nth-child(15),
.ls-keys i:nth-child(9), .ls-keys i:nth-child(4), .ls-keys i:nth-child(11), .ls-keys i:nth-child(14) {
  animation: ls-press 2.4s cubic-bezier(.22, 1, .36, 1) infinite both;
}
.ls-keys i:nth-child(6) { animation-delay: 0s; }
.ls-keys i:nth-child(12) { animation-delay: .3s; }
.ls-keys i:nth-child(1) { animation-delay: .6s; }
.ls-keys i:nth-child(15) { animation-delay: .9s; }
.ls-keys i:nth-child(9) { animation-delay: 1.2s; }
.ls-keys i:nth-child(4) { animation-delay: 1.5s; }
.ls-keys i:nth-child(11) { animation-delay: 1.8s; }
.ls-keys i:nth-child(14) { animation-delay: 2.1s; }

.ls-caption {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ls-ink);
}
.ls-cursor {
  display: inline-block;
  width: 8px;
  height: 13px;
  margin-left: 6px;
  vertical-align: -1px;
  background: var(--ls-violet);
  animation: ls-blink 1s steps(1) infinite;
}

/* Indeterminate rail: a violet segment travelling along a sunk track. */
.ls-rail {
  position: relative;
  width: 100%;
  max-width: 240px;
  height: 4px;
  overflow: hidden;
  background: var(--ls-sunk);
  border: 1px solid var(--ls-rule);
}
.ls-rail i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34%;
  background: var(--ls-fill);
  animation: ls-travel 1.6s cubic-bezier(.65, 0, .35, 1) infinite;
}

/* Only mention the wait if it is actually slow. */
.ls-slow {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: var(--ls-dim);
  opacity: 0;
  animation: ls-late 0.4s ease-out 6s forwards;
}

@keyframes ls-press {
  0%, 100% { background: var(--ls-raise); border-color: var(--ls-rule); transform: none; box-shadow: inset 0 1px 0 var(--ls-hi), 0 2px 0 var(--ls-shade); }
  6%, 16% { background: var(--ls-fill); border-color: var(--ls-fill); transform: translateY(2px); box-shadow: inset 0 1px 0 var(--ls-hi), 0 0 0 var(--ls-shade); }
  30% { background: var(--ls-tint); border-color: var(--ls-violet); transform: none; box-shadow: inset 0 1px 0 var(--ls-hi), 0 2px 0 var(--ls-shade); }
}
@keyframes ls-travel {
  from { left: -34%; }
  to { left: 100%; }
}
@keyframes ls-blink { 50% { opacity: 0; } }
@keyframes ls-late { to { opacity: 1; } }
@keyframes ls-in { from { opacity: 0; } }

@media (max-width: 560px) {
  .ls-panel { padding: 30px 22px 24px; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  #loading-screen, .ls-keys i, .ls-cursor, .ls-rail i { animation: none !important; }
  .ls-rail i { left: 33%; }
  .ls-slow { opacity: 1; animation: none; }
}
