.kb-demo {
  --kb-step-time: 5s;
  --kb-cycle: calc(3 * var(--kb-step-time));
  min-height: 0;
  padding: clamp(24px, 4vw, 42px) 12px 78px;
}

.kb-demo .notes-phone {
  position: relative;
  top: auto;
  width: min(274px, 100%);
  user-select: none;
}

.kb-demo .notes-screen {
  width: 100%;
}

.kb-demo .app {
  /* Компенсируем масштаб .app из notes.css, когда корпус телефона сужается. */
  width: calc(100% / 0.6718);
}

.kb-demo .notes-screen::after {
  position: absolute;
  bottom: 6px;
  left: 30%;
  width: 40%;
  height: 3px;
  border-radius: 3px;
  background: #1f2328;
  content: "";
}

.kb-scene {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.kb-directory {
  opacity: 1;
}

.kb-navbar {
  grid-template-columns: 40px minmax(0, 1fr) 40px;
}

.kb-navbar::before {
  width: 12px;
  height: 12px;
  justify-self: center;
  border-bottom: 3px solid;
  border-left: 3px solid;
  transform: rotate(45deg);
  content: "";
}

.kb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.kb-tile {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  min-height: 140px;
  padding: 12px 16px;
  color: var(--ink);
}

.kb-tile-wide {
  grid-column: 1 / -1;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 110px;
}

.kb-tile img {
  object-fit: contain;
}

.kb-tile small,
.kb-entry small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.kb-offline {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 7px;
  background: #e8f0eb;
  color: #416c58;
  font-size: 12px;
  font-weight: 600;
}

.kb-content {
  padding-top: 14px;
}

.kb-entry {
  padding: 20px;
  color: var(--ink);
  font-size: 20px;
}

.kb-entry small {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.kb-entry img {
  border-radius: 50%;
}

.kb-schedule dt {
  margin: 20px 0 4px;
  color: #234b9b;
  font-size: 18px;
  font-weight: 650;
}

.kb-schedule dd {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.4;
}

.kb-steps {
  right: 70px;
  font-size: 11px;
}

.kb-pause {
  appearance: none;
  position: absolute;
  right: 15px;
  bottom: 15px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(16, 39, 105, 0.65);
  color: #fff;
  cursor: pointer;
}

.kb-pause::before {
  width: 11px;
  height: 14px;
  border-inline: 4px solid;
  content: "";
}

.kb-pause:checked::before {
  width: 0;
  height: 0;
  border: solid transparent;
  border-width: 8px 0 8px 13px;
  border-left-color: currentColor;
}

.kb-pause:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.kb-pause:checked ~ .notes-phone,
.kb-pause:checked ~ .notes-phone *,
.kb-pause:checked ~ .kb-steps .notes-step {
  animation-play-state: paused;
}

/* Экран, подсветка выбранной карточки и подпись используют одно смещение. */
.kb-guides { --kb-delay: calc(-2 * var(--kb-step-time)); }
.kb-memo  { --kb-delay: calc(-1 * var(--kb-step-time)); }

@media (prefers-reduced-motion: no-preference) {
  .kb-scene,
  .kb-choice,
  .kb-steps .notes-step {
    animation: kb-show-scene var(--kb-cycle) ease-in-out var(--kb-delay, 0s) infinite;
  }

  .kb-choice { animation-name: kb-press; }
  .kb-steps .notes-step { animation-name: kb-show-step; }
}

@keyframes kb-show-scene {
  0%, 30%, 100% { opacity: 1; transform: none; }
  33.33%, 70% { opacity: 0; transform: translateX(-24px); }
  80%, 96.67% { opacity: 0; transform: translateX(24px); }
}

@keyframes kb-press {
  0%, 23%, 33.33%, 100% { transform: none; border-color: var(--border); }
  27%, 30% { transform: scale(0.97); border-color: var(--ios-blue); }
}

@keyframes kb-show-step {
  0%, 30%, 100% { background: #fff; color: #245ef2; }
  33.33%, 96.67% { background: transparent; color: inherit; }
}

@media (prefers-reduced-motion: reduce) {
  .kb-demo { padding-bottom: 28px; }
  .kb-steps, .kb-pause { display: none; }
}
