/* Pikara — a lively, cover-first community UI that stays cheap to paint on
   low-end devices (no blur, no 3D, only transform/opacity animations).

   THEME TOKENS. Every colour in this file comes from the variables below;
   components never hard-code a colour. Two independent axes:
     display mode   <html data-theme="light|dark">   neutral surfaces and text
     accent colour  <html data-accent="blue|pink">   brand colour for actions
   Any mode combines with any accent. */
:root {
  /* palette swatches (fixed: used by the accent picker itself) */
  --sky: #00aeec; --sakura: #fb7299;

  /* neutrals — light: three stacked layers on a soft grey page */
  --bg: #f1f2f3; --surface: #ffffff; --surface-2: #f6f7f8; --surface-3: #e9eaec;
  --line: #e7e8ea; --line-strong: #cfd2d6;
  --text: #18191c; --text-2: #61666d; --text-3: #9499a0;
  --danger: #e5484d; --danger-soft: #fdecec; --ok: #1a9c5b; --warn: #f5a623; --badge: #f6546a;
  --inverse: #2b2d31; --on-inverse: #ffffff; --selected: #ffffff;
  --scrim: rgba(0, 0, 0, .45); --cover-shade: rgba(0, 0, 0, .62); --cover-shade-0: rgba(0, 0, 0, 0);
  --media-bg: #000000; --on-media: #ffffff; --glass: rgba(255, 255, 255, .14); --glass-strong: rgba(255, 255, 255, .24);
  --shadow: 0 1px 2px rgba(0, 0, 0, .05); --shadow-pop: 0 8px 24px rgba(0, 0, 0, .12); --shadow-lift: 0 6px 16px rgba(0, 0, 0, .10);
  --tint-0: #2aa7d8; --tint-1: #4a86d8; --tint-2: #2a9d8f; --tint-3: #7d6fcb; --tint-4: #d98148; --tint-5: #cf5f93;
  /* code blocks keep one dark palette in both modes */
  --code-bg: #1e2227; --code-text: #d7dae0; --code-comment: #7f8896; --code-keyword: #c792ea; --code-string: #9ccc65;
  --code-number: #f7a35c; --code-title: #5fc8f2; --code-variable: #f07178; --code-deletion: #ff6b6f;

  /* accent — sky blue (default) */
  --brand: #00aeec; --brand-strong: #0099d2; --brand-ink: #007ba8; --brand-soft: #e1f5fd; --on-brand: #ffffff;

  --radius: 12px; --radius-sm: 8px; --pill: 999px;
  --ease: cubic-bezier(.2, .8, .2, 1); --theme-fade: 200ms;
  --topbar-h: 60px; --tabbar-h: 0px;
  --font: "PingFang TC", "PingFang SC", "Microsoft JhengHei", "Microsoft YaHei", "Noto Sans TC", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
:root[data-accent="pink"] {
  --brand: #fb7299; --brand-strong: #f25d8a; --brand-ink: #d23d6f; --brand-soft: #ffecf2;
}
/* Dark: layered warm-neutral greys rather than pure black, and a slightly
   softened accent so it does not glare against the dark surfaces. */
:root[data-theme="dark"] {
  --bg: #17181a; --surface: #1f2022; --surface-2: #292a2d; --surface-3: #343538;
  --line: #2f3033; --line-strong: #47494e;
  --text: #e6e7e9; --text-2: #a6aab0; --text-3: #767a81;
  --danger: #ff6b6f; --danger-soft: #3a2022; --ok: #3ecf8e; --warn: #f0b03f; --badge: #f2637a;
  --inverse: #e6e7e9; --on-inverse: #18191c; --selected: #3d3f43;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: none; --shadow-pop: 0 8px 24px rgba(0, 0, 0, .4); --shadow-lift: 0 6px 16px rgba(0, 0, 0, .32);
  --tint-0: #2587ad; --tint-1: #3f6fb3; --tint-2: #26857a; --tint-3: #685caa; --tint-4: #b36b3e; --tint-5: #ab507b;
  --code-bg: #141517;
  --brand: #1fa5dc; --brand-strong: #3bb3e4; --brand-ink: #5cc6f0; --brand-soft: #1d3541;
  color-scheme: dark;
}
:root[data-theme="dark"][data-accent="pink"] {
  --brand: #ea6d94; --brand-strong: #f084a6; --brand-ink: #ff8fb1; --brand-soft: #40252f;
}

/* Smooth hand-over when the user switches mode or accent. The class is only
   present for ~260 ms (theme.js), so ordinary rendering never pays for it. */
:root.theme-switching, :root.theme-switching *, :root.theme-switching *::before, :root.theme-switching *::after {
  transition: background-color var(--theme-fade) ease, color var(--theme-fade) ease, border-color var(--theme-fade) ease,
    fill var(--theme-fade) ease, stroke var(--theme-fade) ease, box-shadow var(--theme-fade) ease !important;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); min-height: 100vh; display: flex; flex-direction: column; overflow-wrap: anywhere; }
h1, h2, h3, h4, p, ul, ol, figure, pre { margin: 0; }
h1 { font-size: 24px; line-height: 1.3; } h2 { font-size: 18px; line-height: 1.35; } h3 { font-size: 16px; line-height: 1.4; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video, iframe { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--brand); color: var(--on-brand); padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.icon-sm { width: 14px; height: 14px; margin-left: 4px; vertical-align: -2px; }
.mono, code { font-family: var(--mono); font-size: .92em; }

/* ---------- layout ---------- */
/* One page width: the navigation bar, announcement strip, content and footer share the same left and right edges. */
body { --page-w: 1200px; --page-pad: 16px; }
body.page-wide { --page-w: 1440px; }
.container { width: 100%; max-width: var(--page-w); margin: 0 auto; padding: 20px var(--page-pad) 40px; flex: 1; }
.narrow { max-width: 680px; margin: 0 auto; }
.narrow-wide { max-width: 920px; margin: 0 auto; }
.narrow > * + *, .narrow-wide > * + * { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; } .row.wrap { flex-wrap: wrap; } .row.center { justify-content: center; } .row.end { justify-content: flex-end; }
.center { text-align: center; }
.block { margin-top: 28px; }
.grid { display: grid; gap: 14px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-resources { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-software, .grid-links { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; margin-top: 28px; }
.two-col > * { min-width: 0; }
.feed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; max-width: 1020px; margin: 0 auto; }
.feed-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.feed-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(var(--topbar-h) + 16px); align-self: start; }
.side-title { font-size: 15px; margin-bottom: 8px; }
.page-head { margin-bottom: 16px; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.section-head h2 .icon { color: var(--brand); }
.more-link, .back-link { font-size: 14px; color: var(--text-2); }
.back-link { display: inline-block; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.card.pad > * + * { margin-top: 12px; }
.center-card { text-align: center; padding: 36px 20px; }
.center-card > * + * { margin-top: 14px; }
.empty { text-align: center; color: var(--text-3); padding: 32px 16px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty .icon { width: 30px; height: 30px; }
.empty > * + * { margin-top: 10px; }
.hint { color: var(--text-3); font-size: 13px; }
.meta, .meta-item, .when, time { color: var(--text-3); font-size: 13px; }
.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.meta-item .icon { width: 15px; height: 15px; }
.meta-author { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; min-width: 0; }
.summary { color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.promise { color: var(--brand-ink); font-weight: 600; }
.notice, .site-notice { background: var(--brand-soft); color: var(--text); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; }
.site-notice { border-radius: 0; text-align: center; }
.ok-text, .form-ok { color: var(--ok); }
.form-error { color: var(--danger); font-size: 14px; }
.danger { color: var(--danger); }

/* ---------- buttons, chips, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 18px; border-radius: var(--pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn .icon { width: 17px; height: 17px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand-ink); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); position: relative; cursor: pointer; transition: background-color .15s, color .15s, transform .15s var(--ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--brand-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; white-space: nowrap; border: 1px solid transparent; }
a.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip-solid { background: var(--brand); color: var(--on-brand); }
.chip-soft { background: var(--brand-soft); color: var(--brand-ink); }
.chip-line { border-color: var(--line-strong); color: var(--text-2); background: var(--surface); }
.badge { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--badge); color: var(--on-brand); font-size: 11px; line-height: 17px; text-align: center; font-weight: 700; }

input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { width: 100%; min-height: 38px; padding: 7px 11px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=file] { max-width: 100%; font-size: 13px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text); display: inline-flex; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 14px; border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 15px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--brand-ink); text-decoration: none; }
.tabs [aria-current] { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabs .has-content::after { content: "•"; margin-left: 4px; color: var(--brand); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; margin-bottom: 16px; align-items: center; }
.filter-bar > * { flex: 1 1 150px; } .filter-bar > .btn { flex: 0 0 auto; }
.load-more { text-align: center; margin-top: 16px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: var(--page-w); margin: 0 auto; height: var(--topbar-h); padding: 0 var(--page-pad); display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand svg, .footer-brand svg { width: 32px; height: 32px; flex: none; }
.mainnav { display: flex; gap: 2px; }
.mainnav a { position: relative; padding: 8px 13px; border-radius: 8px; color: var(--text); font-weight: 600; white-space: nowrap; transition: color .15s; }
.mainnav a:hover { color: var(--brand-ink); text-decoration: none; }
.mainnav a::after { content: ""; position: absolute; left: 50%; bottom: 1px; width: 20px; height: 3px; margin-left: -10px; border-radius: 2px; background: var(--brand); transform: scaleX(0); transition: transform .22s var(--ease); }
.mainnav a:hover::after { transform: scaleX(.5); }
.mainnav a[aria-current] { color: var(--brand-ink); }
.mainnav a[aria-current]::after { transform: scaleX(1); }
.searchbox { flex: 1; max-width: 460px; margin: 0 auto; position: relative; }
.searchbox input { padding-right: 42px !important; border-radius: 19px !important; background: var(--surface-2) !important; border-color: transparent !important; }
.searchbox input:focus { background: var(--surface) !important; border-color: var(--brand) !important; }
.searchbox button { position: absolute; right: 3px; top: 3px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); display: grid; place-items: center; }
.searchbox button:hover { color: var(--brand-ink); }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; }
.menu-panel a, .menu-panel button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; color: var(--text); font-size: 14px; text-align: left; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel [aria-current] { color: var(--brand-ink); font-weight: 700; }
.menu-panel .danger { color: var(--danger); }
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head span { color: var(--text-3); font-size: 12px; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); display: inline-block; vertical-align: middle; }
.avatar-text { display: inline-grid; place-items: center; background: var(--brand); color: var(--on-brand); font-weight: 700; }

/* ---------- footer, tab bar, toast, dialog ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); margin-bottom: var(--tabbar-h); }
.footer-inner { max-width: var(--page-w); margin: 0 auto; padding: 22px var(--page-pad); display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { color: var(--text-2); font-size: 14px; }
.tabbar { display: none; }
.toast-root { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--inverse); color: var(--on-inverse); padding: 10px 18px; border-radius: var(--pill); font-size: 14px; box-shadow: var(--shadow-pop); animation: rise .2s var(--ease); }
.toast-success { background: var(--ok); color: var(--on-brand); } .toast-error { background: var(--danger); color: var(--on-brand); }
.toast.leaving { opacity: 0; transition: opacity .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
dialog, .dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); padding: 20px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: rise .2s var(--ease); }
dialog > * + *, dialog form > * + * { margin-top: 12px; }

/* ---------- home ---------- */
.list-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; color: var(--text); }
.list-item:hover { border-color: var(--brand); text-decoration: none; }

/* ---------- article cards ---------- */
.cover { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: var(--on-media); padding: 8px; text-align: center; }
.tint-0 { background: var(--tint-0); } .tint-1 { background: var(--tint-1); } .tint-2 { background: var(--tint-2); } .tint-3 { background: var(--tint-3); } .tint-4 { background: var(--tint-4); } .tint-5 { background: var(--tint-5); }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-body h3 { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-body h3 a, .resource-card h3 a { color: var(--text); }
.card-body h3 a:hover, .resource-card h3 a:hover { color: var(--brand-ink); text-decoration: none; }
.card-body .meta { margin-top: auto; }
.resource-card { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.resource-top { display: flex; gap: 6px; flex-wrap: wrap; }
.resource-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.link-card, .software-card { display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--text); }
.link-card:hover, .software-card:hover { border-color: var(--brand); text-decoration: none; }
.link-card span, .software-card > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.link-card small, .software-card small { color: var(--text-2); font-size: 13px; }
.software-mark { width: 48px; height: 48px; border-radius: 10px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.software-mark.big { width: 72px; height: 72px; font-size: 17px; border-radius: 14px; }
.software-head { display: flex; align-items: center; gap: 16px; }
.software-head > div > * + * { margin-top: 4px; }
.release-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.asset-list, .plain-list, .session-list, .user-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.asset-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asset-name { font-family: var(--mono); font-size: 13px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.thumb-sm { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; display: block; }
.embed, .md-video { position: relative; aspect-ratio: 16 / 9; background: var(--media-bg); border-radius: var(--radius-sm); overflow: hidden; }
.embed iframe, .md-video video, video.md-video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
video.md-video { position: static; }

/* ---------- feed ---------- */
.composer { padding: 14px; }
.composer-row { display: flex; gap: 12px; }
.composer-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.composer-main textarea { border-color: transparent; background: var(--surface-2); min-height: 76px; }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.composer-bar .counter { margin-left: auto; color: var(--text-3); font-size: 13px; }
.composer-link { display: flex; gap: 8px; }
.post { padding: 14px 16px; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.post-who .name { color: var(--text); font-weight: 700; }
.post-who .when:hover { text-decoration: none; color: var(--brand-ink); }
.post-body { margin: 10px 0 0 54px; }
.post-body.clamp { max-height: 9.6em; overflow: hidden; }
.post-images { margin: 10px 0 0 54px; display: grid; gap: 6px; max-width: 560px; }
.post-images.n1 { grid-template-columns: minmax(0, 320px); } .post-images.n2 { grid-template-columns: 1fr 1fr; } .post-images.n3 { grid-template-columns: 1fr 1fr 1fr; }
.post-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--surface-2); }
.post-images.n1 img { aspect-ratio: auto; max-height: 420px; }
.post-link { margin: 10px 0 0 54px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface-2); border-radius: 8px; color: var(--text); font-size: 14px; min-width: 0; }
.post-link-url { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.post-actions { margin: 10px 0 0 46px; display: flex; gap: 4px; flex-wrap: wrap; }
.act { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 10px; border: 0; background: none; border-radius: 17px; color: var(--text-2); font-size: 13px; transition: color .15s, background-color .15s; }
.act:hover { background: var(--surface-2); color: var(--brand-ink); }
.act .icon { width: 18px; height: 18px; }
.act[aria-pressed="true"] { color: var(--brand-ink); }
.act[aria-pressed="true"] .icon { fill: currentColor; }
.act[data-act="like"][aria-pressed="true"] { color: var(--brand); }
.thumbs-up, .post-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
[data-thumbs] { display: flex; gap: 6px; flex-wrap: wrap; }
[data-thumbs] > * { position: relative; }
[data-thumbs] img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
[data-thumbs] button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--inverse); color: var(--on-inverse); line-height: 1; padding: 0; }

.comments { margin: 12px 0 0 54px; border-top: 1px solid var(--line); padding-top: 12px; }
.article-comments .comments, .article-comments { margin-left: 0; }
.comment-form { display: flex; gap: 8px; align-items: flex-start; }
.comment-form textarea { min-height: 40px; flex: 1; }
.comment-list { list-style: none; padding: 0; margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.comment-head .name { font-weight: 700; color: var(--text-2); }
.comment-text { white-space: pre-wrap; margin-top: 2px; }
.comment.removed .comment-text { color: var(--text-3); font-style: italic; }
.comment-actions { display: flex; gap: 12px; margin-top: 2px; }
.comment-actions button { border: 0; background: none; padding: 0; color: var(--text-3); font-size: 13px; }
.comment-actions button:hover { color: var(--brand-ink); }
.replies { list-style: none; padding: 0; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.reply-to { color: var(--brand-ink); margin-right: 4px; }
.empty-comments { color: var(--text-3); font-size: 14px; padding: 8px 0; }

/* ---------- profile, settings, notifications ---------- */
.profile-head { display: flex; gap: 18px; padding: 20px; align-items: flex-start; }
.profile-info { flex: 1; min-width: 0; }
.profile-info > * + * { margin-top: 6px; }
.profile-info h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-meta { color: var(--text-3); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.profile-bio { color: var(--text-2); white-space: pre-wrap; }
.profile-stats { display: flex; gap: 22px; }
.profile-stats a, .profile-stats span { color: var(--text-2); font-size: 14px; }
.profile-stats strong { color: var(--text); font-size: 17px; margin-right: 4px; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
.user-row:hover { border-color: var(--brand); text-decoration: none; }
.user-row span { display: flex; flex-direction: column; min-width: 0; }
.user-row small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-link { color: var(--text); font-weight: 600; }
.settings section > * + * { margin-top: 12px; }
.avatar-edit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.danger-zone { border-color: var(--danger); }
.session-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.session-list li > div { display: flex; flex-direction: column; min-width: 0; }
.session-list small { color: var(--text-3); }
.secret, .recovery { display: block; padding: 12px; background: var(--surface-2); border-radius: 8px; font-family: var(--mono); font-size: 15px; letter-spacing: 1px; user-select: all; white-space: pre-wrap; }
.notify-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
a.notify-row:hover { background: var(--surface-2); text-decoration: none; }
.notify-row.unread { background: var(--brand-soft); }
.notify-text { display: flex; flex-direction: column; min-width: 0; }
.notify-text small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.notify-row { display: block; }
details.notify-row summary { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; }
.mail-body { white-space: pre-wrap; color: var(--text-2); margin-top: 8px; }
.auth-wrap { max-width: 420px; margin: 24px auto; }
.auth-wrap > * + * { margin-top: 16px; }
.auth-card h1 { text-align: center; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.error-code { font-size: 64px; font-weight: 800; color: var(--brand); line-height: 1; }

/* ---------- Markdown ---------- */
.md { line-height: 1.75; }
.md > * + * { margin-top: .8em; }
.md h1, .md h2, .md h3, .md h4 { margin-top: 1.5em; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.md > :first-child { margin-top: 0; }
.md h2 { font-size: 21px; padding-bottom: 6px; border-bottom: 1px solid var(--line); } .md h3 { font-size: 18px; }
.md ul, .md ol { padding-left: 1.5em; }
.md li + li { margin-top: .25em; }
.md blockquote { margin: .8em 0 0; padding: 8px 14px; border-left: 3px solid var(--brand); background: var(--surface-2); color: var(--text-2); border-radius: 0 6px 6px 0; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.md pre { position: relative; background: var(--code-bg); color: var(--code-text); padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; }
.md pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.md img { border-radius: 8px; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; }
.md th { background: var(--surface-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.copy-btn { position: absolute; top: 6px; right: 6px; border: 0; border-radius: 5px; background: var(--glass); color: var(--code-text); font-size: 12px; padding: 3px 8px; }
.copy-btn:hover { background: var(--glass-strong); }
.hljs-comment, .hljs-quote { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: var(--code-keyword); }
.hljs-string, .hljs-attr, .hljs-symbol, .hljs-bullet, .hljs-addition { color: var(--code-string); }
.hljs-number, .hljs-meta, .hljs-built_in { color: var(--code-number); }
.hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-name { color: var(--code-title); }
.hljs-variable, .hljs-template-variable, .hljs-attribute { color: var(--code-variable); }
.hljs-deletion { color: var(--code-deletion); }

/* ---------- article page ---------- */
.reading-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; pointer-events: none; }
.reading-progress span { display: block; height: 100%; background: var(--brand); transform: scaleX(0); transform-origin: left; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; max-width: 1080px; margin: 0 auto; }
.article-layout > * { min-width: 0; }
.article { padding: 26px 30px; }
.article > * + * { margin-top: 16px; }
.article h1 { font-size: 28px; }
.article-cover { width: 100%; border-radius: var(--radius-sm); aspect-ratio: 16 / 9; object-fit: cover; }
.article-meta { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; color: var(--text-3); font-size: 13px; }
.article-body { font-size: 16px; }
.article-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.article-comments { padding: 18px 30px; margin-top: 16px; }
.toc-side { position: sticky; top: calc(var(--topbar-h) + 16px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 32px); overflow: auto; }
.toc { padding: 14px; }
.toc ol, .toc ul { list-style: none; padding: 0; margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: block; padding: 4px 8px; border-left: 2px solid transparent; color: var(--text-2); font-size: 14px; }
.toc a:hover { color: var(--brand-ink); text-decoration: none; }
.toc a[aria-current] { color: var(--brand-ink); border-left-color: var(--brand); font-weight: 600; }
.toc .toc-l3, .toc-l.toc-l3, .toc [data-level="3"] { padding-left: 20px; }
.static-page { font-size: 16px; }

/* ---------- editor ---------- */
.editor { display: flex; flex-direction: column; gap: 12px; }
.editor-bar { padding: 10px 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 20; }
.editor-status { color: var(--text-3); font-size: 13px; margin-right: auto; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.editor-form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.editor-form textarea[name=content] { min-height: 460px; font-family: var(--mono); font-size: 14px; }
.editor-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.editor-preview { padding: 16px; min-height: 300px; }
.cover-edit { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.cover-preview { aspect-ratio: 16 / 9; max-width: 320px; background: var(--surface-2); border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.admin-nav { padding: 14px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.admin-nav h1 { font-size: 17px; margin-bottom: 10px; }
.admin-nav nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav button { text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 6px; color: var(--text-2); font-size: 14px; }
.admin-nav button:hover { background: var(--surface-2); }
.admin-nav button[aria-current] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.admin-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.admin-panel input[type=search] { width: 220px; }
.admin-panel select { width: auto; }
.table-wrap { overflow-x: auto; }
.admin-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { color: var(--text-3); font-weight: 600; white-space: nowrap; }
.admin-table td > * + * { margin-left: 6px; }
.admin-table td .btn { margin-bottom: 4px; }
.cell-text { display: inline-block; max-width: 340px; max-height: 4.8em; overflow: hidden; white-space: pre-wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; }
.stat strong { font-size: 24px; line-height: 1.2; }
.stat span { color: var(--text-3); font-size: 13px; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.meter span { display: block; height: 100%; background: var(--brand); }
.meter span.warn { background: var(--warn); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .mainnav { display: none; }
  :root { --tabbar-h: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-3); font-size: 11px; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current] { color: var(--brand-ink); }
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .toc-side { position: static; max-height: none; order: -1; }
}
@media (max-width: 860px) {
  .two-col, .feed-layout, .editor-grid, .admin { grid-template-columns: minmax(0, 1fr); }
  .feed-side, .admin-nav, .editor-bar { position: static; }
  .feed-side { order: -1; }
  .feed-side .rules { display: none; }
  .admin-nav nav { flex-direction: row; overflow-x: auto; }
  .admin-nav button { white-space: nowrap; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 54px; }
  body { font-size: 15px; }
  body { --page-pad: 10px; }
  .container { padding: 14px var(--page-pad) 28px; }
  .topbar-inner { gap: 8px; }
  .brand span { display: none; }
  .top-actions { gap: 0; }
  .icon-btn { width: 36px; height: 36px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .post { padding: 12px; }
  .post-body, .post-images, .post-link, .comments { margin-left: 0; }
  .post-actions { margin-left: -8px; justify-content: space-between; }
  .post-images.n3 { grid-template-columns: 1fr 1fr; }
  .article { padding: 18px 16px; } .article h1 { font-size: 23px; }
  .article-comments { padding: 14px 16px; }
  .profile-head { flex-direction: column; align-items: center; text-align: center; }
  .profile-info h1, .profile-meta, .profile-stats, .profile-actions { justify-content: center; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .admin-table thead { display: none; }
  .admin-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .admin-table td { display: block; border: 0; padding: 3px 0; }
  .admin-table td::before { content: attr(data-label) "："; color: var(--text-3); font-size: 12px; }
  .cell-text { max-width: 100%; }
}

/* ---------- brand mark ---------- */
.brand-mark-bg { fill: var(--brand); }
.brand-mark-line { stroke: var(--on-brand); }
.brand-mark-dot { fill: var(--on-brand); }

/* ---------- appearance menu ---------- */
.theme-panel { min-width: 236px; padding: 12px; }
.menu-label { font-size: 12px; color: var(--text-3); font-weight: 600; margin: 0 2px 6px; }
.seg + .menu-label { margin-top: 12px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--radius-sm); }
.menu-panel .seg button { flex-direction: column; justify-content: center; gap: 4px; padding: 8px 4px; font-size: 12px; text-align: center; color: var(--text-2); border-radius: 6px; transition: background-color .15s, color .15s, transform .15s var(--ease); }
.menu-panel .seg button:hover { background: var(--surface-3); }
.menu-panel .seg button:active { transform: scale(.96); }
.menu-panel .seg button[aria-checked="true"] { background: var(--selected); color: var(--brand-ink); font-weight: 700; box-shadow: var(--shadow-lift); }
.swatch { width: 20px; height: 20px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-strong); }
.swatch-blue { background: var(--sky); } .swatch-pink { background: var(--sakura); }
[aria-checked="true"] > .swatch { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }

/* ---------- home ---------- */
/* A slim strip in the page flow, directly under the navigation bar: it pushes the content down by its own height and never covers it. */
.announce-bar { height: 36px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; overflow: hidden; animation: announce-in .2s var(--ease); transition: height .2s var(--ease), opacity .2s var(--ease); }
.announce-bar.closing { height: 0; opacity: 0; }
.announce-inner { display: flex; align-items: center; gap: 8px; height: 36px; max-width: var(--page-w); margin: 0 auto; padding: 0 calc(var(--page-pad) - 6px) 0 var(--page-pad); }
@keyframes announce-in { from { height: 0; opacity: 0; } to { height: 36px; opacity: 1; } }
.announce-icon { display: inline-flex; flex: none; }
.announce-icon .icon { width: 16px; height: 16px; }
.announce-open { flex: 1; min-width: 0; border: 0; background: none; padding: 0; color: var(--text); font-size: 13px; font-weight: 500; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.announce-open:hover { color: var(--brand-ink); }
.announce-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--text-2); display: grid; place-items: center; }
.announce-close:hover { background: var(--surface); color: var(--text); }
.announce-close .icon { width: 16px; height: 16px; }
.announce-dialog { color: var(--text); }
.announce-dialog section + section { padding-top: 14px; border-top: 1px solid var(--line); }
.announce-dialog section > * + * { margin-top: 8px; }
.announce-count { flex: none; padding: 0 8px; border-radius: var(--pill); background: var(--surface); color: var(--text-2); font-size: 12px; line-height: 20px; }
.home-head { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; margin-bottom: 8px; }
.home-head h1 { font-size: 26px; letter-spacing: .5px; }
.home-head .promise { font-size: 14px; }
.topic-tabs { display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; }
.topic-tabs::-webkit-scrollbar { display: none; }
.topic-tabs a { position: relative; flex: none; padding: 8px 0 11px; color: var(--text-2); font-size: 16px; font-weight: 600; border-radius: var(--radius-sm); transition: color .15s, transform .15s var(--ease); }
.topic-tabs a:hover { color: var(--brand-ink); text-decoration: none; }
.topic-tabs a:active { transform: scale(.96); }
.topic-tabs a::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: var(--brand); transform: scaleX(0); transition: transform .22s var(--ease); }
.topic-tabs a:hover::after { transform: scaleX(.5); }
.topic-tabs a[aria-current] { color: var(--brand-ink); font-size: 17px; }
.topic-tabs a[aria-current]::after { transform: scaleX(1); }
.level-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 12px 0 20px; }
.level-chips::-webkit-scrollbar { display: none; }
.level-chips .chip { flex: none; height: 30px; padding: 0 14px; border-radius: var(--pill); transition: background-color .15s, color .15s, border-color .15s, transform .15s var(--ease); }
.level-chips .chip-line { background: var(--surface); border-color: transparent; color: var(--text-2); }
.level-chips .chip-line:hover { color: var(--brand-ink); }
.level-chips .chip:active { transform: scale(.95); }
.home-grid { gap: 20px 16px; }
.home-more { display: flex; justify-content: center; gap: 20px; margin-top: 18px; }
.home-more .more-link:hover { color: var(--brand-ink); }

/* ---------- cover cards ---------- */
.article-card { display: flex; flex-direction: column; background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
.article-card .cover { border-radius: var(--radius); transition: box-shadow .2s, transform .2s var(--ease); }
.article-card:hover .cover { box-shadow: var(--shadow-lift); transform: translateY(-3px); }
.cover img { transition: transform .4s var(--ease); }
.article-card:hover .cover img { transform: scale(1.05); }
.cover-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; padding: 22px 10px 7px; background: linear-gradient(var(--cover-shade-0), var(--cover-shade)); color: var(--on-media); font-size: 12px; pointer-events: none; }
.cover-stat { display: inline-flex; align-items: center; gap: 4px; }
.cover-stat .icon { width: 15px; height: 15px; }
.cover-badge { position: absolute; left: 8px; top: 8px; padding: 2px 9px; border-radius: var(--pill); background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700; }
.cover-play { position: absolute; inset: 0; display: grid; place-items: center; color: var(--on-media); opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s var(--ease); pointer-events: none; }
.cover-play .icon { width: 44px; height: 44px; fill: currentColor; stroke-width: 0; padding: 11px; border-radius: 50%; background: var(--cover-shade); }
.article-card:hover .cover-play { opacity: 1; transform: none; }
.article-card .card-body { padding: 9px 2px 2px; gap: 5px; }
.article-card .meta { gap: 8px; }

/* ---------- motion ---------- */
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes like-pop { 0% { transform: scale(1); } 35% { transform: scale(1.38); } 65% { transform: scale(.9); } 100% { transform: scale(1); } }
@keyframes like-ring { from { opacity: .55; transform: scale(.4); } to { opacity: 0; transform: scale(1.9); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.home-grid > *, .grid-cards > * { animation: card-in .36s var(--ease) both; }
.grid-cards > :nth-child(2) { animation-delay: 30ms; } .grid-cards > :nth-child(3) { animation-delay: 60ms; } .grid-cards > :nth-child(4) { animation-delay: 90ms; }
.grid-cards > :nth-child(5) { animation-delay: 120ms; } .grid-cards > :nth-child(6) { animation-delay: 150ms; } .grid-cards > :nth-child(7) { animation-delay: 180ms; }
.grid-cards > :nth-child(n + 8) { animation-delay: 210ms; }
.menu[open] > .menu-panel { animation: menu-in .16s var(--ease); transform-origin: top right; }
.btn:active, .icon-btn:active, .act:active { transform: scale(.96); }
.act[data-act="like"] { position: relative; }
.act[data-act="like"].pop .icon { animation: like-pop .42s var(--ease); }
.act[data-act="like"].pop::after { content: ""; position: absolute; left: 10px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; border: 2px solid var(--brand); animation: like-ring .5s ease-out both; pointer-events: none; }
/* Same-origin page changes (topic and level filters) cross-fade where the browser supports it. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

@media (max-width: 640px) {
  .home-head h1 { font-size: 21px; }
  .home-head .promise { font-size: 13px; }
  .topic-tabs { gap: 22px; }
  .topic-tabs a { padding: 7px 0 10px; font-size: 15px; }
  .level-chips { margin: 10px 0 14px; }
  .topic-tabs a[aria-current] { font-size: 16px; }
  .home-grid { gap: 14px 10px; }
  .article-card .card-body h3 { font-size: 14px; }
  .home-grid .meta time { display: none; }
  .theme-panel { position: fixed; left: 10px; right: 10px; top: calc(var(--topbar-h) + 6px); min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
}
@media print { .topbar, .tabbar, .footer, .toc-side, .article-actions, .article-comments, .reading-progress, .announce-bar { display: none !important; } body { background: var(--surface); } .card { border: 0; box-shadow: none; } }
.hero-search { display: flex; gap: 8px; max-width: 560px; }
.hero-search input { flex: 1; }

/* ---------- feed, profile, resources: same lively language as the home page ---------- */
/* Tabs: sliding accent indicator instead of a hard underline. */
.tabs { gap: 2px; border-bottom: 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { position: relative; flex: none; padding: 8px 14px 11px; border-bottom: 0; border-radius: var(--radius-sm); transition: color .15s, transform .15s var(--ease); }
.tabs a:active, .tabs button:active { transform: scale(.96); }
.tabs a::after, .tabs button::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: var(--brand); transform: scaleX(0); transition: transform .22s var(--ease); }
.tabs a:hover::after, .tabs button:hover::after { transform: scaleX(.5); }
.tabs [aria-current] { color: var(--brand-ink); border-bottom-color: transparent; }
.tabs [aria-current]::after { transform: scaleX(1); }
.tabs .has-content::after { content: ""; margin-left: -11px; }
.tabs .has-content::before { content: ""; position: absolute; right: 6px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }

/* Feed */
.feed-main > .post, [data-post-list] > .post, .user-list > *, .grid-resources > *, .grid-software > *, .grid-links > * { animation: card-in .34s var(--ease) both; }
.feed-main > .post:nth-of-type(2), [data-post-list] > .post:nth-of-type(2), .grid-resources > :nth-child(2) { animation-delay: 40ms; }
.feed-main > .post:nth-of-type(3), [data-post-list] > .post:nth-of-type(3), .grid-resources > :nth-child(3) { animation-delay: 80ms; }
.feed-main > .post:nth-of-type(n + 4), [data-post-list] > .post:nth-of-type(n + 4), .grid-resources > :nth-child(n + 4) { animation-delay: 120ms; }
.post { transition: box-shadow .2s; }
.post:hover { box-shadow: var(--shadow-lift); }
.post-who .name:hover { color: var(--brand-ink); text-decoration: none; }
.post-link { transition: background-color .15s; }
.post-link:hover { background: var(--brand-soft); text-decoration: none; }
.post-images img { transition: transform .3s var(--ease); }
.post-images a:hover img, .post-images img:hover { transform: scale(1.02); }
.act { transition: color .15s, background-color .15s, transform .15s var(--ease); }
.act:hover { background: var(--brand-soft); }
.composer { transition: box-shadow .2s; }
.composer:focus-within { box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-lift); }
.composer-main textarea { border-radius: var(--radius); transition: background-color .15s, border-color .15s; }
.center-card { padding: 22px 20px; }
.empty { border: 0; background: none; }
.empty .icon { color: var(--line-strong); width: 40px; height: 40px; }

/* Profile: accent banner with the avatar sitting on its edge */
.profile-head { position: relative; flex-wrap: wrap; padding: 84px 24px 20px; overflow: hidden; }
.profile-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 68px; background: linear-gradient(100deg, var(--brand-soft), var(--surface-2)); }
.profile-head::after { content: ""; position: absolute; right: 28px; top: -26px; width: 120px; height: 120px; border-radius: 50%; background: var(--brand); opacity: .14; }
.profile-head > * { position: relative; }
.profile-head > .avatar { margin-top: -52px; box-shadow: 0 0 0 4px var(--surface); }
.profile-stats { gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.profile-stats a, .profile-stats span { padding: 5px 12px; border-radius: var(--pill); background: var(--surface-2); transition: background-color .15s, color .15s; }
.profile-stats a:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.profile-stats a:hover strong { color: var(--brand-ink); }
.profile-stats strong { font-size: 15px; }
.user-row { border-color: transparent; background: none; border-radius: var(--radius-sm); transition: background-color .15s; }
.user-row:hover { background: var(--surface-2); border-color: transparent; }
.user-list { padding: 6px; gap: 2px; }

/* Resources */
.page-head.row { align-items: flex-end; }
.page-links { display: flex; gap: 14px; font-size: 14px; }
.cat-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chips .chip { flex: none; height: 30px; padding: 0 14px; border-radius: var(--pill); transition: background-color .15s, color .15s, transform .15s var(--ease); }
.cat-chips .chip-line { background: var(--surface); border-color: transparent; color: var(--text-2); }
.cat-chips .chip-line:hover { color: var(--brand-ink); }
.cat-chips .chip:active { transform: scale(.95); }
.filter-bar { background: none; box-shadow: none; padding: 0; gap: 8px; }
.filter-bar input, .filter-bar select { border-radius: var(--pill) !important; border-color: transparent !important; background-color: var(--surface) !important; padding-left: 16px !important; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--brand) !important; }
.filter-bar > select { flex: 0 1 170px; }
.resource-card { position: relative; padding: 16px 16px 10px; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.resource-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); transform: scaleY(0); transform-origin: top; transition: transform .22s var(--ease); }
.resource-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.resource-card:hover::before { transform: scaleY(1); }
.resource-card h3 { font-size: 16px; }
.link-card, .software-card { transition: transform .2s var(--ease), box-shadow .2s, border-color .15s; }
.link-card:hover, .software-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: transparent; }
.act[aria-pressed="true"] .icon { animation: none; }
.act.pop .icon, [data-fav-type].pop .icon { animation: like-pop .42s var(--ease); }

@media (max-width: 640px) {
  .profile-head { padding: 76px 16px 16px; }
  .profile-head > .avatar { margin-top: -48px; }
  .profile-stats { justify-content: center; }
  .filter-bar > select { flex: 1 1 120px; }
  .page-head.row { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- sign-in, password and verification ---------- */
.pw-field { position: relative; display: block; }
.pw-field > input { width: 100%; padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; width: 36px; height: 36px; margin-top: -18px; border: 0; border-radius: 50%; background: none; color: var(--text-3); display: grid; place-items: center; transition: color .15s, background-color .15s, transform .15s var(--ease); }
.pw-toggle:hover { color: var(--brand-ink); background: var(--brand-soft); }
.pw-toggle:active { transform: scale(.9); }
.pw-toggle[aria-pressed="true"] { color: var(--brand-ink); }
.pw-toggle .icon { width: 20px; height: 20px; }
.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: -4px; animation: fade-up .2s var(--ease); }
.pw-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; }
.pw-bars i { height: 4px; border-radius: 2px; background: var(--line-strong); transition: background-color .2s var(--ease), transform .2s var(--ease); transform-origin: left; }
.pw-label { flex: none; min-width: 5em; text-align: right; font-size: 12px; font-weight: 600; color: var(--text-3); transition: color .2s; }
.pw-meter[data-score="0"] .pw-label, .pw-meter[data-score="1"] .pw-label { color: var(--danger); }
.pw-meter[data-score="1"] i:nth-child(-n + 1) { background: var(--danger); }
.pw-meter[data-score="2"] i:nth-child(-n + 2) { background: var(--warn); }
.pw-meter[data-score="2"] .pw-label { color: var(--warn); }
.pw-meter[data-score="3"] i:nth-child(-n + 3) { background: var(--brand); }
.pw-meter[data-score="3"] .pw-label { color: var(--brand-ink); }
.pw-meter[data-score="4"] i { background: var(--ok); }
.pw-meter[data-score="4"] .pw-label { color: var(--ok); }
.form-ok.pop-in:not([hidden]) { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; animation: pop-in .28s var(--ease); }
.form-ok .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.form-error:not([hidden]) { animation: fade-up .2s var(--ease); }
.verify-notice a { font-weight: 700; margin-left: 6px; }

.verify-card { position: relative; text-align: center; overflow: hidden; }
.verify-card > * + * { margin-top: 12px; }
.verify-badge { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; animation: pop-in .32s var(--ease); }
.verify-badge svg { width: 34px; height: 34px; }
.verify-text { color: var(--text-2); font-size: 14px; }
.verify-text strong { color: var(--text); word-break: break-all; }
.code-input { width: 100%; height: 60px; padding: 0 0 0 .5em; text-align: center; font: 700 30px/1 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .5em; border-radius: var(--radius); caret-color: var(--brand); }
.code-input::placeholder { color: var(--line-strong); font-weight: 400; }
.code-input[aria-invalid="true"] { border-color: var(--danger); }
.code-input.shake { animation: shake .36s var(--ease); }
.verify-expiry { font-variant-numeric: tabular-nums; transition: color .2s; }
.verify-expiry.is-ending { color: var(--warn); }
.verify-expiry.is-expired { color: var(--danger); }
.verify-resend { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 0; border-radius: var(--pill); background: none; color: var(--brand-ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background-color .15s, color .15s, transform .15s var(--ease); }
.verify-resend:hover:not(:disabled) { background: var(--brand-soft); }
.verify-resend:active:not(:disabled) { transform: scale(.96); }
.verify-resend:disabled { color: var(--text-3); cursor: default; }
.verify-resend .ring { width: 18px; height: 18px; transform: rotate(-90deg); display: none; }
.verify-resend.waiting .ring { display: block; }
.ring circle { fill: none; stroke-width: 2.5; }
.ring-bg { stroke: var(--line-strong); }
.ring-fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.verify-done { position: absolute; inset: 0; margin: 0; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; font-size: 18px; font-weight: 700; animation: fade-in .2s var(--ease); }
.verify-done[hidden] { display: none; }
.verify-done svg { width: 84px; height: 84px; fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.done-ring { stroke: var(--brand); stroke-dasharray: 176; stroke-dashoffset: 176; animation: draw .45s var(--ease) forwards; transform: rotate(-90deg); transform-origin: center; }
.done-check { stroke: var(--brand); stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .3s var(--ease) .35s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- simplified home and resources ---------- */
/* Two sections on the home page, generous space between them, nothing decorative. */
.home-head { margin: 16px 0 36px; }
.home-head h1 { font-size: 32px; letter-spacing: 0; }
.home-section + .home-section, .res-section { margin-top: 56px; }
.home-section .section-head, .res-section .section-head { margin-bottom: 18px; }
.home-section .section-head h2, .res-section .section-head h2 { font-size: 20px; }
.home-section .more-link { transition: color .15s; }
.home-section .more-link:hover { color: var(--brand-ink); text-decoration: none; }
.home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 20px; }
.home-grid .card-body { padding: 12px 2px 0; gap: 6px; }
.home-grid .card-body h3 { font-size: 16px; line-height: 1.45; }
.home-grid .meta { font-size: 13px; }
.home-section .post { box-shadow: none; }
.topic-tabs + .res-section { margin-top: 28px; }
.res-section .filter-bar { margin-bottom: 16px; }
@media (max-width: 1080px) {
  .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .home-head { margin: 8px 0 24px; }
  .home-head h1 { font-size: 24px; }
  .home-section + .home-section, .res-section { margin-top: 40px; }
  .home-section .section-head h2, .res-section .section-head h2 { font-size: 18px; }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .home-grid .card-body h3 { font-size: 14px; }
}

/* ---------- official (verified) accounts ---------- */
.official-badge { display: inline-flex; flex: none; width: 1em; height: 1em; margin-left: 4px; vertical-align: -0.12em; color: var(--brand); }
.official-badge svg { width: 100%; height: 100%; }
.official-badge .seal { fill: currentColor; }
.official-badge .tick { fill: none; stroke: var(--on-brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.official-badge-text { align-items: center; justify-content: center; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: .7em; font-weight: 700; line-height: 1; }
.profile-info h1 .official-badge { font-size: .85em; margin-left: 0; }
.official-chip { font-size: 12px; font-weight: 600; }
