/* ── MD → PNG 卡片生成器 — 样式 ──────────────────────── */

:root {
  --bg: #f9f7f5;
  --surface: #ffffff;
  --text: #2c2c2c;
  --text-muted: #8a8a8a;
  --border: #e5e0dc;
  --accent: #d9774f;
  --accent-hover: #c7663f;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────── */

.tool-header {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 16px;
}

.home-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.home-link:hover { color: var(--accent); }

.tool-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 12px;
  letter-spacing: -0.02em;
}
.tool-header h1 .arrow {
  color: var(--accent);
  font-weight: 300;
  margin: 0 2px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ── Main body ───────────────────────────────────────── */

.tool-body {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  flex: 1;
}

@media (max-width: 720px) {
  .tool-body {
    grid-template-columns: 1fr;
  }
}

/* ── Panels ──────────────────────────────────────────── */

.input-panel,
.output-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ── Editor ──────────────────────────────────────────── */

.md-editor {
  width: 100%;
  min-height: 360px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.md-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217,119,79,0.12);
}

.md-editor::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

/* ── Input actions ───────────────────────────────────── */

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Theme picker ────────────────────────────────────── */

.theme-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.theme-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: all 0.15s;
}

.theme-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-card.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(217, 119, 79, 0.06);
  font-weight: 600;
}

.theme-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.swatch-warm    { background: linear-gradient(135deg, #faf7f2, #d9774f); }
.swatch-cool    { background: linear-gradient(135deg, #f4f8fc, #3182ce); }
.swatch-dark    { background: linear-gradient(135deg, #1a1a2e, #fbbf24); }
.swatch-minimal { background: linear-gradient(135deg, #ffffff, #e5e5e5); }

/* ── Size picker ─────────────────────────────────────── */

.size-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-top: 4px;
}

.size-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.15s;
}

.size-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.size-card.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(217, 119, 79, 0.06);
  font-weight: 600;
}

.size-label {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.size-label .size-name {
  font-size: 0.72rem;
  opacity: 0.75;
}

.size-shape {
  display: inline-block;
  background: currentColor;
  opacity: 0.55;
  border-radius: 2px;
  flex-shrink: 0;
}
.size-shape-og       { width: 18px; height: 10px; }
.size-shape-square   { width: 12px; height: 12px; }
.size-shape-portrait { width: 10px; height: 12px; }
.size-shape-story    { width: 8px;  height: 14px; }

.presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 2px;
}

.preset-btn {
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(217,119,79,0.04);
}

/* ── Buttons ─────────────────────────────────────────── */

.btn-primary,
.btn-secondary {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(217,119,79,0.3);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(217,119,79,0.05);
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Preview ─────────────────────────────────────────── */

.preview-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.placeholder-icon {
  width: 120px;
  height: 80px;
  opacity: 0.5;
}

.placeholder-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.svg-preview-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.svg-preview-wrapper svg {
  display: block;
  max-width: 100%;
}

/* ── Loading ─────────────────────────────────────────── */

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-ring {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Output actions ──────────────────────────────────── */

.output-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.output-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-text {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.btn-text:hover {
  color: var(--accent);
}

.status-msg {
  font-size: 0.8rem;
  padding: 4px 0;
}

.status-loading { color: var(--text-muted); }
.status-success { color: #3b8c4a; }
.status-error { color: #c44d4d; }

/* ── Footer ──────────────────────────────────────────── */

.tool-footer {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 36px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tool-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tool-footer a:hover {
  color: var(--accent);
}

.dot {
  margin: 0 6px;
  opacity: 0.4;
}
