:root {
  color-scheme: light dark;
  --cat-health: #ff5a8a;
  --cat-career: #4d9bff;
  --cat-finance: #44d17a;
  --cat-learning: #ffad3d;
  --cat-relationships: #a985ff;
  --cat-personal: #7b8dff;
  --cat-mindfulness: #38d6c8;
  --cat-creative: #ffd84a;
  --cat-other: #9a9aa3;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select { font: inherit; }

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

a { color: inherit; }

.app-hidden,
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html:has(body[data-surface="auth"]),
body[data-surface="auth"] {
  color-scheme: dark;
  background: #0a0a0a;
}

.boot,
.auth-shell {
  --auth-bg: #0a0a0a;
  --auth-paper: #131316;
  --auth-text: #f5f5f7;
  --auth-muted: #a1a1a6;
  --auth-faint: #6e6e73;
  --auth-accent: #4d9bff;
  --auth-border: rgba(255, 255, 255, 0.09);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--auth-text);
  background:
    radial-gradient(circle at 10% 12%, rgba(77, 155, 255, 0.12), transparent 28%),
    var(--auth-bg);
}

.auth-frame {
  width: min(1120px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(24px + env(safe-area-inset-top))
    clamp(22px, 5vw, 58px)
    calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--auth-text);
  text-decoration: none;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: 0;
}

.auth-brand img {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: cover;
  border-radius: 9px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.auth-dot { color: var(--auth-accent); }

.auth-top-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border: 1px solid var(--auth-border);
  border-radius: 9px;
  color: var(--auth-text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.auth-top-link:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: var(--auth-paper);
}

.auth-layout {
  flex: 1;
  display: grid;
  align-items: center;
  gap: clamp(52px, 8vw, 112px);
  padding: clamp(54px, 9vh, 92px) 0 44px;
}

.auth-card,
.boot-card { width: min(540px, 100%); }

.boot .auth-frame { justify-content: flex-start; }

.boot-card {
  flex: 1;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 18px;
}

.auth-eyebrow,
.invite-kicker {
  margin: 0 0 13px;
  color: var(--auth-accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-card h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(48px, 6.4vw, 72px);
  line-height: 1;
  letter-spacing: 0;
  font-weight: 700;
}

.boot .lede,
.auth-shell .lede,
.auth-shell .note,
.auth-shell .error {
  color: var(--auth-muted);
  line-height: 1.55;
}

.auth-shell .lede {
  max-width: 31em;
  margin: 20px 0 0;
  font-size: 17px;
}

.boot .lede { margin: 0; font-size: 17px; }

.auth-shell .note {
  max-width: 34em;
  margin: 18px 0 0;
  font-size: 13px;
}

.invite-preview {
  margin: 0 0 24px;
  padding: 18px 20px;
  border: 1px solid var(--auth-border);
  border-left: 3px solid var(--auth-accent);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.invite-preview h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

.invite-preview .lede { margin-top: 8px; font-size: 15px; }
.error { color: #ff6b6b !important; }

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(450px, 100%);
  margin-top: 30px;
}

.auth-button,
.secondary-button,
.primary-link {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 650;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.auth-shell .auth-button,
.auth-shell .primary-link { color: #fff; background: var(--auth-accent); }

.auth-shell .secondary-button {
  color: var(--auth-text);
  border: 1px solid var(--auth-border);
  background: var(--auth-paper);
}

.auth-shell :is(.auth-button, .secondary-button, .primary-link) {
  transition: transform 0.1s ease, filter 0.14s ease, background 0.14s ease;
}

.auth-shell :is(.auth-button, .secondary-button, .primary-link):hover { filter: brightness(0.97); }
.auth-shell :is(.auth-button, .secondary-button, .primary-link):active { transform: scale(0.985); }

.auth-shell :is(.auth-button, .secondary-button):disabled {
  opacity: 0.52;
  cursor: wait;
  transform: none;
}

.auth-provider-icon { width: 17px; height: 17px; flex: 0 0 auto; }
.auth-provider-icon.apple { width: 15px; height: 19px; }

.auth-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 22px;
}

.auth-pill {
  --pill: var(--cat-other);
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 7px;
  color: color-mix(in srgb, var(--pill) 82%, var(--auth-text));
  background: color-mix(in srgb, var(--pill) 11%, var(--auth-paper));
  font-size: 11px;
  line-height: 1;
  font-weight: 650;
}

.auth-pill.cat-career { --pill: var(--cat-career); }
.auth-pill.cat-relationships { --pill: var(--cat-relationships); }
.auth-pill.cat-personal { --pill: var(--cat-personal); }

.auth-aside { display: none; }

.auth-panel {
  width: min(410px, 100%);
  padding: 18px 14px;
  border: 1px solid var(--auth-border);
  border-radius: 16px;
  background: rgba(19, 19, 22, 0.9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.auth-panel-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  align-items: center;
  padding: 16px 12px;
  border-bottom: 1px solid var(--auth-border);
}

.auth-panel-card:last-child { border-bottom: 0; }
.auth-panel-card .auth-pill { grid-row: 1 / 3; align-self: start; }

.auth-panel-card strong {
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

.auth-panel-card p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  color: var(--auth-faint);
  font-size: 12px;
}

.auth-foot a { color: var(--auth-muted); text-decoration: none; }
.auth-foot a:hover { color: var(--auth-text); }

.auth-spinner {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--auth-accent);
  animation: auth-spin 0.72s linear infinite;
}

@keyframes auth-spin { to { transform: rotate(360deg); } }

.boot :focus-visible,
.auth-shell :focus-visible {
  outline: 2px solid color-mix(in srgb, var(--auth-accent) 64%, transparent);
  outline-offset: 3px;
}

@media (min-width: 880px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr) minmax(330px, 0.78fr); }
  .auth-aside { display: block; }
  .auth-pills { display: none; }
}

@media (max-width: 640px) {
  .auth-layout { padding-top: 52px; }
  .auth-card h1 { max-width: none; font-size: 45px; }
  .auth-actions { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"]:has(body[data-surface="auth"]),
  html[data-theme="dark"]:has(body[data-surface="auth"]),
  html[data-theme="system"] body[data-surface="auth"],
  html[data-theme="dark"] body[data-surface="auth"] {
    color-scheme: dark;
    background: #0a0a0a;
  }

  html[data-theme="system"] :is(.boot, .auth-shell),
  html[data-theme="dark"] :is(.boot, .auth-shell) {
    --auth-bg: #0a0a0a;
    --auth-paper: #131316;
    --auth-text: #f5f5f7;
    --auth-muted: #a1a1a6;
    --auth-faint: #6e6e73;
    --auth-accent: #4d9bff;
    --auth-border: rgba(255, 255, 255, 0.09);
    background: var(--auth-bg);
  }

  html[data-theme="system"] :is(.auth-panel, .invite-preview),
  html[data-theme="dark"] :is(.auth-panel, .invite-preview) {
    background: rgba(19, 19, 22, 0.9);
    box-shadow: none;
  }
}

html[data-theme="light"]:has(body[data-surface="auth"]),
html[data-theme="light"] body[data-surface="auth"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  .auth-spinner { animation: none; }
  .auth-shell :is(.auth-button, .secondary-button, .primary-link) { transition: none; }
}
