/* Connection UI shares the product website’s warm surfaces and native coral. */
:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --background: #fffaf6;
  --surface: #ffffff;
  --ink: #262520;
  --muted: #67645d;
  --accent: #ff8861;
  --border: #e5dfd6;
  --tint: #f1ece4;
  --primary: #ff8861;
  --primary-text: #262520;
  --focus: #262520;
  background: var(--background);
  color: var(--ink);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 1.5rem; font-size: 1rem; line-height: 1.6; }
main { max-width: 32rem; margin: 3rem auto; padding: 2.5rem; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); }
h1 { font-size: 2rem; font-weight: 550; letter-spacing: -.045em; line-height: 1.12; margin: 0 0 1rem; text-wrap: balance; }
h2 { font-size: 1.0625rem; font-weight: 600; }
p { color: var(--muted); }
a { color: inherit; text-underline-offset: 4px; }
button, input { min-height: 52px; font: inherit; width: 100%; padding: .8rem 1rem; margin: .5rem 0; border-radius: 12px; }
input { border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
input:hover { border-color: var(--muted); }
button { cursor: pointer; border: 1px solid transparent; background: var(--primary); color: var(--primary-text); font-weight: 600; transition: background-color 160ms ease, box-shadow 160ms ease; }
button:hover:not(:disabled), .primary-link:hover { box-shadow: 0 3px 0 var(--ink); }
button:active:not(:disabled), .primary-link:active { box-shadow: none; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: #262520; }
.connection-page {
  min-height: 100svh;
  padding: 48px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #ff886112, transparent 65%), var(--background);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 650; letter-spacing: -.04em; }
.brand-icon { width: 40px; height: 40px; flex-shrink: 0; }
.brand-caption { font-size: .8125rem; margin: 12px 0 0; text-align: center; }
main.connection { width: 100%; max-width: 480px; margin: 30px auto 24px; padding: 36px; border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 16px 60px #6e47380a; }
.steps { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; list-style: none; padding: 0 0 24px; margin: 0 0 30px; border-bottom: 1px solid var(--border); font-size: .8125rem; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 9px; }
.steps span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--tint); font-size: .75rem; }
.steps [aria-current] { color: var(--ink); font-weight: 600; }
.steps [aria-current] span { background: var(--accent); color: #262520; }
.connection h1 { font-size: clamp(1.875rem, 5vw, 2.25rem); }
.connection h2 { margin: 24px 0 12px; }
.page-heading { margin-bottom: 28px; }
.page-heading p { margin: 0; font-size: .9375rem; }
.page-heading .eyebrow { margin-bottom: 12px; font-size: .6875rem; letter-spacing: .12em; font-weight: 650; text-transform: uppercase; }
.connection .account-hint { font-size: .875rem; margin: 0 0 22px; padding-left: 14px; border-left: 3px solid var(--accent); }
.connection button { margin: 0 0 12px; }
.connection #google, .connection #apple { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.connection #google:hover:not(:disabled), .connection #apple:hover:not(:disabled) { background: var(--tint); }
.connection input { caret-color: var(--ink); }
.connection label { display: block; font-size: .875rem; }
#email-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.registration-note { text-align: center; font-size: .8125rem; margin: 16px 0 0; }
.account-row { padding: 16px 18px 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--background); }
.account-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 3px; }
#account { color: var(--ink); margin: 0; overflow-wrap: anywhere; font-size: .9375rem; font-weight: 600; }
.connection #switch-account { width: auto; min-height: 44px; padding: 8px 0; margin: 0; background: transparent; border: 0; color: var(--ink); font-size: .8125rem; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
#permissions { padding-left: 20px; margin: 0; font-size: .875rem; }
#permissions li { padding-left: 5px; margin: 16px 0; }
#permissions li::marker { color: var(--muted); }
.continue-note { font-size: .8125rem; margin: 24px 0 20px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); }
.connection #cancel { background: transparent; border: 1px solid var(--border); margin: 0; color: var(--ink); }
.connection #cancel:hover:not(:disabled) { background: var(--tint); }
#message { font-size: .875rem; margin: 20px 0 0; padding: 14px 16px; background: var(--tint); color: var(--ink); border-radius: 10px; overflow-wrap: anywhere; }
#message:empty { display: none; }
.page-footer { text-align: center; color: var(--muted); font-size: .75rem; margin: 0; }
.page-footer nav { display: flex; justify-content: center; gap: 24px; margin-top: 8px; flex-wrap: wrap; }
.page-footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px; }
/* The callback preserves its existing loading, success, error and cancelled states. */
.result-page { text-align: center; }
.result-symbol { width: 64px; height: 64px; margin: 4px auto 28px; color: var(--ink); }
.result-symbol svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.result-symbol circle { fill: var(--tint); stroke: none; }
.result-check, .result-warning { display: none; }
[data-state="success"] .result-check { display: block; }
[data-state="error"] .result-warning, [data-state="cancelled"] .result-warning { display: block; }
[data-state="loading"] .result-symbol circle { stroke: currentColor; stroke-dasharray: 32 12; fill: none; }
.result-page h1 { margin-bottom: 12px; }
#result-description { margin: 0; font-size: .9375rem; }
.primary-link { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 12px 16px; margin-top: 28px; border-radius: 12px; font-weight: 600; text-decoration: none; color: var(--primary-text); background: var(--primary); }
.result-note { font-size: .8125rem; margin: 20px 0 0; }
.result-page[data-state="success"] .result-symbol { color: #227043; }
.result-page[data-state="success"] .result-symbol circle { fill: #e8f6ed; }
.first-log { display: none; margin-top: 28px; padding: 22px 16px; background: var(--background); border: 1px solid var(--border); border-radius: 14px; }
[data-state="success"] .first-log { display: block; }
.first-log p { margin: 0 0 12px; font-size: .8125rem; }
.first-log blockquote { margin: 0 auto; max-width: 24ch; font-size: 1.25rem; line-height: 1.4; font-weight: 500; letter-spacing: -.025em; text-wrap: balance; color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root { --background: #191918; --surface: #252524; --ink: #f5efe6; --muted: #b8b4ad; --border: #45433e; --tint: #302e2b; --focus: #ff8861; }
  .result-page[data-state="success"] .result-symbol { color: #74d99b; }
  .result-page[data-state="success"] .result-symbol circle { fill: #21382b; }
}
@media (max-width: 520px) {
  .connection-page { padding: 28px 16px 16px; justify-content: flex-start; }
  main.connection { padding: 26px 22px; margin-top: 24px; border-radius: 20px; }
  .steps { gap: 14px 20px; margin-bottom: 24px; padding-bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) { button, .primary-link { transition: none; } }
