:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-press: #0062c4;
  --field-bg: rgba(255, 255, 255, 0.9);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  --green: #1aa251;
  --red: #e5484d;
  --radius: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: rgba(28, 28, 30, 0.72);
    --surface-solid: #1c1c1e;
    --text: #f5f5f7;
    --text-dim: #98989d;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #2997ff;
    --accent-press: #0a84ff;
    --field-bg: rgba(44, 44, 46, 0.82);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
    --green: #30d158;
    --red: #ff453a;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

/* Ambient background */
.bg-orbs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; }
.orb-a { width: 460px; height: 460px; background: #5e9dff; top: -140px; left: -120px; }
.orb-b { width: 420px; height: 420px; background: #c17bff; bottom: -160px; right: -120px; }
.orb-c { width: 360px; height: 360px; background: #5ad1c9; top: 40%; left: 55%; }
@media (prefers-color-scheme: dark) { .orb { opacity: 0.28; } }

.shell {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) 20px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Hero */
.hero { text-align: center; margin-bottom: 28px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.badge svg { color: var(--accent); }
.hero h1 {
  font-size: clamp(40px, 9vw, 60px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 18px 0 10px;
  background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 62%, var(--text-dim)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  font-size: clamp(16px, 2.6vw, 19px);
  color: var(--text-dim);
  max-width: 440px;
  margin: 0 auto;
}

/* Card */
.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 34px);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
}

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .suffix {
  position: absolute;
  right: 16px;
  color: var(--text-dim);
  font-size: 15px;
  pointer-events: none;
}

input, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
  resize: vertical;
}
input { padding-right: 52px; }
textarea { min-height: 170px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: .8; }
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.meta-row { display: flex; justify-content: space-between; margin-top: 8px; }
.counter, .hint { font-size: 12.5px; color: var(--text-dim); }

/* Buttons */
.btn-primary {
  position: relative;
  width: 100%;
  border: none;
  border-radius: 980px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 15px 20px;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-primary:hover { background: var(--accent-press); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: .7; cursor: default; }
.btn-primary .btn-spinner { display: none; vertical-align: -5px; margin-left: 8px; animation: spin .8s linear infinite; }
.btn-primary.loading .btn-label { opacity: .85; }
.btn-primary.loading .btn-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 980px;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.btn-ghost:active { transform: scale(0.98); }

/* Toast */
.toast {
  margin-top: 14px;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
  color: var(--red);
  opacity: 0;
  transition: opacity .2s ease;
}
.toast.show { opacity: 1; }

/* Success card */
.card.success { text-align: center; margin-top: 18px; animation: pop .35s cubic-bezier(.2,.9,.3,1.2); }
.success-icon {
  width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto 12px;
  color: #fff; background: var(--green);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--green) 45%, transparent);
}
.card.success h2 { margin: 6px 0; font-size: 24px; letter-spacing: -0.02em; }
.success-name { font-weight: 600; font-size: 16px; margin: 4px 0; }
.success-expiry { color: var(--text-dim); font-size: 14px; margin: 0 0 18px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Footer */
.foot {
  margin-top: 30px;
  display: flex; gap: 8px; align-items: center;
  color: var(--text-dim); font-size: 13px;
}
.foot .dot { opacity: .6; }

.hidden { display: none !important; }
