/* Подстройка под тему Telegram (светлая/тёмная) */
:root {
  --tg-theme-bg-color: #ffffff;
  --tg-theme-text-color: #000000;
  --tg-theme-hint-color: #999999;
  --tg-theme-link-color: #2481cc;
  --tg-theme-button-color: #2481cc;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #f4f4f5;
  --page-padding: 12px;
  --card-radius: 12px;
  --btn-radius: 8px;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--tg-theme-bg-color);
  color: var(--tg-theme-text-color);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 100%;
  min-height: 100vh;
  padding: var(--page-padding);
  padding-bottom: calc(var(--page-padding) + env(safe-area-inset-bottom, 0px));
}

#loading {
  text-align: center;
  padding: 2rem;
  color: var(--tg-theme-hint-color);
}

.screen {
  display: none;
  animation: fadeIn 0.2s ease;
}
.screen.visible {
  display: block;
}
.screen.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 8px;
  gap: 8px;
}
.header .balance {
  font-weight: 600;
  font-size: 1.1rem;
}
.header .back {
  background: none;
  border: none;
  color: var(--tg-theme-link-color);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 0;
}
.header span:last-child {
  flex: 1;
  text-align: center;
  font-weight: 600;
}

.card {
  background: var(--tg-theme-secondary-bg-color);
  border-radius: var(--card-radius);
  padding: 16px;
  margin-bottom: 12px;
}
.subscribe-card {
  text-align: center;
  padding: 24px;
}
.subscribe-card h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}
.subscribe-card p {
  margin: 0 0 20px;
  color: var(--tg-theme-hint-color);
  font-size: 0.95rem;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.menu-item {
  display: block;
  padding: 14px 16px;
  background: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-text-color);
  text-decoration: none;
  border-radius: var(--btn-radius);
  font-size: 1rem;
  transition: opacity 0.15s;
}
.menu-item:active {
  opacity: 0.8;
}
.menu-item.link {
  text-align: center;
  color: var(--tg-theme-link-color);
}
.menu-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.menu-item.half {
  text-align: center;
  padding: 12px 8px;
  font-size: 0.9rem;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--btn-radius);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 8px;
  transition: opacity 0.15s;
  box-sizing: border-box;
}
.btn:active {
  opacity: 0.9;
}
.btn-primary {
  background: var(--tg-theme-button-color);
  color: var(--tg-theme-button-text-color);
}
.btn-secondary {
  background: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-text-color);
  border: 1px solid var(--tg-theme-hint-color);
}
.amounts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.amount-btn {
  margin-bottom: 0;
}
.bonuses {
  font-size: 0.9rem;
  color: var(--tg-theme-hint-color);
  margin: 8px 0;
}
.message {
  margin-top: 12px;
  font-size: 0.9rem;
}
.message.hidden {
  display: none;
}
.message.error {
  color: #e53935;
}
.message.success {
  color: #43a047;
}

.prices-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.prices-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  display: flex;
  justify-content: space-between;
}
.prices-list li:last-child {
  border-bottom: none;
}

.service-form {
  margin-bottom: 16px;
}
.service-form.hidden {
  display: none;
}
.service-form-extra {
  margin-bottom: 12px;
}
.service-form-extra.hidden {
  display: none;
}
.service-label {
  display: block;
  font-size: 0.9rem;
  color: var(--tg-theme-hint-color);
  margin-bottom: 4px;
}
.service-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--tg-theme-hint-color);
  border-radius: var(--btn-radius);
  font-size: 1rem;
  margin-bottom: 12px;
  background: var(--tg-theme-bg-color);
  color: var(--tg-theme-text-color);
}
.service-result {
  margin-top: 16px;
  padding: 12px 0;
  font-size: 0.95rem;
}
.service-result.hidden {
  display: none;
}
.service-result .result-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.service-result .result-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}
.service-info {
  margin-bottom: 16px;
  color: var(--tg-theme-hint-color);
}
