* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg-1: #ffffff;
  --bg-2: #f0f4ff;
  --blob-1: #b5cbff;
  --blob-2: #ffb8d4;
  --blob-3: #d6c4ff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-border: rgba(255, 255, 255, 0.7);
  --text: #0a0a0c;
  --text-secondary: #5a5a66;
  --text-tertiary: #8a8a96;
  --fill: rgba(120, 120, 130, 0.09);
  --fill-strong: rgba(120, 120, 130, 0.14);
  --accent-from: #007aff;
  --accent-to: #5e5ce6;
  --success: #30d158;
  --danger: #ff3b30;
  --shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 30px 60px -20px rgba(50, 50, 93, 0.18), 0 18px 36px -18px rgba(0, 0, 0, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #07070b;
    --bg-2: #0d0d18;
    --blob-1: #1e3a8a;
    --blob-2: #6d28d9;
    --blob-3: #be185d;
    --surface: rgba(28, 28, 34, 0.62);
    --surface-border: rgba(255, 255, 255, 0.08);
    --text: #f5f5f7;
    --text-secondary: #a8a8b3;
    --text-tertiary: #6e6e7a;
    --fill: rgba(255, 255, 255, 0.06);
    --fill-strong: rgba(255, 255, 255, 0.1);
    --accent-from: #0a84ff;
    --accent-to: #7c5cff;
    --shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 30px 60px -20px rgba(0, 0, 0, 0.6), 0 18px 36px -18px rgba(0, 0, 0, 0.5);
  }
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  letter-spacing: -0.011em;
  overflow: hidden;
  position: relative;
}

/* Анимированные градиентные пятна на фоне */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}
.blob.b1 { width: 480px; height: 480px; background: var(--blob-1); top: -120px; left: -120px; animation: float1 18s ease-in-out infinite; }
.blob.b2 { width: 420px; height: 420px; background: var(--blob-2); bottom: -140px; right: -100px; animation: float2 22s ease-in-out infinite; }
.blob.b3 { width: 360px; height: 360px; background: var(--blob-3); top: 40%; right: 30%; animation: float3 26s ease-in-out infinite; }
@keyframes float1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(60px, 80px) scale(1.1); } }
@keyframes float2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-80px, -60px) scale(1.05); } }
@keyframes float3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px, -50px) scale(0.95); } }

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--surface-border);
  border-radius: 28px;
  padding: 32px 26px 26px;
  box-shadow: var(--shadow);
  animation: cardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}
.brand svg { width: 22px; height: 22px; color: var(--text); }
.logo {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 14px;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 22px;
  text-align: center;
  letter-spacing: -0.025em;
}

.field { margin-bottom: 10px; }
label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  padding-left: 4px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.005em;
}
input {
  width: 100%;
  padding: 15px 16px;
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  font-size: 17px;
  font-family: inherit;
  outline: none;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder { color: var(--text-tertiary); }
input:focus {
  background: var(--fill-strong);
  border-color: var(--accent-from);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

button {
  width: 100%;
  padding: 15px;
  margin-top: 18px;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 20px -8px rgba(0, 122, 255, 0.55), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
button:hover { filter: brightness(1.05); box-shadow: 0 12px 28px -10px rgba(0, 122, 255, 0.65), inset 0 1px 0 rgba(255,255,255,0.22); }
button:active { transform: scale(0.98); }

.hint {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--fill);
  border-radius: 12px;
}
.hint-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.hint-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
  transition: color 0.2s ease;
}
.hint-mark {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fill-strong);
  position: relative;
  transition: background 0.2s ease;
}
.hint-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  line-height: 14px;
  text-align: center;
}
.hint-rule.ok { color: var(--success); }
.hint-rule.ok .hint-mark { background: var(--success); }
.hint-rule.ok .hint-mark::after { content: "✓"; }
.hint-rule.bad { color: var(--danger); }
.hint-rule.bad .hint-mark { background: var(--danger); }
.hint-rule.bad .hint-mark::after { content: "×"; font-size: 12px; }

.error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 18px;
  letter-spacing: -0.01em;
}
.shake { animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.pin-inputs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}
.pin-inputs input {
  width: 58px;
  height: 68px;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  padding: 0;
  background: var(--fill);
}
.pin-inputs input:focus { transform: translateY(-2px); }

/* Виртуальная карта */
.credit-card {
  position: relative;
  margin: 6px 0 22px;
  padding: 22px 22px 20px;
  border-radius: 20px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,0.18), transparent 60%),
    linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
  box-shadow: 0 18px 40px -16px rgba(0, 122, 255, 0.55);
  overflow: hidden;
}
.credit-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 100% 100%, rgba(255,255,255,0.12), transparent 60%);
  pointer-events: none;
}
.cc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.cc-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
  font-weight: 600;
}
.cc-chip {
  width: 32px;
  height: 24px;
  border-radius: 5px;
  background: linear-gradient(135deg, #f6c97a, #c98e2b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -1px 0 rgba(0,0,0,0.2);
  position: relative;
}
.cc-chip::after {
  content: "";
  position: absolute;
  inset: 4px 6px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.18), transparent);
}
.cc-balance {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.cc-number {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
  opacity: 0.95;
}
.sms-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-top: 14px;
  background: rgba(255, 159, 10, 0.1);
  border: 1px solid rgba(255, 159, 10, 0.28);
  border-radius: 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: -0.005em;
}
.sms-notice .sms-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff9f0a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  margin-top: 1px;
}
.sms-notice b { font-weight: 600; }

/* Карта-форма (экран ввода) */
.card-form {
  position: relative;
  margin: 6px 0 18px;
  padding: 22px 22px 20px;
  border-radius: 20px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,0.18), transparent 60%),
    linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
  box-shadow: 0 18px 40px -16px rgba(0, 122, 255, 0.55);
  overflow: hidden;
  aspect-ratio: 1.586 / 1;
  display: flex;
  flex-direction: column;
}
.card-form::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 100% 100%, rgba(255,255,255,0.12), transparent 60%);
  pointer-events: none;
}
.card-form .cc-top { margin-bottom: auto; }
.cc-input-row {
  position: relative;
  z-index: 1;
}
.cc-input-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.75;
  font-weight: 600;
  margin-bottom: 4px;
}
.cc-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.cc-input::placeholder { color: rgba(255,255,255,0.5); }
.cc-input:focus { background: transparent; box-shadow: none; }
.cc-input.cc-num-input {
  font-size: clamp(15px, 5.2vw, 19px);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.cc-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}
.cc-row > div { flex: 1; }
.cc-row > div.cc-cvv-wrap { flex: 0 0 70px; }
.cc-input.cc-small {
  font-size: 16px;
  letter-spacing: 0.08em;
}

.credited-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 12px;
  background: rgba(48, 209, 88, 0.18);
  color: var(--success);
  border: 1px solid rgba(48, 209, 88, 0.35);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.credited-badge::before { content: "✓"; font-size: 11px; }

.timer-block {
  margin-top: 6px;
  padding: 18px 14px 16px;
  background: var(--fill);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
}
.timer-title {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.timer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.timer-cell {
  background: var(--bg-1);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 12px 4px 10px;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .timer-cell { background: rgba(255,255,255,0.04); }
}
.timer-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.timer-lbl {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}

.hidden { display: none; }

.screen { animation: screenIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
