:root {
  --tg-bg-deep: #17212b;
  --tg-bg-card: #222e3c;
  --tg-accent: #2b5278;
  --tg-text: #ffffff;
  --tg-muted: #aaaaaa;
  --tg-accent-link: #539edb;
  --tg-border-light: rgba(255, 255, 255, 0.05);
  --tg-hover: #2b3d52;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  background: var(--tg-bg-deep);
  color: var(--tg-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.section {
  background-color: var(--tg-bg-card);
  overflow: hidden;
  margin: 16px 0;
}

h2 {
  font-size: 20px;
  font-weight: 700;
}

h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--tg-accent-link);
}

p {
  font-size: 14px;
  color: var(--tg-muted);
  line-height: 1.5;
}

.subtext {
  font-size: 14px;
  color: var(--tg-text);
  line-height: 1.5;
}

.username {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.placeholder {
  color: #888888;
}

.basic-margin {
  margin: 10px 16px;
  display: block;
}

.link {
  color: var(--tg-accent-link);
  text-decoration: underline;
  font-weight: 500;
  font-size: 14px;
  transition: color 0.2s ease;
}

.link:hover {
  color: var(--tg-accent);
  text-decoration: none;
}

.carousel {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.carousel-item {
  flex: 0 0 auto;
  width: 120px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.carousel-item .icon-box {
  height: 60px;
  background-color: var(--tg-bg-card);
  border: 2px solid var(--tg-border-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.carousel-item:hover .icon-box {
  background-color: var(--tg-hover);
}

.carousel-item h2 {
  margin: 0;
  font-size: 32px;
}

.carousel-item p {
  margin: 4px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  margin: 16px 0;
}

.card {
  background-color: var(--tg-bg-card);
  border: 2px solid var(--tg-border-light);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.card-link:hover .card {
  background-color: var(--tg-hover);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-content {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.horizontal-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  background-color: #17212b;
  color: white;
  padding: 12px 24px;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transform: translateX(100%);
  animation: slide-in 0.3s forwards, fade-out 0.5s 4.5s forwards;
  
  width: 400px;           /* Фиксированная ширина */
  max-width: 90vw;        /* Не шире 90% вьюпорта */
  word-break: break-word; /* Перенос длинных слов */
  box-sizing: border-box; /* Чтобы padding учитывался в ширине */
}

@keyframes slide-in {
  to {
    transform: translateX(0);
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
    height: 0;
    margin-bottom: 0;
    padding: 0 24px;
  }
}


.payment-buttons-container {
  display: flex;
  flex-wrap: wrap; /* перенос строк */
  gap: 8px;
  margin: 8px;
  max-height: 80px; /* увеличил, чтобы вместить 2 ряда */
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.payment-buttons-container button {
  position: relative;
  flex: 1 1 calc(50% - 8px); /* 2 кнопки в ряд с учётом gap */
  padding: 8px 12px;
  background-color: var(--tg-bg-card);
  border: 2px solid var(--tg-border-light);
  color: var(--tg-text);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  overflow: visible;
}

.payment-buttons-container button:hover {
  background-color: var(--tg-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: var(--tg-accent-link);
}

/* Бейдж скидки */
.payment-buttons-container button .discount-badge {
  position: absolute;
  top: 0px;
  right: -5px;
  background: var(--tg-accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  transform: rotate(15deg);
  border-radius: 2px;
  pointer-events: none;
  user-select: none;
}

.payment-buttons-container:not(.hidden) {
  opacity: 1;
}

.payment-buttons-container.hidden {
  max-height: 0 !important;
  opacity: 0 !important;
  overflow: hidden;
}
