:root {
  --bg: #fff;
  --surface: #f7f7f7;
  --card: #fff;
  --text: #111;
  --muted: #666;
  --muted-2: #7b7b7b;
  --accent: #e1262f;
  --accent-2: #f26a21;
  --border: rgba(0, 0, 0, 0.12);
  --soft-border: rgba(0, 0, 0, 0.08);
  --chrome-bg: rgba(255, 255, 255, 0.74);
  --chrome-text: #222;
  --chrome-muted: #444;
  --code-bg: #f2f2f2;
  --code-text: #111;
  --switch-text: #555;
  --switch-selected-text: #111;
  --step-bg: #111;
  --step-text: #fff;
  --image-bg: #f2f2f2;
}

:root[data-theme="dark"] {
  --bg: #050505;
  --surface: #0d0d0d;
  --card: #111;
  --text: #f7f7f7;
  --muted: #a8a8a8;
  --muted-2: #8e8e8e;
  --border: rgba(255, 255, 255, 0.14);
  --soft-border: rgba(255, 255, 255, 0.09);
  --chrome-bg: rgba(5, 5, 5, 0.66);
  --chrome-text: #f2f2f2;
  --chrome-muted: #d4d4d4;
  --code-bg: #050505;
  --code-text: #fff;
  --switch-text: #d2d2d2;
  --switch-selected-text: #fff;
  --step-bg: #fff;
  --step-text: #111;
  --image-bg: #111;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-bottom: 44px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    linear-gradient(rgba(225, 38, 47, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225, 38, 47, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 18% 18%, rgba(225, 38, 47, 0.05) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 28%, rgba(242, 106, 33, 0.045) 0 1px, transparent 2px),
    linear-gradient(180deg, rgba(225, 38, 47, 0.025), transparent 220px),
    var(--bg);
  background-size: 44px 44px, 44px 44px, 220px 180px, 260px 220px, auto, auto;
  color: var(--text);
  line-height: 1.5;
}

.container {
  width: min(1600px, calc(100% - 72px));
  margin: 0 auto;
  padding-inline: 0;
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 20;
  width: min(1600px, calc(100% - 72px));
  margin: 14px auto 0;
  border: 0;
  border-radius: 999px;
  background: var(--chrome-bg);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  box-shadow:
    0 18px 48px rgba(15, 23, 42, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.22);
}

.site-header .container {
  width: 100%;
  padding-inline: 26px;
}

.header-inner {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 136px;
  height: auto;
  display: block;
}

.brand-logo-dark,
:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
  display: block;
}

.header-title {
  flex: 1;
  min-width: 180px;
}

.header-title strong {
  display: block;
  color: var(--chrome-text);
  font-size: 16px;
  line-height: 1.2;
}

.header-title span {
  display: block;
  color: var(--chrome-muted);
  font-size: 12px;
  line-height: 1.3;
}

h1 {
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.95;
  margin: 0 0 14px;
  letter-spacing: 0;
}

.hero-text {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  margin: 0;
}

.audience-text {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 14px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.hero-badges span {
  border: 1px solid var(--soft-border);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(14px) saturate(1.14);
  -webkit-backdrop-filter: blur(14px) saturate(1.14);
}

:root[data-theme="dark"] .hero-badges span {
  background: rgba(17, 17, 17, 0.72);
}

.guide-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

.guide-switch button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--switch-text);
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition:
    color 160ms ease,
    opacity 160ms ease;
}

.guide-switch button[aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
}

:root[data-theme="dark"] .guide-switch button[aria-selected="true"] {
  background: #fff;
  color: #111;
}

.header-link {
  color: var(--switch-text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link {
  color: var(--switch-text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--switch-selected-text);
}

.login-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(225, 38, 47, 0.16);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

.login-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(225, 38, 47, 0.24);
  filter: saturate(1.08) brightness(1.03);
}

.login-link:active {
  transform: translateY(0) scale(0.98);
  box-shadow: inset 0 2px 8px rgba(90, 12, 12, 0.28);
}

.login-link svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.header-link:hover {
  color: var(--switch-selected-text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.nav-icon-link {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

.theme-toggle:hover,
.nav-icon-link:hover {
  transform: translateY(-1px);
  border-color: rgba(242, 106, 33, 0.42);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.theme-toggle:active,
.nav-icon-link:active {
  transform: translateY(0) scale(0.96);
  box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.14);
}

.theme-toggle svg,
.nav-icon-link svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.theme-toggle .sun-icon,
:root[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

main {
  padding-top: 34px;
}

.intro-panel {
  display: grid;
  gap: 24px;
  padding: 24px 0 14px;
  margin-bottom: 14px;
}

.intro-copy {
  max-width: 920px;
}

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

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 12px;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.concept-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 6px 12px;
  align-items: center;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--soft-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(1.16);
  -webkit-backdrop-filter: blur(16px) saturate(1.16);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.04);
}

:root[data-theme="dark"] .concept-card {
  background: rgba(17, 17, 17, 0.72);
}

.concept-card strong {
  color: var(--text);
  line-height: 1.2;
}

.concept-card p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.concept-icon {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 28px rgba(225, 38, 47, 0.16);
  position: relative;
}

.concept-icon::before,
.concept-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
}

.concept-icon-auth::before {
  width: 12px;
  height: 12px;
  left: 15px;
  top: 10px;
}

.concept-icon-auth::after {
  width: 20px;
  height: 10px;
  left: 11px;
  top: 23px;
}

.concept-icon-connect::before {
  width: 9px;
  height: 9px;
  left: 9px;
  top: 17px;
  box-shadow: 16px -9px 0 rgba(255, 255, 255, 0.88), 18px 10px 0 rgba(255, 255, 255, 0.88);
}

.concept-icon-connect::after {
  left: 14px;
  top: 20px;
  width: 20px;
  height: 2px;
  transform: rotate(-18deg);
}

.concept-icon-permission::before {
  left: 11px;
  top: 9px;
  width: 20px;
  height: 24px;
  border-radius: 6px;
}

.concept-icon-permission::after {
  left: 16px;
  top: 17px;
  width: 11px;
  height: 7px;
  border-radius: 0;
  border-left: 3px solid rgba(225, 38, 47, 0.58);
  border-bottom: 3px solid rgba(225, 38, 47, 0.58);
  background: transparent;
  transform: rotate(-45deg);
}

.security-panel {
  padding: 18px;
  border: 1px solid rgba(4, 120, 87, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(4, 120, 87, 0.055), transparent 130px),
    var(--surface);
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.security-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--soft-border);
  border-radius: 8px;
  background: var(--card);
}

.security-item strong {
  display: block;
  margin: 0 0 5px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.security-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.security-item code {
  display: inline;
  padding: 1px 5px;
  font-size: 12px;
  white-space: nowrap;
}

.explain-panel,
.requirements-panel,
.connection-panel {
  background: var(--surface);
  border: 1px solid var(--soft-border);
  border-radius: 8px;
}

.explain-panel,
.requirements-panel {
  padding: 18px;
}

.explain-panel h2,
.requirements-panel h2,
.section-heading h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.explain-panel p {
  margin: 0;
  color: var(--muted);
}

.requirements-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.requirements-panel li + li {
  margin-top: 4px;
}

.connection-panel {
  padding: 18px;
  border-color: rgba(225, 38, 47, 0.14);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.06);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 10px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-box {
  position: relative;
  background: var(--card);
  border: 1px solid var(--soft-border);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.quick-box:hover {
  border-color: rgba(225, 38, 47, 0.22);
}

.copy-card {
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.copy-card:hover,
.copy-card:focus-visible {
  border-color: rgba(225, 38, 47, 0.36);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  outline: 0;
}

.copy-card:active {
  transform: translateY(1px);
}

.copy-status {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(4, 120, 87, 0.12);
  color: var(--ok-text, #047857);
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.copy-card.is-copied .copy-status {
  opacity: 1;
}

.quick-box h3 {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--muted);
}

.quick-box p {
  margin: 6px 0 10px;
  color: var(--muted);
}

.quick-box code {
  display: block;
  width: 100%;
  font-size: 13px;
}

code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--code-text);
  padding: 7px 8px;
  border-radius: 6px;
  word-break: break-word;
}

.guide {
  padding: 24px 0 34px;
  scroll-margin-top: 20px;
}

.guide-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--soft-border);
  border-radius: 12px;
  background:
    radial-gradient(circle at 86% 18%, rgba(225, 38, 47, 0.07), transparent 28%),
    var(--surface);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.05);
}

.guide-selector h2 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.2;
}

.guide-selector p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.guide[hidden] {
  display: none;
}

.guide-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.4fr) minmax(0, 0.6fr);
  gap: 18px;
  align-items: end;
  margin: 0 0 16px;
  padding-top: 8px;
  border-top: 1px solid var(--soft-border);
}

.guide-heading h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  margin: 0 0 8px;
  letter-spacing: 0;
}

.guide-heading p {
  color: var(--muted);
  font-size: 15px;
  max-width: none;
  margin: 0;
}

.step {
  position: relative;
  margin: 16px 0;
}

.step-number {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  background: var(--step-bg);
  border: 1px solid var(--step-bg);
  color: var(--step-text);
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--soft-border);
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(260px, 0.38fr) minmax(0, 0.62fr);
  align-items: start;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.04);
}

.step-content {
  padding: 68px 20px 16px;
  position: sticky;
  top: 88px;
}

.guide > .step:nth-of-type(even) .step-content {
  grid-column: 2;
  grid-row: 1;
}

.guide > .step:nth-of-type(even) .step-card {
  grid-template-columns: minmax(0, 0.62fr) minmax(260px, 0.38fr);
}

.guide > .step:nth-of-type(even) .image-wrap {
  grid-column: 1;
  grid-row: 1;
}

.guide > .step:nth-of-type(even) .step-number {
  left: calc(62% + 16px);
}

.step-content h3 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: 0;
}

.step-content p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.image-wrap {
  padding: 10px;
}

.image-wrap img {
  width: 100%;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--image-bg);
}

.note {
  margin: 18px 0 0;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.note h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.note p {
  margin: 6px 0;
}

.note code {
  display: block;
  width: 100%;
  max-width: 100%;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
}

.note ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--chrome-bg);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  box-shadow: 0 -18px 46px rgba(15, 23, 42, 0.08);
  color: var(--chrome-muted);
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 820px) {
  .site-header {
    top: 8px;
    width: calc(100% - 20px);
    margin-top: 8px;
    border-radius: 24px;
  }

  .site-header .container {
    padding-inline: 14px;
  }

  .header-inner {
    min-height: 0;
    display: flex;
    gap: 6px 10px;
    padding: 8px 5px 8px 5px;
  }

  .brand-block {
    flex-direction: row;
    justify-content: flex-start;
    width: auto;
    flex: 1;
  }

  .brand-logo {
    width: 104px;
    flex: 0 0 auto;
  }

  .header-title {
    min-width: 0;
    width: auto;
  }

  .header-title strong,
  .header-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-title strong {
    font-size: 14px;
  }

  .header-title span {
    font-size: 11px;
  }

  .nav-actions {
    flex: 0 0 auto;
  }

  .overview-grid,
  .concept-grid,
  .security-grid,
  .detail-grid,
  .guide-selector,
  .guide-heading {
    grid-template-columns: 1fr;
  }

  .guide-selector {
    display: grid;
  }

  .guide-selector .guide-switch {
    width: 100%;
  }

  .guide-selector .guide-switch button {
    flex: 1;
  }

  h1 {
    font-size: clamp(36px, 13vw, 52px);
  }

  .intro-panel {
    padding-top: 10px;
  }

  .section-heading {
    display: block;
  }

  .step-card {
    grid-template-columns: 1fr;
  }

  .guide > .step:nth-of-type(even) .step-card {
    grid-template-columns: 1fr;
  }

  .step-content {
    position: static;
    padding-top: 66px;
  }

  .step-number {
    top: 16px;
    left: 16px;
  }

  .guide > .step:nth-of-type(even) .step-content,
  .guide > .step:nth-of-type(even) .image-wrap {
    grid-column: auto;
    grid-row: auto;
  }

  .guide > .step:nth-of-type(even) .step-number {
    left: 16px;
  }

  .container {
    width: calc(100% - 20px);
    padding-inline: 0;
  }
}

@media (max-width: 480px) {
  .site-header .container {
    padding-inline: 12px;
  }

  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 7px 12px 8px;
  }

  .brand-block {
    display: contents;
  }

  .brand-logo {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 116px;
  }

  .nav-actions {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .header-title {
    grid-column: 1 / -1;
    grid-row: 2;
    display: block;
    width: 100%;
    min-width: 0;
    padding-top: 5px;
    border-top: 1px solid rgba(225, 38, 47, 0.12);
    text-align: center;
  }

  .header-title strong,
  .header-title span {
    display: inline;
    font-size: 13px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .header-title strong::after {
    content: " ";
  }

  .login-link {
    min-height: 36px;
    padding: 0 14px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .note {
    padding: 16px;
  }

  .note code {
    padding: 10px 11px;
    font-size: 13px;
  }
}

@media (max-width: 1120px) and (min-width: 821px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step-card {
    grid-template-columns: minmax(200px, 0.42fr) minmax(0, 0.58fr);
  }

  .guide > .step:nth-of-type(even) .step-card {
    grid-template-columns: minmax(0, 0.58fr) minmax(200px, 0.42fr);
  }

  .guide > .step:nth-of-type(even) .step-number {
    left: calc(58% + 16px);
  }
}
