/* 🛠️ work 工作台（24 号 C）— 变量借 /chat/css/base.css（不改它），样式全在这里。只做浅色。
   22/23 教训：手机上的浮层 pointer-events:none（toast）；无限动画在 reduced-motion 下单独 animation:none。 */

:root {
  --fable: #7d86b8;        /* fable：淡靛 */
  --fable-soft: rgba(125,134,184,0.10);
  --opus: #c99155;         /* opus：蜜色（金毛） */
  --opus-soft: rgba(201,145,85,0.10);
  --err: #b85c5c;
  --err-soft: rgba(184,92,92,0.08);
  --ok: #6f9a6a;
  --perm: #c9922b;         /* 🔐 🎫#52 授权卡片：琥珀 */
  --steps: #6f9a6a;        /* 📋 🎫#59 步骤卡：绿 */
  --mono: 'Fira Code', 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

.hidden { display: none !important; }

/* ===== 🎫#70 图标（js/icons.js 画形状；A「奶油双色」：深棕线 + 淡色填充）=====
   线一律 1.6px 屏幕像素（non-scaling-stroke：图标大小不同、线一样粗，美化铁律 46） */
:root { --ic-ink: #6e5c49; }
.ic { display: block; width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ic * { stroke: var(--ic-ink); stroke-width: 1.6px; vector-effect: non-scaling-stroke; }
.ic .c-green { fill: #d3e6cc; }
.ic .c-honey { fill: #f3d9b1; }
.ic .c-indigo { fill: #d9ddf2; }
.ic .c-cream { fill: #fbf1e2; }
.ic .c-white { fill: #fff; }
.ic .dot { fill: var(--ic-ink); stroke: none; }
.ic .acc { stroke: var(--ok); }
.ic .dash { stroke-dasharray: 1.6 2.2; }
.icon-btn .ic { margin: auto; width: 24px; height: 24px; }   /* 有的 icon-btn 不是 flex（only-mobile 要靠 display 藏），块级 svg 用 auto 边距居中 */
.btn-flat .ic { width: 28px; height: 28px; }   /* 澄澄：图标放大一点、行高不变 → 按钮框是定死的（38），只放大里面的图 */
#top .top-btn .ic { width: 30px; height: 30px; }   /* 澄澄：💬🏠 再大点（框还是 34） */
.btn-send { display: inline-flex; align-items: center; justify-content: center; }
.btn-send .ic { width: 21px; height: 21px; margin-left: -1px; }
.btn-send .ic * { stroke: #fff; }
.btn-send .ic .c-white { fill: rgba(255,255,255,0.35); }
.tk-top-title { display: inline-flex; align-items: center; gap: 6px; }
.tk-top-title .ic { width: 24px; height: 24px; }
.drawer-head .icon-btn .ic { width: 27px; height: 27px; }
.drawer-title { display: inline-flex; align-items: center; gap: 6px; }
.drawer-title .ic { width: 24px; height: 24px; }
.img-x, .tk-chip-x { display: inline-flex; align-items: center; justify-content: center; }
.img-x .ic, .tk-chip-x .ic { width: 11px; height: 11px; }
.img-x .ic * { stroke: #fff; stroke-width: 2px; }
.tk-chip-x .ic * { stroke: #7a5424; stroke-width: 1.8px; }
.steps-askimg { display: inline-flex; align-items: center; }
.steps-askimg .ic { width: 27px; height: 27px; }
.btn-flat:disabled .ic, .steps-askimg:disabled .ic { opacity: 0.6; }
.dim { color: var(--text-muted); }
.small { font-size: 12.5px; }
.pad { padding: 14px; }

/* ===== 登录框（同 chat） ===== */
#gate {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(170deg, var(--bg-primary), var(--bg-secondary));
}
.gate-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px; }
.gate-emoji { font-size: 44px; margin-bottom: 10px; }
.gate-box input {
  padding: 10px 20px; border: 1px solid var(--border-strong); border-radius: 24px;
  background: rgba(255,255,255,0.6); font: 16px var(--font); color: var(--text-primary);
  text-align: center; width: 230px; outline: none;
}
.gate-box input:focus { border-color: var(--accent-dark); }
.gate-btn {
  margin-top: 6px; padding: 9px 28px; border: none; border-radius: 20px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff;
  font: 15px var(--font); box-shadow: var(--shadow-soft);
}
.gate-hint { font-size: 12px; color: var(--text-muted); }
.gate-err { color: var(--err); font-size: 13px; min-height: 1em; }

/* ===== 布局 ===== */
#app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* 抽屉：手机上左侧滑出；宽屏常驻 */
#drawer {
  width: 300px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  overflow: hidden;
}
#drawer-mask { display: none; }
.only-mobile { display: none; }
@media (max-width: 899px) {
  .only-mobile { display: inline-flex; }
  #drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: min(86vw, 330px);
    transform: translateX(-102%); transition: transform 0.22s ease;
    box-shadow: 4px 0 18px rgba(120,100,70,0.15);
  }
  body.drawer-open #drawer { transform: none; }
  body.drawer-open #drawer-mask {
    display: block; position: fixed; inset: 0; z-index: 40; background: rgba(60,50,40,0.25);
  }
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 8px; font-weight: 600; font-size: 16px;
}
.icon-btn {
  background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-secondary);
  width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 10px; flex-shrink: 0;
}
.icon-btn:active { background: var(--paw-soft); }
/* 🏠 回玄关（和 chat 的 header 菜单、home 的 🏠 一样都指 /portal/）：a 元素要自己 display 成 flex，只用 .icon-btn 的 width/height 不够 */
.home-btn { display: inline-flex; text-decoration: none; }
.drawer-head > span:last-child { display: inline-flex; gap: 2px; }
#btn-reload { display: inline-flex; font-size: 22px; }

.new-desk { display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 12px; border-bottom: 1px solid var(--border); }
.new-desk input[type="text"] {
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 12px; outline: none;
  background: rgba(255,255,255,0.7); font: 16px var(--font); color: var(--text-primary);
}
.new-desk input[type="text"]:focus { border-color: var(--paw); }
.btn-primary {
  padding: 9px; border: none; border-radius: 12px; cursor: pointer; font: 15px var(--font); color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}
.btn-primary:disabled { opacity: 0.5; }

/* 分段选择（选狗 / 说给谁） */
.seg { display: inline-flex; background: rgba(180,160,130,0.12); border-radius: 12px; padding: 3px; gap: 2px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; padding: 6px 14px; border-radius: 9px; font-size: 14px; line-height: 20px; color: var(--text-secondary); }   /* 🎫#68 行高定死：「两只」「→」走 fallback 字体行盒更高，Fable/Opus 看着高一截（澄澄真机） */
.seg input:checked + span { background: #fff; color: var(--text-primary); box-shadow: 0 1px 4px rgba(150,120,80,0.2); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--paw); }
.seg label.is-off { opacity: 0.35; cursor: default; }
.seg-sm span { padding: 4px 11px; font-size: 13.5px; }
.new-desk .seg { display: flex; }
.new-desk .seg label { flex: 1; text-align: center; }

.desk-list { flex: 1; overflow-y: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
.desk-item {
  display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; cursor: pointer;
  margin-bottom: 4px; border: 1px solid transparent;
}
.desk-item:active { background: var(--paw-soft); }
.desk-item.is-current { background: #fff; border-color: var(--border-strong); }
.desk-main { flex: 1; min-width: 0; }
.desk-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-sub { font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 3px; color: var(--text-secondary); }
.desk-acts { display: flex; flex-direction: column; gap: 4px; }
.btn-small {
  padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff;
  font: 13px var(--font); color: var(--text-secondary); cursor: pointer;
}
.btn-small:active { background: var(--paw-soft); }

.chip { font-size: 12px; padding: 1px 8px; border-radius: 9px; background: rgba(180,160,130,0.15); color: var(--text-secondary); white-space: nowrap; }
.chip:empty { display: none; }
.chip.st-running { background: rgba(111,154,106,0.15); color: #4f7a4a; }
.chip.st-closing { background: rgba(217,168,106,0.18); color: #9a6f33; }
.chip.st-dead { background: var(--err-soft); color: var(--err); }

/* 状态点 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #bbb; margin-right: 4px; vertical-align: 1px; }
.dot.st-running { background: var(--ok); }
.dot.st-starting { background: #d9a86a; }
.dot.st-closed { background: #c8c0b4; }
.dot.st-dead { background: var(--err); }
.dot.is-busy { animation: pulse 1.2s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(111,154,106,0.5); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(111,154,106,0.55); } 70% { box-shadow: 0 0 0 6px rgba(111,154,106,0); } 100% { box-shadow: 0 0 0 0 rgba(111,154,106,0); } }

/* ===== 顶部 ===== */
#top {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: var(--bg-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 10;
}
/* 🎨 🎫#68 顶栏一行：桌名（省略号）+ 状态 + 狗点 + 断线时的连接状态；右边 📋 💬 🏠 34px */
.top-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#desk-name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
#desk-state { flex-shrink: 0; }
#top { padding: 5px 8px 5px 12px; gap: 2px; }
#top .top-btn { width: 34px; height: 34px; font-size: 19px; }
#btn-steps { position: relative; }
.steps-badge { position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; box-sizing: border-box;
  background: var(--steps); color: #fff; font: 600 10px/15px var(--font); text-align: center; }
#desk-name { cursor: pointer; border-bottom: 1px dashed transparent; }   /* 点一下改名 */
#desk-name:active { border-bottom-color: var(--border-strong); }
/* 🎫#68 合并的连接状态：圆点颜色跟 c-* 走（已连接绿 / 连接中重连中琥珀 / 断开挂了红 / 已关灰） */
#dog-dots { display: inline-flex; align-items: center; flex-shrink: 0; font-size: 12.5px; color: var(--text-secondary); }
#dog-dots::before { content: none; }
#dog-dots.c-open .dot { background: var(--ok); }
#dog-dots.c-connecting .dot, #dog-dots.c-retry .dot { background: #d9a86a; }
#dog-dots.c-closed .dot { background: var(--err); }
#dog-dots.c-closed { color: var(--err); }
#dog-dots.c-off .dot { background: #c8c0b4; }
#desk-state, #dog-dots { cursor: pointer; }   /* 🎫#68 点一下看额度 */
#dog-dots.c-quota { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
#dog-dots.c-quota.q-warn { color: #9a6f33; }
#dog-dots.c-quota.q-bad { color: var(--err); }
.dogdot { white-space: nowrap; }
.conn { white-space: nowrap; }
.conn::before { content: '●'; margin-right: 3px; font-size: 9px; vertical-align: 1px; }
.conn.c-open::before { color: var(--ok); }
.conn.c-connecting::before, .conn.c-retry::before { color: #d9a86a; }
.conn.c-closed::before { color: var(--err); }
.drawer-sub { padding: 0 14px 8px; }   /* 🎫#68 额度胶囊住这 */
.quota {
  border: 1px solid var(--border); background: rgba(255,255,255,0.6); border-radius: 9px;
  padding: 1px 8px; font: 12.5px var(--font); color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.quota.q-warn { color: #9a6f33; border-color: rgba(217,168,106,0.5); }
.quota.q-bad { color: var(--err); border-color: rgba(184,92,92,0.5); }

/* ===== 对话流 ===== */
#stream-wrap { flex: 1; overflow-y: auto; position: relative; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#stream-wrap.replaying { visibility: hidden; }   /* 回放存档期间藏着，画完跳到底再露出（app.js selectDesk） */
#stream { padding: 12px 12px 18px; display: flex; flex-direction: column; gap: 10px; max-width: 860px; margin: 0 auto; }
.empty { text-align: center; color: var(--text-secondary); margin-top: 24vh; font-size: 14px; }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.btn-bottom {
  /* sticky 在滚动区底部；负 margin-top 让它不多占一行 */
  position: sticky; bottom: 10px; display: block; margin: -48px 12px 0 auto; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: #fff; box-shadow: var(--shadow-soft); font-size: 17px; color: var(--text-secondary); cursor: pointer;
}

.time { font-size: 11.5px; color: var(--text-muted); }

/* 澄澄：右边，chat 同款气泡色 */
.it-user { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; }
.bubble-user {
  background: var(--user-bubble); color: #3e342a; padding: 10px 15px; border-radius: var(--radius) var(--radius) 6px var(--radius);
  font-size: 15.5px; line-height: 1.62; box-shadow: var(--shadow-soft); word-break: break-word;
}
.meta-user { display: flex; gap: 8px; align-items: center; margin-top: 3px; }
.to-tag { font-size: 12px; color: var(--text-secondary); background: rgba(180,160,130,0.14); border-radius: 8px; padding: 0 7px; }
.it-user.is-pending { opacity: 0.6; }

/* 小狗的一轮：左边卡片，按狗上色 */
.it-turn {
  align-self: flex-start; width: 100%; max-width: 100%;
  background: var(--ai-bubble); border-radius: 6px var(--radius) var(--radius) var(--radius);
  border: 1px solid var(--border); border-left: 3px solid var(--accent); box-shadow: var(--shadow-soft);
  padding: 8px 13px 6px;
}
.it-turn.dog-fable { border-left-color: var(--fable); }
.it-turn.dog-opus { border-left-color: var(--opus); }
.turn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; min-height: 22px; }
.dog-badge { font-size: 13px; font-weight: 600; padding: 1px 9px; border-radius: 9px; }
.dog-badge.dog-fable { color: #4f5890; background: var(--fable-soft); }
.dog-badge.dog-opus { color: #8a5a22; background: var(--opus-soft); }
.reply-to { font-size: 12.5px; color: var(--text-secondary); }
.typing { display: inline-flex; gap: 3px; margin-left: 2px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-dark); opacity: 0.6; animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
.turn-blocks { display: flex; flex-direction: column; gap: 6px; }
.turn-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 5px; font-size: 11.5px; }
.model { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.model-odd { color: #9a6f33; background: rgba(217,168,106,0.18); border-radius: 6px; padding: 0 5px; font-weight: 600; }

/* 正文 */
.blk-text { font-size: 15.5px; line-height: 1.65; word-break: break-word; }
.md-text { white-space: pre-wrap; }
.md-h { display: inline-block; margin-top: 4px; }
.md-inline { font-family: var(--mono); font-size: 0.88em; background: rgba(180,160,130,0.14); padding: 1px 5px; border-radius: 5px; }
.md-code, .wk-pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: rgba(120,100,70,0.06);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 4px 0;
  overflow-x: auto; white-space: pre; -webkit-overflow-scrolling: touch;
}
.wk-pre { white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow-y: auto; }
/* 🎫#62 代码块：等宽、底色、不折行（横向滑）、右上角复制；按钮留出位置不盖字 */
.code-wrap { position: relative; margin: 4px 0; }
.code-wrap .md-code { margin: 0; padding-right: 58px; }
.btn-copy {
  position: absolute; top: 5px; right: 5px; z-index: 1; padding: 3px 9px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: #fff; font: 12px var(--font); color: var(--text-secondary); cursor: pointer;
}
.btn-copy:active { background: var(--paw-soft); }
.copy-inline { cursor: pointer; border-bottom: 1px dashed rgba(120,100,70,0.45); }
.steps-do .md-inline, .steps-see .md-inline { word-break: break-all; }

/* 折叠：思考 / 工具 / 小字 / sys */
details > summary { cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸'; display: inline-block; width: 1em; color: var(--text-muted); transition: transform 0.15s; }
details[open] > summary::before { transform: rotate(90deg); }

.blk-think { background: rgba(140,170,140,0.07); border-radius: 9px; padding: 5px 9px; font-size: 13.5px; color: #5a7a5a; }
.think-body { margin-top: 4px; font-size: 13.5px; color: #5d6d5d; }

.blk-tool { border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,0.55); font-size: 13px; }
.blk-tool > summary { padding: 6px 9px; display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.blk-tool > summary::before { flex-shrink: 0; }
.tool-st { flex-shrink: 0; width: 1em; color: var(--ok); }
.blk-tool.is-err .tool-st { color: var(--err); }
.blk-tool.is-running .tool-st { color: #d9a86a; }
.tool-name { font-weight: 600; color: var(--text-primary); flex-shrink: 0; }
.tool-sum { font-family: var(--mono); font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tool-body { padding: 0 9px 8px; }
.tool-label { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.blk-tool.is-err { border-color: rgba(184,92,92,0.35); }
.wk-more { border: none; background: none; color: var(--accent-dark); font: 12.5px var(--font); cursor: pointer; padding: 2px 0; text-decoration: underline; }

.blk-mini { font-size: 12.5px; color: var(--text-muted); }
.blk-mini > summary { padding: 1px 0; }

/* 狗↔狗：居中、窄、虚线框、带箭头 */
.blk-dm {
  align-self: center; width: 88%; max-width: 560px; margin: 4px 0;
  border: 1.5px dashed var(--border-strong); border-radius: 14px; background: #fffdf8; padding: 7px 12px 9px;
}
.blk-dm.dm-from-fable { border-color: rgba(125,134,184,0.55); background: #fbfbff; }
.blk-dm.dm-from-opus { border-color: rgba(201,145,85,0.55); background: #fffaf3; }
.dm-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 3px; }
.dm-who { font-weight: 600; }
.dm-who.dog-fable { color: #4f5890; }
.dm-who.dog-opus { color: #8a5a22; }
.dm-arrow { color: var(--text-muted); font-size: 14px; }
.dm-st { margin-left: auto; font-size: 11.5px; color: var(--text-muted); }
.dm-st.bad { color: var(--err); font-weight: 600; }
.dm-body { font-size: 14.5px; line-height: 1.6; word-break: break-word; }

/* 流式临时块 */
.blk-stream { font-size: 15.5px; line-height: 1.65; word-break: break-word; }
.blk-stream.sk-thinking { font-size: 13.5px; color: #5a7a5a; }
.blk-stream.sk-tool { font-size: 13px; }
.blk-stream.is-partial { opacity: 0.7; }
.caret { display: inline-block; width: 7px; height: 1em; background: var(--accent-dark); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* 出错 / 被拦的轮：整轮标红 */
.it-turn.is-error { border-color: rgba(184,92,92,0.45); border-left-color: var(--err); background: #fffafa; }
.turn-err { margin-top: 8px; padding: 8px 10px; border-radius: 9px; background: var(--err-soft); border: 1px solid rgba(184,92,92,0.25); }
.err-head { font-weight: 600; color: var(--err); font-size: 14px; }
.err-text { font-size: 13.5px; margin: 3px 0 6px; white-space: pre-wrap; word-break: break-word; }
.btn-resend {
  padding: 6px 14px; border-radius: 10px; border: 1px solid rgba(184,92,92,0.4); background: #fff;
  color: var(--err); font: 14px var(--font); cursor: pointer;
}
.btn-resend:disabled { opacity: 0.55; }

/* 🔐 🎫#52 授权卡片：和小狗的一轮一样的底，左边条按状态变色；pending 亮琥珀 */
.it-perm {
  align-self: flex-start; width: 100%; max-width: 100%;
  background: var(--ai-bubble); border-radius: 6px var(--radius) var(--radius) var(--radius);
  border: 1px solid var(--border); border-left: 3px solid var(--perm); box-shadow: var(--shadow-soft);
  padding: 8px 13px 8px;
}
.it-perm.st-pending { border-color: rgba(201,146,43,0.55); border-left-color: var(--perm); background: #fffbf2; }
.it-perm.st-allowed { border-left-color: var(--ok); }
.it-perm.st-denied { border-left-color: var(--err); }
.it-perm.st-void, .it-perm.st-cancelled { border-left-color: var(--text-muted); opacity: 0.7; }
.perm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.perm-head .time { margin-left: auto; }
.perm-sum { font-family: var(--mono); font-size: 12.5px; word-break: break-all; color: var(--text-secondary); }
.perm-desc, .perm-reason { margin-top: 3px; word-break: break-word; }
.perm-det { margin-top: 6px; font-size: 13px; }
.perm-det > summary { cursor: pointer; color: var(--text-secondary); }
.perm-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.perm-acts .perm-allow { flex: 1 1 120px; font-weight: 600; }
.perm-deny-row { display: flex; flex: 1 1 100%; gap: 6px; align-items: stretch; }
.perm-why {
  flex: 1; min-width: 0; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 9px;
  font: 13px var(--font); color: var(--text-primary); background: #fff;
}
.perm-acts .btn-small:disabled, .perm-acts .btn-primary:disabled { opacity: 0.5; }
.perm-stamp { margin-top: 6px; font-size: 13.5px; font-weight: 600; }
.it-perm.st-allowed .perm-stamp { color: var(--ok); }
.it-perm.st-denied .perm-stamp { color: var(--err); }
.it-perm.st-void .perm-stamp, .it-perm.st-cancelled .perm-stamp { color: var(--text-muted); font-weight: 400; }
.perm-badge { font-size: 11px; margin-left: 2px; }

/* 📋 🎫#59 步骤卡：当前步大字、按钮大（手机上她一只手点）；问一句输入框常驻 */
.it-steps {
  align-self: flex-start; width: 100%; max-width: 100%;
  background: var(--ai-bubble); border-radius: 6px var(--radius) var(--radius) var(--radius);
  border: 1px solid var(--border); border-left: 3px solid var(--steps); box-shadow: var(--shadow-soft);
  padding: 9px 13px 9px;
}
.it-steps.st-open { border-color: rgba(111,154,106,0.5); border-left-color: var(--steps); background: #f8fbf6; }
.it-steps.st-dropped { opacity: 0.7; border-left-color: var(--text-muted); }
.steps-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.steps-head .time { margin-left: auto; }
.steps-prog { font-size: 12.5px; color: var(--text-secondary); background: rgba(111,154,106,0.12); border-radius: 8px; padding: 1px 7px; }
.steps-cur { margin-top: 8px; }
.steps-do { font-size: 17px; line-height: 1.55; font-weight: 600; word-break: break-word; }
.steps-see { margin-top: 5px; font-size: 14px; word-break: break-word; }
.steps-url { display: inline-block; margin-top: 7px; text-decoration: none; }
.steps-hint, .steps-asked, .steps-warn { margin-top: 6px; font-size: 13.5px; padding: 5px 9px; border-radius: 9px; word-break: break-word; }
.steps-hint { background: rgba(111,154,106,0.12); }
.steps-asked { background: rgba(180,160,130,0.12); color: var(--text-secondary); }
.steps-warn { background: var(--err-soft); color: var(--err); }
.steps-acts { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin-top: 10px; }
/* 🎫#68 澄澄：卡里按钮太大太笨 → 统一小一号（还是一只手好点的高度，≈36px） */
.steps-acts .steps-done { flex: 1 1 120px; font-size: 15px; padding: 8px; font-weight: 600; }
.steps-acts .btn-small { padding: 7px 10px; font-size: 13.5px; }
.steps-acts .btn-small:disabled, .steps-acts .btn-primary:disabled, .steps-askrow .btn-small:disabled { opacity: 0.5; }
.steps-opts { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 100%; }
.steps-opts .steps-opt { flex: 1 1 100px; font-size: 15px; padding: 8px; font-weight: 600; }
.steps-freerow { display: flex; gap: 6px; flex: 1 1 100%; }
.steps-free { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 10px; font: 15px var(--font); color: var(--text-primary); background: #fff; }
.steps-askrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.steps-asktray { flex: 0 0 100%; order: -1; padding-bottom: 2px; }   /* 📎 🎫#61 问一句的托盘在输入框上面一整行 */
.steps-askrow { align-items: center; }
.steps-askrow .steps-askimg { border: none; background: none; padding: 0 3px; font-size: 18px; }   /* 🎫#68 扁图标，同输入区 📷 */
.steps-askrow .btn-steps[data-act="ask"] { padding: 6px 10px; }
.steps-askimgs img { max-width: min(100%, 220px); }
.steps-ask {
  flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 10px;
  font: 15px var(--font); color: var(--text-primary); background: #fff;
}
.steps-det { margin-top: 8px; font-size: 13px; }
.steps-det > summary { cursor: pointer; color: var(--text-secondary); }
.steps-donelist > div { margin-top: 3px; word-break: break-word; }
.steps-stamp:empty { display: none; }
.steps-stamp { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--ok); }
.it-steps.st-dropped .steps-stamp { color: var(--text-muted); font-weight: 400; }
/* 📌 🎫#60 待办提示条：输入区最上面一条细条（跟着键盘走） */
/* 📋 🎫#68 待办弹窗（壳 = .tk-panel；z 同 #tickets） */
#stepsp { position: fixed; inset: 0; z-index: 60; background: rgba(60,50,40,0.25); display: flex; justify-content: center; }
.sp-list { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.sp-list .it-steps { width: 100%; max-width: none; box-sizing: border-box; }
.empty-sm { text-align: center; color: var(--text-muted); font-size: 14px; padding: 40px 0; }

/* sys：居中灰色小字 */
.it-sys { align-self: center; max-width: 92%; font-size: 12.5px; color: var(--text-muted); text-align: center; }
.it-sys.lv-err { color: var(--err); }
.it-sys.lv-warn { color: #9a7a55; }
.sys-det > summary { display: inline; }
.sys-raw { text-align: left; }

/* ===== 输入区（底部，跟着键盘走） ===== */
#input-area {
  flex-shrink: 0; padding: 7px 12px 12px; z-index: 10;
  background: var(--bg-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
/* 🎨 🎫#68 输入区 B：输入框（一行起步，autoGrow 往上长到 180）+ ➤ 一行；下面 说给谁五个 + 📷 🎫 一行（360 宽不换行） */
.target-row { display: flex; align-items: center; gap: 2px; margin-top: 5px; }
.input-row { display: flex; gap: 6px; align-items: flex-end; }
#msg {
  flex: 1; min-width: 0; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 18px;
  background: rgba(255,255,255,0.7); font: 16px var(--font); line-height: 1.5; color: var(--text-primary);
  resize: none; outline: none; max-height: 180px; overflow-y: auto; box-sizing: border-box;
}
#target { flex: 0 1 auto; min-width: 0; margin-right: auto; }
.target-row .seg-sm span { padding: 5px 5px; font-size: 13px; line-height: 20px; white-space: nowrap; }
#input-hint:empty { display: none; }
#input-hint { white-space: nowrap; }
.btn-flat { display: inline-flex; width: 38px; height: 38px; font-size: 21px; }   /* 🎫#69 澄澄：右下三个太小不好按 → 32 → 38 */
.btn-flat:disabled { opacity: 0.4; cursor: default; }
#msg:focus { border-color: var(--paw); box-shadow: 0 0 0 3px var(--paw-soft); }
#msg:disabled { opacity: 0.6; }
.btn-send {
  width: 36px; height: 36px; border-radius: 50%; border: none; flex-shrink: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; font-size: 17px;
  box-shadow: var(--shadow-soft);
}
.btn-send:disabled { background: rgba(180,160,130,0.2); box-shadow: none; cursor: default; }

/* toast：顶部，不挡输入区；不吃触摸（22 教训） */
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 2000;
  max-width: 90vw; padding: 9px 16px; border-radius: 14px; background: #fff; color: var(--text-primary);
  border: 1px solid var(--border-strong); box-shadow: 0 3px 14px rgba(0,0,0,0.12); font-size: 14px;
  pointer-events: none;
}

/* 减弱动效：base.css 只把时长压到 0.01ms，infinite 动画会乱闪 → 单独关掉（22 教训） */
@media (prefers-reduced-motion: reduce) {
  .dot.is-busy, .typing i, .caret { animation: none !important; }
}

/* 👀 26 传图 */
.btn-img {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; cursor: pointer; font-size: 18px; line-height: 1;
  border: 1px solid var(--border-strong); background: rgba(255,255,255,0.7); box-shadow: var(--shadow-soft);
}
.btn-img:disabled { opacity: 0.45; box-shadow: none; cursor: default; }
.img-tray { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; -webkit-overflow-scrolling: touch; }
/* 🎫#68 澄澄：宽截图裁成方块只剩一条白 → 整张按比例缩到 56 高（最宽 160），细边框描出图的轮廓 */
.img-thumb { position: relative; flex: 0 0 auto; height: 56px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border-strong); background: #fff; box-shadow: var(--shadow-soft); }
.img-thumb img { height: 100%; width: auto; max-width: 160px; min-width: 32px; object-fit: contain; display: block; }
.img-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; padding: 0;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 11px; line-height: 20px; cursor: pointer; }
.bubble-imgs img { max-width: min(100%, 320px); border-radius: 8px; display: block; margin-top: 6px; }
.bubble-imgs a:first-child img { margin-top: 0; }
.bubble-user .md-text + .bubble-imgs img, .bubble-user pre + .bubble-imgs img { margin-top: 6px; }

/* ===== 🎫 30 工单 ===== */
/* 面板：覆盖层（手机全屏；宽屏居中一张卡 + 遮罩），z 60 > 抽屉 50。是页面不是提示，pointer-events 正常 */
#tickets { position: fixed; inset: 0; z-index: 60; background: rgba(60,50,40,0.25); display: flex; justify-content: center; }
.tk-panel {
  width: 100%; max-width: 620px; height: 100%; display: flex; flex-direction: column;
  background: var(--bg-primary); box-shadow: 0 4px 24px rgba(120,100,70,0.18);
}
@media (min-width: 900px) { .tk-panel { height: auto; max-height: 88vh; margin-top: 6vh; border-radius: var(--radius); overflow: hidden; } }
.tk-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 16px; border-bottom: 1px solid var(--border); background: var(--bg-glass); }
.tk-top-title { font-weight: 600; font-size: 16px; }
.tk-top > span:last-child { display: inline-flex; gap: 2px; }
.tk-top .icon-btn { display: inline-flex; }
.tk-new { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.tk-new input {
  flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 12px; outline: none;
  background: rgba(255,255,255,0.7); font: 16px var(--font); color: var(--text-primary);
}
.tk-new input:focus { border-color: var(--paw); }
.tk-new .btn-primary { padding: 9px 18px; }
.tk-list { flex: 1; overflow-y: auto; padding: 6px 12px 24px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tk-group { display: block; width: 100%; text-align: left; font-size: 12.5px; color: var(--text-secondary); margin: 12px 2px 6px; font-weight: 600; }
button.tk-fold { background: none; border: none; padding: 0; font-family: var(--font); cursor: pointer; }
button.tk-fold::before { content: '▸'; display: inline-block; width: 1em; transition: transform 0.15s; }
button.tk-fold.is-open::before { transform: rotate(90deg); }

.tk-card { background: var(--ai-bubble); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 6px; box-shadow: var(--shadow-soft); }
.tk-card.tk-doing { border-left: 3px solid var(--paw); }
.tk-card.tk-done, .tk-card.tk-dropped { opacity: 0.72; }
.tk-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; width: 100%; text-align: left;
  background: none; border: none; padding: 10px 12px; font: 15px var(--font); color: var(--text-primary); cursor: pointer;
}
.tk-id { font-family: var(--mono); font-size: 12.5px; color: var(--text-secondary); flex-shrink: 0; }
.tk-title { flex: 1 1 60%; min-width: 0; word-break: break-word; }
.tk-card.tk-dropped .tk-title { text-decoration: line-through; }
.tk-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-left: auto; }
.tk-st-todo { background: rgba(180,160,130,0.15); }
.tk-st-doing { background: var(--paw-soft); color: #9a6f33; }
.tk-st-done { background: rgba(111,154,106,0.15); color: #4f7a4a; }
.tk-st-dropped { background: rgba(160,150,140,0.15); color: var(--text-muted); }

.tk-detail { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--border); padding-top: 10px; }
.tk-edit-title, .tk-edit-body, .tk-note-form input {
  width: 100%; box-sizing: border-box; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 10px; outline: none;
  background: rgba(255,255,255,0.75); font: 16px var(--font); color: var(--text-primary);
}
.tk-edit-title { font-weight: 600; }
.tk-edit-body { resize: vertical; line-height: 1.55; font-size: 15px; }
.tk-edit-title:focus, .tk-edit-body:focus, .tk-note-form input:focus { border-color: var(--paw); }
.tk-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tk-acts .btn-small.is-main { background: var(--paw-soft); border-color: var(--paw); color: #8a5a22; }
.tk-acts .btn-small:disabled { opacity: 0.5; }
.tk-from { margin-left: auto; }
.tk-notes { display: flex; flex-direction: column; gap: 8px; padding-left: 2px; }
.tk-note { display: flex; gap: 8px; align-items: flex-start; }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--accent-dark); }
.tk-dot.who-fable { background: var(--fable); }
.tk-dot.who-opus { background: var(--opus); }
.tk-dot.who-user { background: var(--paw); box-shadow: 0 0 0 2px var(--paw-soft); }
.tk-note-main { flex: 1; min-width: 0; }
.tk-note-head { font-size: 12.5px; color: var(--text-secondary); }
.tk-note-text { font-size: 14px; line-height: 1.55; word-break: break-word; }
.tk-note-form { display: flex; gap: 6px; }
.tk-note-form input { flex: 1; min-width: 0; }

/* 挂工单：选单（输入区里，不浮）+ 托盘胶囊 + 气泡下的胶囊 */
.tk-pick { max-height: 38vh; overflow-y: auto; margin-bottom: 8px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 12px; background: #fff; }
.tk-pick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-secondary); padding: 2px 4px 6px; }
.tk-pick-item {
  display: flex; align-items: baseline; gap: 6px; width: 100%; text-align: left; padding: 8px; border: none; border-radius: 9px;
  background: none; font: 14.5px var(--font); color: var(--text-primary); cursor: pointer;
}
.tk-pick-item.is-on { background: var(--paw-soft); }
.tk-check { width: 1em; flex-shrink: 0; color: #8a5a22; font-weight: 700; }
.tk-pick-item .tk-title { flex: 1; }
.tk-tray { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 8px; }
.tk-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 9px; border-radius: 12px;
  background: var(--paw-soft); border: 1px solid rgba(217,168,106,0.45); font-size: 13px; color: #7a5424;
}
.tk-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14em; }
.tk-chip-x { border: none; background: rgba(0,0,0,0.08); border-radius: 50%; width: 20px; height: 20px; padding: 0; font-size: 11px; line-height: 20px; cursor: pointer; color: #7a5424; flex-shrink: 0; }
.bubble-tks { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-top: 4px; }
.bubble-tks .tk-chip { padding-right: 9px; }

/* 🤖 Agent 卡（10/1 🎫#14）：子工具一行一条，不嵌套展开 */
.agent-steps { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px; }
.agent-step { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; overflow: hidden; padding: 1px 0; }
.agent-step .tool-name { font-weight: 600; flex-shrink: 0; }
.agent-step .tool-sum { font-family: var(--mono); font-size: 11.5px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.agent-step.is-err .tool-st { color: var(--err); }

/* ===== 🎲 #21 游戏面板（壳复用 .tk-panel / .tk-top；js/games.js 画） ===== */
/* 三个玩家色：狗沿用流里的 --fable 淡靛 / --opus 蜜色，澄澄绿（🦌） */
:root { --user-c: #6f9a6a; --user-soft: rgba(111,154,106,0.14); }
#games { position: fixed; inset: 0; z-index: 60; background: rgba(60,50,40,0.25); display: flex; justify-content: center; }
#btn-games { position: relative; }
#btn-games.has-dot::after { content: ''; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); }
.gm-body { flex: 1; overflow-y: auto; padding: 10px 12px 28px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; }
.gm-who { font-weight: 600; }
.gm-who.who-user { color: #4f7a4a; }
.gm-who.who-fable { color: #4f5890; }
.gm-who.who-opus { color: #9a6f33; }
.gm-sec { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin: 0 2px 6px; }

.gm-die { font-size: 19px; line-height: 1; vertical-align: -2px; margin-right: 3px; }   /* 🎫#83：骰子挪进话框下那行，跟字一样高 */
.gm-move {
  text-align: left; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--user-c); background: var(--user-soft);
  font: 14px var(--font); color: var(--text-primary); cursor: pointer;   /* 🎫#83：住进话框上面那排，按钮小一号 */
}
.gm-move:active { background: rgba(111,154,106,0.28); }
.gm-move:disabled { opacity: 0.5; }

/* 棋盘：n×n grid，外圈是环（JS 给每格 grid-row/column），中间一块放各人的冲刺道 + 家 */
.gm-board-wrap { display: flex; flex-direction: column; gap: 8px; }
.gm-board {
  display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  gap: 3px; width: 100%; max-width: 420px; aspect-ratio: 1; margin: 0 auto;   /* 🎫#68：去掉 38vh——键盘一弹棋盘跟着缩；放不下就整块滚 */
}
.gm-cell, .gm-lcell {
  position: relative; border-radius: 7px; background: rgba(255,255,255,0.7); border: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; gap: 1px; min-width: 0; min-height: 0;
}
.gm-cell.is-start.who-user { border: 2px solid var(--user-c); background: var(--user-soft); }
.gm-cell.is-start.who-fable { border: 2px solid var(--fable); background: var(--fable-soft); }
.gm-cell.is-start.who-opus { border: 2px solid var(--opus); background: var(--opus-soft); }
.gm-no { position: absolute; top: 1px; left: 3px; font: 9px var(--mono); color: var(--text-muted); pointer-events: none; }
.gm-inner { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 4px; }
.gm-lane { display: grid; grid-template-columns: 2.2em repeat(5, 1fr); gap: 3px; align-items: stretch; min-height: 0; flex: 0 1 2.6em; }
.gm-lane-name { display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; line-height: 1.1; }
.gm-lane-name small { font-weight: 400; font-size: 8.5px; color: var(--text-muted); white-space: nowrap; }
.gm-lane.who-user .gm-lane-name { color: #4f7a4a; }
.gm-lane.who-fable .gm-lane-name { color: #4f5890; }
.gm-lane.who-opus .gm-lane-name { color: #9a6f33; }
.gm-lane.who-user .gm-lcell { border-color: var(--user-c); background: var(--user-soft); }
.gm-lane.who-fable .gm-lcell { border-color: var(--fable); background: var(--fable-soft); }
.gm-lane.who-opus .gm-lcell { border-color: var(--opus); background: var(--opus-soft); }
.gm-lcell.gm-home { border-style: dashed; }
/* 🎫#83 ③ 机场：原来那种虚线胶囊，住进中间、各自跑道正下方（缩一号，中间那块放得下 三条跑道 + 三个胶囊） */
.gm-air-cell { align-self: center; display: flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 10px; border: 1px dashed var(--border-strong); font-size: 10.5px; min-height: 22px; margin: -1px 0 3px; background: rgba(255,255,255,0.55); }
.gm-air-cell .gm-tok { width: 18px; height: 18px; font-size: 9.5px; }
.gm-air-cell.who-user { border-color: var(--user-c); }
.gm-air-cell.who-fable { border-color: var(--fable); }
.gm-air-cell.who-opus { border-color: var(--opus); }
.gm-air-name { color: var(--text-secondary); }

.gm-tok {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
  font-size: 10.5px; font-weight: 700; color: #fff; line-height: 1; box-shadow: 0 1px 2px rgba(0,0,0,0.25); z-index: 1;
}
.gm-tok sub { font-size: 7px; vertical-align: baseline; margin-left: 0.5px; opacity: 0.85; }
.gm-tok.who-user { background: var(--user-c); }
.gm-tok.who-fable { background: var(--fable); }
.gm-tok.who-opus { background: var(--opus); }
.gm-tok.is-hl { outline: 2px solid var(--err); outline-offset: 1px; }


.gm-log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.gm-log-item { display: flex; align-items: baseline; gap: 6px; font-size: 13px; line-height: 1.45; word-break: break-word; }
.gm-log-item.is-skip { color: var(--text-muted); }
.gm-log-item.is-pick { font-weight: 600; }
.gm-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--accent-dark); }
.gm-dot.who-user { background: var(--user-c); }
.gm-dot.who-fable { background: var(--fable); }
.gm-dot.who-opus { background: var(--opus); }

.gm-new { display: flex; flex-direction: column; gap: 6px; background: var(--ai-bubble); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.gm-new-row { display: flex; gap: 8px; align-items: stretch; }   /* 🎫#83 ①：下拉 + 开一局 一行 */
.gm-type-sel { flex: 1; min-width: 0; font: 15px var(--font); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-primary); }
.gm-result { font-size: 14px; padding: 0 4px; }   /* 🎫#83：结束态一行字 */

/* ===== 🗣️ #22 接力 / 同桌知情 ===== */
/* 说给五个选项：放不下就换行（澄澄：能用就行，美化时再摆） */
.carry-chip {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 10px; font-size: 12px;
  background: rgba(125,134,184,0.10); border: 1px solid rgba(125,134,184,0.3); color: #4f5890; white-space: nowrap;
}
.it-sys .btn-relay-skip { margin-left: 4px; padding: 2px 9px; font-size: 12.5px; }

/* 📜 🎫#28 B-lite：顶上「加载更早」 */
.earlier-row { text-align: center; padding: 8px 0 4px; }

/* ===== 🎫#23 牌桌：在玩时 棋盘+轮次固定在上、牌桌记录占剩下的高度自己滚、话框常驻在面板最下 ===== */
.gm-body.is-playing { overflow-y: auto; padding-bottom: 6px; gap: 8px; }   /* 🎫#68：hidden → auto，矮屏棋盘放不下时整块滚、不裁 */
.gm-head { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; }
.gm-body.is-playing .gm-table { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
/* 打字时（#gm-say 有焦点，games.js 给 #games 加 is-typing）：只关掉整块滚 → 棋盘原大钉在顶上；牌桌记录照旧 flex:1 吃剩下的高度
   键盘弹起 = 剩下 0、记录自然看不见；键盘收了（安卓返回键不 blur）= 空间回来、记录也回来。放不下的棋盘下沿被话框挡住也行
   （🎫#68 原来是整块滚；10/13 澄澄真机：「棋盘一直固定着就好，打字的时候不需要看到记录」；藏记录用 display:none 的版本她试出「点了输入框之后聊天记录会消失」） */
#games.is-typing .gm-body.is-playing { overflow: hidden; }
.gm-table { display: flex; flex-direction: column; gap: 3px; padding: 4px 2px; border-top: 1px dashed var(--border); }
.gm-row { display: flex; align-items: baseline; gap: 6px; font-size: 13px; line-height: 1.45; word-break: break-word; }
.gm-row.gm-auto { opacity: 0.5; }
.gm-row.is-skip { color: var(--text-muted); }
.gm-say-row { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; line-height: 1.45; margin: 2px 0 2px 14px; }
.gm-say-row .gm-who { flex-shrink: 0; font-size: 12px; }
.gm-bubble { background: var(--ai-bubble); border: 1px solid var(--border); border-radius: 10px; padding: 2px 8px; word-break: break-word; white-space: pre-wrap; }
.gm-say-row.who-user .gm-bubble { background: var(--user-soft); border-color: rgba(111,154,106,0.35); }
.gm-say-row.who-fable .gm-bubble { background: var(--fable-soft); }
.gm-say-row.who-opus .gm-bubble { background: var(--opus-soft); }
.gm-more { text-align: center; }
.gm-saybox { flex: 0 0 auto; padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg-glass); }
.gm-say-row-in { display: flex; gap: 6px; align-items: flex-end; }
.gm-say-row-in textarea { flex: 1; min-width: 0; resize: none; font: inherit; font-size: 15px; padding: 7px 10px; border-radius: 12px; border: 1px solid var(--border-strong); background: #fff; max-height: 6em; }
/* 🎫#83 ④ 按键区：棋盘正下方，和棋盘同宽（max-width 420 同 .gm-board / .gk-board） */
.gm-ctrl { width: 100%; max-width: 420px; margin: 0 auto; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 7px 10px; border-radius: 12px; background: var(--ai-bubble); border: 1px solid var(--border); }
.gm-ctrl-top { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.gm-ctrl-top .btn-small { flex-shrink: 0; padding: 3px 9px; font-size: 12.5px; }
.gm-hint-text { flex: 1; min-width: 0; }
.gm-ctrl-acts { display: flex; gap: 6px; }
.gm-ctrl-acts > * { flex: 1; min-width: 0; }
.gm-roll { font-size: 16px; padding: 8px 12px; }
.gm-wins { flex: 1; min-width: 0; text-align: right; margin-right: 6px; font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* 🎫#83 ⑥ */

/* ===== ⚫⚪ 🎫#42 五子棋：16×16 grid（第 0 行列字母、第 0 列行号）+ 225 个交叉点按钮；线用 ::before 横 / ::after 竖，边上的只画半截 ===== */
.gk-wrap { display: flex; justify-content: center; }
.gk-board {
  --gk-line: rgba(90,62,30,0.55);
  display: grid; grid-template-columns: 0.9fr repeat(15, 1fr); grid-template-rows: 0.9fr repeat(15, 1fr);
  width: 100%; max-width: 420px; aspect-ratio: 1; padding: 4px 6px 6px 2px; box-sizing: border-box;
  background: linear-gradient(135deg, #ecd3a1, #dfbd80); border-radius: 10px; box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(120,84,40,0.25);
}
.gk-lab { display: flex; align-items: center; justify-content: center; font: 8.5px var(--mono); color: rgba(90,62,30,0.75); user-select: none; }
.gk-cell { position: relative; padding: 0; margin: 0; border: 0; background: transparent; min-width: 0; min-height: 0; -webkit-tap-highlight-color: transparent; }
.gk-cell::before, .gk-cell::after { content: ''; position: absolute; background: var(--gk-line); pointer-events: none; }
.gk-cell::before { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-0.5px); }   /* 横线 */
.gk-cell::after { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-0.5px); }    /* 竖线 */
.gk-cell.e-l::before { left: 50%; } .gk-cell.e-r::before { right: 50%; }
.gk-cell.e-t::after { top: 50%; } .gk-cell.e-b::after { bottom: 50%; }
.gk-cell.is-star { background: radial-gradient(circle, rgba(90,62,30,0.8) 0 2px, transparent 2.5px); }
.gk-board.is-mine .gk-cell:not(:disabled) { cursor: pointer; }
.gk-board.is-mine .gk-cell:not(:disabled):active { background: radial-gradient(circle, rgba(0,0,0,0.18) 0 38%, transparent 40%); }
.gk-cell:disabled { opacity: 1; cursor: default; }
.gk-stone { position: absolute; inset: 7%; border-radius: 50%; z-index: 1; }
/* 🎫#43 三色：澄澄绿 / fable 蓝 / opus 金（金要亮、和木色棋盘分得开 → 偏柠檬黄的金 + 深一点的描边） */
.gk-stone.c-user, .ot-stone.c-user { background: radial-gradient(circle at 35% 32%, #8fe39a, #1f8a3a 66%); box-shadow: 0 1px 2px rgba(0,0,0,0.45); }
.gk-stone.c-fable, .ot-stone.c-fable { background: radial-gradient(circle at 35% 32%, #9cc2ff, #2457c5 66%); box-shadow: 0 1px 2px rgba(0,0,0,0.45); }
.gk-stone.c-opus, .ot-stone.c-opus { background: radial-gradient(circle at 35% 32%, #fff6b0, #f5c400 52%, #c98a00 80%); box-shadow: 0 1px 2px rgba(0,0,0,0.45), inset 0 0 0 0.5px rgba(120,70,0,0.55); }
.gk-mark.m-user { color: #1f8a3a; } .gk-mark.m-fable { color: #2457c5; } .gk-mark.m-opus { color: #d9a300; }
.gk-cell.is-last .gk-stone::after { content: ''; position: absolute; inset: 34%; border-radius: 50%; background: #d9534f; }   /* 最后一手：中间小红点 */
.gk-cell.is-win .gk-stone { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #d9534f, 0 0 8px 3px rgba(217,83,79,0.55); }   /* 🎫#43 原来是金圈，套在 opus 的金子上看不出 → 白圈 + 红边 */
.gk-mark { font-size: 17px; }
.gm-type { margin-bottom: 2px; }
/* ===== 🟢🔵🟡 🎫#44 オセロ：10×10 grid（第 0 行列字母、第 0 列行号）+ 81 个格子按钮；暗绿毡底（和澄澄的亮绿子分得开）+ 浅色格线 ===== */
.ot-wrap { display: flex; justify-content: center; }
.ot-board {
  display: grid; grid-template-columns: 0.6fr repeat(9, 1fr); grid-template-rows: 0.6fr repeat(9, 1fr);
  width: 100%; max-width: 420px; aspect-ratio: 1; padding: 3px 6px 6px 2px; box-sizing: border-box;
  background: #1f4f2a; border-radius: 10px; box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(0,0,0,0.3);
}
.ot-lab { display: flex; align-items: center; justify-content: center; font: 9.5px var(--mono); color: rgba(225,240,225,0.75); user-select: none; }
.ot-cell { position: relative; padding: 0; margin: 0; border: 0; min-width: 0; min-height: 0; background: #2e6b3a;
  box-shadow: inset 0 0 0 0.5px rgba(230,245,230,0.38); -webkit-tap-highlight-color: transparent; }
.ot-cell:disabled { opacity: 1; cursor: default; }
.ot-cell.is-open { background: #255a30; }   /* 开局前三手的起手区：底色稍深 */
.ot-stone { position: absolute; inset: 9%; border-radius: 50%; z-index: 1; }
.ot-cell.is-last .ot-stone::after { content: ''; position: absolute; inset: 34%; border-radius: 50%; background: #d9534f; }   /* 最后一手：中间小红点（同四子棋） */
.ot-cell.is-flipped .ot-stone { box-shadow: 0 0 0 1.5px rgba(255,255,255,0.9), 0 1px 2px rgba(0,0,0,0.45); }   /* 这一手刚被翻：细白圈 */
.ot-dot { position: absolute; inset: 36%; border-radius: 50%; background: rgba(170,240,180,0.55); }   /* 能落的格：淡色圆点 */
.ot-n { position: absolute; right: 2px; bottom: 0; font: 9px var(--mono); color: rgba(235,250,235,0.9); line-height: 1.2; }   /* 落这里翻几颗 */
.ot-board.is-mine .ot-cell.is-legal:not(:disabled) { cursor: pointer; }
.ot-board.is-mine .ot-cell.is-legal:not(:disabled):active { background: #3b8a4a; }
.ot-scores { font-size: 15px; margin-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { .gk-cell, .gk-stone, .ot-cell, .ot-stone, .ot-dot { transition: none !important; animation: none !important; } }
