@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Inter+Tight:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,600;1,500;1,600&display=swap");

:root {
  --bg: #efe7d2;
  --panel: rgba(247, 241, 222, 0.9);
  --panel-strong: #f7f1de;
  --ink: #15140f;
  --muted: #5a5448;
  --line: rgba(21, 20, 15, 0.14);
  --line-strong: rgba(21, 20, 15, 0.24);
  --accent: #ed6f5c;
  --accent-ink: #fffaf4;
  --danger: #a43428;
  --stage: #e7ddc8;
  --canvas-shadow: 0 24px 60px rgba(42, 31, 9, 0.18);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --hover-shadow: 0 12px 30px rgba(38, 28, 13, 0.08);
  --font-display: "Inter Tight", "Inter", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-serif: "Playfair Display", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
}

body.theme-dark {
  --bg: #11100d;
  --panel: rgba(30, 25, 20, 0.86);
  --panel-strong: #201b16;
  --ink: #f4ecde;
  --muted: #b9ad9b;
  --line: rgba(233, 220, 201, 0.12);
  --line-strong: rgba(233, 220, 201, 0.22);
  --accent: #ed7f66;
  --accent-ink: #fff7f1;
  --danger: #ffad9a;
  --stage: #171411;
  --canvas-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(106, 92, 56, 0.07) 0, transparent 28%),
    radial-gradient(circle at 88% 72%, rgba(106, 92, 56, 0.06) 0, transparent 32%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.16 0 0 0 0 0.12 0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: auto, auto, 240px 240px;
  mix-blend-mode: multiply;
  opacity: 0.9;
}

body.theme-dark {
  background: var(--bg);
}

body.theme-dark::before {
  background-image:
    radial-gradient(circle at 14% 12%, rgba(145, 102, 67, 0.14) 0, transparent 24%),
    radial-gradient(circle at 82% 84%, rgba(105, 80, 56, 0.12) 0, transparent 28%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.28 0 0 0 0 0.22 0 0 0 0 0.16 0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.58;
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 241, 226, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(22, 17, 12, 0.04);
}

body.theme-dark .topbar {
  background: rgba(20, 17, 14, 0.72);
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.shell-icon-btn {
  width: auto;
  min-width: 40px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.shell-icon-btn-quiet {
  border-color: transparent;
  background: transparent;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand-note {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  max-width: min(1180px, 100%);
}

.toolbar-actions {
  gap: 8px;
}

.actions .btn {
  width: auto;
  margin-bottom: 0;
}

.actions .btn,
.actions select {
  flex: 0 0 auto;
}

.export-scale-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.export-scale-label select {
  margin: 0;
  width: 70px;
  padding: 7px 8px;
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.52);
}

body.theme-dark .toolbar-group {
  background: rgba(255, 247, 236, 0.04);
}

.compact-label {
  margin: 0;
  padding: 0 6px 0 2px;
}

.toolbar-menu {
  position: relative;
}

.toolbar-menu summary {
  list-style: none;
}

.toolbar-menu summary::-webkit-details-marker {
  display: none;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 12;
  display: grid;
  gap: 10px;
  min-width: 170px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(18, 13, 8, 0.14);
  animation: menu-in 0.18s ease;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-panel-wide {
  min-width: 220px;
}

.toolbar-menu[open] summary.btn {
  border-color: #b89e75;
  background: #f6ede0;
}

body.theme-dark .toolbar-menu[open] summary.btn {
  background: #31261d;
  border-color: #80664f;
}

.menu-btn {
  width: 100%;
  margin: 0;
}

.menu-field {
  display: grid;
  gap: 4px;
  margin: 0;
}

.menu-field select {
  width: 100%;
}

.tool-icon {
  min-width: 40px;
  padding-inline: 0;
  font-weight: 700;
}

.brand {
  min-width: 180px;
  max-width: 220px;
}

.shell-link-btn {
  width: auto;
  margin: 0;
  padding-inline: 14px;
}

.mobile-shell-actions {
  display: none;
  align-items: center;
  gap: 8px;
}

.mobile-shell-btn {
  width: auto;
  margin: 0;
  padding-inline: 12px;
}

.doc-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 18;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 14px;
  width: min(380px, calc(100vw - 28px));
  padding: 22px 18px 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(251, 246, 235, 0.96), rgba(244, 236, 219, 0.98)),
    var(--panel);
  box-shadow: 0 28px 80px rgba(23, 16, 10, 0.22);
  transform: translateX(calc(-100% - 24px));
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

body.theme-dark .doc-drawer {
  background:
    linear-gradient(180deg, rgba(34, 28, 23, 0.98), rgba(20, 17, 14, 0.99)),
    var(--panel);
}

body.doc-drawer-open .doc-drawer {
  transform: translateX(0);
}

.doc-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 17;
  background: rgba(17, 12, 9, 0.4);
  backdrop-filter: blur(8px);
}

.doc-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.doc-drawer-eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.doc-drawer-header h2 {
  margin: 0;
  font-size: 24px;
}

.doc-drawer-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.doc-drawer-toolbar .btn {
  margin: 0;
}

.doc-drawer-list {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.doc-card {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 242, 0.7);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.doc-card:hover {
  border-color: #c8b79f;
  box-shadow: var(--hover-shadow);
}

body.theme-dark .doc-card {
  background: rgba(255, 248, 238, 0.03);
}

.doc-card.is-active {
  border-color: #bf8755;
  background: rgba(233, 205, 172, 0.28);
  box-shadow: inset 0 0 0 1px rgba(191, 135, 85, 0.16);
}

body.theme-dark .doc-card.is-active {
  background: rgba(205, 145, 91, 0.18);
}

.doc-card-visual {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 120px;
  padding: 16px 16px 14px;
  border: 1px solid rgba(140, 117, 88, 0.18);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.94), rgba(247, 237, 222, 0.88));
  overflow: hidden;
}

.doc-card-visual::after {
  content: "";
  position: absolute;
  inset: auto 14px 12px 14px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(140, 117, 88, 0.14), rgba(140, 117, 88, 0.02));
}

body.theme-dark .doc-card-visual {
  border-color: rgba(223, 198, 165, 0.1);
  background:
    linear-gradient(180deg, rgba(42, 33, 26, 0.96), rgba(27, 21, 16, 0.98));
}

.doc-card-visual-title {
  position: relative;
  z-index: 1;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 22px;
  line-height: 1.1;
  color: var(--ink);
}

.doc-card-visual-meta {
  position: relative;
  z-index: 1;
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.doc-card-visual-excerpt {
  position: relative;
  z-index: 1;
  max-width: 82%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.doc-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-card-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(212, 95, 60, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.doc-card-meta {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-card-preview {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr) 292px;
  gap: 20px;
  padding: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.72), rgba(245, 238, 223, 0.94));
  padding: 18px;
  height: calc(100vh - 92px);
  overflow: auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 22px 55px rgba(36, 28, 16, 0.08);
}

body.theme-dark .panel {
  background: linear-gradient(180deg, rgba(36, 30, 24, 0.94), rgba(21, 18, 15, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 225, 0.05),
    0 24px 60px rgba(0, 0, 0, 0.22);
}

.panel-section {
  padding: 2px 2px 0;
}

.panel-section + .panel-section {
  margin-top: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel-section-emphasis {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.42);
}

body.theme-dark .panel-section-emphasis {
  background: rgba(255, 248, 239, 0.04);
}

.panel-section-compact {
  padding: 4px 2px 12px;
}

.panel-section-compact h2 {
  margin-bottom: 6px;
}

.panel h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: -0.02em;
}

.panel-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.panel-intro {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--accent);
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.group {
  margin-top: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.34);
}

body.theme-dark .group {
  background: rgba(255, 248, 239, 0.03);
}

.inspector-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.inspector-actions-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.inspector-btn {
  margin-bottom: 0;
}

#text-formatting-controls {
  margin: 10px 0 18px;
  padding: 14px;
}

#text-formatting-controls .hint {
  margin-bottom: 12px;
  font-size: 11px;
  line-height: 1.45;
}

#text-formatting-controls h3 {
  margin-bottom: 8px;
}

label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.field-block {
  margin-bottom: 12px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

input,
select {
  margin-top: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 14px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.92);
  transition: border-color 0.15s ease;
}

input:focus,
select:focus {
  border-color: #c8b79f;
  outline: none;
}

body.theme-dark input,
body.theme-dark select {
  background: rgba(41, 33, 26, 0.9);
  color: var(--ink);
}

.canvas-bg-tools {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.canvas-bg-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.canvas-bg-swatch {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)) padding-box,
    var(--swatch) border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.canvas-bg-swatch:hover {
  border-color: #c8b79f;
  box-shadow: var(--hover-shadow);
}

.canvas-bg-swatch:active {
  transform: translateY(1px);
}

.canvas-bg-swatch.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(237, 111, 92, 0.16);
}

.canvas-bg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.canvas-bg-row input[type="color"] {
  min-height: 42px;
  margin-top: 0;
  padding: 4px;
}

.canvas-bg-reset {
  width: auto;
  margin-bottom: 0;
  padding-inline: 14px;
  white-space: nowrap;
}

.canvas-palette-status {
  margin: 0;
}

.btn,
.file-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.88);
  color: var(--ink);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  text-decoration: none;
}

.btn:hover,
.file-btn:hover {
  border-color: #c8b79f;
  box-shadow: var(--hover-shadow);
}

.btn:active,
.file-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:disabled,
.file-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  border-color: var(--line);
}

body.theme-dark .btn,
body.theme-dark .file-btn {
  background: rgba(39, 32, 26, 0.9);
}

.btn-primary {
  width: auto;
  padding: 9px 14px;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 12px 24px rgba(237, 111, 92, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(212, 95, 60, 0.35);
}

body.theme-dark .btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-danger {
  margin-top: 18px;
  background: rgba(255, 244, 241, 0.52);
  color: var(--danger);
  border-color: rgba(240, 200, 190, 0.56);
}

.btn-danger:hover {
  background: #fff4f1;
  border-color: #f0c8be;
}

.topbar > .shell-icon-btn,
.doc-drawer-header .shell-icon-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
}

body.theme-dark .btn-danger {
  background: rgba(255, 153, 130, 0.08);
  color: var(--danger);
  border-color: rgba(255, 153, 130, 0.22);
}

body.theme-dark .btn-danger:hover {
  background: rgba(255, 153, 130, 0.15);
  border-color: rgba(255, 153, 130, 0.3);
}

.file-btn input {
  display: none;
}

.element-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.element-grid .btn,
.element-grid .file-btn {
  margin-bottom: 0;
  justify-content: center;
  min-height: 48px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
}

.canvas-wrap {
  min-height: calc(100vh - 92px);
}

.canvas-stage {
  height: calc(100vh - 92px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid rgba(21, 20, 15, 0.12);
  border-radius: 28px;
  padding: 28px;
  background:
    linear-gradient(transparent 39px, rgba(110, 88, 55, 0.05) 40px),
    linear-gradient(90deg, transparent 39px, rgba(110, 88, 55, 0.05) 40px),
    linear-gradient(180deg, rgba(235, 225, 202, 0.8), rgba(228, 217, 192, 0.94)),
    var(--stage);
  background-size: 40px 40px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

body.theme-dark .canvas-stage {
  border-color: rgba(233, 220, 201, 0.1);
  background:
    linear-gradient(transparent 39px, rgba(120, 92, 63, 0.05) 40px),
    linear-gradient(90deg, transparent 39px, rgba(120, 92, 63, 0.05) 40px),
    linear-gradient(180deg, rgba(30, 25, 20, 0.94), rgba(21, 18, 15, 0.98)),
    var(--stage);
}

.canvas-viewport {
  flex: 0 0 auto;
  margin: 0;
}

.canvas-scale {
  transform-origin: top left;
}

.long-canvas {
  position: relative;
  margin: 0;
  width: 1200px;
  min-height: 1600px;
  background: #ffffff;
  border: 2px solid rgba(65, 44, 14, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 90px rgba(31, 24, 14, 0.16);
  transition: width 0.2s ease;
}

body.theme-dark .long-canvas {
  background: #16120e;
  border-color: rgba(231, 213, 186, 0.18);
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.3);
}

body.theme-dark .el.selected {
  background: rgba(106, 144, 173, 0.12);
}

body.theme-dark .el-text .content,
body.theme-dark .header-title,
body.theme-dark .header-meta,
body.theme-dark .quote-content,
body.theme-dark .card-title,
body.theme-dark .card-body,
body.theme-dark .md-preview {
  color: #f4ede2 !important;
}

body.theme-dark .el-card,
body.theme-dark .el-markdown,
body.theme-dark .el-quote {
  background: rgba(255, 248, 239, 0.08);
  border-color: rgba(233, 214, 190, 0.16);
}

.el {
  position: absolute;
  user-select: none;
  border: 2px solid transparent;
}

.drag-reordering .el {
  transition: top 0.18s ease, left 0.18s ease;
}

.drag-reordering .el.selected {
  transition: none;
}

.el.selected {
  border-color: #3a6a8d;
  background: rgba(73, 122, 157, 0.05);
}

.el .content,
.header-title,
.header-meta {
  user-select: text;
}

.el-text .content {
  width: 100%;
  min-height: 48px;
  padding: 8px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 60px;
  line-height: 1.5;
  text-align: justify;
  text-justify: inter-ideograph;
  color: #1f1f22;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 300;
}

.el-text .content b,
.el-text .content strong,
.quote-content b,
.quote-content strong,
.card-title b,
.card-title strong,
.card-body b,
.card-body strong,
.header-title b,
.header-title strong,
.header-meta b,
.header-meta strong {
  font-weight: 700;
}

.el-text .content:empty::before {
  content: attr(data-placeholder);
  color: #8a8a8a;
}

.el [contenteditable="true"]:focus {
  outline: none;
}

.el-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  background: transparent;
}

.el-image.frame-polaroid {
  padding: 14px 14px 48px;
  background: #fffaf4;
  box-shadow: 0 20px 45px rgba(35, 25, 10, 0.15);
}

.el-image.frame-card {
  padding: 12px;
  background: #fff6ea;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(35, 25, 10, 0.12);
}

.el-image.frame-none {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.el-divider {
  padding: 8px 0;
}

.divider-line {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, #5c3c2d, #bf8058, #5c3c2d);
  border-radius: 999px;
}

.el-header {
  padding: 8px 0;
  background: transparent;
  border-radius: 0;
}

.header-title {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
}

.header-meta {
  position: absolute;
  top: 8px;
  right: 0;
  font-size: 60px;
  color: #1f1f22;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
  text-align: right;
}

.el-quote {
  border-left: 6px solid #c9b294;
  background: #fbf7f0;
  padding: 18px 20px 18px 26px;
}

.quote-mark {
  font-size: 48px;
  line-height: 1;
  color: #8d7354;
}

.quote-content {
  margin-top: 2px;
  min-height: 64px;
  font-size: 46px;
  line-height: 1.45;
  text-align: justify;
  text-justify: inter-ideograph;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 300;
}

.quote-content:empty::before {
  content: attr(data-placeholder);
  color: #8a8a8a;
}

.el-card {
  border: 2px solid #e1d2bd;
  border-radius: 18px;
  background: #fffaf2;
  padding: 18px 20px;
}

body.theme-dark .el-card {
  background: #fff8ef;
}

.card-title {
  min-height: 54px;
  font-size: 52px;
  font-weight: 700;
  line-height: 1.25;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 500;
}

.card-body {
  margin-top: 10px;
  min-height: 66px;
  font-size: 40px;
  line-height: 1.5;
  text-align: justify;
  text-justify: inter-ideograph;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 300;
}

.card-title:empty::before,
.card-body:empty::before {
  content: attr(data-placeholder);
  color: #8a8a8a;
}

.el-markdown {
  border: 1px solid #d8ccbd;
  border-radius: 12px;
  background: #fffdfa;
  padding: 12px;
}

body.theme-dark .el-markdown {
  background: #fff8ef;
}

.md-editor {
  min-height: 100px;
  font-size: 24px;
  line-height: 1.5;
  color: #574736;
  padding: 10px;
  border: 1px dashed #d5c4af;
  border-radius: 8px;
  font-family: "SF Mono", "Menlo", monospace;
  white-space: pre-wrap;
}

.md-editor:empty::before {
  content: attr(data-placeholder);
  color: #a18b72;
}

.md-preview {
  margin-top: 10px;
  min-height: 70px;
  font-size: 34px;
  line-height: 1.5;
  text-align: justify;
  text-justify: inter-ideograph;
  font-family: "方正清刻本悦宋", "FZQKBYSJW--GB1-0", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 300;
}

.md-preview h2,
.md-preview h3,
.md-preview h4 {
  margin: 0.5em 0 0.3em;
  font-weight: 600;
}

.md-preview p,
.md-preview blockquote,
.md-preview li,
.md-preview ul {
  margin: 0.35em 0;
}

.move-handle {
  position: absolute;
  top: -10px;
  left: -1px;
  border: 1px solid #a5bdd0;
  border-radius: 999px;
  background: #edf5fb;
  color: #315a78;
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
  cursor: grab;
  display: none;
}

.el.selected .move-handle {
  display: inline-block;
}

body.layout-locked .el .move-handle {
  display: none !important;
}

body.layout-locked .el {
  cursor: default;
}

.hint {
  margin: 2px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  right: -8px;
  bottom: -8px;
  background: #3a6a8d;
  border: 2px solid #fff;
  cursor: nwse-resize;
}

.hidden {
  display: none;
}

.page-landing {
  color: var(--ink);
  background: #f3ecde;
}

.page-landing::before {
  background-image:
    radial-gradient(circle at 14% 16%, rgba(106, 92, 56, 0.05) 0, transparent 26%),
    radial-gradient(circle at 82% 74%, rgba(106, 92, 56, 0.04) 0, transparent 28%);
  background-size: auto, auto;
  mix-blend-mode: normal;
  opacity: 1;
}

.landing-shell {
  position: relative;
  z-index: 1;
}

.landing-container {
  width: min(1240px, calc(100vw - 72px));
  margin: 0 auto;
}

.landing-meta-bar {
  border-bottom: 1px solid var(--line);
  background: rgba(243, 236, 222, 0.92);
}

.landing-meta-inner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  color: rgba(21, 20, 15, 0.58);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.landing-meta-inner strong,
.landing-meta-inner em {
  color: var(--ink);
  font-style: normal;
}

.landing-meta-inner i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 236, 222, 0.82);
  backdrop-filter: blur(12px);
}

.landing-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
}

.landing-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(21, 20, 15, 0.18);
  border-radius: 999px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-style: italic;
  background: rgba(255, 252, 246, 0.7);
}

.landing-brand-copy {
  display: grid;
  gap: 2px;
}

.landing-brand-copy strong {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.02em;
}

.landing-brand-copy small {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.landing-nav-links,
.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 28px;
}

.landing-nav-links a {
  color: rgba(21, 20, 15, 0.78);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.landing-nav-btn {
  width: auto;
  margin: 0;
  padding-inline: 16px;
}

.landing-hero,
.landing-section {
  position: relative;
  padding: 76px 0 92px;
}

.landing-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(420px, 0.94fr);
  gap: 48px;
  align-items: center;
}

.landing-eyebrow,
.landing-card-tag {
  margin: 0 0 18px;
  color: color-mix(in srgb, var(--accent) 82%, var(--ink) 18%);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.landing-hero h1,
.landing-info-card h2,
.landing-feature-block h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(44px, 5.6vw, 72px);
  font-weight: 700;
  line-height: 1.01;
  letter-spacing: -0.04em;
}

.landing-info-card h2,
.landing-feature-block h2 {
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.06;
}

.landing-serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
}

.landing-dot {
  color: var(--accent);
}

.landing-lead,
.landing-info-card p,
.landing-feature-block p,
.landing-flow-step p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.72;
}

.landing-cta-row {
  display: flex;
  gap: 14px;
  margin: 28px 0 34px;
}

.landing-cta,
.landing-ghost-cta {
  width: auto;
  margin: 0;
  padding-inline: 20px;
  text-decoration: none;
}

.landing-stat-grid,
.landing-card-grid,
.landing-feature-grid,
.landing-flow-grid {
  display: grid;
  gap: 18px;
}

.landing-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-stat {
  margin: 0;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.58);
}

.landing-stat dt,
.landing-flow-step span {
  margin-bottom: 10px;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 22px;
  font-style: italic;
}

.landing-stat dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.landing-hero-visual {
  position: relative;
  align-self: stretch;
}

.landing-preview-card {
  position: relative;
  border: 1px solid rgba(21, 20, 15, 0.1);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(250, 245, 235, 0.96), rgba(244, 236, 221, 0.94));
  box-shadow: 0 18px 44px rgba(21, 20, 15, 0.08);
}

.landing-preview-frame {
  padding: 16px;
}

.landing-preview-topline {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px 12px;
  color: rgba(21, 20, 15, 0.52);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-preview-app {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  min-height: 500px;
}

.landing-preview-sidebar {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px 12px;
  border: 1px solid rgba(21, 20, 15, 0.1);
  border-radius: 16px;
  background: rgba(255, 251, 243, 0.78);
}

.landing-preview-canvas {
  padding: 16px;
  border: 1px solid rgba(21, 20, 15, 0.1);
  border-radius: 18px;
  background: rgba(231, 223, 205, 0.72);
}

.landing-preview-canvas-sheet {
  height: 100%;
  min-height: 420px;
  padding: 30px;
  border: 1px solid rgba(21, 20, 15, 0.08);
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 10px 24px rgba(36, 28, 16, 0.06);
}

.landing-preview-kicker {
  color: rgba(21, 20, 15, 0.56);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-preview-title {
  margin-top: 18px;
  font-family: var(--font-display);
  max-width: 100%;
  font-size: 31px;
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.landing-preview-line {
  width: 96px;
  height: 1px;
  margin: 18px 0;
  background: color-mix(in srgb, var(--accent) 36%, transparent);
}

.landing-preview-body,
.landing-preview-quote {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.landing-preview-quote {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(21, 20, 15, 0.08);
  color: rgba(21, 20, 15, 0.7);
}

.landing-preview-chip,
.landing-preview-tile,
.landing-preview-field,
.landing-preview-swatch {
  border: 1px solid rgba(21, 20, 15, 0.1);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.85);
}

.landing-preview-chip,
.landing-preview-tile {
  padding: 10px 11px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

.landing-preview-chip-accent {
  background: rgba(237, 111, 92, 0.12);
  color: var(--accent);
}

.landing-preview-field {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: rgba(21, 20, 15, 0.72);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

.landing-preview-field-short {
  height: 34px;
  font-size: 11px;
}

.landing-preview-swatch {
  height: 88px;
  background: linear-gradient(135deg, #15140f, #ed6f5c);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 14px;
  color: rgba(255, 250, 244, 0.94);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.landing-section-rule {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line-strong);
  color: rgba(21, 20, 15, 0.54);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.landing-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

.landing-info-card,
.landing-flow-step {
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.6);
}

.landing-feature-grid {
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
}

.landing-feature-block {
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.56);
}

.landing-feature-list {
  margin: 16px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
  color: var(--muted);
}

.landing-flow-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

.landing-bottom-cta {
  margin-top: 28px;
}

.mobile-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 14;
  background: rgba(17, 12, 9, 0.24);
}

#image-controls {
  padding-top: 4px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 12, 0.42);
  backdrop-filter: blur(10px);
}

.dialog-backdrop.hidden {
  display: none;
}

.dialog-card {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--ink);
  padding: 22px;
  box-shadow: 0 28px 70px rgba(22, 16, 10, 0.26);
}

.dialog-card h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.dialog-message {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.dialog-fields {
  display: grid;
  gap: 10px;
}

.dialog-fields.hidden {
  display: none;
}

.dialog-field {
  margin: 0;
}

.dialog-field label {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.dialog-field input {
  margin-top: 0;
}

.dialog-field-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

#no-selection {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.24);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

body.theme-dark #no-selection {
  background: rgba(255, 248, 239, 0.03);
}

@media (max-width: 1180px) {
  .landing-container {
    width: min(100vw - 56px, 1200px);
  }

  .landing-meta-inner,
  .landing-nav-inner {
    flex-wrap: wrap;
  }

  .landing-hero-grid,
  .landing-card-grid,
  .landing-feature-grid,
  .landing-flow-grid,
  .landing-stat-grid {
    grid-template-columns: 1fr;
  }

  .landing-preview-app {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-main {
    width: 100%;
  }

  .actions {
    justify-content: flex-start;
  }

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

  .panel {
    height: auto;
  }

  .canvas-stage {
    height: 68vh;
  }
}

@media (max-width: 900px) {
  .landing-container {
    width: calc(100vw - 32px);
  }

  .landing-hero,
  .landing-section {
    padding: 62px 0 76px;
  }

  .landing-nav-links {
    display: none;
  }

  .landing-meta-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .landing-cta-row {
    flex-direction: column;
  }

  .landing-preview-app {
    grid-template-columns: 1fr;
  }

  .landing-preview-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-preview-canvas-sheet {
    padding: 22px;
  }

  .landing-preview-title {
    font-size: 32px;
  }

  .landing-lead,
  .landing-info-card p,
  .landing-feature-block p,
  .landing-flow-step p {
    font-size: 16px;
  }

  .topbar {
    gap: 10px;
    padding: 12px 12px 10px;
    align-items: stretch;
  }

  .shell-icon-btn {
    min-width: 42px;
    padding-inline: 12px;
  }

  .topbar-main {
    width: 100%;
    gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .brand h1 {
    font-size: 20px;
  }

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

  .mobile-shell-actions {
    display: inline-flex;
  }

  .actions {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    justify-content: flex-start;
  }

  .actions::-webkit-scrollbar {
    display: none;
  }

  .toolbar-group {
    flex: 0 0 auto;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 10px;
  }

  .canvas-wrap {
    min-height: calc(100dvh - 126px);
  }

  .canvas-stage {
    height: calc(100dvh - 126px);
    padding: 12px;
    border-radius: var(--radius-lg);
  }

  .panel {
    position: fixed;
    top: 108px;
    bottom: 12px;
    z-index: 15;
    width: min(360px, calc(100vw - 24px));
    height: auto;
    box-shadow: 0 26px 70px rgba(17, 12, 9, 0.28);
    transition: transform 0.22s ease, opacity 0.22s ease;
  }

  .left-panel {
    left: 12px;
    transform: translateX(calc(-100% - 20px));
  }

  .right-panel {
    right: 12px;
    transform: translateX(calc(100% + 20px));
  }

  body.mobile-panel-left-open .left-panel {
    transform: translateX(0);
  }

  body.mobile-panel-right-open .right-panel {
    transform: translateX(0);
  }

  body.mobile-panel-left-open .mobile-panel-backdrop,
  body.mobile-panel-right-open .mobile-panel-backdrop {
    display: block;
  }

  .doc-drawer {
    width: min(360px, calc(100vw - 18px));
    padding: 18px 14px 14px;
  }

  .doc-drawer-toolbar {
    grid-template-columns: 1fr;
  }
}
