:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --ink: #232336;
  --muted: #626578;
  --faint: #74788a;
  --line: #e0e2ea;
  --brand: #4c45be;
  --brand-soft: #edecfb;
  --sans: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100vh;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  overflow-wrap: anywhere;
}
h1 {
  font: 600 clamp(30px, 4.3vw, 54px) / 1.2 var(--sans);
  letter-spacing: -0.045em;
}
h2 {
  font: 600 24px/1.35 var(--sans);
  letter-spacing: -0.025em;
}
h3 {
  font-size: 18px;
}
a {
  color: inherit;
}
svg {
  width: 18px;
  height: 18px;
  flex: none;
  vertical-align: middle;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
:focus-visible {
  outline: 3px solid #635ada;
  outline-offset: 3px;
}
main:focus {
  outline: none;
}
.skip {
  position: fixed;
  z-index: 50;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 9px 16px;
  background: var(--surface);
}
.skip:focus {
  transform: none;
}
#topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bar {
  max-width: 1248px;
  padding: 0 40px;
  height: 70px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--brand);
}
.bar-actions,
.bar-label,
.btn,
.form-line,
.reader-meta,
.reader-meta a,
.backlink,
.tab,
.panel-title,
.pass-tools {
  display: flex;
  align-items: center;
}
.bar-actions {
  gap: 18px;
}
.bar-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.bar-actions .link {
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding-left: 15px;
}
.loading {
  text-align: center;
  color: var(--muted);
  padding: 18vh 20px;
}
.btn {
  display: inline-flex;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 560;
  font-size: 14px;
  line-height: 1.35;
  padding: 10px 16px;
  text-decoration: none;
  background: none;
  color: var(--ink);
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.btn.primary:hover {
  background: #37329a;
}
.btn.secondary {
  background: var(--surface);
  border-color: #d8dae4;
}
.btn.secondary:hover,
.btn.quiet:hover,
.btn.link:hover {
  background: #efeff7;
}
.btn.quiet,
.btn.link {
  color: var(--brand);
}
.btn.compact {
  padding: 6px 10px;
  min-height: 34px;
  font-size: 13px;
}
.btn.full {
  width: 100%;
  justify-content: space-between;
}
.subtitle,
.help,
.field small,
.empty p,
.comment-empty {
  color: var(--muted);
}
.subtitle {
  margin-top: 10px;
  line-height: 1.7;
}
.help,
.field small {
  font-size: 13px;
  line-height: 1.7;
}
.error {
  color: #9d3028;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.error:not(:empty) {
  border-left: 3px solid #ba4a3b;
  padding: 8px 12px;
  background: #fcf1ed;
  border-radius: 2px;
}
.error:empty {
  display: none;
}
#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 8px);
  transition:
    opacity 0.15s,
    transform 0.15s;
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  padding: 9px 18px;
  border-radius: 6px;
  z-index: 20;
  font-size: 14px;
  text-align: center;
}
#toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.gate {
  max-width: 790px;
  margin: clamp(64px, 15vh, 145px) auto 40px;
  display: grid;
  grid-template-columns: 33% 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 15px 38px -30px #34412e;
}
.gate-card {
  padding: clamp(32px, 5vw, 60px);
  align-self: center;
}
.gate h1 {
  font-size: clamp(29px, 3.4vw, 39px);
}
.gate .subtitle {
  margin-top: 12px;
}
.gate .stack {
  margin-top: 30px;
}
.gate.simple {
  max-width: 520px;
  display: block;
}
.gate.simple .emblem {
  margin-bottom: 18px;
}
.stack,
.field {
  display: grid;
}
.stack {
  gap: 18px;
}
.field {
  gap: 7px;
  min-width: 0;
}
.field-name {
  font-weight: 600;
  font-size: 14px;
}
input,
textarea,
select {
  display: block;
  max-width: 100%;
  width: 100%;
  border: 1px solid #d4d6e2;
  background: white;
  border-radius: 5px;
  padding: 10px 12px;
  line-height: 1.5;
}
input[readonly] {
  background: #f5f6f9;
  color: var(--muted);
}
textarea {
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: #73778b;
}
.pw-control,
.copyline {
  display: flex;
  gap: 6px;
  align-items: center;
}
.pw-control {
  border: 1px solid #d4d6e2;
  border-radius: 5px;
  background: white;
  padding: 0 5px 0 0;
}
.pw-control input {
  min-width: 0;
  border: 0;
  background: transparent;
}
.pw-control .btn {
  flex: none;
}
.workspace {
  max-width: 1170px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 10px 0 32px;
}
.page-heading .subtitle {
  margin-top: 8px;
}
.tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0 15px;
}
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  background: #edeef3;
  border-radius: 7px;
  padding: 3px;
}
.btn.tab {
  color: var(--muted);
  border: 0;
  font-size: 13px;
  min-height: 30px;
  border-radius: 4px;
  padding: 5px 14px;
}
.btn.tab[aria-pressed='true'] {
  color: var(--brand);
  background: var(--surface);
  box-shadow: 0 1px 3px #24243915;
}
.search {
  width: min(290px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
}
.search input {
  min-width: 0;
  border: 0;
  padding: 8px 0;
  background: transparent;
  font-size: 14px;
}
.case-list {
  display: grid;
  gap: 10px;
}




.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #dbdde7;
  border-radius: 99px;
  background: #f3f3f7;
  color: #5c6070;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  white-space: nowrap;
}
.status:before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status.published {
  color: #385c3f;
  background: #edf3e9;
  border-color: #d7e2ce;
}

.case-link {
  text-decoration: none;
}
.case-link:hover,
.backlink:hover,
.reader-meta a:hover {
  text-decoration: underline;
}

.emblem,
.avatar {
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
}


.emblem {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}


.reader-meta svg {
  width: 15px;
  height: 15px;
}
.empty {
  padding: 54px 20px;
  border: 1px dashed #d2d5e2;
  border-radius: 8px;
  text-align: center;
  background: #fafafd;
}
.empty .emblem {
  margin: 0 auto 13px;
}
.empty p {
  margin: 7px 0 0;
  font-size: 14px;
}
.more {
  text-align: center;
  margin-top: 16px;
}
.backlink,
.reader-meta a {
  display: inline-flex;
  gap: 7px;
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
}
.backlink {
  margin-bottom: 12px;
}
.backlink svg {
  width: 15px;
  height: 15px;
}
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(245px, 29%);
  gap: 20px;
  align-items: start;
}
.editor-left,
.editor-right {
  display: grid;
  gap: 17px;
  min-width: 0;
}
.panel {
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.panel h2,
.discussion h2,
.copy-dialog h2 {
  font-size: 22px;
}
.panel-title {
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title + div,
.panel-title + .help,
.panel .field,
.share .copyline,
.panel .help,
.pass-tools {
  margin-top: 12px;
}
.panel.stack .field {
  margin: 0;
}
.panel .tabs .btn {
  padding: 5px 10px;
}
.format-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.format-bar .field {
  margin: 0;
}
.format-bar select {
  font-size: 14px;
}
.file-picker {
  display: none;
}
.body-input {
  font:
    14px/1.7 ui-monospace,
    Menlo,
    'PingFang SC',
    monospace;
  tab-size: 2;
}
.editor-right .panel {
  padding: 18px;
}
.copyline input {
  font-size: 12px;
  padding: 8px;
  min-width: 0;
}
.copyline .btn {
  flex: none;
}
.pass-tools {
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}
.pass-tools .btn {
  padding: 4px 7px;
}
.save-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.editor-form > .error:not(:empty) {
  margin-top: 14px;
}
.preview-head {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.copy-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 24px;
  width: min(420px, 90vw);
}
.copy-dialog::backdrop {
  background: #22223a55;
}
.copy-dialog textarea,
.copy-dialog .btn {
  margin-top: 12px;
}
.reader {
  max-width: 960px;
  margin: auto;
  padding: 60px 40px 80px;
}
.reader-head {
  padding-bottom: 28px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--brand);
}
.reader-head h1 {
  margin: 10px 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.dek {
  font-size: clamp(16px, 2.1vw, 20px);
  line-height: 1.7;
  color: var(--muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.reader-meta {
  margin-top: 18px;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.reader > .prose {
  max-width: 800px;
}
.prose {
  color: #333544;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.prose p,
.prose ul,
.prose ol,
.prose pre,
.prose blockquote {
  margin: 0 0 1em;
}
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  font-family: var(--sans);
  line-height: 1.45;
  margin: 1.15em 0 0.55em;
  color: var(--ink);
}
.prose h2 {
  font-size: 28px;
}
.prose h3 {
  font-size: 23px;
}
.prose p,
.prose blockquote,
.comment-text p {
  white-space: pre-line;
}
.prose blockquote,
.comment-text blockquote {
  margin-left: 0;
  border-left: 3px solid #827bd2;
  background: #f2f1fb;
  padding: 8px 14px;
  color: #555469;
}
.prose pre {
  overflow: auto;
  padding: 14px;
  background: #f0f0f5;
  border-radius: 5px;
  font-size: 13px;
  line-height: 1.55;
}
.prose code {
  background: #f0f0f5;
  padding: 0.05em 0.2em;
  font-size: 0.9em;
  white-space: pre-wrap;
}
.prose pre code {
  padding: 0;
  white-space: pre;
}
.prose hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}
.anchor-block {
  position: relative;
  padding-right: 36px;
}
.btn.anchor-btn {
  position: absolute;
  right: 0;
  top: 0;
  color: #6c6888;
  min-height: 32px;
  padding: 7px;
  opacity: 0.25;
}
.anchor-block:hover .anchor-btn,
.anchor-btn:focus-visible {
  opacity: 1;
  background: #edebfa;
}
.html-frame {
  display: block;
  width: 100%;
  height: clamp(350px, 68vh, 800px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.html-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.html-toolbar [aria-pressed='true'] {
  color: white;
  background: var(--brand);
}
.discussion {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 15px;
}
.discussion-count {
  font: 500 16px var(--sans);
  color: var(--muted);
}
.discussion h2 {
  margin-bottom: 15px;
}
.comment-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}
.comment-form .field:first-child {
  max-width: 320px;
}
.comment-form .form-line {
  justify-content: flex-end;
}
.anchor-details {
  color: var(--muted);
  font-size: 13px;
}
.anchor-details summary {
  cursor: pointer;
}
.anchor-details .field {
  margin-top: 8px;
}
.comment-row {
  padding: 16px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.avatar {
  border-radius: 50%;
  width: 33px;
  height: 33px;
  flex: none;
  font-size: 13px;
  font-weight: 600;
}
.comment-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.comment-who {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}
.comment-who time,
.comment-empty {
  font-size: 13px;
  color: var(--muted);
}
.comment-text p {
  margin-top: 4px;
}
.comment-text blockquote {
  font-size: 13px;
  margin: 8px 0;
}
.comment-empty {
  padding: 12px 0;
}
@media (max-width: 780px) {
  .bar,
  .workspace,
  .reader {
    padding-left: 24px;
    padding-right: 24px;
  }



  .editor-grid {
    grid-template-columns: 1fr;
  }
  .editor-right {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  .gate {
    margin-left: 22px;
    margin-right: 22px;
  }
  .gate.simple {
    margin-left: auto;
    margin-right: auto;
  }
}
@media (max-width: 560px) {
  .bar {
    height: 57px;
  }
  .bar,
  .workspace,
  .reader {
    padding-left: 16px;
    padding-right: 16px;
  }
  .bar-actions {
    gap: 8px;
  }
  .bar-label {
    font-size: 12px;
  }
  .brand {
    font-size: 17px;
  }
  .workspace,
  .reader {
    padding-top: 26px;
  }
  .page-heading {
    margin-bottom: 22px;
    align-items: center;
    gap: 10px;
  }
  .page-heading .btn {
    padding: 9px 11px;
    white-space: nowrap;
  }
  .tools {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .tools .tabs {
    align-self: flex-start;
  }
  .search {
    width: 100%;
  }




  .gate,
  .gate.simple {
    grid-template-columns: 1fr;
    margin: 32px 16px;
  }
  .gate-card {
    padding: 25px 20px 28px;
  }
  .panel,
  .editor-right .panel {
    padding: 15px;
  }
  .editor-grid,
  .editor-left,
  .editor-right {
    gap: 12px;
  }
  .panel-title .tabs {
    margin: 0;
  }
  .preview .prose h2 {
    font-size: 22px;
  }
  .reader-head {
    padding-bottom: 18px;
  }
  .reader-meta {
    margin-top: 12px;
  }
  .discussion {
    margin-top: 28px;
  }
  .comment-form {
    padding: 13px;
  }
  .btn.anchor-btn {
    opacity: 0.7;
  }
  .comment-who {
    gap: 5px;
  }
  .comment-row {
    gap: 8px;
  }
  .share .copyline .btn {
    padding: 6px;
  }
  .copyline .btn svg {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.activity-actions, .activity-stats { display: flex; align-items: center; gap: 12px; }
.activity-page h1 { font-size: clamp(30px, 4vw, 44px); }
.activity-kpi-heading { font-size: 15px; margin: 0 0 10px; }
.activity-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.activity-stat { display: grid; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 17px 20px; border-radius: 10px; }
.activity-stat span, .activity-muted { color: var(--muted); }
.activity-stat strong { font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.activity-panel { margin-top: 20px; }
.activity-panel .panel-title { margin: 0 0 5px; }
.activity-panel h2 { font-size: 19px; }
.activity-scroll { overflow-x: auto; margin: 18px 0 6px; }
.activity-panel table { width: 100%; text-align: left; border-collapse: collapse; font-size: 13px; }
.activity-panel th, .activity-panel td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.activity-panel th { background: #f6f6fa; font-weight: 550; color: var(--muted); white-space: nowrap; }
.activity-device { display: grid; gap: 3px; }
.activity-device small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.activity-kind { display: inline-block; white-space: nowrap; padding: 2px 7px; border-radius: 4px; background: #f0f1f5; }
.kind-read { background: #e4f1e9; color: #285940; }
.kind-click { background: var(--brand-soft); color: var(--brand); }
.visit-link { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.activity-panel .visit-link { font-family: ui-monospace, monospace; }
.activity-empty { padding: 20px 0; color: var(--muted); }
@media (max-width: 640px) {
  .activity-actions { flex-wrap: wrap; gap: 4px; }
  .activity-page .page-heading { align-items: flex-start; flex-direction: column; }
  .activity-stats { gap: 6px; }
  .activity-stat { padding: 12px; font-size: 13px; }
  .activity-stat strong { font-size: 24px; }
  .activity-panel table { min-width: 690px; }
}
