:root {
  --bg: #0b1020;
  --text: #f7f8ff;
  --text-2: #b7c2e7;
  --muted: #7885b5;
  --brand-a: #4c5ae9;
  --brand-b: #a86efd;
  --success: #49d8b2;
  --danger: #ff6b8a;
  --shadow: 0 24px 70px rgba(3, 6, 18, 0.42);
  --brand-gradient: linear-gradient(135deg, #4c5ae9 0%, #6b6bf0 42%, #a86efd 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(76, 90, 233, 0.18) 0%, rgba(168, 110, 253, 0.18) 100%);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background-color: #090d19;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: Manrope, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(76, 90, 233, 0.18), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(168, 110, 253, 0.14), transparent 24%),
    linear-gradient(180deg, #090d19 0%, var(--bg) 22%, #0e1527 100%);
  overflow-x: hidden;
  padding: calc(14px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-noise,
.backdrop,
.backdrop-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-noise {
  z-index: 0;
  opacity: 0.06;
  background-image:
    linear-gradient(transparent 0, transparent calc(100% - 1px), rgba(255, 255, 255, 0.04) 100%),
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(255, 255, 255, 0.03) 100%);
  background-size: 4px 4px, 4px 4px;
}

.backdrop {
  z-index: 0;
  filter: blur(90px);
  opacity: 0.35;
}

.backdrop-a {
  top: -120px;
  left: -140px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: rgba(76, 90, 233, 0.75);
}

.backdrop-b {
  top: 140px;
  right: -120px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: rgba(168, 110, 253, 0.62);
}

.backdrop-grid {
  z-index: 0;
  background-image: radial-gradient(circle, rgba(168, 110, 253, 0.1) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent 96%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 32px - var(--safe-left) - var(--safe-right)));
  height: calc(100vh - 30px - var(--safe-top) - var(--safe-bottom));
  min-height: 620px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(125, 138, 197, 0.14);
  border-radius: 22px;
  background: rgba(10, 15, 29, 0.62);
  box-shadow: 0 12px 36px rgba(5, 8, 20, 0.32);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 76px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 28px;
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.brand-main {
  color: var(--text);
}

.brand-accent {
  color: var(--brand-b);
}

.brand-chip {
  padding: 5px 8px 4px;
  border-radius: 999px;
  color: #e0d2ff;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(168, 110, 253, 0.14);
  border: 1px solid rgba(168, 110, 253, 0.28);
}

.brand-sub {
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.hero {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(390px, 0.74fr);
  gap: 34px;
  align-items: center;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #d5c4ff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.eyebrow-line {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, rgba(76, 90, 233, 0), rgba(168, 110, 253, 0.9));
}

.hero-copy h1 {
  margin-top: 18px;
  max-width: 620px;
  font-size: clamp(44px, 6.6vw, 74px);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.hero-copy h1 span {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-text {
  margin-top: 20px;
  max-width: 590px;
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.65;
}

.hero-whisper {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 590px;
  margin-top: 20px;
  padding: 15px 16px;
  border-radius: 18px;
  background: rgba(19, 27, 50, 0.74);
  border: 1px solid rgba(123, 137, 197, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.hero-whisper svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  fill: none;
  stroke: rgba(168, 110, 253, 0.9);
  stroke-width: 2;
}

.hero-whisper p {
  color: #c7d0f0;
  font-size: 14px;
  line-height: 1.6;
}

.mfa-card {
  position: relative;
  padding: 26px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(25, 33, 62, 0.96) 0%, rgba(18, 24, 46, 0.98) 100%);
  border: 1px solid rgba(129, 144, 212, 0.18);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mfa-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(76, 90, 233, 0.16), transparent 44%, rgba(168, 110, 253, 0.12));
  pointer-events: none;
}

.mfa-card > * {
  position: relative;
  z-index: 1;
}

.mfa-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mfa-card h2 {
  margin-top: 8px;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.mfa-timer {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--text);
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 16px;
  font-weight: 800;
}

.mfa-timer svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.mfa-timer circle {
  fill: none;
  stroke-width: 4;
}

.mfa-timer circle:first-child {
  stroke: rgba(123, 137, 197, 0.16);
}

#timerRing {
  stroke: var(--brand-b);
  stroke-linecap: round;
  stroke-dasharray: 113;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.25s linear, stroke 0.2s ease;
}

#timerRing.is-ending {
  stroke: var(--danger);
}

.secret-form {
  margin-top: 22px;
}

.secret-form label {
  display: block;
  margin: 0 0 10px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.secret-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
}

.secret-field input {
  min-width: 0;
  min-height: 58px;
  padding: 0 17px;
  border-radius: 18px;
  border: 1px solid rgba(123, 137, 197, 0.18);
  outline: none;
  background: rgba(10, 14, 28, 0.74);
  color: var(--text);
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.secret-field input:focus {
  border-color: rgba(168, 110, 253, 0.46);
  box-shadow: 0 0 0 4px rgba(168, 110, 253, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.secret-field input::placeholder {
  color: rgba(120, 133, 181, 0.58);
}

.icon-button {
  border: 1px solid rgba(123, 137, 197, 0.18);
  border-radius: 18px;
  background: rgba(31, 41, 77, 0.72);
  color: var(--text-2);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(168, 110, 253, 0.34);
  color: #e6dcff;
  background: rgba(36, 48, 88, 0.92);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.form-error {
  min-height: 19px;
  margin: 8px 0 0 2px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.35;
}

.code-panel {
  margin-top: 12px;
}

.otp-button {
  width: 100%;
  min-height: 122px;
  border: 1px solid rgba(168, 110, 253, 0.22);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(76, 90, 233, 0.18), rgba(168, 110, 253, 0.12)),
    rgba(10, 14, 28, 0.72);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.otp-button span {
  display: block;
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-size: clamp(50px, 8vw, 76px);
  line-height: 1;
  letter-spacing: 0.12em;
  font-weight: 800;
  text-indent: 0.12em;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 122px;
  margin-top: 12px;
  padding: 22px;
  border: 1px solid rgba(123, 137, 197, 0.14);
  border-radius: 26px;
  background: rgba(16, 23, 44, 0.5);
  text-align: center;
}

.empty-state p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.mfa-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 14px;
}

.primary-action,
.secondary-action,
.otp-button {
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 800;
}

.primary-action {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 18px 40px rgba(110, 103, 240, 0.28);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  filter: saturate(0.7);
}

.primary-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.secondary-action {
  border: 1px solid rgba(123, 137, 197, 0.22);
  background: rgba(31, 41, 77, 0.72);
  color: var(--text-2);
}

.primary-action:not(:disabled):hover,
.secondary-action:hover,
.otp-button:hover {
  transform: translateY(-2px);
}

.secondary-action:hover {
  color: var(--text);
  border-color: rgba(168, 110, 253, 0.34);
  background: rgba(36, 48, 88, 0.9);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  z-index: 30;
  padding: 12px 16px;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  background: rgba(12, 18, 34, 0.94);
  color: var(--text);
  border: 1px solid rgba(168, 110, 253, 0.22);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: light) {
  :root {
    --text: #151b2f;
    --text-2: #536082;
    --muted: #8893b4;
    --brand-a: #5b68f0;
    --brand-b: #af7bff;
    --shadow: 0 24px 60px rgba(102, 116, 170, 0.16);
    --brand-gradient: linear-gradient(135deg, #5b68f0 0%, #7783f5 42%, #af7bff 100%);
    --brand-gradient-soft: linear-gradient(135deg, rgba(91, 104, 240, 0.14) 0%, rgba(175, 123, 255, 0.16) 100%);
  }

  html {
    background-color: #f7f8fc;
  }

  body {
    background:
      radial-gradient(circle at 10% 9%, rgba(91, 104, 240, 0.16), transparent 26%),
      radial-gradient(circle at 88% 14%, rgba(175, 123, 255, 0.14), transparent 24%),
      radial-gradient(circle at 48% 100%, rgba(146, 182, 255, 0.18), transparent 28%),
      linear-gradient(180deg, #fbfcff 0%, #f7f8fc 22%, #eef2f8 100%);
  }

  .page-noise {
    opacity: 0.08;
    background-image:
      linear-gradient(transparent 0, transparent calc(100% - 1px), rgba(70, 87, 140, 0.04) 100%),
      linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(70, 87, 140, 0.03) 100%);
  }

  .backdrop {
    opacity: 0.42;
    filter: blur(110px);
  }

  .backdrop-a {
    background: rgba(91, 104, 240, 0.34);
  }

  .backdrop-b {
    background: rgba(175, 123, 255, 0.26);
  }

  .backdrop-grid {
    background-image: radial-gradient(circle, rgba(112, 126, 178, 0.12) 1px, transparent 1px);
  }

  .topbar,
  .mfa-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.84) 0%, rgba(243, 246, 253, 0.78) 100%);
    border-color: rgba(123, 137, 197, 0.16);
    box-shadow: 0 18px 42px rgba(116, 131, 178, 0.12);
  }

  .mfa-card::before {
    background: linear-gradient(135deg, rgba(91, 104, 240, 0.1), transparent 44%, rgba(175, 123, 255, 0.1));
  }

  .brand-sub {
    color: #667295;
  }

  .section-kicker,
  .eyebrow {
    color: #8f79ca;
  }

  .hero-whisper,
  .secret-field input,
  .otp-button,
  .empty-state {
    background: rgba(255, 255, 255, 0.68);
    border-color: rgba(123, 137, 197, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  }

  .hero-whisper p {
    color: #5d6b8d;
  }

  .icon-button,
  .secondary-action {
    background: rgba(255, 255, 255, 0.68);
    border-color: rgba(123, 137, 197, 0.16);
    color: #536082;
  }

  .icon-button:hover,
  .secondary-action:hover {
    color: #4f3c85;
    background: rgba(255, 255, 255, 0.92);
  }

  .toast {
    background: rgba(255, 255, 255, 0.92);
    color: #202840;
    border-color: rgba(175, 123, 255, 0.14);
    box-shadow: 0 18px 36px rgba(119, 133, 177, 0.12);
  }
}

@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }

  .shell {
    height: auto;
    min-height: calc(100vh - 30px - var(--safe-top) - var(--safe-bottom));
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
  }

  .hero-copy h1 {
    max-width: 720px;
    font-size: clamp(36px, 9vw, 54px);
  }

  .hero-text,
  .hero-whisper {
    max-width: 720px;
  }
}

@media (min-width: 901px) and (max-height: 760px) {
  body {
    padding-top: calc(10px + var(--safe-top));
    padding-bottom: calc(10px + var(--safe-bottom));
  }

  .shell {
    min-height: 0;
    gap: 12px;
  }

  .topbar {
    padding: 10px 14px;
    border-radius: 18px;
  }

  .brand-mark {
    width: 64px;
    height: 44px;
  }

  .brand-title {
    font-size: 24px;
  }

  .brand-sub {
    font-size: 12px;
  }

  .hero {
    gap: 26px;
  }

  .hero-copy h1 {
    margin-top: 14px;
    font-size: clamp(38px, 5vw, 58px);
  }

  .hero-text {
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.5;
  }

  .hero-whisper {
    margin-top: 14px;
    padding: 12px 14px;
  }

  .mfa-card {
    padding: 22px;
  }

  .mfa-card h2 {
    font-size: 32px;
  }

  .secret-form {
    margin-top: 16px;
  }

  .secret-field input,
  .primary-action,
  .secondary-action {
    min-height: 50px;
  }

  .otp-button,
  .empty-state {
    min-height: 96px;
  }
}

@media (max-width: 560px) {
  body {
    padding-top: calc(12px + var(--safe-top));
  }

  .shell {
    width: min(calc(100vw - 24px - var(--safe-left) - var(--safe-right)), 1120px);
    gap: 12px;
  }

  .topbar {
    padding: 12px 14px;
    border-radius: 18px;
  }

  .brand-mark {
    width: 64px;
    height: 44px;
  }

  .brand-title {
    font-size: 22px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .hero-copy h1 {
    font-size: clamp(32px, 10vw, 42px);
  }

  .hero-text {
    font-size: 14px;
    line-height: 1.55;
  }

  .hero-whisper {
    margin-top: 14px;
    padding: 12px 13px;
  }

  .mfa-card {
    padding: 18px;
    border-radius: 24px;
  }

  .mfa-card h2 {
    font-size: 30px;
  }

  .mfa-timer {
    width: 54px;
    height: 54px;
    font-size: 14px;
  }

  .secret-form {
    margin-top: 18px;
  }

  .otp-button,
  .empty-state {
    min-height: 98px;
  }

  .otp-button span {
    font-size: clamp(40px, 15vw, 56px);
  }

  .mfa-actions {
    grid-template-columns: 1fr;
  }
}
