:root {
  color-scheme: light dark;
  --canvas: #f4f4f7;
  --surface: #fbfbfd;
  --surface-soft: #ecebf2;
  --text: #202026;
  --muted: #686872;
  --line: rgba(32, 32, 38, 0.12);
  --accent: #7357d9;
  --accent-hover: #6449c6;
  --accent-text: #fbfaff;
  --warning: #9a4f16;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--text);
}

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

.shell {
  width: min(1120px, calc(100% - 48px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 0 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
}

.join-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: clamp(48px, 8vw, 112px);
  align-items: center;
  min-height: calc(100dvh - 128px);
  padding: 56px 0 72px;
}

.intro { max-width: 590px; }

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 600px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 520px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.button:active { transform: translateY(1px); }

.primary { background: var(--accent); color: var(--accent-text); }
.primary:hover { background: var(--accent-hover); }

.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}
.secondary:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.button:focus-visible,
.install-note a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: 3px;
}

.install-note {
  display: grid;
  gap: 5px;
  max-width: 500px;
  margin-top: 42px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.install-note strong { color: var(--text); }
.install-note a { width: fit-content; margin-top: 5px; color: var(--accent); font-weight: 700; }

.invitation-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(46, 39, 75, 0.12);
}

.relay-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 22px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.relay-heading div { display: grid; gap: 3px; min-width: 0; }
.relay-heading strong { overflow-wrap: anywhere; font-size: 18px; }
.muted { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.relay-glyph {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 19px;
  font-weight: 800;
}

dl { margin: 0; padding: 8px 22px; }
dl > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; padding: 15px 0; }
dl > div + div { border-top: 1px solid var(--line); }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }
dd[data-role="owner"] { color: var(--warning); font-weight: 800; }

.owner-warning {
  margin: 8px 22px 0;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--warning) 8%, var(--surface));
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.agent-warning {
  margin: 0 22px 18px;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: 12px;
  padding: 13px 14px;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.privacy {
  margin: 0;
  padding: 17px 22px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.error-state {
  width: min(560px, 100%);
  margin: 18vh auto 0;
  text-align: center;
}
.error-state .brand-mark { margin: 0 auto 24px; }
.error-state h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.04; }
.error-state p { margin: 20px auto 0; color: var(--muted); font-size: 16px; line-height: 1.5; }

@media (max-width: 760px) {
  .shell { width: min(100% - 32px, 620px); padding-top: 18px; }
  .join-layout { grid-template-columns: 1fr; gap: 42px; min-height: auto; padding: 64px 0 40px; }
  h1 { font-size: clamp(42px, 13vw, 60px); }
  .invitation-panel { box-shadow: 0 18px 48px rgba(46, 39, 75, 0.1); }
}

@media (max-width: 460px) {
  .actions { display: grid; }
  .button { width: 100%; }
  dl > div { grid-template-columns: 1fr; gap: 5px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #16151a;
    --surface: #201f25;
    --surface-soft: #29272f;
    --text: #f1eff5;
    --muted: #aaa6b3;
    --line: rgba(241, 239, 245, 0.12);
    --accent: #8a70e7;
    --accent-hover: #9a82ed;
    --accent-text: #17131f;
    --warning: #e59a5d;
  }
  .invitation-panel { box-shadow: 0 24px 70px rgba(8, 7, 12, 0.3); }
}

:root[data-appearance="dark"] {
  --canvas: #16151a;
  --surface: #201f25;
  --surface-soft: #29272f;
  --text: #f1eff5;
  --muted: #aaa6b3;
  --line: rgba(241, 239, 245, 0.12);
  --accent: #8a70e7;
  --accent-hover: #9a82ed;
  --accent-text: #17131f;
  --warning: #e59a5d;
}

:root[data-appearance="dark"] .invitation-panel {
  box-shadow: 0 24px 70px rgba(8, 7, 12, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
