:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #2f3135;
  --muted: #7d8391;
  --line: #e2e5ea;
  --blue: #4f86ed;
  --blue-dark: #2f6fe4;
  --yellow: #ffe24a;
  --yellow-hover: #ffd72d;
  --warning: #fff2be;
  --radius-lg: 34px;
  --radius-md: 22px;
  --shadow: 0 26px 80px rgba(22, 34, 57, .12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(79, 134, 237, .12), transparent 34rem),
    linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

img {
  display: block;
  max-width: 100%;
}

svg {
  display: block;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 34px;
}

.instruction {
  overflow: hidden;
  min-height: min(860px, calc(100vh - 40px));
  border: 1px solid rgba(226, 229, 234, .95);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: 56px minmax(90px, 1fr) auto;
  gap: 18px;
  align-items: center;
  height: 76px;
  padding: 0 clamp(18px, 3vw, 34px);
  background: rgba(255, 255, 255, .9);
}

.topbar__back,
.topbar__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 16px;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  transition: opacity .2s ease, background .2s ease, transform .2s ease;
}

.topbar__back {
  width: 48px;
}

.topbar__back:hover,
.topbar__close:hover {
  background: rgba(79, 134, 237, .08);
}

.topbar__back:disabled {
  cursor: default;
  opacity: .35;
}

.topbar__close {
  padding: 0 10px;
  font-size: clamp(18px, 2.7vw, 28px);
  font-weight: 500;
}

.topbar__progress {
  overflow: hidden;
  justify-self: center;
  width: min(100%, 330px);
  height: 14px;
  border-radius: 999px;
  background: #edf0f5;
}

.topbar__progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width .28s ease;
}

.instruction__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  min-height: calc(min(860px, calc(100vh - 40px)) - 76px);
}

.hero {
  display: grid;
  place-items: center;
  min-height: 620px;
  padding: clamp(22px, 4vw, 48px);
  background:
    linear-gradient(180deg, #fff 0%, #fff 68%, #f7fafc 100%);
}

.hero img {
  width: min(100%, 760px);
  max-height: min(650px, calc(100vh - 150px));
  object-fit: contain;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid #f0f2f5;
  background: #fff;
}

.content__inner {
  flex: 1;
  padding: clamp(28px, 5vw, 62px) clamp(24px, 4.8vw, 58px) 24px;
}

.step-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.step-meta::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

h1 {
  margin: 0 0 24px;
  color: var(--text);
  font-size: clamp(22px, 6.5vw, 30px);
  font-weight: 800;
  line-height: .96;
  letter-spacing: -.055em;
}

.lead {
  margin: 0;
  color: #3f4248;
  font-size: clamp(22px, 2.85vw, 34px);
  line-height: 1.18;
  letter-spacing: -.02em;
}

.notice {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding: 20px 24px;
  border-radius: 22px;
  color: #3f4248;
  background: var(--warning);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.25;
}

.notice svg {
  flex: 0 0 auto;
  color: #f4b700;
}

.person-fields {
  display: grid;
  gap: 16px;
  margin-top: 30px;
}

.field {
  min-width: 0;
}

.field__label {
  display: block;
  margin: 0 0 8px 24px;
  color: #9aa1ae;
  font-size: 14px;
  font-weight: 500;
}

.field__control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  align-items: center;
  min-height: 82px;
  border: 2px solid #e1e4ea;
  border-radius: 22px;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.field__control:focus-within {
  border-color: rgba(79, 134, 237, .55);
  box-shadow: 0 0 0 4px rgba(79, 134, 237, .12);
}

.field__input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0px 0px 0px 8px;
  border: 0;
  outline: 0;
  border-radius: 20px;
  color: #2f3135;
  background: transparent;
  font-size: clamp(14px, 2.5vw, 16px);
}

.field__input::placeholder {
  color: #a4aab5;
}

.copy-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-right: 8px;
  border-radius: 16px;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, color .2s ease;
  padding: 12px;
}

.copy-btn:hover {
  background: rgba(79, 134, 237, .08);
}

.copy-btn:active {
  transform: scale(.96);
}

.copy-btn.is-copied {
  color: #1f9d55;
}

.copy-btn__icon,
.copy-btn__icon::before {
  display: block;
  width: 18px;
  height: 22px;
  border: 3px solid currentColor;
  border-radius: 3px;
}

.copy-btn__icon {
  position: relative;
  transform: translate(3px, -3px);
}

.copy-btn__icon::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 9px;
  background: #fff;
}

.copy-status {
  min-height: 20px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.install-actions {
  display: grid;
  gap: 20px;
  margin-top: 32px;
}

.install-link {
  display: flex;
  align-items: center;
  gap: 18px;
  width: fit-content;
  color: var(--blue);
  text-decoration: none;
  font-size: clamp(14px, 6.5vw, 18px);
  line-height: 1.15;
  transition: opacity .2s ease, transform .2s ease;
}

.install-link:hover {
  opacity: .82;
  transform: translateX(2px);
}

.install-link svg {
  flex: 0 0 auto;
}

.bottom-nav {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 14px;
  padding: 24px clamp(24px, 4.8vw, 58px) clamp(28px, 4vw, 42px);
}

.bottom-nav__prev,
.bottom-nav__next {
  min-height: 72px;
  border-radius: 22px;
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 500;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, opacity .2s ease;
}

.bottom-nav__prev {
  color: #50545d;
  background: #f3f5f8;
}

.bottom-nav__next {
  color: #33353a;
  background: var(--yellow);
}

.bottom-nav__prev:hover,
.bottom-nav__next:hover {
  transform: translateY(-1px);
}

.bottom-nav__next:hover {
  background: var(--yellow-hover);
}

.bottom-nav__prev:disabled {
  cursor: default;
  opacity: .42;
  transform: none;
}

.steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.step-tab {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: #626875;
  background: rgba(255, 255, 255, .82);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.step-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 134, 237, .42);
}

.step-tab[aria-current="step"] {
  border-color: var(--blue);
  color: var(--text);
  background: #fff;
  box-shadow: 0 14px 34px rgba(79, 134, 237, .14);
}

.step-tab__image {
  overflow: hidden;
  aspect-ratio: 1.35 / 1;
  border-radius: 12px;
  background: #f7f9fb;
}

.step-tab__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.step-tab__number {
  font-size: 12px;
  font-weight: 800;
}

.step-tab__title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1020px) {
  .page {
    width: min(760px, calc(100% - 24px));
  }

  .instruction__layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero {
    min-height: clamp(260px, 43vh, 520px);
    padding: clamp(16px, 4vw, 34px);
  }

  .hero img {
    max-height: min(48vh, 520px);
  }

  .content {
    border-left: 0;
    border-top: 1px solid #f0f2f5;
  }

  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    background: #fff;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .instruction {
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    grid-template-columns: 54px minmax(90px, 1fr) auto;
    gap: 10px;
    height: 72px;
    padding: max(10px, env(safe-area-inset-top, 0px)) 18px 8px;
  }

  .topbar__progress {
    width: min(100%, 180px);
    height: 8px;
  }

  .topbar__close {
    font-size: 16px;
  }

  .hero {
    min-height: 0;
    height: clamp(245px, 40vh, 390px);
    padding: 10px 14px 16px;
  }

  .hero img {
    width: 100%;
    max-height: 100%;
  }

  .content {
    min-height: calc(100dvh - 72px - clamp(245px, 40vh, 390px));
  }

  .content__inner {
    padding: 34px 24px 12px;
  }

  .step-meta {
    margin-bottom: 14px;
    font-size: 12px;
  }

  h1 {
    margin-bottom: 22px;
    font-size: clamp(22px, 6.5vw, 30px);
  }

  .lead {
    font-size: clamp(25px, 6.2vw, 36px);
    line-height: 1.22;
  }

  .notice {
    margin-top: 28px;
    padding: 16px 18px;
    border-radius: 18px;
    font-size: clamp(20px, 5vw, 28px);
  }

  .person-fields {
    margin-top: 26px;
    gap: 14px;
  }

  .field__label {
    margin-left: 18px;
    font-size: 14px;
  }

  .field__control {
    min-height: 74px;
    border-radius: 18px;
    grid-template-columns: minmax(0, 1fr) 54px;
  }

  .field__input {
    padding-left: 12px;
    font-size: 16px;
  }

  .copy-btn {
    margin-right: 4px;
  }

  .install-actions {
    gap: 24px;
    margin-top: 34px;
  }

  .install-link {
    font-size: clamp(14px, 6.5vw, 18px);
  }

  .bottom-nav {
    position: sticky;
    bottom: 0;
    grid-template-columns: 1fr;
    padding: 18px 24px calc(20px + var(--safe-bottom));
    background: linear-gradient(180deg, rgba(255,255,255,0), #fff 22%, #fff 100%);
  }

  .bottom-nav__prev {
    display: none;
  }

  .bottom-nav__next {
    min-height: 72px;
    width: 100%;
    border-radius: 18px;
    font-size: 28px;
  }

  .steps {
    display: none;
  }
}

@media (max-width: 390px) {
  .topbar__close {
    font-size: 16px;
  }

  .content__inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  h1 {
    font-size: 26px;
  }

  .lead {
    font-size: 16px;
  }

  .bottom-nav {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
