/* ======================================================
   墨记 · 富文本 Markdown 编辑器
   ====================================================== */

:root {
  --canvas: #f3f3ef;
  --canvas-dot: rgba(51, 52, 44, 0.075);
  --paper: #fffefa;
  --surface: #fdfdfa;
  --surface-2: #f7f7f1;
  --ink: #292923;
  --ink-soft: #515149;
  --ink-faint: #77766c;
  --muted: #95948a;
  --line: #e9e8e1;
  --line-strong: #dcdad1;
  --accent: #2f6f5b;
  --accent-hover: #275d4c;
  --accent-strong: #245744;
  --accent-soft: #eaf3ef;
  --accent-faint: #f4f8f5;
  --accent-line: #c8ded4;
  --danger: #a84842;
  --danger-soft: #fbefee;
  --warning: #ad7424;
  --shadow-xs: 0 1px 2px rgba(35, 36, 29, 0.06);
  --shadow-menu: 0 16px 44px -12px rgba(35, 36, 29, 0.2), 0 3px 10px rgba(35, 36, 29, 0.06);
  --shadow-modal: 0 32px 90px -20px rgba(27, 28, 23, 0.38), 0 6px 22px rgba(27, 28, 23, 0.08);
  --font-ui: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-editor: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --topbar-h: 62px;
  --statusbar-h: 34px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[contenteditable]:focus-visible {
  outline: 2px solid rgba(47, 111, 91, 0.5);
  outline-offset: 2px;
}

::selection {
  background: rgba(47, 111, 91, 0.2);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.app {
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: var(--topbar-h);
  padding: 0 22px;
  background: rgba(250, 250, 247, 0.9);
  border-bottom: 1px solid rgba(226, 225, 216, 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar [data-tip] {
  position: relative;
}

.export-label-short {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

button:disabled {
  cursor: not-allowed;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.45;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.topbar-left {
  gap: 16px;
  min-width: 0;
  flex: 1;
}

.topbar-actions {
  gap: 7px;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  user-select: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #f7fbf7;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.22), transparent 45%),
    linear-gradient(145deg, #397d67 0%, #255744 100%);
  box-shadow: 0 2px 7px rgba(37, 87, 68, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.brand-icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.65;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: 0.08em;
  color: #292a24;
}

.brand-copy span {
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.topbar-sep {
  width: 1px;
  height: 23px;
  background: var(--line-strong);
  flex: 0 0 auto;
}

.title-area {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.doc-title {
  width: clamp(150px, 22vw, 280px);
  min-width: 80px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  text-overflow: ellipsis;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.doc-title:hover {
  border-color: var(--line);
  background: rgba(255, 255, 252, 0.75);
}

.doc-title:focus {
  outline: none;
  border-color: var(--accent-line);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 111, 91, 0.08);
}

.save-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  transition: color 0.2s;
}

.save-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6f9b82;
  box-shadow: 0 0 0 3px rgba(111, 155, 130, 0.11);
  transition: background 0.2s, box-shadow 0.2s;
}

.save-chip.is-saving .save-dot,
.footer-save.is-saving .save-dot {
  background: #bf8c3d;
  box-shadow: 0 0 0 3px rgba(191, 140, 61, 0.13);
  animation: savePulse 1.1s ease-in-out infinite;
}

.save-chip.is-saving,
.footer-save.is-saving {
  color: var(--warning);
}

.save-chip.is-error .save-dot,
.footer-save.is-error .save-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(168, 72, 66, 0.11);
}

.save-chip.is-error,
.footer-save.is-error {
  color: var(--danger);
}

@keyframes savePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- 通用按钮 ---------- */

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  color: var(--ink);
  background: #efefe9;
}

.icon-btn.subtle {
  color: #8b8a80;
}

.ghost-btn,
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 35px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s, box-shadow 0.16s, transform 0.12s;
}

.ghost-btn {
  color: var(--ink-soft);
  background: #fffefb;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.ghost-btn:hover {
  color: var(--ink);
  border-color: #cbc9be;
  background: #fff;
}

.primary-btn {
  color: #f8fbf8;
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 5px rgba(47, 111, 91, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.primary-btn .icon {
  width: 15px;
  height: 15px;
}

.primary-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 11px rgba(47, 111, 91, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 2px 5px rgba(168, 72, 66, 0.16);
}

.primary-btn.danger:hover {
  background: #963d38;
  border-color: #963d38;
}

.secondary-btn {
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line-strong);
}

.secondary-btn:hover {
  color: var(--ink);
  border-color: #cac8bd;
  background: #fcfcf8;
}

.secondary-btn .icon {
  width: 15px;
  height: 15px;
}

#exportBtn {
  height: 36px;
  padding: 0 13px;
}

/* ---------- 工具栏 ---------- */

.toolbar-shell {
  position: sticky;
  top: var(--topbar-h);
  z-index: 50;
  background: rgba(253, 253, 249, 0.93);
  border-bottom: 1px solid rgba(226, 225, 216, 0.92);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 52px;
  padding: 7px 20px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 1px;
}

.tool-sep {
  width: 1px;
  height: 21px;
  margin: 0 7px;
  background: var(--line);
  flex: 0 0 auto;
}

.tool-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #4f4f46;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.14s, background 0.14s, box-shadow 0.14s;
}

.tool-btn .icon {
  width: 17px;
  height: 17px;
  stroke-width: 1.75;
}

.tool-btn:hover {
  color: var(--ink);
  background: #efefe8;
}

.tool-btn[aria-pressed="true"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 91, 0.08);
}

.tool-btn[aria-pressed="true"]:hover {
  background: #e3efe9;
}

.tool-btn.is-disabled,
.tool-btn:disabled {
  opacity: 0.33;
  pointer-events: none;
}

.toolbar-end {
  margin-left: auto;
}

.block-picker,
.insert-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  color: var(--ink-soft);
  background: #fbfbf7;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 520;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.block-picker {
  min-width: 96px;
}

.block-picker:hover,
.insert-btn:hover {
  color: var(--ink);
  background: #fff;
  border-color: var(--line-strong);
}

.block-picker .icon,
.insert-btn .icon {
  width: 15px;
  height: 15px;
  color: #85847a;
}

.block-picker .chevron,
.insert-btn .chevron {
  width: 12px;
  height: 12px;
  margin-left: 1px;
  stroke-width: 2;
  transition: transform 0.16s ease;
}

.block-picker[aria-expanded="true"],
.insert-btn[aria-expanded="true"] {
  background: #fff;
  border-color: var(--accent-line);
  color: var(--accent-strong);
}

.block-picker[aria-expanded="true"] .chevron,
.insert-btn[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.block-picker-icon {
  display: grid;
  place-items: center;
}

#blockLabel {
  min-width: 32px;
  text-align: left;
}

.color-btn {
  overflow: hidden;
}

.tool-swatch {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 15px;
  height: 2.5px;
  border-radius: 99px;
  background: #c94f7c;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: background 0.15s;
}

.tool-swatch.highlight-swatch {
  background: #fde68a;
}

/* 工具提示 */
@media (hover: hover) and (min-width: 760px) {
  .toolbar [data-tip]::after,
  .topbar [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 240;
    padding: 5px 7px;
    color: #f7f6f0;
    background: #2c2d26;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 450;
    line-height: 1.25;
    letter-spacing: 0.01em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(30, 31, 25, 0.18);
    transform: translate(-50%, -3px);
    transition: opacity 0.12s ease 0.3s, transform 0.12s ease 0.3s;
  }

  .toolbar [data-tip]::before,
  .topbar [data-tip]::before {
    content: "";
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    z-index: 241;
    width: 7px;
    height: 7px;
    background: #2c2d26;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -3px) rotate(45deg);
    transition: opacity 0.12s ease 0.3s, transform 0.12s ease 0.3s;
  }

  .toolbar [data-tip]:hover::after,
  .toolbar [data-tip]:hover::before,
  .topbar [data-tip]:hover::after,
  .topbar [data-tip]:hover::before {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  .toolbar [data-tip]:hover::before,
  .topbar [data-tip]:hover::before {
    transform: translate(-50%, 0) rotate(45deg);
  }

  .toolbar [data-tip][aria-expanded="true"]::after,
  .toolbar [data-tip][aria-expanded="true"]::before {
    display: none;
  }

  .topbar-actions [data-tip]::after {
    left: auto;
    right: 0;
    transform: translateY(-3px);
  }

  .topbar-actions [data-tip]::before {
    left: auto;
    right: 12px;
    transform: translateY(-3px) rotate(45deg);
  }

  .topbar-actions [data-tip]:hover::after {
    transform: translateY(0);
  }

  .topbar-actions [data-tip]:hover::before {
    transform: translateY(0) rotate(45deg);
  }
}

/* ---------- 下拉菜单 ---------- */

.menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 180;
  padding: 6px;
  background: #fffefa;
  border: 1px solid rgba(221, 219, 210, 0.95);
  border-radius: 11px;
  box-shadow: var(--shadow-menu);
  animation: popIn 0.14s var(--ease);
}

@keyframes popIn {
  from { transform: translateY(-4px) scale(0.985); }
  to { transform: translateY(0) scale(1); }
}

.block-menu {
  width: 172px;
}

.insert-menu {
  width: 194px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

.menu-item:hover {
  color: var(--ink);
  background: #f4f4ee;
}

.menu-item .icon {
  width: 15px;
  height: 15px;
  color: #7b7a70;
}

.menu-item.is-selected {
  color: var(--accent-strong);
  background: var(--accent-faint);
}

.menu-item.is-selected .icon {
  color: var(--accent);
}

.menu-check {
  width: 14px !important;
  height: 14px !important;
  margin-left: auto;
  color: var(--accent) !important;
  opacity: 0;
}

.menu-item.is-selected .menu-check {
  opacity: 1;
}

.block-sample {
  display: block;
  line-height: 1.35;
}

.sample-p {
  font-size: 12.5px;
  font-weight: 500;
}

.sample-h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sample-h2 {
  font-size: 14.5px;
  font-weight: 700;
}

.sample-h3 {
  font-size: 13px;
  font-weight: 650;
}

.sample-quote {
  padding-left: 8px;
  border-left: 2px solid var(--accent-line);
  color: #67675e;
  font-style: italic;
}

.sample-code {
  color: #4d5a51;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.menu-divider,
.popover-divider {
  height: 1px;
  margin: 5px 5px;
  background: #efeee7;
}

.menu-shortcut {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.mobile-only-item,
.mobile-only-divider {
  display: none;
}

/* ---------- 颜色菜单 ---------- */

.color-popover {
  width: 224px;
  padding: 12px;
}

.popover-title {
  margin-bottom: 10px;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.06em;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.swatch {
  position: relative;
  width: 26px;
  height: 26px;
  padding: 0;
  background: var(--swatch);
  border: 1px solid rgba(35, 36, 29, 0.1);
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.swatch:hover {
  z-index: 1;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(28, 29, 23, 0.16);
}

.swatch.is-current {
  box-shadow: 0 0 0 2px #fffefa, 0 0 0 3.5px var(--accent);
}

.swatch.swatch-light {
  border-color: rgba(35, 36, 29, 0.16);
}

.popover-divider {
  margin: 11px 0;
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 11px;
  cursor: pointer;
}

.custom-color-control {
  display: grid;
  place-items: center;
  width: 27px;
  height: 25px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.custom-color-control input[type="color"] {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.custom-color-control input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.custom-color-control input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

.menu-text-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 6px 4px;
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.menu-text-btn:hover {
  color: var(--ink);
  background: #f5f5ef;
}

.reset-color-dot {
  width: 10px;
  height: 10px;
  border: 1px solid #5d5d53;
  border-radius: 50%;
  background: #26251f;
}

.reset-color-dot.no-highlight {
  position: relative;
  overflow: hidden;
  background: #fff;
}

.reset-color-dot.no-highlight::after {
  content: "";
  position: absolute;
  top: 4px;
  left: -2px;
  width: 14px;
  height: 1px;
  background: #b14c47;
  transform: rotate(-45deg);
}

/* ---------- 编辑区 ---------- */

.workspace {
  min-height: calc(100vh - var(--topbar-h) - 52px - var(--statusbar-h));
  padding: 30px 24px 66px;
  background-color: var(--canvas);
  background-image: radial-gradient(var(--canvas-dot) 0.8px, transparent 0.8px);
  background-position: 0 0;
  background-size: 22px 22px;
}

.paper {
  position: relative;
  width: min(856px, 100%);
  min-height: calc(100vh - 218px);
  margin: 0 auto;
  padding: 62px clamp(42px, 8.2vw, 86px) 90px;
  background: var(--paper);
  border: 1px solid #e7e5dd;
  border-radius: 9px;
  box-shadow:
    0 1px 1px rgba(35, 36, 29, 0.03),
    0 12px 30px -18px rgba(35, 36, 29, 0.14),
    0 34px 80px -48px rgba(35, 36, 29, 0.22);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.paper:focus-within {
  border-color: #dcd9ce;
  box-shadow:
    0 1px 1px rgba(35, 36, 29, 0.03),
    0 14px 34px -18px rgba(35, 36, 29, 0.16),
    0 36px 90px -50px rgba(35, 36, 29, 0.24);
}

.paper-tab {
  position: absolute;
  top: 22px;
  right: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #a1a096;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  user-select: none;
}

.paper-tab-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c9d8d0;
}

.editor {
  position: relative;
  min-height: clamp(420px, 57vh, 760px);
  color: #33332c;
  font-family: var(--font-editor);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.86;
  letter-spacing: 0.002em;
  caret-color: var(--accent);
  overflow-wrap: break-word;
  word-break: break-word;
  -webkit-font-smoothing: antialiased;
}

.editor:focus {
  outline: none;
}

.editor.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 0;
  left: 0;
  color: #aaa99e;
  font-size: 15px;
  font-weight: 400;
  pointer-events: none;
  user-select: none;
}

.editor > *:first-child {
  margin-top: 0 !important;
}

.editor > *:last-child {
  margin-bottom: 0 !important;
}

.editor p {
  margin: 0 0 1.05em;
  min-height: 1.6em;
}

.editor h1,
.editor h2,
.editor h3,
.editor h4,
.editor h5,
.editor h6 {
  color: #25261f;
  font-family: var(--font-editor);
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: -0.018em;
}

.editor h1 {
  margin: 0.1em 0 0.62em;
  font-size: clamp(28px, 3.25vw, 35px);
  letter-spacing: -0.025em;
}

.editor h2 {
  margin: 1.75em 0 0.62em;
  font-size: clamp(21px, 2.1vw, 24px);
  letter-spacing: -0.018em;
}

.editor h3 {
  margin: 1.55em 0 0.52em;
  font-size: 18.5px;
}

.editor h4 {
  margin: 1.4em 0 0.45em;
  font-size: 16px;
}

.editor p.lead {
  color: #5d5d53;
  font-size: 17.5px;
  line-height: 1.8;
}

.editor strong,
.editor b {
  color: #20211b;
  font-weight: 700;
}

.editor em,
.editor i {
  font-style: italic;
}

.editor u {
  text-decoration-line: underline;
  text-decoration-thickness: 1.4px;
  text-underline-offset: 3px;
}

.editor s,
.editor strike,
.editor del {
  color: #87867c;
  text-decoration-thickness: 1.2px;
}

.editor mark {
  padding: 0.05em 0.15em;
  color: inherit;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.editor a {
  color: #286b55;
  text-decoration: underline;
  text-decoration-color: #a9caba;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: text;
}

.editor a:hover {
  text-decoration-color: var(--accent);
}

.editor blockquote {
  margin: 1.5em 0;
  padding: 3px 0 3px 19px;
  color: #5d5d52;
  border-left: 2.5px solid #b6d0c4;
  font-style: normal;
}

.editor blockquote p {
  margin: 0 0 0.5em;
}

.editor blockquote p:last-child {
  margin-bottom: 0;
}

.editor code {
  padding: 0.14em 0.37em;
  color: #9b4d58;
  background: #f4f2ed;
  border: 1px solid #ece9e0;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.84em;
  font-weight: 450;
  letter-spacing: -0.01em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.editor pre {
  position: relative;
  margin: 1.55em 0;
  padding: 18px 20px;
  color: #e9ede4;
  background: #282c26;
  border: 1px solid #242820;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.76;
  white-space: pre-wrap;
  overflow-x: auto;
  -webkit-font-smoothing: antialiased;
}

.editor pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: inherit;
  font-weight: 400;
  letter-spacing: 0;
}

.editor pre:empty::before,
.editor pre > code:empty::before {
  content: "输入代码…";
  color: #858c7f;
  font-style: italic;
}

.editor ul,
.editor ol {
  margin: 0.45em 0 1.2em;
  padding-left: 1.45em;
}

.editor li {
  margin: 0.26em 0;
  padding-left: 0.15em;
}

.editor li::marker {
  color: #7d9d8c;
  font-weight: 600;
}

.editor li > p {
  margin: 0 0 0.3em;
}

.editor li > ul,
.editor li > ol {
  margin: 0.2em 0 0.35em;
}

.editor ul.task-list,
.editor ol.task-list {
  padding-left: 0;
  list-style: none;
}

.editor ul.task-list li,
.editor ol.task-list li {
  position: relative;
  padding-left: 27px;
  list-style: none;
}

.editor ul.task-list li .task-check,
.editor ol.task-list li .task-check,
.editor ul.task-list li > input[type="checkbox"],
.editor ol.task-list li > input[type="checkbox"] {
  position: absolute;
  top: 0.49em;
  left: 1px;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  border-radius: 4px;
  cursor: pointer;
}

.editor ul.task-list li[data-checked="true"],
.editor ol.task-list li[data-checked="true"] {
  color: #96958a;
  text-decoration: line-through;
  text-decoration-color: #b6b5aa;
  text-decoration-thickness: 1px;
}

.editor ul.task-list li[data-checked="true"] .task-text,
.editor ol.task-list li[data-checked="true"] .task-text {
  text-decoration: line-through;
  text-decoration-color: #b6b5aa;
}

.editor hr {
  height: 1px;
  margin: 2.1em 0;
  background: #e7e5dc;
  border: 0;
}

.editor img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.2em auto;
  border-radius: 6px;
}

.editor table {
  width: 100%;
  margin: 1.45em 0;
  border: 1px solid #e4e2d9;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
  line-height: 1.65;
}

.editor th,
.editor td {
  min-width: 76px;
  padding: 8px 11px;
  border: 1px solid #e7e4dc;
  vertical-align: top;
  overflow-wrap: break-word;
}

.editor th {
  color: #414138;
  background: #f6f5ef;
  font-weight: 650;
  text-align: left;
}

.editor td {
  background: #fffefa;
}

.editor tr:nth-child(even) td {
  background: #fcfbf7;
}

.editor table:focus-within {
  box-shadow: 0 0 0 2px rgba(47, 111, 91, 0.08);
}

.editor div[style*="center"],
.editor p[style*="center"] {
  text-align: center;
}

.editor div[style*="right"],
.editor p[style*="right"] {
  text-align: right;
}

.editor .task-text {
  outline: none;
}

.canvas-footnote {
  margin: 17px 0 0;
  color: #a1a095;
  font-size: 10px;
  letter-spacing: 0.02em;
  text-align: center;
  user-select: none;
}

/* ---------- 底部状态栏 ---------- */

.statusbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--statusbar-h);
  padding: 0 21px;
  color: #85847a;
  background: rgba(249, 249, 245, 0.93);
  border-top: 1px solid rgba(229, 227, 219, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  user-select: none;
}

.status-left,
.status-right {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.footer-save {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #7f887e;
  transition: color 0.15s;
}

.status-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: #aaa99f;
}

.status-right {
  gap: 9px;
  color: #929186;
}

.status-right b {
  color: #6f6e64;
  font-weight: 600;
}

.status-divider {
  width: 1px;
  height: 10px;
  background: #dfded5;
}

.markdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 5px;
  padding: 3px 7px;
  color: #74867c;
  background: rgba(234, 243, 239, 0.65);
  border: 1px solid #e3ece7;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.02em;
}

.badge-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #7da58f;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 17px;
  padding: 0 4px;
  color: #77766c;
  background: #fffefa;
  border: 1px solid #e2e0d7;
  border-bottom-color: #d6d4ca;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(35, 36, 29, 0.04);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1;
  white-space: nowrap;
}

.plus {
  color: #b1afa4;
  font-size: 8.5px;
}

/* ---------- 遮罩与弹窗 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 32, 26, 0.36);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.overlay.is-open {
  opacity: 1;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: min(88vh, 820px);
  background: #fffefa;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 15px;
  box-shadow: var(--shadow-modal);
  opacity: 0;
  overflow: hidden;
  transform: translateY(10px) scale(0.992);
  transition: opacity 0.18s ease, transform 0.2s var(--ease);
}

.overlay.is-open .modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.export-modal {
  width: min(720px, 100%);
}

.form-modal {
  width: min(478px, 100%);
}

.help-modal {
  width: min(684px, 100%);
}

.confirm-modal {
  width: min(432px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 23px 25px 17px;
}

.modal-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.modal-title-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-faint);
  border: 1px solid #e5efe9;
  border-radius: 9px;
}

.modal-title-icon .icon {
  width: 17px;
  height: 17px;
}

.modal-title-icon.warning {
  color: var(--warning);
  background: #fbf5e8;
  border-color: #f2e7cd;
}

.modal-title-wrap h2 {
  margin: 1px 0 4px;
  color: #292a23;
  font-size: 17.5px;
  font-weight: 680;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.modal-title-wrap p {
  margin: 0;
  color: #89887d;
  font-size: 11.5px;
  line-height: 1.55;
}

.modal-close {
  width: 30px;
  height: 30px;
  margin: -3px -5px 0 0;
  flex: 0 0 auto;
}

.modal-close .icon {
  width: 16px;
  height: 16px;
}

/* 导出弹窗 */

.export-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 25px 12px;
}

.export-meta {
  color: #9c9b90;
  font-family: var(--font-mono);
  font-size: 10px;
}

.style-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #727167;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

.style-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 31px;
  height: 18px;
  flex: 0 0 auto;
  background: #deded5;
  border-radius: 999px;
  transition: background 0.17s;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(38, 39, 32, 0.22);
  transition: transform 0.17s var(--ease);
}

.style-toggle input:checked + .switch {
  background: var(--accent);
}

.style-toggle input:checked + .switch .switch-thumb {
  transform: translateX(13px);
}

.style-toggle input:focus-visible + .switch {
  outline: 2px solid rgba(47, 111, 91, 0.45);
  outline-offset: 2px;
}

.code-preview-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0 25px;
  border: 1px solid #e7e5dc;
  border-radius: 9px;
  background: #fbfbf7;
  overflow: hidden;
}

.code-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  flex: 0 0 auto;
  padding: 0 12px;
  color: #8e8d82;
  background: #f5f5ef;
  border-bottom: 1px solid #eae8e0;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.code-ready {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #839188;
  font-family: var(--font-ui);
}

.code-ready-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #80a48f;
}

.code-preview {
  width: 100%;
  height: 298px;
  min-height: 190px;
  max-height: 42vh;
  padding: 15px 17px;
  resize: none;
  color: #3f473e;
  background:
    linear-gradient(90deg, rgba(246, 246, 240, 0.65) 1px, transparent 1px) 0 0 / 100% 1.74em,
    #fcfcf8;
  border: 0;
  outline: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.74;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
  tab-size: 2;
}

.code-preview::-webkit-scrollbar,
.editor pre::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.code-preview::-webkit-scrollbar-thumb,
.editor pre::-webkit-scrollbar-thumb {
  background: #d8d6cc;
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 99px;
}

.export-note {
  margin: 10px 25px 0;
  color: #a1a096;
  font-size: 10px;
  line-height: 1.65;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding: 16px 25px 19px;
  border-top: 1px solid #f0eee7;
  background: #fdfcf8;
}

.copy-btn {
  min-width: 142px;
}

.copy-btn.is-copied {
  background: #467962;
  border-color: #467962;
}

/* 表单弹窗 */

.form-modal form {
  padding: 3px 25px 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: #55554b;
  font-size: 11.5px;
  font-weight: 600;
}

.label-required {
  margin-left: 3px;
  color: #bb736d;
  font-size: 9.5px;
  font-weight: 450;
}

.label-optional {
  margin-left: 3px;
  color: #a6a59b;
  font-size: 9.5px;
  font-weight: 450;
}

.field input {
  height: 39px;
  width: 100%;
  padding: 0 11px;
  color: #36362e;
  background: #fffefb;
  border: 1px solid #dedcd3;
  border-radius: 7px;
  font-size: 12.5px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input::placeholder {
  color: #b1b0a5;
}

.field input:hover {
  border-color: #cfcdc2;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 111, 91, 0.09);
}

.field input.is-invalid {
  border-color: #c67872;
  box-shadow: 0 0 0 3px rgba(168, 72, 66, 0.08);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.field-help {
  margin: -2px 0 13px;
  color: #9b9a90;
  font-size: 10px;
  line-height: 1.6;
}

.form-error {
  min-height: 17px;
  margin: 0;
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.5;
}

.form-footer {
  margin: 5px -25px 0;
  padding-right: 25px;
  padding-left: 25px;
}

.table-preview {
  display: grid;
  gap: 3px;
  margin: 2px 0 8px;
  padding: 9px;
  background: #f8f8f3;
  border: 1px solid #efede5;
  border-radius: 7px;
}

.table-preview-cell {
  height: 14px;
  background: #fffefa;
  border: 1px solid #e3e1d8;
  border-radius: 2px;
}

.table-preview-cell.is-header {
  background: #e9f1ed;
  border-color: #d4e3db;
}

/* 帮助弹窗 */

.help-modal .modal-header {
  padding-bottom: 13px;
}

.help-body {
  padding: 6px 25px 24px;
  overflow-y: auto;
}

.help-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.help-section {
  padding: 14px 15px 11px;
  background: #fbfbf7;
  border: 1px solid #efede6;
  border-radius: 9px;
}

.help-section h3,
.help-markdown h3 {
  margin: 0 0 9px;
  color: #5e5d53;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 29px;
  color: #7f7e74;
  font-size: 11.5px;
}

.shortcut-row > span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.shortcut-row .kbd {
  font-size: 8px;
  height: 16px;
}

.help-tip {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 12px;
  padding: 13px 15px;
  background: var(--accent-faint);
  border: 1px solid #e2ede7;
  border-radius: 9px;
}

.help-tip-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: var(--accent);
  background: #fff;
  border: 1px solid #dfeae4;
  border-radius: 7px;
}

.help-tip-icon .icon {
  width: 14px;
  height: 14px;
}

.help-tip strong {
  display: block;
  margin: 2px 0 3px;
  color: #486958;
  font-size: 11px;
  font-weight: 650;
}

.help-tip p {
  margin: 0;
  color: #7e8e85;
  font-size: 10.5px;
  line-height: 1.7;
}

.help-tip .kbd {
  height: 15px;
  font-size: 8px;
  margin: 0 1px;
}

.help-markdown {
  margin-top: 13px;
  padding: 13px 15px;
  border: 1px solid #efede6;
  border-radius: 9px;
}

.help-markdown h3 {
  margin-bottom: 6px;
}

.help-markdown p {
  margin: 0;
  color: #8e8d82;
  font-size: 10.5px;
  line-height: 1.7;
}

.confirm-footer {
  margin-top: 4px;
}

/* ---------- 提示气泡 ---------- */

.toast {
  position: fixed;
  bottom: 51px;
  left: 50%;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 9px 14px 9px 10px;
  color: #f6f7f2;
  background: rgba(43, 45, 37, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(29, 30, 24, 0.22);
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.18s, transform 0.22s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #d5e7dc;
  background: rgba(127, 170, 145, 0.2);
  border-radius: 50%;
}

.toast-icon .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.3;
}

.toast.is-error {
  background: rgba(112, 48, 44, 0.97);
}

.toast.is-error .toast-icon {
  color: #f0d4d1;
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- 表格快捷工具 ---------- */

.table-bubble {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 35px;
  padding: 3px 20px;
  background: rgba(248, 249, 244, 0.97);
  border-top: 1px solid rgba(232, 233, 226, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  overflow-x: auto;
  scrollbar-width: none;
  animation: contextIn 0.16s var(--ease);
  user-select: none;
}

.table-bubble::-webkit-scrollbar {
  display: none;
}

@keyframes contextIn {
  from { transform: translateY(-3px); }
  to { transform: translateY(0); }
}

.table-bubble button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 8px;
  color: #6f6e64;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 10.5px;
  white-space: nowrap;
  cursor: pointer;
}

.table-bubble button:hover {
  color: var(--accent-strong);
  background: #fffefa;
  border-color: #e4e6dc;
}

.table-bubble button.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.table-bubble .icon {
  width: 12px;
  height: 12px;
}

.table-bubble-sep {
  width: 1px;
  height: 15px;
  margin: 0 5px;
  background: #e4e5dc;
  flex: 0 0 auto;
}

.table-bubble-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px 0 2px;
  color: #8b8c80;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.table-bubble-label::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8fb3a2;
  box-shadow: 0 0 0 3px rgba(143, 179, 162, 0.11);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1050px) {
  .status-hint {
    display: none;
  }

  .toolbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .tool-sep {
    margin: 0 4px;
  }

  .doc-title {
    width: clamp(130px, 20vw, 230px);
  }
}

@media (max-width: 860px) {
  .brand-copy span {
    display: none;
  }

  .topbar {
    gap: 10px;
    padding: 0 14px;
  }

  .topbar-left {
    gap: 11px;
  }

  .save-chip {
    display: none;
  }

  .doc-title {
    width: clamp(110px, 24vw, 210px);
  }

  .workspace {
    padding: 20px 16px 56px;
  }

  .paper {
    padding-right: clamp(28px, 7vw, 54px);
    padding-left: clamp(28px, 7vw, 54px);
  }

  .help-columns {
    grid-template-columns: 1fr;
  }

  .statusbar {
    padding: 0 14px;
  }

  .markdown-badge {
    display: none;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-h: 57px;
    --statusbar-h: 31px;
  }

  .topbar {
    padding: 0 10px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
    border-radius: 9px;
  }

  .brand-icon {
    width: 16px;
    height: 16px;
  }

  .brand-copy strong {
    font-size: 13px;
  }

  .topbar-sep {
    display: none;
  }

  .topbar-left {
    gap: 6px;
  }

  .doc-title {
    width: clamp(80px, 25vw, 160px);
    padding-right: 5px;
    padding-left: 5px;
    font-size: 12px;
  }

  .topbar-actions {
    gap: 3px;
  }

  .ghost-btn {
    width: 33px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .ghost-btn span {
    display: none;
  }

  #exportBtn {
    height: 33px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  #exportBtn .icon {
    display: none;
  }

  .export-label-full {
    display: none;
  }

  .export-label-short {
    display: inline;
  }

  .toolbar {
    gap: 1px;
    padding: 6px 8px;
    min-height: 46px;
  }

  .tool-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }

  .tool-btn .icon {
    width: 16px;
    height: 16px;
  }

  .tool-sep {
    height: 19px;
    margin: 0 3px;
  }

  .block-picker {
    min-width: 83px;
    height: 30px;
    padding: 0 6px;
    font-size: 11px;
  }

  .block-picker .block-picker-icon {
    display: none;
  }

  .insert-btn {
    height: 30px;
    padding: 0 6px;
    font-size: 11px;
  }

  .insert-btn .icon:first-child {
    display: none;
  }

  .toolbar-end {
    margin-left: 0;
  }

  .workspace {
    padding: 14px 9px 48px;
    background-size: 18px 18px;
  }

  .paper {
    min-height: calc(100vh - 190px);
    padding: 42px 23px 64px;
    border-radius: 7px;
  }

  .paper-tab {
    display: none;
  }

  .editor {
    min-height: 52vh;
    font-size: 15.5px;
    line-height: 1.82;
  }

  .editor h1 {
    font-size: 27px;
  }

  .editor h2 {
    font-size: 21px;
    margin-top: 1.5em;
  }

  .editor p.lead {
    font-size: 16.5px;
  }

  .editor pre {
    margin-right: -8px;
    margin-left: -8px;
    padding: 15px 14px;
    font-size: 12px;
    border-radius: 6px;
  }

  .editor table {
    font-size: 12.5px;
  }

  .editor th,
  .editor td {
    min-width: 58px;
    padding: 6px 7px;
  }

  .canvas-footnote {
    margin-top: 13px;
    font-size: 9px;
  }

  .statusbar {
    padding: 0 10px;
    font-size: 9.5px;
  }

  .status-right {
    gap: 6px;
  }

  .status-right > span:nth-child(2),
  .status-right > span:nth-child(3),
  .status-right > span:nth-child(4) {
    display: none;
  }

  .footer-save {
    font-size: 9.5px;
  }

  .overlay {
    align-items: flex-end;
    padding: 10px;
  }

  .modal {
    max-height: 92vh;
    border-radius: 13px;
  }

  .modal-header {
    padding: 17px 17px 13px;
  }

  .modal-title-icon {
    width: 32px;
    height: 32px;
  }

  .modal-title-wrap h2 {
    font-size: 16px;
  }

  .modal-title-wrap p {
    font-size: 10.5px;
  }

  .export-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 0 17px 10px;
  }

  .code-preview-wrap {
    margin: 0 17px;
  }

  .code-preview {
    height: 240px;
    min-height: 160px;
    padding: 12px;
    font-size: 11px;
  }

  .export-note {
    margin: 8px 17px 0;
    font-size: 9.5px;
  }

  .modal-footer {
    margin-top: 13px;
    padding: 13px 17px 15px;
  }

  .form-modal form {
    padding-right: 17px;
    padding-left: 17px;
  }

  .form-footer {
    margin-right: -17px;
    margin-left: -17px;
    padding-right: 17px;
    padding-left: 17px;
  }

  .help-body {
    padding: 4px 17px 18px;
  }

  .help-markdown,
  .help-tip {
    margin-top: 9px;
  }

  .copy-btn {
    min-width: 0;
    flex: 1;
  }

  .toast {
    bottom: 41px;
    font-size: 10.5px;
  }

  .table-bubble {
    padding: 3px 8px;
  }

  .table-bubble-label,
  .table-bubble-sep {
    display: none;
  }

  .table-bubble button {
    padding: 0 7px;
  }
}

@media (max-width: 440px) {
  .brand-copy {
    display: none;
  }

  .doc-title {
    width: clamp(88px, 34vw, 150px);
  }

  #exportBtn {
    padding: 0 9px;
  }

  .toolbar-end {
    display: none;
  }

  .mobile-only-item {
    display: flex;
  }

  .mobile-only-divider {
    display: block;
  }

  .status-right > span:nth-child(6) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
