:root {
  color-scheme: light dark;
  --background: #f2f2f7;
  --group: #fff;
  --text: #000;
  --secondary: #636366;
  --separator: #d1d1d6;
  --blue: #007aff;
  --link: #0066d6;
  --button-text: #fff;
  --button-background: #0066d6;
  --field: #f2f2f7;
  --danger: #b42318;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; background: var(--background); color: var(--text); font-size: 17px; line-height: 1.45; }
button, input, textarea { font: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; overflow-wrap: break-word; }
h2, h3 { font-size: 17px; line-height: 1.3; font-weight: 600; }
a { color: var(--link); text-decoration: none; text-underline-offset: .18em; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
::selection { background: var(--blue); color: var(--button-text); }
.wrap, .auth-shell { width: min(680px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: absolute; z-index: 10; top: 8px; left: 8px; padding: 10px 16px; border-radius: 10px; background: var(--group); transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 64px; }
.brand { font-size: 17px; font-weight: 600; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; }
nav a { font-size: 15px; }
nav a[aria-current="page"] { text-decoration: underline; }
.page-header { padding: 24px 0 28px; }
.app-icon { width: 48px; height: 48px; border-radius: 11px; margin-bottom: 16px; }
.page-header h1 { margin-bottom: 8px; }
.page-intro, .article-intro { color: var(--secondary); font-size: 15px; line-height: 1.5; }
.group-section { margin-bottom: 24px; }
.section-label { margin: 0 16px 7px; color: var(--secondary); font-size: 13px; line-height: 1.35; font-weight: 400; text-transform: uppercase; letter-spacing: .01em; }
.group-list { padding: 0; margin: 0; list-style: none; background: var(--group); border-radius: 16px; }
.group-row { position: relative; padding: 14px 16px; }
.group-row + .group-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.group-row h3 { margin-bottom: 4px; }
.group-row p { font-size: 15px; color: var(--secondary); }
.steps { counter-reset: step; }
.steps .group-row { display: flex; gap: 12px; counter-increment: step; }
.steps .group-row::after { content: counter(step); order: -1; flex: 0 0 20px; color: var(--secondary); font-size: 15px; line-height: 22px; font-variant-numeric: tabular-nums; }
.steps .group-row + .group-row::before { left: 48px; }
.steps .group-row > div { min-width: 0; }
.section-footer { margin: 7px 16px 0; color: var(--secondary); font-size: 13px; line-height: 1.4; }
.group-content { padding: 16px; border-radius: 16px; background: var(--group); font-size: 15px; }
.group-content p { margin-bottom: 10px; color: var(--secondary); }
.site-footer { padding: 2px 16px 32px; color: var(--secondary); }
.site-footer nav { gap: 22px; margin-bottom: 14px; }
.site-footer nav a { font-size: 13px; }
.site-footer small { font-size: 12px; }

.article { padding-top: 24px; }
.article-header { margin-bottom: 24px; }
.article-header h1 { margin-bottom: 8px; }
.version { font-size: 12px; color: var(--secondary); margin-bottom: 16px; }
.article-intro { margin-top: 8px; }
.contact-link { display: inline-block; margin-top: 12px; }
.article-content section { margin-bottom: 20px; padding: 18px 16px; border-radius: 16px; background: var(--group); }
.article-content h2 { margin-bottom: 12px; }
.article-content p, .article-content li { font-size: 15px; line-height: 1.6; }
.article-content p { margin-bottom: 12px; }
.article-content p:last-child, .article-content ul:last-child, .article-content ol:last-child { margin-bottom: 0; }
.article-content ul, .article-content ol { padding-left: 22px; margin: 0 0 12px; }
.article-content li { padding-left: 2px; margin-bottom: 8px; }
.article-content strong { font-weight: 600; }
.article-content a { overflow-wrap: anywhere; }
.connection-address { margin: 16px 0; padding: 12px; border-radius: 10px; background: var(--field); }
.connection-address span { display: block; font-size: 12px; color: var(--secondary); margin-bottom: 4px; }
.connection-address code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
details { border-top: 1px solid var(--separator); padding-block: 13px; }
details:last-child { padding-bottom: 0; }
summary { cursor: pointer; font-size: 15px; font-weight: 500; }
details p { padding-top: 12px; }

.auth-shell { max-width: 520px; padding-block: 48px 28px; }
.auth-header { margin-bottom: 24px; }
.auth-header img { width: 48px; height: 48px; border-radius: 11px; margin-bottom: 16px; }
.auth-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 24px; color: var(--text); font-size: 17px; font-weight: 600; }
.auth-brand img { margin-bottom: 0; }
.auth-header h1 { margin-bottom: 10px; }
.auth-intro { color: var(--secondary); font-size: 15px; line-height: 1.5; }
.auth-card { margin-bottom: 16px; padding: 16px; border-radius: 16px; background: var(--group); }
.auth-card > h2 { margin-bottom: 12px; }
.auth-card > p + p { margin-top: 12px; }
.auth-intro + form, .auth-intro + .permission-list { margin-top: 16px; }
.auth-intro + .button { display: flex; margin-top: 20px; }
.auth-note { color: var(--secondary); font-size: 13px; line-height: 1.45; margin-top: 12px; }
.auth-card .auth-note:first-child { margin-top: 0; }
.account-row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--separator); }
.account-label { font-size: 15px; }
.account-value { color: var(--secondary); font-size: 15px; overflow-wrap: anywhere; }
.permission-list { list-style: none; margin: 0; padding: 0; }
.permission-row { padding-block: 12px; font-size: 15px; }
.permission-row:first-child { padding-top: 0; }
.permission-row:last-child { padding-bottom: 0; }
.permission-row + .permission-row { border-top: 1px solid var(--separator); }
.permission-row p { margin-top: 4px; color: var(--secondary); font-size: 13px; }
.permission-row strong { font-weight: 600; }
.form-group { margin: 0; padding: 0; border: 0; }
.form-row { display: block; margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
.field-label { display: block; margin-bottom: 6px; font-size: 15px; }
.form-input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--separator); border-radius: 10px; background: var(--group); color: var(--text); outline-offset: 2px; }
.form-input::placeholder { color: var(--secondary); opacity: 1; }
.auth-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 12px 20px; border: 0; border-radius: 999px; background: var(--button-background); color: var(--button-text); font-size: 17px; font-weight: 600; line-height: 1.3; text-align: center; text-decoration: none; cursor: pointer; }
.button:hover { filter: brightness(.96); text-decoration: none; }
.button-secondary { background: var(--group); color: var(--link); }
.auth-card .button-secondary { background: var(--field); }
.button:disabled { opacity: .45; cursor: default; }
.auth-alert { margin-block: 16px; padding: 14px 16px; border-radius: 16px; background: var(--group); color: var(--danger); font-size: 15px; }
.auth-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 24px; color: var(--secondary); font-size: 13px; }
.auth-footer a { font-size: 13px; }

@media (prefers-color-scheme: dark) {
  :root {
    --background: #000;
    --group: #1c1c1e;
    --text: #fff;
    --secondary: #aeaeb2;
    --separator: #38383a;
    --blue: #0a84ff;
    --link: #64aaff;
    --button-text: #fff;
    --field: #2c2c2e;
    --danger: #ff9b93;
  }
}

@media (max-width: 480px) {
  .site-header { min-height: 56px; }
  .page-header, .article { padding-top: 16px; }
  .auth-shell { padding-top: 32px; }
}

@media (prefers-contrast: more) {
  :root { --secondary: #48484a; --separator: #8e8e93; --blue: #0062cc; --link: #0054b0; }
}

@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  :root { --secondary: #d1d1d6; --separator: #8e8e93; --blue: #005bbb; --link: #8fc1ff; }
}

@media print {
  :root { color-scheme: light; --background: #fff; --group: #fff; --text: #000; --secondary: #333; }
  .site-header, .site-footer, .skip-link, .auth-actions, .auth-footer { display: none; }
  .wrap, .auth-shell { width: 100%; max-width: none; padding: 0; }
  .article-content section { padding: 0; }
  a { color: inherit; }
  details { break-inside: avoid; }
  details > p { display: block !important; }
}
