:root {
  --ink: #f7f8ff;
  --muted: #9da6c4;
  --subtle: #69728f;
  --surface: rgba(16, 23, 48, 0.78);
  --surface-strong: rgba(21, 30, 61, 0.96);
  --line: rgba(255, 255, 255, 0.11);
  --line-soft: rgba(255, 255, 255, 0.07);
  --blue: #7082ff;
  --aqua: #2bd8c1;
  --coral: #ff7a90;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #050816; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(112, 130, 255, 0.20), transparent 31rem),
    radial-gradient(circle at 88% 86%, rgba(255, 122, 144, 0.12), transparent 30rem),
    linear-gradient(135deg, #050816 0%, #080d21 48%, #0c1025 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.30;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black, transparent 84%);
}
body::after {
  content: "";
  position: fixed;
  width: 26rem;
  height: 26rem;
  right: -12rem;
  top: 18%;
  border-radius: 50%;
  background: rgba(43, 216, 193, 0.11);
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 1060px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 13px;
  background: linear-gradient(140deg, var(--blue), var(--aqua));
  color: #061021;
  box-shadow: 0 10px 28px rgba(112, 130, 255, 0.28);
  font-size: 13px;
  letter-spacing: -0.08em;
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 13px; }
.brand-copy span { color: var(--subtle); font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,0.035);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease), background 180ms var(--ease);
}
.back-link:hover { transform: translateX(-2px); border-color: rgba(112,130,255,0.48); color: var(--ink); background: rgba(112,130,255,0.09); }

.page-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  align-items: center;
  gap: clamp(34px, 7vw, 92px);
  padding: 42px 0 64px;
}
.hero { max-width: 530px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 17px;
  color: var(--aqua);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--aqua); box-shadow: 0 0 14px var(--aqua); }
h1 { max-width: 620px; margin: 0; color: var(--ink); font-size: clamp(2rem, 4.6vw, 3.65rem); line-height: 1.02; letter-spacing: -0.065em; }
.lede { max-width: 520px; margin: 18px 0 0; color: var(--muted); font-size: clamp(13px, 1.7vw, 16px); line-height: 1.58; }
.hero-note { display: flex; gap: 10px; align-items: flex-start; max-width: 470px; margin-top: 28px; color: var(--subtle); font-size: 12px; line-height: 1.55; }
.hero-note svg { flex: 0 0 auto; color: var(--coral); margin-top: 2px; }

.panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(21, 30, 61, 0.91), rgba(10, 16, 37, 0.82));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(26px);
}
.action-panel { max-width: 470px; padding: 26px; justify-self: end; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.panel-kicker { color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.panel-title { margin: 7px 0 0; font-size: 18px; letter-spacing: -0.04em; }
.step-badge { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(43,216,193,0.34); border-radius: 12px; color: var(--aqua); background: rgba(43,216,193,0.09); font-size: 12px; font-weight: 800; }
.rule { height: 1px; background: linear-gradient(90deg, rgba(255,255,255,0.02), var(--line), rgba(255,255,255,0.02)); margin: 0 0 23px; }
.field-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
.text-input {
  width: 100%;
  height: 54px;
  padding: 0 15px 0 45px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
  color: var(--ink);
  background: rgba(4, 8, 22, 0.52);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}
.text-input::placeholder { color: #56617e; }
.text-input:focus { border-color: rgba(112,130,255,0.78); background: rgba(8, 13, 34, 0.9); box-shadow: 0 0 0 4px rgba(112,130,255,0.12); }
.form-hint { margin: 9px 0 18px; color: var(--subtle); font-size: 11px; line-height: 1.45; }
.primary-btn, .secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 51px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), border-color 160ms var(--ease), background 160ms var(--ease), opacity 160ms var(--ease);
}
.primary-btn { border: 1px solid rgba(255,255,255,0.18); color: #061021; background: linear-gradient(110deg, var(--aqua), #8ce7ff 54%, var(--blue)); box-shadow: 0 14px 28px rgba(43,216,193,0.17); }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 34px rgba(43,216,193,0.25); }
.primary-btn:active, .secondary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { cursor: wait; opacity: 0.62; transform: none; }
.secondary-btn { border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,0.04); }
.secondary-btn:hover { border-color: rgba(112,130,255,0.48); color: var(--ink); background: rgba(112,130,255,0.09); }
.status { min-height: 64px; display: grid; place-items: center; margin-top: 18px; text-align: center; }
.status-loading { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.14); border-top-color: var(--aqua); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-error { color: var(--coral); font-size: 12px; font-weight: 700; line-height: 1.45; }
.code-wrap { display: grid; gap: 8px; width: 100%; padding: 15px; border: 1px solid rgba(43,216,193,0.28); border-radius: 16px; background: linear-gradient(135deg, rgba(43,216,193,0.08), rgba(112,130,255,0.10)); }
.code-label { color: #9deee3; font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.code-display { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 62px; padding: 12px 14px; overflow-wrap: anywhere; border: 1px solid rgba(255,255,255,0.16); border-radius: 12px; color: var(--ink); background: rgba(4,8,22,0.68); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: clamp(1.65rem, 5vw, 2.2rem); font-weight: 900; letter-spacing: 0.14em; line-height: 1.1; text-align: center; cursor: copy; user-select: all; text-shadow: 0 0 24px rgba(112,130,255,0.44); transition: border-color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease); }
.code-value { overflow-wrap: anywhere; }
.copy-action { display: inline-flex; align-items: center; flex: 0 0 auto; min-height: 25px; padding: 0 8px; border: 1px solid rgba(77,227,204,.32); border-radius: 999px; color: #9deee3; font-family: Inter, sans-serif; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.code-display:hover, .code-display:focus-visible { border-color: rgba(43,216,193,0.68); background: rgba(8,13,34,0.94); outline: none; }
.code-display:active { transform: scale(0.985); }
.copy-hint { color: var(--subtle); font-size: 11px; text-align: center; }
.instructions { display: none; margin-top: 18px; padding: 18px; border: 1px solid rgba(112,130,255,0.22); border-radius: 18px; background: rgba(112,130,255,0.06); text-align: left; animation: rise 300ms var(--ease); }
.instructions.visible { display: block; }
.instructions h2 { margin: 0 0 12px; color: var(--muted); font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; }
.instructions ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.instructions b { color: var(--ink); }
.success-note { display: none; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 13px; border: 1px solid rgba(43,216,193,0.22); border-radius: 15px; color: #a8eadf; background: rgba(43,216,193,0.07); font-size: 11px; line-height: 1.55; text-align: left; }
.success-note.visible { display: flex; animation: rise 300ms var(--ease); }

.qr-panel { max-width: 470px; padding: 26px; justify-self: end; }
.qr-stage { display: grid; place-items: center; min-height: 312px; padding: 22px; border: 1px solid var(--line-soft); border-radius: 22px; background: rgba(2, 6, 18, 0.52); }
.qr-frame { position: relative; display: inline-flex; padding: 13px; border-radius: 20px; background: #fff; box-shadow: 0 20px 48px rgba(0,0,0,0.4); }
.qr-frame::before, .qr-frame::after { content: ""; position: absolute; width: 25px; height: 25px; border: 3px solid var(--aqua); }
.qr-frame::before { left: -3px; top: -3px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.qr-frame::after { right: -3px; bottom: -3px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.qr-frame img { display: block; width: min(100%, 230px); aspect-ratio: 1; border-radius: 7px; }
.qr-loading { display: grid; place-items: center; gap: 13px; color: var(--muted); font-size: 12px; }
.qr-loading .spinner { width: 28px; height: 28px; border-width: 3px; }
.qr-error { display: grid; place-items: center; gap: 12px; color: var(--coral); font-size: 12px; text-align: center; }
.qr-error svg { color: var(--coral); }
.qr-timer { width: min(100%, 260px); height: 4px; margin: 17px auto 0; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.09); }
.qr-timer-fill { width: 100%; height: 100%; transform-origin: left; border-radius: inherit; background: linear-gradient(90deg, var(--aqua), var(--blue)); animation: drain 55s linear forwards; }
@keyframes drain { to { transform: scaleX(0); } }
.qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.qr-actions .secondary-btn { width: auto; }
.helper-card { margin-top: 18px; padding: 15px 17px; border: 1px solid var(--line-soft); border-radius: 17px; background: rgba(255,255,255,0.025); text-align: left; }
.helper-title { margin-bottom: 9px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; }
.helper-card ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.helper-card b { color: var(--ink); }
.footer { padding: 18px 0 24px; color: #59627d; font-size: 11px; text-align: center; }
.footer span { color: #8592c2; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; } }
@media (max-width: 800px) {
  .page-grid { grid-template-columns: 1fr; gap: 34px; padding-top: 28px; }
  .hero, .action-panel, .qr-panel { max-width: 620px; justify-self: stretch; }
  h1 { max-width: 560px; }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 24px, 1060px); }
  .topbar { padding: 16px 0; }
  .page-grid { padding: 26px 0 46px; }
  .action-panel, .qr-panel { padding: 19px; border-radius: 22px; }
  .panel-head { margin-bottom: 19px; }
  .qr-stage { min-height: 270px; padding: 16px; }
  .qr-frame img { width: min(65vw, 210px); }
  .qr-actions { grid-template-columns: 1fr; }
  .qr-actions .secondary-btn { width: 100%; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .brand-copy strong { font-size: 12px; }
  .back-link { padding: 8px 11px; }
}
