.guide-page {
  background: #0d0e12;
  color-scheme: dark;
}

.guide-page[data-theme="light"] {
  background: #f3f5fa;
  color-scheme: light;
}

.guide-page :is(.client-guide, .admin-page) {
  --ink: #f5f5f7;
  --muted: #b6becb;
  --accent: #a6ceff;
  --accent-hover: #c6dfff;
  --line: #ffffff21;
  --paper: #191b22;
  --soft: #ffffff0a;
  --canvas: #0d0e12;
  --surface: #222630;
  --control: #ffffff0b;
  --control-hover: #ffffff16;
  --glass: linear-gradient(155deg, #282e3b, #1d212a);
  --selection: linear-gradient(155deg, #4b607c, #2b384d);
  --selection-edge: #7190b8;
  --selected-ink: #fff;
  --shine: #ffffff2c;
  --shadow: #0006;
  --success: #9de5c4;
  --success-bg: #204235;
  --error: #ff9d9d;
  --placeholder: #a0aabc;
  --glow-blue: #233650;
  --glow-violet: #201f34;
  --hero-halo: #5a83bd52;
  --hero-edge: #a3c5ee6e;
  --hero-symbol: #e8f1fe;
  --certificate-glass: linear-gradient(145deg, #a8c1e190, #46607f70 55%, #1c2736be);
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 680px 450px at 76% 0, var(--glow-blue), transparent 100%),
    radial-gradient(ellipse 490px 360px at 12% 2%, var(--glow-violet), transparent 100%),
    var(--canvas);
}

.guide-page[data-theme="light"] :is(.client-guide, .admin-page) {
  --ink: #1d1d1f;
  --muted: #515c6d;
  --accent: #0058ad;
  --accent-hover: #004883;
  --line: #192e5221;
  --paper: #fff;
  --soft: #f1f5fb;
  --canvas: #f3f5fa;
  --surface: #edf2fa;
  --control: #ffffffbd;
  --control-hover: #e5edf8;
  --glass: linear-gradient(155deg, #fff, #e7edf7);
  --selection: linear-gradient(155deg, #fff, #dbe9fc);
  --selection-edge: #83a9df;
  --selected-ink: #173254;
  --shine: #fff;
  --shadow: #20365514;
  --success: #226649;
  --success-bg: #e0f2e8;
  --error: #ad3338;
  --placeholder: #657489;
  --glow-blue: #d5e4fc;
  --glow-violet: #e5e3fb;
  --hero-halo: #99bbf0a6;
  --hero-edge: #809ec58f;
  --hero-symbol: #283e5a;
  --certificate-glass: linear-gradient(145deg, #ffffffd9, #dbe8f6c9 55%, #b5cae7c7);
}

.client-guide .wrap {
  --page-gutter: clamp(16px, 3.5vw, 48px);
  width: min(1160px, calc(100% - var(--page-gutter) * 2));
  padding-top: clamp(16px, 3.8vw, 38px);
}

.client-guide .workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 2.8vw, 28px);
}

.client-guide .journey {
  position: static;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: clamp(12px, 2.5vw, 24px);
}

.client-guide :is(.journey-title, .aside-help) {
  grid-column: 1 / -1;
  margin: 0;
}

.client-guide .journey-item {
  min-width: 0;
  min-height: 48px;
  align-items: center;
  padding: 0;
}

.client-guide .journey-item::after { display: none; }
.client-guide .journey-item strong { margin-top: 0; }
.client-guide .aside-help {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 0;
  border: 0;
}
.client-guide .aside-help :is(.help-symbol, p) { margin: 0; }
.client-guide .aside-help p { max-width: none; }

.client-guide .guide-top,
.client-guide .guide-preferences,
.client-guide .language-toggle {
  display: flex;
  align-items: center;
}

.client-guide .guide-top { justify-content: space-between; }
.client-guide .guide-mark {
  border-radius: 13px;
  display: block;
  box-shadow: 0 7px 24px var(--shadow);
}

.client-guide .guide-preferences { gap: 9px; }

.client-guide :is(.language-toggle, .theme-toggle) {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--shine), 0 5px 18px var(--shadow);
  border-radius: 999px;
}

.client-guide .language-toggle { padding: 3px; }
.client-guide :is(.language-toggle button, .theme-toggle) {
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: background .2s ease, color .2s ease;
}

.client-guide .language-toggle button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  min-width: 41px;
  min-height: 36px;
  font-size: .75rem;
  font-weight: 680;
  letter-spacing: .035em;
}

.client-guide .language-toggle button[aria-pressed="true"] {
  color: var(--selected-ink);
  background: var(--selection);
  box-shadow: inset 0 1px 0 var(--shine);
}

.client-guide .language-toggle button:hover { color: var(--ink); }
.client-guide .theme-toggle { width: 44px; height: 44px; }
.client-guide .theme-toggle:hover { background: var(--control-hover); }
.client-guide .theme-toggle svg { width: 20px; height: 20px; }
.guide-page[data-theme="dark"] .theme-moon,
.guide-page[data-theme="light"] .theme-sun { display: none; }

.client-guide .hero { padding: clamp(32px, 5vw, 70px) 0 clamp(26px, 4.7vw, 57px); }
.client-guide .hero h1 {
  max-width: 14em;
  font-size: clamp(2.25rem, 6vw, 4.65rem);
  font-weight: 670;
  line-height: 1.04;
  letter-spacing: -.048em;
  text-wrap: balance;
}

.client-guide .hero-art { display: none; }

@media (min-width: 960px) {
  .client-guide .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(248px, 31vw, 400px);
    align-items: center;
    gap: clamp(24px, 4vw, 64px);
  }

  .client-guide .hero h1 { text-wrap: pretty; }

  .client-guide .hero-art {
    position: relative;
    display: grid;
    place-items: center;
    height: clamp(210px, 24vw, 310px);
    isolation: isolate;
    pointer-events: none;
  }

  .client-guide .hero-art::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(ellipse at 50% 50%, var(--hero-halo), transparent 67%);
  }

  .client-guide .hero-phone {
    position: absolute;
    left: 50%;
    top: 49%;
    width: 37%;
    height: 89%;
    border: 1px solid var(--hero-edge);
    border-radius: clamp(20px, 2.5vw, 36px);
    background: var(--glass);
    box-shadow: inset 0 0 0 4px var(--control), inset 0 1px 2px var(--shine), 0 22px 40px var(--shadow);
    transform: translate(-46%, -50%) rotate(16deg);
  }

  .client-guide .hero-phone::before {
    content: "";
    display: block;
    width: 34%;
    height: 5%;
    margin: 7% auto 0;
    border-radius: 999px;
    background: var(--canvas);
    box-shadow: 0 1px 0 var(--shine);
  }

  .client-guide .hero-certificate {
    display: grid;
    place-items: center;
    z-index: 1;
    width: 49%;
    aspect-ratio: 1.55;
    border: 1px solid var(--hero-edge);
    border-radius: clamp(14px, 1.8vw, 22px);
    background: var(--certificate-glass);
    box-shadow: inset 0 1px 0 var(--shine), 0 18px 35px var(--shadow);
    color: var(--hero-symbol);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transform: translate(-18%, 18%) rotate(-10deg);
  }

  .client-guide .hero-certificate svg {
    width: 49%;
    height: auto;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .client-guide .hero-certificate circle { fill: var(--surface); }
}

.client-guide :is(.panel, .journey, .faq, dialog) {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 14px 38px var(--shadow);
}

.client-guide .panel { padding: clamp(18px, 3vw, 36px); }
.client-guide .faq { border-radius: var(--radius); padding: clamp(16px, 3vw, 28px); margin-bottom: 32px; }
.client-guide .faq details { padding-inline: 0; }
.client-guide .faq details + details { margin-top: 10px; }

.client-guide :is(.journey-title, .journey-item small, .mini-label, .hint, .details-body, .guide-example-note, .check-row, .eyebrow) { color: var(--muted); }
.client-guide .details-body strong { color: var(--ink); }
.client-guide :is(.step-circle, .detail-number, .pill:not(.ready), .icon-button) {
  background: var(--surface);
  color: var(--muted);
}
.client-guide .journey-item.current .step-circle,
.client-guide .journey-item.done .step-circle {
  border-color: var(--selection-edge);
  background: var(--selection);
  color: var(--selected-ink);
}

.client-guide .pill.ready { background: var(--success-bg); color: var(--success); }
.client-guide :is(.help-symbol, .chevron) { border-color: var(--muted); }
.client-guide .primary { background: var(--accent); color: var(--canvas); }
.client-guide .primary:hover:not(:disabled) { background: var(--accent-hover); }
.guide-page[data-theme="light"] .client-guide .primary { color: #fff; }
.guide-page .client-guide #get-udid { background: #176b59; color: #fff; }
.guide-page .client-guide #get-udid:hover:not(:disabled) { background: #105343; }

.client-guide .secondary {
  background: var(--control);
  border-color: var(--line);
  color: var(--ink);
}

.client-guide .secondary:hover:not(:disabled) { background: var(--control-hover); }

.client-guide .developer-video {
  gap: 10px;
  max-inline-size: 100%;
  background: rgba(255, 0, 51, .09);
  border-color: rgba(255, 0, 51, .42);
}

.client-guide .developer-video:hover:not(:disabled) {
  background: rgba(255, 0, 51, .16);
}

.client-guide .developer-video .youtube-icon {
  flex: none;
  width: 28px;
  height: 20px;
  stroke: none;
}

.client-guide :is(.installer-action, .neutral, .message-box, .certificate-kit, input[type="text"], .image-pair, .system-shot a, .screenshot-link, .guide-image-dialog > img) {
  background: var(--soft);
  border-color: var(--line);
}

.client-guide .neutral { color: var(--muted); }
.client-guide input::placeholder { color: var(--placeholder); }
.client-guide input[aria-invalid="true"] { border-color: var(--error); }
.client-guide .field-error { color: var(--error); }
.client-guide :is(figcaption, .screenshot-grid figcaption, .phone-shot figcaption, .system-shot figcaption, .image-pair figcaption) { color: var(--muted); }
.client-guide .phone-shot img { border-color: var(--line); }
.client-guide .guide-image-dialog:has(> img[src$=".svg"]) {
  width: min(560px, calc(100% - 24px));
}

.client-guide .guide-image-dialog > img[src$=".svg"] {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(86vh - 80px);
  max-height: calc(86dvh - 80px);
  margin-inline: auto;
  background: transparent;
}

.client-guide .device-profile-guide {
  border-top: 0;
  margin-block: clamp(24px, 3.8vw, 40px);
}

@media (max-width: 480px) {
  .client-guide .guide-details.device-profile-guide > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

.client-guide .device-controls {
  width: min(100%, 520px);
  margin-inline: auto;
}

.client-guide .device-controls legend { margin-inline: auto; }
.client-guide .device-controls .device-strip { max-width: none; }
.guide-page .client-guide .device-controls :is(#get-udid, #enter-udid) {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-inline: auto;
  white-space: normal;
  text-align: center;
}

.guide-page .client-guide #enter-udid {
  margin-top: 10px;
  background: #29374a;
  border-color: #52657e;
  color: #f1f6ff;
}

.guide-page .client-guide #enter-udid:hover:not(:disabled) { background: #35465e; }
.guide-page[data-theme="light"] .client-guide #enter-udid {
  background: #e9f0f9;
  border-color: #a9bbd2;
  color: #21354e;
}
.guide-page[data-theme="light"] .client-guide #enter-udid:hover:not(:disabled) { background: #dbe7f5; }

@media (max-width: 740px) {
  .client-guide #udid-submit { width: 100%; }
}

.client-guide .device-instructions li { margin-bottom: clamp(18px, 3vw, 32px); }
.client-guide .device-instructions li:last-child { margin-bottom: 0; }
.guide-page[lang="en"] .device-instructions [data-ru-only-shot] { display: none; }

.client-guide .image-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px auto 24px;
}
.client-guide :is(.image-pair, .screenshot-grid) figure > figcaption:first-child {
  margin: 0 0 10px;
}
.client-guide .screenshot-grid figure > figcaption { text-align: start; }
.client-guide .details-body > .screenshot-grid:first-child { margin-top: 0; }
.client-guide .system-shot { width: min(100%, 300px); }
.client-guide .system-shot.wide-shot { width: min(100%, 430px); }
.client-guide .installer-guide .details-body {
  width: min(100%, 800px);
  margin-inline: auto;
}
.client-guide .screenshot-grid {
  width: min(100%, 740px);
  margin-inline: auto;
}
.client-guide .details-body .developer-video {
  display: flex;
  width: fit-content;
  margin-inline: auto;
}

@media (min-width: 960px) {
  .client-guide .device-instructions .instruction-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(34px, 4vw, 58px);
    row-gap: 28px;
  }

  .client-guide .device-instructions li { margin-bottom: 0; }
  .client-guide .device-instructions li > :is(.image-pair, .system-shot) {
    margin-bottom: 0;
  }
}

.client-guide :is(.system-shot a, .screenshot-link, .image-pair) {
  box-shadow: inset 0 1px 0 var(--shine), 0 8px 22px var(--shadow);
}

.client-guide dialog::backdrop { background: #050914aa; }
.client-guide .noscript { background: var(--surface); color: var(--ink); }

.client-guide :is(.guide-tabs, .device-strip) {
  border-color: var(--line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--shine), 0 4px 16px var(--shadow);
}

.client-guide .device-strip label > span {
  background: var(--control);
  color: var(--ink);
}

.client-guide .device-strip label input:checked + span,
.client-guide .guide-tabs button[aria-selected="true"] {
  border-color: var(--selection-edge);
  background: var(--selection);
  color: var(--selected-ink);
  box-shadow: inset 0 1px 0 var(--shine), 0 3px 10px var(--shadow);
}

.client-guide .device-strip svg { color: #2b5078; }
.client-guide .guide-tabs button {
  color: var(--ink);
  background: var(--control);
}

.client-guide .guide-tabs button:hover,
.client-guide :is(.system-shot a, .screenshot-link):hover { border-color: var(--selection-edge); }
.client-guide .guide-drag-glass {
  border-color: #ffffff9c;
  background: linear-gradient(150deg, #ffffff55, #ffffff18 52%, #99beff32);
  box-shadow: inset 0 1px 4px #ffffff8c, 0 2px 10px var(--shadow);
}

@media (max-width: 740px) {
  .client-guide .hero h1 { font-size: clamp(2.1rem, 8.9vw, 3.35rem); }
  .client-guide .journey { gap: 6px; }
  .client-guide .aside-help { display: none; }
  .client-guide .panel, .client-guide .faq { border-radius: 21px; }
}

.guide-page[lang="en"] .client-guide .image-pair {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}
.guide-page[lang="en"] .client-guide .image-pair img {
  display: block;
  width: min(100%, 360px);
  max-height: none;
  border-radius: 9px;
}

@media (max-width: 480px) {
  .client-guide .guide-tabs button { font-size: clamp(.65rem, 2.8vw, .875rem); }
}

@media (max-width: 360px) {
  .client-guide .kit-downloads .button { font-size: .9rem; padding-inline: 9px; }
  .client-guide .guide-tabs button { font-size: .75rem; }
}

@media screen and (prefers-reduced-motion: no-preference) {
  .client-guide .hero h1 { animation: guide-lift .72s cubic-bezier(.22,.7,.25,1) backwards; }
  .client-guide .hero-art { animation: guide-lift .9s cubic-bezier(.22,.7,.25,1) .1s backwards; }
  .client-guide .journey { animation: guide-lift .64s cubic-bezier(.22,.7,.25,1) .12s backwards; }

  .client-guide [data-guide-reveal] {
    --reveal-offset: 14px;
    --reveal-scale: 1;
    --reveal-delay: 0ms;
    --reveal-time: .57s;
  }

  .client-guide :is(.lead, .device-instructions li > p, .guide-details .details-body > p)[data-guide-reveal] {
    --reveal-delay: 45ms;
  }

  .client-guide figure[data-guide-reveal] {
    --reveal-offset: 19px;
    --reveal-scale: .985;
    --reveal-delay: 80ms;
    --reveal-time: .78s;
  }

  .client-guide [data-guide-reveal="pending"]:not(:focus-within) {
    opacity: .08;
    transform: translateY(var(--reveal-offset)) scale(var(--reveal-scale));
  }

  .client-guide [data-guide-reveal="visible"]:not(:focus-within) {
    animation: guide-lift var(--reveal-time) cubic-bezier(.22,.7,.25,1) var(--reveal-delay) backwards;
  }

  .client-guide .content .button { transition: background .18s, transform .18s; }
  .client-guide .content .button:active:not(:disabled) { transform: scale(.98); }

  @keyframes guide-lift {
    from {
      opacity: .08;
      transform: translateY(var(--reveal-offset, 14px)) scale(var(--reveal-scale, 1));
    }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

@media (max-width: 600px) {
  .client-guide .journey { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-guide .journey-item { flex-direction: row; text-align: left; padding-inline: 6px; }
}

.client-guide .back-to-steps { display: none; }

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .client-guide .back-to-steps {
    position: sticky;
    top: max(12px, env(safe-area-inset-top, 0px));
    z-index: 2;
    display: flex;
    width: max-content;
    min-height: 44px;
    margin: 0 0 12px auto;
    padding: 0 14px;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--accent);
    box-shadow: 0 4px 16px var(--shadow);
    font-size: .875rem;
    font-weight: 650;
    text-decoration: none;
  }

  .client-guide .back-to-steps:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

/* Keep the badge beside the first line, even when the instruction wraps. */
.client-guide .numbered-guide-list,
.client-guide .faq .numbered-guide-list {
  list-style: none;
  padding-inline-start: 0;
  counter-reset: guide-step;
}
.client-guide .numbered-guide-list[start="5"] { counter-reset: guide-step 4; }
.client-guide .numbered-guide-list[start="11"] { counter-reset: guide-step 10; }
.client-guide .numbered-guide-list > li {
  position: relative;
  min-height: 1.75rem;
  padding-inline-start: 2.4rem;
  counter-increment: guide-step;
}
.client-guide .numbered-guide-list > li::before,
.client-guide .detail-number {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  border: 1px solid var(--selection-edge);
  border-radius: 50%;
  background: var(--selection);
  color: var(--selected-ink);
  font-size: .875rem;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.client-guide .numbered-guide-list > li::before { content: counter(guide-step); }
.client-guide .device-instructions li > strong { display: block; }
.client-guide .guide-details > summary > span:has(> .detail-number) {
  position: relative;
  min-height: 1.75rem;
  padding-inline-start: 2.4rem;
}
.client-guide .journey-item .step-circle,
.client-guide .step-heading h2[data-step]::before {
  display: grid;
  place-items: center;
  border: 1px solid var(--selection-edge);
  border-radius: .32em;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.client-guide .journey-item .step-circle {
  flex: 0 0 auto;
  width: 2.125rem;
  height: 2.125rem;
  font-size: 1.125rem;
}

.client-guide .step-heading h2[data-step] {
  --step-badge-size: clamp(2.25rem, 5vw, 2.75rem);
  position: relative;
  min-height: var(--step-badge-size);
  padding-inline-start: calc(var(--step-badge-size) + .65rem);
  padding-block-start: .16em;
}

.client-guide .step-heading h2[data-step]::before {
  content: attr(data-step);
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: var(--step-badge-size);
  height: var(--step-badge-size);
  background: var(--selection);
  color: var(--selected-ink);
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
}
.client-guide .step-heading h2[data-step] .step-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.client-guide .journey-item {
  border-radius: 12px;
  padding: 4px 6px;
}
.client-guide .journey-item.current {
  background: var(--selection);
  box-shadow: inset 0 0 0 1px var(--selection-edge);
}
.client-guide .journey-item.current strong {
  color: var(--selected-ink);
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .guide-page {
    --guide-navigation-top: max(8px, env(safe-area-inset-top, 0px));
    scroll-padding-top: calc(var(--guide-navigation-inset, 0px) + 12px);
  }
  .client-guide .journey {
    position: sticky;
    top: var(--guide-navigation-top);
    z-index: 3;
    gap: 4px;
    padding: 6px;
  }
  .client-guide :is(.journey-title, .aside-help, .journey-item small) {
    display: none;
  }
  .client-guide .journey-item {
    min-height: 44px;
  }
  .client-guide .journey .journey-item strong {
    overflow-wrap: anywhere;
  }
  .client-guide .back-to-steps {
    position: static;
  }
}

/* Keep lazy screenshots at their final height before their files arrive. */
.client-guide :is(.system-shot, .screenshot-grid) img[width][height] {
  width: 100%;
}
.order-message-line {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}
.order-message-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-end: .4em;
  vertical-align: -.13em;
  background-color: currentColor;
  -webkit-mask: var(--order-icon) center / contain no-repeat;
  mask: var(--order-icon) center / contain no-repeat;
}
.order-message-icon[data-icon="device"] { --order-icon: url('/assets/order-icons/device.svg'); }
.order-message-icon[data-icon="request"] { --order-icon: url('/assets/order-icons/request.svg'); }
