/* FastWikiGen — one stylesheet for the site, the generator and published wikis. */
:root {
  --bg: #f7f7fc; --surface: #ffffff; --surface-2: #f2f2f9; --ink: #17172b; --ink-2: #33334a; --muted: #5d5d78; --line: #e3e3ef; --line-2: #d3d3e4;
  --acc: #4f46e5; --acc-2: #4338ca; --acc-ink: #ffffff; --acc-soft: #eef0ff; --acc-line: #c9cbff;
  --ok: #0f7b52; --ok-soft: #e6f6ee; --err: #c0262d; --err-soft: #fdecec; --warn: #9a5800; --warn-soft: #fff4e0;
  --code-bg: #16161f; --code-ink: #e9e9f5;
  --r: 12px; --r-sm: 8px; --shadow: 0 1px 2px rgba(23, 23, 43, .05), 0 8px 24px rgba(23, 23, 43, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  --top: 60px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; }
a { color: var(--acc); }
a:hover { color: var(--acc-2); }
h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); }
code { font-family: var(--mono); font-size: .88em; }
:focus-visible { outline: 3px solid var(--acc-line); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13.5px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--acc); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 12px; }
.hp { position: absolute; left: -5000px; }
.ic { flex: none; vertical-align: -3px; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--acc);
  background: var(--acc); color: var(--acc-ink); font: 600 15px/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--acc-2); border-color: var(--acc-2); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-outline:hover { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 10px 22px; font-size: 16px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--acc); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger { color: var(--err); }
.pro-tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--acc-2); background: var(--acc-soft); border: 1px solid var(--acc-line); border-radius: 999px; padding: 0 6px; line-height: 17px; }
body.is-pro .pro-tag { display: none; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-row { display: flex; align-items: center; gap: 16px; min-height: var(--top); }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-size: 19px; letter-spacing: -.01em; }
.brand b, .footer-brand b { color: var(--acc); }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--acc); color: #fff; }
#primary-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
#primary-nav a:not(.btn) { color: var(--ink-2); text-decoration: none; padding: 8px 11px; border-radius: 8px; font-size: 15px; }
#primary-nav a:not(.btn):hover, #primary-nav a[aria-current] { background: var(--surface-2); color: var(--ink); }
.pro-btn { margin-left: 6px; }
.pro-btn.is-pro { background: var(--ok-soft); color: var(--ok); border-color: #b7e3cb; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 12px; font: inherit; color: var(--ink); cursor: pointer; }

/* ---------- hero + generator ---------- */
.hero { padding: 44px 0 14px; text-align: center; }
.hero h1 { font-size: clamp(30px, 4.6vw, 48px); letter-spacing: -.025em; margin: 6px auto 12px; max-width: 900px; }
.hero .lead { font-size: 18.5px; color: var(--ink-2); max-width: 760px; margin: 0 auto 16px; }
.hero-points { list-style: none; padding: 0; margin: 0 auto 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; color: var(--muted); font-size: 14.5px; }
.hero-points li { display: inline-flex; align-items: center; gap: 6px; }
.hero-points .ic { color: var(--acc); }
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

.gen { max-width: 900px; margin: 18px auto 0; }
.gen-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; width: max-content; max-width: 100%; margin-bottom: 14px; overflow-x: auto; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 14px; border-radius: 9px; font: 600 14.5px var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 23, 43, .12); }
.pane textarea, .field input, .field select, .field textarea, .pb-row input, .row-inline input {
  width: 100%; font: 16px/1.5 var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.pane textarea:focus, .field input:focus, .field select:focus, .field textarea:focus, .pb-row input:focus, .row-inline input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
#g-topic { font-size: 18px; resize: vertical; min-height: 64px; }
#g-text { resize: vertical; min-height: 200px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 999px; padding: 4px 11px; font: 13.5px var(--font); cursor: pointer; }
.chip:hover { border-color: var(--acc-line); background: var(--acc-soft); color: var(--acc-2); }
.pane-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
[data-count].over { color: var(--err); font-weight: 600; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 30px 18px; border: 2px dashed var(--line-2); border-radius: 14px; cursor: pointer; color: var(--ink-2); background: var(--surface-2); }
.drop:hover, .drop.over { border-color: var(--acc); background: var(--acc-soft); }
.drop .ic { color: var(--acc); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-info { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14.5px; }
.file-info.ok { background: var(--ok-soft); }
.file-info.warn { background: var(--warn-soft); }
.file-info.err { background: var(--err-soft); color: var(--err); }
.gen-opts { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-top: 14px; }
.field { margin: 0 0 12px; }
.gen-opts .field { margin: 0; }
.field label, .field .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; color: var(--ink-2); }
.gen-go { min-width: 190px; }
.gen-quota { margin: 12px 0 0; }
.form-msg { min-height: 0; margin: 8px 0 0; font-size: 14.5px; }
.form-msg:empty { display: none; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }
.form-msg.warn { color: var(--warn); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-inline { display: flex; gap: 8px; }

.gen-progress { margin-top: 14px; background: var(--surface); border: 1px solid var(--acc-line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.gp-head { display: flex; align-items: center; gap: 12px; }
.gp-head > div { flex: 1; display: flex; flex-direction: column; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--acc-soft); border-top-color: var(--acc); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.gp-list { margin: 12px 0 10px; padding-left: 22px; columns: 2; column-gap: 28px; font-size: 14.5px; color: var(--ink-2); }
.gp-list:empty { display: none; }
.gp-list li { break-inside: avoid; padding: 1px 0; }
.gp-list li::marker { color: var(--ok); }
.gp-list li.doing { color: var(--acc-2); font-weight: 600; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--acc), #8b5cf6); border-radius: 99px; transition: width .5s ease; }

/* ---------- result ---------- */
.result { margin: 26px auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 18px 26px; scroll-margin-top: calc(var(--top) + 10px); }
.result-bar { position: sticky; top: var(--top); z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; margin-bottom: 4px; background: var(--surface); border-bottom: 1px solid var(--line); }
.rb-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-ok, .badge-draft, .badge-warn { font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-draft { background: var(--surface-2); color: var(--muted); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 270px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(23, 23, 43, .14); padding: 6px; }
.menu-list button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: 0; background: none; padding: 9px 11px; border-radius: 8px; font: 14.5px var(--font); color: var(--ink); cursor: pointer; }
.menu-list button:hover, .menu-list button:focus { background: var(--acc-soft); outline: none; }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.publish-box { margin: 12px 0 4px; padding: 14px; border-radius: 12px; background: var(--acc-soft); border: 1px solid var(--acc-line); }
.pb-row { display: flex; gap: 8px; margin-bottom: 8px; }
.pb-row input { flex: 1; min-width: 0; padding: 7px 10px; font-size: 15px; }
.publish-box .hint { margin: 4px 0 0; }

.wiki-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; margin-top: 18px; }
.wiki-side { position: sticky; top: calc(var(--top) + 64px); align-self: start; max-height: calc(100vh - var(--top) - 84px); overflow: auto; overscroll-behavior: contain; padding-right: 6px; }
.page-wiki .wiki-side { top: calc(var(--top) + 20px); max-height: calc(100vh - var(--top) - 40px); }
.wtoc-toggle { display: none; }
.wtoc { font-size: 14px; }
.wtoc-h { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.wtoc ol { list-style: none; margin: 0; padding: 0; }
.wtoc ol ol { padding-left: 12px; margin: 2px 0 4px; border-left: 1px solid var(--line); }
.wtoc a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.wtoc ol ol a { font-size: 13.5px; color: var(--muted); }
.wtoc a:hover { background: var(--surface-2); color: var(--ink); }
.wtoc a.active { background: var(--acc-soft); color: var(--acc-2); font-weight: 600; }

/* ---------- wiki typography (preview, published page) ---------- */
.wiki { font-size: 16.5px; line-height: 1.7; color: var(--ink); max-width: 780px; overflow-wrap: break-word; }
.wiki-head { position: relative; padding-bottom: 6px; }
.wiki h1 { font-size: clamp(28px, 3.6vw, 38px); letter-spacing: -.02em; margin: 6px 0 10px; }
.wiki-summary { font-size: 18px; color: var(--ink-2); }
.wiki-summary p { margin: 0 0 .6em; }
.wsec { position: relative; }
.wiki h2 { font-size: 25px; margin: 1.9em 0 .55em; padding-bottom: .3em; border-bottom: 1px solid var(--line); letter-spacing: -.01em; }
.wiki h3 { font-size: 20px; margin: 1.6em 0 .45em; }
.wiki h4 { font-size: 17px; margin: 1.4em 0 .4em; }
.wiki h5, .wiki h6 { font-size: 16px; margin: 1.2em 0 .3em; color: var(--ink-2); }
.wiki h2, .wiki h3, .wiki h4 { scroll-margin-top: calc(var(--top) + 70px); }
.page-wiki .wiki h2, .page-wiki .wiki h3, .page-wiki .wiki h4 { scroll-margin-top: calc(var(--top) + 16px); }
.anchor { margin-left: 8px; color: var(--line-2); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .15s; }
.wiki h2:hover .anchor, .wiki h3:hover .anchor, .anchor:focus { opacity: 1; }
.wiki p { margin: 0 0 1em; }
.wiki ul, .wiki ol { margin: 0 0 1em; padding-left: 1.5em; }
.wiki li { margin: .25em 0; }
.wiki li > ul, .wiki li > ol { margin: .25em 0; }
.wiki li.task { list-style: none; margin-left: -1.3em; }
.wiki li.task input { margin: 0 6px 0 0; vertical-align: -1px; }
.wiki code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: .08em .35em; }
.wiki pre { background: var(--code-bg); color: var(--code-ink); border-radius: 10px; padding: 14px 16px; overflow: auto; font-size: 14px; line-height: 1.55; margin: 0 0 1.2em; }
.wiki pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.wiki blockquote { margin: 0 0 1.2em; padding: 10px 16px; border-left: 4px solid var(--acc); background: var(--acc-soft); border-radius: 0 10px 10px 0; color: var(--ink-2); }
.wiki blockquote p:last-child { margin-bottom: 0; }
.wiki hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; -webkit-overflow-scrolling: touch; }
.wiki table, .prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.wiki th, .wiki td, .prose th, .prose td { border: 1px solid var(--line); padding: 8px 11px; text-align: left; vertical-align: top; }
.wiki thead th, .prose thead th { background: var(--surface-2); font-weight: 650; }
.wiki a { text-underline-offset: 2px; }
.wl { text-decoration: none; border-bottom: 1px solid var(--acc-line); }
.wl:hover { border-bottom-color: var(--acc); background: var(--acc-soft); }
.wl-new { border-bottom-style: dashed; }
.wsec-foot { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.wsec-foot p { margin: 4px 0; }
.wtags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 6px; }
.wtags li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; font-size: 12.5px; margin: 0; }
.wrel span, .wback span { font-weight: 650; color: var(--ink-2); margin-right: 4px; }
.wrel a { display: inline-block; margin-right: 10px; }
.wsec-edit { display: none; position: absolute; right: 0; top: 2.1em; font: 600 12.5px var(--font); border: 1px solid var(--acc-line); background: var(--acc-soft); color: var(--acc-2); border-radius: 7px; padding: 3px 10px; cursor: pointer; }
.wiki-head .wsec-edit { top: 10px; }
body.editing .wsec-edit { display: inline-block; }
body.editing .wsec { outline: 1px dashed var(--line-2); outline-offset: 8px; border-radius: 4px; }
.wsec-edit:hover { background: var(--acc); color: #fff; }

/* ---------- my wikis ---------- */
.mine { max-width: 900px; margin: 26px auto 0; }
.mine-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mine h2 { font-size: 19px; margin: 0; }
.mine-list { list-style: none; padding: 0; margin: 12px 0 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.mine-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.mine-list li:first-child { border-top: 0; }
.mine-list li.current { background: var(--acc-soft); }
.mi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mi-title { border: 0; background: none; padding: 0; text-align: left; font: 600 15.5px var(--font); color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-title:hover { color: var(--acc); }
.mi-btns { display: flex; gap: 4px; flex: none; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 18px; padding: 24px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 64px rgba(23, 23, 43, .25); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(23, 23, 43, .45); }
.edit-dialog { width: min(820px, calc(100vw - 24px)); }
.dialog-close { position: absolute; right: 12px; top: 10px; margin: 0; }
.dialog-close button { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.dialog-close button:hover { background: var(--surface-2); }
dialog h2 { margin: 0 0 8px; font-size: 22px; padding-right: 32px; }
#e-content { font-family: var(--mono); font-size: 14px; line-height: 1.55; resize: vertical; }
.edit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pro-state { background: var(--ok-soft); color: var(--ok); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.key-entry { margin-top: 12px; }
.key-entry summary { cursor: pointer; font-weight: 600; }
.key-entry .row-inline { margin-top: 8px; }
.key-box { font: 700 20px var(--mono); letter-spacing: 1px; background: var(--surface-2); border: 1px dashed var(--line-2); padding: 12px 16px; border-radius: 10px; display: inline-block; }

/* ---------- pricing ---------- */
.price-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.price-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface); display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.price-card h3 { margin: 0; font-size: 17px; }
.price-card .price { font-size: 32px; font-weight: 800; margin: 4px 0 6px; letter-spacing: -.02em; }
.price-card .muted { font-size: 14.5px; flex: 1; }
.narrow-field { max-width: 380px; }
.plans th[scope="row"] { font-weight: 500; }

/* ---------- content pages ---------- */
.content { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; margin-top: 56px; padding-bottom: 40px; }
.prose { font-size: 16.5px; line-height: 1.7; }
.prose h2 { font-size: 25px; margin: 1.6em 0 .5em; letter-spacing: -.01em; }
.prose h3 { font-size: 19px; margin: 1.3em 0 .4em; }
.prose section:first-child h2 { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: .05em .35em; }
.page { padding: 40px 0 60px; }
.narrow { max-width: 820px; }
.page h1 { font-size: clamp(30px, 4vw, 40px); letter-spacing: -.02em; margin: 0 0 12px; }
.lead { font-size: 18px; color: var(--ink-2); }
.faq { margin-top: 2em; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 0 0 8px; padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.faq details p { margin: 0 0 14px; color: var(--ink-2); }
.more h2 { font-size: 18px; margin: 0 0 12px; }
.cards { display: grid; gap: 10px; }
.page .cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 20px; }
.card { display: flex; flex-direction: column; gap: 3px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--acc-line); box-shadow: var(--shadow); color: var(--ink); }
.card .muted { font-size: 14px; }
.contact-form { margin-top: 18px; }
.contact-form textarea { resize: vertical; }

/* ---------- published wiki page ---------- */
.wiki-page { padding: 22px 20px 50px; }
.wiki-page .wiki-layout { margin-top: 10px; }
.wiki-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.wt-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.made-with { margin: 44px 0 0; }
.made-with a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: 14px; }
.made-with a:hover { border-color: var(--acc-line); color: var(--acc-2); }
.made-with .ic { color: var(--acc); }
.wiki-foot { margin-top: 18px; }

/* ---------- footer ---------- */
.footer { margin-top: 64px; padding: 36px 0 26px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; margin-bottom: 22px; }
.footer-brand { font-size: 18px; margin: 0 0 6px; }
.footer-col { display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.footer-col a { color: var(--ink-2); text-decoration: none; }
.footer-col a:hover { color: var(--acc); }
.footer-h { font-weight: 700; margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .wiki-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wiki-side { position: static; max-height: none; overflow: visible; padding: 0; margin-bottom: 8px; }
  .wtoc-toggle { display: inline-flex; }
  .wiki-side .wtoc { display: none; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .wiki-side.open .wtoc { display: block; }
  .content { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  #primary-nav { display: none; position: absolute; left: 0; right: 0; top: var(--top); flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; box-shadow: var(--shadow); }
  #primary-nav.open { display: flex; }
  .pro-btn { margin: 6px 0 0; }
  .topbar-row { position: relative; }
  .gen-opts { grid-template-columns: 1fr 1fr; }
  .gen-go { grid-column: 1 / -1; width: 100%; }
  .gp-list { columns: 1; }
  .row2, .price-cards { grid-template-columns: 1fr; }
  .result { padding: 10px 14px 20px; border-radius: 14px; }
  .result-bar { position: static; }
  .rb-actions .btn { flex: 1 1 auto; }
  .menu-list { right: auto; left: 0; }
  .pb-row { flex-wrap: wrap; }
  .pb-row input { flex-basis: 100%; }
  .wsec-edit { position: static; margin: 0 0 8px; }
  .hero { padding-top: 28px; }
  .hero .lead { font-size: 17px; }
  .wiki { font-size: 16px; }
  .wiki h2 { font-size: 22px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .gen-card { padding: 14px; border-radius: 14px; }
  .gen-opts { grid-template-columns: 1fr; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; justify-content: center; padding: 8px 6px; font-size: 13.5px; }
  .footer-grid { grid-template-columns: 1fr; }
  .mine-list li { flex-wrap: wrap; }
}

/* ---------- print: published wikis, and Export → PDF in the generator ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .footer, .skip-link, .wiki-tools, .made-with, .wiki-foot, .wtoc-toggle, .anchor, .wsec-edit, dialog { display: none !important; }
  .wiki-layout { display: block; }
  .wiki-side { position: static; max-height: none; overflow: visible; }
  .wiki-side .wtoc { display: block !important; border: 0; padding: 0; page-break-after: always; }
  .wtoc a { padding: 1px 0; color: #000; }
  .wtoc a.active { background: none; font-weight: 400; }
  .wiki { max-width: none; font-size: 11pt; }
  .wiki h2, .wiki h3, .wiki h4 { break-after: avoid; page-break-after: avoid; }
  .wiki pre, .wiki table, .wiki blockquote { break-inside: avoid; }
  .wiki pre { background: #f4f4f8; color: #111; border: 1px solid #ddd; white-space: pre-wrap; }
  .wiki a { color: #000; text-decoration: none; border: 0; }
  body.print-result main > *:not(.wrap), body.print-result .hero, body.print-result .gen, body.print-result .mine, body.print-result .content,
  body.print-result .result-bar, body.print-result .publish-box, body.print-result [data-result-msg] { display: none !important; }
  body.print-result .result { border: 0; box-shadow: none; padding: 0; margin: 0; }
}

/* ---------- search inside a wiki ---------- */
.wsearch { position: relative; margin: 0 0 12px; }
.wsearch input { width: 100%; padding: 7px 30px 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; font: 14px var(--font); background: var(--surface); color: var(--ink); }
.wsearch input:focus { outline: 2px solid var(--acc-line); border-color: var(--acc); }
.wsearch kbd { position: absolute; right: 8px; top: 7px; font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; background: var(--surface-2); pointer-events: none; }
.wsearch input:focus + kbd, .wsearch input:not(:placeholder-shown) + kbd { display: none; }
.ws-count { margin: 6px 2px 4px; font-size: 12.5px; }
.ws-count:empty { display: none; }
.ws-results { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.ws-results a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.ws-results a:hover, .ws-results a:focus { background: var(--surface-2); color: var(--ink); }
.ws-results strong { display: block; font-weight: 600; color: var(--ink); }
.ws-snip { display: block; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.ws-snip mark, ::highlight(wiki-search) { background: #ffe58a; color: inherit; }
@media (max-width: 1000px) {
  .wiki-side .wsearch { display: none; margin-top: 10px; }
  .wiki-side.open .wsearch { display: block; }
}

/* ---------- AI tools in the section editor ---------- */
.ai-tools { margin: 4px 0 12px; padding: 10px 12px; border: 1px solid var(--acc-line); border-radius: 12px; background: var(--acc-soft); }
.ai-tools.busy { opacity: .75; }
.ai-tools.busy .ai-h .ic { animation: spin 1.2s linear infinite; }
.ai-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ai-row > span { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ai-row + .ai-row { margin-top: 8px; }
.ai-h { font-weight: 700; color: var(--acc-2); display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
.ai-custom input { flex: 1; min-width: 200px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; font: 14px var(--font); background: var(--surface); }
.ai-tools .form-msg { margin: 8px 0 0; }
.ai-tools .form-msg:empty { display: none; }
.ai-quota { margin: 6px 0 0; font-size: 12.5px; }

/* ---------- concept link menu (preview) ---------- */
.concept-menu { position: absolute; z-index: 60; width: 270px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgba(23, 23, 43, .18); display: flex; flex-direction: column; gap: 6px; }
.concept-menu .cm-h { margin: 0 0 2px; font-weight: 700; overflow-wrap: anywhere; }
.concept-menu .hint { margin: 2px 0 0; font-size: 12.5px; }

/* ---------- examples ---------- */
.hero-sm { padding: 34px 0 26px; }
.hero-sm h1 { margin-top: 6px; }
.content-wide { margin-top: 26px; padding-bottom: 30px; }
.ex-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ex-card { gap: 5px; }
.ex-card strong { font-size: 16px; line-height: 1.3; }
.ex-kind { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--acc-2); }
.ex-card .hint { margin-top: auto; padding-top: 4px; }
.examples-strip { margin-top: 30px; }
.es-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.es-head h2 { font-size: 20px; margin: 0; }
.example-note { margin: 10px 0 14px; padding: 12px 14px; border: 1px solid var(--acc-line); border-radius: 12px; background: var(--acc-soft); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.example-note q { font-style: italic; }
.en-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.example-source { flex-basis: 100%; }
.example-source summary { cursor: pointer; font-weight: 600; color: var(--acc-2); }
.example-source pre { margin: 8px 0 0; max-height: 360px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.cta-box { margin: 44px 0 0; padding: 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--acc-line); box-shadow: 0 0 0 4px var(--acc-soft); }
.cta-box h2 { margin: 0 0 6px; font-size: 21px; border: 0; padding: 0; }
.cta-box p { margin: 0 0 12px; }
.page-example .more { margin-top: 40px; }
@media print { .example-note, .cta-box, .page-example .more, .wsearch { display: none !important; } }
@media (hover: none) { .wsearch kbd { display: none; } }
