:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071019;
  color: #f4f8fb;
  --accent: #45d6c7;
  --accent-strong: #16b8aa;
  --panel: rgba(14, 29, 42, 0.92);
  --muted: #91a4b5;
  --line: rgba(137, 188, 208, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -10%, rgba(50, 190, 177, 0.2), transparent 40%),
    linear-gradient(155deg, #071019 0%, #091722 52%, #061019 100%);
}

button { font: inherit; }

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.card {
  width: min(100%, 460px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(16, 34, 48, 0.98), rgba(9, 22, 33, 0.98));
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.36), inset 0 1px rgba(255, 255, 255, 0.04);
}

.brand-row { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; }
.mark {
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 15px; color: #061715; font-weight: 900; font-size: 24px;
  background: linear-gradient(145deg, #77f5e7, #20b7aa);
  box-shadow: 0 8px 30px rgba(34, 211, 193, 0.25);
}
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 10px; letter-spacing: .18em; font-weight: 800; }
h1 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.secure-pill { padding: 6px 9px; border: 1px solid rgba(69, 214, 199, .25); border-radius: 99px; color: #76e9dd; background: rgba(37, 180, 166, .08); font-size: 9px; font-weight: 800; letter-spacing: .09em; }

.state-panel { min-height: 340px; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); text-align: center; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.08); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.identity { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0 18px; }
.identity > div { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(4, 14, 22, .38); }
.identity span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.identity strong { display: block; overflow: hidden; color: #eef7fa; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.instruction { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.instruction p { margin: 0; color: #c6d3dc; font-size: 13px; line-height: 1.45; }
.step-badge { flex: none; padding: 6px 8px; border-radius: 8px; background: rgba(69, 214, 199, .12); color: #71e4d8; font-size: 9px; font-weight: 800; letter-spacing: .08em; }

.captcha-frame { position: relative; overflow: hidden; min-height: 112px; display: grid; place-items: center; border: 1px solid rgba(134, 194, 214, .2); border-radius: 18px; background: #e9f0f4; }
.captcha-frame img { display: block; width: 100%; max-height: 150px; object-fit: contain; }
.scan-line { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 0 47%, rgba(69, 214, 199, .15) 50%, transparent 53%); background-size: 100% 80px; pointer-events: none; animation: scan 3.4s linear infinite; }
@keyframes scan { from { background-position-y: -80px; } to { background-position-y: 160px; } }

.progress { display: flex; justify-content: center; gap: 8px; min-height: 22px; margin: 14px 0 12px; }
.progress-dot { width: 34px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.09); transition: .2s ease; }
.progress-dot.active { background: var(--accent); box-shadow: 0 0 14px rgba(69,214,199,.42); }

.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.code-button { min-height: 48px; border: 1px solid rgba(147, 188, 205, .16); border-radius: 14px; color: #eef8fa; background: rgba(22, 43, 58, .86); font-family: "SFMono-Regular", Consolas, monospace; font-size: 16px; font-weight: 800; letter-spacing: .08em; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.code-button:active { transform: scale(.96); border-color: var(--accent); background: rgba(31, 103, 101, .7); }
.code-button:disabled { opacity: .45; }
.attempts { min-height: 18px; margin: 12px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

.result { min-height: 350px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.result-icon { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 50%; color: #071714; background: linear-gradient(145deg, #7ef0e4, #24bbaa); font-size: 38px; font-weight: 900; box-shadow: 0 12px 46px rgba(36, 187, 170, .28); }
.result.error .result-icon { color: #260c0c; background: linear-gradient(145deg, #ff9d97, #ef5751); box-shadow: 0 12px 46px rgba(239, 87, 81, .22); }
.result h2 { margin: 0 0 8px; font-size: 23px; }
.result p { max-width: 310px; margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
#close-button { width: 100%; min-height: 50px; border: 0; border-radius: 15px; color: #061512; background: linear-gradient(135deg, #6ce9dc, #27beaf); font-weight: 850; }

footer { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; color: #6f8597; font-size: 10px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(69,214,199,.7); }
.hidden { display: none !important; }

@media (max-width: 380px) {
  .card { padding: 18px; border-radius: 22px; }
  .secure-pill { display: none; }
  .brand-row { grid-template-columns: 44px 1fr; }
  .mark { width: 44px; height: 44px; }
  .identity { grid-template-columns: 1fr; }
  .identity-user { display: none; }
  .code-button { min-height: 45px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
