body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  height: 100%;
  background: #0d0d0d;
  color: #cecece;
}

html {
    display: flex;
    flex-direction: column;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  min-height: 100vh;
  background-color: #e7ecf4; /* светлая тема */
  color: #111;
}
@media (prefers-color-scheme: dark) {
  body {
    background-color: #000000; /* тёмная тема */
    color: #eee;
  }
}
.wrapper {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  background: inherit;
  padding: 20px 16px 100px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  position: relative;
}

.logo {
  font-weight: 600;
  font-size: 1.3rem;
  margin-bottom: 24px;
  user-select: none;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.subhead {
  font-size: 1rem;
  text-align: center;
  margin-bottom: 28px;
  color: #a0a0ff;
  font-weight: 600;
}

.features {
  background: #2e2e55;
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.features p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
}

.features p::before {
  content: '⬤';
  font-size: 0.6rem;
  color: #aaa;
}

.referral {
  background: #4a47ff;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 16px;
}

.referral small {
  display: inline-block;
  font-size: 0.85rem;
  color: #ccc;
  margin-top: 6px;
  font-weight: 400;
}

.tariff-note {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: #ccc;
  margin-bottom: 32px;
}

.telegram-btn {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #4a47ff;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 16px 28px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(74, 71, 255, 0.5);
  transition: all 0.3s ease;
  z-index: 10;
}

.telegram-btn:hover {
  box-shadow: 0 12px 32px rgba(74, 71, 255, 0.7);
  transform: translateX(-50%) translateY(-4px);
}

.telegram-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center; /* <-- ключевая строка */
  background: #f4f4f8;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #ccc;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 1rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: bold;
  color: #5c3dac;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1; /* убираем сдвиги */
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  line-height: 1;
}

.user-name {
  font-weight: 500;
  color: #333;
  margin: 0;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}

.menu-group {
  position: relative;
  display: flex;
  align-items: center;
}

.menu-button {
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: #e0e0e0;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-top: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 100;
}

.dropdown a {
  display: inline-block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #333;
  transition: background 0.2s;
}

.dropdown a:hover {
  background-color: #f0f0f0;
}

/* Показывать меню */
.dropdown.show {
  display: inline-block;
}

/* 🌙 Тёмная тема */
@media (prefers-color-scheme: dark) {
  .topbar-row {
    background: #1e1b26;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 1rem;
  }

  .logo {
    color: #a489fc;
  }

  .user-name {
    color: #ddd;
  }

  .menu-button {
    background: #333;
    color: #fff;
  }

  .menu-button:hover {
    background: #444;
  }

  .dropdown {
    background: #2a2733;
    border-color: #444;
  }

  .dropdown a {
    color: #ddd;
  }

  .dropdown a:hover {
    background: #3a3844;
  }
}


.balance-card {
  background: #f9f9f9;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e0e0e0;
}

.balance-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
}

.balance-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.balance-info {
  display: flex;
  flex-direction: column;
}

.balance-value {
  font-size: 1.8rem;
  font-weight: bold;
  color: #111;
  margin-bottom: 0.3rem;
}

.balance-label {
  font-size: 0.95rem;
  color: #666;
}

.balance-actions {
  display: flex;
  gap: 0.75rem;
}

.primary-btn {
  background-color: #4a47ff;
  color: white;
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.2s;
}

.primary-btn:hover {
  background-color: #3633c4;
}

.secondary-btn {
  background-color: #e0e0e0;
  color: #333;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.2s;
}

.secondary-btn:hover {
  background-color: #d5d5d5;
}

/* 🌙 Dark Theme */
@media (prefers-color-scheme: dark) {
  .balance-card {
    background: #1e1e1e;
    border: 1px solid #333;
  }

  .balance-header {
    color: #c8bfe7;
  }

  .balance-value {
    color: #ffffff;
  }

  .balance-label {
    color: #aaa;
  }

  .primary-btn {
    background-color: #4a47ff;
    color: #fff;
  }

  .primary-btn:hover {
    background-color: #4a47ff;
  }

  .secondary-btn {
    background-color: #333;
    color: #ddd;
  }

  .secondary-btn:hover {
    background-color: #444;
  }
}



.devices-block {
  margin-bottom: 24px;
}

.devices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  margin-bottom: 12px;
}

.add-device {
  background: #4a47ff;
  color: white;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: bold;
  font-size: 1.2rem;
  text-decoration: none;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-item {
  background: #3a3a5a;
  padding: 14px;
  border-radius: 12px;
}

.device-item small {
  color: #aaa;
  font-size: 0.8rem;
}

.device-empty {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
}

.share-btn {
  background: #2e2e55;
  border: none;
  color: white;
  padding: 12px;
  border-radius: 12px;
  width: 100%;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  margin-top: 12px;
  font-size: 16px;
}
.share-btna {
  background: #1c1c36;
  border: none;
  color: white;
  padding: 12px;
  border-radius: 12px;
  width: 100%;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  margin-top: 12px;
  font-size: 16px;
}
.share-btn:hover {
  background: #3b3b6d;
}
.share-btna:hover {
  background: rgb(26, 26, 49);
}

.amount-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

/* Светлая тема */
@media (prefers-color-scheme: light) {
  body {
  background-color: #e7ecf4; /* светлая тема */
  color: #111;
  }
  .share-btna {
    background: #f7f7f9;  /* Светло-серый фон */
    color: black;  /* Черный текст */
  }

  .share-btna:hover {
    background: #e3e3e4;  /* Более светлый фон при наведении */
  }
  .balance-card, .device-item, .share-btn {
    background: #e6eaff;
    color: #111;
  }

  .primary-btn {
    background: #4a47ff;
    color: white;
  }

  .device-item small {
    color: #555;
  }
}
.header-box {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-link {
  margin: 20px 0;
}

.back-link a {
  display: inline-block;
  color: #888; /* Нейтральный серый, подходит к обоим темам */
  text-decoration: none;
  font-size: 16px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all 0.2s ease-in-out;
}

.back-link a:hover {
  background-color: rgba(136, 136, 136, 0.1); /* легкий прозрачный фон */
  color: #222; /* тёмный текст на светлой теме, и норм на тёмной */
  border-color: #ccc;
}

/* Тёмная тема (если используется класс или prefers-color-scheme) */
@media (prefers-color-scheme: dark) {
  .back-link a {
    color: #aaa;
  }

  .back-link a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #555;
  }
}
.devices-section {
  margin-top: 2rem;
}

.devices-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.device-card {
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.device-type {
  font-style: italic;
  color: #666;
}

.device-meta {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #777;
}

.device-empty {
  text-align: center;
  padding: 1rem;
  background: #fff8f0;
  border: 1px dashed #ccc;
  border-radius: 8px;
  color: #999;
}

.devices-add-btn {
  display: inline-block;
  margin-top: 1rem;
  font-size: 1.5rem;
  padding: 0.5rem 1rem;
  background: #4caf50;
  color: white;
  border-radius: 50%;
  text-decoration: none;
  text-align: center;
}

.device-edit-btn {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #0066cc;
  text-decoration: underline;
  transition: color 0.2s;
}

.device-edit-btn:hover {
  color: #004c99;
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-label {
  display: flex;
  flex-direction: column;
}

.device-settings {
  font-size: 1.2rem;
  text-decoration: none;
  cursor: pointer;
  color: #333;
  transition: transform 0.2s, color 0.2s;
}

.device-settings:hover {
  transform: rotate(20deg);
  color: #007acc;
}

/* Заголовок секции с кнопкой "+" */
.devices-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.devices-title-text {
  display: flex;
  flex-direction: column;
}

.devices-title h3 {
  margin: 0;
  font-size: 1.2rem;
}

.devices-count {
  margin: 0.25rem 0 0 0;
  font-size: 0.95rem;
  color: #555;
}

/* Кнопка "+" в квадрате */
.devices-square-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background-color: #e0f2f1;
  color: #111;
  text-decoration: none;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;           /* 🔧 убирает лишний вертикальный отступ */
  transition: background-color 0.2s, transform 0.2s;
  border: 1px solid #ffffff;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
  position: relative;
  top: 1px;                 /* 🔧 мелкая компенсация для точной центровки */
}

.devices-square-add:hover {
  background-color: #ffffff;
  transform: scale(1.05);
}

/* 🌙 Тёмная тема */
@media (prefers-color-scheme: dark) {
  .device-card {
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
  }

  .device-type {
    color: #aaa;
  }

  .device-meta {
    color: #999;
  }

  .device-empty {
    background: #2c2c2c;
    border: 1px dashed #444;
    color: #aaa;
  }

  .devices-add-btn {
    background: #ffffff;
    color: white;
  }

  .device-edit-btn {
    color: #66ccff;
  }

  .device-edit-btn:hover {
    color: #33bbff;
  }

  .device-settings {
    color: #ccc;
  }

  .device-settings:hover {
    color: #66ccff;
  }

  .devices-count {
    color: #aaa;
  }

  .devices-square-add {
    background-color: #444;
    color: #fff;
    border: 1px solid #666;
  }

  .devices-square-add:hover {
    background-color: #555;
  }
}
.help-card {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease;
  margin-top: 20px;
}
.help-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
/* Светлая тема (по умолчанию) */
.instruction-container {
  margin-top: 24px;
  background: #f7f7f9;
  border: 1px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  transition: 0.3s ease;
}

.instruction-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 16px;
  font-weight: bold;
  background: #e8e8f0;
  color: #222;
}

.arrow {
  transition: transform 0.3s ease;
}

.arrow.rotate {
  transform: rotate(90deg);
}

.instruction-container {
  margin-top: 24px;
  background: #f7f7f9;
  border: 1px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  transition: 0.3s ease;
}

.instruction-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 16px;
  font-weight: bold;
  background: #e8e8f0;
  color: #222;
}

.arrow {
  font-size: 16px;
  display: inline-block;
  transition: transform 0.3s ease;
}

.arrow.rotate {
  transform: rotate(180deg);
}

.instruction-content {
  display: none;
  padding: 16px;
  background: #fff;
  color: #222;
}

.instruction-content ol {
  margin: 0;
  padding-left: 18px;
}

/* Тёмная тема */
@media (prefers-color-scheme: dark) {
  .instruction-container {
    background: #1f1f23;
    border: 1px solid #333;
  }

  .instruction-header {
    background: #2a2a30;
    color: #f0f0f0;
  }

  .instruction-content {
    background: #121214;
    color: #ddd;
  }

  .instruction-content ol {
    color: #ddd;
  }
}
.instruction-text {
  font-size: 16px;
  font-weight: bold; /* жирный текст */
  line-height: 1.6;
  margin-top: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.instruction-text p {
  margin-top: 12px;
}

.instruction-text a {
  color: #007aff;
  text-decoration: underline;
  font-weight: bold;
}

.instruction-text .warning {
  color: #cc0000;
  font-weight: bold;
}
.store-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.store-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: bold;
  font-size: 15px;
  transition: background 0.3s ease;
}

.store-btn img {
  width: 20px;
  height: 20px;
}

.store-btn.apple {
  background-color: #3b3f44;
}

.store-btn.google {
  background-color: #34a853;
}

.store-btn:hover {
  opacity: 0.85;
}

/* Кнопка "Назад" */
.back-button {
  display: inline-block;            /* ширина по содержимому */
  background-color: #1c1c36;
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 15px;
  transition: background-color 0.3s ease;
  margin-bottom: 20px;
  max-width: fit-content;          /* гарантирует, что не будет растягиваться */
  white-space: nowrap;             /* не переносить текст на другую строку */
}

/* Ховер для кнопки "Назад" */
.back-button:hover {
  background-color: rgb(26, 26, 49);
}

/* Для темной темы */
@media (prefers-color-scheme: dark) {
  .back-button {
    background-color: #1c1c36;
    color: #fff;
  }

  .back-button:hover {
    background-color: rgb(26, 26, 49);
  }
}

/* Для светлой темы */
@media (prefers-color-scheme: light) {
  .back-button {
    background-color: #f7f7f9;  /* Светлый фон для светлой темы */
    color: #333;  /* Темный текст для контраста */
  }

  .back-button:hover {
    background-color: #e0e0e0;  /* Светлый фон при наведении */
  }
}

/* Модальное окно */
/* Общие стили для модального окна */
.modal-overlay {
  display: none;
  position: fixed; /* Позиционируем относительно всего экрана */
  top: 50%; /* Центрируем по вертикали */
  left: 50%; /* Центрируем по горизонтали */
  transform: translate(-50%, -50%); /* Точное центрирование окна */
  width: 100%; /* Окно будет растягиваться на всю ширину экрана */
  height: 100%; /* Окно будет растягиваться на всю высоту экрана */
  display: flex; /* Для использования flexbox */
  justify-content: center; /* Центрируем по горизонтали */
  align-items: center; /* Центрируем по вертикали */
  z-index: 9999; /* Чтобы окно было поверх всех других элементов */
}

/* Само окно */
.modal-window {
  padding: 20px 25px;
  border-radius: 12px;
  text-align: center;
  max-width: 350px;
  width: 90%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Текст внутри окна */
.modal-text {
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 1.4;
}

/* Кнопки */
.modal-actions button {
  margin: 0 10px;
  padding: 10px 20px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease;
}

/* Стили для темной темы */
@media (prefers-color-scheme: dark) {
  /* Окно с темным фоном */
  .modal-window {
    background: #1e1e1e;
    color: white;
  }

  /* Кнопка "Заменить" */
  .modal-confirm {
    background: #007bff;
    color: white;
  }

  /* Ховер для кнопки "Заменить" */
  .modal-confirm:hover {
    background: #0056b3;
  }

  /* Кнопка "Отменить" */
  .modal-cancel {
    background: #444;
    color: white;
  }

  /* Ховер для кнопки "Отменить" */
  .modal-cancel:hover {
    background: #666;
  }

  /* Полупрозрачный темный фон */
  .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
  }
}

/* Стили для светлой темы */
@media (prefers-color-scheme: light) {
  /* Окно с светлым фоном */
  .modal-window {
    background: #f5f5f5;
    color: black;
  }

  /* Кнопка "Заменить" */
  .modal-confirm {
    background: #007bff;
    color: white;
  }

  /* Ховер для кнопки "Заменить" */
  .modal-confirm:hover {
    background: #0056b3;
  }

  /* Кнопка "Отменить" */
  .modal-cancel {
    background: #ddd;
    color: black;
  }

  /* Ховер для кнопки "Отменить" */
  .modal-cancel:hover {
    background: #bbb;
  }

  /* Полупрозрачный светлый фон */
  .modal-overlay {
    background: rgba(0, 0, 0, 0.2);
  }
}

/* Опции выбора */
.option-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

/* Каждая опция */
.option {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  cursor: pointer;
  transition: background-color 0.3s ease; /* Плавный переход для фона */
  padding: 5px 10px;
  border-radius: 8px;
}

.option:hover {
  background-color: #3a3f47; /* Цвет фона при наведении */
}

.option input {
  display: none;
}

.circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease; /* Плавный переход для фона */
}

/* Увеличиваем иконку при выборе */
.option input:checked + .circle i {
  transform: scale(1.2);
}

/* Цвет фона круга при выборе */
.option input:checked + .circle {
  background-color: #007bff; /* Синий цвет при выборе */
}

.circle i {
  color: white;
  font-size: 24px; /* Размер иконки */
  transition: transform 0.3s ease;
}

.option span {
  font-size: 16px;
  font-weight: bold;
}

/* Кнопка "Далее" */
.next-btn {
  margin-top: 30px;
  padding: 12px 20px;
  font-size: 16px;
  color: white;
  background-color: #808080;
  border: none;
  border-radius: 8px;
  cursor: not-allowed;
  opacity: 0.6;
  width: 100%;
}

.next-btn.active {
  background-color: #007bff;
  cursor: pointer;
  opacity: 1;
}

/* Стили для светлой темы */
@media (prefers-color-scheme: light) {
  .option {
    background-color: #fff;
  }

  .option:hover {
    background-color: #f1f1f1;
  }

  .circle {
    background-color: #ddd;
  }

  .option input:checked + .circle {
    background-color: #007bff; /* Синий цвет при выборе */
  }

  .option span {
    color: #333;
  }

  .next-btn {
    background-color: #808080;
  }

  .next-btn.active {
    background-color: #007bff;
  }
}

/* Стили для темной темы */
@media (prefers-color-scheme: dark) {
  .option {
    background-color: #3a3f47;
  }

  .option:hover {
    background-color: #4b525d;
  }

  .circle {
    background-color: #555;
  }

  .option input:checked + .circle {
    background-color: #007bff; /* Синий цвет при выборе */
  }

  .option span {
    color: white;
  }

  .next-btn {
    background-color: #808080;
  }

  .next-btn.active {
    background-color: #007bff;
  }
  .clipped-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
  font-family: monospace;
  font-size: 14px;
  border-radius: 10px;
  padding: 12px;
  background-color: #3f3f8f;
  color: #fff;
  cursor: pointer;
  text-align: left;
  border: none;
  }


}
