:root {
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --brand: #1d4ed8;
  --brand-weak: rgba(29, 78, 216, 0.10);
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --max: 920px;
  --ring: 0 0 0 3px rgba(29, 78, 216, 0.25);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  background: var(--bg);
}

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

a {
  color: var(--brand);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 10px;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 56px;
}

.header {
  max-width: var(--max);
  width: 100%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand);
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.4px;
  box-shadow: var(--shadow-sm);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}

.nav a {
  padding: 6px 10px;
  border-radius: 10px;
  color: var(--text);
  border: 1px solid transparent;
}

.nav a:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.nav a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: transparent;
}

.nav a[aria-current="page"] {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.95);
  font-weight: 650;
}

.card {
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 32px;
}

.card h1 {
  margin-top: 0;
  font-size: clamp(28px, 3.2vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.card h2 {
  margin-top: 28px;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.card h3 {
  margin-top: 20px;
  font-size: 16px;
}

.card p {
  margin: 12px 0;
}

.card ul {
  margin: 10px 0 10px 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.footer {
  max-width: var(--max);
  width: 100%;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer a {
  color: inherit;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: #fbfdff;
  border-radius: 14px;
}

.kv div {
  padding: 4px 0;
}

.kv .k {
  color: var(--muted);
}

.note {
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #fafafa;
  border-radius: 12px;
}

.toc {
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #fbfbff;
  border-radius: 12px;
}

.toc ol {
  margin: 8px 0 0 18px;
  columns: 2;
  column-gap: 28px;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  padding: 0.1em 0.35em;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.input::placeholder {
  color: var(--muted);
}

.input:focus {
  outline: none;
  box-shadow: var(--ring);
  border-color: transparent;
}

.btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--brand);
  color: #ffffff;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  filter: brightness(0.98);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.actions {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.action {
  display: block;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fbfdff;
  color: inherit;
  text-decoration: none;
}

.action:hover {
  border-color: rgba(29, 78, 216, 0.25);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.action:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.action-title {
  font-weight: 650;
}

.action-desc {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.action-store,
.action-store-inline {
  border-color: rgba(29, 78, 216, 0.28);
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
}

.action-store .action-title,
.action-store-inline .action-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-store .action-title::after,
.action-store-inline .action-title::after {
  content: "\2197";
  font-size: 13px;
  color: var(--muted);
  line-height: 1;
}

.app-links {
  display: grid;
  gap: 10px;
}

.app-tile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-tile-body {
  flex: 1;
  min-width: 0;
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.app-tile-arrow {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.screenshots {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 0 4px;
  display: grid;
  grid-auto-flow: column;
  /* Fixed width ensures overflow (so horizontal scroll is always available). */
  grid-auto-columns: 240px;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}

.screenshots-carousel {
  margin-top: 8px;
}

.screenshots-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.carousel-btn {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.carousel-btn:hover {
  border-color: rgba(29, 78, 216, 0.3);
}

.carousel-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.carousel-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.screenshot {
  margin: 0;
  scroll-snap-align: start;
}

.screenshot img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 700px) {
  .toc ol {
    columns: 1;
  }
}

@media (max-width: 520px) {
  .card {
    padding: 20px;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .screenshots {
    grid-auto-columns: 70vw;
  }

  .search {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-subtitle {
    display: none;
  }
}
