/* AI 杀人游戏竞技场 — 深夜推理综艺（D34/D35/D37）
   D37 定位（功能出发）：观战页 = 深夜点播影院（UI 退场，颜色只来自卡司与事件）；
                        工坊页 = 糖果卡牌后台（你在捏一张实体选手卡）。
   设计系统三条纪律：
   1. 字体三层职责制：display（得意黑）= 标题/名牌/揭榜/CTA；body = 台词与说明；mono = 一切数据
   2. 8pt 间距栅格：所有 padding/margin/gap 只取 --s-* 档位
   3. 硬阴影只给可点击或正在发生的事；层级靠背景三档明度 + 重阴影（暗场里浅阴影是隐形的） */
* { margin: 0; padding: 0; box-sizing: border-box; }

@font-face {
  font-family: "DisplayCN"; /* 得意黑 Smiley Sans 子集（tts/subset-font.mjs 生成，OFL 可商用）——D43 换：黄油体中文可读性差 */
  src: url(fonts/display.woff2) format("woff2");
  font-display: swap;
}

:root {
  /* 色板（D39 重调：舞台压黑、紫味只留一丝——中间亮度的紫灰会把糖果色泡死） */
  --bg: #121016;         /* 墨黑舞台（带一丝紫，不用纯黑） */
  --bg-panel: #191521;
  --bg-card: #1f1a28;
  --line: #38304a;
  --ink: #0e0b14;        /* 糖果色块上的深色字 / 硬阴影 / 顶栏与播放条 */
  --paper: #f6f1e6;      /* 台词纸：说出口的话上实色纸块（心里话留在阴影里） */
  --paper-dim: #6b6478;  /* 纸上的次要字 */
  --text: #f0ecf9;
  --text-dim: #aaa2c0; /* 注解层：暗底上要读得清（D38 提亮） */
  --accent: #ffc900;     /* 奶黄：法官 / 高亮 */
  --cta: #ff90e8;        /* 全站唯一主 CTA 粉 */
  --mint: #23a094;
  --coral: #ff6b5b;
  --sky: #7bd3f7;
  --killer: #ff6b5b;
  --killer-bg: #2a151c;
  --police: #7bd3f7;
  --police-bg: #142031;
  --good: #23a094;
  --night: #1c1830;
  /* 字体 */
  --display: "DisplayCN", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, Consolas, "Cascadia Mono", monospace;
  /* 8pt 栅格 */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  /* 圆角与阴影 */
  --r-card: 12px;
  --r-pill: 999px;
  --pop: 3px 3px 0 var(--ink);
  --pop-lg: 4px 4px 0 var(--ink);
  --float: 0 8px 24px rgba(0, 0, 0, 0.5); /* 浮层重阴影：抽屉/弹层/字幕盒 */
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
#app { display: flex; flex-direction: column; height: 100dvh; }
.hidden { display: none !important; }

/* ============ 顶栏 ============ */
#topbar {
  display: flex; align-items: center; gap: var(--s-4);
  height: 56px; flex-shrink: 0;
  background: var(--ink);
  padding: 0 var(--s-5);
}
#topbar h1 { font-family: var(--display); font-size: 18px; font-weight: 400; letter-spacing: 2px; }
#now-title {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
#btn-guide { flex-shrink: 0; }
.studio-link {
  margin-left: auto; flex-shrink: 0;
  color: var(--accent); text-decoration: none; font-size: 13px;
  padding: var(--s-1) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-pill);
  transition: border-color .12s;
}
.studio-link:hover { border-color: var(--accent); }

/* ============ 节目单抽屉 ============ */
#guide {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10, 8, 16, 0.72);
  display: none;
}
#guide.open { display: block; }
#guide-panel {
  width: min(480px, 94vw); height: 100%;
  background: var(--bg-panel);
  box-shadow: var(--float);
  padding: var(--s-5) var(--s-5) var(--s-6);
  overflow-y: auto;
  animation: guideIn .22s ease;
}
@keyframes guideIn {
  from { transform: translateX(-24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
#guide-head { display: flex; align-items: center; justify-content: space-between; }
#guide-head h2 { font-family: var(--display); font-size: 20px; font-weight: 400; letter-spacing: 2px; }
#guide .tagline { color: var(--text-dim); font-size: 12px; margin: var(--s-1) 0 var(--s-5); }

/* 节目卡：海报化——标题 + 阵容脸排 + 日期与胜负角标 */
.match-item {
  padding: var(--s-4) var(--s-4); margin-bottom: var(--s-3);
  background: var(--bg-card); border-radius: var(--r-card);
  cursor: pointer; border: 2px solid transparent;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.match-item:hover { transform: translate(-2px, -2px); box-shadow: var(--pop); }
.match-item.active { border-color: var(--cta); box-shadow: var(--pop); }
.match-item .m-title { font-family: var(--display); font-size: 15px; font-weight: 400; letter-spacing: 1px; }
.match-item .m-faces { display: flex; gap: var(--s-1); margin: var(--s-2) 0 var(--s-2); }
.m-face {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; object-position: 50% 14%;
  border: 2px solid var(--plate, var(--line)); background: var(--bg);
}
.m-face-n {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--ink); background: var(--plate, var(--text-dim)); border: none;
}
.match-item .m-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.match-item .m-sub { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.w-killers, .w-good {
  display: inline-block; padding: 1px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; color: var(--ink);
}
.w-killers { background: var(--coral); }
.w-good { background: var(--mint); }

/* ============ 主舞台 ============ */
#stage { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

#advance-hint {
  position: absolute; right: var(--s-6); bottom: var(--s-4); z-index: 5;
  color: var(--accent); font-size: 17px; pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  animation: hintBlink 1.1s ease-in-out infinite;
}
@keyframes hintBlink {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(3px); }
}

/* 剧场：影院暗场，字幕盒靠重阴影浮起（不描边） */
#theater {
  flex: 1; min-height: 0;
  position: relative; /* D51：演员层脱离文档流，台词框长高时盖住演员而不是压缩舞台 */
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  background: linear-gradient(rgba(18, 16, 22, 0.5), rgba(18, 16, 22, 0.82)),
    url(assets/cover.jpg) center / cover no-repeat;
  padding: var(--s-5) var(--s-4) var(--s-5);
}
/* 演员占满整个舞台（大小恒定），台词框浮在其上层 */
#th-figure { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
#th-vrm { position: absolute; inset: 0; width: 100%; height: 100%; }
#th-vrm.hidden { display: none; }
#th-portrait {
  max-height: min(44vh, 400px); max-width: 80vw;
  border-radius: var(--r-card);
  box-shadow: 0 14px 56px rgba(0, 0, 0, 0.55);
}
#th-face { font-size: 100px; line-height: 1; filter: drop-shadow(0 8px 24px rgba(0,0,0,.5)); }
#th-box {
  width: min(760px, 96%); margin-top: var(--s-4);
  position: relative; z-index: 2; /* 浮在演员层之上（D51） */
  background: rgba(16, 13, 22, 0.94);
  border-radius: var(--r-card);
  box-shadow: var(--float);
  padding: var(--s-4) var(--s-5) var(--s-4); min-height: 116px;
}
#th-nameline { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-2); }
/* 签名件：综艺字幕名牌——应援色色块 + 黄油体 + 硬阴影 + 微倾（本页唯一倾斜元素） */
#th-name {
  font-family: var(--display); font-size: 15px; font-weight: 400; letter-spacing: 1px;
  color: var(--ink); background: var(--plate, var(--accent));
  padding: 3px 16px; border-radius: var(--r-pill);
  transform: rotate(-1.2deg); transform-origin: left center;
  box-shadow: var(--pop);
}
#th-name:empty { display: none; }
#th-name.plate-in { animation: plateIn .28s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes plateIn {
  from { transform: rotate(-1.2deg) scale(.85); opacity: 0; }
  to { transform: rotate(-1.2deg) scale(1); opacity: 1; }
}
#th-sub { color: var(--text-dim); font-size: 12px; }
#th-think {
  font-size: 12.5px; color: var(--text-dim); font-style: italic;
  margin-bottom: var(--s-2); white-space: pre-wrap;
  border-left: 2px solid var(--line); padding-left: var(--s-3);
}
.th-think-in { animation: thinkIn 0.8s ease; }
@keyframes thinkIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
body.hide-thinking #th-think { display: none; }
#th-dialog { font-size: 15.5px; line-height: 1.85; white-space: pre-wrap; min-height: 56px; }
#th-extra { max-height: 42vh; overflow-y: auto; }
#th-extra .vote-card { margin: var(--s-1) auto var(--s-2); background: transparent; border: none; padding: var(--s-1) 0; }
#th-extra .banner { margin: var(--s-2) auto; }

/* ============ 座位条（OB 席）：舞台下方一排，说话人点亮 ============ */
#roster {
  display: flex; justify-content: center; gap: var(--s-4);
  padding: var(--s-2) var(--s-4);
  background: rgba(14, 11, 20, 0.72);
  flex-shrink: 0;
}
#roster:empty { display: none; }
.seat-chip {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-1);
  width: 64px; padding-top: var(--s-2);
  transition: transform .15s, opacity .15s;
}
.seat-chip .chip-name { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; max-width: 64px; }
.seat-chip.dead { opacity: .35; }
.seat-chip.dead .cast-avatar { filter: grayscale(1) brightness(0.6); }
.seat-chip.talking { transform: translateY(-3px); }
.seat-chip.talking .cast-avatar, .seat-chip.talking > .avatar { box-shadow: var(--pop); }
.seat-chip.talking .chip-name { color: var(--plate, var(--text)); font-weight: 700; }
.cast-wrap { position: relative; flex-shrink: 0; }
.cast-avatar {
  width: 44px; height: 44px; border-radius: var(--r-card); display: block;
  object-fit: cover; object-position: 50% 14%;
  border: 2px solid var(--plate, var(--line)); background: var(--bg);
}
.cast-seat {
  position: absolute; bottom: -3px; left: -3px;
  width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--ink); background: var(--plate, var(--text-dim));
  border: 1px solid var(--ink);
}
.role-badge { font-size: 12px; }

/* ============ 号码牌（应援色由 JS 注入 --plate，旧局回落座位色） ============ */
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--ink); flex-shrink: 0;
  background: var(--plate, var(--text-dim));
}
.av-1 { --plate: #ffd9a0; } .av-2 { --plate: #7bd3f7; }
.av-3 { --plate: #ff90e8; } .av-4 { --plate: #7fb069; }
.av-5 { --plate: #e8564b; } .av-6 { --plate: #9caf88; }
.av-7 { --plate: #c77dff; } .av-8 { --plate: #d4a24c; }

/* ============ 列表视图 ============ */
#feed { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-6) 8%; scroll-behavior: smooth; }
#feed {
  background: linear-gradient(rgba(18, 16, 22, 0.88), rgba(18, 16, 22, 0.95)),
    url(assets/cover.jpg) center / cover no-repeat;
}
#feed.empty {
  background: linear-gradient(rgba(18, 16, 22, 0.15), rgba(18, 16, 22, 0.7)),
    url(assets/cover.jpg) center / cover no-repeat;
}
.empty-hint { color: var(--text); text-align: center; margin-top: 40vh; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }

/* 阶段分隔条 */
.banner {
  text-align: center; margin: var(--s-6) auto var(--s-5); padding: var(--s-2) var(--s-5);
  border-radius: var(--r-pill); font-size: 14px; letter-spacing: 2px;
  width: fit-content;
}
.banner.night { background: #2b2452; color: #cfc9ff; }
.banner.day { background: var(--accent); color: var(--ink); }
.banner.death { background: var(--coral); color: var(--ink); }
/* 终局 = 揭榜 */
.banner.result {
  background: var(--mint); color: var(--ink);
  font-family: var(--display); font-size: 19px; letter-spacing: 3px;
  padding: var(--s-3) var(--s-6); box-shadow: var(--pop-lg);
}
.banner.result.killers-win { background: var(--coral); color: var(--ink); }
.banner.info { color: var(--text-dim); }

/* 消息气泡 */
.msg { display: flex; gap: var(--s-3); margin-bottom: var(--s-5); max-width: 760px; }
.msg .bubble-wrap { min-width: 0; }
.msg .who { font-size: 12px; color: var(--text-dim); margin-bottom: var(--s-1); }
.msg .who .model-tag { margin-left: var(--s-2); font-family: var(--mono); font-size: 10px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--line); }
/* 台词纸：说出口的话 = 灯下的实色纸块（Gumroad 式墨字色块）；心里话留在阴影里 */
.bubble {
  background: var(--paper); color: var(--ink);
  border-radius: 4px var(--r-card) var(--r-card) var(--r-card); padding: var(--s-3) var(--s-4);
  white-space: pre-wrap; word-break: break-word;
  box-shadow: var(--pop);
}
.bubble.lastwords { background: #efe3c4; }
.thinking {
  margin-top: var(--s-2); padding: var(--s-2) var(--s-3); font-size: 12.5px;
  color: var(--text-dim); font-style: italic;
  background: rgba(90, 96, 140, 0.08); border-left: 2px solid var(--line);
  border-radius: 0 var(--s-2) var(--s-2) 0; white-space: pre-wrap;
}
.thinking::before { content: "💭 "; font-style: normal; }
body.hide-thinking .thinking { display: none; }

/* 队内频道 */
.channel {
  margin: var(--s-4) auto var(--s-5); max-width: 700px;
  border-radius: var(--r-card); padding: var(--s-3) var(--s-4); font-size: 13.5px;
}
.channel.killers { background: var(--killer-bg); border-left: 3px solid var(--killer); }
.channel.police { background: var(--police-bg); border-left: 3px solid var(--police); }
/* 频道标签 = 阵营色实底小旗 */
.channel .ch-label {
  display: inline-block; font-family: var(--display); font-size: 12px; font-weight: 400;
  letter-spacing: 2px; margin-bottom: var(--s-2);
  color: var(--ink); padding: 1px 12px; border-radius: var(--r-pill);
}
.channel.killers .ch-label { background: var(--killer); }
.channel.police .ch-label { background: var(--police); }
.channel .action-line { color: var(--text-dim); font-size: 12.5px; }
.channel .say-line { white-space: pre-wrap; }

/* 票型：计分板 */
.vote-card {
  margin: var(--s-4) auto; max-width: 700px;
  background: var(--bg-card); border-radius: var(--r-card);
  padding: var(--s-4) var(--s-4);
}
.vote-card .v-title { font-family: var(--display); font-size: 12px; font-weight: 400; color: var(--text-dim); letter-spacing: 2px; margin-bottom: var(--s-3); }
.vote-grid { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.vote-pair {
  display: flex; align-items: center; gap: var(--s-1);
  background: var(--bg-panel); border-radius: var(--r-pill); padding: var(--s-1) var(--s-3);
  font-family: var(--mono); font-size: 13px;
}
.vote-pair .arrow { color: var(--text-dim); }

.rules-card .rules-text { white-space: pre-wrap; font-size: 12.5px; color: var(--text-dim); line-height: 1.8; }

/* ============ tester 视角（仅本地） ============ */
.trace-btn {
  border: none; background: none; padding: 0 2px; font-size: 12px;
  cursor: pointer; opacity: .5; vertical-align: baseline;
}
.trace-btn:hover { opacity: 1; border-color: transparent; }
#trace-modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 8, 16, 0.72);
  display: flex; align-items: center; justify-content: center;
}
#trace-modal.hidden { display: none; }
#trace-panel {
  width: min(880px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--bg-panel); border-radius: var(--r-card);
  box-shadow: var(--float);
}
#trace-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line);
  font-family: var(--display); font-size: 13px; color: var(--accent); letter-spacing: 1px;
}
#trace-close { font-size: 13px; padding: 3px 10px; }
#trace-body { overflow-y: auto; padding: var(--s-4) var(--s-4); }
.trace-sec { margin-bottom: var(--s-4); }
.trace-sec-title { font-family: var(--display); font-size: 12px; font-weight: 400; color: var(--text-dim); letter-spacing: 2px; margin-bottom: var(--s-2); }
.trace-sec pre {
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: var(--s-3) var(--s-4); font-size: 12.5px; line-height: 1.7;
  font-family: var(--mono);
}

/* ============ 播放条：影院底部操作台 ============ */
#controls {
  background: var(--ink);
  padding: var(--s-3) var(--s-5);
  flex-shrink: 0;
}
#controls.hidden { display: none; }
.ctrl-row { display: flex; align-items: center; gap: var(--s-4); }
.ctrl-row.options { margin-top: var(--s-2); font-size: 12.5px; color: var(--text-dim); flex-wrap: wrap; gap: var(--s-5); }
.ctrl-row label { display: flex; align-items: center; gap: var(--s-2); }

/* 按钮层级：默认幽灵；▶ 与快速开局是全站仅有的粉色主角 */
button {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 5px 16px; cursor: pointer; font-size: 14px;
  font-family: inherit;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
button:hover { border-color: var(--text-dim); transform: translate(-1px, -1px); box-shadow: var(--pop); }
button:disabled { opacity: .45; cursor: default; }
button:disabled:hover { border-color: var(--line); transform: none; box-shadow: none; }
.trace-btn:hover { transform: none; box-shadow: none; }
/* ▶：圆形主播放键 */
button.big {
  width: 44px; height: 44px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; border-radius: 50%;
  background: var(--cta); color: var(--ink); border: none; font-weight: 700;
  box-shadow: var(--pop);
}
button.big:hover { transform: translate(-1px, -1px); box-shadow: var(--pop-lg); }
#btn-prev-key, #btn-next-key {
  width: 34px; height: 34px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 13px;
}
select {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--s-2); padding: 3px 8px; font-size: 12.5px; font-family: inherit;
}
#progress { flex: 1; accent-color: var(--cta); }
#progress-text { font-family: var(--mono); font-size: 12px; color: var(--text-dim); min-width: 54px; text-align: right; }

/* ============ 选手工坊 ============ */
body.studio { overflow-y: auto; height: auto; }
#studio-wrap { max-width: 1100px; margin: 0 auto; padding: var(--s-5) var(--s-5) 96px; }
/* 返回大厅：图标按钮（D44） */
.back-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  color: var(--text); font-size: 16px; text-decoration: none;
  border: 1px solid var(--line);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.back-link:hover { border-color: var(--text-dim); transform: translate(-1px, -1px); box-shadow: var(--pop); }

/* 两栏：左轨选手卡实体（跟随滚动），右侧操作流 */
#studio-cols { display: grid; grid-template-columns: 300px 1fr; gap: var(--s-6); align-items: start; margin-top: var(--s-5); }
#studio-main { min-width: 0; }
#studio-card { position: sticky; top: var(--s-5); }

/* 选手卡实体：应援色卡框 + 半身照 + 名牌（本页唯一倾斜元素） */
.pcard {
  border: 3px solid var(--tile, var(--cta));
  border-radius: var(--r-card); overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--pop-lg);
}
.pcard img { width: 100%; aspect-ratio: 420 / 400; object-fit: cover; object-position: 50% 10%; display: block; background: var(--bg); }
/* 卡底 = 台词纸：照片 + 纸面墨字，像一张实体卡 */
.pc-body { padding: var(--s-4) var(--s-4) var(--s-4); background: var(--paper); }
.pc-name {
  display: inline-block;
  font-family: var(--display); font-size: 17px; font-weight: 400; letter-spacing: 1px;
  color: var(--ink); background: var(--tile, var(--cta));
  padding: 2px 14px; border-radius: var(--r-pill);
  transform: rotate(-1.2deg); transform-origin: left center;
  box-shadow: var(--pop);
  margin: -28px 0 var(--s-2); position: relative;
}
.pc-cast { font-size: 12px; color: var(--paper-dim); margin-bottom: var(--s-3); }
.pc-strat { display: flex; align-items: baseline; gap: var(--s-2); margin-bottom: var(--s-2); }
.pc-strat .st-num { font-family: var(--mono); font-size: 10.5px; color: var(--paper-dim); }
.pc-strat b { font-family: var(--display); font-size: 15px; font-weight: 400; color: var(--ink); }
.pc-meta { font-family: var(--mono); font-size: 11px; color: var(--paper-dim); }

/* 左轨选手库：大卡下方，最多 3 张 */
#rail-lib { margin-top: var(--s-4); }
#rail-lib .agent-row { padding: var(--s-2) var(--s-3); font-size: 12.5px; gap: var(--s-2); }
#rail-lib .agent-row .model-tag { display: none; }
/* 新建选手：＋ 圆形图标钮（D44），居中在卡槽下 */
#btn-new-agent {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  font-size: 17px; margin: var(--s-2) auto 0;
}

.studio-sec { margin-top: var(--s-7); }
#studio-main > .studio-sec:first-child { margin-top: 0; }
.studio-sec h2 { font-family: var(--display); font-size: 17px; font-weight: 400; margin-bottom: var(--s-4); color: var(--accent); letter-spacing: 2px; }
.studio-sec .hint { font-size: 12.5px; color: var(--text-dim); margin-bottom: var(--s-3); }
.studio-sec .sub-h { font-family: var(--display); font-size: 14px; font-weight: 400; margin: var(--s-5) 0 var(--s-3); color: var(--text); letter-spacing: 1px; }
details.studio-sec summary { cursor: pointer; font-family: var(--display); font-size: 15px; font-weight: 400; color: var(--accent); letter-spacing: 2px; margin-bottom: var(--s-4); }
details.adv > summary { cursor: pointer; color: var(--text-dim); font-size: 13.5px; padding: var(--s-2) 0; }
details.adv[open] > summary { color: var(--accent); }

.studio-toolbar { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; font-size: 13px; row-gap: var(--s-3); }
.studio-toolbar label { display: flex; align-items: center; gap: var(--s-2); }
.studio-toolbar input[type="text"] {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--s-2); padding: 5px 10px; font-size: 13px; width: 150px; font-family: inherit;
}
.studio-toolbar input[type="number"] {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--s-2); padding: 5px 10px; font-size: 13px; width: 140px; font-family: var(--mono);
}

.locked-block, .edit-block { margin-bottom: var(--s-4); }
.block-label {
  font-size: 12px; color: var(--text-dim); letter-spacing: 1px; margin-bottom: var(--s-2);
  display: flex; align-items: center; gap: var(--s-3);
}
.locked-block pre {
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg-panel); border: 1px dashed var(--line); border-radius: var(--r-card);
  padding: var(--s-3) var(--s-4); font-size: 12.5px; line-height: 1.75; color: var(--text-dim);
  font-family: var(--mono);
}
.edit-block textarea {
  width: 100%; resize: vertical;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--accent); border-radius: var(--r-card);
  padding: var(--s-3) var(--s-4); font-size: 13.5px; line-height: 1.75;
  font-family: inherit;
}
.edit-block textarea:focus { outline: none; box-shadow: 0 0 0 1px var(--accent); }
#roleplan-count.over { color: var(--killer); }
#config-json { user-select: all; }

/* 选手库 */
.agent-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-2); cursor: pointer;
  background: var(--bg-card); border: 2px solid transparent; border-radius: var(--r-card);
  font-size: 13.5px;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.agent-row:hover { border-color: var(--line); }
.agent-row.active { border-color: var(--cta); box-shadow: var(--pop); }
.agent-row .agent-face { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; object-position: 50% 14%; }
.agent-row .model-tag { font-family: var(--mono); font-size: 11px; color: var(--text-dim); background: var(--bg-panel); padding: 1px 10px; border-radius: var(--r-pill); }
.agent-row .agent-ops { margin-left: auto; display: flex; gap: var(--s-2); }
.agent-row .agent-ops button { font-size: 12px; padding: 2px 10px; }

/* 造型九宫格：每张卡常驻应援色卡框（独立个体感，D42），选中 = 浮起 + 硬阴影 */
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: var(--s-4); margin-bottom: var(--s-4); }
.skin-tile {
  border: 2px solid var(--tile, var(--line)); border-radius: var(--r-card); overflow: hidden; cursor: pointer;
  background: var(--bg-card); transition: transform .12s, box-shadow .12s;
}
.skin-tile:hover { transform: translate(-1px, -1px); box-shadow: var(--pop); }
.skin-tile.sel { transform: translate(-2px, -2px); box-shadow: var(--pop-lg); }
.skin-tile img { width: 100%; aspect-ratio: 420 / 520; object-fit: cover; display: block; }
.skin-tile .sk-name { font-size: 11px; padding: var(--s-2) var(--s-1); text-align: center; color: var(--text-dim); line-height: 1.5; }
.skin-tile .sk-name b { font-family: var(--display); font-size: 13px; font-weight: 400; }
.skin-tile.sel .sk-name { color: var(--text); }
.skin-tile.sel .sk-name b { color: var(--tile, var(--cta)); }

/* 策略技能卡：常驻明边（独立个体感，D42），选中 = CTA 粉描边 + 浮起 */
.strat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s-4); margin-bottom: var(--s-4); }
.strat-tile {
  border: 2px solid #574c72; border-radius: var(--r-card); padding: var(--s-3) var(--s-4); cursor: pointer;
  background: var(--bg-card); transition: transform .12s, border-color .12s, box-shadow .12s;
}
.strat-tile:hover { transform: translate(-1px, -1px); box-shadow: var(--pop); }
.strat-tile.sel { border-color: var(--cta); transform: translate(-2px, -2px); box-shadow: var(--pop-lg); }
.strat-tile .st-num { font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); display: block; margin-bottom: var(--s-1); }
.strat-tile b { display: block; margin-bottom: var(--s-1); font-family: var(--display); font-size: 14.5px; font-weight: 400; }
.strat-tile.sel b { color: var(--cta); }
.strat-tile .st-brief { font-size: 12px; color: var(--text-dim); line-height: 1.55; }

/* 快速开局：与 ▶ 同族的粉色药丸 */
button.cta {
  background: var(--cta); color: var(--ink); font-weight: 700;
  border: none; border-radius: var(--r-pill); padding: var(--s-3) var(--s-6); font-size: 15px;
  cursor: pointer; letter-spacing: 1px; font-family: var(--display);
  box-shadow: var(--pop);
}
button.cta:hover { transform: translate(-1px, -1px); box-shadow: var(--pop-lg); }

#seat-picks { row-gap: var(--s-3); }

/* ============ 操控面板（D43）：正在发生的事——台词纸 + 硬阴影 ============ */
#turn-panel {
  position: absolute; left: 50%; bottom: var(--s-5); transform: translateX(-50%);
  z-index: 6; width: min(560px, 92%);
  background: var(--paper); color: var(--ink);
  border-radius: var(--r-card); box-shadow: var(--pop-lg);
  padding: var(--s-4) var(--s-5);
  animation: turnIn .25s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes turnIn {
  from { transform: translateX(-50%) translateY(16px); opacity: 0; }
  to { transform: translateX(-50%); opacity: 1; }
}
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.tp-head b { font-family: var(--display); font-size: 16px; font-weight: 400; letter-spacing: 1px; }
#tp-count { font-family: var(--mono); font-size: 15px; font-weight: 700; }
#tp-count.tp-urgent { color: var(--coral); }
#tp-vote { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tp-target {
  background: #fff; color: var(--ink); border: 1px solid var(--ink);
  font-size: 13.5px; padding: var(--s-2) var(--s-4);
}
#tp-say { display: flex; align-items: center; gap: var(--s-4); }
.tp-hint { font-size: 12.5px; color: var(--paper-dim); }

/* ============ 开局选择框（D43）：版型大卡 ============ */
#start-modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 8, 16, 0.72);
  display: flex; align-items: center; justify-content: center;
}
#start-modal.hidden { display: none; }
#start-panel {
  width: min(560px, 92vw);
  background: var(--bg-panel); border-radius: var(--r-card);
  box-shadow: var(--float);
  padding: var(--s-5) var(--s-6) var(--s-6);
}
#start-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-5); }
#start-head h3 { font-family: var(--display); font-size: 19px; font-weight: 400; letter-spacing: 2px; }
.rs-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.rs-card {
  background: var(--bg-card); border: 2px solid var(--line); border-radius: var(--r-card);
  padding: var(--s-5) var(--s-4); text-align: center; cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.rs-card:hover { border-color: var(--cta); transform: translate(-2px, -2px); box-shadow: var(--pop); }
.rs-card .rs-icon { font-size: 40px; line-height: 1; margin-bottom: var(--s-3); }
.rs-card b { display: block; font-family: var(--display); font-size: 18px; font-weight: 400; letter-spacing: 2px; margin-bottom: var(--s-2); }
.rs-card .rs-sub { font-size: 12px; color: var(--text-dim); line-height: 1.7; }
#ctl-block { margin-top: var(--s-5); }
#ctl-block .ctl-row { display: flex; gap: var(--s-5); flex-wrap: wrap; font-size: 13.5px; margin-bottom: var(--s-2); }
#ctl-block label { display: flex; align-items: center; gap: var(--s-2); cursor: pointer; }

/* ============ 入场闸（D48）：候场→就位→开演 ============ */
#enter-gate {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 8, 16, 0.82);
  display: flex; align-items: center; justify-content: center;
}
#enter-gate.hidden { display: none; }
#gate-panel {
  width: min(640px, 94vw);
  background: var(--bg-panel); border-radius: var(--r-card);
  box-shadow: var(--float);
  padding: var(--s-5) var(--s-6) var(--s-6);
  text-align: center;
}
#gate-title { font-family: var(--display); font-size: 19px; font-weight: 400; letter-spacing: 3px; margin-bottom: var(--s-5); }
#gate-cast { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-4); margin-bottom: var(--s-6); }
.gate-card {
  width: 72px;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-1);
  opacity: .38; filter: grayscale(.7);
  transition: opacity .25s, filter .25s, transform .25s;
}
.gate-card.ready { opacity: 1; filter: none; transform: translateY(-2px); }
.gate-card img, .gate-card .gate-num {
  width: 64px; height: 78px; object-fit: cover;
  border-radius: var(--r-card); border: 2px solid var(--plate, var(--line));
  background: var(--bg-card);
}
.gate-card .gate-num { display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 20px; color: var(--text-dim); }
.gate-card b { font-size: 11.5px; font-weight: 700; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-card .gate-state { font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); }
.gate-card.ready .gate-state { color: var(--mint); }
#gate-go { min-width: 200px; }

/* ============ 动效保底 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .match-item:hover, button.big:hover, button.cta:hover { transform: none; }
}

/* ============ 手机适配 ============ */
@media (max-width: 760px) {
  #topbar { padding: 0 var(--s-3); gap: var(--s-2); }
  #topbar h1 { font-size: 15px; }
  #now-title { display: none; }
  #guide-panel { width: 100vw; }
  #roster { gap: var(--s-2); overflow-x: auto; justify-content: flex-start; }
  #feed { padding: var(--s-4) var(--s-3); }
  #controls { padding: var(--s-2) var(--s-3); }
  #studio-wrap { padding: var(--s-5) var(--s-4) var(--s-7); }
  #studio-cols { grid-template-columns: 1fr; }
  #studio-card { position: static; max-width: 300px; margin: 0 auto; }
  .studio-sec { margin-top: var(--s-6); }
}
