:root {
  --yz-edit-gold: #d6b15e;
  --yz-edit-cyan: #23d7b3;
  --yz-edit-bg: rgba(4, 10, 9, .92);
  --yz-edit-line: rgba(214, 177, 94, .38);
}

.yz-edit-toolbar {
  position: fixed;
  left: 50%;
  top: 14px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  transform: translateX(-50%);
  border: 1px solid var(--yz-edit-line);
  background: var(--yz-edit-bg);
  color: #f6f2df;
  padding: 9px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, .38);
  backdrop-filter: blur(16px);
  font-family: "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 12px;
}

body.yz-edit-mode .yz-edit-toolbar { display: flex; }

.yz-edit-toolbar button {
  min-width: 40px;
  height: 32px;
  border: 1px solid rgba(166, 187, 178, .36);
  background: rgba(7, 21, 19, .94);
  color: #f6f2df;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

.yz-edit-toolbar button:hover,
.yz-edit-toolbar button:focus-visible {
  border-color: var(--yz-edit-gold);
  color: var(--yz-edit-gold);
  outline: none;
}

.yz-edit-toolbar button.is-active {
  border-color: var(--yz-edit-cyan);
  background: rgba(35, 215, 179, .16);
  color: var(--yz-edit-cyan);
}

.yz-edit-status {
  min-width: 156px;
  color: rgba(246, 242, 223, .74);
  text-align: center;
  white-space: nowrap;
}

.yz-editable {
  transform: translate(var(--yz-edit-x, 0px), var(--yz-edit-y, 0px));
}

body.yz-edit-mode .yz-editable {
  outline: 1px dashed rgba(214, 177, 94, .72);
  outline-offset: 5px;
}

body.yz-edit-mode .yz-editable[contenteditable="true"] { cursor: text; }

body.yz-edit-mode .yz-editable[contenteditable="true"]:focus {
  outline: 2px solid var(--yz-edit-gold);
  background: rgba(214, 177, 94, .09);
}

body.yz-edit-mode.yz-move-mode .yz-editable {
  cursor: move;
  outline: 1px solid rgba(35, 215, 179, .78);
  user-select: none;
  touch-action: none;
}

body.yz-edit-mode.yz-move-mode .yz-editable:focus { background: transparent; }

body.yz-edit-mode.yz-dragging .yz-editable.is-dragging {
  z-index: 20;
  outline: 2px solid var(--yz-edit-gold);
  background: rgba(35, 215, 179, .08);
}

.markdown-doc-shell {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 14% 6%, rgba(35, 215, 179, .1), transparent 26%),
    radial-gradient(circle at 86% 12%, rgba(214, 177, 94, .1), transparent 30%),
    #06100f;
  color: #f5f7f1;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.75;
}

.markdown-doc {
  width: min(1040px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.markdown-doc-header {
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(214, 177, 94, .34);
}

.markdown-doc-kicker {
  color: var(--yz-edit-cyan);
  font-family: "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.markdown-doc-title {
  margin: 10px 0 0;
  color: #f5f7f1;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.12;
}

.markdown-doc-content {
  color: #d4e1dc;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.markdown-doc-content h1,
.markdown-doc-content h2,
.markdown-doc-content h3 {
  color: #f5f7f1;
  line-height: 1.24;
  margin: 30px 0 12px;
}

.markdown-doc-content h1 { font-size: clamp(30px, 4vw, 48px); }
.markdown-doc-content h2 { font-size: clamp(24px, 3vw, 34px); }
.markdown-doc-content h3 { font-size: 22px; }

.markdown-doc-content p,
.markdown-doc-content ul,
.markdown-doc-content ol,
.markdown-doc-content pre,
.markdown-doc-content table { margin: 12px 0; }

.markdown-doc-content a {
  color: var(--yz-edit-gold);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-doc-content code {
  border: 1px solid rgba(214, 177, 94, .28);
  background: rgba(214, 177, 94, .08);
  color: #f0cf82;
  padding: 1px 5px;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-all;
}

.markdown-doc-content pre {
  overflow-x: auto;
  border: 1px solid rgba(168, 196, 184, .18);
  background: rgba(3, 8, 7, .72);
  padding: 14px;
}

.markdown-doc-content pre code {
  border: 0;
  background: transparent;
  color: #d4e1dc;
  padding: 0;
}

.markdown-doc-content blockquote {
  border-left: 3px solid var(--yz-edit-gold);
  color: #cdbf9f;
  margin: 18px 0;
  padding-left: 16px;
}

.markdown-doc-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown-doc-content th,
.markdown-doc-content td {
  border: 1px solid rgba(168, 196, 184, .18);
  padding: 8px 10px;
  vertical-align: top;
}

@media (max-width: 560px) {
  .yz-edit-toolbar {
    left: 12px;
    right: 12px;
    top: 10px;
    max-width: none;
    max-height: 42vh;
    flex-wrap: wrap;
    justify-content: center;
    overflow-y: auto;
    transform: none;
  }

  .yz-edit-toolbar button {
    min-width: 52px;
  }

  .yz-edit-status {
    flex: 1 0 100%;
    min-width: 0;
  }
}
