:root {
  color: #ffffff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --page-width: 480px;
  --side-space: clamp(20px, 5.4vw, 28px);
  --telegram-blue: #229ed9;
  --telegram-blue-hover: #178ac1;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 280px;
  background: #080808;
  overflow: hidden;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

.app-shell {
  position: relative;
  width: min(100%, var(--page-width));
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #1b1b1b;
  box-shadow: 0 0 48px rgb(0 0 0 / 55%);
}

.step {
  position: absolute;
  inset: 0;
  display: none;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  isolation: isolate;
}

.step::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgb(0 0 0 / 24%), rgb(0 0 0 / 36%));
  content: "";
  pointer-events: none;
}

.step.is-active {
  display: block;
  animation: step-in 280ms ease-out both;
}

.step--welcome {
  background-image: url("bg-1.webp");
}

.step--age {
  background-image: url("bg-2.webp");
}

.step--telegram {
  background-image: url("bg-3.webp");
}

.step-header {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: grid;
  width: 100%;
  min-height: calc(76px + env(safe-area-inset-top));
  padding: calc(18px + env(safe-area-inset-top)) var(--side-space) 12px;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  pointer-events: none;
}

.step-count {
  grid-column: 2;
  justify-self: center;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1;
  text-shadow: 0 1px 8px rgb(0 0 0 / 65%);
}

.back-button {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 8px;
  color: #ffffff;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  grid-column: 1;
  place-items: center;
  pointer-events: auto;
}

.back-button svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2;
}

.step-content {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 100%;
  padding: calc(92px + env(safe-area-inset-top)) var(--side-space)
    calc(24px + env(safe-area-inset-bottom));
  flex-direction: column;
}

.step-content--welcome {
  justify-content: center;
  gap: clamp(26px, 5.4vh, 48px);
}

.step-content--age {
  justify-content: center;
  gap: clamp(22px, 4vh, 38px);
}

.step-content--telegram {
  justify-content: center;
  gap: clamp(26px, 5vh, 44px);
  text-align: center;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 8.5vw, 2.7rem);
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1.04;
  text-wrap: balance;
  text-shadow: 0 2px 14px rgb(0 0 0 / 48%);
}

.copy-block p {
  max-width: 410px;
  margin: 18px 0 0;
  font-size: clamp(0.9rem, 3.8vw, 1.08rem);
  font-weight: 520;
  line-height: 1.42;
  text-shadow: 0 1px 9px rgb(0 0 0 / 80%);
}

.copy-block--centered p {
  margin-right: auto;
  margin-left: auto;
}

.option-list {
  display: grid;
  width: calc(100% - 12px);
  align-self: center;
  gap: 12px;
}

.option-list--ages {
  gap: 10px;
}

.option-button {
  width: 100%;
  min-height: 62px;
  padding: 13px 20px;
  color: #222222;
  background: #ffffff;
  border: 2px solid rgb(255 255 255 / 72%);
  border-radius: 8px;
  box-shadow: 0 5px 16px rgb(0 0 0 / 24%);
  cursor: pointer;
  font-size: clamp(1rem, 4.4vw, 1.28rem);
  font-weight: 650;
  line-height: 1.1;
  text-align: left;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.option-button:active {
  transform: scale(0.985);
}

.option-button[aria-pressed="true"] {
  background: #edf8fd;
  border-color: var(--telegram-blue);
}

.telegram-button {
  display: flex;
  width: 100%;
  min-height: 76px;
  padding: 16px 20px;
  color: #ffffff;
  background: var(--telegram-blue);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgb(0 100 160 / 35%);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: clamp(1rem, 4.3vw, 1.18rem);
  font-weight: 800;
  line-height: 1.15;
  text-decoration: none;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.telegram-button svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  fill: currentColor;
}

.telegram-button:active {
  transform: scale(0.985);
  background: var(--telegram-blue-hover);
}

.age-notice {
  max-width: 400px;
  margin: 4px auto 0;
  font-size: 0.82rem;
  font-weight: 520;
  line-height: 1.45;
  text-shadow: 0 1px 7px rgb(0 0 0 / 90%);
}

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(100%, 380px);
  padding: 30px 24px 24px;
  color: #202020;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 55%);
  text-align: center;
  animation: modal-in 200ms ease-out both;
}

.modal-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  color: #ffffff;
  background: var(--telegram-blue);
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 850;
  place-items: center;
}

.modal-card h2 {
  margin-bottom: 12px;
  font-size: 1.4rem;
  line-height: 1.15;
}

.modal-card p {
  margin-bottom: 24px;
  color: #555555;
  font-size: 0.92rem;
  line-height: 1.5;
}

.modal-button {
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  color: #ffffff;
  background: var(--telegram-blue);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
}

.back-button:focus-visible,
.option-button:focus-visible,
.telegram-button:focus-visible,
.modal-button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

h1:focus {
  outline: none;
}

.option-button:focus-visible,
.modal-button:focus-visible {
  outline-color: var(--telegram-blue);
}

body.modal-open {
  overflow: hidden;
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (hover: hover) {
  .option-button:hover {
    background: #f4f9fb;
    box-shadow: 0 7px 20px rgb(0 0 0 / 30%);
  }

  .telegram-button:hover,
  .modal-button:hover {
    background: var(--telegram-blue-hover);
  }

  .back-button:hover {
    background: rgb(255 255 255 / 12%);
  }
}

@media (max-height: 680px) {
  .step-content {
    padding-top: calc(78px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .step-content--welcome,
  .step-content--age,
  .step-content--telegram {
    gap: 18px;
  }

  h1 {
    font-size: clamp(1.72rem, 7.6vw, 2.3rem);
  }

  .copy-block p {
    margin-top: 12px;
    font-size: 0.88rem;
  }

  .option-list,
  .option-list--ages {
    gap: 9px;
  }

  .option-button {
    min-height: 50px;
    padding: 10px 16px;
    font-size: 0.98rem;
  }

  .telegram-button {
    min-height: 62px;
  }

  .age-notice {
    font-size: 0.74rem;
  }
}

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