/* Wakehelm launch screen (approved loading motion kit, docs/brand/loading-screen/).
 *
 * The kit's look, unchanged: matte graphite #11151B, the original logo geometry used as a mask,
 * a dim silver base #434B55, an indeterminate silver sweep every 2.4 s while waiting, and a
 * bottom-up silver #D3D8DE reveal (550 ms) on a real ready signal. The sweep is activity, not
 * progress. Added for the app: a fixed full-screen layer above the shell with Telegram safe areas,
 * a short fade once ready, and no hit testing after that (wakehelm-loader.js drives the state).
 */

.wakehelm-loader {
  --wakehelm-bg: #11151b;
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-content: center;
  justify-items: center;
  box-sizing: border-box;
  width: 100%;
  height: var(--tg-viewport-stable-height, 100dvh);
  min-height: 100%;
  padding:
    max(24px, env(safe-area-inset-top, 0px))
    max(24px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px))
    max(24px, env(safe-area-inset-left, 0px));
  overflow: hidden;
  background: var(--wakehelm-bg);
  color: #d3d8de;
  font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  opacity: 1;
  transition: opacity 220ms ease;
}

.wakehelm-loader[hidden] {
  display: none;
}

/* Once ready the layer no longer takes taps, even while its last frames fade. */
.wakehelm-loader[data-state="ready"] {
  pointer-events: none;
}

.wakehelm-loader.is-leaving {
  opacity: 0;
}

.wakehelm-mark {
  display: block;
  width: min(66vw, 270px);
  height: auto;
  overflow: hidden;
}

.wakehelm-sweep {
  transform: translateY(659px);
  animation: wakehelm-sweep 2.4s linear infinite;
}

.wakehelm-finish {
  transform: translateY(659px);
  transition: transform 550ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.wakehelm-status {
  min-height: 20px;
  max-width: 280px;
  margin: 36px 0 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.035em;
  color: #8c949e;
}

.wakehelm-loader[data-state="ready"] .wakehelm-finish {
  transform: translateY(0);
}

.wakehelm-loader[data-state="ready"] .wakehelm-sweep,
.wakehelm-loader[data-state="error"] .wakehelm-sweep {
  animation: none;
  opacity: 0;
}

.wakehelm-loader[data-state="error"] .wakehelm-finish {
  transition: none;
  transform: translateY(659px);
}

.wakehelm-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 18px;
}

.wakehelm-actions[hidden] {
  display: none;
}

.wakehelm-retry,
.wakehelm-continue {
  min-width: 88px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  background: transparent;
  color: #d3d8de;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.wakehelm-retry {
  border: 1px solid #65707e;
}

.wakehelm-continue {
  border: 0;
  color: #8c949e;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wakehelm-retry[hidden],
.wakehelm-continue[hidden] {
  display: none;
}

.wakehelm-retry:focus-visible,
.wakehelm-continue:focus-visible {
  outline: 2px solid #d3d8de;
  outline-offset: 4px;
}

@keyframes wakehelm-sweep {
  0% {
    transform: translateY(659px);
  }

  84%,
  100% {
    transform: translateY(-320px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wakehelm-sweep {
    animation: none;
    opacity: 0;
  }

  .wakehelm-base {
    fill: #7b848f;
  }

  .wakehelm-finish,
  .wakehelm-loader {
    transition: none;
  }
}
