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

:root {
  /* Light theme (default) */
  --blue: #0b57d0;            /* accent: links */
  --btn-bg: #0b57d0;          /* filled button */
  --btn-text: #ffffff;        /* text on filled button */
  --text-primary: #1f1f1f;
  --text-secondary: #444746;
  --text-tertiary: #5e5e5e;
  --border: #747775;
  --page-bg: #f0f4f9;
  --card-bg: #ffffff;
  --error: #d93025;
  --chip-hover: rgba(31, 31, 31, .06);
  --spinner-track: rgba(60, 64, 67, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #a8c7fa;
    --btn-bg: #a8c7fa;
    --btn-text: #062e6f;
    --text-primary: #e3e3e3;
    --text-secondary: #c4c7c5;
    --text-tertiary: #8e918f;
    --border: #8e918f;
    --page-bg: #1e1f20;
    --card-bg: #0e0e0e;
    --error: #f2b8b5;
    --chip-hover: rgba(227, 227, 227, .08);
    --spinner-track: rgba(255, 255, 255, .12);
  }
}

html, body { height: 100%; }

body {
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

.title,
.twosv-heading {
  font-family: "Google Sans", "Product Sans", "Roboto", sans-serif;
  font-weight: 400;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 880px;
  background: var(--card-bg);
  border-radius: 28px;
  padding: 44px 40px 40px;
}

.step {
  display: flex;
  gap: 48px;
  align-items: stretch;
}

.hidden { display: none !important; }

/* ---------- Loading spinner ---------- */
.step-loading {
  justify-content: center;
  align-items: center;
  min-height: 372px;
}
.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid var(--spinner-track);
  border-top-color: #4285F4;
  animation: spin .85s linear infinite, spinColors 3.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinColors {
  0%   { border-top-color: #4285F4; }
  25%  { border-top-color: #EA4335; }
  50%  { border-top-color: #FBBC05; }
  75%  { border-top-color: #34A853; }
  100% { border-top-color: #4285F4; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: spinColors 3.4s linear infinite; }
}

/* ---------- Columns ---------- */
.step-left {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
}

.step-right {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* offset the form so it aligns with the title, not the logo */
  padding-top: 68px;
}

/* ---------- Left column content ---------- */
.logo { margin-bottom: 20px; }
.logo svg { display: block; }

.title {
  font-size: 36px;
  line-height: 1.22;
  letter-spacing: 0;
  margin-bottom: 12px;
}

.subtitle {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
}

.subtitle-sm {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ---------- Account chip ---------- */
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px 5px 8px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  max-width: 100%;
}
.account-chip:hover { background: var(--chip-hover); }
.chip-avatar { display: inline-flex; }
.chip-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-arrow { color: var(--text-tertiary); font-size: 11px; }

.resend-link {
  margin-top: auto;
  padding-top: 32px;
  align-self: flex-start;
}

/* ---------- Inputs ---------- */
.field { margin-bottom: 8px; }
.input-wrap { position: relative; }

.text-input {
  width: 100%;
  height: 56px;
  padding: 13px 15px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
}
.text-input:hover { border-color: var(--text-primary); }
.text-input:focus {
  border: 2px solid var(--blue);
  padding: 12px 14px;
}

.floating-label {
  position: absolute;
  left: 8px;
  top: 16px;
  padding: 0 8px;
  color: var(--text-tertiary);
  font-size: 16px;
  background: var(--card-bg);
  pointer-events: none;
  transition: all .1s ease-out;
}
.text-input:focus + .floating-label,
.text-input:not(:placeholder-shown) + .floating-label {
  top: -8px;
  font-size: 12px;
  color: var(--blue);
}
.text-input:not(:focus):not(:placeholder-shown) + .floating-label {
  color: var(--text-tertiary);
}

/* error state */
.field.has-error .text-input { border-color: var(--error); }
.field.has-error .text-input:focus { border-color: var(--error); }
.field.has-error .floating-label { color: var(--error) !important; }

.error-msg {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--error);
  font-size: 12px;
  line-height: 16px;
  margin-top: 8px;
  padding-left: 1px;
}
.field.has-error .error-msg { display: flex; }
.error-msg::before {
  content: "";
  display: inline-block;
  width: 16px; height: 16px;
  flex-shrink: 0;
  background: no-repeat center/16px url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%23f28b82'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
}

/* ---------- Links ---------- */
.link {
  color: var(--blue);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: .25px;
}
.link:hover { text-decoration: underline; }

.forgot-link {
  display: inline-block;
  margin-top: 22px;
  margin-left: 8px;
}

/* ---------- Guest text ---------- */
.guest-text {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
  margin-top: 32px;
  letter-spacing: .2px;
}
.guest-text .link { font-size: 14px; }

/* ---------- Checkbox ---------- */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  cursor: pointer;
  user-select: none;
}
.checkbox-row input {
  width: 18px; height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}
.checkbox-label { font-size: 14px; color: var(--text-primary); }

/* ---------- Actions ---------- */
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 48px;
}
.actions-end { justify-content: flex-end; }
.create-account { margin-left: -8px; padding: 8px; }

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .25px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  padding: 10px 24px;
  height: 40px;
  background: var(--btn-bg);
  color: var(--btn-text);
  transition: box-shadow .15s, filter .15s;
}
.btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 1px 3px 1px rgba(0,0,0,.35);
}
.btn:disabled { opacity: .7; cursor: default; }

/* ---------- 2SV panel ---------- */
.twosv-panel {
  display: flex;
  flex-direction: column;
}
.phone-illustration {
  align-self: center;
  margin-bottom: 28px;
}
.phone {
  width: 108px;
  height: 168px;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.phone-brand {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: .3px;
}
.phone-app {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 5px;
  border-radius: 100px;
  background: var(--chip-hover);
}
.phone-app-icon { display: inline-flex; }
.phone-app-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: .2px;
}

.phone-number {
  font-family: "Google Sans", "Roboto", sans-serif;
  font-size: 34px;
  color: var(--blue);
  line-height: 1;
  margin: 4px 0;
}
.phone-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}
.phone-line {
  width: 70%;
  height: 8px;
  border-radius: 4px;
  background: #3c4043;
}
.phone-line.short { width: 45%; }

.twosv-heading {
  font-size: 22px;
  margin-bottom: 12px;
}
.twosv-body {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
  max-width: 420px;
}
.twosv-body strong { color: var(--text-primary); font-weight: 500; }

/* ---------- Account recovery (email code) ---------- */
.recovery-sent {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 420px;
}
.recovery-sent strong {
  color: var(--text-primary);
  font-weight: 400;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.footer {
  width: 100%;
  max-width: 880px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 8px 0;
  margin-top: 8px;
}
.lang-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
}
.footer-links { display: flex; gap: 4px; }
.footer-link {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px;
}
.footer-link:hover { color: var(--text-primary); }

/* ---------- Responsive: stack columns ---------- */
@media (max-width: 800px) {
  .page { padding: 0; justify-content: flex-start; }
  .card {
    border-radius: 0;
    padding: 36px 24px 24px;
    min-height: 100vh;
    max-width: 100%;
  }
  .step {
    flex-direction: column;
    gap: 24px;
    min-height: calc(100vh - 120px);
  }
  .step-left { flex: none; text-align: left; }
  .title { font-size: 32px; }
  .step-right { padding-top: 0; }
  .resend-link { margin-top: 24px; padding-top: 0; }
  .footer {
    flex-direction: column-reverse;
    gap: 12px;
    padding: 16px;
  }
}
