  :root {
    --page: #ebe6da;
    --paper: #f3efe6;
    --sage: #cdd1b8;
    --sage-deep: #8f9678;
    --ink: #3f4433;
    --text: #4d4f44;
    --dim: #86847a;
    --field: #f7f4ed;
    --line: #ddd6c8;
    --line-on: #8f9678;
    --brown: #7d5d4a;
    --brown-ink: #fbf7f0;
    --ok: #4f7a4a;
    --bad: #b0473c;
    --shadow: 0 24px 60px rgba(70, 64, 45, .16);
    --serif: 'Lora', Georgia, 'Times New Roman', serif;
    --sans: Vazirmatn, Tahoma, system-ui, sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --page: #1b1d16; --paper: #23261d; --sage: #3b4131; --sage-deep: #7d8567;
      --ink: #eeeadd; --text: #dcd8ca; --dim: #9b9887; --field: #1c1e17;
      --line: #3a3e31; --line-on: #9aa37f; --brown: #9b7660; --brown-ink: #fffaf2;
      --ok: #8fbf86; --bad: #e0897d; --shadow: 0 24px 60px rgba(0, 0, 0, .45);
    }
  }
  *, *::before, *::after { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body {
    background: var(--page); color: var(--text);
    font: 15px/1.75 var(--sans);
    display: flex; align-items: center; justify-content: center;
    -webkit-font-smoothing: antialiased;
  }
  [hidden] { display: none !important; }

  .card {
    position: relative; overflow: hidden;
    width: 100%; max-width: 420px; min-height: 100vh; min-height: 100dvh;
    background: var(--paper);
    display: flex; flex-direction: column;
  }
  @media (min-width: 480px) {
    body { padding: 32px 16px; }
    .card { min-height: 0; border-radius: 34px; box-shadow: var(--shadow); }
  }

  .band { position: relative; background: var(--sage); padding: calc(34px + env(safe-area-inset-top, 0px)) 30px 58px; }
  .band svg.wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 56px; display: block; }
  .brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .brand h1 { margin: 0; color: var(--ink); font-weight: 800; font-size: 34px; line-height: 1.25; }
  .brand p { margin: 2px 0 0; color: var(--dim); font-size: 16px; font-weight: 500; }
  html[lang="en"] .brand h1 { font-family: var(--serif); font-weight: 500; font-size: 38px; letter-spacing: -.2px; }
  html[lang="en"] .brand p { letter-spacing: .28em; font-size: 13.5px; }
  .tile {
    flex: none; width: 82px; height: 82px; border-radius: 22px;
    background: var(--sage-deep); display: grid; place-items: center;
    box-shadow: 0 10px 22px rgba(70, 75, 50, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
  }
  .tile svg { width: 50px; height: 50px; }

  .lang {
    position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); inset-inline-start: 22px;
    font: 600 12px var(--sans); color: var(--ink); opacity: .72;
    background: none; border: 0; padding: 6px 8px; cursor: pointer; border-radius: 9px;
  }
  .lang:hover { opacity: 1; background: rgba(255, 255, 255, .25); }

  .body { position: relative; z-index: 1; padding: 6px 30px 34px; flex: 1; }
  h2 { margin: 0 0 20px; color: var(--ink); font-size: 27px; font-weight: 800; }
  html[lang="en"] h2 { font-family: var(--serif); font-weight: 500; font-size: 30px; }
  .lead { margin: -12px 0 18px; color: var(--dim); font-size: 13.5px; }

  .field {
    display: flex; align-items: center; gap: 12px;
    background: var(--field); border: 1.5px solid var(--line); border-radius: 16px;
    padding: 8px 16px; margin-bottom: 14px; transition: border-color .15s, box-shadow .15s;
  }
  .field:focus-within { border-color: var(--line-on); box-shadow: 0 0 0 3px rgba(143, 150, 120, .16); }
  .field > svg { flex: none; width: 20px; height: 20px; color: var(--brown); opacity: .85; }
  .field .in { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .field label { font-size: 11.5px; color: var(--dim); line-height: 1.5; }
  .field input {
    width: 100%; border: 0; outline: 0; background: none; padding: 0;
    font: 500 16px/1.6 var(--sans); color: var(--text);
  }
  .field input::placeholder { color: var(--dim); opacity: .7; }
  .field input.ltr { direction: ltr; text-align: right; }
  html[lang="en"] .field input.ltr { text-align: left; }
  .field input.code { letter-spacing: 10px; text-align: center; font-size: 22px; direction: ltr; }
  .eye { flex: none; background: none; border: 0; padding: 4px; cursor: pointer; color: var(--dim); display: grid; }
  .eye svg { width: 20px; height: 20px; }

  .links { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 2px 2px 22px; font-size: 13px; }
  .links a { color: var(--dim); text-decoration: none; }
  .links a:hover { color: var(--brown); }

  .btn {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 15px 18px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--brown); color: var(--brown-ink);
    font: 700 17px var(--sans); box-shadow: 0 10px 22px rgba(125, 93, 74, .25);
    transition: transform .08s, opacity .15s;
  }
  html[lang="en"] .btn { font-weight: 600; }
  .btn:active { transform: translateY(1px); }
  .btn:disabled { opacity: .55; cursor: default; }
  .btn svg { width: 20px; height: 20px; }
  html[dir="rtl"] .btn svg.arrow { transform: scaleX(-1); }
  .ghost {
    width: 100%; margin-top: 12px; padding: 11px; border-radius: 999px; cursor: pointer;
    background: none; border: 1.5px solid var(--line); color: var(--dim); font: 600 14px var(--sans);
  }
  .ghost:disabled { opacity: .5; cursor: default; }

  .msg { font-size: 13.5px; margin-top: 12px; min-height: 22px; text-align: center; }
  .msg:empty { min-height: 0; margin-top: 0; }
  .msg.bad { color: var(--bad); }
  .msg.ok { color: var(--ok); }
  .hint { color: var(--dim); font-size: 12.5px; text-align: center; }

  .or { display: flex; align-items: center; gap: 12px; margin-top: 20px; color: var(--dim); font-size: 13px; }
  .or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
  .or a { color: var(--ink); font-weight: 700; text-decoration: none; }

  .dev {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 12px 14px; margin-bottom: 10px;
    background: var(--field); border: 1.5px solid var(--line); border-radius: 16px;
  }
  .dev b { font-weight: 700; font-size: 14px; color: var(--ink); }
  .dev small { color: var(--dim); font-size: 11.5px; display: block; line-height: 1.7; }
  .dev button {
    flex: none; padding: 7px 14px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--brown); color: var(--brown-ink); font: 600 12.5px var(--sans);
  }

  .foot { position: relative; height: 96px; margin-top: auto; pointer-events: none; }
  .foot svg { position: absolute; bottom: 0; width: 100%; height: 96px; display: block; }
