/* =========================================================
   ITShare — "Toolkit" theme: navy + amber, sharp corners,
   terminal-inspired hero. Dark (default) & light.
   ========================================================= */
:root,
[data-theme="dark"] {
    --bg: #0c1222;
    --bg-2: #0f172b;
    --surface: #131c33;
    --surface-2: #19243f;
    --surface-3: #22304f;
    --border: #243152;
    --border-2: #2f3f66;
    --text: #e6ebf5;
    --muted: #8d99b8;
    --amber: #ffb02e;
    --amber-ink: #1d1404;
    --amber-soft: rgba(255, 176, 46, .13);
    --blue: #5e9bff;
    --tool: #5e9bff;
    --prompt: #f472b6;
    --article: #34d399;
    --danger: #f87171;
    --ok: #4ade80;
    --term-bg: #0a0f1c;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 6px 18px rgba(3, 8, 20, .35);
    --radius: 8px;
    --header-h: 62px;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f5f6f9;
    --bg-2: #eceff5;
    --surface: #ffffff;
    --surface-2: #f2f4f8;
    --surface-3: #e6eaf2;
    --border: #dfe3ec;
    --border-2: #cdd3e0;
    --text: #172036;
    --muted: #5c6782;
    --amber: #e08a00;
    --amber-ink: #ffffff;
    --amber-soft: rgba(224, 138, 0, .10);
    --blue: #2563eb;
    --tool: #2563eb;
    --prompt: #db2777;
    --article: #059669;
    --danger: #dc2626;
    --ok: #16a34a;
    --term-bg: #0f1629;
    --shadow: 0 1px 2px rgba(23, 32, 54, .05), 0 4px 14px rgba(23, 32, 54, .06);
    color-scheme: light;
}

/* ===================== Base ===================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 15px/1.65 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: "Lexend", "Be Vietnam Pro", sans-serif; line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.page-pad { padding-top: 22px; padding-bottom: 52px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ml-auto { margin-left: auto; }
code, pre, kbd, .mono { font-family: "JetBrains Mono", Consolas, monospace; }
[hidden] { display: none !important; }
::selection { background: var(--amber); color: var(--amber-ink); }

#loading-bar { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 1000; background: var(--amber); opacity: 0; transition: width .4s, opacity .3s; }
#loading-bar.active { opacity: 1; width: 70%; transition: width 8s cubic-bezier(.1, .7, .2, 1); }
#loading-bar.done { width: 100%; opacity: 0; transition: width .2s, opacity .3s .15s; }

/* ===================== Header ===================== */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 22px; height: var(--header-h); max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px; display: grid; place-items: center; transform: rotate(45deg);
    background: var(--amber); border-radius: 6px;
}
.brand-mark b { transform: rotate(-45deg); font: 800 12px "Lexend", sans-serif; color: var(--amber-ink); }
.brand-name { display: flex; flex-direction: column; font: 700 18px/1.1 "Lexend", sans-serif; }
.brand-name em { font: 500 11px "JetBrains Mono", monospace; color: var(--muted); font-style: normal; margin-top: 2px; }

.main-nav { display: flex; align-items: stretch; height: 100%; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
    position: relative; display: flex; align-items: center; padding: 0 10px; white-space: nowrap;
    color: var(--muted); font-weight: 600; font-size: 14.5px;
}
.main-nav a sup { font: 600 10px "JetBrains Mono", monospace; color: var(--amber); margin-left: 3px; top: -.6em; }
.main-nav a:hover { color: var(--text); text-decoration: none; }
.main-nav a.active { color: var(--text); }
.main-nav a.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; background: var(--amber); border-radius: 3px 3px 0 0; }

.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.mini-search {
    display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px 0 10px; width: 240px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.mini-search:focus-within { border-color: var(--amber); }
.mini-search span { color: var(--muted); font-size: 18px; }
.mini-search input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; padding: 0 !important; box-shadow: none !important; color: var(--text); font: inherit; font-size: 13.5px; outline: none; }
.mini-search kbd { font-size: 11px; padding: 1px 6px; border: 1px solid var(--border-2); border-radius: 4px; color: var(--muted); }
.lang-switch { display: flex; border: 1px solid var(--border-2); border-radius: var(--radius); overflow: hidden; }
.lang-switch button { border: 0; background: transparent; color: var(--muted); font: 700 12px "JetBrains Mono", monospace; padding: 0 9px; height: 34px; cursor: pointer; }
.lang-switch button.active { background: var(--amber); color: var(--amber-ink); }
.icon-btn {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); cursor: pointer;
    border: 1px solid var(--border-2); background: transparent; color: var(--text); font-size: 16px;
}
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.nav-toggle { display: none; }

/* ===================== Buttons & inputs ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px; border-radius: var(--radius);
    border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
    font: 600 14px "Be Vietnam Pro", sans-serif; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .7; cursor: wait; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 700; }
.btn-primary:hover { background: color-mix(in srgb, var(--amber) 88%, #fff); }
.btn-outline { background: transparent; }
.btn-danger { color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.like-btn.liked { color: #fb7185; border-color: #fb7185; }
.link-btn { background: none; border: 0; padding: 2px 6px; cursor: pointer; font: 600 12.5px inherit; color: var(--muted); border-radius: 4px; }
.link-btn.danger:hover { color: var(--danger); background: rgba(248, 113, 113, .1); }

input[type=text], input[type=search], input[type=password], input[type=number], input[type=file], textarea, .select {
    width: 100%; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border-2);
    background: var(--surface); color: var(--text); font: inherit; font-size: 14px; outline: none;
}
input:focus, textarea:focus, .select:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
textarea { resize: vertical; }
textarea.mono { font-size: 13px; line-height: 1.55; }
.select { width: auto; cursor: pointer; }

/* ===================== Hero ===================== */
.hero { border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--bg-2), var(--bg)); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding-top: 56px; padding-bottom: 56px; }
.eyebrow { font: 500 13px "JetBrains Mono", monospace; color: var(--amber); margin: 0 0 14px; }
.hero h1 { font-size: 44px; line-height: 1.15; font-weight: 800; letter-spacing: -.025em; margin-bottom: 16px; }
.hero h1 mark { background: linear-gradient(transparent 62%, var(--amber-soft) 62%, var(--amber-soft) 92%, transparent 92%); color: var(--amber); padding: 0 2px; }
.lead { font-size: 16.5px; color: var(--muted); max-width: 560px; margin: 0 0 24px; }
.hero-search { display: flex; max-width: 560px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.hero-search:focus-within { border-color: var(--amber); }
.hero-search input { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 13px 14px !important; font-size: 15px; }
.hero-search .btn { border-radius: 0; padding: 0 22px; }
.hero-stats { display: flex; gap: 0; margin: 28px 0 0; padding: 0; }
.hero-stats div { padding: 0 22px; border-left: 1px solid var(--border-2); }
.hero-stats div:first-child { padding-left: 0; border-left: 0; }
.hero-stats dt { font: 700 26px "Lexend", sans-serif; }
.hero-stats dd { margin: 0; font-size: 13px; color: var(--muted); }

.term { background: var(--term-bg); border: 1px solid #263355; border-radius: 10px; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); color: #d7deee; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #121a2e; border-bottom: 1px solid #222d4a; }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a4566; }
.term-bar b { margin-left: 10px; font: 500 12px "JetBrains Mono", monospace; color: #8d99b8; }
.term-body { padding: 16px 18px 20px; font: 13px/1.9 "JetBrains Mono", monospace; min-height: 300px; }
.term-line { display: block; opacity: 0; animation: termIn .35s ease forwards; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-line .ps { color: var(--amber); }
.term-line .arg { color: #7dd3fc; }
a.term-item { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; color: #d7deee; padding: 2px 6px; margin: 0 -6px; border-radius: 4px; }
a.term-item:hover { background: rgba(255, 255, 255, .05); text-decoration: none; }
.term-item .tag-type { color: var(--k); font-weight: 700; font-size: 12px; }
.term-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-item .n { color: #8d99b8; font-size: 12px; }
.term-line.ok { color: var(--ok); margin-top: 6px; }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--amber); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes termIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }

/* type colors */
.type-tool { --k: var(--tool); }
.type-prompt { --k: var(--prompt); }
.type-article { --k: var(--article); }

/* ===================== Sections ===================== */
.section { margin: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.section-head h2 { margin: 0; position: relative; padding-left: 14px; }
.section-head h2::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; background: var(--amber); border-radius: 2px; }
.see-all { font-weight: 600; font-size: 14px; color: var(--amber); white-space: nowrap; }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--radius); }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick {
    display: flex; align-items: center; gap: 14px; padding: 16px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--k); border-radius: var(--radius);
    transition: background .15s, transform .15s;
}
.quick:hover { background: var(--surface-2); text-decoration: none; transform: translateX(3px); }
.quick-icon { width: 46px; height: 46px; display: grid; place-items: center; font-size: 24px; border-radius: var(--radius); background: color-mix(in srgb, var(--k) 14%, transparent); flex-shrink: 0; }
.quick-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.quick-text b { font: 600 16px "Lexend", sans-serif; }
.quick-text small { color: var(--muted); font-size: 13.5px; }
.quick-count { font: 700 22px "Lexend", sans-serif; color: var(--k); }

.issue-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.issue {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px; text-align: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 600; font-size: 14px;
}
.issue span { font-size: 28px; }
.issue:hover { border-color: var(--amber); text-decoration: none; color: var(--amber); }

/* ===================== Post card ===================== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card-grid.grid-sm { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pcard {
    display: flex; flex-direction: column; padding: 16px 16px 12px; min-width: 0;
    background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--k); border-radius: var(--radius);
    box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.pcard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--k) 55%, var(--border)); border-top-color: var(--k); }
.pcard-media { display: block; margin: -16px -16px 12px; aspect-ratio: 16 / 8; overflow: hidden; border-bottom: 1px solid var(--border); }
.pcard-media img { width: 100%; height: 100%; object-fit: cover; }
.pcard-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; min-width: 0; }
.pcard-icon { font-size: 18px; }
.ptype { font: 700 11.5px "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: .04em; color: var(--k); }
.pcat { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcat::before { content: "/ "; opacity: .5; }
.pcard-title { font-size: 16.5px; margin: 0 0 6px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-title a { color: var(--text); }
.pcard-title a:hover { color: var(--k); text-decoration: none; }
.pcard-sum { color: var(--muted); font-size: 14px; margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-code { position: relative; margin: 0 0 12px; border: 1px dashed var(--border-2); border-radius: 6px; background: var(--term-bg); overflow: hidden; }
.pcard-code .fname { display: block; padding: 4px 10px; font: 500 11px "JetBrains Mono", monospace; color: #8d99b8; border-bottom: 1px dashed #263355; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-code pre { margin: 0; padding: 8px 10px; font-size: 11.5px; line-height: 1.6; color: #c6d0e6; white-space: pre; overflow: hidden; max-height: 64px; }
.type-prompt .pcard-code pre { white-space: pre-wrap; font-family: "Be Vietnam Pro", sans-serif; }
.pcard-foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pcard-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ibtn {
    display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--border-2); background: transparent; color: var(--text); font-size: 14px;
}
.ibtn:hover { border-color: var(--k); color: var(--k); text-decoration: none; }
.ibtn.done { border-color: var(--ok); color: var(--ok); }
.go { font-weight: 600; color: var(--k); white-space: nowrap; margin-left: 4px; }

/* ===================== List page ===================== */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--amber); }
.list-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.list-icon { width: 56px; height: 56px; display: grid; place-items: center; font-size: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); flex-shrink: 0; }
.list-head h1 { margin: 0 0 2px; }
.list-head p { margin: 0; }
.list-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 26px; align-items: start; }
.filter-panel { position: sticky; top: calc(var(--header-h) + 14px); display: flex; flex-direction: column; gap: 18px; }
.fp-block h4 { font: 600 12px "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.fp-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.fp-list a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; margin-left: -2px; border-left: 2px solid transparent; color: var(--text); font-size: 14px; }
.fp-list a em { font: normal 12px "JetBrains Mono", monospace; color: var(--muted); }
.fp-list a:hover { text-decoration: none; background: var(--surface); }
.fp-list a.active { border-left-color: var(--amber); color: var(--amber); font-weight: 600; background: var(--amber-soft); }
.fp-sort { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fp-sort a { padding: 6px 8px; text-align: center; font-size: 13px; border: 1px solid var(--border-2); border-radius: 6px; color: var(--muted); }
.fp-sort a:hover { text-decoration: none; color: var(--text); }
.fp-sort a.active { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.result-line { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.result-line b { color: var(--text); }
.result-line .clear { margin-left: 4px; color: var(--muted); }
.load-more { display: flex; justify-content: center; margin-top: 24px; min-height: 40px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; font-size: 12.5px; padding: 3px 9px; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tag:hover, .tag.active { color: var(--amber); border-color: var(--amber); text-decoration: none; }

/* ===================== Detail ===================== */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 28px; align-items: start; }
.post-head { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.post-badges { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.post-badges .ptype { font-size: 12px; }
.pcat.draft { color: #fbbf24; }
.post-head h1 { font-size: 32px; margin: 10px 0 8px; }
.post-summary { font-size: 16.5px; color: var(--muted); margin: 0 0 12px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 16px; font: 13px "JetBrains Mono", monospace; color: var(--muted); margin-bottom: 16px; }
.post-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.post-cover { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 18px; }
.notice { padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius); background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); font-size: 14px; }
.download-panel {
    display: grid; grid-template-columns: 1fr auto; gap: 14px 18px; align-items: center; margin-bottom: 20px; padding: 18px;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--amber); border-radius: var(--radius);
}
.dl-file { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dl-ext {
    flex-shrink: 0; width: 52px; height: 60px; display: grid; place-items: end center; padding-bottom: 8px; position: relative;
    font: 700 11px "JetBrains Mono", monospace; color: var(--amber);
    border: 2px solid var(--amber); border-radius: 4px 14px 4px 4px; background: var(--amber-soft);
}
.dl-name { display: block; font: 600 15px "JetBrains Mono", monospace; word-break: break-all; margin: 2px 0; }
.dl-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; }
.dl-note { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }
.dl-buttons { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dl-alt { font-size: 12.5px; color: var(--muted); }
.dl-alt:hover { color: var(--amber); }
.dl-howto { grid-column: 1 / -1; font-size: 13.5px; padding: 12px 14px; border-radius: 6px; background: var(--surface-2); border: 1px dashed var(--border-2); }
.dl-howto ol { margin: 6px 0 0; padding-left: 20px; }
.dl-howto li { margin: 4px 0; }
.dl-howto code { font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: var(--term-bg); color: #e6ebf5; }
.dl-cmd { display: block; width: fit-content; max-width: 100%; margin-top: 6px; padding: 6px 10px !important; overflow-x: auto; white-space: nowrap; }
.code-wrap { margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; border: 1px solid #263355; background: var(--term-bg); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px 7px 14px; background: #121a2e; color: #c6d0e6; font-size: 13px; font-weight: 600; border-bottom: 1px solid #222d4a; }
.code-head .btn { background: #1b2540; border-color: #2f3f66; color: #e6ebf5; }
.code-lang { margin-left: 8px; font: 500 11px "JetBrains Mono", monospace; color: #8d99b8; padding: 1px 7px; border: 1px solid #2f3f66; border-radius: 4px; }
.code-wrap pre { margin: 0; max-height: 560px; overflow: auto; }
.code-wrap pre code { display: block; padding: 16px; font-size: 13px; line-height: 1.65; color: #e6ebf5; background: transparent !important; }
.code-wrap.is-prompt { border-color: color-mix(in srgb, var(--prompt) 45%, #263355); }
.code-wrap.is-prompt pre code { white-space: pre-wrap; word-break: break-word; font-family: "Be Vietnam Pro", sans-serif; font-size: 14px; }
.content-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }

.prose { font-size: 15.5px; line-height: 1.8; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 20px; margin: 1.5em 0 .6em; }
.prose h3 { font-size: 17px; margin: 1.2em 0 .5em; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li:has(> input[type=checkbox]) { list-style: none; margin-left: -22px; }
.prose input[type=checkbox] { margin-right: 8px; accent-color: var(--amber); }
.prose code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; font-size: .87em; }
.prose pre { background: var(--term-bg); border: 1px solid #263355; border-radius: var(--radius); overflow: auto; }
.prose pre code { display: block; padding: 14px 16px; border: 0; background: transparent; color: #e6ebf5; font-size: 13px; }
.prose blockquote { margin: 1em 0; padding: 10px 16px; border-left: 4px solid var(--amber); background: var(--amber-soft); border-radius: 0 6px 6px 0; }
.prose blockquote p { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border-2); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-family: "Lexend", sans-serif; font-weight: 600; }

.comment-form { display: grid; gap: 10px; margin-bottom: 14px; }
.comment-form input[name=name] { max-width: 320px; }
.comment-form .form-row { margin: 0; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); animation: termIn .3s; transition: opacity .25s; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 6px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; color: var(--amber-ink); background: var(--amber); }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.removing { opacity: 0 !important; transition: opacity .25s; }

.sidebar { position: sticky; top: calc(var(--header-h) + 14px); display: flex; flex-direction: column; gap: 14px; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.widget-title { font: 600 12px "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.popular-list { margin: 0; padding: 0; list-style: none; counter-reset: pop; }
.popular-list li { counter-increment: pop; position: relative; padding: 8px 0 8px 30px; border-bottom: 1px solid var(--border); }
.popular-list li:last-child { border-bottom: 0; }
.popular-list li::before { content: counter(pop, decimal-leading-zero); position: absolute; left: 0; top: 9px; font: 700 13px "JetBrains Mono", monospace; color: var(--amber); }
.popular-list a { display: block; color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.4; }
.popular-list a:hover { color: var(--amber); text-decoration: none; }
.cat-group-title { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .05em; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list a { display: flex; justify-content: space-between; padding: 5px 8px; border-radius: 4px; color: var(--text); font-size: 14px; }
.cat-list a:hover { background: var(--surface-2); text-decoration: none; }
.cat-list .count { font: 12px "JetBrains Mono", monospace; color: var(--muted); }

/* ===================== Forms & admin ===================== */
.page-head { margin-bottom: 18px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .select { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--amber); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span-2 { grid-column: span 2; }
.form-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.form-msg { font-size: 14px; }
.form-msg.error { color: var(--danger); background: rgba(248, 113, 113, .1); padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; }
.fieldset { border: 1px solid var(--border-2); border-radius: var(--radius); padding: 14px 16px 4px; margin: 0 0 16px; }
.fieldset legend { font-weight: 700; padding: 0 6px; font-size: 14px; }
.hp { position: absolute !important; left: -9999px !important; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-search { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.chip { padding: 6px 12px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border-2); color: var(--muted); font: 600 13px inherit; cursor: pointer; }
.chip.active { border-color: var(--amber); color: var(--amber); }
.editor-tabs { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.preview-box { border: 1px dashed var(--border-2); border-radius: var(--radius); padding: 16px; min-height: 200px; margin-bottom: 12px; }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager a { min-width: 36px; text-align: center; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-2); color: var(--text); font-weight: 600; font-size: 14px; }
.pager a.active { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.admin-nav { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.admin-nav a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.admin-nav a:hover { color: var(--text); text-decoration: none; }
.admin-nav a.active { color: var(--text); border-bottom-color: var(--amber); }
.admin-split { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 600 11.5px "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; }
.table .actions { white-space: nowrap; text-align: right; }
.table td a { color: var(--text); font-weight: 600; }
.table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--amber); }
.comment-cell { max-width: 380px; }
.badge { display: inline-block; font: 700 11px "JetBrains Mono", monospace; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; }
.badge-tool { color: var(--tool); background: color-mix(in srgb, var(--tool) 14%, transparent); }
.badge-prompt { color: var(--prompt); background: color-mix(in srgb, var(--prompt) 14%, transparent); }
.badge-article { color: var(--article); background: color-mix(in srgb, var(--article) 14%, transparent); }
.switch { width: 40px; height: 22px; border-radius: 99px; border: 0; background: var(--border-2); position: relative; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--amber); }
.switch.on::after { transform: translateX(18px); }
.auth-box { max-width: 400px; margin: 40px auto; padding: 30px; }
.auth-box h1 { text-align: center; font-size: 22px; margin-bottom: 18px; }
.auth-icon { text-align: center; font-size: 40px; }
.error-page { text-align: center; padding: 60px 16px; }
.error-code { font: 800 96px/1 "Lexend", sans-serif; color: var(--amber); }

/* ===================== Footer, toast ===================== */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding-top: 34px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.footer-grid h4 { font: 600 12px "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.footer-grid > div:not(.footer-about) a { display: block; color: var(--text); font-size: 14px; padding: 3px 0; }
.footer-grid a:hover { color: var(--amber); text-decoration: none; }
.footer-about p { max-width: 320px; font-size: 14px; }
.footer-bottom { padding-top: 18px; padding-bottom: 22px; margin-top: 24px; border-top: 1px solid var(--border); }
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 16px; border-radius: 6px; background: #131c33; color: #e6ebf5; font-size: 14px; font-weight: 500; border: 1px solid #2f3f66; border-left: 4px solid var(--ok); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transform: translateY(16px); opacity: 0; transition: all .25s; max-width: 360px; }
.toast.show { transform: none; opacity: 1; }
.toast-error { border-left-color: var(--danger); }
#back-to-top { position: fixed; bottom: 20px; left: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90; background: var(--surface); }
#back-to-top.show { opacity: 1; pointer-events: auto; }
#main > :not(#page-meta) { animation: fadeUp .22s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ===================== Responsive ===================== */
@media (max-width: 1180px) {
    .mini-search { width: 180px; }
    .issue-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nav-about { display: none !important; }
}
@media (max-width: 1020px) {
    .hero-grid { grid-template-columns: 1fr; gap: 30px; }
    .layout, .admin-split { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .list-layout { grid-template-columns: 1fr; }
    .filter-panel { position: static; }
    .fp-list { display: flex; flex-wrap: wrap; gap: 6px; border-left: 0; }
    .fp-list a { border: 1px solid var(--border-2); border-radius: 6px; margin: 0; }
    .fp-list a.active { border-color: var(--amber); }
    .fp-sort { grid-template-columns: repeat(4, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .nav-toggle { display: grid; }
    .main-nav {
        position: absolute; top: var(--header-h); left: 0; right: 0; height: auto; flex-direction: column; gap: 0;
        background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 6px 20px 12px; display: none;
    }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 11px 0; border-bottom: 1px solid var(--border); }
    .main-nav a.active::after { left: -20px; right: auto; top: 8px; bottom: 8px; width: 3px; height: auto; }
    .nav-about { display: flex !important; }
}
@media (max-width: 680px) {
    .container, .header-inner { padding: 0 16px; }
    .mini-search { display: none; }
    .brand-name em { display: none; }
    h1, .post-head h1 { font-size: 24px; }
    .hero h1 { font-size: 31px; }
    .hero-grid { padding-top: 32px; padding-bottom: 36px; }
    .hero-stats { flex-wrap: wrap; row-gap: 12px; }
    .hero-stats div { padding: 0 14px; }
    .term-body { min-height: 0; font-size: 12px; }
    a.term-item { grid-template-columns: 1fr auto; }
    a.term-item .tag-type { display: none; }
    .quick-grid { grid-template-columns: 1fr; }
    .issue-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card-grid, .card-grid.grid-sm { grid-template-columns: 1fr; }
    .fp-sort { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .download-panel { grid-template-columns: 1fr; }
    .content-box { padding: 16px; }
    .footer-grid { grid-template-columns: 1fr; }
}
