:root {
  color-scheme: light dark;
  --navy-950: #07142a;
  --navy-900: #0d2144;
  --navy-800: #123261;
  --navy-700: #214a82;
  --ink: #102348;
  --muted: #586b88;
  --teal: #0082fb;
  --teal-dark: #0064e1;
  --blue: #0866ff;
  --blue-dark: #0055d6;
  --violet: #7657ff;
  --cyan: #00a8ff;
  --blue-soft: #eaf3ff;
  --warm: #fff2e7;
  --warm-ink: #b64d17;
  --paper: #ffffff;
  --canvas: #f3f7fb;
  --surface-soft: #f6f8fc;
  --surface-raised: #eef3f9;
  --code-head: #e5ecf5;
  --line: #dce5ef;
  --shadow: 0 22px 60px rgba(17, 37, 64, 0.12);
  --radius-lg: 12px;
  --radius-md: 8px;
  --content: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { color: var(--navy-950); background: rgba(29,181,181,.32); }

a { color: var(--blue-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--teal-dark); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 4px;
  color: white;
  background: var(--blue);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(calc(100% - 40px), var(--content));
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(0, 100, 225, .2);
  border-radius: 7px;
  background: var(--paper);
  box-shadow: 0 5px 15px rgba(0, 100, 225, .12);
}
.brand-mark img { display: block; width: 24px; height: 18px; }

.header-link { color: var(--muted); font-size: .92rem; font-weight: 700; text-decoration: none; }

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: center;
  gap: 42px;
  width: min(calc(100% - 40px), var(--content));
  min-height: 430px;
  margin: 18px auto 0;
  padding: clamp(42px, 7vw, 78px);
  border-radius: 16px;
  color: white;
  background:
    radial-gradient(circle at 88% 8%, rgba(118,87,255,.32), transparent 31%),
    radial-gradient(circle at 65% 115%, rgba(0,168,255,.2), transparent 38%),
    linear-gradient(135deg, var(--navy-900), var(--navy-950));
  box-shadow: var(--shadow);
}

.hero-copy { position: relative; z-index: 1; max-width: 720px; }
.eyebrow { margin: 0 0 12px; color: #48a7ff; font-size: .78rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; letter-spacing: -.035em; line-height: 1.1; }
h1 { max-width: 720px; margin-bottom: 22px; font-size: clamp(2.6rem, 6.8vw, 5rem); }
.hero-lede { max-width: 680px; margin: 0; color: #d7e2ee; font-size: clamp(1.05rem, 2vw, 1.28rem); line-height: 1.65; }

.hero-orbit { position: relative; width: 240px; aspect-ratio: 1; justify-self: end; }
.orbit-ring { position: absolute; inset: 10px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; }
.orbit-ring::before, .orbit-ring::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(61,145,255,.5); }
.orbit-ring::before { inset: 34px -14px; transform: rotate(55deg); }
.orbit-ring::after { inset: 34px -14px; transform: rotate(-55deg); }
.orbit-core { position: absolute; inset: 50%; display: grid; place-items: center; width: 76px; height: 76px; transform: translate(-50%, -50%); border: 1px solid rgba(255,255,255,.16); border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: 0 0 60px rgba(8,102,255,.4); }
.orbit-core img { display: block; width: 46px; height: auto; }

.library { width: min(calc(100% - 40px), 1120px); margin: 84px auto; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); }
.guide-count { padding: 8px 13px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--paper); font-size: .84rem; font-weight: 750; }

.guide-category + .guide-category { margin-top: 44px; }
.category-heading { margin: 0 0 16px; color: var(--blue-dark); font-size: 1.3rem; }
.guide-list { display: grid; gap: 24px; }
.guide-card { padding: clamp(28px, 5vw, 48px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: 0 16px 45px rgba(17,37,64,.07); }
.guide-card-topline, .card-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.tag { display: inline-flex; padding: 7px 12px; border-radius: 5px; color: white; background: linear-gradient(110deg, var(--blue-dark), var(--blue), var(--violet)); font-size: .74rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.reading-time { color: var(--muted); font-size: .86rem; font-weight: 700; }
.guide-card h3 { max-width: 690px; margin: 26px 0 14px; font-size: clamp(1.7rem, 4vw, 2.55rem); }
.guide-card p { max-width: 720px; margin: 0 0 30px; color: var(--muted); font-size: 1.04rem; }
.card-footer { padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.button { display: inline-flex; align-items: center; gap: 9px; padding: 11px 17px; border-radius: 6px; color: white; background: linear-gradient(110deg, var(--blue-dark), var(--blue)); font-weight: 800; text-decoration: none; box-shadow: 0 7px 18px rgba(8,102,255,.22); }
.card-footer .button { flex-shrink: 0; white-space: nowrap; }
.button:hover { color: white; background: var(--blue-dark); transform: translateY(-1px); }

@media (min-width: 960px) {
  .guide-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-card { display: flex; flex-direction: column; }
  .card-footer { margin-top: auto; }
}

.warning-strip { display: grid; grid-template-columns: 180px 1fr; gap: 28px; width: min(calc(100% - 40px), 900px); margin: 0 auto 84px; padding: 28px 32px; border-left: 4px solid #d45e21; border-radius: 0 var(--radius-md) var(--radius-md) 0; color: var(--ink); background: var(--warm); }
.warning-strip strong { color: var(--warm-ink); text-transform: uppercase; letter-spacing: .04em; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: min(calc(100% - 40px), var(--content)); margin: 0 auto; padding: 32px 0 42px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-footer a { font-weight: 750; text-decoration: none; }

/* Guide reader */
.guide-page { background: var(--paper); }
.reading-progress { position: fixed; z-index: 90; inset: 0 0 auto; height: 3px; background: transparent; }
.reading-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan), var(--violet)); box-shadow: 0 0 12px rgba(8,102,255,.45); }
.guide-page .site-header { background: var(--paper); }
.guide-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 8vw, 92px) max(24px, calc((100vw - var(--content)) / 2));
  color: white;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-950));
}
.guide-hero::after { content: ""; position: absolute; width: 360px; height: 360px; right: max(-160px, calc((100vw - var(--content)) / 2 - 170px)); top: -120px; border: 1px solid rgba(118,87,255,.32); border-radius: 50%; box-shadow: 0 0 0 55px rgba(8,102,255,.05), 0 0 0 110px rgba(118,87,255,.035); }
.guide-hero > * { position: relative; z-index: 1; }
.guide-hero h1 { margin-bottom: 22px; font-size: clamp(2.7rem, 6vw, 5rem); }
.guide-hero h1 span { color: #eef5fb; font-size: .72em; }
.device-list { display: flex; flex-wrap: wrap; gap: 10px; color: #c5d4e4; font-size: 1.05rem; }
.device-list i { color: #49a6ff; font-style: normal; }
.guide-intro { max-width: 760px; margin: 28px 0 34px; color: #d7e2ee; font-size: 1.08rem; }
.guide-meta { display: flex; flex-wrap: wrap; gap: 12px 28px; color: #aac0d5; font-size: .88rem; }
.guide-meta strong { color: white; }
.guide-shell { display: grid; grid-template-columns: 230px minmax(0, 760px); gap: clamp(36px, 6vw, 76px); width: min(calc(100% - 40px), var(--content)); margin: 0 auto; padding: 72px 0 100px; }
.guide-nav { align-self: start; position: sticky; top: 24px; padding: 22px 0; border-top: 3px solid var(--blue); }
.nav-label { margin: 0 0 12px; color: var(--muted); font-size: .74rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.guide-nav nav { display: grid; }
.guide-nav a { padding: 7px 0; color: var(--muted); font-size: .9rem; font-weight: 680; text-decoration: none; }
.guide-nav a:hover { color: var(--blue); }
.guide-article { min-width: 0; }
.guide-article p, .guide-article dd, .guide-article li { overflow-wrap: anywhere; }
.source-guide ol { display: grid; gap: 12px; margin: 0 0 24px; padding-left: 1.45rem; }
.source-guide ol li { padding-left: .2rem; }
.source-guide ol li::marker { color: var(--blue-dark); font-weight: 850; }
.source-guide h3 { margin: 34px 0 16px; font-size: 1.2rem; }
.source-quote { margin: 0 0 34px; border-left: 4px solid #d45e21; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.source-quote p + p { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(212,94,33,.25); }
.guide-meta a { color: white; font-weight: 800; }
.project-credit { margin-top: 0; }
.license-notice { margin-top: 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.license-notice summary { color: var(--blue-dark); font-weight: 850; cursor: pointer; }
.license-notice p { margin: 16px 0 0; color: var(--muted); font-size: .86rem; }
.firmware-notice { scroll-margin-top: 24px; margin: 0 0 20px; padding: 28px 30px; border: 1px solid rgba(212,94,33,.38); border-left: 4px solid #d45e21; border-radius: 0 7px 7px 0; background: var(--warm); }
.firmware-notice-label { margin: 0 0 8px !important; color: var(--warm-ink); font-size: .76rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.firmware-notice h2 { margin: 0 0 14px; color: var(--ink); font-size: clamp(1.45rem, 3vw, 2rem); }
.firmware-notice ul { display: grid; gap: 8px; margin: 18px 0; padding-left: 22px; }
.firmware-notice li::marker { color: #d45e21; }
.firmware-notice-foot { margin: 0 !important; padding-top: 16px; border-top: 1px solid rgba(212,94,33,.28); }
.guide-section { scroll-margin-top: 24px; padding: 0 0 76px; }
.guide-section + .guide-section { padding-top: 70px; border-top: 1px solid var(--line); }
.section-kicker { margin: 0 0 8px; color: var(--blue); font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.guide-section h2 { margin-bottom: 28px; font-size: clamp(2rem, 4vw, 3rem); }
.section-intro { max-width: 700px; margin: -10px 0 34px; color: var(--muted); font-size: 1.06rem; }
.subsection-title { margin: 40px 0 20px; color: var(--blue); font-size: 1.04rem; letter-spacing: .03em; text-transform: uppercase; }
.guide-article p { margin-top: 0; }
.guide-article code { padding: .13em .34em; border-radius: 3px; color: var(--ink); background: var(--surface-raised); font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .9em; }
.check-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.check-list li { position: relative; padding: 16px 18px 16px 50px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.check-list li::before { content: "✓"; position: absolute; left: 18px; top: 15px; color: var(--teal-dark); font-weight: 900; }
.callout { margin-top: 30px; padding: 26px 28px; border-radius: var(--radius-md); }
.callout h3 { margin-bottom: 9px; font-size: 1rem; letter-spacing: .01em; text-transform: uppercase; }
.callout p:last-child { margin-bottom: 0; }
.callout.caution { margin: 30px 0 28px; color: var(--ink); background: var(--warm); }
.callout.caution h3 { color: var(--warm-ink); }
.callout.warning { margin: 0 0 28px; padding: 28px 30px; border: 1px solid rgba(185, 28, 28, .3); border-left: 5px solid #b91c1c; border-radius: 0 10px 10px 0; color: #3b0a0a; background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%); box-shadow: 0 10px 22px rgba(185, 28, 28, .12); }
.callout.warning h3 { margin-bottom: 12px; color: #7f1d1d; font-size: 1.02rem; letter-spacing: .08em; }
.callout.warning p { color: #4b1111; }
.callout.warning strong { color: #7f1d1d; }
.callout.info { color: var(--ink); background: var(--blue-soft); }
.callout.info h3 { color: var(--blue-dark); }
.compact-callout { margin: 0 0 30px; padding: 18px 20px; border-left: 3px solid #d45e21; border-radius: 0 6px 6px 0; }
.compact-callout h3 { margin-bottom: 6px; }
.compact-callout p { font-size: .94rem; }
.steps { display: grid; gap: 26px; }
.steps.compact-top { margin-top: 34px; }
.step { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 18px; align-items: start; }
.step-number { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 7px; color: white; background: linear-gradient(145deg, var(--blue), var(--violet)); font-size: 1.12rem; font-weight: 850; box-shadow: 0 8px 20px rgba(8,102,255,.17); }
.step h3 { margin: 2px 0 6px; font-size: 1.16rem; letter-spacing: -.015em; }
.step p { margin: 0; color: #273b57; }
.footnote { margin-top: 26px !important; color: var(--muted); font-size: .9rem; }
.code-block { overflow: hidden; margin: 30px 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 12px 9px 18px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--code-head); font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.code-head button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--paper); font: inherit; cursor: pointer; }
.code-head button:hover { border-color: var(--teal); }
.code-block pre { overflow-x: auto; margin: 0; padding: 22px 26px 10px; }
.code-block pre code { padding: 0; color: var(--ink); background: transparent; font-size: .98rem; font-weight: 700; }
.code-block > p { margin: 0; padding: 0 26px 18px; color: var(--muted); font-size: .87rem; }
.command-options { display: grid; gap: 8px; margin: 22px 0 28px; }
.command-option { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-soft); }
.command-option > strong { color: var(--blue-dark); font-size: .9rem; }
.command-field { display: flex; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.command-field code { flex: 1; overflow-x: auto; min-width: 0; padding: .52rem .72rem; color: var(--ink); background: transparent; white-space: nowrap; }
.command-field button { flex: none; min-width: 48px; padding: 0 8px; border: 0; border-left: 1px solid var(--line); color: var(--ink); background: var(--code-head); font: inherit; font-size: .64rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.command-field button:hover { color: var(--blue-dark); background: var(--paper); }
.command-note span { color: var(--muted); font-size: .92rem; }
.table-wrap { overflow-x: auto; margin: 22px 0 30px; border: 1px solid var(--line); border-radius: 7px; }
.comparison-table { margin-bottom: 8px; }
.comparison-footnote { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 14px 16px; text-align: left; white-space: nowrap; }
.troubleshooting-table { table-layout: fixed; }
.troubleshooting-table th, .troubleshooting-table td, .troubleshooting-table td code { white-space: normal; overflow-wrap: anywhere; }
.mode-table th, .mode-table td { white-space: normal; }
.mode-table td:nth-child(2), .mode-table td:nth-child(3) { text-align: left; }
.mode-status { display: inline-flex; align-items: center; gap: 7px; }
.mode-status-icon { width: 17px; height: 17px; flex: none; }
.comparison-summary th, .comparison-summary td { white-space: normal; }
th { color: white; background: var(--navy-900); font-size: .8rem; letter-spacing: .02em; }
tbody tr:nth-child(odd) { background: var(--surface-soft); }
tbody tr + tr { border-top: 1px solid var(--line); }
td code { white-space: nowrap; }
.quick-fixes { display: grid; margin: 0; }
.quick-fixes div { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 22px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.quick-fixes dt { color: var(--blue-dark); font-weight: 800; }
.quick-fixes dd { margin: 0; color: var(--muted); }
.reference-group { margin-top: 34px; }
.reference-group h3 { margin-bottom: 12px; color: var(--blue-dark); font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; }
.reference-group a { display: grid; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.reference-group a strong { color: var(--blue-dark); }
.reference-group a span { color: var(--muted); font-size: .9rem; }
.reference-group a:hover strong { color: var(--teal-dark); }
.credits { margin-top: 34px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-soft); }
.credits p { margin-bottom: 10px; color: var(--muted); }
.credits a { font-weight: 800; }
.guide-nav a[aria-current] { color: var(--blue-dark); }
.guide-nav a[aria-current]::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 0; border-radius: 2px; background: var(--blue); }

@media (max-width: 760px) {
  .site-header { min-height: 64px; }
  .header-link { display: none; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 42px 28px 48px; border-radius: 12px; }
  .hero-orbit { position: absolute; right: -68px; bottom: -72px; width: 210px; opacity: .6; }
  .hero-copy { padding-right: 8px; }
  .library { margin: 64px auto; }
  .guide-card-topline, .card-footer, .section-heading, .site-footer { align-items: flex-start; flex-direction: column; }
  .card-footer { gap: 18px; }
  .button { width: 100%; justify-content: center; }
  .warning-strip { grid-template-columns: 1fr; gap: 8px; margin-bottom: 64px; }
  .guide-shell { grid-template-columns: 1fr; padding-top: 44px; }
  .guide-nav { position: static; padding: 18px; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 7px; background: var(--surface-soft); }
  .guide-nav nav { grid-template-columns: 1fr 1fr; gap: 2px 18px; }
  .quick-fixes div { grid-template-columns: 1fr; gap: 4px; }
  .command-option { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 470px) {
  .guide-nav nav { grid-template-columns: 1fr; }
  .step { grid-template-columns: 42px minmax(0, 1fr); gap: 13px; }
  .step-number { width: 42px; height: 42px; border-radius: 6px; }
  .callout { padding: 22px; }
  .firmware-notice { padding: 22px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy-950: #040811;
    --navy-900: #09152b;
    --navy-800: #0e2346;
    --navy-700: #173d72;
    --ink: #edf3ff;
    --muted: #a8b6ce;
    --teal: #28a0ff;
    --teal-dark: #64baff;
    --blue: #3f86ff;
    --blue-dark: #62a1ff;
    --violet: #9b83ff;
    --cyan: #32c6ff;
    --blue-soft: #101f39;
    --warm: #2d1c18;
    --warm-ink: #ff9c69;
    --paper: #0b1220;
    --canvas: #070c15;
    --surface-soft: #101a2a;
    --surface-raised: #17243a;
    --code-head: #131f32;
    --line: #26354d;
    --shadow: 0 22px 60px rgba(0, 0, 0, .34);
  }

  .brand-mark { border-color: rgba(63,134,255,.34); background: #f6f9ff; box-shadow: 0 5px 18px rgba(8,102,255,.2); }
  .hero { background: radial-gradient(circle at 88% 8%, rgba(118,87,255,.4), transparent 31%), radial-gradient(circle at 65% 115%, rgba(0,168,255,.24), transparent 38%), linear-gradient(135deg, #0c2144, #050b17); }
  .guide-card { box-shadow: 0 18px 50px rgba(0,0,0,.24); }
  .guide-hero { background: radial-gradient(circle at 90% 0, rgba(118,87,255,.26), transparent 30%), linear-gradient(135deg, #0b2042, #050a14); }
  .step p { color: #cfdaeb; }
  .callout.caution { color: var(--ink); }
  .code-head button { border-color: #33435c; }
  th { background: #10284f; }
  .tag { color: white; }
}

@media print {
  .site-header, .guide-nav, .reading-progress, .code-head button, .site-footer { display: none !important; }
  .guide-hero { padding: 38px 0; background: white; color: var(--ink); }
  .guide-hero h1 span, .guide-intro, .device-list, .guide-meta { color: var(--ink); }
  .guide-shell { display: block; width: 100%; padding: 38px 0; }
  .guide-section { break-inside: auto; }
  .step, .callout, .code-block, table { break-inside: avoid; }
  body { background: white; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
