:root {
  --bg: #0b1020;
  --card: rgba(255, 255, 255, 0.96);
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #5b5bf0;
  --primary-2: #8b5cf6;
  --danger: #e11d48;
  --ok: #059669;
  --ring: rgba(91, 91, 240, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #1e2a63 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 110%, #3b1d6e 0%, transparent 60%),
              var(--bg);
  overflow-x: hidden;
}

.blob { position: fixed; border-radius: 50%; filter: blur(80px); opacity: .45; pointer-events: none; z-index: 0; }
.b1 { width: 360px; height: 360px; background: #5b5bf0; top: -90px; left: -90px; }
.b2 { width: 420px; height: 420px; background: #c026d3; bottom: -140px; right: -120px; opacity: .3; }

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 800px;
  background: var(--card);
  border-radius: 24px;
  padding: 36px 34px 30px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, .5), 0 0 0 1px rgba(255, 255, 255, .6) inset;
  animation: rise .5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

header { text-align: center; margin-bottom: 26px; }
.logo {
  width: 58px; height: 58px; margin: 0 auto 14px;
  display: grid; place-items: center; color: #fff;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 24px rgba(91, 91, 240, .45);
}
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
header p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }

.section-title {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 4px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { min-width: 0; margin-top: 14px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #1e293b; }
label em { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--muted); margin-left: 4px; }

input[type="text"], input[type="tel"], input[type="email"] {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font: inherit; font-size: 15px; color: var(--text);
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: #a3aebf; }
input:hover { border-color: #cbd5e1; }
input:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
input.invalid, .select.invalid .select-trigger { border-color: var(--danger); background: #fff5f7; }
input.invalid:focus { box-shadow: 0 0 0 4px rgba(225, 29, 72, .15); }

/* phone prefix */
.input-wrap.prefix { position: relative; }
.prefix-tag {
  position: absolute; left: 1.5px; top: 1.5px; bottom: 1.5px;
  display: grid; place-items: center; padding: 0 13px;
  font-size: 14px; font-weight: 600; color: #475569;
  background: #eef2f7; border-radius: 10.5px 0 0 10.5px; border-right: 1.5px solid var(--border);
  pointer-events: none;
}
.input-wrap.prefix input { padding-left: 62px; }

.error { display: block; min-height: 0; margin-top: 5px; font-size: 12.5px; color: var(--danger); }
.error:empty { display: none; }

/* custom select */
.select { position: relative; }
.select-trigger {
  width: 100%; height: 46px; padding: 0 12px 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: inherit; font-size: 15px; color: var(--text); text-align: left;
  background: #f8fafc; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.select-trigger:hover { border-color: #cbd5e1; }
.select-trigger:focus-visible, .select.open .select-trigger {
  outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring);
}
.select-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger .placeholder { color: #a3aebf; }
.chev { flex: none; color: var(--muted); transition: transform .2s; }
.select.open .chev { transform: rotate(180deg); color: var(--primary); }

.select-menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 8px);
  min-width: 230px;
  margin: 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .06);
  transform-origin: top; animation: pop .15s ease both;
}
.select-menu[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

.select-menu li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; font-size: 14.5px; font-weight: 500;
  border-radius: 9px; cursor: pointer; color: #1e293b;
  transition: background .12s;
}
.opt-ico {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center;
  color: var(--primary); background: #eef0ff; border-radius: 8px;
}
.select-menu li.active { background: #f1f2ff; }
.select-menu li[aria-selected="true"] { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.select-menu li[aria-selected="true"] .opt-ico { background: rgba(255, 255, 255, .22); color: #fff; }
.select-menu li[aria-selected="true"]::after {
  content: ''; margin-left: auto; width: 14px; height: 14px; flex: none;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* submit */
.submit {
  position: relative; width: 100%; height: 52px; margin-top: 26px;
  font: inherit; font-size: 16px; font-weight: 600; color: #fff; cursor: pointer;
  border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 26px rgba(91, 91, 240, .42);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.submit:hover { transform: translateY(-1px); box-shadow: 0 16px 32px rgba(91, 91, 240, .5); filter: brightness(1.05); }
.submit:active { transform: translateY(0); }
.submit:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring), 0 12px 26px rgba(91, 91, 240, .42); }
.submit:disabled { cursor: wait; filter: saturate(.7); transform: none; }
.spinner {
  display: none; width: 20px; height: 20px; margin-left: 10px; vertical-align: -4px;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.submit:disabled .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* outcome */
#outcome { margin-top: 22px; animation: rise .35s ease both; }
#outcome[hidden] { display: none; }
.banner {
  padding: 13px 16px; border-radius: 12px; font-size: 14.5px; font-weight: 500;
  border: 1px solid; line-height: 1.45;
}
.banner.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.banner.fail { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }

#didBox {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(135deg, #ecfdf5, #f0fdfa); border: 1px solid #a7f3d0;
}
#didBox[hidden] { display: none; }
.did-label { width: 100%; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #047857; }
#didValue { font-size: 28px; letter-spacing: .01em; color: #064e3b; user-select: all; margin-right: auto; }
.copy {
  font: inherit; font-size: 13px; font-weight: 600; color: #047857; cursor: pointer;
  padding: 8px 16px; background: #fff; border: 1.5px solid #6ee7b7; border-radius: 10px;
  transition: background .15s;
}
.copy:hover { background: #d1fae5; }

details { margin-top: 12px; }
summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
pre {
  margin: 10px 0 0; padding: 14px; font-size: 12.5px; line-height: 1.5;
  background: #0f172a; color: #e2e8f0; border-radius: 12px;
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
}

@media (max-width: 480px) {
  .card { padding: 28px 20px 24px; border-radius: 20px; }
  .row { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* keep long content (certificate URLs, responses) inside the card */
#outcome, details, .banner, #didBox { min-width: 0; max-width: 100%; }
.card { min-width: 0; }
.banner { overflow-wrap: anywhere; word-break: break-word; }
#didValue { overflow-wrap: anywhere; }
pre { max-width: 100%; overflow-x: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
@media (max-width: 640px) { .card { padding: 28px 20px 24px; } }

/* narrow 300px card: stack the two-column rows */
.row { grid-template-columns: 1fr 1fr; gap: 14px; }
h1 { font-size: 26px; }
#didValue { font-size: 26px; }
