/* ============ 基础 ============ */
:root {
  --bg: #14120f;
  --bg-2: #1a1713;
  --card: #201c17;
  --line: #2e2822;
  --ink: #e9e3d6;
  --ink-dim: #9a9083;
  --gold: #c9a227;
  --gold-soft: #e0be5a;
  --red: #c0553f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background-image:
    radial-gradient(120% 60% at 50% 0%, #241f18 0%, rgba(20,18,15,0) 60%),
    radial-gradient(80% 50% at 90% 100%, #1b1a22 0%, rgba(20,18,15,0) 70%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

/* ============ 门厅 ============ */
.lobby {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
}

.lobby-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(38,33,27,.92), rgba(26,23,19,.92));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 22px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}

.lobby-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: .06em;
  font-weight: 600;
}

.lobby-card .sub {
  margin: 0 0 22px;
  color: var(--ink-dim);
  font-size: 13.5px;
  line-height: 1.7;
}

.field { display: block; margin-bottom: 14px; }

.field > span {
  display: block;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 6px;
  letter-spacing: .08em;
}

.field input,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #151310;
  color: var(--ink);
  font-size: 16px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.field textarea {
  resize: vertical;
  min-height: 74px;
  line-height: 1.55;
  font-family: inherit;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(201,162,39,.6);
  box-shadow: 0 0 0 3px rgba(201,162,39,.12);
}

.field input::placeholder,
.field textarea::placeholder { color: #5d554a; }

/* ---- 场景卡 ---- */
.scene-preview {
  margin: 4px 0 16px;
  padding: 16px 16px 14px;
  border: 1px solid rgba(201,162,39,.35);
  border-radius: 14px;
  background: rgba(201,162,39,.055);
  animation: fadeUp .28s ease-out;
}

/* ---- 游戏列表 ---- */
.scene-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 6px;
  max-height: 340px;
  overflow-y: auto;
}

.list-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
  padding: 14px 0;
}

.scene-card {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151310;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s, transform .12s, background .18s;
  font: inherit;
}

.scene-card:hover {
  border-color: rgba(201,162,39,.55);
  background: rgba(201,162,39,.06);
}

.scene-card:active { transform: scale(.98); }

.sc-name {
  font-size: 15px;
  font-weight: 700;
  color: #f0e2bd;
  margin-bottom: 4px;
}

.sc-meta {
  font-size: 11.5px;
  color: var(--ink-dim);
  margin-bottom: 4px;
}

.sc-place {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  opacity: .78;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- 模板 chips ---- */
.tpl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tpl-chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  font: inherit;
  font-size: 12.5px;
}

.tpl-chip:hover {
  border-color: rgba(201,162,39,.5);
  color: #f0e2bd;
  background: rgba(201,162,39,.07);
}

.tpl-chip:active { transform: scale(.96); }

.scene-preview.hidden { display: none; }

.sp-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #f0e2bd;
  margin-bottom: 8px;
}

.sp-line {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 6px;
  opacity: .9;
}

.sp-line b { color: var(--ink-dim); font-weight: 500; margin-right: 6px; }
.sp-meta { font-size: 12.5px; color: var(--ink-dim); opacity: .8; }

.scene-preview .btn { width: 100%; margin-top: 10px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row .field { flex: 1; margin-bottom: 0; }

.btn {
  padding: 13px 20px;
  border-radius: 12px;
  border: 1px solid rgba(201,162,39,.55);
  background: linear-gradient(180deg, #d8b23a, #b98f1c);
  color: #241c06;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform .1s, filter .18s;
}

.btn:active { transform: scale(.97); filter: brightness(1.08); }

.btn.ghost {
  width: 100%;
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid rgba(201,162,39,.45);
  font-weight: 600;
  padding: 13px;
}

.btn.ghost:active { background: rgba(201,162,39,.1); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: #6b6255;
  font-size: 11.5px;
  letter-spacing: .1em;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.hint {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.8;
  color: #7b7266;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

/* ============ 房间 ============ */
.room {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  max-width: 760px;
  margin: 0 auto;
  border-left: 1px solid rgba(46,40,34,.6);
  border-right: 1px solid rgba(46,40,34,.6);
}

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(20,18,15,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.bar-main { flex: 1; min-width: 0; }

.theme {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-dim);
  min-width: 0;
}

/* 顶栏第一行：场景名 + 房号（同一行，房号点一下复制邀请链接） */
.theme-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.theme-row .theme { flex: 0 1 auto; min-width: 0; }
.code-chip {
  flex: 0 0 auto;
  align-self: center;
  font-size: 10.5px;
  padding: 2px 7px;
  letter-spacing: .06em;
  color: var(--gold-soft);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
}
.code-chip:active { background: rgba(201,162,39,.16); color: #f0e2bd; }
.code-chip.copied {
  background: rgba(120,190,140,.18);
  border-color: rgba(120,190,140,.6);
  color: #cdeed6;
  letter-spacing: 0;
}

.chip {
  border: 1px solid var(--line);
  background: #1c1915;
  color: var(--gold-soft);
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .1em;
  cursor: pointer;
  flex: 0 0 auto;
  font-family: inherit;
}

.players {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1c1915;
  color: var(--ink-dim);
  font-size: 15px;
  cursor: pointer;
  flex: 0 0 auto;
}
.icon-btn:active { background: #262119; color: var(--gold-soft); }

/* ---- 消息区 ---- */
.msgs {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 14px 8px;
  position: relative;
  z-index: 2;                     /* 文字在人形贴图（z:1）和场景背景（z:0）之上 */
  /* 不用 smooth：程序化滚动（新消息到达）和它打架，手机上常停在半路 */
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  --bh: 210;
}

/* 场景背景层：独立一层垫在 msgs 底下，走向的人形贴图（.near-fig）
   夹在它和文字中间——照片再花也压不住字（字自己垫实底） */
.scene-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* 聊天背景：走进小场景后换（默认是主场景的画面卡色相，有真图用真图） */
#room.has-hue .scene-bg {
  background:
    radial-gradient(120% 90% at 50% 0%,
      hsl(var(--bh) 32% 16%) 0%, transparent 70%),
    hsl(var(--bh) 28% 9%);
  transition: background .5s ease;
}
#room.has-photo .scene-bg {
  background:
    linear-gradient(rgba(20,18,15,.86), rgba(20,18,15,.93)),
    var(--scene-url) center / cover no-repeat;
  transition: background .5s ease;
}

/* ---------------- 世界状态条（动作A） ---------------- */

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 0;
  flex: 0 0 auto;
  position: relative;
}
.stage-chip {
  font-size: 11.5px;
  color: var(--ink-soft, #cfc4a6);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.stage-chip:hover, .stage-chip:active { border-color: rgba(201,162,39,.55); color: #f0e2bd; }
.stage-sep { color: rgba(240,226,189,.35); font-size: 11px; }

/* 天气 / 时间弹出菜单：整块不透明（后面还有旁白和气泡，透一点就糊），
   位置由 JS 用 fixed 算好，永远不出屏 */
.stage-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 95;
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(201,162,39,.3);
  background: #1b1712;
  background-image: linear-gradient(180deg, #241f18, #171410 70%);
  box-shadow: 0 16px 38px rgba(0,0,0,.66), 0 1px 0 rgba(255,255,255,.05) inset;
  animation: stage-pop .14s ease both;
}
@keyframes stage-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.stage-menu .stage-menu-tip {
  grid-column: 1 / -1;
  padding: 2px 2px 4px;
  font-size: 11px;
  letter-spacing: .12em;
  color: #a2916d;
}
.stage-opt {
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.2;
  color: #d5c9ab;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.stage-opt:hover { border-color: rgba(201,162,39,.55); color: #f0e2bd; }
.stage-opt.on {
  color: #14120f;
  background: #c9a227;
  border-color: #c9a227;
  font-weight: 600;
}

/* 动作面板（走向/观察的挑目标列表） */
.act-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 6px;
}
/* 面板里的天气/天色：还是胶囊，别沿用弹层的方块 */
.act-chips .stage-opt {
  padding: 5px 12px;
  border-radius: 999px;
}
.act-places {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  padding: 4px 0 8px;
}
.act-place {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: hsl(var(--h, 210) 30% 16%);
  cursor: pointer;
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.act-place:hover { transform: translateY(-2px); border-color: rgba(201,162,39,.55); }
.act-place:active { transform: scale(.97); }
.act-place img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.act-place-emoji {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.act-place-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 12px;
  color: #f0e2bd;
  background: linear-gradient(transparent, rgba(10,9,7,.85));
  padding: 14px 8px 6px;
  text-align: center;
}

/* 新内容提示（用户往上翻时出现） */
.jump {
  position: absolute;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid rgba(201,162,39,.45);
  background: rgba(28,25,21,.94);
  color: var(--gold-soft, #e2c46a);
  font-size: 12.5px;
  letter-spacing: .06em;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  animation: fade-up .22s ease both;
}
.jump:active { background: #2a2419; }

/* 长按消息弹出的小菜单 */
.lp-menu {
  position: fixed;
  z-index: 90;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(201,162,39,.35);
  background: rgba(28,25,21,.98);
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.lp-menu button {
  display: block;
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #ece4d2;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: .02em;
  cursor: pointer;
}
.lp-menu button:active { background: rgba(201,162,39,.18); }

.msg { margin-bottom: 16px; animation: fade-up .28s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* 旁白：整段是一块「卡片」，和玩家气泡一眼分得开 */
.msg.gm {
  border-left: 2px solid rgba(201,162,39,.5);
  padding: 11px 14px 12px;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, rgba(201,162,39,.07), rgba(201,162,39,.015) 70%, transparent);
  color: #e9e2d4;
  font-family: "Songti SC", "Noto Serif SC", Georgia, "STSong", serif;
  font-size: 16.5px;
  line-height: 1.95;
  letter-spacing: .01em;
}

.msg.gm p { margin: 0 0 12px; }
.msg.gm p:last-of-type { margin-bottom: 0; }

.msg.gm .opts {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg.gm .opt {
  text-align: left;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid rgba(201,162,39,.3);
  background: rgba(201,162,39,.06);
  color: var(--gold-soft);
  font-family: -apple-system, "PingFang SC", sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.msg.gm .opt:active {
  background: rgba(201,162,39,.16);
  transform: scale(.99);
}

/* 玩家 */
.msg.player {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.msg.player .bubble {
  max-width: 82%;
  background: #262119;
  border: 1px solid #332c23;
  border-top-right-radius: 14px;
  border-bottom-right-radius: 4px;
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
  padding: 9px 13px;
  font-size: 15px;
  line-height: 1.6;
  color: #ddd5c6;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.player .who {
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 3px;
  letter-spacing: .04em;
  opacity: .85;
}

/* 聊天（不惊动旁白）：冷色调，和「行动」区分开 */
.msg.player.talk { justify-content: flex-start; }
.msg.player.talk .bubble {
  background: #1b2027;
  border-color: rgba(120,160,220,.26);
  border-top-left-radius: 14px;
  border-bottom-left-radius: 4px;
  color: #cdd8e6;
}
.msg.player.talk .who { color: #8fa8c8; }


/* 动作：同样是一条气泡，但用金色描边 + 斜体，和说话分开 */
.msg.player.act { justify-content: flex-start; }
.msg.player.act.mine { justify-content: flex-end; }
.msg.player.act .bubble {
  background: #221d15;
  border: 1px dashed rgba(201,162,39,.36);
  border-radius: 12px;
  color: #e2d9c4;
  font-style: italic;
}
.msg.player.act .who { color: #b9a06a; }

/* 系统 */
.msg.system {
  text-align: center;
  font-size: 12px;
  color: #6f6659;
  letter-spacing: .06em;
  margin: 10px 0 18px;
}

/* ---- 打字指示 ---- */
.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 18px 8px;
  font-size: 12px;
  color: #8a8071;
  flex: 0 0 auto;
}

.typing i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .35;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
.typing span { margin-left: 6px; letter-spacing: .08em; }

@keyframes blink {
  0%, 100% { opacity: .2; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

/* ---- 输入栏（聊天软件式：上面输入，下面工具条，右下发送） ---- */
/* ---------------- 聊天对象条（发言框上边） ----------------
   屋里参演的人一人一个圆头像：点谁亮谁，这句话就是对她说；
   再点一下取消；点别人换人。 */

.cast-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px 12px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.cast-bar::-webkit-scrollbar { display: none; }

.cast-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 3px 6px 2px;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cast-item .avatar {
  width: 34px;
  height: 34px;
  font-size: 16px;
  border: 2px solid rgba(255,255,255,.08);
  opacity: .62;
  filter: grayscale(.35);
  transition: opacity .15s, filter .15s, border-color .15s, transform .15s;
}
.cast-item .cast-name {
  max-width: 56px;
  font-size: 10px;
  line-height: 1.2;
  color: #93866f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.cast-item.on .avatar {
  opacity: 1;
  filter: none;
  border-color: #c9a227;
  /* 深色留一圈缝 + 金环：34px 的小圆也一眼看得出「亮着」 */
  box-shadow: 0 0 0 2px #14110c, 0 0 0 3.5px #c9a227, 0 6px 14px rgba(201,162,39,.22);
  transform: translateY(-1px);
}
.cast-item.on .cast-name { color: #f0d488; font-weight: 600; }
.cast-item:active .avatar { transform: scale(.94); }

/* ---------------- 聊天输入区 ---------------- */

.saybar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(20,18,15,.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  /* 键盘弹起时整个条抬到键盘上沿（iOS 用 visualViewport 算出来的高度） */
  margin-bottom: var(--kb, 0px);
  transition: margin-bottom .12s ease-out;
}

.say-box { display: flex; }

.say-input {
  width: 100%;
  min-height: 42px;
  max-height: 132px;              /* 最多四行，再多就在框里滚 */
  padding: 10px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #171410;
  color: var(--ink);
  font-size: 16px;                /* 小于 16 iOS 会自动放大页面 */
  line-height: 1.55;
  font-family: inherit;
  outline: none;
  resize: none;
  overflow-y: auto;
  display: block;
}
.say-input:focus { border-color: rgba(201,162,39,.5); }
.say-input::placeholder { color: #5d554a; }

.say-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(201,162,39,.32);
  background: rgba(201,162,39,.10);
  color: var(--gold-soft);
  font-size: 12.5px;
  font-family: inherit;
  letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
}
.tool-btn:active { background: rgba(201,162,39,.2); }
.tool-btn:disabled { opacity: .4; cursor: not-allowed; }

.say-hint {
  margin-left: auto;
  font-size: 11px;
  color: #635b50;
  letter-spacing: .04em;
  white-space: nowrap;
}

.send-btn {
  flex: 0 0 auto;
  margin-left: auto;
  height: 34px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid rgba(201,162,39,.55);
  background: linear-gradient(180deg, #d8b23a, #b98f1c);
  color: #241c06;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .04em;
  cursor: pointer;
}
.send-btn:active { filter: brightness(1.1); }
.send-btn:disabled { opacity: .45; filter: grayscale(.4); }

/* 行动模式：发言框换成行动色（说的话交给旁白推演，不是闲聊） */
.saybar.acting .say-input {
  border-color: rgba(200,105,58,.55);
  background: #1d1512;
  box-shadow: 0 0 0 1px rgba(200,105,58,.22) inset;
}
.saybar.acting .say-input:focus { border-color: rgba(228,132,80,.75); }
.saybar.acting .send-btn { filter: hue-rotate(-18deg); }
.tool-btn.on {
  border-color: rgba(228,132,80,.6);
  background: rgba(200,105,58,.18);
  color: #e0a172;
}

/* 走向一个人：TA 的形象贴在聊天区右下（只有自己看得到）。
   挂在 .room 上，夹在场景背景（z:0）和文字（z:2）之间。 */
.near-fig {
  position: absolute;
  right: 10px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: .92;
}
.near-fig img {
  width: 108px;
  max-height: 190px;
  object-fit: cover;
  object-position: top;
  border-radius: 12px 12px 0 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.55));
}
.near-tag {
  margin-top: -4px;
  font-size: 11px;
  color: #cdbd97;
  background: rgba(0,0,0,.52);
  padding: 2px 9px;
  border-radius: 9px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
@media (max-width: 520px) {
  .near-fig img { width: 88px; max-height: 150px; }
}

/* 时间分隔线 / 新消息分隔线 */
.time-sep {
  text-align: center;
  font-size: 11.5px;
  color: #6b6355;
  letter-spacing: .1em;
  margin: 4px 0 16px;
}
.unread-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: #c9a227;
  letter-spacing: .08em;
  margin: 2px 0 16px;
}
.unread-sep::before,
.unread-sep::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: rgba(201,162,39,.26);
}

/* 别人正在打字 */
.ptyping {
  flex: 0 0 auto;
  padding: 0 18px 4px;
  font-size: 11.5px;
  letter-spacing: .05em;
  color: #7d90a8;
  animation: fade-up .2s ease both;
}

/* 输入 @ 时的同伴候选 */
.atbox {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  max-height: 42vh;
  overflow-y: auto;
  z-index: 9;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(26,23,19,.98);
  box-shadow: 0 12px 34px rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  animation: fade-up .16s ease both;
}
.atbox button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}
.atbox button.on,
.atbox button:active { background: rgba(201,162,39,.2); color: var(--gold-soft); }

/* 正文里的 @某人 */
.at {
  color: #e2c46a;
  font-weight: 600;
}

/* 有人叫你 */
.msg.player.mention-me .bubble {
  border-color: rgba(224,190,90,.65);
  box-shadow: 0 0 0 1px rgba(224,190,90,.22), 0 0 16px rgba(201,162,39,.14);
}

/* ---- toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  background: rgba(48,40,30,.97);
  border: 1px solid #4a3f2c;
  color: #e8dfcd;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  max-width: 86vw;
  text-align: center;
  z-index: 99;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 桌面端细节 */
@media (min-width: 760px) {
  .room { border-radius: 0; }
  .msg.gm { font-size: 17px; }
  /* 大厅：卡片放宽，轮播变宽幅，场景格子自动多列 */
  .lobby { padding: 36px 24px calc(36px + env(safe-area-inset-bottom)); }
  .lobby-card { max-width: 640px; padding: 34px 28px 26px; }
  .lobby-title h1 { font-size: 24px; }
  .lobby-title .sub { font-size: 13px; }
  .car-slide { aspect-ratio: 16 / 6; }
  .car-art { font-size: 60px; }
  .scene-list { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .hint { font-size: 13px; }
}

/* 中间尺寸（大手机横屏 / 小平板）：卡片先放宽一档 */
@media (min-width: 521px) and (max-width: 759px) {
  .lobby-card { max-width: 560px; }
}

/* ================= 搭一场新的（/new） ================= */

.lobby-card.wide { max-width: 1060px; }

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.back {
  font-size: 13px;
  color: var(--ink-dim);
  text-decoration: none;
}
.back:hover { color: #f0e2bd; }

.mode-tag {
  font-size: 11.5px;
  letter-spacing: .1em;
  color: #d8b23a;
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 999px;
  padding: 3px 10px;
}

.wide-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.draft-box {
  border: 1px dashed rgba(201,162,39,.4);
  border-radius: 14px;
  padding: 14px 14px 10px;
  margin-bottom: 16px;
  background: rgba(201,162,39,.04);
}

.draft-row { display: flex; gap: 8px; }

.draft-row input {
  flex: 1;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #151310;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}
.draft-row input:focus { border-color: rgba(201,162,39,.55); }

.draft-tip {
  font-size: 11.5px;
  color: var(--ink-dim);
  margin: 8px 0 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.cast-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #151310;
}

.cast-head { display: flex; align-items: center; gap: 10px; }

.c-name {
  flex: 1;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1a1712;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.c-play {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
  cursor: pointer;
}
.c-play input { accent-color: #d8b23a; }

.c-del {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}
.c-del:hover { color: #e06c5a; }

.c-brief, .c-look, .c-secret {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1a1712;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.cast-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cast-foot .c-look, .cast-foot .c-secret { margin-top: 8px; }

.btn-line {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--ink-dim);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 6px;
}
.btn-line:hover { color: #f0e2bd; border-color: rgba(201,162,39,.5); }

.save-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.save-tip { font-size: 12.5px; color: var(--ink-dim); }

@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .cast-foot { grid-template-columns: 1fr; }
}

.scene-card { position: relative; }

.sc-edit {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  transition: color .15s, border-color .15s;
}
.sc-edit:hover { color: #f0e2bd; border-color: rgba(201,162,39,.5); }

/* ================= 世界管理（/manage） ================= */

.w-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 6px;
}

.w-card {
  text-align: left;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #151310;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.w-card:hover { border-color: rgba(201,162,39,.55); background: #1a1712; }

.w-head { margin-bottom: 10px; }

.inline-form {
  border: 1px dashed rgba(201,162,39,.4);
  border-radius: 14px;
  padding: 12px 12px 4px;
  margin: 8px 0 14px;
  background: rgba(201,162,39,.04);
}

.inline-form .field span { font-size: 12px; }
.inline-form .field { margin-bottom: 8px; }

.c-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1a1712;
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}
.c-input:focus { border-color: rgba(201,162,39,.55); }
textarea.c-input { resize: vertical; min-height: 44px; }

select.c-input { appearance: auto; }

.btn-row { display: flex; gap: 10px; margin: 10px 0; }
.btn-row .btn { flex: 0 0 auto; padding: 9px 22px; }
.btn-row .btn-line { width: auto; padding: 9px 16px; margin: 0; }
.btn-line.cancel { border-style: solid; }

.tree-node { margin-bottom: 4px; }

.tree-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.045);
  flex-wrap: wrap;
}

.tree-name {
  border: none;
  background: transparent;
  color: #f0e2bd;
  font-size: 15px;
  font-weight: 600;
  cursor: default;
  padding: 0;
  font-family: inherit;
}

.tree-desc {
  font-size: 12.5px;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46%;
}

.tree-objs { font-size: 12px; color: #8b7f6a; }

.tree-ops { margin-left: auto; display: flex; gap: 2px; }

.op {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 8px;
  font-family: inherit;
}
.op:hover { color: #f0e2bd; background: rgba(255,255,255,.05); }
.op.danger:hover { color: #e06c5a; background: rgba(224,108,90,.08); }

.tree-kids { border-left: 1px solid rgba(201,162,39,.18); margin-left: 8px; }
.tree-kids .tree-head { margin-left: 14px; }

.tree-form { margin-left: 8px; }

.char-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #151310;
}

.char-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.char-name { font-size: 15px; font-weight: 600; color: #f0e2bd; }

.badge {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  color: var(--ink-dim);
}
.badge.ok { color: #d8b23a; border-color: rgba(201,162,39,.45); }
.badge.cast {
  color: #9fc0ea;
  border-color: rgba(140,190,255,.4);
  background: rgba(90,140,220,.14);
}

.char-home { font-size: 12px; color: #8b7f6a; }
.char-head .tree-ops { margin-left: auto; }

.char-detail { font-size: 13px; color: var(--ink-dim); margin-top: 5px; }

.char-secret {
  font-size: 12.5px;
  color: #a08b57;
  margin-top: 4px;
}
.char-secret::before { content: '🔒 '; }

.rel-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.045);
  flex-wrap: wrap;
}

.rel-line b { font-size: 14px; color: #f0e2bd; font-weight: 600; }

.rel-label {
  font-size: 12.5px;
  color: #d8b23a;
  border: 1px solid rgba(201,162,39,.35);
  border-radius: 999px;
  padding: 1px 9px;
}

.rel-metrics {
  font-size: 12px;
  color: #7fb2c9;
  border: 1px solid rgba(127,178,201,.3);
  border-radius: 999px;
  padding: 1px 9px;
}

.ledger-time {
  font-size: 11.5px;
  color: rgba(240,226,189,.45);
  font-variant-numeric: tabular-nums;
}

/* 关系线面板里的流水小字 */
.rel-event {
  width: 100%;
  font-size: 12px;
  color: rgba(240,226,189,.55);
  padding: 2px 0 0 14px;
}
.rel-event::before { content: '· '; }

.rel-row .op { margin-left: auto; }

@media (max-width: 520px) {
  .w-list { grid-template-columns: 1fr; }
  .tree-desc { max-width: 100%; }
}

.manage-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  padding: 10px;
  font-size: 13px;
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px dashed var(--line);
  border-radius: 12px;
  transition: color .15s, border-color .15s;
}
.manage-link:hover { color: #f0e2bd; border-color: rgba(201,162,39,.5); }

/* ================= 准备进场（/prep）与进房挑人 ================= */

.meta-line { color: #d8b23a; font-size: 13px; letter-spacing: .05em; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #151310;
  color: var(--ink-dim);
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s, border-color .15s;
}
.chip:hover { color: #f0e2bd; border-color: rgba(201,162,39,.5); }
.chip.sel {
  color: #d8b23a;
  border-color: rgba(201,162,39,.65);
  background: rgba(201,162,39,.08);
}

.char-card {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151310;
  color: var(--ink);
  padding: 11px 13px;
  margin-bottom: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.char-card:hover { border-color: rgba(201,162,39,.5); }
.char-card.sel {
  border-color: rgba(224,190,90,.95);
  background: linear-gradient(180deg, rgba(201,162,39,.16), rgba(201,162,39,.06));
  box-shadow: 0 0 0 1px rgba(224,190,90,.45), 0 6px 20px rgba(201,162,39,.14);
}
.char-card.sel::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #e0be5a, rgba(224,190,90,.25));
}
.char-head { position: relative; }
.char-card { position: relative; }

/* 房间人物卡：左列头像 + 人名，右列 简介 / 羁绊条 + 选择状态（状态贴右） */
.char-card.face {
  display: flex;
  align-items: stretch;          /* 右列拉满卡高，羁绊条才能压到底 */
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
}
.cc-left {
  flex: none;
  align-self: flex-start;        /* 头像+人名永远贴顶 */
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.char-card.face .char-name {
  max-width: 100%;
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-face {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  line-height: 1;
  color: #efe3c4;
  border: 1px solid rgba(255,255,255,.09);
  background:
    radial-gradient(120% 120% at 30% 16%, hsl(var(--h, 210) 42% 33%), hsl(var(--h, 210) 52% 13%) 78%),
    #14120f;
}
.cc-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cc-right {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cc-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  flex-wrap: nowrap;
  margin-top: auto;              /* 底部对齐：羁绊条和状态贴卡片下沿 */
}
.cc-foot .char-core { flex: 1 1 auto; min-width: 0; }
.cc-foot .pick-state { margin-left: auto; }
.char-card.face .char-look { font-size: 11.5px; color: #8b7f6a; }
.char-card.face .char-detail {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #b6ab93;
}
.char-card.face .char-detail.dim { color: #6f6759; font-style: italic; }
.char-card.face .char-core { margin-top: 0; }
.char-card.face .char-secret,
.char-card.face .char-rels { margin-top: 0; }

/* 羁绊条可点：点自己那张卡上的条，改这一场对核心的态度 */
.char-core.with-bond.tap { cursor: pointer; }
.char-core.with-bond.tap:hover .cb-label,
.char-core.with-bond.tap:hover .cb-num { color: #f0e2bd; }
.char-core.with-bond.mooded .cb-label::after { content: ' · 临时'; color: #8b7f6a; }

/* 临时态度色板 */
.mood-pop {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10,9,7,.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(3px);
}
.mood-card {
  width: min(92vw, 340px);
  padding: 16px 16px 12px;
  border-radius: 16px;
  border: 1px solid rgba(201,162,39,.3);
  background: #1a1713;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
.mood-title { font-size: 14.5px; font-weight: 600; color: #f0e2bd; }
.mood-sub { margin-top: 5px; font-size: 11.5px; line-height: 1.65; color: #8b7f6a; }
.mood-row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 14px 0 12px;
}
.mood-dot {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  color: #9a8f79;
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.mood-dot > i {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bond, #9a8f79);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.35);
  transition: transform .15s, border-color .15s;
}
.mood-dot.on > i { border-color: #f0e2bd; transform: scale(1.08); }
.mood-dot:hover > i { transform: scale(1.12); }
.mood-bar { display: flex; gap: 8px; justify-content: flex-end; }

.pick-note { margin: 4px 0 12px; }

.join-row { margin-top: 10px; }
.join-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #151310;
  color: var(--ink);
  font-size: 16px;
  outline: none;
  text-transform: uppercase;
}

.field-row { display: flex; gap: 10px; margin-top: 12px; }
.field-row .btn { flex: 1; }

.pick-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,9,7,.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 18px;
}

.pick-card {
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  overflow-y: auto;
  background: #17140f;
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 18px;
  padding: 22px 20px;
  animation: fadeUp .28s ease-out;
}

.pick-card h2 { margin: 0 0 6px; font-size: 20px; }
.pick-card .sub { margin-bottom: 14px; }

.pick-list { margin-bottom: 8px; }

/* ================= 页面1：场景图片卡 ================= */

/* ---- 顶栏：左上世界图标（进管理树）+ 标题 + 右上头像 ---- */
.lobby-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.world-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(201,162,39,.35);
  background: linear-gradient(180deg, rgba(201,162,39,.16), rgba(201,162,39,.05));
  font-size: 24px;
  text-decoration: none;
  transition: border-color .15s, transform .12s;
}
.world-icon:hover { border-color: rgba(201,162,39,.7); }
.world-icon:active { transform: scale(.94); }

.lobby-title { flex: 1; min-width: 0; }
.lobby-title h1 { margin: 0; font-size: 22px; letter-spacing: .05em; }
.lobby-title .sub { margin: 3px 0 0; font-size: 12.5px; }

.avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid hsl(var(--h, 40) 40% 40% / .7);
  background:
    radial-gradient(120% 120% at 30% 20%, hsl(var(--h, 40) 46% 32%), hsl(var(--h, 40) 50% 16%));
  color: #f2e8d4;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: transform .12s, border-color .15s;
}
.avatar:hover { border-color: rgba(201,162,39,.8); }
.avatar:active { transform: scale(.94); }
.avatar.sm { width: 34px; height: 34px; font-size: 16px; }
/* 聊天室右上角：我扮演的那个人（头像 + 名字） */
.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  flex: 0 0 auto;
  max-width: 40vw;
}
.me-chip .avatar { pointer-events: none; }
.me-chip:active .avatar { transform: scale(.94); }
.me-name {
  /* 头像后面不再显示名字：我是谁看头像（title 里也有全名） */
  display: none;
  font-size: 12.5px;
  color: #ded7c7;
  letter-spacing: .02em;
  max-width: 5.6em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.avatar.has-photo {
  background-size: cover;
  background-position: center 30%;
  color: transparent;
  border-color: rgba(201,162,39,.55);
}
/* 头像下的子菜单 */
.me-menu {
  position: fixed;
  z-index: 70;
  min-width: 148px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(201,162,39,.32);
  background: rgba(24,21,17,.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}
.me-item {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: #e9e2d2;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.me-item:hover { background: rgba(255,255,255,.07); }
.me-item.hidden { display: none; }

/* 头像编辑浮层 */
.user-pop {
  position: fixed;
  z-index: 60;
  top: calc(78px + env(safe-area-inset-top));
  right: 14px;
  width: min(300px, calc(100vw - 28px));
  padding: 14px 14px 12px;
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 16px;
  background: rgba(24,21,17,.97);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  animation: fadeUp .2s ease-out;
}

.up-head {
  font-size: 11.5px;
  letter-spacing: .14em;
  color: #d8b23a;
  margin-bottom: 10px;
}

.up-avs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.up-av {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #151310;
  font-size: 17px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: border-color .15s, background .15s;
}
.up-av:hover { border-color: rgba(201,162,39,.5); }
.up-av.sel {
  border-color: rgba(201,162,39,.85);
  background: rgba(201,162,39,.14);
}

.user-pop .field { margin-bottom: 10px; }

.up-acts { display: flex; gap: 8px; }
.up-acts .btn { flex: 1; padding: 9px 0; font-size: 14px; }

.top-right { display: flex; align-items: center; gap: 10px; }

.cover-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  margin-bottom: 6px;
  max-height: 460px;
  overflow-y: auto;
}

.cover-card {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #151310;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
  transition: border-color .18s, transform .12s;
}

.cover-card:hover { border-color: rgba(201,162,39,.55); }
.cover-card:active { transform: scale(.98); }

.cover {
  position: relative;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(130% 120% at 22% 12%, hsl(var(--h, 210) 40% 30%), hsl(var(--h, 210) 52% 13%) 72%),
    #0f0d0a;
}

.cover-art {
  font-size: 40px;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.55));
  opacity: .9;
}

@media (max-width: 380px) {
  .cover-art { font-size: 32px; }
  .cover-syn { -webkit-line-clamp: 2; font-size: 12px; }
}

/* 悬停浮出：剧情简介 + 需要人数 */
.cover-hover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 5px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(10,9,7,.1) 20%, rgba(10,9,7,.9) 82%);
  opacity: 0;
  transition: opacity .18s;
}

.cover-card:hover .cover-hover,
.cover-card:focus-visible .cover-hover,
.cover-card:active .cover-hover { opacity: 1; }

/* 触屏没有 hover：简介常显 */
@media (hover: none) {
  .cover-hover { opacity: 1; }
}

.cover-story {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #e8dfcc;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover-need {
  font-size: 11.5px;
  color: #e0be5a;
  letter-spacing: .06em;
}

/* 卡面常显：名字 + 简介 + 需要人数 */
.cover-body { padding: 9px 12px 11px; }

.cover-name {
  font-size: 14px;
  font-weight: 600;
  color: #f0e2bd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cover-syn {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #a99e8b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.cover-body .cover-need {
  margin-top: 7px;
  font-size: 11.5px;
  color: #c9a227;
  letter-spacing: .05em;
}

/* ================= 页面2：剧情简介 ================= */

.page-title {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: .06em;
  font-weight: 600;
}

.page-title + .sub { margin-bottom: 18px; }

/* ================= 页面3：浮动面板（选角色 + 开幕） ================= */

.prep-panel {
  position: fixed;
  z-index: 30;
  top: calc(70px + env(safe-area-inset-top));
  right: 10px;
  width: min(330px, calc(100vw - 20px));
  max-height: min(64vh, 560px);
  overflow-y: auto;
  padding: 12px 14px 10px;
  border: 1px solid rgba(201,162,39,.35);
  border-radius: 16px;
  background: rgba(24,21,17,.93);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 48px rgba(0,0,0,.55);
  animation: fadeUp .28s ease-out;
}

/* 窄屏：贴在输入框上方的底部抽屉 */
@media (max-width: 640px) {
  .prep-panel {
    top: auto;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 56vh;
  }
}

.prep-panel.collapsed .prep-story,
.prep-panel.collapsed .prep-chars,
.prep-panel.collapsed .prep-note,
.prep-panel.collapsed .prep-foot { display: none; }

.prep-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.prep-title {
  font-size: 11.5px;
  letter-spacing: .14em;
  color: #d8b23a;
}

.prep-hint { font-size: 12px; color: var(--ink-dim); }

.prep-story {
  font-size: 13.5px;
  line-height: 1.7;
  color: #d8cfc0;
  margin: 0 0 12px;
  white-space: pre-wrap;
}

.prep-chars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.prep-chars .char-card { margin-bottom: 0; }

/* 别人已选：冷色锁定，跟自己的金色高亮一眼区分 */
.char-card.taken {
  cursor: default;
  border-color: rgba(96,120,158,.55);
  background: rgba(52,66,92,.18);
  opacity: .72;
}
.char-card.taken .char-name { color: #9fb2cf; }
.char-card.taken:hover { border-color: rgba(96,120,158,.55); }
.char-card.taken::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: rgba(96,120,158,.7);
}

.prep-note { margin: 2px 0 8px; font-size: 13px; }

.prep-foot { display: flex; justify-content: flex-end; }
.prep-foot .btn { padding: 9px 26px; }
.prep-foot .btn:disabled { opacity: .45; }

.world-open {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(201,162,39,.3);
  cursor: default;
}

.code-input {
  flex: 1;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #151310;
  color: var(--ink);
  font-size: 16px;
  outline: none;
  text-transform: uppercase;
}

@media (max-width: 520px) {
  .prep-chars { grid-template-columns: 1fr; }
}

.inline-link { color: #d8b23a; text-decoration: none; border-bottom: 1px dashed rgba(201,162,39,.5); }
.inline-link:hover { color: #f0e2bd; }

/* ================= 大厅：世界轮播 + 场景列表 ================= */

.carousel {
  position: relative;
  margin: 2px 0 2px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #151310;
}

.car-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.car-track::-webkit-scrollbar { display: none; }

.car-slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(130% 130% at 24% 14%, hsl(var(--h, 210) 42% 28%), hsl(var(--h, 210) 55% 12%) 74%),
    #0f0d0a;
  cursor: pointer;
}

.car-slide.photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.car-art {
  font-size: 52px;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.55));
  opacity: .9;
  transition: transform .22s ease;
}
.car-slide:hover .car-slide.photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.car-art { transform: translateY(-18px) scale(1.04); }

/* 悬停浮出：整条等高的说明栏，名字 + 人数 + 两行说明 + 详情 */
.car-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 12px 13px;
  background: linear-gradient(180deg, rgba(10,9,7,0) 32%, rgba(10,9,7,.9) 100%);
  opacity: 0;
  transition: opacity .2s ease;
}
.car-slide:hover .car-hover,
.car-slide:focus-visible .car-hover,
.car-slide:active .car-hover { opacity: 1; }

.car-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
}

.car-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.car-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.car-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #f6eeda;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-need {
  flex: 0 0 auto;
  padding: 1px 8px;
  border: 1px solid rgba(201,162,39,.38);
  border-radius: 999px;
  background: rgba(201,162,39,.14);
  color: #e9cb84;
  font-size: 10.5px;
  letter-spacing: .06em;
}

.car-story {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #d8ceb8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.car-go {
  flex: 0 0 auto;
  align-self: center;
  padding: 7px 16px;
  border: 1px solid rgba(201,162,39,.55);
  border-radius: 999px;
  background: rgba(201,162,39,.16);
  color: #f5e8c8;
  font-size: 12px;
  cursor: pointer;
}
.car-go:hover { background: rgba(201,162,39,.32); }
.car-go:disabled { opacity: .6; }

.car-dots {
  position: absolute;
  right: 11px;
  top: 9px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  pointer-events: none;
}
.car-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.34);
  box-shadow: 0 0 4px rgba(0,0,0,.6);
  pointer-events: auto;
  cursor: pointer;
}
.car-dots i.on { background: #c9a227; }

/* ---- 场景列表标题栏 ---- */

.sec-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 10px;
}

.sec-title {
  font-size: 13px;
  font-weight: 600;
  color: #cbbd9f;
  letter-spacing: .14em;
}

.sec-add {
  position: relative;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(201,162,39,.45);
  border-radius: 50%;
  background: rgba(201,162,39,.1);
  color: #e0be5a;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.sec-add:hover { background: rgba(201,162,39,.24); }

/* 「＋」的自定义提示（比原生 title 快） */
.sec-add::after {
  content: attr(data-tip);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: max-content;
  max-width: 216px;
  padding: 7px 10px;
  border: 1px solid rgba(201,162,39,.32);
  border-radius: 9px;
  background: rgba(12,10,8,.96);
  color: #e8dfcc;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  text-align: left;
  white-space: normal;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
  z-index: 6;
}
.sec-add:hover::after,
.sec-add:focus-visible::after { opacity: 1; transform: none; }

/* ---- 场景卡片 ---- */

.scene-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.sc-card {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #151310;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
}
.sc-card:hover { border-color: rgba(201,162,39,.55); }

/* 主场景（公寓本身）只当封面：不点进去 */
.car-slide.is-world { cursor: default; }
.car-note {
  align-self: center;
  padding: 4px 11px;
  border: 1px dashed rgba(201,162,39,.45);
  border-radius: 999px;
  color: #cbbd9f;
  font-size: 11.5px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.sc-card:active { transform: scale(.98); }

.sc-img {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  font-size: 32px;
  background:
    radial-gradient(120% 120% at 24% 14%, hsl(var(--h, 210) 42% 28%), hsl(var(--h, 210) 55% 12%) 74%),
    #0f0d0a;
}

/* 场景要几个人：图右下角常显 */
.sc-need {
  position: absolute;
  right: 7px;
  bottom: 6px;
  z-index: 2;
  padding: 2px 8px;
  border: 1px solid rgba(201,162,39,.38);
  border-radius: 999px;
  background: rgba(10,9,7,.62);
  color: #ecdcb6;
  font-size: 10.5px;
  letter-spacing: .03em;
  pointer-events: none;
}

.sc-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.sc-name {
  display: block;
  padding: 8px 11px 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #f0e2bd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 玩家自己添的场景：图上角一个小标，谁加的一眼看得到 */
.sc-by {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 9px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(10,9,7,.58);
  color: #e6d6b0;
  font-size: 10.5px;
  letter-spacing: .04em;
  pointer-events: none;
}

/* 后台「只看玩家添加的」勾选 */
.mg-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 10px;
  font-size: 12px;
  color: #a99b80;
  cursor: pointer;
}
.mg-filter input { accent-color: #c9a227; margin: 0; }

/* 后台场景树 / 人物行上的「玩家添加」徽章 */
.badge.user { color: #8fc8a8; border-color: rgba(96,168,132,.45); }
.badge.lock { color: #d88f7a; border-color: rgba(200,110,90,.45); }

.sc-go {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 3px 11px;
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 999px;
  background: rgba(10,9,7,.6);
  color: #f0e2bd;
  font-size: 11.5px;
  opacity: 0;
  transition: opacity .18s;
}
.sc-card:hover .sc-go,
.sc-card:focus-visible .sc-go { opacity: 1; }

/* 悬停提示：第一行需要人数，第二行故事说明 */
.sc-tip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(10,9,7,.94) 58%, rgba(10,9,7,.5) 100%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  z-index: 1;
}
.sc-card:hover .sc-tip,
.sc-card:focus-visible .sc-tip { opacity: 1; }

.sc-tip b {
  font-size: 12px;
  font-weight: 600;
  color: #e0be5a;
  letter-spacing: .05em;
}

.sc-tip i {
  font-style: normal;
  font-size: 12px;
  line-height: 1.55;
  color: #ded4bf;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 触屏没有 hover：说明常显、进入按钮常在 */
@media (hover: none) {
  .sc-tip {
    position: static;
    opacity: 1;
    background: none;
    padding: 0 11px 9px;
  }
  .sc-tip i { -webkit-line-clamp: 2; color: #a99e8b; }
  .sc-go { opacity: 1; }
  .car-hover { opacity: 1; background: linear-gradient(180deg, rgba(10,9,7,0) 40%, rgba(10,9,7,.7) 100%); }
}

@media (max-width: 380px) {
  .car-slide { aspect-ratio: 4 / 3; }
  .car-slide.photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.car-art { font-size: 42px; }
  .car-panel { max-width: 100%; }
}

/* ================= 页面2：详情三栏（场景 / 剧情 / 人物） ================= */

.detail-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1.1fr;
  gap: 14px;
  margin-top: 18px;
  align-items: start;
}

.dcol {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.015);
}

.dcol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.dcol-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .16em;
  color: #cbbd9f;
}

.lock-tag {
  font-size: 10.5px;
  letter-spacing: .08em;
  color: #d8b23a;
  border: 1px solid rgba(201,162,39,.45);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(201,162,39,.1);
}

.mode-tag.locked {
  color: #e08a4b;
  border-color: rgba(224,138,75,.5);
  background: rgba(224,138,75,.1);
}

.mini-btn {
  font-size: 11.5px;
  padding: 4px 10px;
  border: 1px solid rgba(201,162,39,.35);
  border-radius: 999px;
  background: transparent;
  color: #cbbd9f;
  cursor: pointer;
}
.mini-btn:hover { background: rgba(201,162,39,.14); color: #f0e2bd; }

/* 画面卡 */
.img-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

/* 画面卡：锁定 9:16，点开看大图 */
.img-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid rgba(255,255,255,.07);
  background:
    radial-gradient(130% 130% at 30% 16%, hsl(var(--h, 210) 42% 32%), hsl(var(--h, 210) 55% 11%) 76%),
    #0f0d0a;
  transition: transform .16s ease, border-color .16s ease;
}
.img-card:hover { transform: translateY(-2px); border-color: rgba(201,162,39,.5); }
.img-card:active { transform: scale(.98); }

.img-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.img-card.photo { border-color: rgba(255,255,255,.12); }
.img-card.photo .img-cap {
  padding: 18px 6px 6px;
  opacity: 0;
  transition: opacity .18s;
}
.img-card.photo:hover .img-cap { opacity: 1; }

.img-emoji {
  font-size: 34px;
  transform: translateY(-12px);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.58));
}

.img-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 6px 6px;
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: .02em;
  color: rgba(240,232,214,.9);
  text-align: center;
  background: linear-gradient(180deg, rgba(10,9,7,0) 0%, rgba(10,9,7,.9) 52%);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.img-x {
  position: absolute;
  top: 4px; right: 4px;
  z-index: 3;
  width: 17px; height: 17px;
  border: none;
  border-radius: 50%;
  background: rgba(10,9,7,.62);
  color: #e8dfcc;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .16s;
}
.img-card:hover .img-x { opacity: 1; }

.img-empty {
  grid-column: 1 / -1;
  width: 100%;
  padding: 16px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #7b7266;
  text-align: center;
}

.ai-row { display: flex; gap: 8px; flex-wrap: wrap; }

.ai-btn {
  padding: 6px 11px;
  border: 1px solid rgba(201,162,39,.34);
  border-radius: 999px;
  background: rgba(201,162,39,.07);
  color: #e0be5a;
  font-size: 11.5px;
  cursor: pointer;
}
.ai-btn:hover { background: rgba(201,162,39,.2); color: #f7edd3; }
.ai-btn:disabled { opacity: .55; cursor: default; }

.dcol textarea.c-input { min-height: 96px; }
.dcol textarea.grow { min-height: 220px; flex: 1; }

/* 人物栏 */
.char-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
}

.dchar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151310;
}

.dchar-head { display: flex; align-items: center; gap: 9px; }

.dchar-cover {
  width: 46px;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  font-size: 16px;
  cursor: zoom-in;
  background:
    radial-gradient(130% 130% at 30% 16%, hsl(var(--h, 210) 38% 30%), hsl(var(--h, 210) 50% 12%) 76%),
    #0f0d0a;
}
.dchar-cover:hover { border-color: rgba(201,162,39,.5); }

.dchar-titles { flex: 1; min-width: 0; }

.dchar-name {
  font-size: 13px;
  padding: 5px 8px;
  min-height: 0;
}

.dchar-name-txt {
  font-size: 14px;
  font-weight: 600;
  color: #f0e2bd;
}

.dchar-brief {
  font-size: 12.5px;
  min-height: 52px !important;
}

/* 底部两个按钮 */
.enter-bar {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.enter-bar .btn { flex: 1; }

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .char-list { max-height: none; }
  .dcol textarea.grow { min-height: 140px; }
}


/* ================= 看大图 ================= */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6,5,4,.9);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: lbIn .16s ease;
}
.lightbox.hidden { display: none; }

@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }

.lb-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* 大图也锁 9:16 */
.lb-card {
  width: min(70vw, 300px);
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 24px 60px rgba(0,0,0,.62);
  background:
    radial-gradient(130% 130% at 30% 16%, hsl(var(--h, 210) 42% 34%), hsl(var(--h, 210) 55% 10%) 76%),
    #0f0d0a;
}
.lb-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

/* 自己上传的横图别裁掉两边，整张显示 */
.lb-card img.fit {
  object-fit: contain;
  background: #0b0a09;
}

.lb-card span {
  font-size: 86px;
  filter: drop-shadow(0 10px 26px rgba(0,0,0,.6));
}

.lb-cap {
  max-width: 78vw;
  color: #e8dfcc;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.lb-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  background: rgba(10,9,7,.6);
  color: #e8dfcc;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.lb-close:hover { background: rgba(201,162,39,.24); }

@media (max-width: 480px) {
  .lb-card { width: min(74vw, 260px); }
  .lb-card span { font-size: 68px; }
}

/* 画面描述框：AI 翻译出来的那句，用户可改 */
.shot-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px 10px;
  border: 1px dashed rgba(201,162,39,.32);
  border-radius: 12px;
  background: rgba(201,162,39,.05);
}
.shot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .06em;
  color: #d9c48a;
}
.shot-box textarea.c-input {
  min-height: 62px;
  font-size: 12.5px;
  line-height: 1.6;
  background: rgba(0,0,0,.22);
  border-color: rgba(255,255,255,.08);
}

/* 人物卡右上角的小删除钮 */
.dchar-x {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  color: #8d8474;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.dchar-x:hover { background: rgba(220,80,60,.16); color: #ff9d8a; }
.dchar-x.arm {
  background: rgba(220,80,60,.3);
  color: #ffb4a6;
  animation: xArm .9s ease-in-out infinite alternate;
}
@keyframes xArm { from { transform: scale(1); } to { transform: scale(1.18); } }

/* 退出 / 散场：圆形白底，跟头像一个风格，图标画在中间 */
.icon-btn.exit-btn {
  width: 38px; height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f7f2e7;
  border: 1px solid rgba(201,162,39,.55);
  color: #2b2419;
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.icon-btn.exit-btn svg { width: 21px; height: 21px; display: block; }
.icon-btn.exit-btn:hover { background: #fffaf0; }
.icon-btn.exit-btn:active { background: #ece3d0; color: #2b2419; }

/* 散场按钮（房主）：确认时白底转红、脉动 */
#finishBtn.arm {
  background: #f6d8d2;
  border-color: rgba(196,74,58,.8);
  color: #8e2a1c;
  animation: xArm .9s ease-in-out infinite alternate;
}

/* 剧情线：在这里玩过的每一场 */
.story-line {
  margin-top: 10px;
  padding: 9px 10px 10px;
  border: 1px dashed rgba(140,190,255,.28);
  border-radius: 12px;
  background: rgba(90,140,220,.06);
}
.sl-head {
  font-size: 11px;
  letter-spacing: .06em;
  color: #9fc0ea;
  margin-bottom: 8px;
}
.sl-items { display: flex; flex-direction: column; gap: 8px; }
.sl-item {
  padding: 8px 9px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: rgba(0,0,0,.2);
  cursor: pointer;
}
.sl-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.sl-when { font-size: 11px; color: #7d8ba0; }
.sl-open { font-size: 11px; color: #9fc0ea; }
.sl-text {
  font-size: 12.5px;
  line-height: 1.65;
  color: #d8d5cc;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.sl-item.open .sl-text {
  display: block;
  -webkit-line-clamp: unset;
}

/* 管理页：世界 / 场景 / 剧情 / 人物 四个模块页签 */
.mg-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 4px;
}
.mg-tab {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  color: #9a9284;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mg-tab:hover { background: rgba(255,255,255,.06); }
.mg-tab.active {
  background: rgba(201,162,39,.14);
  border-color: rgba(201,162,39,.4);
  color: #e8d9a8;
}
.mg-pane { margin-top: 6px; }
.mg-pane .divider { margin-top: 12px; }
.mg-pane .field { margin-bottom: 8px; }

/* 管理页：按钮行别被拉成长条 */
.mg-pane .ai-row { display: flex; gap: 8px; }
.mg-pane .ai-row .btn { width: auto; flex: 1; }
.mg-tabs + .mg-pane { min-height: 120px; }

/* 管理页：助手下的二级菜单（点条目去另一个小工具，新页签打开） */
.mg-sub { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.mg-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  color: inherit;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.mg-sub-item:hover {
  background: rgba(201,162,39,.12);
  border-color: rgba(201,162,39,.4);
}
.mg-sub-ico { font-size: 18px; line-height: 1; }
.mg-sub-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mg-sub-txt b { font-size: 14px; font-weight: 600; color: #e8d9a8; }
.mg-sub-txt i { font-style: normal; font-size: 12px; color: #9a9284; }
.mg-sub-go { font-size: 12px; color: #9a9284; white-space: nowrap; }
.mg-sub-item:hover .mg-sub-go { color: #e8d9a8; }

/* 管理页：锁定提示条 */
.lock-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid rgba(201,162,39,.28);
  border-radius: 10px;
  background: rgba(201,162,39,.06);
}
.lock-why { font-size: 11.5px; color: #a09578; flex: 1; }
.lock-bar .btn-line { width: auto; flex: 0 0 auto; }
.lock-bar .btn-line.danger {
  color: #ffb4a6;
  border-color: rgba(220,80,60,.4);
  background: rgba(220,80,60,.16);
}

/* 管理页剧情：各场景剧情折叠行 */
.sp-row {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: rgba(0,0,0,.18);
  margin-bottom: 8px;
  overflow: hidden;
}
.sp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
}
.sp-name { font-size: 13px; color: #e8e2d6; flex: 0 0 auto; }
.sp-hint {
  flex: 1;
  font-size: 11.5px;
  color: #8d8579;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sp-body { padding: 0 10px 10px; }
.sp-body textarea.c-input { margin-bottom: 8px; font-size: 12.5px; line-height: 1.6; }

/* 锁定后输入框一眼看出不能改 */
.c-input:disabled,
textarea.c-input:disabled {
  opacity: .55;
  cursor: not-allowed;
  background: rgba(0,0,0,.3);
}

/* 人物列表：两列横版小卡 */
#charListHome { grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* ---- 大厅列表选项卡：场景 / 人物 ---- */
.lobby-tabs { display: flex; gap: 6px; }
.lobby-tab {
  padding: 7px 16px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  color: #9a9284;
  font-size: 12.5px;
  letter-spacing: .05em;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.lobby-tab:hover { background: rgba(255,255,255,.06); }
.lobby-tab.active {
  background: rgba(201,162,39,.14);
  border-color: rgba(201,162,39,.4);
  color: #e8d9a8;
}

/* 人物卡：横版小卡（名单性质，比场景卡小一号） */
.pc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151310;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: border-color .15s;
}
.pc-row:hover { border-color: rgba(201,162,39,.55); }
.pc-row:active { transform: scale(.98); }

.pc-thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background:
    radial-gradient(120% 120% at 24% 14%, hsl(var(--h, 210) 42% 28%), hsl(var(--h, 210) 55% 12%) 74%),
    #0f0d0a;
}
.pc-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.pc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pc-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: #f0e2bd;
}
.pc-line b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-line .badge { flex: 0 0 auto; }
.pc-brief {
  font-size: 11.5px;
  line-height: 1.5;
  color: #a89e8c;
  white-space: nowrap;      /* 一行截断，详细信息点开看 */
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-brief.dim { color: #6f675a; }

/* 人物卡：整张图完整显示（不缺头也不裁脚），两侧留底色 */
.pc-img { background: #0d0b09; }
.pc-img img { object-fit: contain; }
.pc-card .sc-name { padding-bottom: 4px; }

/* ---- 剧情关联人物 ---- */
.plot-chars { margin-top: 10px; }
.pch-head {
  font-size: 11px;
  letter-spacing: .06em;
  color: #d9c48a;
  margin-bottom: 7px;
}
.plot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: #b3aa99;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip-btn:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.chip-btn.on {
  background: rgba(201,162,39,.18);
  border-color: rgba(201,162,39,.5);
  color: #f0dfae;
}
.chip-btn:disabled { opacity: .55; cursor: not-allowed; }

/* 人物卡里：参与的剧情 */
.c-rel {
  margin-top: 6px;
  border: 1px dashed rgba(140,190,255,.25);
  border-radius: 10px;
  background: rgba(90,140,220,.05);
  overflow: hidden;
}
.c-rel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  cursor: pointer;
  font-size: 11.5px;
}
.c-rel-tag { color: #9fc0ea; }
.c-rel-items { display: flex; flex-direction: column; }
.c-rel-item {
  padding: 7px 9px;
  border-top: 1px solid rgba(255,255,255,.05);
  cursor: pointer;
}
.c-rel-item:hover { background: rgba(255,255,255,.03); }
.c-rel-item b { font-size: 12px; color: #e8dfcc; }
.c-rel-item p {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #948c7d;
}

/* 剧情线条目：这一场的出场人物 */
.sl-cast {
  font-size: 11px;
  color: #8fb3dd;
  margin-bottom: 3px;
}

/* ================= 场景页：上栏画面 + 下栏这一场 ================= */

.scene-page {
  min-height: 100%;
  display: flex;
  justify-content: center;
  padding: 14px 12px calc(26px + env(safe-area-inset-bottom));
}

.scene-card {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- 上栏：画面轮播 ---- */

.up-pane { display: flex; flex-direction: column; gap: 10px; }

.hero {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f0d0a;
  /* 默认横条：让下面的剧情和挑人一进来就在视野里 */
  aspect-ratio: 16 / 9;
  max-height: 32vh;
  box-shadow: 0 18px 42px rgba(0,0,0,.42);
  transition: max-height .22s ease;
}
/* 改场景设定时放大回去，生图/换图要看清效果 */
.hero.big {
  aspect-ratio: auto;
  height: 60vh;
  max-height: 60vh;
}

.hero-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hero-track::-webkit-scrollbar { display: none; }

.hero-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  background:
    radial-gradient(130% 130% at 26% 14%, hsl(var(--h, 210) 42% 30%), hsl(var(--h, 210) 55% 11%) 74%),
    #0f0d0a;
  cursor: zoom-in;
}
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.hero-emoji {
  font-size: 72px;
  transform: translateY(-16px);
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.6));
}
.hero-cap {
  position: absolute;
  left: 12px; top: 12px;
  max-width: 60%;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(10,9,7,.55);
  color: rgba(240,232,214,.9);
  font-size: 10.5px;
  letter-spacing: .04em;
  backdrop-filter: blur(4px);
}

/* 说明：半透明浮在画面上 */
.hero-desc {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  z-index: 3;
  padding: 8px 11px 9px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(14,12,9,.42);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  cursor: pointer;
  transition: background .18s ease;
}
.hero-desc:hover { background: rgba(14,12,9,.52); }
/* 展开时整块在画面内滚动，不会顶出画面被裁掉 */
.hero-desc.open {
  max-height: calc(100% - 20px);
  overflow-y: auto;
  background: rgba(14,12,9,.72);
}

.hero-name {
  margin: 0 0 3px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: #f8f1de;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 54px;
}
/* 说明被截断时右上角给个提示，点一下展开全文 */
.hero-desc.clip::after {
  content: '展开 ▾';
  position: absolute;
  right: 11px; top: 10px;
  font-size: 10px;
  letter-spacing: .04em;
  color: rgba(240,232,214,.6);
  pointer-events: none;
}
.hero-desc.clip.open::after { content: '收起 ▴'; }
.hero-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(242,235,219,.88);
  text-shadow: 0 1px 6px rgba(0,0,0,.55);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-desc.open .hero-text {
  display: block;
  -webkit-line-clamp: unset;
  max-height: none;
  overflow-y: visible;
}

.hero-dots {
  position: absolute;
  right: 12px; top: 11px;
  z-index: 4;
  display: flex;
  gap: 6px;
}
.hero-dots.hidden { display: none; }
.hero-dots i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.38);
  box-shadow: 0 0 5px rgba(0,0,0,.65);
  cursor: pointer;
}
.hero-dots i.on { background: #e0be5a; }

.hero-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-size: 13.5px;
  color: #8a8172;
  letter-spacing: .04em;
  background:
    radial-gradient(120% 110% at 50% 30%, #211d17, #14120f 72%);
}
.hero-empty span { font-size: 11.5px; color: #6f675a; line-height: 1.7; max-width: 74%; }
/* 没画面时不用占满一屏，短一点当横幅 */
.hero.empty { aspect-ratio: 16 / 9; max-height: 32vh; }

/* ---- 剧情线：横向滚动播放 ---- */

.ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px dashed rgba(140,190,255,.26);
  border-radius: 12px;
  background: rgba(90,140,220,.06);
  overflow: hidden;
}
.ticker-tag {
  flex: 0 0 auto;
  padding-right: 8px;
  border-right: 1px solid rgba(140,190,255,.22);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: #9fc0ea;
}
.ticker-view {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.ticker-track {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  will-change: transform;
}
.ticker-count { flex: 0 0 auto; font-size: 10.5px; color: #7d8ba0; }

.tk-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  background: rgba(0,0,0,.26);
  color: #d8d5cc;
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
}
.tk-item:hover { border-color: rgba(140,190,255,.42); background: rgba(90,140,220,.14); }
.tk-when { color: #8fa6c4; font-size: 10.5px; }
.tk-who { color: #8fb3dd; font-size: 10.5px; }
.tk-text { color: #d8d5cc; }
.tk-empty { font-size: 11.5px; color: #6f7c8c; padding-left: 2px; }

/* ---- 场景设定（折叠） ---- */

.edit-toggle {
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  color: #9a9083;
  font-size: 12px;
  letter-spacing: .06em;
  cursor: pointer;
}
.edit-toggle:hover { color: #e0be5a; border-color: rgba(201,162,39,.4); }
.edit-toggle.on { color: #d9c48a; border-color: rgba(201,162,39,.4); background: rgba(201,162,39,.05); }

.edit-pane {
  margin-top: 8px;
  padding: 12px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.015);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.edit-pane .field { margin-bottom: 0; }
.edit-pane .img-strip { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.edit-hint { align-self: center; font-size: 11px; color: #7b7266; }
.btn.ghost.sm { width: auto; flex: 0 0 auto; padding: 9px 18px; font-size: 13px; }

/* ---- 下栏：这一场怎么演 ---- */

.down-pane {
  padding: 13px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(38,33,27,.6), rgba(26,23,19,.45));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.down-pane .field { margin-bottom: 0; }
.down-pane textarea.c-input { min-height: 92px; }
.down-sub { font-size: 11px; color: #8a8172; letter-spacing: .04em; }

.cast-blk {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.cast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  letter-spacing: .08em;
  color: #cbbd9f;
}
.cast-hint { margin: 0; font-size: 11px; line-height: 1.65; color: #7b7266; }

/* 谁上场：右边两个小按钮（挑人 / 添加人物） */
.cast-head-btns { display: flex; gap: 6px; }
.cast-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px dashed rgba(201,162,39,.3);
  border-radius: 10px;
  background: rgba(201,162,39,.05);
}
.cast-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: #cbbd9f;
}
.cast-pick-bar { display: flex; gap: 8px; justify-content: flex-end; }

/* 核心人物：场景页的选择行 + 人物卡上的羁绊一行 */
.core-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.core-sel {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  color: #e6dcc6;
  font-size: 12.5px;
}
.core-hint {
  font-size: 11px;
  color: #7b7266;
  white-space: nowrap;
}
.chip-btn.core {
  border-color: rgba(201,162,39,.55);
  color: #f0dfae;
}
.char-core {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: .04em;
  color: #9a8f79;
}
.char-core.is-core { color: #e0be5a; }

/* 羁绊进度条：长度=羁绊（0~100），颜色=温度（--bond 由脚本按温度算） */
.char-core.with-bond {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  letter-spacing: 0;
}
.char-core .cb-label {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.char-core .cb-num {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--bond, #9a8f79);
}
.char-core .cb-temp {
  flex: none;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--bond, #9a8f79);
  opacity: .8;
}
.bond-bar {
  flex: 1 1 auto;
  min-width: 30px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
  overflow: hidden;
}
.bond-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--bond, #9a8f79);
  box-shadow: 0 0 9px -1px var(--bond, #9a8f79);
  transition: width .35s ease, background .35s ease;
}

/* ---- 添加人物页 ---- */

.char-page {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow-y: auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 60% at 50% 0%, #241f18 0%, rgba(20,18,15,0) 62%),
    var(--bg);
}
.cp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto 14px;
}
.cp-bar .back {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink-dim);
  cursor: pointer;
}
.cp-bar .back:hover { color: #f0e2bd; }
.cp-title { font-size: 15px; letter-spacing: .1em; color: #e8dfcc; }

.cp-body {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cp-top { display: flex; gap: 12px; align-items: stretch; }
.cp-cover {
  flex: 0 0 auto;
  width: 96px;
  height: 128px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  cursor: pointer;
  background:
    radial-gradient(130% 130% at 30% 16%, hsl(var(--h, 210) 42% 32%), hsl(var(--h, 210) 55% 11%) 76%),
    #0f0d0a;
}
.cp-cover.photo { border-color: rgba(255,255,255,.12); }
.cp-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}
.cp-side .field { margin-bottom: 0; }

/* ---- 剧情线一条的详情 ---- */

.story-modal {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(6,5,4,.84);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.sm-card {
  width: 100%;
  max-width: 520px;
  max-height: 74vh;
  overflow-y: auto;
  padding: 14px 15px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #1b1814;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.sm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.sm-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.9;
  color: #ddd8ca;
  white-space: pre-wrap;
}
.sm-card .lb-close {
  position: static;
  width: 26px; height: 26px;
  font-size: 15px;
  background: rgba(255,255,255,.06);
}

@media (max-width: 420px) {
  .hero { aspect-ratio: 16 / 10; }
  .hero.big { aspect-ratio: auto; height: 62vh; max-height: 62vh; }
  .hero-name { font-size: 15.5px; padding-right: 50px; }
  .hero-desc { left: 8px; right: 8px; bottom: 8px; padding: 7px 10px 8px; }
  .cp-cover { width: 82px; height: 108px; }
}

/* 顶栏塞了「天气读数 + 天气 + 头像 + 退出」：窄屏只留头像和天气图标 */
.stage-chip b { font-weight: 400; }
@media (max-width: 480px) {
  .say-hint { display: none; }
  .send-btn { padding: 0 16px; }
  .tool-btn { padding: 0 10px; }
  .bar { gap: 7px; padding-left: 10px; padding-right: 10px; }
  .theme { font-size: 14px; }
  .me-name { display: none; }
  .stage-chip { padding: 2px 7px; font-size: 11px; }
  .stage-sep { display: none; }
}
@media (max-width: 360px) {
  /* 只有 360 这种极窄屏才把天气的字收起来（名字进 title） */
  .stage-chip span { display: none; }
  .stage-chip { padding: 3px 7px; }
}

/* ---- 选人状态角标：右对齐，自己在演 vs 别人在演 ---- */

.pick-state {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .04em;
  white-space: nowrap;
}

.pick-state.mine {
  color: #1c1608;
  background: linear-gradient(180deg, #ecd182, #c9a227);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(201,162,39,.35);
}

.pick-state.theirs {
  color: #9fb2cf;
  border: 1px solid rgba(96,120,158,.5);
  background: rgba(52,66,92,.28);
}

.pick-state.free {
  color: #8a8172;
  border: 1px dashed var(--line);
  background: none;
}

/* ---- 选人卡：高度跟着内容走（头像 64 + 简介 + 羁绊/状态行） ---- */

.prep-chars { grid-auto-rows: auto; }

.prep-chars .char-card {
  height: auto;
  margin-bottom: 0;
  padding: 14px;
  overflow: visible;
}

.prep-chars .char-detail,
.prep-chars .char-secret {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prep-chars .char-detail { -webkit-line-clamp: 3; }

.prep-chars .char-secret {
  -webkit-line-clamp: 2;
  text-overflow: ellipsis;
}

/* ================= 选人面板：占聊天页上半部分，下半部分留着聊天 ================= */

.prep-panel {
  position: fixed;
  z-index: 30;
  top: calc(62px + env(safe-area-inset-top));
  bottom: auto;
  left: 10px;
  right: 10px;
  width: auto;
  max-width: 560px;
  margin: 0 auto;
  height: calc(50vh - 62px - env(safe-area-inset-top));
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px 10px;
  border: 1px solid rgba(201,162,39,.32);
  border-radius: 16px;
  background: rgba(24,21,17,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 48px rgba(0,0,0,.5);
  animation: fadeUp .22s ease-out;
}

/* 面板里剧情只露两行，别把它撑成主角 */
.prep-panel .prep-story {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* 收起来就剩一条抬头，不挡聊天 */
.prep-panel.collapsed {
  height: auto;
  max-height: none;
  overflow: visible;
  padding-bottom: 12px;
}

/* 剧中头顶的「序幕」分隔 */
.prologue-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 2px 14px;
  color: rgba(201,162,39,.72);
  font-size: 11.5px;
  letter-spacing: .3em;
}
.prologue-sep::before,
.prologue-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,162,39,.34));
}
.prologue-sep::after {
  background: linear-gradient(270deg, transparent, rgba(201,162,39,.34));
}

/* 面板装不下时，底部提示还能往下翻 */
.prep-more {
  position: sticky;
  bottom: -10px;
  margin: 2px -14px -10px;
  padding: 9px 0 7px;
  text-align: center;
  font-size: 11px;
  letter-spacing: .08em;
  color: #93866f;
  background: linear-gradient(180deg, rgba(24,21,17,0), rgba(24,21,17,.94) 55%);
  pointer-events: none;
}

/* ================= 选人面板 v2：通栏 + 抬头固定 ================= */

.prep-panel {
  display: flex;
  flex-direction: column;
  top: calc(62px + env(safe-area-inset-top));
  bottom: 0;                     /* 全屏：一直铺到屏幕底，收起才会缩回去 */
  height: auto;
  max-height: none;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;              /* 滚动交给内部的 .prep-body */
  border: none;
  border-radius: 16px 16px 0 0;
  /* 后面的聊天还看得出是层皮，但字看不清（只透一点 + 毛玻璃） */
  background: rgba(20,17,13,.975);
  backdrop-filter: blur(22px) saturate(115%);
  -webkit-backdrop-filter: blur(22px) saturate(115%);
}

/* 抬头：标题 + 状态 + 开幕 + 收起，一直贴在面板顶上 */
.prep-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.055);
  background: rgba(20,18,14,.72);
}

.prep-top-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.prep-top-txt .prep-hint {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prep-start {
  flex: 0 0 auto;
  padding: 7px 18px;
  font-size: 13px;
  border-radius: 999px;
}
.prep-start:disabled { opacity: .45; }

.prep-panel .op {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--ink-dim);
  cursor: pointer;
}
.prep-panel .op:hover { color: #e0be5a; border-color: rgba(201,162,39,.4); }

/* 内容区：只有这一块滚 */
.prep-body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 11px 14px 10px;
}

.prep-sub {
  margin: 2px 0 8px;
  font-size: 11.5px;
  letter-spacing: .14em;
  color: #d8b23a;
}

/* 收起来就只剩抬头那一条 */
.prep-panel.collapsed {
  bottom: auto;
  height: auto;
  padding: 0;
  overflow: visible;
  border-radius: 0 0 16px 16px;
}
.prep-panel.collapsed .prep-body { display: none; }

/* 选人面板：占屏幕 80%（下面留一条能看见聊天），背景 30% 不透明 + 毛玻璃 */
#prepPanel {
  bottom: auto;
  height: min(80vh, calc(100vh - 76px - env(safe-area-inset-top)));
  max-height: none;
  border: 1px solid rgba(201,162,39,.22);
  border-radius: 16px;
  background: rgba(24,21,17,.3);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
}
#prepPanel.collapsed {
  height: auto;
  max-height: none;
}

/* 提示改成贴在内容区底部 */
.prep-more {
  margin: 2px -14px -10px;
}

/* ================= 聊天：自己靠右，别人靠左 ================= */

/* 默认（别人）：左边，气泡小尾巴朝左下 */
.msg.player,
.msg.player.talk { justify-content: flex-start; }

.msg.player .bubble,
.msg.player.talk .bubble {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 14px;
}

/* 自己：右边，小尾巴朝右下，颜色比别人的暖一档 */
.msg.player.mine,
.msg.player.talk.mine { justify-content: flex-end; }

.msg.player.mine .bubble,
.msg.player.talk.mine .bubble {
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}

.msg.player.mine .bubble {
  background: #2b2418;
  border-color: rgba(201,162,39,.34);
}

.msg.player.talk.mine .bubble {
  background: #1d2634;
  border-color: rgba(120,160,220,.4);
}

.msg.player.mine .who { color: var(--gold); opacity: .95; }

/* 单列聊天流（像 QQ 那样）：一条一条往下排，只是自己的靠右、别人的靠左 */
.msg.player .bubble { max-width: 78%; }
.msg.player.mine .who { text-align: right; }

/* 这句是冲我说的：金圈标一下（放在后面，压过上面的气泡配色） */
.msg.player.talk.to-me .bubble,
.msg.player.act.to-me .bubble {
  border-color: rgba(201,162,39,.55);
  border-style: solid;
  box-shadow: 0 0 0 1px rgba(201,162,39,.12);
}

/* 旁观（没认领角色）：输入区变灰，只能看 */
.saybar.spectate {
  opacity: .66;
  border-top-color: rgba(255,255,255,.06);
}
.saybar.spectate .say-input {
  color: #8a8172;
  text-align: center;
  letter-spacing: .06em;
}
.saybar.spectate .tool-btn,
.saybar.spectate .send-btn {
  opacity: .45;
  cursor: not-allowed;
}

/* 旁白里有人开口：台词单独一行，念起来才像在说话 */
.msg.gm p.say-line {
  margin: 10px 0;
  padding-left: 10px;
  border-left: 2px solid rgba(201,162,39,.28);
}
.msg.gm .gm-who {
  font-family: -apple-system, "PingFang SC", sans-serif;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--gold-soft, #d9bf7a);
  opacity: .95;
}
.msg.gm .gm-say {
  color: #f8e3b0;
  font-weight: 500;
}

/* 这一场：开幕后加人（开放 / 锁定） */
.join-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.jm-label {
  font-size: 12px;
  letter-spacing: .06em;
  color: #cbbd9f;
}
.jm-tabs {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
}
.jm-tab {
  padding: 5px 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8a8172;
  font-size: 12px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.jm-tab.on {
  background: rgba(201,162,39,.2);
  color: #f6e6bb;
  box-shadow: inset 0 0 0 1px rgba(201,162,39,.45);
}
.jm-tab.locked.on {
  background: rgba(116,152,206,.16);
  color: #cfe0f7;
  box-shadow: inset 0 0 0 1px rgba(116,152,206,.42);
}
#jmHint { margin-top: -2px; }

/* 场景自己的「开局人数」 */
.need-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.need-ctl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.need-input {
  width: 62px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: #f0e2bd;
  font-size: 13px;
  text-align: center;
}
.need-input:focus { outline: none; border-color: rgba(201,162,39,.55); }
.need-hint {
  font-size: 11.5px;
  color: #8a8172;
  max-width: 240px;
  line-height: 1.5;
}

/* 开幕后：还没角色的人从这里「加进来」 */
.join-bar {
  position: fixed;
  left: 50%;
  bottom: calc(74px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 45;
  max-width: calc(100vw - 32px);
  padding: 9px 18px;
  border: 1px solid rgba(201,162,39,.45);
  border-radius: 999px;
  background: rgba(201,162,39,.13);
  color: #f2e2b6;
  font-size: 13px;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0,0,0,.42);
  animation: fadeUp .26s ease-out;
}
.join-bar.off {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: #8a8172;
  cursor: default;
  box-shadow: none;
}

/* 面板里临时添一个人 */
.prep-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.prep-add .mini-btn { align-self: flex-start; }
.prep-new {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px dashed rgba(201,162,39,.28);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
}
.prep-new .c-input { font-size: 13px; }
.prep-new-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}
.prep-new-bar .btn,
.prep-new-bar .btn.ghost {
  width: auto;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 18px;
  font-size: 13px;
  white-space: nowrap;
}
.prep-panel.collapsed .prep-add { display: none; }

/* 谁上场：勾了几个人，一眼看得见 */
.cast-head b.cast-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(201,162,39,.22);
  color: #f5e4b6;
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  letter-spacing: 0;
}
.cast-head b.cast-count.zero {
  background: rgba(255,255,255,.07);
  color: #8a8172;
}
.chip-btn.npc {
  border-style: dashed;
  color: #8f98a8;
}
.chip-btn.npc.on {
  border-color: rgba(116,152,206,.5);
  background: rgba(116,152,206,.16);
  color: #cfe0f7;
}
.chip-btn.npc::after {
  content: "AI";
  margin-left: 5px;
  font-size: 9px;
  letter-spacing: .04em;
  opacity: .6;
}

/* 选人面板：这一场一个人都没有（角色都被挑走了） */
.prep-empty {
  grid-column: 1 / -1;
  padding: 22px 14px;
  border: 1px dashed rgba(255,255,255,.1);
  border-radius: 12px;
  color: #7b7266;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

/* 选人卡上的关系行：他和场上谁有什么 */
.char-rels {
  font-size: 12px;
  color: #9db4d6;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.char-rels::before { content: '🔗 '; }

/* 管理页：AI 补关系 */
.btn-line.ai {
  border-style: solid;
  border-color: rgba(201,162,39,.4);
  color: #e8d5a2;
}
.btn-line.ai:disabled { opacity: .55; cursor: wait; }

/* ================= 玩家消息：头像在气泡外面 =================
   气泡里只装说的话（对谁说就写成 @某人 放在句首），
   谁说的看气泡旁边的头像；自己的头像在右边。 */

.msg.player { align-items: flex-start; }
.msg.player .p-av { pointer-events: none; margin-top: 1px; }
.msg.player.mine .p-av { order: 2; }

.msg.player .p-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 82%;
}
.msg.player.mine .p-col { align-items: flex-end; }
.msg.player .p-col .who { margin: 0 0 3px 3px; }
.msg.player.mine .p-col .who { margin: 0 3px 3px 0; }

/* 宽度交给外面那列，气泡自己撑满 */
.msg.player .bubble { max-width: 100%; }

.msg.player .say-txt { display: inline; }

/* ================= 去气泡：纯文字，只留头像和对齐 =================
   气泡的底、边、投影全撤，聊天就是聊天；
   对谁说看句首的 @某人，谁说的看头像。 */

.msg.player .bubble,
.msg.player.talk .bubble,
.msg.player.act .bubble,
.msg.player.mine .bubble,
.msg.player.talk.mine .bubble,
.msg.player.act.mine .bubble,
.msg.player.talk.to-me .bubble,
.msg.player.act.to-me .bubble,
.msg.player.mention-me .bubble {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 1px 2px;
}

/* 没了底色，字直接压在照片上：给一层阴影，亮的地方也看得清 */
.msg.player .say-txt { text-shadow: 0 1px 3px rgba(0,0,0,.6); }

/* 「行动」靠斜体和淡金分出来 */
.msg.player.act .say-txt {
  font-style: italic;
  color: #cdbd97;
}


/* ================= 自己的话：一条跟文字一样宽的暗底 =================
   不是气泡——没有圆角描边，只是一层贴着文字的淡暗底，
   让自己的话在照片上站得住；别人的还是纯文字。 */

.msg.player.mine .bubble {
  background: rgba(12,10,8,.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border-radius: 7px;
  padding: 5px 9px;
}
.msg.player.mine.talk .bubble { background: rgba(10,13,18,.53); }
.msg.player.mine.act .bubble { background: rgba(18,14,8,.5); }
/* 宽度贴着文字：把自己那列收到内容宽 */
.msg.player.mine .p-col { max-width: 82%; }
.msg.player.mine .bubble { align-self: flex-end; width: fit-content; }

/* ================= 头像 + 名字一行，话在下一行 =================
   像微信：头像挨着名字（别人的名字在头像右边、自己的在左边），
   说话的内容在下面；别人的文字左对齐、自己的右对齐。 */

.msg.player {
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.msg.player.mine { align-items: flex-end; }

.msg.player .p-head {
  display: flex;
  align-items: center;
  gap: 7px;
}
.msg.player.mine .p-head { flex-direction: row-reverse; }  /* 自己的名字在头像左边 */
.msg.player .p-av { order: 0 !important; margin: 0; }
.msg.player .p-name {
  font-size: 12.5px;
  line-height: 1;
  letter-spacing: .02em;
  opacity: .92;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 文字/暗底跟着名字的对齐走：别人的靠左，自己的靠右 */
.msg.player .p-col {
  max-width: 88%;
  margin: 0;
}
.msg.player .bubble { max-width: 100%; width: fit-content; }
.msg.player.mine .bubble { align-self: flex-end; }

/* ================= 观察结果：只有自己看得见的私密卡 =================
   和金色旁白区分开：银蓝的边，冷一点，一眼知道这是「我看到的」。 */

.msg.observe {
  border-left: 2px solid rgba(126,164,214,.6);
  padding: 10px 14px 11px;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, rgba(96,138,196,.10), rgba(96,138,196,.02) 70%, transparent);
}
.msg.observe .obs-head {
  font-size: 11.5px;
  color: #8fb2dd;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.msg.observe .obs-txt { color: #d6dee9; font-size: 14.5px; line-height: 1.65; }

/* ================= 文字垫实底，永远在人形贴图前面 =================
   层次：场景照片(z:0) → 走近的人的形象(z:1) → 聊天文字(z:2)。
   文字块全部垫纯色实底，照片再花也压不住字。 */
.msg.player .bubble {
  background: #191510;              /* 别人的话：暖黑实底 */
  border-radius: 7px;
  padding: 5px 9px;
}
.msg.player.talk .bubble { background: #131a24; }    /* 聊天：冷一档 */
.msg.player.act .bubble { background: #1a140a; }     /* 行动：暗暖 */
.msg.player.mine .bubble { background: #2a2215; }    /* 自己：亮一档 */
.msg.player.mine.talk .bubble { background: #172231; }
.msg.player.mine.act .bubble { background: #231a0d; }

/* 旁白和观察卡也垫实底：贴图再亮，正文都读得清 */
.msg.gm { background: #17130d; }
.msg.observe { background: #121826; }

/* 场景背景层是绝对定位的，会盖住普通文档流的兄弟元素：
   顶栏/天气条/头像条/打字提示/聊天对象条/输入区都抬到它上面 */
.room .bar,
.room .stage-bar,
.room .cast-bar,
.room .typing,
.room .ptyping,
.room .saybar {
  position: relative;
  z-index: 2;
}

/* 全屏按钮：藏掉地址栏（安卓 Chrome 可直接全屏，iPhone 用「添加到主屏幕」） */
.icon-btn.fs-btn svg { width: 19px; height: 19px; display: block; }
.icon-btn.fs-btn { padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ========== 大厅自适应（手机保持原样，屏幕越宽越舒展） ========== */

/* 未登录时右上角的「登录 / 注册」：比普通小标签更醒目一点 */
.lobby-top .chip.login-cta {
  color: #f5e8c8;
  border-color: rgba(201, 162, 39, .6);
  background: rgba(201, 162, 39, .14);
  padding: 4px 12px;
  font-size: 12.5px;
  letter-spacing: .06em;
}
.lobby-top .chip.login-cta:hover { background: rgba(201, 162, 39, .26); }


/* 宽桌面：卡片再放宽一档，格子更大更稀 */
@media (min-width: 1100px) {
  .lobby-card { max-width: 820px; }
  .car-slide { aspect-ratio: 2 / 1; }
  .scene-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
}

/* 窄手机（≤420）：收紧内边距，顶栏允许换行——
   「登录 + 装成应用 + 头像」三个都挤在标题右边时放不下就折行 */
@media (max-width: 420px) {
  .lobby { padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); }
  .lobby-card { padding: 22px 16px 18px; }
  .lobby-top { flex-wrap: wrap; row-gap: 8px; }
  .lobby-title h1 { font-size: 20px; }
}
