/* QA-Online user guide – responsive RTL help-center styles */
:root {
  --bg: #14151a;
  --bg-subtle: #1b1c22;
  --text: #e8e9ee;
  --text-muted: #a3a8b5;
  --border: #2b2d36;
  --accent: #a99fd1;
  --accent-hover: #c4bce3;
  --accent-soft: #24222f;
  --tip: #7cc8b2;
  --tip-bg: #17241f;
  --warn: #e6b450;
  --warn-bg: #2a2416;
  --important: #f0a0a0;
  --important-bg: #2c1a1a;
  --perm: #b8bfcc;
  --perm-bg: #1f2027;
  --radius: 8px;
  --topbar-h: 56px;
  --sidebar-w: 280px;
  --content-w: 760px;
  --font: 'Heebo', 'Assistant', 'Segoe UI', Arial, sans-serif;
  color-scheme: dark;
}

html[data-theme='light'] {
  --bg: #ffffff;
  --bg-subtle: #f7f7f9;
  --text: #1a1d26;
  --text-muted: #5b6272;
  --border: #e5e6ec;
  --accent: #3f3660;
  --accent-hover: #2a2340;
  --accent-soft: #f2f1f7;
  --tip: #2f6f5e;
  --tip-bg: #eef7f4;
  --warn: #8a5a00;
  --warn-bg: #fff7e6;
  --important: #9b2c2c;
  --important-bg: #fdf0f0;
  --perm: #4a5568;
  --perm-bg: #f4f5f7;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme='dark']) {
    --bg: #ffffff;
    --bg-subtle: #f7f7f9;
    --text: #1a1d26;
    --text-muted: #5b6272;
    --border: #e5e6ec;
    --accent: #3f3660;
    --accent-hover: #2a2340;
    --accent-soft: #f2f1f7;
    --tip: #2f6f5e;
    --tip-bg: #eef7f4;
    --warn: #8a5a00;
    --warn-bg: #fff7e6;
    --important: #9b2c2c;
    --important-bg: #fdf0f0;
    --perm: #4a5568;
    --perm-bg: #f4f5f7;
    color-scheme: light;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--topbar-h) + 16px);
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -48px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { top: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 6px; }
.brand b { font-weight: 700; }
.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-subtle); }

.search { position: relative; margin-inline-start: auto; width: min(360px, 100%); }
.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.search input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.search__results {
  position: absolute;
  inset-inline: 0;
  top: 42px;
  max-height: 70vh;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
}
.search__results a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.search__results a:hover,
.search__results a[aria-selected='true'] { background: var(--accent-soft); text-decoration: none; }
.search__results small { display: block; color: var(--text-muted); font-size: 12px; }
.search__results .snippet { display: block; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.search__results mark { background: transparent; color: var(--accent); font-weight: 700; }
.search__empty { padding: 10px; color: var(--text-muted); font-size: 14px; }

.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: nowrap;
}
.pdf-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
@media (max-width: 520px) {
  .pdf-btn span { display: none; }
  .pdf-btn { width: 36px; padding: 0; justify-content: center; }
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-btn .icon-moon { display: none; }
.theme-btn .icon-sun { display: block; }
html[data-theme='light'] .theme-btn .icon-sun { display: none; }
html[data-theme='light'] .theme-btn .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  html:not([data-theme='dark']) .theme-btn .icon-sun { display: none; }
  html:not([data-theme='dark']) .theme-btn .icon-moon { display: block; }
}

/* ---------- Layout ---------- */
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - var(--topbar-h)); }

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  flex: 0 0 var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 20px 12px 40px;
  border-inline-end: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
}
.nav-part + .nav-part { margin-top: 20px; }
.nav-part__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.nav-emoji {
  flex: 0 0 1.25em;
  width: 1.25em;
  text-align: center;
  line-height: 1.45;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 1em;
}
.nav-part__title .nav-emoji { font-size: 13px; line-height: 1; }
.sidebar ul { margin: 0; padding: 0; list-style: none; }
.sidebar li a {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  line-height: 1.45;
}
.sidebar li a:hover { background: var(--bg-subtle); text-decoration: none; }
.sidebar li a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav-sub { margin: 2px 0 6px !important; padding-inline-start: 12px !important; border-inline-start: 1px solid var(--border); margin-inline-start: 14px !important; }
.nav-sub a { padding: 4px 10px !important; font-size: 13px; color: var(--text-muted) !important; }
.nav-sub a.current { color: var(--accent) !important; }

main { flex: 1 1 auto; min-width: 0; padding: 40px 48px 80px; outline: none; }

.onpage {
  position: sticky;
  top: calc(var(--topbar-h) + 32px);
  flex: 0 0 220px;
  max-height: calc(100vh - var(--topbar-h) - 64px);
  overflow-y: auto;
  padding: 0 16px 0 24px;
  font-size: 13px;
}
.onpage__title { margin: 0 0 8px; font-weight: 700; color: var(--text-muted); font-size: 12px; }
.onpage ul { margin: 0; padding: 0; list-style: none; border-inline-start: 1px solid var(--border); }
.onpage a { display: block; padding: 4px 12px; color: var(--text-muted); line-height: 1.45; margin-inline-start: -1px; border-inline-start: 2px solid transparent; }
.onpage a:hover { color: var(--text); text-decoration: none; }
.onpage a.current { color: var(--accent); border-inline-start-color: var(--accent); }

/* ---------- Article typography ---------- */
.doc { max-width: var(--content-w); margin: 0 auto; }
.eyebrow { margin: 0 0 4px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.print-btn {
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.print-btn:hover { color: var(--text); border-color: var(--accent); }
.doc h1 { margin: 0 0 16px; font-size: 32px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.doc h2 { margin: 48px 0 12px; padding-top: 8px; font-size: 22px; line-height: 1.35; font-weight: 700; }
.doc h3 { margin: 28px 0 8px; font-size: 18px; font-weight: 700; }
.doc h4 { margin: 20px 0 6px; font-size: 16px; font-weight: 700; }
.doc p { margin: 0 0 14px; }
.doc ul,
.doc ol { margin: 0 0 16px; padding-inline-start: 24px; }
.doc li { margin: 4px 0; }
.doc li > ul,
.doc li > ol { margin: 4px 0; }
.doc ol > li::marker { color: var(--text-muted); font-weight: 500; }
.doc strong { font-weight: 700; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.doc code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  unicode-bidi: isolate;
}
.anchor { margin-inline-start: 8px; color: var(--text-muted); opacity: 0; font-weight: 400; }
h2:hover .anchor,
h3:hover .anchor,
.anchor:focus { opacity: 1; text-decoration: none; }

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc th,
.doc td { padding: 10px 14px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--border); }
.doc th { background: var(--bg-subtle); font-weight: 700; font-size: 14px; }
.doc tr:last-child td { border-bottom: 0; }

blockquote { margin: 0 0 16px; padding: 4px 16px; color: var(--text-muted); border-inline-start: 3px solid var(--border); }

/* Callouts */
.callout {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border-inline-start: 3px solid;
  font-size: 15px;
}
.callout p { margin: 0 0 8px; }
.callout p:last-child,
.callout ul:last-child,
.callout ol:last-child { margin-bottom: 0; }
.callout__label { margin-inline-end: 2px; }
.callout--tip { background: var(--tip-bg); border-color: var(--tip); }
.callout--tip .callout__label { color: var(--tip); }
.callout--warning { background: var(--warn-bg); border-color: var(--warn); }
.callout--warning .callout__label { color: var(--warn); }
.callout--important { background: var(--important-bg); border-color: var(--important); }
.callout--important .callout__label { color: var(--important); }
.callout--permission { background: var(--perm-bg); border-color: var(--perm); }
.callout--permission .callout__label { color: var(--perm); }
.callout--purpose {
  padding: 0 0 0;
  background: none;
  border: 0;
  font-size: 18px;
  color: var(--text-muted);
}
.callout--purpose .callout__label { display: none; }

/* Screenshots */
.shot { margin: 8px 0 24px; }
.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}
.shot figcaption { margin-top: 6px; font-size: 13px; color: var(--text-muted); text-align: center; }
.shot--missing .shot__ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 140px;
  padding: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.shot__label { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
.shot--missing code { font-size: 12px; background: none; border: 0; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: var(--content-w); margin: 56px auto 0; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; font-size: 12px; color: var(--text-muted); }
.pager span { font-weight: 500; }
.pager__next { text-align: end; grid-column: 2; }

/* ---------- Home ---------- */
.home { max-width: 1040px; margin: 0 auto; }
.hero { padding: 24px 0 40px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.hero h1 { margin: 0 0 8px; font-size: 36px; line-height: 1.2; letter-spacing: -0.01em; }
.hero p { margin: 0 0 24px; font-size: 18px; color: var(--text-muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  font-weight: 500;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #14151a; }
.btn--primary:hover { background: var(--accent-hover); }
html[data-theme='light'] .btn--primary { color: #fff; }
@media (prefers-color-scheme: light) {
  html:not([data-theme='dark']) .btn--primary { color: #fff; }
}
.part { margin-bottom: 36px; }
.part h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.card:hover { border-color: var(--accent); text-decoration: none; background: var(--bg-subtle); }
.card__emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  background: var(--bg-subtle);
  border-radius: var(--radius);
}
.card:hover .card__emoji { background: var(--accent-soft); }
.card__title { font-weight: 700; }
.card__desc { font-size: 14px; line-height: 1.5; color: var(--text-muted); }

.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .onpage { display: none; }
}

@media (max-width: 900px) {
  .icon-btn { display: inline-flex; }
  .brand span { display: none; }
  .search { width: auto; flex: 1; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    inset-inline-start: 0;
    z-index: 30;
    width: min(320px, 86vw);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  [dir='ltr'] .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 24px rgb(0 0 0 / 0.12); }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 20; background: rgb(0 0 0 / 0.25); }
  main { padding: 24px 20px 64px; }
  .doc h1 { font-size: 26px; }
  .doc h2 { font-size: 20px; margin-top: 36px; }
  .hero h1 { font-size: 28px; }
}

@media (max-width: 520px) {
  body { font-size: 15.5px; }
  .pager { grid-template-columns: 1fr; }
  .pager__next { grid-column: 1; }
}

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

@media print {
  .topbar, .sidebar, .onpage, .pager, .skip-link, .anchor, .print-btn, .theme-btn { display: none !important; }
  main { padding: 0; }
}

/* Step-by-step walkthroughs */
ol > li > .shot, ol > li > p > .shot { margin: 10px 0 18px; }
.shot--phone { max-width: 260px; margin-inline: auto; }
.shot--phone img { border-radius: 18px; }
.phone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 240px));
  justify-content: center;
  gap: 16px;
  margin: 8px 0 24px;
}
.phone-grid .shot { margin: 0; max-width: none; }
