:root,[data-theme="dark"]{--bg:#0f1115;--surface:#171a21;--surface2:#222734;--text:#e6e6e6;--muted:#9aa0aa;--accent:#4f8cff;--border:#262a33;--code-bg:#222734;--error-bg:#3a1d1d;--error-text:#ff9a9a;--ok-bg:#1d3a24;--ok-text:#8dffab;color-scheme:dark}
[data-theme="light"]{--bg:#f5f6f8;--surface:#ffffff;--surface2:#e8ecf3;--text:#1c2330;--muted:#5b6572;--accent:#2f6fe4;--border:#d8dde6;--code-bg:#e8ecf3;--error-bg:#fdecec;--error-text:#b3261e;--ok-bg:#e6f4ea;--ok-text:#137333;color-scheme:light}
*{box-sizing:border-box}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,"PingFang SC","Microsoft YaHei",sans-serif;background:var(--bg);color:var(--text);line-height:1.6}
a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
.nav{display:flex;justify-content:space-between;align-items:center;padding:16px 24px;border-bottom:1px solid var(--border);flex-wrap:wrap;gap:12px}.logo{color:var(--text);font-weight:700}.nav nav{display:flex;gap:16px;flex-wrap:wrap}.nav nav a{color:var(--muted)}
.hero{text-align:center;padding:72px 20px 48px}.hero h1{font-size:44px;margin:0 0 12px}.tagline{color:var(--muted);font-size:18px}
.btn{display:inline-block;background:var(--accent);color:#fff;padding:10px 18px;border-radius:8px;border:0;cursor:pointer}.btn.ghost{background:transparent;border:1px solid var(--accent)}
.container{max-width:1100px;margin:0 auto;padding:24px}.container.narrow{max-width:760px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:20px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:12px;overflow:hidden}.card img{width:100%;height:180px;object-fit:cover}.card-body{padding:18px}.tags,.muted{color:var(--muted)}.tag{display:inline-block;background:#222734;padding:4px 10px;border-radius:999px;margin:4px 4px 0 0}
.links{display:flex;gap:14px;margin-top:10px}.links.big{margin:20px 0}
.pre{white-space:pre-wrap}.content{margin:20px 0}.cover{width:100%;border-radius:12px}
.form{display:flex;flex-direction:column;gap:14px}.form label{display:flex;flex-direction:column;gap:6px}.form input,.form textarea{background:var(--surface);border:1px solid var(--border);color:var(--text);padding:10px;border-radius:8px}.form .check{flex-direction:row;align-items:center}
.table{width:100%;border-collapse:collapse}.table th,.table td{border-bottom:1px solid var(--border);padding:10px;text-align:left}
.error{background:#3a1d1d;color:#ff9a9a;padding:10px;border-radius:8px}.ok{background:#1d3a24;color:#8dffab;padding:10px;border-radius:8px}
.linkbtn{background:none;border:0;color:#ff7a7a;cursor:pointer}
footer{text-align:center;color:var(--muted);padding:32px;border-top:1px solid var(--border);margin-top:40px}
@media(max-width:600px){.hero h1{font-size:32px}.grid{grid-template-columns:1fr}}
/* ---- Markdown body (enhanced) ---- */
.markdown{word-wrap:break-word}
.markdown h1,.markdown h2,.markdown h3,.markdown h4{line-height:1.3;margin:1.4em 0 .6em}
.markdown h2{font-size:26px;border-bottom:1px solid var(--border);padding-bottom:6px}
.markdown h3{font-size:20px}
.markdown p{margin:.8em 0}
.markdown ul,.markdown ol{padding-left:1.6em;margin:.8em 0}
.markdown li{margin:.3em 0}
.markdown blockquote{margin:1em 0;padding:8px 16px;border-left:4px solid var(--accent);background:var(--surface);color:var(--muted)}
.markdown blockquote p{margin:.4em 0}
.markdown a{text-decoration:underline}
.markdown img{max-width:100%;border-radius:8px}
.markdown table{width:100%;border-collapse:collapse;margin:1em 0;display:block;overflow-x:auto}
.markdown th,.markdown td{border:1px solid var(--border);padding:8px 12px;text-align:left}
.markdown th{background:var(--surface)}
.markdown hr{border:0;border-top:1px solid var(--border);margin:1.6em 0}
.markdown code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.9em;background:#222734;padding:2px 6px;border-radius:6px}
.markdown pre{background:#0d1117;border:1px solid var(--border);border-radius:10px;padding:14px 16px;overflow-x:auto;margin:1em 0}
.markdown pre code{background:transparent;padding:0;border-radius:0;font-size:13.5px;line-height:1.55;display:block}
/* ---- Gallery (frontend) ---- */
.gallery-section{margin:28px 0}
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:14px}
.gallery-item{display:block;border-radius:10px;overflow:hidden;border:1px solid var(--border)}
.gallery-item img{width:100%;height:160px;object-fit:cover;display:block}
.gallery-item:hover img{opacity:.85}
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.88);display:flex;align-items:center;justify-content:center;z-index:50}
.lightbox[hidden]{display:none}
.lightbox img{max-width:92vw;max-height:90vh;border-radius:8px}
.lightbox button{position:absolute;top:14px;right:20px;background:none;border:0;color:#fff;font-size:36px;cursor:pointer;line-height:1}
/* ---- Admin helpers ---- */
.hint{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:12px 14px;font-size:13.5px;color:var(--muted)}
.hint code{background:#222734;padding:1px 5px;border-radius:5px;color:var(--text)}
.hint pre{background:#0d1117;border:1px solid var(--border);border-radius:8px;padding:10px;overflow-x:auto;color:var(--text);margin:8px 0 0}
.admin-gallery{margin-top:32px}
.gallery-thumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:14px}
.gallery-thumbs .thumb{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:8px;text-align:center}
.gallery-thumbs .thumb img{width:100%;height:100px;object-fit:cover;border-radius:6px;display:block;margin-bottom:6px}
/* ---- v3 design sync: hero + profile card ---- */
.hero{text-align:left;padding:56px 20px 40px;max-width:1100px;margin:0 auto}
.hero-wrap{display:grid;grid-template-columns:1.4fr 1fr;gap:28px;align-items:center}
.hero-text{text-align:left}
.hero-text h1{font-size:44px;margin:0 0 12px}
.profile-card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:22px;text-align:center}
.profile-card .avatar{width:72px;height:72px;border-radius:50%;margin:0 auto 12px;background:linear-gradient(135deg,#4f8cff,#7a5cff);color:#fff;font-size:32px;font-weight:700;display:flex;align-items:center;justify-content:center}
.profile-name{font-size:20px;font-weight:700}
.profile-tagline{color:var(--muted);font-size:14px;margin:8px 0 12px}
.profile-skills{margin-bottom:14px}
.profile-links{display:flex;gap:16px;justify-content:center;border-top:1px solid var(--border);padding-top:14px}
/* ---- v3: filter bar ---- */
.filter-bar{display:flex;gap:10px;flex-wrap:wrap;margin:6px 0 20px}
.filter-btn{background:var(--surface);color:var(--muted);border:1px solid var(--border);padding:7px 16px;border-radius:999px;cursor:pointer;font-size:14px}
.filter-btn:hover{color:var(--text)}
.filter-btn.active{background:var(--accent);color:#fff;border-color:var(--accent)}
/* ---- v3: card covers (gradient placeholder, never empty) ---- */
.card-cover-img{width:100%;height:180px;object-fit:cover;display:block}
.card-cover{height:180px;display:flex;align-items:center;justify-content:center;position:relative}
.cover-grad{color:#fff}
.grad-web{background:linear-gradient(135deg,#2563eb,#4f8cff)}
.grad-tool{background:linear-gradient(135deg,#7a5cff,#b45cff)}
.grad-deploy{background:linear-gradient(135deg,#0e9f6e,#2dd4bf)}
.grad-other{background:linear-gradient(135deg,#64748b,#94a3b8)}
.grad-v1.grad-web{background:linear-gradient(135deg,#1d4ed8,#38bdf8)}
.grad-v1.grad-tool{background:linear-gradient(135deg,#6d28d9,#ec4899)}
.grad-v1.grad-deploy{background:linear-gradient(135deg,#047857,#84cc16)}
.grad-v1.grad-other{background:linear-gradient(135deg,#475569,#f59e0b)}
.grad-v2.grad-web{background:linear-gradient(135deg,#0ea5e9,#6366f1)}
.grad-v2.grad-tool{background:linear-gradient(135deg,#9333ea,#f43f5e)}
.grad-v2.grad-deploy{background:linear-gradient(135deg,#059669,#22d3ee)}
.grad-v2.grad-other{background:linear-gradient(135deg,#78716c,#f97316)}
.cover-initial{font-size:56px;font-weight:800;opacity:.92;line-height:1}
.cover-initial.big{font-size:84px}
.cover-cat{position:absolute;left:14px;bottom:12px;background:rgba(0,0,0,.35);padding:3px 10px;border-radius:999px;font-size:12.5px}
.detail-cover{height:260px;border-radius:12px;display:flex;align-items:center;justify-content:center;position:relative;margin-bottom:20px}
.detail-cover-img{height:260px;object-fit:cover}
.card-meta{margin-bottom:6px}
.cat-badge{display:inline-block;background:#222734;color:var(--accent);padding:2px 10px;border-radius:999px;font-size:12.5px}
.tech-pills{margin:8px 0 2px}
/* ---- v3: skill bars ---- */
.skill-bars{display:flex;flex-direction:column;gap:14px;max-width:640px;margin-bottom:14px}
.skill-bar-head{display:flex;justify-content:space-between;font-size:14px;margin-bottom:5px}
.skill-pct{color:var(--muted)}
.skill-track{background:#222734;border-radius:999px;height:9px;overflow:hidden}
.skill-fill{background:var(--accent);height:100%;border-radius:999px}
/* ---- v3: section polish + form select ---- */
.section-block{margin-top:40px}
.section-block h2{border-bottom:1px solid var(--border);padding-bottom:8px}
.form select{background:var(--surface);border:1px solid var(--border);color:var(--text);padding:10px;border-radius:8px}
@media(max-width:800px){.hero-wrap{grid-template-columns:1fr}.hero-text h1{font-size:32px}.detail-cover{height:200px}}
/* ---- v4: Mac-style code windows ---- */
.markdown .mac-window{background:#0d1117;border:1px solid var(--border);border-radius:10px;overflow:hidden;margin:1.1em 0}
.mac-bar{display:flex;align-items:center;gap:10px;background:#161b22;border-bottom:1px solid var(--border);padding:8px 12px}
.mac-bar .dots{display:inline-flex;gap:7px;flex:none}
.mac-bar .dot{width:12px;height:12px;border-radius:50%;display:inline-block}
.mac-bar .dot.r{background:#ff5f57}.mac-bar .dot.y{background:#febc2e}.mac-bar .dot.g{background:#28c840}
.mac-file{flex:1;text-align:center;color:var(--muted);font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:ui-monospace,Menlo,Consolas,monospace}
.mac-lang{flex:none;color:#8b949e;font-size:11px;font-weight:700;letter-spacing:.08em}
.copy-btn{flex:none;background:#222734;color:var(--muted);border:1px solid var(--border);border-radius:6px;padding:3px 10px;font-size:12px;cursor:pointer}
.copy-btn:hover{color:var(--text)}
.copy-btn.copied{color:#8dffab;border-color:#2ea043}
.markdown .mac-window pre,.markdown pre.code-scroll{margin:0;border:0;border-radius:0;background:#0d1117;padding:14px 16px;max-height:480px;overflow:auto}
.markdown pre.code-scroll code{white-space:pre}
pre.code-scroll::-webkit-scrollbar,.markdown .table-wrap::-webkit-scrollbar{height:8px;width:8px}
pre.code-scroll::-webkit-scrollbar-thumb,.markdown .table-wrap::-webkit-scrollbar-thumb{background:#30363d;border-radius:4px}
pre.code-scroll::-webkit-scrollbar-track,.markdown .table-wrap::-webkit-scrollbar-track{background:transparent}
/* ---- v4: figures, callouts, tables, details, tasks ---- */
.markdown .md-figure{margin:1.2em 0;text-align:center}
.markdown .md-figure img{max-width:100%;border-radius:10px}
.markdown .md-figure figcaption{color:var(--muted);font-size:13px;margin-top:6px}
.markdown .table-wrap{overflow-x:auto;margin:1em 0}
.markdown .table-wrap table{display:table;margin:0}
.markdown details{border:1px solid var(--border);border-radius:8px;padding:10px 14px;margin:1em 0;background:var(--surface)}
.markdown summary{cursor:pointer;font-weight:600}
.markdown li input[type="checkbox"]{margin-right:6px;accent-color:var(--accent)}
.callout{border-left:4px solid var(--accent);background:var(--surface);border-radius:0 8px 8px 0;padding:10px 16px;margin:1em 0}
.callout-title{font-weight:700;margin-bottom:4px}
.callout-body p{margin:.3em 0}
.callout-note{border-left-color:#4f8cff}.callout-note .callout-title{color:#79b8ff}
.callout-tip{border-left-color:#2ea043}.callout-tip .callout-title{color:#7ee787}
.callout-warning{border-left-color:#d29922}.callout-warning .callout-title{color:#e3b341}
.callout-important{border-left-color:#f85149}.callout-important .callout-title{color:#ff9a9a}
.markdown h2,.markdown h3{scroll-margin-top:20px}
/* ---- v4: admin editor ---- */
.container.editor-page{max-width:1180px}
.editor-field{display:flex;flex-direction:column;gap:10px}
.editor-label{font-weight:600}
.editor-toolbar{display:flex;flex-wrap:wrap;gap:6px;background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:8px}
.editor-toolbar button,.preview-switch button{background:#222734;color:var(--text);border:1px solid var(--border);border-radius:6px;padding:5px 10px;font-size:13px;cursor:pointer}
.editor-toolbar button:hover,.preview-switch button:hover{border-color:var(--accent)}
.editor-toolbar select,.editor-codebar select,.editor-codebar input{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:6px 8px;font-size:13px}
.editor-codebar{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.editor-codebar .inline{display:inline-flex;align-items:center;gap:6px;flex-direction:row}
.btn.sm{padding:6px 12px;font-size:13px}
.editor-status{color:var(--muted);font-size:13px}
.preview-switch{display:flex;gap:6px}
.preview-switch button.active{background:var(--accent);color:#fff;border-color:var(--accent)}
#editor-layout{display:grid;grid-template-columns:1fr 1fr;gap:14px;align-items:start}
#editor-layout[data-mode="edit"]{grid-template-columns:1fr}
#editor-layout[data-mode="edit"] .editor-preview{display:none}
#editor-layout[data-mode="full"]{grid-template-columns:1fr}
#editor-layout[data-mode="full"] textarea{display:none}
#description-editor{width:100%;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13.5px;line-height:1.6}
.editor-preview{border:1px solid var(--border);border-radius:8px;padding:6px 18px;min-height:200px;background:var(--bg);overflow-wrap:break-word;min-width:0;max-width:100%;overflow:hidden}
/* ---- v4.1: split-editor + code-block layout hardening ---- */
/* Grid children default to min-width:auto, so a long pre line (min-content)
   used to blow up the preview column and crush the editor column to a sliver.
   Pin every level of the chain to min-width:0 so the pre scrolls internally. */
#editor-layout{min-width:0}
#editor-layout>textarea,#editor-layout>.editor-preview{min-width:0}
#editor-layout textarea{width:100%;box-sizing:border-box}
.editor-field{min-width:0}
.markdown{min-width:0;max-width:100%}
.markdown .mac-window{max-width:100%;min-width:0}
.markdown .table-wrap{min-width:0;max-width:100%}
.markdown img{max-width:100%}
.markdown pre.code-scroll{overflow:auto;max-width:100%}
.markdown pre.code-scroll code{display:block;width:max-content;min-width:100%}
.wrap-btn.active{color:#8dffab;border-color:#2ea043}
/* Wrap toggle: soft-wrap the code instead of horizontal scrolling */
.mac-window.wrapped pre.code-scroll code{white-space:pre-wrap;word-break:break-all;width:auto;min-width:0}
/* ---- v5: theme overrides (variable-driven light/dark) ---- */
/* Elements that used the hard-coded dark chip colour now follow the theme. */
.tag{background:var(--surface2)}
.markdown code{background:var(--code-bg)}
.hint code{background:var(--code-bg)}
.cat-badge{background:var(--surface2)}
.skill-track{background:var(--surface2)}
.editor-toolbar button,.preview-switch button{background:var(--surface2)}
.error{background:var(--error-bg);color:var(--error-text)}
.ok{background:var(--ok-bg);color:var(--ok-text)}
.hint pre{color:#e6e6e6}
/* Mac code windows stay dark in BOTH themes (industry convention). */
.markdown .mac-window{border-color:#30363d}
.mac-bar{border-bottom:1px solid #30363d}
/* Theme toggle button (in every nav, front + admin) */
.theme-toggle{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:999px;width:34px;height:34px;font-size:16px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex:none}
.theme-toggle:hover{border-color:var(--accent)}
body{transition:background-color .18s ease,color .18s ease}
/* ---- v5: usage-settings (guide) page ---- */
.guide-section{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:20px 22px;margin:22px 0}
.guide-section h2{margin-top:0;border-bottom:1px solid var(--border);padding-bottom:8px}
.guide-note{color:var(--muted);font-size:13px;margin:6px 0 0}
.guide-note code,.guide-section code{background:var(--code-bg);padding:1px 5px;border-radius:5px}
.path-banner{background:var(--code-bg);border:1px dashed var(--accent);border-radius:8px;padding:12px 16px;font-size:18px;font-weight:700;word-break:break-all;margin:10px 0}
.guide-section details{border:1px solid var(--border);border-radius:8px;padding:10px 14px;margin:10px 0;background:var(--bg)}
.guide-section summary{cursor:pointer;font-weight:600}
.guide-section .sub-form{border-top:1px solid var(--border);margin-top:18px;padding-top:16px}
.inline-form{display:inline}
.danger-btn{background:none;border:0;color:#ff7a7a;cursor:pointer}
[data-theme="light"] .danger-btn{color:#b3261e}
/* ---- v5 add-ons: profile facts + KV row editor ---- */
.profile-facts{margin:4px 0 12px;text-align:left}
.profile-fact{display:flex;justify-content:space-between;gap:12px;padding:5px 2px;border-bottom:1px dashed var(--border);font-size:14px}
.profile-fact:last-child{border-bottom:0}
.fact-label{color:var(--muted)}
.fact-value{font-weight:600}
.kv-rows{display:flex;flex-direction:column;gap:8px}
.kv-row{display:grid;grid-template-columns:1fr 1.4fr 1.4fr 76px auto;gap:8px;align-items:center}
.kv-row.fact-row{grid-template-columns:1fr 1.6fr 76px auto}
.kv-row input{min-width:0}
.kv-head{font-size:12.5px;color:var(--muted)}
@media(max-width:700px){.kv-row,.kv-row.fact-row{grid-template-columns:1fr 1fr}.kv-head{display:none}}
/* ---- v6: editor split panes — independent scrolling + orientation ---- */
/* Split stays two columns down to phone widths (the old 1023px stacking rule
   is gone): each pane gets the same viewport-based height and scrolls on its
   own, and editor.js syncs the scroll positions, so at half-screen width the
   live preview is always visible without scrolling the page. */
#editor-layout[data-mode="split"]{align-items:stretch}
#editor-layout[data-mode="split"]>textarea,
#editor-layout[data-mode="split"]>.editor-preview{height:calc(100vh - 230px);min-height:420px}
#editor-layout[data-mode="split"]>.editor-preview{overflow-y:auto;overflow-x:hidden}
#editor-layout[data-mode="split"][data-orient="v"]{grid-template-columns:1fr;grid-template-rows:auto auto}
#editor-layout[data-mode="split"][data-orient="v"]>textarea,
#editor-layout[data-mode="split"][data-orient="v"]>.editor-preview{height:min(52vh,620px);min-height:280px}
.orient-switch{display:inline-flex;gap:6px;margin-left:10px;padding-left:10px;border-left:1px solid var(--border)}
@media(max-width:719px){
  #editor-layout{grid-template-columns:1fr}
  #editor-layout[data-mode="split"]>textarea,
  #editor-layout[data-mode="split"]>.editor-preview{height:auto;min-height:300px}
}
/* ---- v6.1: full-height page layout — sidebar spans the whole page ----
   (Replaces the v6 .home-layout, where the sidebar only sat next to the
   project grid. Now the grid starts right under the top nav: sidebar column
   first, then the content column holding Hero + every section.) */
.page-layout{display:grid;grid-template-columns:260px minmax(0,1fr);gap:26px;align-items:start}
.page-layout.layout-right{grid-template-columns:minmax(0,1fr) 260px}
.page-main{min-width:0}
.page-main .hero{max-width:none;margin:0;padding:20px 0 36px}
.page-main>section:first-child h2{margin-top:0}
/* The sidebar sticks while the content scrolls and scrolls internally when
   it is taller than the viewport. */
.page-layout .sidebar{position:sticky;top:76px;max-height:calc(100vh - 90px);overflow-y:auto;padding-right:2px}
/* Whole-column collapse: column disappears, content takes the full width. */
.page-layout.sidebar-collapsed{grid-template-columns:minmax(0,1fr)}
.page-layout.sidebar-collapsed .sidebar{display:none}
.side-topbar{display:flex;align-items:center;justify-content:space-between}
.side-topbar-label{color:var(--muted);font-size:13px}
.sidebar-collapse-btn{background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:6px;width:28px;height:28px;cursor:pointer;line-height:1;font-size:15px;flex:none}
.sidebar-collapse-btn:hover{border-color:var(--accent)}
/* Floating re-open button pinned to the left edge of the viewport. */
.sidebar-expand{position:fixed;left:0;top:50%;transform:translateY(-50%);z-index:55;background:var(--surface);color:var(--text);border:1px solid var(--border);border-left:0;border-radius:0 8px 8px 0;padding:16px 8px;font-size:16px;cursor:pointer;box-shadow:0 4px 14px rgba(0,0,0,.25)}
.sidebar-expand:hover{border-color:var(--accent);color:var(--accent)}
.sidebar-expand[hidden]{display:none}
@media(max-width:860px){
  .page-layout,.page-layout.layout-right{grid-template-columns:1fr}
  .page-layout .sidebar{position:static;max-height:none;overflow:visible}
}
.sidebar{display:flex;flex-direction:column;gap:18px;min-width:0}
.side-box{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:14px 16px}
.side-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border);padding-bottom:8px;margin-bottom:10px}
.side-head h3{margin:0;font-size:16px}
.side-collapse{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:6px;width:26px;height:26px;cursor:pointer;line-height:1;flex:none}
.side-list{list-style:none;margin:0;padding:0}
.side-list .side-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 2px;border-bottom:1px dashed var(--border)}
.side-list .side-item:last-child{border-bottom:0}
.side-count{background:var(--surface2);color:var(--muted);border-radius:999px;font-size:12px;padding:1px 8px;flex:none}
.side-tags{display:flex;flex-wrap:wrap;gap:2px}
.side-tags .tag{margin:3px 3px 0 0}
.side-more{margin-top:10px;background:none;border:0;color:var(--accent);cursor:pointer;padding:2px 0;font-size:13.5px}
.side-more:hover{text-decoration:underline}
.side-search-form{display:flex;gap:8px}
.side-search-form input{flex:1;min-width:0;background:var(--bg);border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:8px}
/* ---- v6: pinned badge / views meta ---- */
.pin-badge{display:inline-block;background:#d29922;color:#161b22;padding:2px 10px;border-radius:999px;font-size:12.5px;font-weight:700;margin-left:6px}
.views-meta{color:var(--muted);font-size:13px;margin-left:10px}
/* ---- v6: list page ---- */
.list-conditions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:10px 0}
.cond-chip{background:var(--surface2);border:1px solid var(--border);border-radius:999px;padding:3px 12px;font-size:13.5px}
.list-tools{display:flex;gap:14px;flex-wrap:wrap;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:12px 16px;margin-bottom:22px}
.list-tools .inline{display:inline-flex;align-items:center;gap:8px;flex-direction:row}
.list-tools input,.list-tools select{background:var(--bg);border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:8px}
.list-empty{background:var(--surface);border:1px dashed var(--border);border-radius:12px;padding:36px;text-align:center}
/* ---- v6: detail page (TOC / related / prev-next / progress / back-to-top) ---- */
.toc-box{border:1px solid var(--border);border-radius:10px;background:var(--surface);padding:12px 18px;margin:18px 0}
.toc-box summary{cursor:pointer;font-weight:700}
.toc-box ul{list-style:none;margin:10px 0 4px;padding:0}
.toc-box li{margin:4px 0}
.toc-box li.toc-l3{padding-left:20px;font-size:14.5px}
.related-section{margin:34px 0 8px}
.related-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px}
.related-card{display:flex;flex-direction:column;gap:6px;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:14px 16px;color:var(--text)}
.related-card:hover{border-color:var(--accent);text-decoration:none}
.related-title{font-weight:700}
.related-summary{color:var(--muted);font-size:13.5px}
.prev-next{display:flex;justify-content:space-between;gap:16px;margin:30px 0 6px}
.pn-link{display:flex;flex-direction:column;gap:4px;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:12px 16px;max-width:48%;color:var(--text)}
.pn-link:hover{border-color:var(--accent);text-decoration:none}
.pn-next{text-align:right;margin-left:auto}
.pn-label{color:var(--muted);font-size:13px}
.pn-title{font-weight:600}
.read-progress{position:fixed;top:0;left:0;height:3px;width:0;background:var(--accent);z-index:60}
.back-to-top{position:fixed;right:22px;bottom:22px;width:42px;height:42px;border-radius:50%;background:var(--accent);color:#fff;border:0;font-size:19px;cursor:pointer;z-index:60;box-shadow:0 4px 14px rgba(0,0,0,.35)}
.back-to-top[hidden]{display:none}
/* ---- v6: admin stats + category editor ---- */
.stats-box{display:flex;gap:26px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:16px 20px;margin:16px 0}
.stat-item{display:flex;flex-direction:column;gap:2px}
.stat-num{font-size:30px;font-weight:800;color:var(--accent)}
.stat-label{color:var(--muted);font-size:13px}
.stat-top h3{margin:0 0 6px;font-size:15px}
.top-list{margin:0;padding-left:20px}
.cat-edit input{background:var(--bg);border:1px solid var(--border);color:var(--text);padding:6px 8px;border-radius:6px}
/* ---- v6.1: sticky editor toolbar ---- */
/* .editor-tools wraps toolbar + code bar + image bar + mode/orient switch so
   they can freeze together at the top of the window while writing. The admin
   top nav is NOT fixed, so top:0 is the right offset. Off = normal flow,
   exactly like before. */
.editor-tools{display:flex;flex-direction:column;gap:10px}
.editor-tools.sticky-on{position:sticky;top:0;z-index:60;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:10px;box-shadow:0 8px 22px rgba(0,0,0,.28)}
.editor-tools-foot{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.editor-tools-foot button{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:5px 10px;font-size:13px;cursor:pointer}
.editor-tools-foot button:hover{border-color:var(--accent)}
.editor-tools-foot button[aria-pressed="true"]{background:var(--accent);color:#fff;border-color:var(--accent)}
/* ---- v6.1: editor panels (image settings / carousel / emoji) ---- */
.editor-panel{background:var(--surface);border:1px dashed var(--border);border-radius:8px;padding:12px 14px;display:flex;flex-direction:column;gap:10px}
.editor-panel[hidden]{display:none}
.editor-panel .panel-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.editor-panel label.inline{display:inline-flex;align-items:center;gap:6px;flex-direction:row;font-size:13.5px}
.editor-panel input[type="text"],.editor-panel textarea{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:7px 9px;font-size:13.5px}
.editor-panel textarea{width:100%;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12.5px}
.emoji-panel{display:flex;flex-wrap:wrap;gap:4px;background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:8px}
.emoji-panel[hidden]{display:none}
.emoji-panel button{background:none;border:0;font-size:19px;cursor:pointer;padding:3px 5px;border-radius:6px;line-height:1.2}
.emoji-panel button:hover{background:var(--surface2)}
.editor-toolbar input[type="color"]{width:34px;height:28px;padding:1px;border:1px solid var(--border);border-radius:6px;background:var(--bg);cursor:pointer}
.editor-stats{color:var(--muted);font-size:13px}
.draft-bar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;background:var(--surface2);border:1px dashed var(--accent);border-radius:8px;padding:9px 12px;font-size:13.5px}
.draft-bar[hidden]{display:none}
.draft-bar button{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:4px 10px;font-size:13px;cursor:pointer}
.draft-bar button:hover{border-color:var(--accent)}
/* Fullscreen editing: the whole editor field fills the screen. */
.editor-field:fullscreen{background:var(--bg);padding:14px;overflow-y:auto}
.editor-field:fullscreen #editor-layout[data-mode="split"]>textarea,
.editor-field:fullscreen #editor-layout[data-mode="split"]>.editor-preview{height:calc(100vh - 300px)}
/* ---- v6.1: sized / aligned / visually-cropped editor images ---- */
/* Alignment is block-level (margin-based), not float, so following
   paragraphs never wrap around or collapse under the figure. Cropping is
   display-only (aspect-ratio + object-fit) — the original file is untouched. */
.markdown figure.md-img{margin:1.2em 0}
.markdown figure.md-img img{display:block;width:100%;border-radius:8px}
.markdown figure.md-img figcaption{color:var(--muted);font-size:13px;margin-top:6px;text-align:center}
.markdown figure.md-img.w25{width:25%}
.markdown figure.md-img.w50{width:50%}
.markdown figure.md-img.w75{width:75%}
.markdown figure.md-img.w100{width:100%}
.markdown figure.md-img.align-center{margin-left:auto;margin-right:auto}
.markdown figure.md-img.align-left{margin-right:auto}
.markdown figure.md-img.align-right{margin-left:auto}
.markdown img.crop-169{aspect-ratio:16/9;object-fit:cover}
.markdown img.crop-43{aspect-ratio:4/3;object-fit:cover}
.markdown img.crop-11{aspect-ratio:1/1;object-fit:cover}
.markdown img.round{border-radius:16px}
/* ---- v6.1: image carousel (WeChat-style swipe) ---- */
.carousel-wrap{position:relative;margin:1.2em 0}
.markdown .carousel{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;border-radius:10px;scrollbar-width:none;background:#0d1117}
.markdown .carousel::-webkit-scrollbar{display:none}
.markdown .carousel>figure{flex:0 0 100%;min-width:100%;scroll-snap-align:start;margin:0;display:flex;align-items:center;justify-content:center}
.markdown .carousel>figure img{width:100%;height:100%;object-fit:cover;display:block;border-radius:0}
.markdown .carousel.car-v{flex-direction:column;overflow-y:auto;overflow-x:hidden;height:440px;scroll-snap-type:y mandatory}
.markdown .carousel.car-v>figure{height:100%;min-height:100%}
.car-btn{position:absolute;top:50%;transform:translateY(-50%);z-index:5;width:36px;height:36px;border-radius:50%;border:1px solid rgba(255,255,255,.35);background:rgba(0,0,0,.5);color:#fff;font-size:19px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center}
.car-btn:hover{background:rgba(0,0,0,.75)}
.car-prev{left:10px}
.car-next{right:10px}
.car-dots{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);z-index:5;display:flex;gap:6px}
.car-dot{width:9px;height:9px;border-radius:50%;border:0;background:rgba(255,255,255,.45);cursor:pointer;padding:0}
.car-dot.active{background:#fff}
.car-count{position:absolute;top:10px;right:12px;z-index:5;background:rgba(0,0,0,.55);color:#fff;font-size:12px;padding:2px 9px;border-radius:999px}
/* ---- v6.2: editor popovers (colour palette / table picker) ---- */
/* Popovers live inside .editor-tools (the sticky toolbar block), anchored
   below it; palette and table picker are mutually exclusive in editor.js. */
.editor-tools{position:relative}
.editor-popover{position:absolute;top:calc(100% + 6px);left:0;z-index:80;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:0 14px 34px rgba(0,0,0,.38);padding:12px 14px;width:308px;max-width:92vw}
.editor-popover[hidden]{display:none}
.pop-head{display:flex;align-items:baseline;gap:10px;margin-bottom:8px}
.pop-head strong{font-size:14px}
.pop-hint{color:var(--muted);font-size:12px}
.pop-label{color:var(--muted);font-size:12px;margin:10px 0 5px}
.pop-label:first-of-type{margin-top:2px}
.pop-empty{color:var(--muted);font-size:12px}
.swatch-grid{display:flex;flex-wrap:wrap;gap:5px}
.swatch-row{display:flex;flex-wrap:wrap;gap:5px;align-items:center;min-height:22px}
.swatch{width:22px;height:22px;flex:none;border-radius:5px;border:1px solid var(--border);cursor:pointer;padding:0;transition:transform .08s ease,border-color .08s ease}
.swatch:hover{transform:scale(1.18);border-color:var(--accent)}
.pop-custom{display:flex;gap:8px;align-items:center;margin-top:12px;flex-wrap:wrap}
.pop-custom input[type="text"]{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:6px 8px;font-size:13px;width:130px;font-family:ui-monospace,Menlo,Consolas,monospace}
.pop-picker{display:inline-flex;align-items:center;gap:6px;font-size:13px;cursor:pointer;color:var(--text)}
.pop-picker input[type="color"]{width:30px;height:26px;padding:1px;border:1px solid var(--border);border-radius:6px;background:var(--bg);cursor:pointer}
/* table grid picker */
.table-grid{display:grid;grid-template-columns:repeat(8,24px);gap:3px}
.table-cell{width:24px;height:19px;border:1px solid var(--border);border-radius:3px;background:var(--bg);cursor:pointer;padding:0}
.table-cell.on{background:var(--accent);border-color:var(--accent)}
/* ---- v6.2: selection floating toolbar (WPS-style) ---- */
.editor-field{position:relative}
#selection-bar{position:absolute;z-index:70;display:flex;gap:2px;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:0 10px 26px rgba(0,0,0,.35);padding:4px}
#selection-bar[hidden]{display:none}
#selection-bar button{background:var(--surface2);color:var(--text);border:1px solid transparent;border-radius:6px;padding:4px 8px;font-size:12.5px;cursor:pointer;line-height:1.3;white-space:nowrap}
#selection-bar button:hover{border-color:var(--accent)}
/* hidden mirror used to locate the selection inside the textarea */
#editor-mirror{position:absolute;visibility:hidden;white-space:pre-wrap;overflow-wrap:break-word;word-wrap:break-word;pointer-events:none;overflow:hidden;z-index:-1}
/* ---- v6.2: image panel source tabs ---- */
.img-tab{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:6px 12px;font-size:13px;cursor:pointer}
.img-tab:hover{border-color:var(--accent)}
.img-tab.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.img-preview-row img{max-height:120px;max-width:260px;border:1px solid var(--border);border-radius:8px;object-fit:contain;background:var(--bg)}
.img-preview-row img[hidden]{display:none}
.editor-panel input[type="file"]{color:var(--text);font-size:13px}
#img-insert:disabled{opacity:.45;cursor:not-allowed}
/* font-size guide table inside the help <details> */
.font-guide-table{border-collapse:collapse;margin:8px 0;font-size:12.5px}
.font-guide-table th,.font-guide-table td{border:1px solid var(--border);padding:4px 9px;text-align:left}
.font-guide-table th{background:var(--surface2)}
/* ---- v6.3: code-window metrics + line numbers ---- */
/* The fs= fence param lands as an inline font-size on the <pre>; the <code>
   must inherit it (and the line-height) instead of the generic 13.5px rule,
   so set the window's base metrics on the <pre> and inherit downwards. */
.markdown .mac-window pre{font-size:13.5px;line-height:1.55}
.markdown .mac-window pre code{font-size:inherit;line-height:inherit}
/* Line-number layout: .code-body is a flex row — gutter column + the <pre>.
   The gutter lives OUTSIDE the <pre>: it never scrolls horizontally, never
   pollutes copied text, and codecopy.js syncs its vertical scroll and copies
   the code's font metrics onto it. Mac windows stay dark in both themes. */
.code-body{display:flex;align-items:stretch;background:#0d1117}
.code-body>pre{flex:1 1 auto;min-width:0}
.code-lns{flex:none;overflow:hidden;white-space:pre;text-align:right;color:#6e7681;background:#0d1117;border-right:1px solid #30363d;padding-right:10px;margin-right:0;user-select:none;-webkit-user-select:none;font-family:ui-monospace,Menlo,Consolas,monospace}
.mac-window.wrapped .code-lns{display:none}
.mac-window.wrapped .code-body{display:block}
/* ---- v6.3: media (image) management page ---- */
.media-help{border:1px solid var(--border);border-radius:8px;padding:10px 14px;margin:12px 0;background:var(--surface)}
.media-help summary{cursor:pointer;font-weight:600}
.media-stats{margin-top:14px}
.media-upload{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:14px 16px;margin:14px 0}
.media-upload label{flex:1;min-width:260px}
.media-tools{display:flex;gap:14px;flex-wrap:wrap;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:12px 16px;margin:14px 0}
.media-tools .inline{display:inline-flex;align-items:center;gap:8px;flex-direction:row}
.media-tools input[type="search"],.media-tools select{background:var(--bg);border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:8px}
.media-tools input[type="search"]{flex:1;min-width:200px}
.media-table td{vertical-align:top}
.media-table .media-name{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12.5px;word-break:break-all;max-width:230px}
.media-table .media-path{font-size:12.5px;color:var(--muted);max-width:300px;word-break:break-all}
.media-table .media-path code{background:var(--code-bg);padding:1px 5px;border-radius:5px}
.media-badge{display:inline-block;border-radius:999px;padding:2px 10px;font-size:12.5px;font-weight:600;white-space:nowrap}
.media-badge.used{background:#2ea04333;color:#3fb950;border:1px solid #2ea043}
[data-theme="light"] .media-badge.used{color:#1a7f37}
.media-badge.unused{background:var(--surface2);color:var(--muted);border:1px solid var(--border)}
.media-usage{font-size:13px;max-width:260px}
.media-more summary{cursor:pointer;color:var(--accent);font-size:12.5px}
.media-ops{white-space:nowrap}
.danger-outline:hover{border-color:#f85149;color:#f85149}
.btn.danger{background:#b3261e;border-color:#b3261e;color:#fff}
.media-modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.62);z-index:90;display:flex;align-items:center;justify-content:center;padding:18px}
.media-modal-backdrop[hidden]{display:none}
.media-modal{background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:12px;max-width:860px;width:100%;max-height:88vh;overflow-y:auto;padding:16px 18px;box-shadow:0 18px 44px rgba(0,0,0,.45)}
.media-modal-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;word-break:break-all}
.media-modal-body img{max-width:100%;max-height:62vh;display:block;margin:0 auto;border-radius:8px;background:#0d1117}
.media-del-item{margin:8px 0}
.media-del-item code{background:var(--code-bg);padding:1px 6px;border-radius:5px;word-break:break-all}
.media-del-item ul{margin:4px 0 8px;padding-left:20px}
.media-modal-foot{display:flex;gap:12px;align-items:center;margin-top:14px}
/* ---- v6.3: editor additions (history / outline / painter / drop) ---- */
#editor-undo:disabled,#editor-redo:disabled{opacity:.45;cursor:not-allowed}
#md-font-size-custom{width:86px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:6px 8px;font-size:13px}
#format-painter.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.code-settings-bar{border:1px dashed var(--border);border-radius:8px;padding:8px 10px;background:var(--surface)}
.code-settings-bar input[type="number"]{width:76px}
.code-settings-bar input[type="range"]{width:110px;padding:0}
.editor-outline{border:1px solid var(--border);border-radius:8px;background:var(--surface);padding:10px 12px;max-height:260px;overflow-y:auto}
.editor-outline[hidden]{display:none}
.outline-head{font-weight:700;margin-bottom:6px}
#outline-list{list-style:none;margin:0;padding:0}
.outline-item{display:block;width:100%;text-align:left;background:none;border:0;color:var(--text);padding:4px 6px;font-size:13.5px;cursor:pointer;border-radius:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.outline-item:hover{background:var(--surface2);color:var(--accent)}
.editor-field.drag-over{outline:2px dashed var(--accent);outline-offset:4px;border-radius:8px}

/* ---- v7: reading & interaction ---- */
/* admin nav pending-comment badge */
.nav-badge{display:inline-block;background:#e5484d;color:#fff;border-radius:999px;font-size:11px;line-height:1;padding:3px 7px;margin-left:5px;vertical-align:2px;font-weight:700}
/* detail meta + interact row */
.words-meta{color:var(--muted);font-size:13px}
.interact-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:14px 0 4px}
.like-btn,.share-btn{background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:999px;padding:7px 16px;font-size:14px;cursor:pointer}
.like-btn:hover,.share-btn:hover{border-color:var(--accent)}
.like-btn.liked{background:#e5484d;border-color:#e5484d;color:#fff}
.toast{position:fixed;left:50%;bottom:34px;transform:translateX(-50%);background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:999px;padding:9px 20px;font-size:14px;z-index:120;box-shadow:0 10px 30px rgba(0,0,0,.35)}
.toast[hidden]{display:none}
/* reading controls */
.reading-controls{display:flex;gap:6px;align-items:center;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:8px 12px;margin:16px 0 4px}
.reading-controls .rc-label{color:var(--muted);font-size:13px;margin-right:2px}
.reading-controls .rc-sep{width:1px;height:18px;background:var(--border);margin:0 6px}
.reading-controls button{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:4px 12px;font-size:13px;cursor:pointer}
.reading-controls button.active{background:var(--accent);color:#fff;border-color:var(--accent)}
/* article font-size steps + wide layout */
.markdown.fs-s{font-size:15px}
.markdown.fs-m{font-size:16.5px}
.markdown.fs-l{font-size:18px}
.markdown.fs-xl{font-size:19.5px}
.container.narrow.wide{max-width:1080px}
/* TOC scrollspy */
.toc-box a.active{color:var(--accent);font-weight:700;text-decoration:underline}
/* comments */
.comments-section{margin-top:36px;border-top:1px solid var(--border);padding-top:8px}
.comment-list{list-style:none;margin:0 0 20px;padding:0}
.comment-item{border:1px solid var(--border);border-radius:10px;background:var(--surface);padding:12px 16px;margin:10px 0}
.comment-head{display:flex;gap:12px;align-items:baseline;margin-bottom:4px}
.comment-name{font-weight:700}
.comment-time{color:var(--muted);font-size:12.5px}
.comment-body{word-wrap:break-word}
.comment-form{margin-top:14px}
.hp-wrap{position:absolute;left:-9999px;top:-9999px;width:1px;height:1px;overflow:hidden}
.comment-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0}
.comment-cell{max-width:420px;word-wrap:break-word}
.comment-ops{white-space:nowrap}
.comment-ops form{display:inline}
.bulk-bar{display:flex;gap:10px;margin-top:12px}
/* lightbox v7 (prev/next, counter, caption) */
.lightbox-v7{flex-direction:column;gap:10px}
.lightbox-v7 .lb-img{max-width:92vw;max-height:82vh;border-radius:8px}
.lightbox-v7 .lb-btn{position:absolute;background:rgba(20,22,28,.55);border:1px solid rgba(255,255,255,.25);color:#fff;cursor:pointer;line-height:1;border-radius:999px}
.lightbox-v7 .lb-close{top:14px;right:20px;font-size:30px;width:44px;height:44px}
.lightbox-v7 .lb-prev,.lightbox-v7 .lb-next{top:50%;transform:translateY(-50%);font-size:34px;width:46px;height:46px}
.lightbox-v7 .lb-prev{left:16px}
.lightbox-v7 .lb-next{right:16px}
.lightbox-v7 .lb-bar{display:flex;gap:14px;align-items:center;color:#e6e6e6;font-size:14px;max-width:92vw}
.lightbox-v7 .lb-count{color:#9aa0aa;white-space:nowrap}
.lightbox-v7 .lb-caption{word-wrap:break-word}
.markdown img{cursor:zoom-in}
.gallery img{cursor:zoom-in}
.carousel img{cursor:default}
/* long-code collapse */
.mac-window{position:relative}
.mac-window.code-collapsed pre.code-scroll{max-height:240px !important}
.mac-window.code-collapsed::after{content:"";position:absolute;left:0;right:0;bottom:34px;height:64px;background:linear-gradient(to bottom,rgba(13,17,23,0),rgba(13,17,23,.92));pointer-events:none}
.code-expand-btn{display:block;width:100%;background:#161b22;color:#e6e6e6;border:0;border-top:1px solid #30363d;padding:8px;font-size:13px;cursor:pointer}
.code-expand-btn:hover{color:#8dffab}
/* reveal entrance animation (style keyed off body[data-anim]) */
.reveal{opacity:0}
body[data-anim="fade"] .reveal{transition:opacity .6s ease}
body[data-anim="up"] .reveal{transform:translateY(18px);transition:opacity .55s ease,transform .55s ease}
body[data-anim="zoom"] .reveal{transform:scale(.96);transition:opacity .55s ease,transform .55s ease}
.reveal.in{opacity:1;transform:none}
@media (prefers-reduced-motion: reduce){
  .reveal{opacity:1 !important;transform:none !important;transition:none !important}
}
/* typewriter caret */
.tagline.typewriter::after{content:"▍";margin-left:2px;color:var(--accent);animation:tw-blink 1s steps(1) infinite}
.tagline.typewriter.done::after{animation:tw-blink 1s steps(1) 3 forwards;opacity:0}
@keyframes tw-blink{50%{opacity:0}}
@media (prefers-reduced-motion: reduce){.tagline.typewriter::after{display:none}}
/* ---- v7: editor additions ---- */
/* slash command menu */
#slash-menu{position:absolute;z-index:85;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:0 14px 34px rgba(0,0,0,.38);padding:6px;min-width:190px;max-width:78vw;max-height:300px;overflow-y:auto}
#slash-menu[hidden]{display:none}
.slash-item{display:block;width:100%;text-align:left;background:none;border:0;border-radius:6px;color:var(--text);padding:7px 10px;font-size:14px;cursor:pointer}
.slash-item:hover,.slash-item.active{background:var(--surface2);color:var(--accent)}
.slash-empty{color:var(--muted);font-size:13px;padding:7px 10px}
/* editor font-size controls in the stats row */
.editor-fs-ctrl{margin-left:16px;white-space:nowrap}
.editor-fs-ctrl button{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:2px 9px;font-size:12.5px;cursor:pointer}
.editor-fs-ctrl button:hover{border-color:var(--accent)}
#editor-fs-val{color:var(--muted);margin-left:4px}
/* split divider (side-by-side; vertical rules live in the v7.2 block) */
#editor-splitter{display:none}
#editor-layout[data-mode="split"][data-orient="h"]{grid-template-columns:1fr 8px 1fr;column-gap:6px}
#editor-layout[data-mode="split"][data-orient="h"] #editor-splitter{display:block;cursor:col-resize;background:var(--border);border-radius:4px;min-width:8px}
#editor-layout[data-mode="split"][data-orient="h"] #editor-splitter:hover{background:var(--accent)}
@media(max-width:719px){
  #editor-layout[data-mode="split"][data-orient="h"]{grid-template-columns:1fr !important}
  #editor-splitter{display:none !important}
}
/* ---- v7.1: foldable editor toolbar sections ---- */
/* The tools block is three stacked sections; folding hides the body and
   leaves only the ~30px head bar, which is what keeps the frozen
   (sticky) toolbar from eating half the screen. */
.tools-sec{border:1px solid var(--border);border-radius:8px;background:var(--bg);overflow:hidden}
.tools-sec-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px;padding:0 4px 0 12px;background:var(--surface2);cursor:pointer;user-select:none}
.tools-sec-title{font-size:13px;font-weight:600}
.tools-fold{background:none;border:0;color:var(--muted);font-size:13px;cursor:pointer;width:28px;height:28px;line-height:1;border-radius:6px;flex:none}
.tools-fold:hover{color:var(--text);background:var(--surface)}
.tools-sec-body{display:flex;flex-direction:column;gap:8px;padding:8px}
.tools-sec.folded .tools-sec-body{display:none}
/* Slimmer controls inside the tools block (still comfortably clickable). */
.editor-tools .editor-toolbar button,.editor-tools .preview-switch button{padding:4px 8px;font-size:13px}
.editor-tools .btn.sm{padding:5px 10px}
.editor-tools .editor-codebar select,.editor-tools .editor-codebar input{padding:5px 7px}
/* ---- v7.1: editor <-> preview sync highlight ---- */
.sync-hl{background:rgba(255,213,79,.35)!important;outline:1px solid rgba(255,213,79,.75);outline-offset:1px;border-radius:4px;transition:background .3s ease}
#description-editor.sync-flash{outline:2px solid rgba(255,213,79,.85);box-shadow:0 0 0 4px rgba(255,213,79,.25)}
#editor-sync-toggle[aria-pressed="true"]{background:var(--accent);color:#fff;border-color:var(--accent)}
/* ---- v7.1: server status page + dashboard server card ---- */
.meter{height:10px;background:var(--surface2);border-radius:5px;overflow:hidden;min-width:110px}
.meter>i{display:block;height:100%;background:var(--accent);border-radius:5px}
.server-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:16px;margin:16px 0}
.server-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:16px 18px}
.server-card h3{margin:0 0 10px;font-size:15px}
.server-card table{width:100%;border-collapse:collapse;font-size:13.5px}
.server-card td{padding:4px 2px;vertical-align:middle;word-break:break-all}
.server-card td:first-child{color:var(--muted);width:104px;flex:none}
/* ---- v7.2: recent tools row, fmt quick forwards, vertical splitter ---- */
/* The recent row is exactly ONE line: flex + nowrap + hidden overflow,
   items that do not fit are simply not shown (no horizontal scrollbar). */
.recent-row{display:flex;flex-wrap:nowrap;overflow:hidden;gap:6px;align-items:center;min-height:30px}
.recent-empty{color:var(--muted);font-size:12.5px;white-space:nowrap}
.recent-btn{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:4px 8px;font-size:13px;cursor:pointer;white-space:nowrap;flex:none}
.recent-btn:hover{border-color:var(--accent)}
.tools-head-btns{display:flex;align-items:center;gap:2px;flex:none}
.tools-clear{background:none;border:0;color:var(--muted);font-size:12px;cursor:pointer;padding:4px 6px;border-radius:6px;line-height:1}
.tools-clear:hover{color:var(--text);background:var(--surface)}
/* fmt quick-forward bar (image / carousel / code / sync / sticky) */
.editor-quickbar{display:flex;flex-wrap:wrap;gap:6px;align-items:center;border-top:1px dashed var(--border);padding-top:8px}
.editor-quickbar .quickbar-label{color:var(--muted);font-size:12.5px}
.editor-quickbar button{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:4px 8px;font-size:13px;cursor:pointer;white-space:nowrap}
.editor-quickbar button:hover{border-color:var(--accent)}
/* toggle mirrors (fmt forwards + recent-row copies) share the on-state */
.editor-quickbar button[aria-pressed="true"],.recent-btn[aria-pressed="true"]{background:var(--accent);color:#fff;border-color:var(--accent)}
#editor-sticky-toggle[aria-pressed="true"]{background:var(--accent);color:#fff;border-color:var(--accent)}
/* vertical (stacked) split: the divider becomes a horizontal bar, and
   once a row ratio is remembered (.v-split) the two panes share a
   viewport-height layout instead of each taking its natural height. */
#editor-layout[data-mode="split"][data-orient="v"]{grid-template-rows:auto 8px auto;row-gap:6px}
#editor-layout[data-mode="split"][data-orient="v"] #editor-splitter{display:block;cursor:row-resize;background:var(--border);border-radius:4px;min-height:8px;height:8px}
#editor-layout[data-mode="split"][data-orient="v"] #editor-splitter:hover{background:var(--accent)}
#editor-layout[data-mode="split"][data-orient="v"].v-split{grid-template-rows:1fr 8px 1fr;height:calc(100vh - 230px);min-height:640px}
#editor-layout[data-mode="split"][data-orient="v"].v-split>textarea,#editor-layout[data-mode="split"][data-orient="v"].v-split>.editor-preview{height:auto;min-height:0}
