:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --navy: #001a4d;
  --blue: #0042aa;
  --blue-light: #e3edff;
  --orange: #f26a21;
  --orange-light: #fff0e7;
  --text: #10233f;
  --muted: #5d6f88;
  --outline: #c3d0e3;
  --radius: 3px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--blue);
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--navy);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
}

p {
  margin: 0;
}

.container {
  width: min(1040px, 100% - 40px);
  margin-inline: auto;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.settings :focus-visible {
  outline-color: #ffffff;
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.button--primary {
  background: var(--orange);
  color: var(--navy);
}

.button--primary:hover {
  background: #e05a12;
}

.button--secondary {
  background: var(--surface);
  border-color: var(--blue);
  color: var(--blue);
}

.button--secondary:hover {
  background: var(--blue-light);
}

/* ---------- hero ---------- */

.hero {
  padding: 56px 0 0;
  background: var(--surface);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 40px;
}

.hero h1 {
  max-width: 15ch;
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.hero__lead {
  max-width: 58ch;
  margin-top: 20px;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.55;
}

.hero__note {
  margin-top: 14px;
  font-size: 0.95rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero__params {
  margin-top: 18px;
  font-size: 0.95rem;
}

.hero__params a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.hero__params a:hover {
  text-decoration: underline;
}

.hero__logo {
  position: relative;
  justify-self: center;
}

.hero__logo img {
  display: block;
  width: clamp(200px, 24vw, 280px);
  height: auto;
  -webkit-mask: url("logo-mask.png") center / 100% 100% no-repeat;
  mask: url("logo-mask.png") center / 100% 100% no-repeat;
}

/* Огонь вырезан из логотипа маской и нарисован отдельной картинкой:
   так он может мерцать, а белого квадрата JPG на странице не видно.
   Наклон (медленный, влево-вправо) живёт на обёртке, мерцание — внутри.
   Пламя — кнопка пасхалки: клик по огню показывает ping/pong. */
.hero__flame {
  position: absolute;
  top: 1.4583%;
  left: 42.7083%;
  width: 11.25%;
  height: 10.4167%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  overflow: visible;
  animation: flame-sway 7s ease-in-out infinite alternate;
  transform-origin: 50% 100%;
}

/* На телефоне пламя — 15×14 px, пальцем не попасть. Невидимый запас
   вокруг расширяет цель до ~44 px; кликабелен только огонь. */
.hero__flame::after {
  content: "";
  position: absolute;
  inset: -15px;
}

.hero__flame span {
  display: block;
  width: 100%;
  height: 100%;
  background: url("flame.png") center / 100% 100% no-repeat;
  animation: flame-flicker 3.6s ease-in-out infinite;
  transform-origin: 50% 100%;
}

/* Ответ на клик по огню. Облачко стоит справа от пламени, в координатах
   логотипа, и не наследует его наклон. */
.hero__ping {
  position: absolute;
  left: calc(53.9583% + 8px);
  top: 1.4583%;
  padding: 3px 9px;
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  background: var(--orange-light);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.96);
  transform-origin: left center;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.hero__ping::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-left: 1px solid var(--orange);
  border-bottom: 1px solid var(--orange);
  border-radius: 1px;
  background: var(--orange-light);
  transform: rotate(45deg);
}

.hero__ping.is-on {
  opacity: 1;
  transform: none;
  transition-duration: 0.16s;
}

/* «Ping» отвечает слева от огня, «pong» — справа: хвостик и точка роста
   разворачиваются вместе со словом. */
.hero__ping.is-left {
  right: calc(57.2917% + 8px);
  left: auto;
  transform-origin: right center;
}

.hero__ping.is-left::before {
  right: -5px;
  left: auto;
  border: 0;
  border-top: 1px solid var(--orange);
  border-right: 1px solid var(--orange);
}

@keyframes flame-sway {
  from {
    transform: rotate(-6deg) translateX(-1.5%);
  }

  to {
    transform: rotate(6deg) translateX(1.5%);
  }
}

@keyframes flame-flicker {
  0%,
  100% {
    filter: brightness(1);
    transform: scale(1, 1);
  }

  18% {
    filter: brightness(1.05);
    transform: scale(1.02, 1.07);
  }

  37% {
    filter: brightness(0.98);
    transform: scale(1.01, 1.03);
  }

  56% {
    filter: brightness(1.06);
    transform: scale(1.04, 1.09);
  }

  74% {
    filter: brightness(1.01);
    transform: scale(1.02, 1.05);
  }

  88% {
    filter: brightness(1.03);
    transform: scale(1.03, 1.06);
  }
}

/* ---------- skyline ---------- */

.skyline {
  margin-top: 28px;
  padding-bottom: 16px;
  color: var(--navy);
  line-height: 0;
}

.skyline svg {
  display: block;
  width: 100%;
  height: auto;
}

.skyline svg.skyline__mobile {
  display: none;
}

/* ---------- settings ---------- */

.settings {
  padding: 48px 0 24px;
  scroll-margin-top: 16px;
}

.settings__card {
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--radius);
  background: var(--navy);
  color: #ffffff;
}

.settings h2 {
  color: #ffffff;
}

.settings__intro {
  max-width: 60ch;
  margin-top: 10px;
  color: #b9cdf2;
}

.settings__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px 20px;
  margin: 28px 0 0;
}

.settings__item {
  min-width: 0;
  padding-top: 14px;
  border-top: 2px solid rgba(242, 106, 33, 0.85);
}

.settings dt {
  margin-bottom: 6px;
  color: #9fc0ff;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.settings dd {
  margin: 0;
  font-size: clamp(1.7rem, 3.4vw, 2.25rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
}

.settings .unit {
  margin-left: 3px;
  color: #9fc0ff;
  font-size: 0.42em;
  font-weight: 400;
}

.settings__note {
  margin-top: 24px;
  color: #9fc0ff;
  font-size: 0.82rem;
}

/* ---------- steps ---------- */

.steps {
  padding: 28px 0 24px;
}

.steps h2 {
  margin-bottom: 24px;
}

.steps__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 24px;
}

.step {
  padding-top: 16px;
  border-top: 2px solid var(--orange);
}

.step__num {
  display: block;
  margin-bottom: 14px;
  color: #d9550f;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.step h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.step p {
  color: var(--muted);
  font-size: 0.98rem;
}

.step .button {
  min-height: 44px;
  margin-top: 16px;
  padding: 10px 18px;
  font-size: 0.95rem;
}

.step__hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.step__apps {
  margin-top: 10px;
  font-size: 0.88rem;
}

.step__apps a {
  font-weight: 700;
}

/* ---------- wiki ---------- */

.wiki {
  padding: 24px 0 56px;
}

.wiki__card {
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--radius);
  background: var(--blue-light);
}

.wiki__card h2 {
  margin-bottom: 10px;
}

.wiki__card p {
  max-width: 62ch;
}

.wiki__card > p:not(.wiki__links) {
  margin-bottom: 24px;
}

.wiki__links {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- footer ---------- */

.footer {
  padding: 24px 0 40px;
  border-top: 1px solid var(--outline);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
}

.footer__brand {
  color: var(--navy);
  font-weight: 700;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer a {
  color: var(--blue);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero {
    padding-top: 48px;
  }

  .hero__inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero__logo {
    order: -1;
    justify-self: start;
  }

  .hero__logo img {
    width: 150px;
  }

  .settings__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 16px;
  }

  .settings dd {
    font-size: 1.8rem;
  }

  .settings__item:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 800px) {
  .steps__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .container {
    width: calc(100% - 32px);
  }

  .skyline svg.skyline__desktop {
    display: none;
  }

  .skyline svg.skyline__mobile {
    display: block;
    max-width: 480px;
    margin-inline: auto;
  }

  .hero {
    padding-top: 36px;
  }

  .hero__logo img {
    width: 132px;
  }

  .hero__actions .button {
    flex: 1 1 100%;
  }

  .settings__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings dd {
    font-size: clamp(1.4rem, 5.5vw, 1.8rem);
  }

  .settings__item:last-child {
    grid-column: 1 / -1;
  }

  .wiki__card {
    padding: 24px;
  }

  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
