:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #111111;
  --surface-alt: #1a1a1a;
  --surface-strong: #0b0b0b;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --subtle: rgba(255, 255, 255, 0.42);
  --line: rgba(255, 214, 0, 0.22);
  --line-strong: rgba(255, 214, 0, 0.48);
  --accent: #ffd600;
  --accent-soft: rgba(255, 214, 0, 0.1);
  --green: #9bdc65;
  --green-bg: rgba(86, 153, 49, 0.18);
  --red: #ff6b6b;
  --radius: 8px;
  --radius-sm: 6px;
  --topbar-h: 76px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 50% 10%, rgba(255, 214, 0, 0.055), transparent 34rem), var(--bg);
  color: var(--text);
}
body > main { display: flex; flex: 1; min-height: 0; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
button { min-height: 36px; cursor: pointer; }
button:hover { border-color: var(--accent); color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(255, 214, 0, 0.45); outline-offset: 2px; }
a { color: inherit; }

.topbar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--topbar-h);
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar-brand { display: block; min-width: 0; color: var(--text); text-decoration: none; }
.topbar-brand strong { display: block; font-size: 22px; font-weight: 760; line-height: 1.12; }
.topbar-brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.25; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-button { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-alt); color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none; }
.topbar-button:hover { border-color: var(--accent); color: var(--accent); }
.topbar-button.accent { border-color: var(--line-strong); background: var(--accent-soft); color: var(--accent); }
.pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.live { background: var(--accent-soft); color: var(--accent); }

.workspace { display: grid; flex: 1; grid-template-columns: 340px minmax(0, 1fr); width: 100%; min-height: 0; }
.directory-toggle, .directory-backdrop, .directory-close { display: none; }
.rule-sidebar { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 18px; border-right: 1px solid var(--line); background: var(--surface-strong); }
.sidebar-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.sidebar-heading h2 { margin: 5px 0 0; font-size: 19px; }
.sidebar-heading-actions { display: flex; align-items: center; gap: 8px; }
.section-label { display: block; margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0; }
.result-count { color: var(--muted); font-size: 12px; }
.search-box { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--subtle); }
.search-box:focus-within { border-color: var(--accent); outline: 3px solid rgba(255, 214, 0, 0.18); }
.search-box input { width: 100%; min-width: 0; min-height: 38px; padding: 0; border: 0; outline: 0; background: transparent; }
.search-box input::placeholder { color: var(--subtle); }
.library-stats { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.library-stats strong { color: var(--text); }
.category-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.category-filter { max-width: 100%; min-height: 32px; padding: 0 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; overflow-wrap: anywhere; }
.category-filter.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.qa-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.quick-filter { width: 100%; min-height: 36px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.quick-filter.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.rule-list, .rule-group-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.rule-list { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; align-content: start; }
.rule-group + .rule-group { margin-top: 14px; }
.rule-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; padding: 0 4px 7px; border-bottom: 1px solid var(--line); }
.rule-group-heading strong { color: var(--accent); font-size: 11px; font-weight: 800; }
.rule-group-heading span { color: var(--subtle); font-size: 10px; }
.rule-item { width: 100%; min-height: 0; padding: 10px; border-color: transparent; background: transparent; text-align: left; }
.rule-item:hover, .rule-item.active { border-color: var(--line-strong); background: var(--accent-soft); color: var(--text); }
.rule-item-top { display: flex; align-items: flex-start; gap: 8px; }
.rule-code { flex: 0 0 auto; color: var(--accent); font-size: 12px; font-weight: 820; }
.rule-title { min-width: 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.rule-item-meta { display: flex; flex-wrap: wrap; gap: 6px 9px; margin-top: 6px; color: var(--subtle); font-size: 10px; overflow-wrap: anywhere; }
.empty-list { padding: 22px 8px; color: var(--muted); font-size: 13px; line-height: 1.65; text-align: center; }

.rule-reader { min-width: 0; min-height: 0; overflow-y: auto; scroll-margin-top: 72px; padding: 20px 24px 40px; }
.reader-loading { padding: 70px 0; color: var(--muted); text-align: center; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.55; }
.demo-banner strong, .demo-banner a { color: var(--accent); }
.demo-banner a { margin-left: 12px; font-weight: 700; text-decoration: none; }
.source-banner { background: var(--surface); }
.source-banner strong { color: var(--green); }
.rule-heading { padding: 4px 0 22px; border-bottom: 1px solid var(--line); }
.rule-heading-top { display: flex; align-items: center; gap: 9px; }
.rule-badge { padding: 5px 8px; border-radius: 5px; background: var(--accent); color: #050505; font-size: 12px; font-weight: 900; }
.status-badge { padding: 4px 8px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-size: 11px; font-weight: 700; }
.rule-heading h2 { max-width: 980px; margin: 14px 0 10px; font-size: clamp(28px, 3vw, 38px); line-height: 1.18; }
.language-kicker { display: block; color: var(--subtle); font-size: 10px; font-weight: 850; letter-spacing: 0.08em; }
.chinese-kicker { margin-bottom: 5px; color: var(--accent); letter-spacing: 0; }
.rule-lead { max-width: 920px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.english-reference { max-width: 920px; margin-top: 16px; border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.english-reference-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 15px; }
.english-reference-head p { margin: 4px 0 0; color: rgba(255, 255, 255, 0.7); font-size: 14px; line-height: 1.45; }
.english-reference-head .english-empty { color: var(--subtle); }
.official-text-details { border-top: 1px solid var(--line); }
.official-text-details summary { padding: 11px 15px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.official-text-details .markdown { padding: 2px 15px 14px; }
.metadata { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; color: var(--subtle); font-size: 12px; }
.metadata strong { color: var(--muted); font-weight: 650; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { padding: 4px 8px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-size: 11px; }
.reader-nav { position: sticky; top: 0; z-index: 10; display: flex; gap: 8px; margin: 0 0 24px; padding: 12px 0; border-bottom: 1px solid var(--line); background: rgba(5, 5, 5, 0.96); }
.reader-nav a { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.reader-nav a:hover { border-color: var(--accent); color: var(--accent); }
.content-section { scroll-margin-top: 68px; padding: 0 0 28px; }
.section-number { display: block; margin-bottom: 5px; color: var(--accent); font-size: 11px; font-weight: 800; }
.content-section > h3 { margin: 0 0 14px; font-size: 20px; }
.section-intro { margin: -5px 0 14px; color: var(--subtle); font-size: 13px; line-height: 1.65; }
.content-card, .qa-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.content-card { padding: 18px; }
.usage-note { margin: 10px 2px 0; color: var(--subtle); font-size: 11px; line-height: 1.6; }
.usage-note strong { color: var(--muted); font-weight: 700; }
.markdown { color: rgba(255, 255, 255, 0.78); font-size: 14px; line-height: 1.8; }
.markdown h2, .markdown h3 { margin: 20px 0 9px; color: var(--text); font-size: 16px; }
.markdown p { margin: 0 0 12px; }
.markdown ul { margin: 0 0 12px; padding-left: 20px; }
.markdown li { margin: 5px 0; }
.markdown strong { color: var(--text); }
.markdown code { padding: 2px 5px; border-radius: 4px; background: var(--surface-alt); color: var(--accent); }
.qa-list { display: grid; gap: 12px; }
.qa-card { overflow: hidden; }
.qa-card-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.qa-code { color: var(--accent); font-size: 11px; font-weight: 820; }
.qa-card h4 { margin: 5px 0 0; font-size: 15px; }
.qa-title-en { margin: 5px 0 0; color: var(--subtle); font-size: 11px; line-height: 1.45; }
.official-link { flex: 0 0 auto; color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; }
.qa-grid.single { grid-template-columns: 1fr; }
.qa-block { padding: 16px 18px; }
.qa-block + .qa-block { border-left: 1px solid var(--line); background: rgba(255, 214, 0, 0.025); }
.qa-label { display: block; margin-bottom: 9px; color: var(--subtle); font-size: 10px; font-weight: 800; }
.qa-scope { margin: 0; padding: 11px 18px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 12px; line-height: 1.6; }
.qa-translation { border-top: 1px solid var(--line); }
.qa-translation summary { padding: 11px 18px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.qa-translation .markdown { padding: 2px 18px 14px; }
.related-list { display: flex; flex-wrap: wrap; gap: 8px; }
.related-chip { min-height: 34px; padding: 0 10px; background: var(--surface); color: var(--accent); font-size: 12px; font-weight: 800; }
span.related-chip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); }

.site-footer { display: flex; flex: none; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; min-height: 48px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); text-align: center; font-size: 13px; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-separator { color: var(--line); }

/* Meeting template */
.meeting-main { justify-content: center; overflow-y: auto; padding: 34px 22px 54px; }
.meeting-page { width: min(100%, 920px); }
.meeting-hero { margin-bottom: 26px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.meeting-hero h1 { margin: 8px 0 10px; font-size: clamp(30px, 4vw, 44px); }
.meeting-hero p { max-width: 720px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.meeting-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: meeting-point; }
.meeting-point { position: relative; padding: 20px 20px 18px 70px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); counter-increment: meeting-point; }
.meeting-point::before { position: absolute; top: 18px; left: 18px; display: grid; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #050505; content: counter(meeting-point); font-size: 14px; font-weight: 900; place-items: center; }
.meeting-point-content { color: rgba(255, 255, 255, 0.86); font-size: 15px; line-height: 1.8; white-space: normal; }
.meeting-rules { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.meeting-rules > span { margin-right: 2px; color: var(--subtle); font-size: 11px; font-weight: 750; }
.meeting-rules a { padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 750; text-decoration: none; }
.meeting-rules a:hover { border-color: var(--accent); }
.meeting-list-empty { display: block; }
.meeting-empty { display: grid; gap: 7px; padding: 54px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.meeting-empty strong { color: var(--text); font-size: 17px; }
.meeting-empty span { font-size: 13px; }

/* Admin */
.admin-body { min-height: 100vh; }
.admin-shell { display: grid; flex: 1; grid-template-columns: 240px minmax(0, 1fr); width: 100%; min-height: 0; }
.admin-sidebar { padding: 18px; border-right: 1px solid var(--line); background: var(--surface-strong); }
.admin-sidebar h1 { margin: 0 0 18px; font-size: 18px; }
.admin-nav { display: grid; gap: 6px; }
.admin-nav button { width: 100%; padding: 0 12px; background: transparent; color: var(--muted); text-align: left; }
.admin-nav button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-count { display: inline-flex; min-width: 20px; height: 20px; margin-left: 6px; border-radius: 999px; background: var(--surface-alt); color: var(--accent); font-size: 10px; align-items: center; justify-content: center; }
.admin-main { min-width: 0; min-height: 0; overflow-y: auto; padding: 20px 24px 40px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.admin-toolbar h2 { margin: 0; font-size: 24px; }
.button { min-height: 38px; padding: 0 14px; background: var(--surface-alt); font-weight: 700; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #050505; }
.button.danger { color: var(--red); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.admin-grid { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; }
.admin-list-panel, .editor-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.admin-list-panel { align-self: start; overflow: hidden; }
.admin-list { max-height: calc(100vh - 270px); overflow-y: auto; padding: 7px; }
.admin-list-filters { display: grid; gap: 7px; padding: 9px; border-bottom: 1px solid var(--line); }
.admin-list-filters input, .admin-list-filters select { width: 100%; min-height: 38px; padding: 0 10px; }
.admin-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.admin-list-item { width: 100%; min-height: 0; padding: 10px; border-color: transparent; background: transparent; text-align: left; }
.admin-list-item:hover, .admin-list-item.active { border-color: var(--line-strong); background: var(--accent-soft); color: var(--text); }
.admin-list-item strong { display: block; font-size: 12px; }
.admin-list-item span { display: block; margin-top: 4px; color: var(--subtle); font-size: 10px; }
.meeting-admin-intro { margin: -8px 0 16px; }
.meeting-sort-hint { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--subtle); font-size: 11px; }
.meeting-sort-item { display: flex; align-items: center; gap: 7px; padding: 4px 6px; cursor: grab; }
.meeting-sort-item.dragging { opacity: .45; }
.meeting-sort-item.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.meeting-sort-item .meeting-drag-handle { flex: 0 0 auto; margin: 0; color: var(--subtle); font-size: 17px; line-height: 1; }
.meeting-point-select { flex: 1; min-width: 0; min-height: 50px; padding: 7px; border: 0; background: transparent; text-align: left; }
.meeting-point-select:hover { color: var(--text); }
.meeting-point-select strong { overflow-wrap: anywhere; }
.meeting-rule-checks { max-height: 300px; }
.editor-card { padding: 18px; }
.editor-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label, .field > span { margin: 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.field input, .field textarea, .field select { width: 100%; outline: 0; }
.field input[readonly], .field textarea[readonly] { background: var(--surface-strong); color: var(--muted); }
.field-hint { margin: 0; color: var(--subtle); font-size: 11px; line-height: 1.55; }
.english-preview { font-family: "Segoe UI", Arial, sans-serif; }
.field input, .field select { min-height: 38px; padding: 0 10px; }
.field textarea { min-height: 118px; padding: 10px; resize: vertical; line-height: 1.6; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 180px; overflow-y: auto; padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check-grid label { display: flex; align-items: start; gap: 7px; color: var(--muted); font-size: 11px; }
.check-grid input { width: auto; min-height: 0; }
.markdown-preview { min-height: 66px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: var(--surface-strong); color: rgba(255,255,255,.78); font-size: 12px; line-height: 1.65; }
.markdown-preview::before { content: "预览"; display: block; margin-bottom: 6px; color: var(--subtle); font-size: 10px; font-weight: 800; }
.markdown-preview h2, .markdown-preview h3 { margin: 10px 0 6px; color: var(--text); font-size: 14px; }
.markdown-preview p { margin: 0 0 6px; }
.markdown-preview ul { margin: 0 0 6px; padding-left: 18px; }
.editor-actions { display: flex; justify-content: space-between; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.editor-actions div { display: flex; gap: 8px; }
.login-shell { display: grid; flex: 1; width: 100%; place-items: center; padding: 24px; }
.login-card { width: min(100%, 420px); padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 22px 70px rgba(0,0,0,.58); }
.login-card h1 { margin: 0 0 8px; font-size: 27px; }
.login-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.65; }
.login-card form { display: grid; gap: 12px; }
.notice { margin-bottom: 16px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--muted); font-size: 12px; line-height: 1.55; }
.notice strong { color: var(--accent); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: 360px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-alt); box-shadow: 0 16px 50px rgba(0,0,0,.45); font-size: 13px; }
.sync-status { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.manual-sync-status { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sync-status > div { display: grid; align-content: start; gap: 5px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sync-status strong { color: var(--subtle); font-size: 10px; }
.sync-status span { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.manual-version { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border-bottom: 1px solid var(--line); }
.manual-version:last-child { border-bottom: 0; }
.manual-version > div:first-child { flex: 1 1 240px; }
.manual-version .section-intro { margin: 5px 0 0; }
.manual-version-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.manual-version-actions input[type="date"] { min-height: 38px; padding: 0 8px; }
.manual-version details { width: 100%; }
.manual-version summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.manual-version pre { overflow: auto; max-height: 220px; padding: 10px; white-space: pre-wrap; color: var(--muted); font-family: inherit; font-size: 11px; }
.review-state.pending_review { color: var(--green); }
.review-state.needs_attention { color: var(--accent); }
.review-state.approved { color: var(--muted); }
.review-state.rejected { color: var(--red); }

@media (max-width: 1200px) {
  .sync-status { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .manual-sync-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body { height: auto; min-height: 100vh; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .topbar-actions { flex-wrap: wrap; width: 100%; }
  .workspace { display: block; min-height: auto; }
  .directory-toggle { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 58px; padding: 9px 16px; border-width: 0 0 1px; border-radius: 0; background: var(--surface); text-align: left; }
  .directory-toggle span:first-child { display: grid; gap: 2px; min-width: 0; }
  .directory-toggle small { color: var(--subtle); font-size: 10px; font-weight: 700; }
  .directory-toggle strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  .directory-toggle-action { flex: 0 0 auto; margin-left: 12px; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--accent); font-size: 12px; font-weight: 800; }
  .directory-backdrop { position: fixed; inset: 0; z-index: 40; display: block; width: 100%; height: 100%; border: 0; border-radius: 0; background: rgba(0,0,0,.68); }
  .rule-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(88vw, 390px); height: 100vh; height: 100dvh; min-height: 0; padding: 18px; border-right: 1px solid var(--line); box-shadow: 24px 0 70px rgba(0,0,0,.55); transform: translateX(-105%); transition: transform 180ms ease; }
  .rule-sidebar.open { transform: translateX(0); }
  .directory-close { display: grid; width: 34px; height: 34px; min-height: 34px; padding: 0; background: var(--surface-alt); color: var(--muted); font-size: 20px; place-items: center; }
  body.directory-open { overflow: hidden; }
  .rule-reader { min-height: calc(100vh - 160px); overflow: visible; padding: 16px; }
  .reader-nav { overflow-x: auto; }
  .reader-nav a { flex: 0 0 auto; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-main { overflow: visible; padding: 16px; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-list { max-height: 260px; }
  .sync-status, .manual-sync-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .english-reference-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .topbar { padding: 13px 16px; }
  .topbar-brand strong { font-size: 20px; }
  .pill { order: 3; width: 100%; justify-content: center; }
  .topbar-button { flex: 1; justify-content: center; }
  .demo-banner { align-items: flex-start; flex-direction: column; }
  .demo-banner a { margin: 0 12px 0 0; }
  .rule-heading h2 { font-size: 27px; }
  .qa-grid { grid-template-columns: 1fr; }
  .qa-block + .qa-block { border-top: 1px solid var(--line); border-left: 0; }
  .qa-card-header { flex-direction: column; }
  .site-footer { font-size: 12px; }
  .meeting-main { padding: 24px 14px 40px; }
  .meeting-point { padding: 62px 16px 16px; }
  .meeting-point::before { top: 15px; left: 16px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .editor-form { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .admin-filter-row, .check-grid { grid-template-columns: 1fr; }
  .sync-status, .manual-sync-status { grid-template-columns: 1fr; }
  .editor-actions { align-items: stretch; flex-direction: column-reverse; }
  .editor-actions div { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
