* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #eef6ff;
  background: #050816;
  --blue: #5b8cff;
  --cyan: #39d9ef;
  --muted: #aabbd2;
  --glass: rgba(12, 23, 50, .62);
  --glass-soft: rgba(255, 255, 255, .08);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 10%, rgba(62, 116, 255, .28), transparent 28%),
    radial-gradient(circle at 82% 88%, rgba(0, 216, 255, .2), transparent 30%),
    linear-gradient(145deg, #030512 0%, #08132e 48%, #02040e 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -35%;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.95) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(111,205,255,.8) 0 1px, transparent 1.7px),
    radial-gradient(circle, rgba(255,255,255,.7) 0 1.5px, transparent 2.2px);
  background-size: 170px 170px, 270px 270px, 390px 390px;
  background-position: 20px 40px, 100px 20px, 50px 120px;
  opacity: .45;
  transform: rotate(12deg) scale(1.15);
  animation: starfield 24s linear infinite;
}
body::after {
  opacity: .2;
  filter: blur(1px);
  transform: rotate(12deg) scale(1.15) translateX(-80px);
  animation-duration: 42s;
}
@keyframes starfield {
  from { background-position: 20px 40px, 100px 20px, 50px 120px; }
  to { background-position: 20px 700px, 100px 980px, 50px 1260px; }
}

button, input { font: inherit; }

.shell {
  width: min(1040px, 100%);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(185, 224, 255, .24);
  border-radius: 26px;
  background: var(--glass);
  box-shadow: 0 28px 100px rgba(0, 0, 0, .48), 0 0 70px rgba(44, 139, 255, .16);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 20px 30px;
  color: white;
  background: linear-gradient(105deg, rgba(38, 86, 198, .72), rgba(10, 133, 190, .62) 52%, rgba(14, 190, 204, .58));
  border-bottom: 1px solid rgba(255,255,255,.16);
}

.brand-mark {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }

.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 20px; }
.brand-copy span { font-size: 12px; opacity: .9; }
.version {
  margin-left: auto;
  padding: 6px 11px;
  border-radius: 20px;
  background: rgba(255,255,255,.18);
  font-size: 11px;
  font-weight: 700;
}

.content { width: min(760px, calc(100% - 64px)); margin: 46px auto 24px; }
h1 {
  margin: 0 0 10px;
  text-align: center;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.15;
  letter-spacing: -.04em;
  font-weight: 850;
}
.intro {
  max-width: 650px;
  margin: 0 auto 26px;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
  line-height: 1.65;
}
h1 span {
  color: #65dcff;
  background: linear-gradient(90deg, #72a3ff, #46e5f2);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.form-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border: 1px solid rgba(183, 222, 255, .2);
  border-radius: 24px;
  background: rgba(255, 255, 255, .075);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .2), 0 0 28px rgba(52, 160, 246, .12);
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
}
.form-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.form-card h2 { margin: 0; font-size: 21px; font-weight: 650; }
.form-card h2 span { color: #8290a3; font-weight: 450; }
.description { margin: 10px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.iid-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
.iid-field { display: grid; gap: 5px; text-align: center; }
.iid-field label { font-size: 14px; font-weight: 600; }
.iid-field input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 6px 12px;
  border: 1px solid rgba(188, 222, 255, .2);
  border-radius: 12px;
  outline: none;
  background: rgba(3, 12, 30, .38);
  color: #eef6ff;
  text-align: center;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 2px rgba(25, 45, 75, .025);
}
.iid-field input:focus { border-color: var(--cyan); outline: 3px solid rgba(57,217,239,.16); background: rgba(12, 33, 66, .65); }

.submit {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;
  width: 100%;
  min-height: 54px;
  margin-top: 28px;
  padding: 14px 22px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(100deg, var(--blue), #168fe9 58%, var(--cyan));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(52, 120, 246, .2);
}
.submit::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.3) 48%, transparent 72%);
  transform: translateX(-120%);
  transition: transform 650ms ease;
}
.submit:disabled { opacity: .6; cursor: wait; }
.submit:not(:disabled):hover { filter: brightness(1.04); box-shadow: 0 10px 24px rgba(52, 120, 246, .3); }
.submit:not(:disabled):hover::before { transform: translateX(120%); }

.status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  margin: 0;
  color: #f2f8ff;
  font-size: 14px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .35);
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #20c875; }
.status[data-state="busy"] .status-dot { background: #f3a712; }
.status[data-state="error"] .status-dot { background: #e5484d; }

.stage { display: grid; }
.stage > form, .stage > .result { grid-area: 1 / 1; }
.stage > form { transition: opacity 220ms ease, transform 220ms ease; }
.stage.show-result > form { visibility: hidden; pointer-events: none; opacity: 0; transform: translateY(-8px) scale(.99); }
.result {
  align-self: stretch;
  min-height: 100%;
  padding: 30px;
  border: 1px solid rgba(183, 238, 220, .28);
  border-radius: 24px;
  background: rgba(10, 54, 57, .52);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .25), 0 0 34px rgba(32, 197, 117, .13);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(14px) scale(.985);
  transition: opacity 360ms ease, transform 360ms cubic-bezier(.2,.75,.25,1);
}
.result:not([hidden]) { display: block; }
.stage.show-result .result { opacity: 1; transform: translateY(0) scale(1); }
.result-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.result-heading h2 { margin: 0; font-size: 20px; }
.result-heading p { margin: 5px 0 0; color: #7b8490; font-size: 14px; }
.success-badge { padding: 6px 10px; border-radius: 20px; background: #e6f8ee; color: #16854b; font-size: 12px; font-weight: 700; }
.cid-value { display: block; margin: 18px 0; padding: 14px; border-radius: 10px; background: rgba(2, 24, 35, .42); color: #edffff; font-family: ui-monospace, Consolas, monospace; font-size: 17px; line-height: 1.7; overflow-wrap: anywhere; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.copy, .again { min-height: 42px; padding: 10px 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; font-weight: 650; cursor: pointer; }
.copy { background: rgba(105, 224, 255, .16); color: #a9edff; }
.again { background: rgba(255,255,255,.09); color: #d8e7f5; }

[hidden] { display: none !important; }

@media (max-width: 600px) {
  body { padding: 0; }
  .shell { min-height: 100vh; border-radius: 0; }
  .topbar { min-height: 76px; padding: 16px 20px; }
  .content { width: calc(100% - 32px); margin: 32px auto 20px; }
  h1 { margin-bottom: 9px; }
  .intro { margin-bottom: 22px; font-size: 13px; }
  .form-card { padding: 22px 18px; border-radius: 20px; }
  .form-card h2 { font-size: 17px; }
  .description { font-size: 13px; }
  .iid-grid { gap: 14px 9px; }
  .iid-field input { height: 44px; }
  .submit { width: 100%; margin-top: 24px; }
}

*, *::before, *::after {
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
