:root {
  color-scheme: dark;
  --bg: #06070a;
  --bg-soft: #101116;
  --surface: rgba(18, 19, 24, 0.82);
  --surface-strong: rgba(28, 29, 36, 0.78);
  --text: #fff8ec;
  --muted: rgba(255, 248, 236, 0.72);
  --muted-soft: rgba(255, 248, 236, 0.5);
  --border: rgba(255, 176, 64, 0.22);
  --accent: #ffae25;
  --accent-strong: #ff7a00;
  --accent-rgb: 255, 145, 19;
  --button-text: #160f08;
  --shadow: rgba(255, 128, 0, 0.24);
}

body[data-page="fail"] {
  --border: rgba(255, 138, 76, 0.22);
  --accent: #ff9c4a;
  --accent-strong: #e45f28;
  --accent-rgb: 238, 96, 44;
  --shadow: rgba(232, 86, 35, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 24%),
    linear-gradient(135deg, #111217 0%, #07080b 48%, #040508 100%);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at 50% 44%, black 0%, transparent 70%);
  opacity: 0.2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 32%, rgba(var(--accent-rgb), 0.12), transparent 44%),
    radial-gradient(ellipse at 50% 68%, rgba(255, 255, 255, 0.05), transparent 48%);
  opacity: 0.92;
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding:
    max(22px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  isolation: isolate;
}

.page::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: min(1040px, 128vw);
  height: min(540px, 70vh);
  border-radius: 999px;
  transform: translate(-50%, -52%) rotate(-8deg);
  background:
    radial-gradient(closest-side, transparent 46%, rgba(var(--accent-rgb), 0.13) 54%, transparent 72%),
    linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.12), transparent);
  filter: blur(20px);
  opacity: 0.88;
  animation: halo-drift 9s ease-in-out infinite alternate;
}

.card {
  position: relative;
  width: min(100%, 548px);
  padding: 40px;
  overflow: hidden;
  text-align: center;
  border: 1px solid transparent;
  border-radius: 30px;
  background:
    linear-gradient(180deg, var(--surface-strong), var(--surface)) padding-box,
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.54), rgba(255, 255, 255, 0.06) 34%, rgba(var(--accent-rgb), 0.18)) border-box;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.48),
    0 0 72px var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: card-in 520ms cubic-bezier(.2, .72, .2, 1) both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.075) 32%, transparent 53%),
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.18), transparent 38%);
  opacity: 0.9;
}

.card > * {
  position: relative;
}

.logo-shell {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 44px var(--shadow);
  animation: logo-breathe 4.8s ease-in-out infinite;
}

.logo {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 28px;
  object-fit: cover;
}

.brand {
  margin: 0 0 13px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.title {
  max-width: 10ch;
  margin: 0 auto;
  font-size: 54px;
  line-height: 1.02;
  font-weight: 860;
  letter-spacing: 0;
}

body[data-page="fail"] .title {
  max-width: 12ch;
}

.subtitle {
  max-width: 36ch;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.58;
  font-weight: 560;
}

.actions {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.button {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.button span {
  min-width: 0;
}

.button::after {
  content: ">";
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 15px;
  line-height: 1;
}

.button.primary {
  border-color: rgba(255, 198, 96, 0.55);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--button-text);
  box-shadow: 0 14px 34px var(--shadow);
}

.button.primary::after {
  background: rgba(0, 0, 0, 0.13);
}

.button:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.56);
  box-shadow: 0 16px 38px var(--shadow);
}

.button:active {
  transform: translateY(0) scale(0.985);
}

.button:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.42);
  outline-offset: 4px;
}

.fallback {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.fallback a {
  color: var(--accent);
}

@media (min-width: 560px) {
  .actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 34px 26px;
    border-radius: 28px;
  }

  .logo-shell {
    width: 104px;
    height: 104px;
    border-radius: 26px;
  }

  .logo {
    border-radius: 26px;
  }

  .title {
    font-size: 46px;
  }
}

@media (max-width: 430px) {
  .page {
    align-items: stretch;
    padding:
      max(14px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }

  .card {
    width: 100%;
    min-height: calc(100svh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 28px 20px;
  }

  .brand {
    font-size: 12px;
  }

  .title {
    font-size: 40px;
  }

  .subtitle {
    margin-top: 16px;
    font-size: 16px;
  }

  .actions {
    margin-top: 28px;
  }

  .button {
    width: 100%;
    min-height: 60px;
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 360px) {
  .card {
    padding-right: 16px;
    padding-left: 16px;
  }

  .logo-shell {
    width: 96px;
    height: 96px;
    border-radius: 24px;
  }

  .logo {
    border-radius: 24px;
  }

  .title {
    font-size: 36px;
  }

  .subtitle {
    font-size: 15px;
  }

  .button {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes logo-breathe {
  0%,
  100% {
    transform: translateY(0);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      0 0 36px var(--shadow);
  }

  50% {
    transform: translateY(-2px);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.12),
      0 0 54px var(--shadow);
  }
}

@keyframes halo-drift {
  from {
    transform: translate(-50%, -52%) rotate(-8deg) scale(0.98);
    opacity: 0.72;
  }

  to {
    transform: translate(-50%, -49%) rotate(-5deg) scale(1.02);
    opacity: 0.98;
  }
}
