/* =============== 基础色板：参考 wange.xyz/prompts-site（暖炭黑 + 暖白 + 青铜金） =============== */
:root {
  --bg: #0d0f10;
  --panel: #15181a;
  --panel-2: #1d2124;
  --border: rgba(232, 228, 218, 0.12);
  --text: #ece9e1;
  --muted: #94989b;
  --accent: #b89455;
  --accent-2: #898989;
  --accent-fav: #c7a15f;
  --accent-like: #b56f78;
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 18px 48px rgba(0, 0, 0, 0.46);
  --brand-gradient: linear-gradient(135deg, #454a4d 0%, #303438 58%, #5b4b34 100%);
}


html, body { margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body {
  background:
    radial-gradient(1100px 700px at -10% -10%, rgba(184, 148, 85, 0.08), transparent 55%),
    radial-gradient(900px 600px at 110% 20%, rgba(137,137,137,0.06), transparent 55%),
    var(--bg);
}

.tabs { display: flex; gap: 10px; margin: 20px 0 16px; flex-wrap: wrap; }
.tab { padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 14.5px; font-weight: 600; cursor: pointer; transition: .2s; }
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.active { color: #fff; background: var(--brand-gradient); border-color: transparent; box-shadow: var(--shadow-soft); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 17px; }
.card-head h3 { margin: 0; font-size: 15px; }
.hidden { display: none !important; }
.input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.input-row input[type="text"] {
  flex: 1 1 280px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 15px; outline: none; transition: .2s;
}
body { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* =============== Header =============== */
.header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; color: #fff;
  background: var(--brand-gradient); box-shadow: var(--shadow-soft);
}
.brand-text h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.brand-text .subtitle { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; transition: .2s; }
.back-link:hover { color: var(--accent); border-color: var(--accent); }

.hero-tip { margin: 6px 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.hero-tip b { color: var(--accent); font-weight: 600; }

/* =============== Theme switch =============== */
.input-row input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input-row select {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 14px; outline: none; cursor: pointer;
}
.input-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

/* =============== Buttons =============== */
.btn { padding: 11px 18px; border-radius: 10px; border: none; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: .2s; }
.btn.primary {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  color: color-mix(in srgb, var(--accent) 95%, #fff);
}
.btn.primary:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.ghost:hover { color: var(--accent); border-color: var(--accent); }
/* =============== Mandala grid (5x5) =============== */
.mandala-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mandala-cell {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 8px;
  text-align: center; font-size: 12.5px; line-height: 1.5; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; min-height: 52px; transition: .2s;
}
.mandala-cell.center {
  grid-column: 3; grid-row: 3; background: var(--brand-gradient); color: #fff; font-weight: 700;
  font-size: 15px; border-color: transparent; box-shadow: var(--shadow-soft);
}
.mandala-cell.inner { color: var(--accent); font-weight: 600; }
.mandala-cell.outer { color: var(--muted); }
.mandala-hint { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

/* =============== Brand grid (3x3) =============== */
.brand-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.brand-cell {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 8px;
  text-align: center; font-size: 12.5px; line-height: 1.5; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; min-height: 56px;
}
.brand-cell.inner { color: var(--accent); font-weight: 600; }
.brand-cell.center {
  grid-column: 3; grid-row: 3; background: var(--brand-gradient); color: #fff; font-weight: 700;
  font-size: 15px; border-color: transparent; box-shadow: var(--shadow-soft);
}
.brand-cell.outer { color: var(--muted); }
.brand-cell.clickable { cursor: pointer; }
.brand-cell.clickable:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.brand-cell.selected {
  border-color: var(--accent); color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel-2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.brand-cell.selected::after { content: "✓"; position: absolute; top: 2px; right: 6px; color: var(--accent); font-weight: 800; font-size: 12px; }
.brand-cell { position: relative; }
.brand-cell.editing {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent) !important;
  background: var(--panel-2) !important;
  outline: none;
}
.brand-cell.empty { border-color: transparent; background: transparent; }

/* =============== Topic list =============== */
.topic-list { display: flex; flex-direction: column; gap: 10px; }
.topic-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); transition: .2s;
}
.topic-item:hover { border-color: var(--accent); }
.topic-num { flex: 0 0 26px; height: 26px; border-radius: 8px; background: var(--brand-gradient); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.topic-body { flex: 1; }
.topic-title { font-size: 15px; font-weight: 600; line-height: 1.6; margin-bottom: 4px; }
.topic-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11.5px; color: color-mix(in srgb, var(--accent) 80%, var(--muted)); background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border)); border-radius: 6px; padding: 2px 8px; }
.topic-actions { display: flex; flex-direction: column; gap: 6px; }
.icon-btn {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; transition: .2s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn.faved { color: var(--accent-fav); border-color: var(--accent-fav); }
.count-badge { font-size: 12px; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 2px 10px; }

/* =============== Favorites =============== */
.favs-block { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border); }
.favs-block h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; }
.empty-tip { color: var(--muted); font-size: 13px; margin: 8px 0; }

/* =============== Structure list =============== */
.structure-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.structure-list li { font-size: 14px; line-height: 1.7; color: var(--text); }
.structure-list li::marker { color: var(--accent); font-weight: 700; }

/* =============== Footer =============== */
.footer { border-top: 1px solid var(--border); padding: 22px 0 34px; margin-top: 30px; }
.footer p { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.footer a { color: var(--accent); text-decoration: none; }

/* =============== Toast =============== */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; opacity: 0; transition: .3s; z-index: 100; box-shadow: var(--shadow-strong); pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* =============== Responsive =============== */
@media (max-width: 640px) {
  .mandala-cell { font-size: 11px; padding: 8px 4px; min-height: 44px; }
  .brand-cell { font-size: 11px; }
  .input-row select { flex: 1 1 100%; }
  .container { padding: 0 14px; }
  .header-top { padding-top: 10px; }
}

.mandala-cell.clickable { cursor: pointer; }
.mandala-cell.clickable:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.mandala-cell.selected {
  border-color: var(--accent); color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel-2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.mandala-cell.selected::after { content: "✓"; position: absolute; top: 2px; right: 6px; color: var(--accent); font-weight: 800; font-size: 12px; }
.mandala-cell { position: relative; }

/* 外圈人群/场景区分 */
.mandala-cell.people { color: var(--muted); }
.mandala-cell.people::before { content: "👥 "; }
.mandala-cell.people.selected, .mandala-cell.scene.selected {
  border-color: var(--accent); color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel-2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.mandala-cell.people.selected::after, .mandala-cell.scene.selected::after { color: var(--accent); }
.mandala-cell.scene { color: var(--muted); }
.mandala-cell.scene::before { content: "🎬 "; }


/* 抽奖滚动复用到盘格 */
.mandala-cell.rolling {
  border-color: var(--accent-fav) !important;
  color: var(--text) !important;
  background: color-mix(in srgb, var(--accent-fav) 22%, var(--panel-2)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-fav) 30%, transparent), 0 0 18px color-mix(in srgb, var(--accent-fav) 40%, transparent);
  transform: scale(1.05);
  z-index: 2;
}
.mandala-cell.rolling::after { content: ""; }

/* 盘提示配色 */
.mandala-hint .c-inner, .mandala-hint .c-people, .mandala-hint .c-scene { color: var(--accent); }

/* =============== POV 模板输出 =============== */
.pov-out {
  margin: 0; padding: 14px 16px; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Microsoft YaHei", monospace;
  font-size: 13px; line-height: 1.8; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  max-height: 320px; overflow-y: auto;
}

/* 已选状态计数 */
.pick-status {
  font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; align-self: center;
  letter-spacing: .02em;
}
.pick-status b { color: var(--accent); font-weight: 700; }

/* 可编辑格子 */
.mandala-cell.editable { cursor: text; }
.mandala-cell.editing {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent) !important;
  background: var(--panel-2) !important;
  outline: none;
}
.mandala-cell.clickable::after { content: ""; }

/* 自定义模板输入 */
.custom-tpl { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.custom-tpl label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.custom-tpl textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 13.5px; line-height: 1.6;
  outline: none; resize: vertical; font-family: inherit; transition: .2s;
}
.custom-tpl textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
