/* ===========================================================
 * Quiz App Info Site - shared styles
 * Based on old Snap-02 style (proven document tone).
 * No external dependencies.
 * =========================================================== */

@font-face {
  font-family: 'AppIcons';
  src: url('/info/public/app-icons.ttf?v=19') format('truetype');
  font-display: block;
  font-weight: normal;
  font-style: normal;
}

.icon {
  font-family: 'AppIcons';
  font-style: normal;
  font-weight: normal;
  display: inline-block;
  vertical-align: -2px;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 1.05em;
}

.icon-alert-triangle::before { content: '\EA06'; }
.icon-check::before          { content: '\EA5E'; }
.icon-chevron-down::before   { content: '\EA5F'; }
.icon-chevron-right::before  { content: '\EA61'; }
.icon-chevron-up::before     { content: '\EA62'; }
.icon-copy::before           { content: '\EA7A'; }
.icon-copyright::before      { content: '\EA7B'; }
.icon-download::before       { content: '\EA96'; }
.icon-external-link::before  { content: '\EA99'; }
.icon-home::before           { content: '\EAC1'; }
.icon-info::before           { content: '\EAC5'; }
.icon-refresh::before        { content: '\EB13'; }
.icon-trash::before          { content: '\EB41'; }
.icon-x::before              { content: '\EB55'; }
.icon-tools::before          { content: '\EBCA'; }
.icon-history::before        { content: '\EBEA'; }
.icon-menu::before           { content: '\EC42'; }
.icon-help::before           { content: '\F91D'; }

:root {
  --primary: #1DB954;
  --primary-light: #1ED760;
  --primary-bg: rgba(29, 185, 84, 0.08);
  --primary-border: rgba(29, 185, 84, 0.4);
  --text: #1f2328;
  --text-muted: #6a7280;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --border: #e1e4e8;
  --code-bg: #f3f4f6;
  --warning-bg: #fff7e6;
  --warning-border: #f5b75a;

  --max-width: 760px;
  --gap: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6e6e6;
    --text-muted: #9ba3af;
    --bg: #16181d;
    --bg-alt: #1e2127;
    --border: #2d3138;
    --code-bg: #1e2127;
    --warning-bg: #2a2316;
    --warning-border: #d49b3a;
  }
}

* { box-sizing: border-box; }

html, body {
  /* Drawer sits off-screen with translateX(100%); clip the overflow
     so the drawer can't trigger horizontal scrollbar. `clip` is used
     instead of `hidden` because `hidden` creates a scroll container
     that breaks `position: sticky` for descendants (header / TOC). */
  overflow-x: clip;
}

html {
  scroll-behavior: smooth;
  /* Always reserve scrollbar gutter so page width doesn't jitter
     between short and long pages. */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo",
               -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* Font size presets: <html data-fs="..."> applied by i18n module */
:root[data-fs="small"]  body { font-size: 14px; }
:root[data-fs="medium"] body { font-size: 16px; }
:root[data-fs="large"]  body { font-size: 18px; }

/* Settings page */
.settings-page .lead {
  margin-bottom: 24px;
}
.settings-list {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-alt);
}
.settings-row {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  gap: 16px;
}
.settings-row-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-row-title {
  font-weight: 600;
  color: var(--text);
}
.settings-row-subtitle {
  font-size: 0.85em;
  color: var(--text-muted);
}
.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 0 20px;
}
.settings-select {
  font-family: inherit;
  font-size: 0.95em;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  min-width: 140px;
  cursor: pointer;
}
.settings-select:focus {
  outline: none;
  border-color: var(--primary);
}
.settings-note {
  margin-top: 16px;
  font-size: 0.85em;
  color: var(--text-muted);
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header .brand {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  font-size: 1.1em;
  border-bottom: none;
}

.site-header .brand:hover {
  border-bottom: none;
}

.primary-nav {
  margin-left: auto;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-internal {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-internal a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95em;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nav-internal a:hover {
  color: var(--primary);
}

.nav-internal a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

/* ---------- Dropdown (Help menu) ---------- */

.nav-dropdown {
  position: relative;
}

.dropdown-trigger {
  background: none;
  border: none;
  padding: 4px 2px;
  margin: 0;
  font: inherit;
  font-size: 0.95em;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dropdown-trigger:hover {
  color: var(--primary);
}

.dropdown-trigger:focus { outline: none; }
.dropdown-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.dropdown-trigger.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.dropdown-trigger .dropdown-caret {
  font-size: 0.85em;
  opacity: 0.7;
  transition: transform 0.15s;
}

.nav-dropdown.open .dropdown-trigger .dropdown-caret {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  display: none;
  flex-direction: column;
  min-width: 200px;
  padding: 6px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  z-index: 20;
}

/* Invisible bridge filling the 4px gap between trigger and menu.
   Without this, moving the cursor from the trigger to the menu fires
   mouseleave on .nav-dropdown and closes the menu. */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 4px;
}

.nav-dropdown.open .dropdown-menu {
  display: flex;
}

.dropdown-menu a {
  display: block;
  padding: 7px 14px;
  color: var(--text);
  font-size: 0.92em;
  text-decoration: none;
  border-bottom: none;
}

.dropdown-menu a:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-bottom: none;
}

.dropdown-menu a.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-bg);
}

.app-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.9em;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.app-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
  border-bottom-color: var(--primary);
}

.app-link .icon {
  font-size: 0.95em;
  opacity: 0.85;
}

/* ---------- Main ---------- */

.main-content {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Mirror of Snap-01 setting_app_screen.dart footer: two columns,
   small muted text, slight letter-spacing, version + changelog link
   on the left, free-to-use notice right-aligned. */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85em;
  padding: 16px 20px;
}
.site-footer .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  letter-spacing: 0.3px;
}
.site-footer .footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0.85;
}
.site-footer .footer-changelog a {
  color: var(--primary);
  text-decoration: underline;
  border-bottom: none;
}
.site-footer .footer-changelog a:hover {
  border-bottom: none;
}
.site-footer .footer-right {
  margin-left: auto;
  text-align: right;
  line-height: 1.6;
  opacity: 0.85;
}

@media (max-width: 480px) {
  .site-footer .inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .site-footer .footer-right {
    margin-left: 0;
    text-align: left;
  }
}

/* ---------- Headings ---------- */

h1 {
  font-size: 1.8em;
  margin: 0 0 8px;
  color: var(--text);
}

h2 {
  font-size: 1.4em;
  margin: 32px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text);
}

h2:first-of-type { border-top: none; padding-top: 0; }

h3 {
  font-size: 1.15em;
  margin: 20px 0 8px;
  color: var(--text);
}

.lead {
  color: var(--text-muted);
  font-size: 1.05em;
  margin: 0 0 24px;
}

/* ---------- Links ---------- */

a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

a:hover {
  border-bottom-color: var(--primary);
}

/* ---------- Cards (index page) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
  margin: 24px 0;
}

.card {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  border-bottom-color: var(--primary);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 1.05em;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h3 .icon {
  font-size: 1.1em;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92em;
}

/* ---------- Help sub-nav ---------- */

.help-sub-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 24px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95em;
}

.help-sub-nav a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 4px;
  transition: color 0.15s, border-color 0.15s;
}

.help-sub-nav a:hover {
  color: var(--primary);
}

.help-sub-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---------- Download cards (used in help) ---------- */

.download-card {
  display: block;
  max-width: 420px;
  padding: 14px 18px;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.download-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.download-card .title {
  display: block;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
  font-size: 1.02em;
}

.download-card .desc {
  display: block;
  color: var(--text-muted);
  font-size: 0.9em;
}

/* ---------- Accordion (used in help) ---------- */

.md-accordion {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-alt);
  overflow: hidden;
}

.md-accordion[open] {
  background: var(--bg);
}

.md-accordion summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  color: var(--text);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.md-accordion summary::-webkit-details-marker { display: none; }

.md-accordion summary::before {
  content: '\EA61';
  font-family: 'AppIcons';
  font-size: 0.85em;
  color: var(--text-muted);
  transition: transform 0.15s;
  line-height: 1;
}

.md-accordion[open] summary::before {
  transform: rotate(90deg);
}

.md-accordion summary:hover {
  color: var(--primary);
}

.md-accordion[open] summary {
  border-bottom: 1px solid var(--border);
}

.md-accordion pre {
  margin: 0;
  border: none;
  border-radius: 0;
  max-height: 60vh;
  overflow-y: auto;
  font-size: 0.82em;
  line-height: 1.55;
}

/* ---------- Note / Warn boxes ---------- */
/* Green-bordered container. The first <strong> in the first <p> acts as
   a title: shown on its own line with an icon, then the body follows. */

.note,
.warn,
.placeholder-note {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: transparent;
}

.placeholder-note { color: var(--text-muted); font-size: 0.92em; }

.note p:first-child,
.warn p:first-child,
.placeholder-note p:first-child { margin-top: 0; }

.note p:last-child,
.warn p:last-child,
.placeholder-note p:last-child { margin-bottom: 0; }

/* Title row — explicit class so multiple titles in one box work,
   and a mid-paragraph <strong> never gets mistaken for a title. */
.callout-title {
  margin: 0 0 8px;
  position: relative;
  padding-left: 24px;
  color: var(--primary);
  font-weight: 600;
}

.note .callout-title + p,
.note .callout-title + ul,
.warn .callout-title + p,
.warn .callout-title + ul { margin-top: 0; }

.note p + .callout-title,
.warn p + .callout-title,
.note ul + .callout-title,
.warn ul + .callout-title { margin-top: 14px; }

.callout-title::before {
  font-family: 'AppIcons';
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--primary);
  font-size: 1em;
}

.note .callout-title::before { content: '\EAC5'; }
.warn .callout-title::before { content: '\EA06'; }

/* ---------- Code ---------- */

code {
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.92em;
}

pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.5;
  border: 1px solid var(--border);
}

pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95em;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-alt);
  font-weight: 600;
}

/* ---------- Badges (mode labels etc) ---------- */

.badge {
  display: inline-block;
  height: 22px;
  padding: 0 8px;
  font-size: 0.78em;
  font-weight: 600;
  line-height: 22px;
  border-radius: 4px;
  vertical-align: middle;
  border: 1px solid;
}

.badge.endless {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
}

.badge.exam {
  color: #6b21a8;
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
}

.badge.review {
  color: var(--primary);
  background: var(--primary-bg);
  border-color: var(--primary-border);
}

.badge .icon {
  font-size: 0.92em;
  vertical-align: -1px;
  margin-right: 3px;
  opacity: 0.95;
}

/* ---------- Checker page ---------- */

.checker-page .lead {
  margin-bottom: 20px;
}

/* Segmented control (replaces pill-shaped radio toggles) */
.format-toggle {
  display: inline-flex;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
}

.format-toggle label {
  padding: 6px 14px;
  font-size: 0.88em;
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
  background: var(--bg);
  border-right: 1px solid var(--border);
  transition: background 0.1s, color 0.1s;
  line-height: 1.4;
}

.format-toggle label:last-child {
  border-right: none;
}

.format-toggle label:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.format-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-toggle label:has(input:checked) {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.input-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.input-hint {
  font-size: 0.88em;
  color: var(--text-muted);
}

.input-hint strong {
  color: var(--primary);
  font-weight: 600;
}

.input-area {
  width: 100%;
  min-height: 260px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  font-size: 0.88em;
  line-height: 1.55;
  resize: vertical;
}

.input-area:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.action-row {
  display: flex;
  gap: 8px;
  margin: 12px 0 24px;
  flex-wrap: wrap;
}

.btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-light, #1ED760);
  border-color: var(--primary-light, #1ED760);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn .icon {
  font-size: 1em;
  opacity: 0.9;
}

/* Result block — flatten the colored summary, rely on left rule + text */
.result-summary {
  padding: 10px 14px;
  border-radius: 4px;
  margin: 16px 0 8px;
  font-size: 0.95em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.result-summary .icon { font-size: 1.05em; }

.result-summary.ok    { border-left: 3px solid var(--primary);         color: var(--primary); }
.result-summary.warn  { border-left: 3px solid var(--warning-border);  color: var(--warning-border); }
.result-summary.error { border-left: 3px solid #d92e2e;                color: #d92e2e; }

.issue-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
}

.issue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.issue:last-child { border-bottom: none; }

.issue .icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 1em;
  line-height: 1.55;
}

.issue.error .icon { color: #d92e2e; }
.issue.warn  .icon { color: var(--warning-border); }
.issue.info  .icon { color: var(--text-muted); }

.issue .body { flex-grow: 1; min-width: 0; }

.issue .where {
  display: inline-block;
  padding: 1px 7px;
  background: var(--bg-alt);
  border-radius: 3px;
  font-size: 0.8em;
  color: var(--text-muted);
  font-family: "Consolas", "Menlo", monospace;
}

/* Issues are grouped by kind: the message leads, the places it occurs follow. */
.issue-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.issue-count {
  flex-shrink: 0;
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.issue-where-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.issue .msg { font-size: 0.93em; }

.issue .hint {
  display: block;
  font-size: 0.84em;
  color: var(--text-muted);
  margin-top: 3px;
}

.fixed-output {
  margin-top: 28px;
}

.fixed-output h2 {
  margin-bottom: 4px;
}

.fixed-output pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 8px 0 0;
  max-height: 50vh;
  overflow-y: auto;
  font-size: 0.84em;
  line-height: 1.55;
}

/* ---------- Changelog page ---------- */

.changelog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.changelog-toolbar h1 {
  margin: 0;
}

.version-picker {
  position: relative;
}

.version-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.92em;
  cursor: pointer;
  line-height: 1.3;
  transition: border-color 0.12s, background 0.12s;
}
.version-picker-btn:hover { border-color: var(--primary); }
.version-picker-btn.open  { border-color: var(--primary); background: var(--bg-alt); }
.version-picker-btn:focus { outline: none; }
.version-picker-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.version-picker-current {
  font-weight: 600;
  color: var(--primary);
  font-family: "Consolas", "Menlo", monospace;
}
.version-picker-date {
  color: var(--text-muted);
  font-size: 0.86em;
  font-family: "Consolas", "Menlo", monospace;
}
.version-picker-caret {
  opacity: 0.6;
  font-size: 0.85em;
  transition: transform 0.15s;
}
.version-picker-btn.open .version-picker-caret { transform: rotate(180deg); }

.version-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  padding: 4px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10),
              0 4px 8px rgba(0, 0, 0, 0.04);
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.version-picker-menu a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92em;
  border-left: 3px solid transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.version-picker-menu a:hover {
  background: var(--bg-alt);
  color: var(--primary);
}
.version-picker-menu a.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.version-picker-menu-version {
  font-family: "Consolas", "Menlo", monospace;
  font-weight: 600;
}
.version-picker-menu-date {
  color: var(--text-muted);
  font-size: 0.8em;
  font-family: "Consolas", "Menlo", monospace;
}

.changelog-status {
  color: var(--text-muted);
  font-size: 0.9em;
  margin: 0;
  padding: 8px 0;
}

.changelog-error {
  color: #d92e2e;
}

.markdown-body { min-width: 0; }

.markdown-body h2 {
  scroll-margin-top: 70px;
}

/* h2 に inject_date が入った場合: title 左、日付ブロック右上に縦並び配置 */
.markdown-body h2:has(.version-h2-dates) {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.markdown-body h2 .version-h2-title {
  flex: 0 0 auto;
}
/* 日付ブロックは縦並び (上: 経過時間 / 下: 日付詳細)。右端揃え。 */
.markdown-body h2 .version-h2-dates {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: auto;
  font-weight: normal;
  letter-spacing: 0.02em;
}
.markdown-body h2 .version-relative {
  display: inline-block;
  padding: 1px 10px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.55em;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.7;
}
.markdown-body h2 .version-detail-line {
  font-family: "Consolas", "Menlo", monospace;
  font-size: 0.48em;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .changelog-toolbar {
    align-items: flex-start;
  }
  .version-picker {
    width: 100%;
  }
  .version-picker-btn {
    width: 100%;
    justify-content: space-between;
  }
  .version-picker-menu {
    left: 0;
    right: 0;
  }
}

/* ---------- Sidebar (PC) + dedicated drawer (mobile) ---------- */

.changelog-title,
.help-page-title {
  margin: 0 0 16px;
  flex-shrink: 0;
}

/* Changelog page flows like a normal document -- body length drives
   page height, no inner scroller. Sidebar is sticky like the help
   TOC. Same vertical rhythm as the help pages. */
.changelog-page {
  /* No height / display:flex hack. Page scrolls naturally. */
}

.changelog-layout {
  display: grid;
  /* Sidebar on the RIGHT, matching the help page TOC layout.
     HTML order is sidebar first then content; `order: 2` on the
     sidebar flips them visually without changing markup. */
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 24px;
  align-items: stretch;
}

.changelog-sidebar {
  order: 2;
  border: none;
  border-left: 1px solid rgba(127, 127, 127, 0.18);
  background: transparent;
  border-radius: 0;
  padding: 0 0 0 8px;
}

/* Inner sticky wrapper: pinned to top of viewport while scrolling,
   matches `.help-toc-sticky`. Outer aside stretches full height so
   its border-left runs the entire length of the article. */
.changelog-sidebar-sticky {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.changelog-sidebar-sticky::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.changelog-version-list {
  display: flex;
  flex-direction: column;
}

.changelog-version-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  font-size: 0.95em;
}

/* version + date を 1 行に: 左 = version + バッジ、右 = 日付 */
.changelog-version-item-row,
.version-drawer-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  width: 100%;
}
.changelog-version-item-left,
.version-drawer-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.changelog-version-item-date,
.version-drawer-item-date {
  font-family: "Consolas", "Menlo", monospace;
  font-size: 0.78em;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}
.changelog-version-item.active .changelog-version-item-date,
.version-drawer-item.active .version-drawer-item-date {
  color: var(--primary);
  opacity: 0.85;
}

/* updated は created と異なる時のみ下の行に小さく表示 */
.changelog-version-item-updated,
.version-drawer-item-updated {
  font-family: "Consolas", "Menlo", monospace;
  font-size: 0.72em;
  color: var(--text-muted);
  text-align: right;
  letter-spacing: 0.02em;
}
.changelog-version-item:hover {
  background: var(--bg);
  color: var(--primary);
}
.changelog-version-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.changelog-version-item-version {
  font-family: "Consolas", "Menlo", monospace;
  font-weight: 600;
  font-size: 1em;
}

.changelog-content {
  min-width: 0;
  /* No independent scroller -- page scrolls naturally with the body. */
}

/* バージョンとバッジを同じ行に並べる */
.changelog-version-item-version-row,
.version-drawer-item-version-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 最新バッジ (サイドバー / ドロワー共通) */
.changelog-latest-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 0.7em;
  font-weight: 600;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo",
               -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  line-height: 1.5;
  white-space: nowrap;
}

/* ---------- Mobile FAB + drawer (shared between changelog & help) ---------- */

.version-fab {
  display: none;
}

.version-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  z-index: 60;
}
.version-drawer-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.version-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(82vw, 320px);
  background: var(--bg);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.22s ease-out;
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.version-drawer.open {
  transform: translateX(0);
}

.version-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.version-drawer-title {
  font-weight: 600;
  color: var(--text);
}
.version-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.version-drawer-close:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.version-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  /* スクロールバー非表示 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.version-drawer-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.version-drawer-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.version-drawer-item:hover {
  background: var(--bg-alt);
}
.version-drawer-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.version-drawer-item-version {
  font-family: "Consolas", "Menlo", monospace;
  font-weight: 600;
  font-size: 1.02em;
}

@media (max-width: 760px) {
  /* Single-column on mobile: sidebar hidden, content full width,
     FAB + drawer take over for version switching. */
  .changelog-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .changelog-sidebar {
    display: none;
  }

  /* Floating action button at bottom-right */
  .version-fab {
    position: fixed;
    right: 14px;
    bottom: calc(18px + var(--fab-bottom-lift, 0px));
    z-index: 55;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 10px 12px;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 0.95em;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18),
                0 2px 4px rgba(0, 0, 0, 0.08);
    max-width: calc(100vw - 28px);
  }
  .version-fab:active { transform: translateY(1px); }
  .version-fab-icon {
    font-size: 1.1em;
  }
  .version-fab-text {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
  }
  .version-fab-current {
    font-family: "Consolas", "Menlo", monospace;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 16ch;
  }
  .version-fab-date {
    font-family: "Consolas", "Menlo", monospace;
    font-size: 0.78em;
    opacity: 0.85;
  }
}

/* pulldown-cmark output — table-heavy, plus headings, code, lists */
.markdown-body h1 {
  font-size: 1.5em;
  margin: 0 0 4px;
  padding-bottom: 0;
  border-bottom: none;
}

.markdown-body h2 {
  font-size: 1.2em;
  margin: 28px 0 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.markdown-body h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 20px;
}

.markdown-body h3 {
  font-size: 1.05em;
  margin: 18px 0 8px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9em;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: block;
  overflow-x: auto;
}

.markdown-body th,
.markdown-body td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.markdown-body tr:last-child td {
  border-bottom: none;
}

.markdown-body th {
  background: var(--bg-alt);
  font-weight: 600;
  font-size: 0.85em;
  white-space: nowrap;
}

.markdown-body code {
  font-family: "Consolas", "Menlo", monospace;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.88em;
}

.markdown-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 12px 0;
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.55;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body li { margin: 3px 0; }

.markdown-body blockquote {
  margin: 12px 0;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
}

.markdown-body a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.markdown-body a:hover {
  border-bottom-color: var(--primary);
}

/* ---------- Credits page ---------- */

.manual-credits {
  margin: 8px 0 16px;
  padding-left: 22px;
}

.manual-credits li {
  margin: 6px 0;
  line-height: 1.65;
}

.manual-credits strong {
  font-weight: 600;
}

.hint-text {
  font-size: 0.92em;
  color: var(--text-muted);
}

/* cargo-about generated block — per-crate license accordion */
.cargo-about-summary {
  color: var(--text-muted);
  font-size: 0.92em;
  margin: 8px 0 16px;
}

.license-overview-heading,
.license-list-heading {
  font-size: 1em;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text);
}

.license-overview {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.license-overview li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.83em;
  background: var(--bg);
}

.license-overview .license-name {
  font-family: "Consolas", "Menlo", monospace;
  font-weight: 600;
  color: var(--text);
}

.license-overview .license-count {
  color: var(--text-muted);
  font-size: 0.92em;
}

.license-crate-list {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.license-crate {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.license-crate:last-child { border-bottom: none; }

.license-crate[open] {
  background: var(--bg-alt);
}

.license-crate summary {
  cursor: pointer;
  padding: 9px 12px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  user-select: none;
}

.license-crate summary::-webkit-details-marker { display: none; }

.license-crate summary::before {
  content: '\EA61';
  font-family: 'AppIcons';
  font-size: 0.78em;
  color: var(--text-muted);
  transition: transform 0.15s;
  margin-right: 2px;
}

.license-crate[open] summary::before { transform: rotate(90deg); }

.license-crate-name {
  font-weight: 600;
  font-family: "Consolas", "Menlo", monospace;
  color: var(--text);
}

.license-crate-version {
  color: var(--text-muted);
  font-family: "Consolas", "Menlo", monospace;
  font-size: 0.85em;
}

.license-crate-spdx {
  margin-left: auto;
  padding: 1px 7px;
  font-size: 0.74em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  white-space: nowrap;
}

.license-crate[open] .license-crate-spdx {
  background: var(--bg);
}

.license-crate-meta {
  padding: 0 12px 8px;
  font-size: 0.83em;
}

.license-crate-meta a {
  color: var(--primary);
  word-break: break-all;
}

.license-crate-text {
  margin: 0;
  padding: 12px 14px;
  background: var(--code-bg);
  border-top: 1px solid var(--border);
  font-size: 0.78em;
  line-height: 1.55;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Consolas", "Menlo", monospace;
  color: var(--text);
}

/* ---------- Hamburger widget (independent of .primary-nav) ----------
   Everything namespaced with .hamburger-* so it can't collide with the
   desktop nav rules above. */

.hamburger-btn,
.hamburger-overlay,
.hamburger-drawer {
  display: none;
}

@media (max-width: 760px) {
  /* Hide desktop nav; show hamburger button instead */
  .primary-nav { display: none; }
  .site-header .inner { padding: 10px 16px; }

  .hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 38px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
  }
  .hamburger-btn:hover { border-color: var(--text-muted); }
  .hamburger-btn.open {
    background: var(--bg-alt);
    border-color: var(--primary);
    color: var(--primary);
  }
  .hamburger-btn:focus { outline: none; }
  .hamburger-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  /* Overlay always in DOM; CSS opacity gates visibility so it fades
     instead of popping. pointer-events:none when invisible. */
  .hamburger-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0s;
  }
  .app-shell.mounted .hamburger-overlay {
    transition: opacity 0.18s ease-out;
  }
  .hamburger-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* Drawer always in DOM, parked off-screen. No transition until
     .app-shell is .mounted (avoids the first-paint flash). */
  .hamburger-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 88vw;
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    z-index: 70;
    transform: translateX(100%);
    transition: transform 0s;
    overflow-y: auto;
  }
  .app-shell.mounted .hamburger-drawer {
    transition: transform 0.22s ease-out;
  }
  .hamburger-drawer.open {
    transform: translateX(0);
    box-shadow: -14px 0 32px rgba(0, 0, 0, 0.18);
  }

  .hamburger-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  .hamburger-drawer-title {
    font-size: 0.88em;
    color: var(--text-muted);
    letter-spacing: 0.04em;
  }
  .hamburger-close {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .hamburger-close:hover {
    color: var(--text);
    border-color: var(--text-muted);
  }

  .hamburger-nav {
    display: flex;
    flex-direction: column;
    padding: 6px 0 16px;
    gap: 0;
  }

  .hamburger-link,
  .hamburger-group-toggle,
  .hamburger-sublink {
    display: flex;
    align-items: center;
    padding: 11px 18px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95em;
    border-left: 3px solid transparent;
    background: transparent;
    border-top: none;
    border-right: none;
    border-bottom: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
  }

  .hamburger-link.active,
  .hamburger-group-toggle.active,
  .hamburger-sublink.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: var(--bg-alt);
    font-weight: 600;
  }

  .hamburger-link:hover,
  .hamburger-group-toggle:hover,
  .hamburger-sublink:hover {
    background: var(--bg-alt);
  }

  .hamburger-group-toggle {
    justify-content: space-between;
  }
  .hamburger-caret {
    opacity: 0.55;
    transition: transform 0.15s;
  }
  .hamburger-group.expanded .hamburger-caret {
    transform: rotate(180deg);
  }

  .hamburger-sublist {
    display: flex;
    flex-direction: column;
    background: var(--bg-alt);
  }
  .hamburger-sublink {
    padding: 9px 18px 9px 36px;
    font-size: 0.88em;
    color: var(--text);
  }
  .hamburger-sublink.active {
    background: var(--bg);
  }

  .hamburger-applink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 14px 14px 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92em;
  }
  .hamburger-applink:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
  }
  .hamburger-applink .icon { opacity: 0.85; }
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .site-header .inner { padding: 10px 16px; }
  .main-content { padding: 16px 16px 60px; }
  h1 { font-size: 1.5em; }
  h2 { font-size: 1.25em; }
}

/* ===========================================================
 * Help redesign — chrome shared across the 5 help pages.
 * Adds: 2-column layout (main + right sticky TOC), Diataxis chip,
 * step-card numbered procedure, next-steps cards, extra callouts.
 * =========================================================== */

/* ---------- Layout: main column + optional right TOC ----------
   Default is a single column. When the page renders a `<details
   class="help-toc">` child, `:has()` switches to a 2-column grid so
   pages without a TOC stay centered (no empty 200px track on the
   right). The border-line stretches the full grid height; only the
   inner `.help-toc-sticky` is sticky, so the line continues past
   the viewport while the link list stays glued. */
.help-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: stretch;
}
.help-layout:has(> .help-toc) {
  grid-template-columns: minmax(0, 1fr) 200px;
}
.help-main { min-width: 0; }

.help-toc {
  border-left: 1px solid var(--border);
  padding: 0 0 0 16px;
}
/* PC: hide the <summary>, force the body visible regardless of the
   <details> open state so the TOC always renders.
   Mobile rules below override both to enable the accordion. */
.help-toc > summary,
.help-toc-summary {
  display: none;
}
.help-toc-summary::-webkit-details-marker { display: none; }

/* Modern browsers (Baseline 2025-09) hide a closed <details>'s content via
   `content-visibility: hidden` on the ::details-content pseudo, not via
   `display: none` on its children -- so forcing `.help-toc-sticky { display:
   block }` alone no longer reveals it and the PC TOC vanished. Re-show it by
   overriding content-visibility. Older browsers ignore this pseudo and rely on
   the display override above, so this is backward-compatible. On mobile the
   whole `.help-toc` is `display: none` (FAB + sheet is used instead), so this
   override is harmless there. */
.help-toc::details-content {
  /* Make the generated wrapper transparent in the box tree. This restores the
     pre-2025 structure where the sticky TOC nav was a direct child of the
     full-height (grid-stretched) .help-toc, so it can follow the scroll again.
     Also removes the wrapper's content-visibility hiding, so the PC TOC stays
     visible (replaces the earlier `content-visibility: visible` fix). Browsers
     new enough to ship ::details-content (2025) all support display:contents
     (Baseline 2020), and older ones ignore this pseudo and use the display
     override above -- backward-compatible either way. */
  display: contents;
}

.help-toc-sticky {
  display: block;
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  scrollbar-width: none;
}
.help-toc-sticky::-webkit-scrollbar { display: none; }

.help-toc-label {
  font-size: 0.74em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.help-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.help-toc li { margin: 0; }

.help-toc a {
  display: block;
  padding: 4px 0 4px 10px;
  margin-left: -12px;
  color: var(--text-muted);
  font-size: 0.88em;
  line-height: 1.4;
  text-decoration: none;
  border-bottom: none;
  border-left: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.help-toc a:hover { color: var(--text); }
.help-toc a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}
.help-toc a.toc-h3 {
  padding-left: 22px;
  font-size: 0.83em;
}

.help-main :is(h2, h3)[id] {
  scroll-margin-top: 70px;
}

/* ---------- h3 separator (turn flat h3/p chains into segments) ----
   Each top-level h3 inside the help body gets a hairline divider so
   pages like settings (h3 + 1 short paragraph repeated) read as
   discrete items instead of one wall of text. The very first h3 is
   excluded so the page doesn't start with a stray line. */
.help-main > h3 {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 24px;
}
.help-main > h3:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 14px;
}

/* ---------- Step card (numbered procedure) ---------- */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0 24px;
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.step-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.step-card-num {
  counter-increment: step;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.92em;
  font-family: "Consolas", "Menlo", monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-top: 2px;
}
.step-card-num::before { content: counter(step); }

.step-card-body { min-width: 0; }
.step-card-body > h3 {
  margin: 0 0 6px;
  font-size: 1.02em;
  line-height: 1.4;
}
.step-card-body > p { margin: 6px 0; }
.step-card-body > p:first-of-type { margin-top: 0; }
.step-card-body > p:last-child { margin-bottom: 0; }
.step-card-body > ul { margin: 6px 0 0; padding-left: 22px; }
.step-card-body > pre { margin-top: 8px; }

/* ---------- Prereq strip ---------- */
.prereq {
  margin: 0 0 20px;
  padding: 10px 14px;
  border-left: 3px solid var(--text-muted);
  background: var(--bg-alt);
  border-radius: 0 4px 4px 0;
  font-size: 0.9em;
  color: var(--text-muted);
}
.prereq-label {
  display: inline-block;
  font-weight: 600;
  color: var(--text);
  margin-right: 8px;
}
.prereq a { color: var(--primary); }

/* ---------- Next steps (footer card grid) ---------- */
.next-steps {
  margin: 40px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.next-steps-label {
  font-size: 0.74em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.next-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.next-step-card {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.next-step-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  border-bottom-color: var(--primary);
}
.next-step-card .next-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95em;
  margin-bottom: 3px;
}
.next-step-card .next-step-desc {
  color: var(--text-muted);
  font-size: 0.85em;
  line-height: 1.5;
}

/* ---------- Extra callouts: tip / kbd / important ----------
   Use the same border + .callout-title pattern as .note / .warn. */
.tip,
.kbd-box,
.important {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: transparent;
}
.tip p:first-child, .kbd-box p:first-child, .important p:first-child { margin-top: 0; }
.tip p:last-child,  .kbd-box p:last-child,  .important p:last-child  { margin-bottom: 0; }
.tip .callout-title::before       { content: '\EA51'; }
.kbd-box .callout-title::before   { content: '\EAC7'; }
.important .callout-title::before { content: '\EAA6'; }

/* ---------- Extra icon class mappings (Snap-01 parity) ----------
   These complement the existing .icon-* set defined near the top
   of this file. Adding here keeps the help icons in one place. */
.icon-infinity::before          { content: '\EB69'; }
.icon-clipboard-check::before   { content: '\EA6C'; }
.icon-rotate::before            { content: '\EBB5'; }
.icon-bulb::before              { content: '\EA51'; }
.icon-clock::before             { content: '\EA70'; }
.icon-settings::before          { content: '\EB20'; }
.icon-file-description::before  { content: '\F028'; }
.icon-list-numbers::before      { content: '\EF11'; }
.icon-list-details::before      { content: '\EF40'; }
.icon-key::before               { content: '\EAC7'; }
.icon-palette::before           { content: '\EB01'; }
.icon-typography::before        { content: '\EBC5'; }
.icon-upload::before            { content: '\EB47'; }
.icon-filter::before            { content: '\EAA5'; }
.icon-flag::before              { content: '\EAA6'; }
.icon-help-circle::before       { content: '\F91D'; }
.icon-book::before              { content: '\F028'; }

/* ---------- Mobile (matches header hamburger breakpoint at 760px) -
   The inline `.help-toc` is hidden entirely on mobile; the FAB +
   bottom-sheet takes over. This pattern (GitHub Docs / MDN / Stripe
   Docs on mobile) keeps the body 100% visible by default and lets
   the user invoke the TOC on demand. */
@media (max-width: 760px) {
  .help-layout,
  .help-layout:has(> .help-toc) {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .help-toc { display: none; }
}

/* ---------- Mobile TOC FAB + bottom sheet ---------- */
.help-toc-fab,
.help-toc-sheet,
.help-toc-sheet-overlay {
  display: none;
}

@media (max-width: 760px) {
  .help-toc-fab {
    position: fixed;
    right: 14px;
    bottom: calc(18px + var(--fab-bottom-lift, 0px));
    z-index: 55;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px 10px 12px;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 0.95em;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18),
                0 2px 4px rgba(0, 0, 0, 0.08);
  }
  .help-toc-fab:active { transform: translateY(1px); }
  .help-toc-fab .icon { font-size: 1.1em; }
  .help-toc-fab-label { font-weight: 600; }

  .help-toc-sheet-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
    z-index: 60;
  }
  .help-toc-sheet-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .help-toc-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 72vh;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.18);
    transform: translateY(100%);
    transition: transform 0.22s ease-out;
    z-index: 70;
  }
  .help-toc-sheet.open { transform: translateY(0); }

  .help-toc-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text);
    /* visual handle hint */
    position: relative;
  }
  .help-toc-sheet-head::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
  }
  .help-toc-sheet-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .help-toc-sheet-close:hover {
    background: var(--bg-alt);
    color: var(--text);
  }

  .help-toc-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 14px;
    scrollbar-width: none;
  }
  .help-toc-sheet-body::-webkit-scrollbar { display: none; }
  .help-toc-sheet-body ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .help-toc-sheet-body li { margin: 0; }
  .help-toc-sheet-body a {
    display: block;
    padding: 12px 18px;
    color: var(--text);
    text-decoration: none;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 0.95em;
    line-height: 1.4;
  }
  .help-toc-sheet-body a:hover,
  .help-toc-sheet-body a:active {
    background: var(--bg-alt);
    color: var(--primary);
    border-left-color: var(--primary);
  }
  .help-toc-sheet-body a.toc-h3 {
    padding-left: 32px;
    font-size: 0.88em;
    color: var(--text-muted);
  }

  /* back-to-top stacks above the toc-fab */
  .back-to-top { bottom: 72px; }
}

@media (max-width: 600px) {
  .step-card {
    grid-template-columns: 30px 1fr;
    gap: 10px;
    padding: 12px 12px;
  }
  .step-card-num {
    width: 24px;
    height: 24px;
    font-size: 0.86em;
  }
}

/* ===========================================================
 * Credits & Licenses page
 *
 * Modeled after Apple / Microsoft / Adobe's third-party notices
 * pages: a flat, linear list of every bundled OSS material, each
 * with its full license text inline. No accordions, no tabs, no
 * separate page. Visually quiet: this is a reference / legal
 * document, not a marketing surface.
 * =========================================================== */

.credits-page .lead {
  margin-bottom: 32px;
}

/* One bundled material entry (font / icon / hand-curated dep). */
.ack-entry {
  margin: 0 0 28px;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--border);
}

.ack-entry-name {
  margin: 0 0 4px;
  font-size: 1.1em;
  color: var(--text);
}
.ack-entry-name a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: none;
}
.ack-entry-name a:hover {
  border-bottom: 1px solid var(--primary);
}

.ack-entry-copyright {
  margin: 0 0 2px;
  font-size: 0.92em;
  color: var(--text);
}

.ack-entry-license-label {
  margin: 0 0 10px;
  font-size: 0.85em;
  color: var(--text-muted);
  font-style: italic;
}

.ack-entry-license-text {
  margin: 0;
  padding: 12px 14px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  font-size: 0.78em;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* Auto-generated dependency bundles (cargo-about HTML and the
   Flutter pub-cache scrape). Just a section header + the embedded
   HTML inline. Inherits .license-crate / .license-overview rules
   defined further up in this file. */
.ack-deps-h {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 1.1em;
}

.ack-deps-block {
  margin: 0 0 24px;
}

/* ---------- Back-to-top floating button ----------
   Lives in Layout, visible on every page once the user has scrolled
   past ~400px. `position: fixed` so it sits independent of page
   layout. Stacks above any page-specific FAB on mobile. */
.back-to-top {
  position: fixed;
  right: 20px;
  /* `--fab-bottom-lift` is updated by Layout's scroll listener so the
     button lifts above the footer when the footer is in view (instead
     of disappearing). Default value 0 keeps the button at 20px. */
  bottom: calc(20px + var(--fab-bottom-lift, 0px));
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  padding: 0;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10),
              0 2px 4px rgba(0, 0, 0, 0.04);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease-out, transform 0.18s ease-out,
              border-color 0.12s, color 0.12s, background 0.12s;
  z-index: 50;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}
.back-to-top:focus { outline: none; }
.back-to-top:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  /* Stack above the page-specific FAB (help-toc-fab / version-fab at
     bottom: 18px). Lift applies the same way for footer avoidance. */
  .back-to-top { bottom: calc(72px + var(--fab-bottom-lift, 0px)); }
}
