:root { --bg:#0f1020; --card:#fff; --line:#e3e6ea; --ink:#1f2329; --muted:#6b7280;
        --brand:#7c3aed; --brand2:#0ea5e9; --ok:#16a34a; --warn:#d97706; --danger:#dc2626;
        --vn-bg1:#1b1530; --vn-bg2:#2a1f3d; --vn-ink:#f3e9d2; --vn-accent:#e8b04b; }
* { box-sizing:border-box; }
body { margin:0; font-family:-apple-system,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei",sans-serif;
       background:var(--bg); color:var(--ink); }
header { background:linear-gradient(90deg,var(--brand),var(--brand2)); color:#fff; padding:14px 20px;
         display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
header h1 { font-size:18px; margin:0; }
.me { font-size:13px; display:flex; gap:14px; align-items:center; flex-wrap:wrap; }
.me b { font-weight:600; }
.badge { background:rgba(255,255,255,.22); padding:2px 8px; border-radius:999px; font-size:12px; }
.wrap { max-width:1100px; margin:18px auto; padding:0 16px; display:grid;
        grid-template-columns:1fr 1fr; gap:16px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; }
h2 { font-size:15px; margin:0 0 12px; }
h3 { font-size:14px; margin:14px 0 8px; }
textarea, input[type=text] { width:100%; border:1px solid var(--line); border-radius:8px;
        padding:10px; font-size:14px; resize:vertical; font-family:inherit; }
button { cursor:pointer; border:none; border-radius:8px; padding:9px 14px; font-size:14px;
         background:var(--brand); color:#fff; transition:.15s; }
button:hover { filter:brightness(1.08); }
button.primary { background:linear-gradient(90deg,var(--brand),#a855f7); }
button.ghost { background:#eef0f3; color:var(--ink); }
button.ghost:hover { background:#e3e6ea; }
button.danger { background:var(--danger); }
button.sm { padding:5px 10px; font-size:12px; }
.row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.muted { color:var(--muted); font-size:12px; }
.pill { display:inline-block; background:#eef2ff; color:var(--brand); border-radius:999px;
        padding:2px 10px; font-size:12px; margin:2px; }
.grid2 { grid-column:1 / -1; }
.outline-preview { font-size:13px; line-height:1.6; max-height:320px; overflow:auto; background:#fbfcfe;
                   border:1px solid var(--line); border-radius:8px; padding:12px; }
.toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background:#1f2329; color:#fff;
         padding:10px 16px; border-radius:8px; font-size:13px; opacity:0; transition:.25s; pointer-events:none; z-index:60; }
.toast.show { opacity:1; }
.paywall { background:#fef2f2; border:1px solid #fecaca; border-radius:8px; padding:12px; margin:8px 0; }
ul.share { list-style:none; padding:0; margin:0; }
ul.share li { padding:10px; border:1px solid var(--line); border-radius:8px; margin:6px 0; }
.ledger { font-size:12px; color:var(--muted); max-height:180px; overflow:auto; }
.ledger div { padding:3px 0; border-bottom:1px dashed var(--line); }
.modal-bg { position:fixed; inset:0; background:rgba(0,0,0,.35); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal { background:#fff; border-radius:12px; padding:20px; width:min(440px,92vw); max-height:86vh; overflow:auto; }
.modal h2 { margin-bottom:14px; }
.shareurl { width:100%; font-size:12px; padding:8px; border:1px solid var(--line); border-radius:8px; }

/* ===== 游戏化：游玩器 HUD ===== */
.player-card { display:flex; flex-direction:column; }
.player-head { display:flex; align-items:center; justify-content:space-between; }
.dbg-btn { background:#27243a; color:#cdb4ff; border:1px solid #3a3358; }
.dbg-btn:hover { background:#322c4d; }
.hud { display:flex; gap:10px; flex-wrap:wrap; background:#f7f5ff; border:1px solid #e6e0ff;
       border-radius:8px; padding:8px 10px; margin:0 0 10px; }
.hud-item { display:flex; flex-direction:column; gap:2px; min-width:64px; }
.hud-k { font-size:11px; color:var(--muted); }
.hud-v { font-size:13px; font-weight:600; }
.tbar { display:inline-block; width:70px; height:8px; background:#e3e6ea; border-radius:999px; overflow:hidden; vertical-align:middle; }
.tbar-fill { display:block; height:100%; background:linear-gradient(90deg,#fbbf24,#dc2626); }

/* ===== 视觉小说故事卡 ===== */
.vn { background:linear-gradient(160deg,var(--vn-bg1),var(--vn-bg2)); border-radius:12px;
      padding:14px; color:var(--vn-ink); box-shadow:inset 0 0 40px rgba(0,0,0,.35); }
.scene-card { margin:10px 0; animation:fade .4s ease; }
.scene-chapter { font-size:13px; color:var(--vn-accent); letter-spacing:.5px; margin-bottom:6px;
                 border-left:3px solid var(--vn-accent); padding-left:8px; }
.tension-tag { color:#c9a24b; font-size:11px; margin-left:8px; opacity:.85; }
.scene-text { font-family:"Georgia","Songti SC","SimSun",serif; font-size:15px; line-height:1.9;
              white-space:pre-wrap; color:var(--vn-ink); text-shadow:0 1px 2px rgba(0,0,0,.4); }
.choice-card { background:rgba(255,255,255,.06); border:1px solid rgba(232,176,75,.4); border-radius:10px;
               padding:12px; margin:12px 0; animation:fade .4s ease; }
.choice-card.chosen { border-color:#4ade80; background:rgba(74,222,128,.08); }
.choice-prompt { font-size:14px; color:#ffe9bf; margin-bottom:10px; }
.choice-options { display:flex; flex-direction:column; gap:8px; }
.opt { display:flex; align-items:center; gap:10px; width:100%; text-align:left; background:rgba(255,255,255,.04);
       color:var(--vn-ink); border:1px solid rgba(255,255,255,.16); border-radius:8px; padding:10px 12px; font-size:14px;
       transition:.15s; }
.opt:hover { border-color:var(--vn-accent); background:rgba(232,176,75,.14); transform:translateX(3px); box-shadow:0 0 12px rgba(232,176,75,.25); }
.opt-key { display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; flex:none;
           border-radius:6px; background:var(--vn-accent); color:#2a1f3d; font-weight:700; font-size:13px; }
.opt-label { flex:1; }
.choice-made { font-size:13px; color:#bbf7d0; }
.vn-actions { display:flex; gap:8px; margin-top:12px; }
.vn-actions .primary { background:linear-gradient(90deg,var(--brand),#a855f7); }
.turn-meta { font-size:12px; color:#c9b8ff; margin-top:8px; text-align:right; }

@keyframes fade { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ===== 调试日志面板 ===== */
.debug-panel { position:fixed; left:0; right:0; bottom:0; background:#15131f; color:#d6d3e0;
               border-top:2px solid #3a3358; z-index:55; font-family:"SFMono-Regular",Consolas,monospace; font-size:12px; }
.debug-panel.collapsed { transform:translateY(calc(100% - 34px)); transition:transform .2s; }
.debug-panel:not(.collapsed) { transform:translateY(0); transition:transform .2s; }
.debug-head { display:flex; align-items:center; justify-content:space-between; padding:6px 12px;
              background:#211d33; color:#cdb4ff; height:34px; cursor:default; }
.debug-log { max-height:210px; overflow:auto; padding:6px 12px 12px; }
.dbg-line { padding:2px 0; border-bottom:1px solid rgba(255,255,255,.05); white-space:pre-wrap; word-break:break-all; }
.dbg-engine { color:#7dd3fc; }
.dbg-bill { color:#fbbf24; }
.dbg-ui { color:#c4b5fd; }
.dbg-outline { color:#86efac; }
.dbg-play { color:#f0abfc; }
.dbg-error { color:#fca5a5; }
