/* ComfyUI 提示词查看器 —— 样式 */
:root {
  --bg: #0f1115;
  --bg-soft: #141821;
  --panel: #171a21;
  --panel-2: #1e232c;
  --border: #2a303c;
  --border-soft: #232833;
  --text: #e8ecf3;
  --muted: #8a93a5;
  --accent: #7c6cff;
  --accent-soft: rgba(124, 108, 255, .14);
  --green: #4ec9b0;
  --red: #e5484d;
  --amber: #e5a548;
  --radius: 14px;
  --mono: "Cascadia Code", Consolas, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(124, 108, 255, .10), transparent 60%),
    radial-gradient(700px 350px at 0% 110%, rgba(78, 201, 176, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

/* ---------- 头部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(15, 17, 21, .82);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 14px; color: var(--accent); }
.logo h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.tagline { margin: 0; font-size: 12.5px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.privacy-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--green);
  border: 1px solid rgba(78, 201, 176, .35);
  background: rgba(78, 201, 176, .08);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}

/* ---------- 布局 ---------- */
.container { max-width: 1100px; width: 100%; margin: 0 auto; padding: 28px 20px 40px; flex: 1; }

/* ---------- 拖放区 ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
  color: var(--muted);
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dz-title { margin: 14px 0 4px; font-size: 16px; font-weight: 600; color: var(--text); }
.dz-sub { margin: 0; font-size: 13px; }
.dz-sub kbd {
  font-family: var(--mono); font-size: 11px; color: var(--text);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; background: var(--panel-2);
}
.dz-formats { margin: 10px 0 0; font-size: 12px; color: var(--muted); letter-spacing: 1px; }

.empty-hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13.5px;
  border-left: 3px solid var(--border);
  padding: 2px 0 2px 14px;
}

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: #fff; }
.btn-sm { padding: 3px 9px; font-size: 11.5px; border-radius: 6px; }
.btn-ghost { background: transparent; }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn.flash { border-color: var(--green); color: var(--green); }

/* ---------- 结果卡片 ---------- */
.results { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }
.results:not(:empty) + .site-footer { margin-top: 0; }

.card {
  display: grid;
  grid-template-columns: 300px 1fr;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  animation: cardIn .25s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card-img {
  background:
    linear-gradient(45deg, #1b1f28 25%, transparent 25%, transparent 75%, #1b1f28 75%),
    linear-gradient(45deg, #1b1f28 25%, #171a21 25%, #171a21 75%, #1b1f28 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
  display: flex; align-items: center; justify-content: center;
  min-height: 240px;
}
.card-img img { max-width: 100%; max-height: 420px; display: block; }

.card-body { padding: 16px 18px 18px; min-width: 0; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.title-box { min-width: 0; }
.filename {
  font-size: 14px; font-weight: 600;
  overflow-wrap: anywhere;
}
.sub { margin-top: 5px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  border: 1px solid transparent;
}
.badge-comfyui { color: var(--accent); background: var(--accent-soft); border-color: rgba(124,108,255,.4); }
.badge-a1111 { color: var(--green); background: rgba(78,201,176,.1); border-color: rgba(78,201,176,.4); }
.badge-novelai { color: var(--amber); background: rgba(229,165,72,.1); border-color: rgba(229,165,72,.4); }
.badge-workflow-only, .badge-unknown { color: var(--muted); background: var(--panel-2); border-color: var(--border); }
.badge-empty, .badge-error { color: var(--red); background: rgba(229,72,77,.1); border-color: rgba(229,72,77,.4); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 选项卡 ---------- */
.tabs {
  display: flex; gap: 4px; margin-top: 14px;
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}
.tab {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px; padding: 7px 12px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count {
  display: inline-block; min-width: 17px; text-align: center;
  margin-left: 5px; font-size: 10.5px;
  background: var(--panel-2); border-radius: 999px; padding: 0 4px;
}

.pane { display: none; padding-top: 14px; }
.pane.active { display: block; }

/* 提示词块 */
.prompt-block { margin-bottom: 14px; }
.prompt-block:last-child { margin-bottom: 4px; }
.prompt-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.prompt-title { font-size: 12.5px; color: var(--accent); font-weight: 600; overflow-wrap: anywhere; }
.prompt-title.neg { color: var(--red); }
.prompt-text {
  margin: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow-y: auto;
}

/* 参数表 */
.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px 18px;
  font-size: 13px;
}
.param { display: flex; gap: 8px; min-width: 0; padding: 4px 0; border-bottom: 1px dashed var(--border-soft); }
.param dt { color: var(--muted); flex-shrink: 0; }
.param dd { margin: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; }

/* 原始数据 */
details.raw {
  margin-bottom: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-soft);
}
details.raw summary {
  cursor: pointer; padding: 9px 14px;
  font-size: 12.5px; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  list-style: none;
}
details.raw summary::-webkit-details-marker { display: none; }
details.raw summary::before { content: "▸"; color: var(--muted); }
details.raw[open] summary::before { content: "▾"; }
details.raw summary .summary-actions { display: flex; gap: 6px; }
details.raw pre {
  margin: 0; padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 11.8px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 360px; overflow-y: auto;
  color: #c9d2e3;
}

.empty-note { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.notice {
  margin-top: 6px;
  font-size: 12.5px; color: var(--amber);
  background: rgba(229,165,72,.08);
  border: 1px solid rgba(229,165,72,.3);
  border-radius: 8px;
  padding: 8px 12px;
}

/* ---------- 页脚 / toast ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 18px 20px 26px;
  text-align: center;
  color: var(--muted); font-size: 12px;
}
.site-footer p { margin: 0; }

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  z-index: 99;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .card { grid-template-columns: 1fr; }
  .card-img { min-height: 0; }
  .card-img img { max-height: 320px; }
  .header-inner { padding: 12px 16px; }
  .container { padding: 20px 14px 32px; }
}
