:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1c1f2b;
  --muted: #6b7280;
  --line: #e6e8f0;
  --brand: #5b5bd6;
  --brand-soft: #eeeefc;
  --danger: #d9415a;
  --ok: #12886a;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(28, 31, 43, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #6a6ae8, #8f6ae8);
  color: #fff; font-weight: 700; font-size: 15px;
  display: grid; place-items: center;
}

.brand h1 { margin: 0; font-size: 17px; }
.brand p { margin: 0; font-size: 12.5px; color: var(--muted); }

.tabs { display: flex; gap: 6px; }

.tab {
  border: 0; background: transparent;
  padding: 8px 16px; border-radius: 999px;
  font-size: 14px; color: var(--muted); cursor: pointer;
  font-family: inherit;
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

main { max-width: 940px; margin: 24px auto; padding: 0 20px; }
.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card h3 { margin: 0 0 12px; font-size: 15px; }

textarea {
  width: 100%; min-height: 96px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-family: inherit; font-size: 14.5px;
  color: var(--text); background: #fbfbfd; outline: none;
}
textarea:focus { border-color: var(--brand); background: #fff; }

.paste-wrap { position: relative; }

.chip {
  position: absolute; right: 12px; top: 10px;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); color: var(--muted);
}
.chip.on { background: var(--brand-soft); color: var(--brand); }

.row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }

.btn {
  border: 1px solid transparent; border-radius: 9px;
  padding: 9px 20px; font-size: 14px; cursor: pointer;
  font-family: inherit; background: var(--brand-soft); color: var(--brand);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #4a4ac4; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn.ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn.text { background: transparent; color: var(--muted); padding-left: 4px; }
.btn.small { padding: 7px 14px; font-size: 13px; }

.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.advanced { display: none; margin-top: 12px; }
.advanced.open { display: block; }
.advanced label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.advanced textarea { min-height: 70px; font-size: 12.5px; }

.status {
  margin-top: 14px; font-size: 14px; white-space: pre-wrap;
  border-radius: 10px; padding: 0; display: none;
}
.status.show { display: block; }
.status.loading { color: var(--muted); }
.status.error { background: #fdecef; color: var(--danger); padding: 12px 14px; }
.status.ok { background: #e6f6f1; color: var(--ok); padding: 12px 14px; }

.result { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
.result-media video { width: 100%; border-radius: 10px; background: #000; }
.grid-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid-imgs img { width: 100%; border-radius: 8px; display: block; background: #eee; }
.result-info h2 { margin: 0 0 6px; font-size: 17px; }
.meta { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.meta span + span::before { content: "·"; margin: 0 8px; }

.raw { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.raw code { display: block; word-break: break-all; margin-top: 6px; background: var(--bg); padding: 8px 10px; border-radius: 8px; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.history li:hover { color: var(--brand); }
.history li.empty { color: var(--muted); cursor: default; border: 0; }
.history small { color: var(--muted); margin-right: 8px; }

.dropzone {
  border: 2px dashed var(--line); border-radius: 12px;
  padding: 28px; text-align: center; color: var(--muted);
  cursor: pointer; font-size: 14px;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.toolbar label { font-size: 13px; color: var(--muted); }
.toolbar label.inline { display: flex; align-items: center; gap: 6px; }
select, input[type="number"], input[type="color"] {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font-family: inherit; font-size: 13.5px; background: #fff; margin-left: 6px;
}
input[type="color"] { padding: 2px; width: 40px; height: 32px; }

.canvas-box {
  margin-top: 16px; border: 1px solid var(--line); border-radius: 12px;
  background: #fafbfe; min-height: 220px; display: grid; place-items: center; overflow: auto;
}
canvas { max-width: 100%; cursor: crosshair; display: block; }
.placeholder { color: var(--muted); font-size: 14px; padding: 40px; }

.notice { background: #fff7e8; border: 1px solid #f4dcae; color: #8a6212; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }
.notice code { background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; }

footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px 20px 28px; }

@media (max-width: 700px) {
  .result { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  main { padding: 0 14px; }
}
