html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: var(--line-height-body);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-bg {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(124,58,237,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}
.noise {
  position: fixed; inset: 0; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; opacity: 0.5;
}
.glow {
  position: fixed; border-radius: 50%;
  filter: blur(140px); pointer-events: none; opacity: 0.07; z-index: 0;
}
.glow-top-right { width: 400px; height: 400px; top: -100px; right: -100px; background: var(--purple); }
.glow-bottom-left { width: 500px; height: 400px; bottom: -150px; left: -150px; background: var(--accent); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim   { opacity: 0; animation: fadeUp var(--duration-enter) var(--ease-out) forwards; }
.anim-1 { animation-delay: 0.05s; }
.anim-2 { animation-delay: 0.15s; }

.page-wrap {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 412px;
  padding: var(--space-5) var(--space-4);
}

.logo {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-2); margin-bottom: var(--space-4); text-decoration: none;
}
.brand-logo {
  margin: 0 auto var(--space-3);
  width: fit-content;
}
.logo span {
  font-family: var(--font-display);
  font-size: 26px; font-weight: var(--font-weight-bold); color: var(--text-primary);
}

.auth-shell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-4);
}
.auth-quote {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: var(--space-4) var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--space-3);
  background:
    radial-gradient(circle at 20% 0%, rgba(124,58,237,0.10), transparent 36%),
    linear-gradient(180deg, var(--color-bg-elevated), var(--color-bg-inner));
  border-bottom: 1px solid var(--color-border-soft);
}
.auth-body {
  padding: var(--space-5) var(--space-4) var(--space-4);
}
.auth-shell .card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  text-align: center;
  box-shadow: none;
}
.auth-card { position: relative; overflow: hidden; }
.auth-card-accent { position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--gradient-accent); }
.quote-photo.is-hidden { display: none; }
.is-hidden { display: none !important; }
.card-icon { font-size: 2.1rem; color: var(--accent2); margin-bottom: var(--space-2); display: block; }
.card h1 {
  font-family: var(--font-display);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);
  color: var(--text-primary); margin-bottom: var(--space-1);
}
.card p.subtitle { color: var(--text-secondary); margin-bottom: var(--space-4); font-size: var(--font-size-body); }

.auth-quote::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--gradient-accent);
  opacity: 0.08;
  pointer-events: none;
}
.quote-text {
  position: relative; z-index: 1;
  margin: var(--space-1) 0;
  font-family: var(--font-display);
  font-size: clamp(1.08rem, 1.35vw, 1.34rem);
  line-height: var(--line-height-subheading);
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 30ch;
}
.quote-footer {
  position: relative; z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.quote-photo-wrap {
  width: 64px; height: 64px; flex-shrink: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  box-shadow: var(--shadow-2);
}
.quote-photo-wrap img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.quote-photo-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent2); font-size: 1.5rem;
}
.quote-meta {
  min-width: 0;
  display: flex; flex-direction: column; gap: var(--space-1);
}
.quote-author {
  font-family: var(--font-display);
  font-size: var(--font-size-h5);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}
.quote-work {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-caption);
}

form { display: flex; flex-direction: column; gap: var(--space-3); }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="url"] {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--control-radius-sm);
  border: 1px solid var(--border);
  background: var(--color-bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-body);
  font-family: inherit;
  text-align: center;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
  outline: none;
}
input:focus, input:focus-visible { border-color: var(--accent2); box-shadow: var(--focus-ring-shadow); }
.btn-primary:focus-visible,
.btn-google:focus-visible,
.pwd-toggle:focus-visible,
.links a:focus-visible,
.skip-profile-btn:focus-visible,
.terms-label input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-shadow);
}
input::placeholder { color: var(--text-muted); opacity: 0.8; }

.terms-label {
  display: flex; align-items: flex-start; gap: var(--space-2);
  text-align: left; cursor: pointer; color: var(--text-secondary);
  font-size: var(--font-size-sm); line-height: var(--line-height-body);
}
.terms-label input[type="checkbox"] {
  width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0;
  accent-color: var(--accent); padding: 0; border: none; background: none; text-align: left;
}
.terms-label a { color: var(--accent2); text-decoration: underline; }

.btn-primary {
  padding: var(--space-3) var(--space-5);
  background: var(--gradient-cta);
  border: none; border-radius: var(--control-radius-sm);
  color: var(--color-on-accent); font-size: var(--font-size-body); font-weight: var(--font-weight-semibold); font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: var(--space-1);
  transition: opacity var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-3);
  min-height: var(--touch-target-min);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled, .btn-primary[aria-busy="true"] { opacity: 0.72; cursor: progress; transform: none; }

.btn-google {
  width: 100%; padding: var(--space-3) var(--space-5);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--control-radius-sm); color: var(--text-primary);
  font-size: var(--font-size-body); font-weight: var(--font-weight-medium); font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
  min-height: var(--touch-target-min);
}
.btn-google:hover { background: var(--bg-card); border-color: var(--accent2); transform: translateY(-1px); }
.btn-google:active { transform: translateY(0); }

.oauth-divider {
  display: flex; align-items: center; gap: var(--space-3);
  color: var(--text-muted); font-size: var(--font-size-sm); margin: var(--space-1) 0;
}
.oauth-divider::before, .oauth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.error-msg { font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); margin-top: var(--space-1); display: none; line-height: var(--line-height-caption); text-align: left; }
.error-msg-centered { text-align: center; }
.error-msg.show { display: block; }

.links { margin-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
.links p { color: var(--text-secondary); font-size: var(--font-size-sm); }
.links a { color: var(--accent2); text-decoration: none; }
.links a:hover { text-decoration: underline; }

.success-section { display: none; }
.success-section.show { display: block; }
.complete-section { display: none; }
.complete-section.show { display: block; }

.form-group { display: flex; flex-direction: column; gap: var(--space-1); text-align: left; }
.form-group label,
.form-label { font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); color: var(--text-secondary); }
.form-group input { text-align: left; }
.form-helper { font-size: var(--font-size-xs); color: var(--text-muted); line-height: var(--line-height-caption); }
.field-status { font-size: var(--font-size-xs); margin-top: var(--space-1); display: none; line-height: var(--line-height-caption); }
.field-status.show { display: block; }
.field-status.is-success { color: var(--color-success); }
.field-status.is-error { color: var(--color-error); }
.username-status { margin-top: var(--space-1); }
.form-helper-tight { margin-top: 2px; font-size: var(--font-size-xs); }
.required-mark { color: var(--color-error); }
input[aria-invalid="true"] { border-color: var(--color-error); box-shadow: 0 0 0 3px var(--color-error-bg); }
button[aria-busy="true"] { opacity: 0.72; cursor: progress; }
.turnstile-container { margin-bottom: var(--space-3); }
.card-icon-success { color: var(--color-success); }
.card-title-compact { font-size: var(--font-size-h3); }
.resend-section { margin-top: var(--space-3); }
.resend-countdown { color: var(--text-muted); font-size: var(--font-size-sm); }
.links-spaced { margin-top: var(--space-6); }
.complete-form { text-align: left; }
.form-group-relative { position: relative; }
.complete-btn { margin-top: var(--space-2); }
.skip-profile-btn { width: 100%; margin-top: var(--space-2); padding: var(--space-2); background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-family: inherit; font-size: var(--font-size-sm); }
.skip-profile-btn:hover { color: var(--text-primary); }

/* Password strength */
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 44px; text-align: left; }
.pwd-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: var(--font-size-h4); display: flex; align-items: center; padding: 0;
}
.pwd-toggle:hover { color: var(--text-primary); }
.pwd-checklist { list-style: none; margin-top: var(--space-2); flex-direction: column; gap: var(--space-1); display: none; }
.pwd-checklist.visible { display: flex; }
.pwd-checklist li { font-size: var(--font-size-xs); display: flex; align-items: center; gap: var(--space-1); color: var(--text-muted); transition: color var(--duration-fast) var(--ease-out); }
.pwd-checklist li.ok { color: var(--color-success); }
.grid-2f { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

.input-prefix-wrap { position: relative; }
.input-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-weight: var(--font-weight-medium); pointer-events: none; }
.input-prefix-wrap input { padding-left: 28px; text-align: left; }

.autocomplete-list {
  list-style: none;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); max-height: 180px; overflow-y: auto;
  position: absolute; width: 100%; z-index: 50; margin-top: 2px;
}
.autocomplete-list li { padding: var(--space-2) var(--space-3); cursor: pointer; font-size: var(--font-size-sm); color: var(--text-primary); transition: background var(--duration-fast) var(--ease-out); }
.autocomplete-list li:hover { background: var(--color-accent-muted); }

#scrollTopBtn {
  position: fixed; bottom: 28px; right: 28px;
  width: var(--touch-target-min); height: var(--touch-target-min); border-radius: 50%;
  background: var(--gradient-cta);
  border: none; color: var(--color-on-accent); font-size: 18px;
  cursor: pointer; z-index: var(--z-menu);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
#scrollTopBtn.visible { opacity: 1; pointer-events: auto; }
#scrollTopBtn:hover { transform: translateY(-2px); }

@media (min-width: 835px) {
  .page-wrap {
    max-width: 1180px;
    padding: var(--space-12);
  }
  .logo {
    margin: 0 auto var(--space-6);
  }
  .logo span {
    font-size: 30px;
  }
  .auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 420px);
    align-items: stretch;
  }
  .auth-quote {
    padding: var(--space-12);
    border-right: 1px solid var(--color-border-soft);
    border-bottom: 0;
    min-height: 620px;
    justify-content: center;
  }
  .auth-body {
    padding: var(--space-12);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .card h1 {
    font-size: var(--font-size-h1);
    line-height: var(--line-height-heading);
  }
  .card p.subtitle {
    font-size: var(--font-size-body);
    margin-bottom: var(--space-6);
  }
  .quote-text {
    font-size: var(--font-size-h3);
    line-height: var(--line-height-subheading);
    max-width: 24ch;
    margin: 0 0 var(--space-4);
  }
  .quote-footer {
    gap: var(--space-4);
  }
  .quote-photo-wrap {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-lg);
  }
  .quote-author {
    font-size: var(--font-size-h5);
  }
  .quote-work {
    font-size: var(--font-size-sm);
  }
}
/* MacBook 14" e maiores */
@media (min-width: 1440px) {
  .page-wrap {
    max-width: 1440px;
  }
  .auth-shell {
    grid-template-columns: minmax(0, 1.45fr) minmax(420px, 520px);
  }
  .quote-text {
    font-size: var(--font-size-h2);
    max-width: 28ch;
  }
}

/* MacBook Pro 16" e iMac */
@media (min-width: 1600px) {
  .page-wrap {
    max-width: 1600px;
    padding: var(--space-16);
  }
  .auth-shell {
    grid-template-columns: minmax(0, 1.45fr) minmax(460px, 560px);
  }
  .auth-quote {
    padding: var(--space-16);
  }
  .auth-body {
    padding: var(--space-16);
  }
  .quote-text {
    font-size: var(--font-size-h1);
    max-width: 26ch;
  }
}

@media (max-width: 430px) {
  .glow-top-right { width: 260px; height: 260px; top: -90px; right: -110px; }
  .glow-bottom-left { width: 320px; height: 260px; bottom: -120px; left: -120px; }
  body {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .page-wrap {
    padding: var(--space-4) var(--space-3) max(20px, env(safe-area-inset-bottom, 20px));
    max-width: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  .logo {
    margin: 0 auto var(--space-3);
    gap: var(--space-2);
  }
  .logo img { width: 28px; height: 28px; }
  .logo span { font-size: 22px; }
  .auth-shell {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
  .auth-quote {
    padding: var(--space-3) var(--space-3) var(--space-3);
    gap: var(--space-2);
    order: 2;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
  }
  .auth-body {
    padding: 0;
    order: 1;
  }
  .auth-shell .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-4) var(--space-4);
    box-shadow: var(--shadow-2);
  }
  .card-icon { font-size: 1.7rem; margin-bottom: var(--space-2); }
  .card h1 { font-size: var(--font-size-h3); margin-bottom: var(--space-1); }
  .card p.subtitle { margin-bottom: var(--space-3); font-size: var(--font-size-sm); }
  .form-label { font-size: var(--font-size-sm); }
  .form-helper { font-size: var(--font-size-xs); }
  .error-msg, .field-status { font-size: var(--font-size-xs); }
  form { gap: var(--space-2); }
  input[type="email"],
  input[type="password"],
  input[type="text"],
  input[type="number"],
  input[type="url"] {
    padding: var(--space-3) var(--space-3);
    font-size: var(--font-size-sm);
    border-radius: var(--control-radius-sm);
  }
  .btn-google { padding: var(--space-3) var(--space-4); font-size: var(--font-size-sm); }
  .btn-primary { padding: var(--space-3) var(--space-3); font-size: var(--font-size-sm); }
  .links { margin-top: var(--space-3); gap: var(--space-1); }
  .links a, .links p { font-size: var(--font-size-sm); }
  .oauth-divider { font-size: var(--font-size-sm); margin: 2px 0; }
  .quote-text { -webkit-line-clamp: 2; margin: 0; font-size: var(--font-size-sm); max-width: none; }
  .quote-footer { gap: var(--space-2); }
  .quote-photo-wrap { width: 44px; height: 44px; border-radius: var(--radius-md); }
  .quote-author { font-size: var(--font-size-sm); }
  .quote-work { font-size: var(--font-size-xs); }
}

html.light .auth-quote {
  background:
    radial-gradient(circle at 20% 0%, var(--color-accent-muted), transparent 36%),
    linear-gradient(180deg, rgba(238,240,248,0.98), rgba(228,232,244,0.95));
  border-bottom: 1px solid var(--color-interactive-border-strong);
}
html.light .quote-photo-wrap {
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.04);
}
html.light .auth-shell { box-shadow: var(--shadow-3); }
html.light .btn-google { background: rgba(255,255,255,0.8); }
html.light input[type="email"],
html.light input[type="password"],
html.light input[type="text"],
html.light input[type="number"],
html.light input[type="url"] {
  background: var(--color-bg-input);
}
