@font-face {
  font-family: "Rostelecom Basis";
  src: url("fonts/RostelecomBasis-Light.woff2") format("woff2");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Rostelecom Basis";
  src: url("fonts/RostelecomBasis-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Rostelecom Basis";
  src: url("fonts/RostelecomBasis-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Rostelecom Basis";
  src: url("fonts/RostelecomBasis-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --rt-primary-1: #7700ff;
  --rt-primary-1-hover: rgba(119, 0, 255, 0.92);
  --rt-primary-2: #ff4f12;
  --rt-primary-2-hover: #d9430f;
  --rt-primary-2-active: #b3370d;
  --rt-primary-2-focus: rgba(255, 79, 18, 0.22);
  --rt-accent-muted: #ffa789;
  --rt-accent-soft: #ff7241;
  --rt-accent-container: rgba(255, 79, 18, 0.1);
  --rt-accent-container-hover: rgba(255, 79, 18, 0.2);
  --rt-secondary-1: #29cca3;
  --rt-secondary-2: #2f9aff;
  --rt-success: #00d359;
  --rt-error: #ff0c0c;
  --rt-warning: #ffb608;
  --rt-info: #0042ed;

  --rt-grey-black: #101828;
  --rt-grey-95: #1d2533;
  --rt-grey-90: #272f3d;
  --rt-grey-80: #3d4555;
  --rt-grey-60: #797e8b;
  --rt-grey-40: #b5b7c0;
  --rt-grey-20: #d3d4db;
  --rt-grey-10: #e8e8ee;
  --rt-grey-5: #f4f4f5;
  --rt-white: #ffffff;

  --rt-transparent-100: rgba(16, 24, 40, 1);
  --rt-transparent-75: rgba(16, 24, 40, 0.7);
  --rt-transparent-50: rgba(16, 24, 40, 0.5);
  --rt-transparent-25: rgba(16, 24, 40, 0.25);
  --rt-transparent-10: rgba(16, 24, 40, 0.1);
  --rt-transparent-5: rgba(16, 24, 40, 0.05);

  --rt-shadow-control: 0 0 1px rgba(28, 41, 61, 0.2), 0 2px 4px rgba(28, 41, 61, 0.12);
  --rt-shadow-bottom-m: 0 0 16px rgba(28, 41, 61, 0.05), 0 4px 8px rgba(28, 41, 61, 0.06);
  --rt-shadow-bottom-l: 0 0 20px rgba(28, 41, 61, 0.05), 0 12px 20px rgba(28, 41, 61, 0.06);

  --rt-radius-s: 8px;
  --rt-radius-m: 16px;
  --rt-radius-l: 24px;
}

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

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Rostelecom Basis", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-feature-settings: "tnum" on, "lnum" on;
  color: var(--rt-grey-black);
  background-color: var(--rt-grey-5);
  background-image:
    radial-gradient(48rem 32rem at 8% -6%, rgba(119, 0, 255, 0.12), transparent 62%),
    radial-gradient(40rem 28rem at 108% 8%, rgba(255, 79, 18, 0.1), transparent 60%);
  background-attachment: fixed;
}

.page {
  width: min(1120px, 100% - 40px);
  margin: 0 auto;
  padding: 28px 0 32px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--rt-white);
  background: linear-gradient(135deg, var(--rt-primary-1) 0%, #a855ff 55%, var(--rt-primary-2) 120%);
  box-shadow: var(--rt-shadow-control);
}

.brand__mark svg {
  width: 26px;
  height: 26px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand__subtitle {
  margin-top: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--rt-grey-60);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 32px;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  color: var(--rt-primary-1);
  background: rgba(119, 0, 255, 0.08);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  align-items: center;
  gap: 48px;
  padding: 24px 0 48px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rt-primary-1);
}

.intro h1 {
  max-width: 14ch;
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  line-height: 48px;
  letter-spacing: -0.02em;
}

.intro__accent {
  color: var(--rt-primary-1);
}

.lead {
  max-width: 48ch;
  margin: 20px 0 0;
  font-size: 16px;
  line-height: 24px;
  color: var(--rt-grey-80);
}

.operations {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.operations li {
  display: flex;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--rt-radius-s);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  background-color: transparent;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.button__label {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.button--size-m {
  min-width: 56px;
  height: 36px;
  padding: 0 12px;
}

.button--size-m .button__label {
  padding: 0 4px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.operations .button {
  width: 56px;
}

.operations .button__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}

.operations__item[data-operation="+"] .button__label {
  margin-top: 1px;
}

.operations__item[data-operation="-"] .button__label {
  margin-top: 2.5px;
  margin-right: -2px;
}

.operations__item[data-operation="*"] .button__label {
  margin-top: 2.5px;
  margin-right: -1px;
}

.operations__item[data-operation="/"] .button__label {
  width: 20px;
  margin-top: -2.2px;
  margin-right: -1px;
}

.button:focus-visible {
  box-shadow: 0 0 0 4px var(--rt-primary-2-focus);
}

.button--outline.button--accent {
  border-color: var(--rt-accent-muted);
  color: var(--rt-primary-2);
}

.button--outline.button--accent:hover {
  border-color: var(--rt-accent-soft);
  color: var(--rt-primary-2-hover);
  background-color: var(--rt-accent-container);
}

.button--outline.button--accent:active {
  border-color: var(--rt-accent-soft);
  color: var(--rt-primary-2-hover);
  background-color: var(--rt-accent-container-hover);
}

.button--primary.button--accent {
  color: var(--rt-white);
  background-color: var(--rt-primary-2);
}

.button--primary.button--accent:hover {
  background-color: var(--rt-primary-2-hover);
}

.button--primary.button--accent:active {
  background-color: var(--rt-primary-2-active);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 420px;
  margin: 32px 0 0;
}

.stat {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--rt-grey-10);
  border-radius: var(--rt-radius-m);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--rt-shadow-bottom-m);
  backdrop-filter: blur(8px);
}

.stat__label {
  font-size: 12px;
  line-height: 16px;
  color: var(--rt-grey-60);
}

.stat__value {
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 32px;
  color: var(--rt-grey-black);
  transition: transform 0.2s ease;
}

.stat__value--pop {
  animation: pop 0.32s ease;
}

.game {
  padding: 28px;
  border: 1px solid var(--rt-grey-10);
  border-radius: var(--rt-radius-l);
  background: var(--rt-white);
  box-shadow: var(--rt-shadow-bottom-l);
}

.game__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.game__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 24px;
}

.status {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 32px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
  color: var(--rt-grey-80);
  background: var(--rt-grey-5);
}

.status--success {
  color: #007c34;
  background: rgba(0, 211, 89, 0.12);
}

.status--error {
  color: #b30000;
  background: rgba(255, 12, 12, 0.1);
}

.status--loading {
  color: var(--rt-primary-1);
  background: rgba(119, 0, 255, 0.08);
}

.equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 132px;
  padding: 24px 16px;
  border-radius: var(--rt-radius-m);
  background:
    linear-gradient(180deg, rgba(119, 0, 255, 0.04), rgba(255, 79, 18, 0.03)),
    var(--rt-grey-5);
}

.equation__number {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: var(--rt-grey-black);
}

.equation__operation {
  font-size: 40px;
  font-weight: 500;
  line-height: 1;
  color: var(--rt-primary-1);
}

.equation__equals {
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
  color: var(--rt-grey-40);
}

.equation__placeholder {
  display: grid;
  place-items: center;
  min-width: 64px;
  height: 64px;
  padding: 0 12px;
  border: 2px dashed var(--rt-grey-20);
  border-radius: var(--rt-radius-s);
  font-size: 36px;
  font-weight: 500;
  line-height: 1;
  color: var(--rt-grey-40);
}

.answer-form {
  margin-top: 24px;
}

.field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--rt-grey-60);
}

.field {
  display: flex;
  gap: 12px;
}

.field__input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 2px solid var(--rt-grey-20);
  border-radius: var(--rt-radius-s);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--rt-grey-black);
  background: var(--rt-white);
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.field__input::placeholder {
  color: var(--rt-grey-40);
}

.field__input:hover {
  border-color: var(--rt-grey-40);
}

.field__input:focus {
  border-color: var(--rt-primary-1);
  box-shadow: 0 0 0 4px rgba(119, 0, 255, 0.12);
}

.field__input--success {
  border-color: var(--rt-success);
}

.field__input--error {
  border-color: var(--rt-error);
}

.field__input--shake {
  animation: shake 0.36s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  border: 2px solid transparent;
  border-radius: var(--rt-radius-s);
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.btn:focus-visible {
  box-shadow: 0 0 0 4px rgba(119, 0, 255, 0.18);
}

.btn:disabled {
  cursor: not-allowed;
}

.btn--large {
  min-width: 120px;
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  line-height: 24px;
}

.btn--small {
  min-width: 80px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 20px;
}

.btn--primary {
  color: var(--rt-white);
  background-color: var(--rt-primary-2);
}

.btn--primary:focus-visible {
  box-shadow: 0 0 0 4px var(--rt-primary-2-focus);
}

.btn--primary:hover:enabled {
  background-image: linear-gradient(var(--rt-transparent-5), var(--rt-transparent-5));
}

.btn--primary:active:enabled {
  background-image: linear-gradient(var(--rt-transparent-10), var(--rt-transparent-10));
}

.btn--primary:disabled {
  color: var(--rt-transparent-25);
  background-color: var(--rt-transparent-10);
  background-image: none;
}

.btn--ghost {
  color: var(--rt-primary-1);
  background-color: transparent;
}

.btn--ghost:hover:enabled {
  background-color: rgba(119, 0, 255, 0.06);
}

.btn--ghost:active:enabled {
  background-color: rgba(119, 0, 255, 0.1);
}

.feedback {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--rt-grey-60);
}

.feedback--success {
  color: #007c34;
}

.feedback--error {
  color: #b30000;
}

.game__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--rt-grey-10);
}

.hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--rt-grey-40);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--rt-grey-10);
  font-size: 12px;
  line-height: 16px;
  color: var(--rt-grey-40);
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 32px;
    align-items: start;
  }

  .intro h1 {
    max-width: 20ch;
    font-size: 36px;
    line-height: 40px;
  }

  .stats {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 24px, 1120px);
    padding-top: 20px;
  }

  .site-header {
    padding-bottom: 20px;
  }

  .brand__title {
    font-size: 14px;
  }

  .intro h1 {
    font-size: 30px;
    line-height: 34px;
  }

  .lead {
    margin-top: 16px;
  }

  .stats {
    gap: 8px;
    margin-top: 24px;
  }

  .stat {
    padding: 12px;
  }

  .stat__value {
    font-size: 22px;
    line-height: 28px;
  }

  .game {
    padding: 20px;
  }

  .game__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .equation {
    min-height: 108px;
    gap: 10px;
    padding: 20px 12px;
  }

  .equation__number {
    font-size: 36px;
  }

  .equation__operation,
  .equation__equals {
    font-size: 30px;
  }

  .equation__placeholder {
    min-width: 48px;
    height: 52px;
    font-size: 28px;
  }

  .field {
    flex-direction: column;
  }

  .field__input {
    flex: none;
  }

  .btn--large {
    width: 100%;
  }

  .game__footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }
}

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