/* ============ Tell Me Prompt · styles ============ */
:root {
  --bg: #f5f6fb;
  --ink: #1e2233;
  --ink-2: #5b6175;
  --ink-3: #9aa0b4;
  --line: #e7e9f2;
  --card: #ffffff;
  --brand: #635bff;
  --brand-2: #8b5cf6;
  --brand-soft: #efeeff;
  --ok: #12b76a;
  --warn: #f79009;
  --danger: #f04438;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(31, 41, 74, .08);
  --shadow-sm: 0 2px 8px rgba(31, 41, 74, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
textarea, input { font-family: inherit; }

/* ---------- 背景装饰 ---------- */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.b1 { width: 420px; height: 420px; background: #c7d2fe; top: -160px; left: -120px; }
.b2 { width: 380px; height: 380px; background: #fbcfe8; top: 20%; right: -140px; }
.b3 { width: 340px; height: 340px; background: #bae6fd; bottom: -160px; left: 30%; }

/* ---------- 顶栏 ---------- */
.topbar {
  max-width: 1120px; margin: 0 auto; padding: 18px 22px 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  font-size: 30px; filter: drop-shadow(0 4px 8px rgba(99, 91, 255, .3));
  animation: float 3.2s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 18px; letter-spacing: .2px; }
.brand-text small { color: var(--ink-3); font-size: 12px; }
.nav { display: flex; gap: 6px; background: #fff; padding: 5px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.nav a {
  padding: 7px 16px; border-radius: 999px; font-size: 14px; color: var(--ink-2);
  transition: all .18s;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand); }
.nav a.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 12px rgba(99, 91, 255, .35); }

/* ---------- 布局 ---------- */
.view { max-width: 1120px; margin: 0 auto; padding: 18px 22px 60px; }
.footer {
  text-align: center; color: var(--ink-3); font-size: 12px; padding: 22px 0 34px;
  display: flex; flex-direction: column; gap: 5px;
}
.footer b { color: var(--ink-2); font-weight: 600; }
.footer-theme { color: var(--brand); font-weight: 600; font-size: 12.5px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; margin-bottom: 18px; border: 1px solid rgba(231, 233, 242, .8);
}

/* ---------- 主旨 Hero ---------- */
.hero-card {
  display: flex; align-items: center; gap: 18px;
  border-radius: 22px; padding: 24px 28px; margin-bottom: 18px;
  background: linear-gradient(120deg, #635bff 0%, #8b5cf6 45%, #ec4899 100%);
  color: #fff; box-shadow: 0 14px 36px rgba(99, 91, 255, .3);
  position: relative; overflow: hidden;
}
.hero-card::after {
  content: ""; position: absolute; right: -50px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%);
}
.hero-emoji { font-size: 42px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.18)); animation: float 3.4s ease-in-out infinite; }
.hero-title { font-size: 19px; font-weight: 700; letter-spacing: .3px; margin-bottom: 5px; }
.hero-sub { font-size: 13.5px; line-height: 1.75; opacity: .92; }
.card h2 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 14px; }

/* ---------- 场景选择 ---------- */
.scenario-tabs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.scenario-tab {
  flex: 0 0 auto; border: 1.5px solid var(--line); background: #fff; border-radius: 14px;
  padding: 10px 16px; font-size: 14px; color: var(--ink-2);
  display: flex; align-items: center; gap: 7px; transition: all .18s;
}
.scenario-tab:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: #c7d2fe; }
.scenario-tab.active {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 18px rgba(99, 91, 255, .35);
}
.scenario-tab .emoji { font-size: 17px; }

/* ---------- 输入区 ---------- */
.compose-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 920px) { .compose-grid { grid-template-columns: 1fr 1fr; align-items: start; } .preview-sticky { position: sticky; top: 14px; } }
.idea-textarea {
  width: 100%; min-height: 150px; resize: vertical; border: 1.5px solid var(--line);
  border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.75;
  color: var(--ink); background: #fbfbff; outline: none; transition: border-color .18s, box-shadow .18s;
}
.idea-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 91, 255, .12); background: #fff; }
.idea-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--ink-3); font-size: 12.5px; }

/* ---------- 气泡云 ---------- */
.bubble-groups { display: flex; flex-direction: column; gap: 16px; }
.bubble-group h3 {
  margin: 0 0 9px; font-size: 12.5px; color: var(--ink-3); font-weight: 600;
  letter-spacing: 1px; display: flex; align-items: center; gap: 7px;
}
.bubble-group h3::after { content: ""; flex: 1; height: 1px; background: dashed var(--line); }
.bubbles { display: flex; flex-wrap: wrap; gap: 9px; }
.bubble {
  --h: 245; --s: 70%;
  position: relative; border: 1.5px solid hsl(var(--h) var(--s) 82%);
  background: hsl(var(--h) var(--s) 96%);
  color: hsl(var(--h) 55% 38%);
  border-radius: 999px; padding: 7px 15px 7px 14px; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .15s, box-shadow .15s, background .18s, color .18s;
  box-shadow: 0 1px 2px rgba(31, 41, 74, .05);
  max-width: 100%;
}
.bubble .dot { width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--h) var(--s) 65%); flex: 0 0 auto; }
.bubble:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 6px 14px hsla(var(--h), var(--s), 60%, .25); z-index: 1; }
.bubble:active { transform: translateY(0) scale(.98); }
.bubble.on {
  background: hsl(var(--h) var(--s) 55%); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px hsla(var(--h), var(--s), 50%, .4);
}
.bubble.on .dot { background: #fff; }
.bubble.on::after {
  content: "✓"; font-size: 11px; font-weight: 700; margin-left: 1px;
}
.bubble .b-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble[title] { cursor: help; }
.bubble { cursor: pointer; }
.group-count { color: var(--brand); font-weight: 600; }

/* ---------- 预览 ---------- */
.preview-card { background: linear-gradient(180deg, #fff, #fcfcff); }
.prompt-preview {
  background: #1e2233; color: #e8e9f3; border-radius: 14px; padding: 16px 18px;
  font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow-y: auto;
  font-family: "SF Mono", "JetBrains Mono", Consolas, "PingFang SC", monospace;
}
.prompt-preview .seg-prefix { color: #a5b4fc; }
.prompt-preview .seg-suffix { color: #fcd34d; }
.prompt-preview .seg-body { color: #e8e9f3; }
.prompt-preview .seg-empty { color: #6b7089; font-style: italic; }
.prompt-meta { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 2px 0; color: var(--ink-3); font-size: 12.5px; }
.prompt-meta b { color: var(--ink-2); font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 12px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; transition: all .16s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(99, 91, 255, .32); }
.btn-primary:hover { box-shadow: 0 10px 22px rgba(99, 91, 255, .4); }
.btn-ok { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #fecdca; background: #fff5f4; }
.btn-danger:hover { background: #fee4e2; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }

/* ---------- 提示词库 ---------- */
.lib-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.text-input {
  border: 1.5px solid var(--line); border-radius: 11px; padding: 9px 14px; font-size: 14px;
  background: #fff; outline: none; color: var(--ink); transition: border-color .16s;
}
.text-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 91, 255, .1); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.prompt-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  transition: all .18s; cursor: pointer; display: flex; flex-direction: column; gap: 9px;
}
.prompt-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.prompt-card .pc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prompt-card .pc-scene { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.prompt-card .pc-time { font-size: 11.5px; color: var(--ink-3); }
.prompt-card .pc-title { font-weight: 700; font-size: 15px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prompt-card .pc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip { font-size: 11.5px; color: var(--ink-2); background: #f2f3f9; padding: 2px 9px; border-radius: 999px; }
.empty { text-align: center; color: var(--ink-3); padding: 70px 20px; }
.empty .big { font-size: 46px; margin-bottom: 10px; }

/* ---------- 后台 ---------- */
.admin-login { max-width: 400px; margin: 40px auto; }
.admin-login .lock { font-size: 40px; text-align: center; }
.admin-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-item {
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px;
  display: flex; align-items: center; gap: 8px; font-size: 14px;
}
.admin-item.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.admin-item .ai-name { flex: 1; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { border: none; background: transparent; color: var(--ink-3); font-size: 13px; padding: 3px 6px; border-radius: 7px; }
.icon-btn:hover { background: #eef0f8; color: var(--ink); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.form-row .text-input, .form-row textarea { width: 100%; }
.form-row textarea {
  border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 13px; font-size: 13.5px;
  outline: none; background: #fff; color: var(--ink); resize: vertical; line-height: 1.7;
}
.form-row textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 91, 255, .1); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kw-group-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fbfbff; }
.kw-group-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.kw-group-head .text-input { flex: 1; }
.kw-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; margin-bottom: 8px; align-items: start; }
.kw-row textarea { min-height: 38px; height: 38px; }
.dirty-banner {
  display: none; align-items: center; gap: 10px; background: #fffaeb; border: 1px solid #fedf89;
  color: #b54708; border-radius: 12px; padding: 10px 16px; margin-bottom: 14px; font-size: 13.5px;
}
.dirty-banner.show { display: flex; }
.git-log { font-family: Consolas, monospace; font-size: 12.5px; background: #f8f9fd; border-radius: 10px; padding: 12px 14px; max-height: 260px; overflow: auto; }
.git-log .gl-row { display: flex; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.git-log .gl-hash { color: var(--brand); font-weight: 700; }
.git-log .gl-time { color: var(--ink-3); }
.badge-new { background: #ecfdf3; color: #027a48; font-size: 11px; padding: 1px 7px; border-radius: 999px; }

/* ---------- 弹窗 / Toast ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(24, 28, 46, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px); animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.28);
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .18s;
}
.modal.modal-lg { max-width: 820px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 18px 22px 8px; display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: none; background: #f2f3f9; width: 30px; height: 30px; border-radius: 50%; color: var(--ink-2); font-size: 15px; }
.modal-close:hover { background: #e6e8f4; }
.modal-body { padding: 8px 22px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.raw-view {
  background: #1e2233; color: #d7d9e8; border-radius: 12px; padding: 16px; font-size: 12.5px;
  line-height: 1.7; white-space: pre-wrap; word-break: break-word; max-height: 55vh; overflow: auto;
  font-family: Consolas, "SF Mono", monospace;
}
.raw-view .rv-fm { color: #7dd3fc; }
.toasts { position: fixed; top: 18px; right: 18px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.14);
  padding: 12px 18px; font-size: 13.5px; display: flex; gap: 9px; align-items: center;
  border-left: 4px solid var(--brand); animation: slidein .2s; max-width: 380px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.out { transition: all .3s; opacity: 0; transform: translateX(30px); }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
