
:root {
  --ab:       #0071e3;
  --ab-dark:  #0058b0;
  --ag:       #34c759;
  --g1:       #1d1d1f;
  --g2:       #6e6e73;
  --g3:       #aeaeb2;
  --g4:       #d1d1d6;
  --g5:       #e5e5ea;
  --g6:       #f2f2f7;
  --surface:  #f5f5f7;
  --card:     #ffffff;
  --radius:   6px;
  --mono:     'SF Mono',SFMono-Regular,Menlo,Consolas,monospace;
  --ease:     cubic-bezier(.25,.46,.45,.94);
}

body {
    padding-top: 98px;
    margin: 0;
    font-size: 14px;
    font-family: Dosis,Open Sans,pingfang SC,helvetica neue,arial,hiragino sans gb,microsoft yahei ui,microsoft yahei,simsun,sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 2em;
    background-color: #F5F5FB;
    color: #333;
}
}
.navbar {
    height: 80px !important;
}
.runoob-page-content {
    margin: 0 20px;
    border-radius: 2rem;
    box-shadow: 0 5px 15px 2px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05);
	margin-top: 40px;
}



/* ── 工具区整体 (内嵌视窗布局) ── */
#md2img-tool {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', sans-serif;
  /* 修复：使用相对视口高度，并设置最小/最大值，确保不撑破/覆盖网页 */
  height: 88vh; 
  min-height: 650px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
}

#md2img-tool .card {
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--g4);
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
  border-radius: 12px;
  overflow: hidden;
}

/* ── 顶部工具栏 (Header) ── */
#md2img-tool .card-header {
  background: var(--card);
  border-bottom: 1px solid var(--g5);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  z-index: 100;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 菜单定制 */
.dropdown-menu-custom {
  min-width: 300px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--g4);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  margin-top: 8px !important;
}
.dropdown-section-title {
  font-size: 12px; font-weight: 700; color: var(--g3);
  margin-bottom: 12px; margin-top: 16px; display: block;
}
.dropdown-section-title:first-child { margin-top: 0; }

/* ── 控制控件 (放入下拉菜单) ── */
.ctrl-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.ctrl-input {
  flex: 1; padding: 6px 10px; border: 1px solid var(--g4);
  border-radius: var(--radius); font-size: 13px; outline: none;
}
.ctrl-input:focus { border-color: var(--ab); }
.ctrl-range {
  flex: 1; height: 4px; border-radius: 2px; background: var(--g4); appearance: none; outline: none;
}
.ctrl-range::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ab); cursor: pointer;
}
.range-val { font-size: 12px; color: var(--g2); min-width: 32px; text-align: right; }

/* 主题色板 */
.theme-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--g4); cursor: pointer; position: relative;
}
.theme-swatch.active { box-shadow: 0 0 0 2px var(--ab); }
.theme-swatch::after {
  content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; 
  justify-content: center; font-size: 10px; color: #fff; opacity: 0;
}
.theme-swatch.active::after { opacity: 1; }

/* 自定义选色器 */
.color-picker-wrap {
  width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--g4);
  cursor: pointer; background: conic-gradient(red,#ff0,lime,aqua,blue,#f0f,red);
  position: relative; flex-shrink: 0; transition: transform .15s;
}
.color-picker-wrap input[type="color"] {
  position: absolute; inset: -50%; width: 200%; height: 200%; opacity: 0; cursor: pointer;
}

/* 字体选择 */
.font-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.font-card {
  padding: 6px; border: 1px solid var(--g4); border-radius: var(--radius);
  cursor: pointer; text-align: center; font-size: 13px; color: var(--g2);
}
.font-card.active { border-color: var(--ab); color: var(--ab); background: rgba(0,113,227,.05); }

/* ── 主体工作区 (Body) ── */
#md2img-tool .card-body {
  display: flex;
  flex: 1;
  padding: 0;
  overflow: hidden; /* 这里保留hidden，让滚动条只出现在编辑区和预览区内部 */
  background: var(--surface);
}

/* 左侧编辑器 */
.editor-pane {
  flex: 1;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--g4);
  background: #fff;
}
.editor-pane .EasyMDEContainer {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
.editor-pane .CodeMirror {
  flex: 1; border: none; font-size: 14px; border-radius: 0;
}
.editor-pane .editor-toolbar {
  border: none; border-bottom: 1px solid var(--g5); border-radius: 0;
  background: var(--g6); padding: 5px 10px;
}
.editor-toolbar button.table { width: auto !important; }

/* 右侧预览区 */
.preview-pane {
  flex: 1;
  background-image: radial-gradient(var(--g4) 1px, transparent 1px);
  background-position: 0 0, 25px 25px;
  background-size: 50px 50px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow: auto;
  position: relative;
}

/* 预览缩放控制 */
.preview-controls {
  position: absolute; top: 15px; right: 20px;
  display: flex; gap: 5px; z-index: 10;
}
.preview-ctrl-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--g4);
  background: rgba(255,255,255,.9); cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 12px; color: var(--g2);
}
.preview-ctrl-btn:hover { background: #fff; color: var(--g1); }

/* ── 卡片渲染区 (Capture) ── */
#card-capture {
  position: relative; padding: 40px; transition: transform .2s var(--ease);
  box-shadow: 0 12px 40px rgba(0,0,0,.15); width: 600px; max-width: 100%; transform-origin: top center;
}
.card-content {
  background: rgba(255,255,255,.95); border-radius: 12px; padding: 30px 36px;
  position: relative; min-height: 200px;
}
/* Mac 窗口点 */
.mac-dots { display: flex; gap: 7px; margin-bottom: 18px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red { background: #ff5f56; } .dot-yellow { background: #ffbd2e; } .dot-green { background: #27c93f; }

/* Markdown 内容样式 */
.markdown-body { color: #333; line-height: 1.7; font-size: 15px; }
.markdown-body h1,.markdown-body h2,.markdown-body h3 { margin-top: 1.2em; margin-bottom: .6em; font-weight: 700; color: #111; }
.markdown-body h1 { font-size: 1.7em; border-bottom: 1px solid #eaecef; padding-bottom: 6px; }
.markdown-body p { margin-bottom: 1em; }
.markdown-body blockquote { border-left: 4px solid var(--ab); background: rgba(0,113,227,.05); padding: 10px 15px; margin: 0 0 1em; color: #555; }
.markdown-body code { background: #f0f0f0; color: #d63384; padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: .9em; }
.markdown-body pre { background: #1e1e2e; color: #cdd6f4; padding: 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 1em; }
.markdown-body pre code { background: transparent; color: inherit; padding: 0; }
.markdown-body img { max-width: 100%; border-radius: 6px; }
.markdown-body table { width: 100%; margin-bottom: 1em; border-collapse: collapse; }
.markdown-body th,.markdown-body td { padding: 8px 12px; border: 1px solid #dfe2e5; }
.markdown-body th { background: #f6f8fa; }

/* 卡片底部 */
.card-footer-info {
  margin-top: 24px; padding-top: 16px; border-top: 1px dashed rgba(0,0,0,.15);
  display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #888;
}
.author-box { display: flex; align-items: center; gap: 8px; }
.author-avatar {
  width: 28px; height: 28px; background: var(--ab); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
}
.card-watermark {
  position: absolute; bottom: 12px; right: 20px; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.8); text-shadow: 0 1px 2px rgba(0,0,0,0.2); letter-spacing: 1px;
}

/* 主题定义 */
.theme-silver  { background: linear-gradient(135deg,#f5f7fa 0%,#c3cfe2 100%); }
.theme-ocean   { background: linear-gradient(135deg,#667eea 0%,#764ba2 100%); }
.theme-sunset  { background: linear-gradient(120deg,#f6d365 0%,#fda085 100%); }
.theme-mint    { background: linear-gradient(120deg,#84fab0 0%,#8fd3f4 100%); }
.theme-dark    { background: linear-gradient(to right,#434343 0%,#000 100%); }
.theme-rose    { background: linear-gradient(135deg,#f093fb 0%,#f5576c 100%); }
.theme-forest  { background: linear-gradient(135deg,#0f9b58 0%,#00bf8f 100%); }
.theme-aurora  { background: linear-gradient(135deg,#4facfe 0%,#00f2fe 50%,#43e97b 100%); }
.theme-charcoal{ background: linear-gradient(135deg,#2c3e50 0%,#4a6741 100%); }

/* 暗色主题字体处理 */
.theme-dark .card-content, .theme-charcoal .card-content { background: rgba(30,30,32,.95); }
.theme-dark .markdown-body, .theme-charcoal .markdown-body { color: #d1d5db; }
.theme-dark .markdown-body h1, .theme-dark .markdown-body h2, .theme-charcoal .markdown-body h1 { color: #fff; border-color: #444; }

/* Toast */
#md2img-toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.md2img-toast { padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: toastIn .2s ease forwards; }
.toast-success { background: var(--ag); }
.toast-error { background: var(--ar); }
@keyframes toastIn { from{transform:translateY(10px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes toastOut { to{transform:translateY(-10px);opacity:0} }

@media (max-width: 768px) {
  #md2img-tool .card-body { flex-direction: column; }
  .editor-pane { max-width: 100%; height: 50vh; border-right: none; border-bottom: 1px solid var(--g4); }
  .preview-pane { height: 50vh; }
  #md2img-tool { height: auto; min-height: 100vh; }
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    color: #333;
    text-align: center;
}