:root {
  --wrap: min(1216px, calc(100% - 80px));
  --jump-offset: 24px;
  --dusk: #21172e;
  --hero-ink: #fcf7ff;
  --hero-muted: #dbcee8;
  --hero-accent: #cbb3ff;
  --horizon: #eee4f4;
}

html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--paper);
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}
.wrap { width: var(--wrap); margin-inline: auto; }
.site-header {
  position: relative; z-index: 2;
  padding-top: env(safe-area-inset-top);
  color: var(--hero-ink);
  background: var(--dusk);
}
.header-inner, .footer-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 810; font-size: 21px; letter-spacing: .04em; text-decoration: none; white-space: nowrap; }
.header-inner { min-height: 74px; border-bottom: 1px solid #e5d2ff24; }
.site-header .wordmark { color: var(--hero-ink); }
.header-inner nav { display: flex; align-items: center; gap: clamp(11px, 2vw, 28px); font-size: 14px; font-weight: 630; color: var(--hero-muted); }
.header-inner nav a, .footer-inner a { text-decoration: none; }
.header-inner nav a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 1px; white-space: nowrap; transition: color .18s; }
.header-inner nav a:hover, .footer-inner a:hover { text-decoration: underline; text-underline-offset: 5px; }
.header-inner nav a:hover { color: var(--hero-ink); }
.footer-inner a:hover { color: var(--accent-deep); }
.header-actions { display: flex; align-items: center; gap: 4px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 17px; border: 1px solid transparent; border-radius: 9px;
  background: var(--accent); color: var(--white);
  font-size: 14px; font-weight: 730; white-space: nowrap; text-decoration: none;
  transition: color .18s, background-color .2s, border-color .2s, transform .25s var(--ease-soft);
}
.button:hover { background: var(--accent-deep); }
.button.primary { min-height: 48px; padding-inline: 21px; }
.button.outline { background: var(--white); border-color: var(--control-line); color: var(--accent-deep); }
.button.outline:hover { background: var(--tint); border-color: var(--focus); }
.button.text-button { background: transparent; color: var(--accent-deep); padding-inline: 12px; }
.button.text-button:hover { background: var(--tint); }
.button.compact { padding-inline: 16px; }
.site-header .button, .hero .button { border-radius: 100px; }
.site-header .button.compact { background: #dfccff20; border-color: #dfccff56; color: var(--hero-ink); }
.site-header .button.compact:hover { background: #dfccff36; border-color: #dfccff8c; }
.site-header .button.text-button { color: var(--hero-muted); }
.site-header .button.text-button:hover { background: #dfccff20; color: var(--hero-ink); }
.site-header :focus-visible, .hero :focus-visible { outline-color: #e6d3ff; }
.button:disabled { opacity: .6; }
.inline-link { min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent-deep); font-weight: 680; text-underline-offset: 4px; }
.inline-link:hover { text-decoration: underline; }
.skip:focus { z-index: 5; inset: 8px auto auto 8px; clip-path: none; width: auto; height: auto; background: var(--white); padding: 10px; }

.acceptance-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--tint);
}
.acceptance-banner > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: 14px; color: var(--accent-deep); }
.acceptance-banner > div span { color: var(--muted); }

.hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  color: var(--hero-ink);
  padding-bottom: 51px;
  background: radial-gradient(ellipse at 80% 72%, #664677 0, transparent 67%), linear-gradient(var(--dusk), #39294b);
}
.hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 0 0 28%;
  pointer-events: none;
  background: url('/connection-hero.webp') 82% 48% / min(760px, 100%) auto no-repeat;
  opacity: .6;
  mask-image: radial-gradient(ellipse 59% 76% at 66% 49%, #000 10%, #000b 45%, transparent 79%);
}
.hero::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 187px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, #79598d14 18%, #a18ab980 45%, #c4afd8df 72%, var(--horizon));
}
.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.21fr);
  align-items: center;
  min-height: 530px;
  gap: clamp(24px, 3.3vw, 50px);
  padding-block: 30px 25px;
}
.hero-copy { position: relative; min-width: 0; padding: 0 0 5px; }
.platform-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  color: var(--hero-muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .08em;
}
.platform-line::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #ffd6ac;
  box-shadow: 0 0 13px #ffb678ac;
}
.hero h1 {
  margin: 0;
  font-size: clamp(47px, 5.45vw, 82px);
  font-weight: 740;
  font-feature-settings: "palt";
  line-height: 1.12;
  letter-spacing: -.069em;
}
.hero h1 span {
  color: var(--hero-accent);
  background: linear-gradient(105deg, #dfcaff 6%, #bda1fa 53%, #f0bfcf 92%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-description {
  max-width: 342px;
  margin: 24px 0 29px;
  color: var(--hero-muted);
  font-size: 16px;
  line-height: 1.85;
  text-wrap: pretty;
}
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero-actions .button { min-height: 49px; }
.hero-actions .primary { padding-inline: 24px; background: #d3b9ff; color: #241735; box-shadow: 0 5px 32px #b58bf342; }
.hero-actions .primary:hover { background: #e5d3ff; transform: translateY(-2px); }
.hero-note { color: #dfd0ee; font-size: 13px; }
.hero-card-form { max-width: 366px; margin-top: 23px; }
.hero-card-form label { display: block; width: fit-content; margin-bottom: 7px; color: #eee1fa; font-size: 14px; font-weight: 690; }
.hero-card-controls {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px;
  padding: 3px; border: 1px solid #ab94c582; border-radius: 12px; background: #21162ddf;
  transition: border-color .22s, box-shadow .22s;
}
.hero-card-controls:focus-within { border-color: #ddc6ff; box-shadow: 0 0 0 2px #d4b4ff36; }
.hero-card-controls input {
  width: 100%; min-width: 0; min-height: 44px; padding: 8px 11px;
  border: 0; border-radius: 8px; background: transparent; color: var(--hero-ink); font-size: 16px;
}
.hero-card-controls input::placeholder { color: #c7b6d4; font-size: 14px; opacity: 1; }
.hero-card-controls input:focus-visible { outline-offset: -2px; outline-width: 2px; }
.hero-card-controls .button { padding-inline: 13px; border-radius: 8px; background: #7653ab; color: #fff9ff; }
.hero-card-controls .button:hover:not(:disabled) { background: #926dc6; }
#home-card-status { margin: 6px 0 0; color: #ffdbc6; font-size: 13px; line-height: 1.5; }
#home-card-status:empty { margin: 0; }
.hero-visual { min-width: 0; scroll-margin-top: var(--jump-offset); }
.hero-showcase { width: 100%; min-width: 0; }

.section { margin: 89px 0; scroll-margin-top: var(--jump-offset); }
.section-heading { margin-bottom: 23px; }
.section-heading h2 { margin: 0 0 8px; font-size: clamp(29px, 3.4vw, 46px); font-weight: 720; line-height: 1.24; letter-spacing: -.043em; }
.section-heading p, .flow-card p, .plan-description { margin: 0; color: var(--muted); line-height: 1.72; }

.rank-band { display: flow-root; background: linear-gradient(180deg, var(--horizon), var(--paper) 89%); }
.section.ranking { margin: 0 auto; padding-top: 21px; }
.rank-intro { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.rank-top { display: flex; flex-direction: column; gap: 5px; color: var(--muted); text-align: right; font-size: 12px; }
.rank-top time { font-variant-numeric: tabular-nums; }
.rank-rows {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.rank-row {
  --avatar-fill: #eddef8;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
}
.rank-row:first-child {
  grid-row: span 2;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  min-height: 160px;
  padding: 22px;
  border-color: #e7d6f5;
  background: radial-gradient(ellipse at 89% 14%, #fbe1e8 0, transparent 65%), linear-gradient(137deg, #efe2fd, #faf2ff);
}
.rank-row:nth-child(2) { --avatar-fill: #f3e1ef; }
.rank-row:nth-child(3) { --avatar-fill: #e1e2f8; }
.rank-row:nth-child(5) { --avatar-fill: #f6e5e2; }
.rank-position { color: var(--muted); text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-row:first-child .rank-position { position: absolute; top: 17px; left: 22px; font-size: 20px; line-height: 1; font-weight: 720; }
.rank-person { min-width: 0; display: flex; align-items: center; gap: 9px; }
.rank-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--avatar-fill);
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 720;
}
.rank-row:first-child .rank-avatar { width: 44px; height: 44px; border: 1px solid #d6b9ef; background: #fff9ff8a; }
.rank-identity { min-width: 0; display: grid; gap: 4px; }
.rank-identity strong { font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-identity small { color: var(--muted); font-size: 12px; }
.rank-streak { display: flex; align-items: baseline; gap: 4px; color: var(--ember); white-space: nowrap; }
.rank-streak svg { align-self: center; width: 15px; height: 15px; fill: #f6c284; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.rank-streak strong { font: 740 23px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.034em; }
.rank-row:first-child .rank-streak strong { font-size: clamp(34px, 4vw, 64px); }
.rank-row:first-child .rank-streak svg { width: 20px; height: 20px; }
.rank-streak small { font-size: 12px; }
.rank-loading { grid-column: 1 / -1; min-height: 152px; padding: 20px; color: var(--muted); }

.plan-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0; padding: 0; border-block: 1px solid var(--line); background: var(--white);
}
.flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.flow-card, .plan-card { min-width: 0; }
.plan-card { padding: 23px; }
.plan-card + .plan-card { border-left: 1px solid var(--line); }
.flow-card { position: relative; display: flex; flex-direction: column; align-items: start; padding: 24px 0 0; }
.flow-marker { position: absolute; top: -5px; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--paper); }
.flow-card h3, .plan-card h3 { margin: 0 0 7px; font-size: 18px; letter-spacing: -.012em; }
.flow-card p { max-width: 24em; font-size: 15px; }
.flow-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: auto; color: var(--accent-deep); font-size: 14px; font-weight: 680; text-underline-offset: 3px; text-decoration-color: var(--control-line); }
.flow-link:hover { text-decoration-color: currentColor; }
.plan-card .price { margin: 4px 0 6px; color: var(--accent-deep); font: 720 31px/1.18 system-ui, sans-serif; letter-spacing: -.03em; }
.plan-card .button { margin-top: 14px; }
.plan-empty { grid-column: 1 / -1; margin: 0; padding: 13px 19px; border-bottom: 1px solid var(--line); background: var(--tint); color: var(--accent-deep); font-size: 14px; }

.faq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.64fr); gap: 38px; margin-bottom: 81px; }
.faq-list { border-block: 1px solid var(--line); }
.faq details + details { border-top: 1px solid var(--line); }
.faq details { scroll-margin-top: var(--jump-offset); }
.faq details summary {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 47px; padding: 13px 3px; color: var(--ink); font-weight: 680; cursor: pointer;
}
.faq details summary::-webkit-details-marker { display: none; }
.faq details summary::after { content: ''; width: 7px; height: 7px; flex: none; margin-right: 4px; border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: rotate(45deg); transition: transform .18s; }
.faq details[open] summary::after { transform: rotate(225deg); }
.faq details p { margin: 0 19px 13px 3px; color: var(--muted); line-height: 1.74; }
.faq details[open] p { animation: panel-appear .22s var(--ease-soft) both; }

.site-footer { padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--white); }
.footer-inner { justify-content: flex-start; gap: 20px; color: var(--muted); font-size: 14px; }
.footer-inner .wordmark { margin-right: auto; font-size: 18px; }
.footer-link { font-weight: 500; color: inherit; }

.auth-dialog {
  width: min(420px, calc(100% - 30px)); max-height: calc(100dvh - 30px); padding: 30px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: var(--ink); box-shadow: 0 23px 60px #40275b36;
}
.auth-dialog[open] { animation: panel-appear .24s var(--ease-soft) both; }
.auth-dialog::backdrop { background: #21152c9c; }
.auth-dialog h2 { margin: 14px 0 3px; }
.auth-dialog p { margin-top: 4px; color: var(--muted); }
.dialog-close { position: absolute; top: 11px; right: 11px; width: 44px; height: 44px; border: 0; border-radius: 9px; background: var(--tint); color: var(--accent-deep); font: 24px/1 system-ui, sans-serif; }
.auth-dialog form { display: grid; gap: 12px; margin-top: 19px; }
.auth-dialog label { display: grid; gap: 5px; font-size: 14px; font-weight: 700; }
.auth-dialog input { width: 100%; min-height: 45px; padding: 10px 11px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--white); color: var(--ink); font-size: 16px; }
#auth-message { margin: 0; min-height: 18px; font-size: 14px; }
#auth-message.is-error { color: var(--danger); }
.dialog-actions { display: flex; gap: 14px; margin-top: 8px; }
.dialog-actions button { min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent-deep); text-decoration: underline; text-underline-offset: 4px; font-size: 14px; }

@keyframes panel-appear {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: page-arrive .62s var(--ease-soft) both; }
  [data-revealed="true"] .section-heading { animation: page-arrive .5s var(--ease-soft) both; }
  @keyframes page-arrive {
    from { opacity: .75; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (max-width: 1080px) {
  :root { --wrap: calc(100% - 54px); }
  .hero-layout { gap: 25px; grid-template-columns: minmax(0, .91fr) minmax(0, 1.15fr); }
  .hero h1 { font-size: clamp(43px, 5.65vw, 65px); }
  .rank-row { gap: 7px; padding-inline: 10px; }
  .rank-row:first-child { padding-inline: 16px; }
  .rank-row:first-child .rank-position { left: 16px; }
}
@media (max-width: 800px) {
  :root { --wrap: calc(100% - 36px); }
  .section { margin: 63px 0; }
  .rank-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-row:first-child { grid-area: auto / span 2; min-height: 116px; }
  .faq { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .footer-inner { gap: 13px; flex-wrap: wrap; padding-block: 7px; }
}
@media (max-width: 680px) {
  .hero { padding-bottom: 41px; }
  .hero::after { height: 147px; }
  .hero-layout { grid-template-columns: 1fr; gap: 18px; min-height: 0; padding-block: 36px 22px; }
  .hero-copy, .hero-visual { width: 100%; max-width: 565px; margin-inline: auto; }
  .hero-copy { padding: 0; }
  .hero::before { inset: 22% 0 0; background-position: center 68%; mask-image: radial-gradient(ellipse 70% 69% at 51% 54%, #0005, transparent 87%); }
  .hero h1 { font-size: clamp(45px, 11.4vw, 68px); }
  .platform-line { margin-bottom: 13px; }
  .hero-description { margin: 15px 0 18px; font-size: 15px; line-height: 1.67; }
  .hero-card-form { margin-top: 18px; }
}
@media (max-width: 660px) {
  :root { --wrap: calc(100% - 32px); }
  .header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 0; gap: 0 7px; padding-top: 8px; }
  .header-inner nav { grid-row: 2; grid-column: 1 / -1; justify-content: space-between; gap: 5px; font-size: 13px; }
  .header-actions { gap: 0; }
  .header-actions .button { padding-inline: 11px; }
  .hero-layout { gap: 14px; padding-top: 22px; }
  .hero h1 { font-size: clamp(40px, 11.5vw, 62px); }
}
@media (max-width: 530px) {
  .header-inner { padding-top: 5px; }
  .hero-layout { gap: 10px; padding-top: 18px; }
  .platform-line { margin-bottom: 9px; }
  .hero h1 { font-size: clamp(38px, 10.5vw, 54px); }
  .hero-description { margin-block: 11px 13px; line-height: 1.6; }
  .hero-actions .button { min-height: 44px; }
  .hero-actions .primary { padding-inline: 19px; }
  .hero-card-form { margin-top: 13px; }
  .hero-card-form label { margin-bottom: 5px; }
  .rank-intro { align-items: start; flex-direction: column; gap: 9px; margin-bottom: 14px; }
  .rank-top { flex-direction: row; justify-content: space-between; width: 100%; text-align: left; }
  .rank-rows { gap: 8px; }
  .rank-row:not(:first-child) { grid-template-columns: auto minmax(0, 1fr); min-height: 88px; }
  .rank-row:not(:first-child) .rank-streak { grid-column: 2; }
  .rank-row:not(:first-child) .rank-streak strong { font-size: 20px; }
  .rank-avatar { width: 26px; height: 26px; }
  .rank-person { gap: 6px; }
  .rank-identity strong { font-size: 14px; }
  .flow-grid, .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .flow-grid { margin-left: 4px; gap: 15px; border-top: 0; border-left: 1px solid var(--line); }
  .flow-card { padding: 0 0 0 18px; }
  .flow-marker { inset: 6px auto auto -5px; }
  .plan-card { padding: 16px; }
  .plan-card + .plan-card { border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button, .header-inner nav a, .hero-card-controls, .faq details summary::after { transition: none; }
  .hero-actions .primary:hover { transform: none; }
  .auth-dialog[open], .faq details[open] p { animation: none; }
}
