/* ==========================================================================
   Magic Wallet — recreated design system
   Extracted 1:1 from the original wallet.magic.link snapshots.
   ========================================================================== */

/* ----- Fonts ------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/inter-800.woff2") format("woff2");
}

/* ----- Design tokens ----------------------------------------------------- */
:root {
  --brand: #6851ff;
  --magic-10: #edebff;
  --magic-20: #cac2ff;
  --magic-30: #a799ff;
  --magic-40: #8875ff;

  --text-primary: #18171a;
  --text-black: #000000;
  --text-muted: #77767a;

  --input-border: #b6b4ba;
  --otp-border: #e2e0e5;

  --danger: #dc2626;
  --danger-text: #b91c1c;

  --amber-bg: #fef3c7;
  --amber-border: #f59e0b;
  --amber-text: #92400e;

  --close-bg: #ededf3;

  --font-sans: "Inter", "ProximaNova", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ----- Reset ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button {
  font-family: inherit;
  cursor: pointer;
}
a {
  color: inherit;
}

/* ==========================================================================
   Wallet shell (landing / loading) — animated pastel gradient
   ========================================================================== */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: linear-gradient(
    144deg,
    #e8e5ff,
    #f4e5ff,
    #fee8ff,
    #e0e8ff,
    #e0f7ff,
    #e0fbff
  );
  background-size: 1200% 1200%;
  animation: backgroundAnimation 33s ease infinite;
}

@keyframes backgroundAnimation {
  0% {
    background-position: 17% 0%;
  }
  50% {
    background-position: 84% 100%;
  }
  100% {
    background-position: 17% 0%;
  }
}

/* Loading spinner */
.spinner-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  animation: spin 1.5s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Shutdown notice card (landing)
   ========================================================================== */
.notice-card {
  width: 100%;
  max-width: 508px;
  background: #ffffff;
  border-radius: 28px;
  padding: 48px 24px;
  box-shadow: 0 12px 56px 0 rgba(119, 118, 122, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Below the card's fit width, the notice fills the screen (mobile state). */
@media (max-width: 520px) {
  .app {
    padding: 0;
    align-items: stretch;
  }
  .notice-card {
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    justify-content: center;
  }
  .notice-body {
    font-size: 16px;
    line-height: 26px;
  }
  /* Keep the headline on a single line, scaling it down to fit narrow screens. */
  .notice-section--strong {
    font-size: min(18px, 3.8vw);
  }
  .notice-badge-text {
    font-size: min(20px, 3.9vw);
    white-space: nowrap;
  }
}

.notice-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 20px;
}
.notice-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #b45309;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.notice-badge-text {
  color: var(--amber-text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notice-body {
  font-size: 18px;
  font-weight: 400;
  line-height: 30px;
  text-align: center;
  color: var(--text-black);
}
.notice-section {
  margin: 0 0 10px;
}
.notice-section:last-child {
  margin-bottom: 0;
}
.notice-section--strong {
  color: var(--danger-text);
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.notice-section--underline {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.notice-spacer-20 {
  height: 20px;
}
.notice-spacer-32 {
  height: 32px;
}

.btn-danger {
  width: 100%;
  height: 48px;
  border: none;
  background: var(--danger);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  padding: 12px 24px;
  border-radius: 300px;
  transition: 0.1s;
}
.btn-danger:hover {
  background: var(--danger-text);
  opacity: 0.9;
}
.btn-danger:active {
  transform: scale(0.98);
}

/* ==========================================================================
   Auth screens (email / otp / approve) — Magic secure modal
   ========================================================================== */
.auth-body {
  background: #e8e5ff;
}
.auth {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(
    144deg,
    #e8e5ff,
    #f4e5ff,
    #fee8ff,
    #e0e8ff,
    #e0f7ff,
    #e0fbff
  );
  background-size: 1200% 1200%;
  animation: backgroundAnimation 33s ease infinite;
}

/* The Magic secure modal: full-screen on mobile, a centered card on desktop. */
.auth-card {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: #ffffff;
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
}
@media (min-width: 768px) {
  .auth-card {
    width: 400px;
    min-height: 0;
    height: fit-content;
    margin-top: 48px;
    border-radius: 28px;
    box-shadow: 0 12px 56px rgba(119, 118, 122, 0.15);
    animation: scaleIn 250ms ease both;
  }
}
@keyframes scaleIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.auth-inner {
  width: 100%;
  padding: 32px 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Close button (otp / approve) — anchored to the card */
.auth-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 9999px;
  background: var(--close-bg);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
  z-index: 2;
}
.auth-close:hover {
  background: #e2e2ea;
}

/* Header line: "Sign in to Magic" */
.auth-heading {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--text-black);
  margin: 0 0 28px;
}
.auth-heading .brand {
  color: var(--brand);
  font-weight: 600;
}

/* Logos row (email) */
.auth-logos {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 21px;
}
.logo-circle {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo-circle--app {
  width: 56px;
  height: 56px;
  background: var(--magic-10);
  color: var(--magic-30);
  z-index: 0;
  animation: fadeIn 0.5s ease both, moveRight 1s ease both;
}
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes moveRight {
  0% {
    transform: translateX(-1.2rem);
  }
  80% {
    transform: translateX(0.05rem);
  }
  100% {
    transform: translateX(0);
  }
}
.logo-circle--app svg {
  width: 31px;
  height: 31px;
}
.logo-circle--magic {
  width: 50px;
  height: 50px;
  margin-left: -8px;
  z-index: 1;
}
.logo-circle--magic svg {
  width: 50px;
  height: 50px;
}

/* Big brand icon (otp envelope / approve shield) */
.auth-icon {
  color: var(--brand);
  margin-bottom: 22px;
  display: inline-flex;
}
.auth-icon svg {
  width: 38px;
  height: 38px;
}

/* Title + subtitle text blocks (approve defaults; otp overrides below) */
.auth-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: var(--text-primary);
  margin: 0 0 9px;
}
.auth-subtitle {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--text-primary);
  margin: 0;
}
.auth-subtitle strong,
.auth-subtitle .bold {
  font-weight: 700;
}
.auth-subtitle .edit-link {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
  color: var(--brand);
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  line-height: 0;
}
.auth-subtitle .edit-link svg {
  width: 16px;
  height: 16px;
}
.auth-subtitle + .auth-subtitle {
  margin-top: 23px;
}

/* OTP screen text uses the larger 20px scale with no title/subtitle gap */
.page-otp .auth-title {
  font-weight: 400;
  margin-bottom: 0;
}
.page-otp .auth-subtitle {
  font-size: 20px;
  line-height: 29px;
  font-weight: 700;
}

/* Email form */
.auth-form {
  width: 100%;
  margin-top: 4px;
}
.field {
  width: 100%;
  height: 43px;
  border: 1px solid var(--otp-border);
  border-radius: 14px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field::placeholder {
  color: #9a99a0;
}
.field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(104, 81, 255, 0.12);
}

.btn-primary {
  width: 100%;
  height: 43px;
  margin-top: 22px;
  border: none;
  border-radius: 9999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  transition: filter 0.12s ease;
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-primary:not(:disabled):hover {
  filter: brightness(0.95);
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 12px 0 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.btn-outline {
  width: 100%;
  height: 43px;
  border: 1px solid var(--input-border);
  border-radius: 9999px;
  background: #fff;
  color: var(--text-black);
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: background 0.12s ease;
}
.btn-outline:hover {
  background: #fafafa;
}
.btn-outline svg {
  flex: none;
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.auth-links .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-primary);
  display: inline-block;
}
.auth-links a,
.auth-links button {
  text-decoration: none;
  color: inherit;
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.auth-links a:hover,
.auth-links button:hover {
  text-decoration: underline;
}

/* OTP inputs */
.otp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 29px 0 11px;
}
.otp .otp-gap {
  width: 8px;
}
.otp-box {
  width: 38px;
  height: 43px;
  border: 1px solid var(--otp-border);
  border-radius: 8px;
  background: transparent;
  text-align: center;
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  -moz-appearance: textfield;
}
.otp-box::-webkit-outer-spin-button,
.otp-box::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.otp-box:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(104, 81, 255, 0.12);
}

/* Secured By Magic footer */
.secured {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  color: #b6b4ba;
  font-size: 13px;
  font-weight: 600;
}
.page-email .secured {
  margin-top: 44px;
}
.page-otp .secured {
  margin-top: 16px;
}
.page-approve .secured {
  margin-top: 24px;
}
.secured svg {
  display: block;
  color: #b6b4ba;
}
.secured svg path {
  fill: currentColor;
  transition: fill 0.15s ease;
}
/* Hover reveals the animated Magic brand gradient on the logo. */
.secured:hover svg path {
  fill: url(#logo-gradient);
}


/* ==========================================================================
   Utilities / accessibility
   ========================================================================== */

/* Screen-reader-only text (e.g. the loading announcement). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The router focuses each screen's root on navigation; don't draw a ring
   around the whole container (nested inputs/buttons keep their own rings). */
#app > *:focus {
  outline: none;
}

/* ==========================================================================
   Legal modal (Privacy / Terms)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(24, 23, 26, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFade 0.15s ease;
}
@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal {
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.2s ease both;
}
.modal-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 18px 24px;
  border-bottom: 1px solid #eeedf0;
}
.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-close {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 9999px;
  background: var(--close-bg);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}
.modal-close:hover {
  background: #e2e2ea;
}
.modal-body {
  overflow-y: auto;
  padding: 24px;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-primary);
  outline: none;
  overscroll-behavior: contain;
}
.modal-body > *:first-child {
  margin-top: 0;
}
.modal-body h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 26px 0 8px;
}
.modal-body h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 20px 0 6px;
}
.modal-body p {
  margin: 0 0 12px;
}
.modal-body ul {
  margin: 0 0 12px;
  padding-left: 20px;
}
.modal-body li {
  margin: 0 0 6px;
}
.modal-body .legal-caps {
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 520px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-start;
  }
  .modal {
    max-width: none;
    max-height: none;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
}
