:root {
  color-scheme: light;
  --bg: #fdf8fa;
  --bg-alt: #fff5f0;
  --surface: #ffffff;
  --rose: #e85d75;
  --rose-dark: #b84d62;
  --lavender: #8b7baf;
  --lavender-deep: #7b6b9a;
  --lavender-soft: #c9b8d8;
  --lavender-line: #e8d4e8;
  --ink: #4a4060;
  --ink-soft: #5a5070;
  --text: #3d3548;
  --muted: #7a7088;
  --line: #e4d6e8;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 14px 40px rgba(74, 64, 96, 0.1);
  --shadow-soft: 0 6px 20px rgba(74, 64, 96, 0.06);
  --toc-w: 220px;
  --header-h: 68px;
  --device-ar: 835 / 717;
  --app-ar: 339 / 393;
  --icon-ar: 542 / 428;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.manual {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--rose);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--rose-dark);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 1000;
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.skip-link:focus {
  left: 12px;
}

.grain::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 9999;
}

.manual-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.manual-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--lavender-deep);
  text-decoration: none;
}

.brand span {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.manual-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--lavender), var(--rose));
  color: #fff;
}

.btn-primary:hover {
  color: #fff;
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.btn-ghost:hover {
  color: var(--lavender-deep);
  border-color: var(--lavender-soft);
}

.manual-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  display: grid;
  grid-template-columns: var(--toc-w) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.manual-toc {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.toc-label {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.manual-toc nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manual-toc a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.3;
}

.manual-toc a:hover,
.manual-toc a.is-active {
  background: var(--bg-alt);
  color: var(--lavender-deep);
}

.manual-main {
  min-width: 0;
}

.manual-cover {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 280px);
  gap: 28px;
  align-items: center;
  padding: 32px;
  margin-bottom: 36px;
  background: linear-gradient(145deg, #fff 0%, var(--bg-alt) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rose);
}

.manual-cover h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
  color: var(--lavender-deep);
}

.manual-lead {
  margin: 0 0 16px;
  color: var(--ink-soft);
  max-width: 42ch;
}

.manual-meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.manual-cover-visual img {
  width: 100%;
  border-radius: var(--radius-sm);
}

.manual-section {
  margin-bottom: 40px;
}

.section-head h2 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--lavender-deep);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--lavender-line);
}

.step-grid {
  display: grid;
  gap: 18px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
  break-inside: avoid;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.step-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lavender), var(--rose));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-badge--heart {
  font-size: 0.95rem;
}

.step-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--lavender-deep);
}

.step-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.step-side {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}

.step-shot {
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  display: block;
  line-height: 0;
  flex-shrink: 0;
}

.step-shot--device {
  width: min(280px, 100%);
}

.step-shot--app {
  width: min(180px, 100%);
}

.step-shot--icon {
  width: min(160px, 100%);
}

.step-shot img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.step-caption {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}

.step-caption--center {
  text-align: center;
}

.step-stack .step-caption {
  text-align: center;
  max-width: 52ch;
}

.step-caption strong {
  color: var(--lavender-deep);
}

.step-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
}

.step-list li {
  margin-bottom: 6px;
}

.step-list li::marker {
  color: var(--rose);
}

.step-note {
  margin: 12px 0 0;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--muted);
}

.step-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.step-qr img {
  width: min(180px, 70%);
}

.step-qr-labels {
  display: flex;
  gap: 32px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--lavender-deep);
}

.step-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  justify-content: center;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.step-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  display: inline-block;
  background: var(--rose);
  border-radius: 50%;
}

.dot-short {
  width: 10px;
  height: 10px;
}

.dot-long {
  width: 10px;
  height: 18px;
  border-radius: 5px;
}

.manual-legal {
  margin-top: 48px;
  padding: 28px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-soft);
  break-inside: avoid;
}

.manual-legal h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--lavender-deep);
  text-align: center;
}

.manual-legal h3 {
  margin: 14px 0 4px;
  font-size: 0.92rem;
  color: var(--lavender);
}

.manual-legal p {
  margin: 0 0 6px;
}

.legal-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 12px 0;
}

.legal-logos img {
  height: 18px;
  width: auto;
}

.legal-contact {
  text-align: center;
  margin-top: 12px !important;
  color: var(--lavender-deep);
}

.manual-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.manual-footer p {
  margin: 0;
}

@media (max-width: 900px) {
  .manual-shell {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .manual-toc {
    position: static;
  }

  .manual-toc nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .manual-cover {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .manual-cover-visual {
    max-width: 220px;
    margin: 0 auto;
  }

  .step-side {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .manual-header-inner {
    flex-wrap: wrap;
  }

  .manual-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .manual-header-actions .btn {
    flex: 1;
  }

  .step-card {
    padding: 16px;
  }
}

@media print {
  @page {
    margin: 16mm;
    size: A4;
  }

  body.manual {
    background: #fff;
    font-size: 10pt;
  }

  .grain::before,
  .skip-link,
  .manual-header,
  .manual-toc {
    display: none !important;
  }

  .manual-shell {
    display: block;
    max-width: none;
    padding: 0;
  }

  .manual-cover {
    box-shadow: none;
    page-break-after: always;
    border: none;
    padding: 0;
    margin-bottom: 0;
  }

  .manual-section {
    page-break-before: auto;
  }

  .section-head h2 {
    page-break-after: avoid;
  }

  .step-card {
    box-shadow: none;
    page-break-inside: avoid;
    margin-bottom: 8mm;
  }

  .step-shot--device {
    width: 55mm;
  }

  .step-shot--app {
    width: 40mm;
  }

  .step-shot--icon {
    width: 35mm;
  }

  .step-qr img {
    width: 45mm;
  }

  .manual-legal {
    page-break-before: always;
    box-shadow: none;
  }

  .manual-footer {
    margin-top: 8mm;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  a[href^="mailto:"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: var(--muted);
  }
}
