:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #17212b;
  --muted: #667085;
  --line: #d8e0ea;
  --panel: #ffffff;
  --blue: #00aaff;
  --blue-dark: #0877b8;
  --green: #16a163;
  --red: #e5484d;
  --shadow: 0 24px 70px rgba(29, 44, 62, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(145deg, rgba(0, 170, 255, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(22, 161, 99, 0.11), transparent 30%),
    var(--bg);
  color: var(--ink);
}

a {
  color: var(--blue-dark);
}

.shell {
  width: min(1080px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 32px;
  align-items: center;
  padding: 48px 0;
}

.page {
  min-height: 100vh;
}

.page-inner {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.hero-band {
  padding: 64px 0 42px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 32px;
  align-items: center;
}

.hero-visual {
  position: relative;
  display: grid;
  align-items: end;
  justify-items: end;
  width: 100%;
  min-height: 430px;
  aspect-ratio: 1 / 1;
  isolation: isolate;
  touch-action: manipulation;
}

.avito-balls {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.avito-ball {
  position: absolute;
  display: block;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0) scale(1);
  transition: transform 180ms ease, opacity 180ms ease;
  will-change: transform;
}

.avito-ball::after {
  content: none;
}

.avito-ball-blue {
  width: clamp(160px, 45%, 206px);
  left: 2%;
  top: 26%;
  background: #00aaff;
}

.avito-ball-green {
  width: clamp(128px, 34%, 158px);
  left: 45%;
  top: 4%;
  background: #97cf26;
}

.avito-ball-red {
  width: clamp(120px, 32%, 150px);
  right: -3%;
  top: 41%;
  background: #ff4053;
}

.avito-ball-yellow {
  width: clamp(116px, 30%, 142px);
  left: 20%;
  bottom: 2%;
  background: #ffcf00;
}

.hero-visual:hover .avito-ball {
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0) scale(1.015);
}

.hero-visual.is-pressed .avito-ball-blue,
.hero-visual.is-pressed .avito-ball-green,
.hero-visual.is-pressed .avito-ball-red,
.hero-visual.is-pressed .avito-ball-yellow {
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0) scale(0.985);
}

.hero-card {
  position: relative;
  z-index: 1;
  width: min(322px, 84%);
  margin: 0 10px 34px 0;
  background: rgba(255, 255, 255, 0.84);
}

.hero-card .status-dot {
  margin-bottom: 14px;
}

.hero-card h2 {
  margin-top: 0;
  font-size: 26px;
}

.hero-card p {
  max-width: none;
}

.page-band {
  padding: 30px 0 54px;
}

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

.info-grid article {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.info-grid h2,
.document h2 {
  margin: 0 0 10px;
  font-size: 21px;
}

.info-grid p,
.document p {
  color: #344054;
  font-size: 16px;
}

.meta-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.meta-list div {
  display: grid;
  gap: 6px;
}

.meta-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.meta-list code {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 18px 0;
}

.footer-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.document {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.document h1 {
  font-size: 44px;
  line-height: 1.06;
}

.document h2 {
  margin-top: 28px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--blue-dark);
  font-weight: 750;
  text-decoration: none;
}

.shell.single {
  grid-template-columns: minmax(320px, 560px);
  justify-content: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  margin: 20px 0 16px;
  max-width: 620px;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 14px 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

p {
  margin: 0;
  max-width: 610px;
  font-size: 18px;
  line-height: 1.55;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #e9eef5;
  color: #243447;
}

.muted {
  color: var(--muted);
  font-size: 15px;
}

.scope-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.scope-row.compact {
  margin-top: 4px;
}

.scope-row span,
.toolbar span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 8px 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.auth-panel {
  border: 1px solid rgba(216, 224, 234, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(16px);
}

.auth-modes {
  display: block;
  margin-top: 22px;
}

.auth-mode-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f9;
  padding: 4px;
}

.auth-toggle label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-radius: 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

#auth-credentials:checked ~ .auth-toggle label[for="auth-credentials"],
#auth-oauth:checked ~ .auth-toggle label[for="auth-oauth"] {
  background: #ffffff;
  color: var(--blue-dark);
  box-shadow: 0 4px 14px rgba(29, 44, 62, 0.11);
}

.auth-method {
  display: none;
  margin-top: 18px;
}

#auth-credentials:checked ~ .auth-method-credentials,
#auth-oauth:checked ~ .auth-method-oauth {
  display: grid;
  gap: 18px;
}

.auth-panel.result {
  text-align: center;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(22, 161, 99, 0.12);
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(229, 72, 77, 0.12);
}

.mini-chat {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.topic-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--blue-dark);
  font-weight: 800;
}

.bubble {
  width: fit-content;
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.35;
}

.bubble.left {
  background: #eaf2fb;
}

.bubble.right {
  justify-self: end;
  background: #ddf6e9;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.primary,
button.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin: 20px 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary:hover,
button.primary:hover {
  background: var(--blue-dark);
}

.secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue-dark);
  text-decoration: none;
  font-size: 15px;
  font-weight: 750;
}

.setup-block {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.setup-block.compact {
  margin: 22px 0 0;
  text-align: left;
}

.setup-form {
  display: grid;
  gap: 10px;
}

.oauth-setup {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.oauth-setup summary {
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.oauth-setup[open] summary {
  margin-bottom: 14px;
}

.field-label {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 170, 255, 0.14);
  outline: none;
}

.copy-input {
  color: #243447;
  background: #f9fbfd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.warning {
  margin-top: 18px;
  border: 1px solid #ffd3a6;
  border-radius: 8px;
  background: #fff7ed;
  padding: 12px;
  color: #9a4d00;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}

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

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 24px;
    padding: 28px 0;
  }

  h1 {
    font-size: 40px;
  }

  p {
    font-size: 16px;
  }

  .hero-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    width: min(430px, 100%);
    min-height: 386px;
    margin: 0 auto;
  }

  .hero-card {
    width: min(328px, 92%);
    margin: 0 auto 26px;
  }

  .hero-card h2 {
    font-size: 23px;
  }

  .hero-band {
    padding-top: 32px;
  }

  .footer-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .document h1 {
    font-size: 36px;
  }
}
