* {
  box-sizing: border-box;
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #5c5c5c;
  color: #302e33;
  color-scheme: light;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
}

.phone {
  width: min(100%, 402px);
  min-height: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  background: #5c5c5c;
  display: flex;
  flex-direction: column;
}

.handle {
  width: 47px;
  height: 4px;
  margin: 10px auto 4px;
  border-radius: 4px;
  background: #ffffff;
  flex: none;
}

.sheet {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 18px 16px 49px;
  min-height: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 1px 2px 18px;
}

.top h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.35px;
  color: #302e33;
}

.close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #c2c1c3;
  display: grid;
  place-items: center;
  flex: none;
}

.card-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  background: #f4f4f5;
  border-radius: 22px;
  padding: 14px 16px 13px;
  min-height: 68px;
}

.card-label {
  font-size: 16px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.card-number-line {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.1px;
}

.copy {
  width: 24px;
  height: 24px;
  margin-left: 2px;
  display: block;
  flex: none;
  object-fit: contain;
}

.balance {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 1px;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.points {
  display: block;
  object-fit: contain;
}

.points-lg {
  width: 17px;
  height: 17px;
}

.points-sm {
  width: 13px;
  height: 13px;
}

.code-panel {
  margin-top: 10px;
  background: #f4f4f5;
  border-radius: 26px;
  padding: 12px 12px 14px;
}

.toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  height: 44px;
  padding: 3px;
  border-radius: 999px;
  background: #e4e4e4;
}

.tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #302e33;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.25px;
  cursor: pointer;
}

.tab.is-active {
  background: #ffffff;
}

.code-card {
  margin-top: 12px;
  background: #ffffff;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.code-card.is-qr {
  padding: 14px 14px 12px;
}

.code-card.is-qr img {
  width: 100%;
  height: auto;
  display: block;
}

.code-card.is-barcode {
  padding: 20px 10px;
  min-height: 112px;
}

.code-card.is-barcode img {
  width: 100%;
  height: 68px;
  object-fit: fill;
  display: block;
}

.hint {
  margin: 14px 8px 2px;
  text-align: center;
  color: #302e33;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 400;
  letter-spacing: -0.2px;
}

.timer {
  margin: 8px 8px 0;
  text-align: center;
  color: #8b8a90;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0;
}

.cashback {
  margin-top: 4px;
  min-height: 64px;
  padding: 10px 16px 10px 16px;
  border-radius: 24px;
  background: #f4f4f5;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 34px;
  height: 40px;
  object-fit: contain;
  flex: none;
}

.cash-text {
  flex: 1;
  min-width: 0;
}

.cash-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.cash-sub {
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.25px;
}

.get-btn {
  flex: none;
  width: 84px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  background: #f76100;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.35px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spacer {
  flex: 1 1 auto;
  min-height: 16px;
}

.footer-btn {
  align-self: center;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #111113;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.35px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- skeleton screen (пока карта грузится) --- */

/* скрытие через атрибут должно перекрывать любые display-правила */
[hidden] {
  display: none !important;
}

/* скелетон виден С ПЕРВОГО КАДРА (не зависит от JS): JS только убирает его */
.sk-code {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #e9e9eb;
}

.sk-code::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: sk-sweep 1.4s infinite;
}

.sk-code.is-barcode-mode {
  aspect-ratio: auto;
  height: 68px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #e9e9eb;
  border-radius: 8px;
  color: transparent !important;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: sk-sweep 1.4s infinite;
}

@keyframes sk-sweep {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after,
  .sk-code::after {
    animation: none;
  }
}

/* состояние загрузки: настоящие данные прозрачны, на их месте серые заглушки */
.is-loading #card-number,
.is-loading #balance,
.is-loading #cashback,
.is-loading #timer {
  display: inline-block;
  background: #e9e9eb;
  border-radius: 8px;
  color: transparent;
  overflow: hidden;
  position: relative;
}

.is-loading #card-number { width: 150px; height: 19px; }
.is-loading #balance { width: 64px; height: 22px; }
.is-loading #cashback { width: 56px; height: 16px; vertical-align: middle; }
.is-loading #timer { display: block; width: 150px; height: 12px; margin: 8px auto 0; border-radius: 6px; }

.is-loading .card-number-line .copy,
.is-loading .balance .points-lg,
.is-loading .cash-title .points-sm {
  visibility: hidden;
}
