:root {
  --bg: #f2efe7;
  --panel: #fffdf7;
  --panel-2: #faf7ee;
  --ink: #221e17;
  --ink-soft: #454034;
  --muted: #706957;
  --line: #ddd6c6;
  --line-strong: #c8c0ab;
  --accent: #b23c14;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9df;
  --ok: #1e7d46;
  --ok-soft: #e2f2e7;
  --warn: #9a6a12;
  --warn-soft: #f8eed3;
  --code-bg: #efe9da;
  --shadow: 0 10px 30px rgba(50, 40, 20, 0.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140f;
    --panel: #211e18;
    --panel-2: #26221b;
    --ink: #ece6d8;
    --ink-soft: #cfc7b4;
    --muted: #a39b88;
    --line: #38332a;
    --line-strong: #4c4636;
    --accent: #e2703a;
    --accent-ink: #1c130c;
    --accent-soft: #3d2718;
    --ok: #5cc98a;
    --ok-soft: #1d3325;
    --warn: #e0b95c;
    --warn-soft: #38300f;
    --code-bg: #2e2a20;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  z-index: 30;
}
.brand {
  font-family: Georgia, "Songti SC", serif;
  font-size: 19px; font-weight: 700; letter-spacing: 0.2px;
  white-space: nowrap; color: var(--ink); text-decoration: none;
}
.brand .dot { color: var(--accent); }
.brand small {
  display: block; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 400;
  font-size: 11px; color: var(--muted); letter-spacing: 0.4px;
}
.doc-title {
  flex: 1 1 auto; min-width: 0;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent;
  font-size: 16px; font-weight: 600;
  padding: 7px 10px;
}
.doc-title:hover { border-color: var(--line); }
.doc-title:focus { outline: none; border-color: var(--accent); background: var(--panel-2); }
/* Longer labels (German, Russian…) must not push the export button off screen: the status line and tagline give way first. */
.save-state { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.brand { flex: 0 1 auto; min-width: 0; }
.brand small { overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.topbar .btn, .topbar .lang-link { flex: 0 0 auto; white-space: nowrap; }
.doc-title { min-width: 120px; }
.save-state b { color: var(--ok); font-weight: 600; }
.lang-link { font-size: 13px; color: var(--ink-soft); text-decoration: none; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
.lang-link:hover { border-color: var(--ink-soft); }
.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px; font-weight: 600;
  white-space: nowrap; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--ink-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding: 9px 20px; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--line); }
.btn.small { padding: 5px 12px; font-size: 13px; }

/* ---------- app shell ---------- */
.app { height: 100vh; height: 100svh; min-height: 560px; display: flex; flex-direction: column; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 6px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  z-index: 25;
  position: relative;
}
.toolbar select { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); padding: 5px 6px; font-size: 13px; margin-inline-end: 6px; }
.tbtn {
  border: 1px solid transparent; background: transparent; color: var(--ink-soft);
  border-radius: 7px; min-width: 34px; height: 32px; padding: 0 7px;
  font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.tbtn:hover { background: var(--panel); border-color: var(--line); }
.toolbar .spacer { flex: 1; }
.wordcount { font-size: 12px; color: var(--muted); white-space: nowrap; margin-inline-end: 6px; }
.notes-btn { font-weight: 600; color: var(--ink); border-color: var(--line); background: var(--panel); }
.notes-btn .count { font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 7px; }
.notes-pop { width: min(340px, calc(100vw - 24px)); }
.notes-pop .row.first { justify-content: flex-start; margin-top: 0; }
.notes-pop .hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.notes-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: min(320px, 50vh); overflow-y: auto; border-top: 1px solid var(--line); }
.notes-list li { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.notes-list li.on { background: var(--accent-soft); }
.note-open { flex: 1; min-width: 0; text-align: start; border: 0; background: transparent; padding: 8px 6px; color: var(--ink); display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.note-open span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.note-open small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.note-del { border: 0; background: transparent; color: var(--muted); font-size: 18px; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; }
.note-del:hover { color: #c0392b; background: var(--panel-2); }
.note-pin { border: 0; background: transparent; color: var(--muted); font-size: 15px; width: 28px; height: 30px; border-radius: 6px; cursor: pointer; opacity: .55; }
.note-pin:hover, .note-pin:focus-visible, .note-pin.on { opacity: 1; }
.note-pin.on { color: var(--accent); }
.note-pin:hover { background: var(--panel-2); }
.drawer-head .flavor select { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); padding: 5px 6px; font-size: 13px; }

.popover {
  position: absolute; top: calc(100% + 4px); inset-inline-start: 12px;
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: var(--shadow);
  padding: 12px; width: min(360px, calc(100vw - 24px));
  display: none; z-index: 60;
}
.popover.open { display: block; }
.export-wrap { position: relative; display: inline-flex; }
.export-wrap #btnExport { border-start-end-radius: 0; border-end-end-radius: 0; }
.export-more { border-start-start-radius: 0; border-end-start-radius: 0; padding: 9px 10px !important; margin-inline-start: 1px; }
.export-pop { inset-inline-start: auto; inset-inline-end: 0; top: calc(100% + 6px); width: min(330px, calc(100vw - 24px)); padding: 6px; }
.menu-item { display: block; width: 100%; text-align: start; border: 0; background: transparent; border-radius: 8px; padding: 9px 10px; cursor: pointer; color: var(--ink); font: inherit; }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); }
.menu-item b { display: block; font-size: 14px; }
.menu-item small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.popover label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.popover label:first-child { margin-top: 0; }
.popover input { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); padding: 7px 9px; font-size: 14px; }
.popover .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---------- layout ---------- */
.layout { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 348px; }
.editor-scroll { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
/* RichTextEditor fills the writing column; its toolbar sits on top, the page (paper) is styled inside its frame. */
.editor-host { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; }
.editor-scroll .richtexteditor { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: var(--panel); }
/* RichTextEditor's own theme follows the system dark mode (rte-auto-dark); its big surfaces use the site palette. */
.editor-scroll rte-toolbar, .editor-scroll rte-subtoolbar { background: var(--panel-2) !important; border-color: var(--line) !important; }
.editor-scroll rte-content { background: var(--panel) !important; padding: 0 !important; border-color: var(--line) !important; }
.editor-scroll iframe.rte-editable { background: var(--panel) !important; }
.editor-scroll rte-bottom { display: none !important; }
.rte-badge { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--panel); }
.rte-badge b { color: var(--accent); font-weight: 700; }
.rte-badge:hover { border-color: var(--accent); color: var(--ink); }
.editor-foot { flex: 0 0 auto; display: flex; justify-content: center; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--panel-2); }
.rte-pill { display: inline-flex; flex-direction: column; line-height: 1.15; text-decoration: none; white-space: nowrap; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 4px 11px; }
.rte-pill span { font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--ink-soft); }
.rte-pill b { font-size: 13.5px; font-weight: 700; }
.rte-pill:hover { background: var(--accent); color: var(--accent-ink); }
.rte-pill:hover span { color: var(--accent-ink); }
.rte-banner { display: flex; gap: 18px 24px; align-items: center; flex-wrap: wrap; margin: 26px 0; padding: 18px 22px; border: 1px solid var(--accent); border-inline-start-width: 5px; border-radius: 12px; background: var(--accent-soft); }
.rte-banner-text { flex: 1 1 360px; }
.rte-banner-title { display: block; font-size: 17px; color: var(--accent); margin-bottom: 4px; }
.rte-banner p { margin: 0; line-height: 1.6; color: var(--ink-soft); }
.rte-banner-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rte-banner-actions .btn { text-decoration: none; }

/* ---------- sidebar ---------- */
.sidebar { border-inline-start: 1px solid var(--line); background: var(--panel-2); overflow-y: auto; padding: 18px 16px 60px; display: flex; flex-direction: column; gap: 26px; }
.side-sec h2 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.side-sec h2 .tag { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
.side-sec .hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.clip { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; margin-bottom: 10px; }
.clip h3 { margin: 0 0 5px; font-size: 14px; }
.clip p { margin: 0 0 8px; font-size: 13px; line-height: 1.65; color: var(--ink-soft); }
.clip .src { font-size: 12px; color: var(--muted); word-break: break-all; margin-bottom: 9px; }
.clip .actions { display: flex; gap: 8px; }
.mini-btn { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.danger:hover { border-color: #c0392b; color: #c0392b; }
.add-form { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px 13px; }
.add-form label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.add-form label:first-child { margin-top: 0; }
.add-form input, .add-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); padding: 7px 9px; font-size: 13.5px; }
.add-form textarea { min-height: 64px; resize: vertical; }
.add-form .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.fidelity-summary { border-radius: 10px; padding: 12px 13px; margin-bottom: 10px; background: var(--ok-soft); border: 1px solid var(--ok); font-size: 13.5px; line-height: 1.6; }
.fidelity-summary b { font-size: 15px; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.check-row:last-child { border-bottom: none; }
.check-row .st { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.st.pass { background: var(--ok); color: #fff; }
.st.unused { background: var(--line); color: var(--muted); }
.st.noguarantee { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.check-row .lbl { flex: 1; }
.check-row .note { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.check-row.is-unused .lbl { color: var(--muted); }
.side-more { font-size: 13px; color: var(--muted); }

/* ---------- md preview drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(20, 16, 8, 0.42); display: none; z-index: 80; }
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--panel); z-index: 90;
  box-shadow: var(--shadow);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); visibility: visible; transition: transform 0.22s ease; }
.drawer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-head > * { order: 2; }
.drawer-head #btnCloseDrawer { order: 1; }
.drawer-head #btnDownload2 { margin-inline-start: auto; }
.drawer-head h2 { order: 0; margin: 0; font-size: 16px; flex: 1 1 calc(100% - 100px); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer pre { flex: 1; overflow: auto; margin: 0; padding: 18px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all 0.2s ease; z-index: 120;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- content pages / landing ---------- */
.site { max-width: 860px; margin: 0 auto; padding: 48px 16px 24px; line-height: 1.75; font-size: 17px; }
.site h1 { font-family: Georgia, "Songti SC", serif; font-size: 36px; line-height: 1.25; margin: 0 0 14px; }
.site h2 { font-family: Georgia, "Songti SC", serif; font-size: 26px; line-height: 1.3; margin: 44px 0 12px; }
.site h3 { font-size: 18px; margin: 26px 0 6px; }
.site p, .site li { color: var(--ink-soft); }
.site .lede { font-size: 19px; color: var(--ink-soft); }
.site .updated { font-size: 13px; color: var(--muted); margin: -6px 0 10px; }
.site .tldr { background: var(--accent-soft); border-inline-start: 4px solid var(--accent); border-radius: 8px; padding: 14px 18px; margin: 18px 0 8px; }
.site .tldr ul { margin: 8px 0 0; padding-inline-start: 1.2em; }
.site .tldr li { margin: 4px 0; }
/* "On this page" list on long guides: compact, two columns when there is room. */
.site .toc { margin: 16px 0 6px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; font-size: 14.5px; }
.site .toc b { display: block; margin-bottom: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.site .toc ol { margin: 0; padding-inline-start: 1.3em; columns: 2; column-gap: 28px; }
.site .toc li { margin: 0 0 5px; break-inside: avoid; }
.site .toc a { text-decoration: none; }
.site .toc a:hover { text-decoration: underline; }
.site h2[id] { scroll-margin-top: 12px; }
@media (max-width: 640px) { .site .toc ol { columns: 1; } }
.site code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88em; background: var(--code-bg); padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.site pre code { overflow-wrap: normal; }
.site pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.site pre code { background: none; padding: 0; }
.site table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 14px 0; display: block; overflow-x: auto; }
.site th, .site td { border: 1px solid var(--line-strong); padding: 8px 11px; text-align: start; vertical-align: top; }
.site th { background: var(--panel-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; padding: 0; list-style: none; }
.cards li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--ink-soft); }
.cards li b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 16px; }
.cards a { text-decoration: none; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0; }
.faq h3 { margin-top: 22px; }
.site-header { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.site-header nav { margin-inline-start: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.site-header nav a { color: var(--ink-soft); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); }
/* Phones: the links stay on one row that scrolls sideways, instead of taking half the screen. */
@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; row-gap: 8px; }
  .site-header nav { margin-inline-start: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  /* The nav row scrolls sideways on a phone, which hid the account link. It moves up beside the brand instead. */
  .site-header { position: relative; }
  .site-header nav .nav-account { position: absolute; top: 10px; inset-inline-end: 16px; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); }
}
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 16px 40px; font-size: 14px; color: var(--muted); }
.footer .inner { max-width: 860px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 10px 20px; }
.footer a { color: var(--muted); }
.footer .copy { flex-basis: 100%; }

/* ---------- mobile ---------- */
.phone-only { display: none; }
.mobile-tabs { display: none; }
@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-inline-start: none; border-top: 1px solid var(--line); display: none; }
  body.show-side .sidebar { display: flex; }
  /* Off-screen, not display:none: RichTextEditor hangs if its box has zero size. */
  body.show-side .editor-scroll { position: fixed; left: -200vw; top: 0; width: 100vw; height: 100vh; visibility: hidden; }
  .brand small { display: none; }
  .save-state { display: none; }
  .topbar { flex-wrap: wrap; row-gap: 4px; padding: 6px 10px; gap: 6px; }
  .toolbar { padding: 4px 10px; }
  .brand { font-size: 15px; margin-inline-end: auto; }
  .lang-link { font-size: 12px; padding: 3px 8px; }
  .export-wrap .btn { padding: 6px 12px; font-size: 13px; }
  .export-more { padding: 6px 8px !important; }
  .doc-title { order: 3; flex: 1 1 100%; font-size: 14px; padding-top: 3px; padding-bottom: 3px; }
  .wordcount { display: none; }
  #btnPreview, #btnNew, #btnOpen { display: none; }
  .phone-only { display: block; }
  .notes-pop .phone-only { display: inline-block; }
  .mobile-tabs { display: flex; gap: 6px; padding: 4px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
  .mobile-tabs button { flex: 1; border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 3px 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
  .mobile-tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .btn.primary { padding: 8px 14px; }
  .site h1 { font-size: 29px; }
  .site h2 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .toast { transition: none; }
}

/* ---------- Visual / Markdown source toggle ---------- */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-inline-start: 8px; }
.view-toggle button { border: 0; background: transparent; padding: 5px 11px; font: inherit; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.view-toggle button + button { border-inline-start: 1px solid var(--line); }
.view-toggle button.on { background: var(--accent); color: var(--accent-ink); }
.md-source { display: none; position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; box-sizing: border-box; border: 0; resize: none; padding: 24px 28px; background: var(--panel); color: var(--ink); outline: none; font: 14px/1.75 ui-monospace, Menlo, Consolas, monospace; tab-size: 4; }
body.source-mode .md-source { display: block; }
/* The editor stays laid out underneath: RichTextEditor must never be given a zero-size box. */
body.source-mode .editor-scroll .editor-host { visibility: hidden !important; pointer-events: none; }
/* Split view: the Markdown box takes the left half and the finished note, read-only, the right. */
body.split-view .md-source { inset-block: 0; inset-inline: 0 auto; width: 50%; border-inline-end: 1px solid var(--line); }
body.split-view .editor-scroll .editor-host { visibility: visible !important; pointer-events: auto; width: 50%; margin-inline-start: 50%; }
@media (max-width: 899px) { #btnSplit { display: none; } }
/* Notes board: one column per value, scrolling sideways when there are many. */
.notes-board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding: 4px 2px 12px; }
.board-col { flex: 0 0 220px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.board-col.drop { border-color: var(--accent); }
.board-col h3 { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }
.board-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-height: 36px; }
.board-card { width: 100%; text-align: start; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; cursor: grab; overflow-wrap: anywhere; }
.board-card:hover, .board-card:focus-visible { border-color: var(--accent); }
.board-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.board-add { flex: 0 0 170px; border: 1px dashed var(--line); border-radius: 10px; background: transparent; color: var(--ink); padding: 10px; font: inherit; font-size: 13px; }
.toast.has-action { pointer-events: auto; }
.toast-act { margin-inline-start: 12px; border: 0; border-radius: 999px; padding: 4px 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }

/* ---------- hide the side panel for a clean writing page ---------- */
body.panel-hidden .layout { grid-template-columns: minmax(0, 1fr); }
body.panel-hidden .sidebar { display: none; }
body.panel-hidden .panel-btn { color: var(--accent); }
@media (max-width: 920px) { .panel-btn { display: none; } }

/* ---------- lighter side panel, phone-only menu items, toolbar separators ---------- */
.add-clip summary { cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 600; color: var(--accent); padding: 8px 2px; }
.add-clip summary::-webkit-details-marker { display: none; }
.add-clip summary:hover { text-decoration: underline; }
.add-clip[open] summary { margin-bottom: 4px; }
.editor-scroll rte-line-spliter { background: var(--line) !important; }
.editor-scroll rte-toolbar-splitbutton-dropdown { border-color: var(--line) !important; }
.editor-scroll rte-toolbar-splitbutton:hover, .editor-scroll rte-toolbar-button:hover { background-color: var(--panel) !important; border-color: var(--line) !important; }
/* The writing area scrolls inside the frame; its wrapper must not be a second, keyboard-unreachable scroller. */
.editor-scroll rte-content { overflow: hidden !important; }
@media (prefers-color-scheme: dark) {
  .side-sec h2 .tag, .rte-banner-title, .notes-btn .count { color: #f4a071; }
}
.app-body { display: contents; }
.notes-search { display: block; margin-top: 10px; }
.notes-search[hidden] { display: none; }
.notes-none { padding: 10px 6px; font-size: 13px; color: var(--muted); }

/* ---------- shortcut help ---------- */
.help-btn { font-weight: 700; }
.help-pop { width: min(520px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.help-pop h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.help-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; align-items: baseline; }
.help-pop dt { white-space: nowrap; }
.help-pop dd { margin: 0; font-size: 13px; color: var(--ink-soft); }
.help-pop code, .help-pop kbd { font: 12px ui-monospace, Menlo, Consolas, monospace; background: var(--code-bg); border-radius: 4px; padding: 1px 5px; white-space: pre; }
@media (max-width: 520px) { .help-cols { grid-template-columns: 1fr; } }

/* ---------- find and replace ---------- */
.find-bar { position: absolute; top: 46px; inset-inline-end: 14px; z-index: 4; width: min(430px, calc(100% - 20px)); box-sizing: border-box; display: grid; gap: 6px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .14); }
.find-bar[hidden] { display: none; }
body.source-mode .find-bar { top: 8px; }
.find-row { display: flex; align-items: center; gap: 4px; }
.find-row input { flex: 1 1 auto; min-width: 0; height: 30px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink); padding: 0 8px; font-size: 14px; }
.find-bar.none #findInput { border-color: var(--accent); }
.find-count { flex: none; font-size: 12px; color: var(--muted); padding: 0 4px; white-space: nowrap; }
.find-btn { flex: none; min-width: 28px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); font-size: 14px; cursor: pointer; }
.find-btn.wide { padding: 0 9px; font-size: 13px; border: 1px solid var(--line); white-space: nowrap; }
.find-btn:hover:not(:disabled) { background: var(--panel-2); }
.find-btn:disabled { color: var(--muted); opacity: .55; cursor: default; }
.find-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* ---------- outline ---------- */
.outline-pop { width: min(320px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; padding: 6px; }
.outline-pop .hint { margin: 6px; font-size: 13px; color: var(--muted); }
.outline-item { display: block; width: 100%; box-sizing: border-box; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); font: inherit; font-size: 13.5px; line-height: 1.5; text-align: start; padding: 4px 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outline-item:hover { background: var(--panel-2); color: var(--ink); }
.outline-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- text tools ---------- */
.site.tool-page { max-width: 1120px; }
.tool-page .lede { max-width: 760px; }
.text-tool { margin: 18px 0 8px; }
.tool-opts { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 14.5px; line-height: 1.4; margin-bottom: 12px; }
.tool-check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.tool-field { display: inline-flex; gap: 8px; align-items: center; max-width: 100%; min-width: 0; }
.tool-field select { min-width: 0; max-width: 100%; flex: 0 1 auto; } /* long option labels in some languages must not widen the page */
.tool-field select, .tool-field input { font: inherit; font-size: 14px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--ink); }
.tool-field input { width: 220px; max-width: 60vw; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tool-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tool-pane { display: flex; flex-direction: column; min-width: 0; }
.pane-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; font-size: 14px; min-height: 32px; }
.pane-head > label, .pane-head > b { font-weight: 700; }
.pane-actions { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.tool-note { color: var(--muted); font-size: 13px; }
.tool-note.bad { color: var(--accent); font-weight: 600; }
.tool-pane textarea { width: 100%; box-sizing: border-box; min-height: 340px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: 14px/1.55 ui-monospace, Menlo, Consolas, "Microsoft YaHei", monospace; tab-size: 4; }
.tool-pane textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.tool-pane textarea[readonly] { background: var(--panel-2); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tool-preview { margin-top: 12px; padding: 14px 18px; border: 1px dashed var(--line); border-radius: 10px; background: var(--panel); line-height: 1.65; overflow-x: auto; }
.tool-preview table { border-collapse: collapse; }
.tool-preview th, .tool-preview td { border: 1px solid var(--line); padding: 4px 10px; }
.tool-privacy { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-grid div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 2px; }
.stats-grid b { font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats-grid b.words { font-size: 19px; }
.stats-grid span { font-size: 13px; color: var(--muted); line-height: 1.3; }
.top-words h2 { font-size: 15px; margin: 18px 0 6px; }
.top-words ol { margin: 0; padding-inline-start: 22px; columns: 2; font-size: 14px; }
.tool-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.tool-list li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel); line-height: 1.4; }
.tool-list li a { font-weight: 700; text-decoration: none; }
.tool-list li small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.tool-list li.on { border-color: var(--accent); }
@media (max-width: 760px) {
  .tool-panes, .tool-panes.stats { grid-template-columns: 1fr; }
  .tool-pane textarea { min-height: 200px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.tool-langs { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; margin: -4px 0 14px; }
.tool-langs a { color: var(--muted); text-decoration: none; }
.tool-langs a:hover { color: var(--accent); text-decoration: underline; }
.tool-langs b { color: var(--ink); font-weight: 600; }

/* Richscripts family: cluster bar in the footer, next-step cards on tool pages (matrix.config.mjs). */
.footer .family-owner { color: inherit; }
.footer .more-tools { flex-basis: 100%; line-height: 1.6; }
.footer .more-tools b { color: var(--ink-soft); }
.footer .more-tools ul { list-style: none; margin: 4px 0 0; padding: 0; }
.footer .more-tools a { overflow-wrap: anywhere; }
.footer .family { flex-basis: 100%; margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.footer .family summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.footer .family ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer .family b { color: var(--ink-soft); }
.footer .family small { font-size: 12px; }
.footer .family .family-tools::before { content: "·"; margin-inline-end: 18px; }
.next-steps { display: grid; gap: 12px; margin: 22px 0 6px; }
.next-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 14px 18px; border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 10px; }
.next-step b { flex-basis: 100%; }
.next-step p { flex: 1 1 320px; margin: 0; color: var(--ink-soft); line-height: 1.55; }
.next-step .btn { text-decoration: none; }

/* Guides index */
.guide-list { list-style: none; padding: 0; margin: 0 0 8px; }
.guide-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.guide-list a { font-weight: 600; }
.guide-list span { display: block; color: var(--ink-soft); font-size: 15px; line-height: 1.5; margin-top: 2px; }

/* Links between notes: backlinks in the sidebar, tag chips, quick switcher (Ctrl+O), link graph */
.links-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.links-item { width: 100%; text-align: start; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 10px; color: var(--ink); cursor: pointer; display: grid; gap: 3px; font: inherit; }
.links-item:hover, .links-item:focus-visible { border-color: var(--accent); }
.links-item strong { font-size: 13.5px; }
.links-item span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; align-items: center; }
.tag-chips[hidden] { display: none; }
.tag-head { width: 100%; margin: 0; font-size: 12px; color: var(--muted); }
.tag-chip { border: 1px solid var(--line); background: var(--panel-2); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; font: inherit; font-size: 12.5px; }
.tag-chip:hover, .tag-chip:focus-visible { border-color: var(--accent); }
.quick-switch, .graph-pop { position: fixed; inset: 0; z-index: 60; background: rgba(20, 16, 10, .35); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.quick-switch[hidden], .graph-pop[hidden] { display: none; }
.quick-box, .graph-box { width: min(560px, 100%); background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); padding: 12px; }
.graph-box { width: min(760px, 100%); }
.quick-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--ink); padding: 10px 12px; font: inherit; font-size: 15px; }
.quick-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(360px, 50vh); overflow-y: auto; }
.quick-item { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14.5px; }
.quick-item.on { background: var(--accent-soft); }
.quick-none { color: var(--muted); cursor: default; }
.quick-hint { margin: 10px 2px 0; font-size: 12px; color: var(--muted); }
.graph-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.graph-head h2 { margin: 0; font-size: 16px; }
.graph-canvas svg { width: 100%; height: auto; display: block; background: var(--panel-2); border-radius: 8px; }
.graph-edge { stroke: var(--line-strong); stroke-width: 1.2; }
.graph-node { cursor: pointer; outline: none; }
.graph-node circle { fill: var(--muted); }
.graph-node text { fill: var(--ink); font-size: 12px; pointer-events: none; }
.graph-node.on circle, .graph-node:hover circle, .graph-node:focus-visible circle { fill: var(--accent); }
.link-suggest { position: fixed; z-index: 70; list-style: none; margin: 0; padding: 4px; min-width: 200px; max-width: 320px; max-height: 260px; overflow-y: auto; background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.link-suggest[hidden] { display: none; }
.link-suggest li { padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-suggest li.on { background: var(--accent-soft); }
.props-sec .props-rows { display: grid; gap: 6px; }
.props-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 4px; align-items: center; }
.props-row input { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); padding: 5px 7px; font: inherit; font-size: 13px; }
.props-key { color: var(--muted); }
.props-del { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.props-del:hover, .props-del:focus-visible { color: var(--accent); }
.props-add { margin-top: 8px; }
.props-raw { width: 100%; min-height: 120px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); padding: 8px; font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.notes-list .folder-head { display: flex; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.notes-list .folder-head.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.folder-open { flex: 1; min-width: 0; text-align: start; border: 0; background: transparent; padding: 7px 8px; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.folder-open:hover, .folder-open:focus-visible { color: var(--ink); }
.notes-list li[draggable="true"] { cursor: grab; }
.folder-new { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin: 10px 0 0; align-items: center; }
.folder-new input { min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--ink); padding: 6px 9px; font: inherit; font-size: 13.5px; }
.folder-new .hint { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.links-item.muted { color: var(--muted); }
.links-item.muted strong { font-weight: 500; font-style: italic; }
.out-sec h2.sub { margin-top: 16px; }
.notes-tools { flex-wrap: wrap; justify-content: flex-start; margin-top: 8px; }
.template-box { margin-top: 8px; }
.template-box .links-list { margin-top: 6px; }
.view-tools { justify-content: flex-start; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.view-tools label { display: inline-flex; align-items: center; gap: 6px; }
.view-tools select { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink); padding: 3px 6px; font: inherit; }
.local-graph { margin-top: 12px; }
.local-graph svg { width: 100%; height: auto; display: block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.local-graph .graph-center { fill: var(--accent); }
.local-graph .graph-node text { font-size: 11px; }
.notes-list .note-open em.snip { display: block; flex-basis: 100%; font-style: normal; color: var(--muted); font-size: 12px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-tip { position: fixed; z-index: 65; max-width: 320px; pointer-events: none; background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 8px 12px; font-size: 13px; line-height: 1.5; }
.link-tip[hidden] { display: none; }
.link-tip p { margin: 4px 0 0; color: var(--ink-soft); }

/* Canvas: cards on a board (Obsidian .canvas format) */
.canvas-pop { position: fixed; inset: 0; z-index: 62; background: var(--panel-2); color: var(--ink); display: flex; flex-direction: column; }
.canvas-pop[hidden] { display: none; }
.canvas-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.canvas-bar select { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink); padding: 4px 6px; font: inherit; font-size: 13px; max-width: 200px; }
.canvas-stage { position: relative; flex: 1; overflow: hidden; cursor: grab; touch-action: none; background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 24px 24px; }
.canvas-stage:focus { outline: none; }
.canvas-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; width: 1px; height: 1px; }
.canvas-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.canvas-edge { pointer-events: stroke; cursor: pointer; }
.canvas-hit { stroke: transparent; stroke-width: 14; fill: none; pointer-events: stroke; }
.canvas-line { stroke: var(--muted); stroke-width: 2; fill: none; }
.canvas-edge.sel .canvas-line { stroke: var(--accent); stroke-width: 3; }
.canvas-node { position: absolute; box-sizing: border-box; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); padding: 8px 10px; cursor: move; user-select: none; }
.canvas-node.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.canvas-node.from { outline: 2px dashed var(--accent); outline-offset: 2px; }
.canvas-node.is-file strong { display: block; font-size: 15px; }
.canvas-node.is-file span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.canvas-node.is-file.missing { border-style: dashed; color: var(--muted); }
.canvas-node textarea { width: 100%; min-height: 90px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.5; resize: none; outline: none; cursor: text; user-select: text; }
.canvas-node[data-color] { border-width: 2px; }
/* A group is a dashed frame behind the cards; only its title is editable. */
.canvas-node.is-group { background: transparent; box-shadow: none; border: 2px dashed var(--line-strong); border-radius: 14px; }
.canvas-node.is-group textarea { min-height: 28px; font-weight: 700; }
.canvas-node[data-color="1"] { border-color: #e03131; }
.canvas-node[data-color="2"] { border-color: #f08c00; }
.canvas-node[data-color="3"] { border-color: #e0ac00; }
.canvas-node[data-color="4"] { border-color: #2f9e44; }
.canvas-node[data-color="5"] { border-color: #1098ad; }
.canvas-node[data-color="6"] { border-color: #9c36b5; }
.canvas-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; border-inline-end: 3px solid var(--line-strong); border-bottom: 3px solid var(--line-strong); border-radius: 0 0 9px 0; }
.canvas-empty { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); margin: 0; color: var(--muted); font-size: 14px; text-align: center; pointer-events: none; width: min(420px, 80%); }
.canvas-hint { margin: 0; padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: var(--panel); }
/* Pro licence box and version history, in the notes menu. */
.pro-box, .history-box { margin: 8px 0; }
.pro-box summary, .history-box summary { cursor: pointer; font-weight: 600; }
.pro-box .row { display: flex; gap: 6px; flex-wrap: wrap; }
.pro-box .pro-key { flex: 1 1 180px; min-width: 0; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; }
.history-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 220px; overflow: auto; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px; }
/* Pricing page. */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.plan { border: 1px solid var(--line-strong); border-radius: 14px; padding: 18px; background: var(--panel); }
.plan.featured { border-color: var(--accent); border-width: 2px; }
.plan h2 { margin: 0 0 4px; font-size: 20px; }
.plan .price { font-size: 30px; font-weight: 700; margin: 6px 0; }
.plan .price small { font-size: 14px; font-weight: 400; color: var(--muted); }
.plan ul { margin: 10px 0 14px; padding-inline-start: 18px; }
.plan li { margin: 4px 0; }
/* Sign-in, register and account pages. */
.account-form { display: grid; gap: 12px; max-width: 420px; margin: 16px 0; }
.account-form[hidden] { display: none; }
.account-form label { display: grid; gap: 4px; font-size: 14px; }
.account-form label.check { display: flex; gap: 8px; align-items: flex-start; }
.account-form input[type=email], .account-form input[type=password], .account-form input[type=text] { padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.form-msg { min-height: 1.4em; margin: 0; color: var(--muted); }
.recovery-show { max-width: 520px; margin: 16px 0; padding: 14px 16px; border: 2px solid var(--accent, #b23c14); border-radius: 10px; background: var(--panel); }
.recovery-show h2 { margin-top: 0; }
.recovery-show label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.recovery-code { display: inline-block; padding: 10px 12px; font: 600 17px/1.5 ui-monospace, Consolas, monospace; letter-spacing: .04em; word-break: break-all; user-select: all; }
.btn.is-off { opacity: .5; cursor: not-allowed; }
.cloud-box { margin: 8px 0; }
.cloud-box summary { cursor: pointer; font-weight: 600; }
.cloud-box .row { display: flex; gap: 6px; flex-wrap: wrap; }
.account-btn { white-space: nowrap; text-decoration: none; }
.editor-cta { margin: 18px 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); font-size: 14px; line-height: 1.6; }
.editor-cta .btn { margin-inline-start: 6px; }
.share-row { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-strong); }
.share-row .share-url { flex: 1 1 200px; min-width: 0; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; }
.account-shares { list-style: none; padding: 0; }
.account-shares li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-strong); max-width: 520px; }
.template-card { margin: 28px 0; padding-top: 8px; border-top: 1px solid var(--line-strong); }
.template-md { max-height: 320px; overflow: auto; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.template-index { font-size: 14px; }

/* PDF style chooser in the export menu */
.export-pop .theme-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-soft); cursor: default; }
.export-pop .theme-row select { font: inherit; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); color: var(--ink); max-width: 62%; }

/* ---------- Right-to-left pages (Arabic, Persian, Urdu) ---------- */
/* Layout uses start and end above, so it mirrors by itself. These cover what does not: fonts, code, the canvas and arrows. */
html:lang(ar), html:lang(fa) { --rtl-font: 'Segoe UI', 'Noto Naskh Arabic', 'Noto Sans Arabic', Tahoma, sans-serif; }
html:lang(ur) { --rtl-font: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Urdu Typesetting', 'Segoe UI', Tahoma, serif; }
html[dir="rtl"] body { font-family: var(--rtl-font); }
html:lang(ur) main.site { line-height: 2.1; }
[dir="rtl"] pre, [dir="rtl"] code, [dir="rtl"] kbd, [dir="rtl"] .md-source, [dir="rtl"] .md-preview, [dir="rtl"] .template-md { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] pre, [dir="rtl"] .md-source { text-align: left; }
/* The canvas is a drawing surface with its own coordinates: it keeps one direction in every language. */
[dir="rtl"] .canvas-stage, [dir="rtl"] .canvas-world { direction: ltr; }
[dir="rtl"] .drawer { right: auto; left: 0; }
/* The Markdown box reads left to right, which would also anchor it to the left: place it on the right by hand. */
[dir="rtl"] body.split-view .md-source { left: auto; right: 0; }
