/* ============================================================
   hall-theme.css · 接龙大厅融合案（牌匾题板 / 状态条 / 芯片网格 /
   规则条 / 等待态学习卡 / tab 切换 / 空链建议 / 断线横幅）
   加载顺序：style.css → hall 内嵌样式 → theme.css → theme-pages.css → 本文件
   全部复用 theme.css 的暖白 + 朱砂变量，不引入新色彩体系。
   ============================================================ */

/* ---------- 1. 牌匾题板（替换原 .hall-round 横条） ---------- */
body.page-hall .hall-top { padding: 12px 14px 0; }

.h-hero {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--red-line);
  border-radius: var(--r-lg);
  padding: 14px 16px 10px;
  background-image: linear-gradient(180deg, rgba(163,44,38,.03), rgba(163,44,38,0) 62%);
}
.h-hero::before, .h-hero::after {
  content: "";
  position: absolute; left: 12px; right: 12px; height: 2px;
  background: linear-gradient(90deg, var(--red-line), var(--red-soft), var(--red-line));
}
.h-hero::before { top: 5px; }
.h-hero::after { bottom: 5px; }

.h-hero-row { display: flex; align-items: stretch; gap: 10px; }
.h-hero-row.solo .h-start-col { display: none; }
.h-hero-row.solo .h-bridge { display: none; }
.h-hero-row.solo .h-target-col { flex: 1; }

.h-char-col { flex: 1; text-align: center; min-width: 0; }
.h-label {
  font-size: 11px; color: var(--ink-3); letter-spacing: .3em;
  margin-bottom: 3px; padding-left: .3em; white-space: nowrap;
}
.h-char {
  font-family: var(--font-serif);
  font-size: 40px; line-height: 1.2; font-weight: 700; color: var(--ink);
  display: block;
}
.h-char-py { font-size: 12px; color: var(--ink-3); letter-spacing: .08em; }
.h-target-col .h-char { color: var(--red); }
.h-target-col .h-label { color: var(--red); font-weight: 600; }
.h-hero-row.solo .h-target-col .h-char { font-size: 44px; }

.h-bridge {
  flex: 0 0 42px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
}
.h-bridge .h-arrow { color: var(--red); font-size: 19px; line-height: 1; font-weight: 300; }
.h-bridge .h-bridge-line { width: 1px; flex: 1; background: var(--line); min-height: 9px; }

.h-corner-tag {
  position: absolute; top: 9px; right: 10px;
  background: var(--red); color: var(--paper-card);
  font-size: 11px; letter-spacing: .18em; padding: 2px 5px 2px 8px;
  border-radius: 3px 0 0 3px; font-weight: 600;
}

/* ---------- 2. 状态条 ---------- */
.h-status {
  display: flex; align-items: stretch;
  margin: 8px 0 0;
  background: var(--paper-sunk);
  border-radius: var(--r-md);
  padding: 5px 2px;
  font-size: 12px; color: var(--ink-2);
}
.h-status .st {
  flex: 1 1 0; text-align: center; line-height: 1.55;
  border-left: 1px solid var(--line);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 4px;
}
.h-status .st:first-child { border-left: none; }
.h-status b { color: var(--ink); font-weight: 700; font-size: 13px; }
.h-status .st-top b { color: var(--red); }
.h-status .hall-idle.warn { color: var(--gold); font-weight: 700; }

/* ---------- 4. 链头工具条：已接统计 + 平铺/时间线切换（链条内吸顶） ---------- */
.h-chain-head {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-3);
  padding: 6px 2px 8px;
  background: var(--paper-card);
}
.h-chain-head b { color: var(--ink); }
.h-view-toggle {
  margin-left: auto; display: flex; gap: 2px;
  background: var(--paper-sunk); border-radius: 7px; padding: 2px;
}
.h-view-toggle button {
  border: none; background: transparent; cursor: pointer;
  font-size: 11px; color: var(--ink-3); padding: 2px 9px;
  border-radius: 5px; font-family: inherit; line-height: 1.5;
  min-height: 0;
}
.h-view-toggle button.on { background: var(--paper-card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }

/* ---------- 5. 芯片网格 ---------- */
.h-chip-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px; padding: 2px 0 8px;
}
body .hall-chain.list-view .h-chip-grid { display: none; }
body .hall-chain:not(.list-view) .chain-item { display: none; }
body .hall-chain:not(.list-view) .hall-empty { display: none; }

.h-chip {
  background: var(--paper-card); border: 1px solid var(--line);
  border-radius: var(--r-sm); text-align: center;
  padding: 9px 4px 8px; font-size: 16px; letter-spacing: .14em;
  font-family: var(--font-serif); color: var(--ink);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.h-chip em { font-style: normal; color: var(--red); }
.h-chip.fold {
  background: var(--paper-sunk); color: var(--ink-3); font-family: var(--font-sans);
  font-size: 12px; letter-spacing: 0;
}
.h-chip.fold-tail { grid-column: 1 / -1; }
/* 等待态下隐藏芯片网格：学习卡 + 建议 + 小结优先露出 */
body .hall-chain .h-idle-zone:not([hidden]) + .h-chip-grid { display: none; }

/* ---------- 6. 等待态（新链无人接时）：学习卡 + 上轮小结 ---------- */
.h-idle-zone { padding: 2px 0 10px; }
body .hall-chain.list-view .h-idle-zone { display: none; }

.h-wait-banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3); padding: 4px 2px 10px;
}
.h-wait-banner b { color: var(--ink); }
.h-wait-banner .dots { color: var(--red); letter-spacing: 3px; }

.h-learn-card {
  background: var(--paper-card); border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--r-md); padding: 12px 14px;
}
.h-learn-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.h-learn-name { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: .08em; }
.h-learn-py { font-size: 12px; color: var(--ink-3); }
.h-learn-tag {
  margin-left: auto; font-size: 11px; color: var(--gold-dark);
  background: var(--gold-soft); border: 1px solid var(--gold-line);
  border-radius: 4px; padding: 1px 7px; letter-spacing: .12em; white-space: nowrap;
}
.h-learn-explain { font-size: 13px; color: var(--ink-2); line-height: 1.75; margin-top: 8px; }
.h-learn-source { font-size: 12px; color: var(--ink-3); margin-top: 8px; display: flex; gap: 6px; }
.h-learn-source .book { color: var(--slate); font-weight: 600; flex: 0 0 auto; }
.h-learn-loading { font-size: 12px; color: var(--ink-4); text-align: center; padding: 10px 0; }

.h-summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--paper-sunk); border-radius: var(--r-md);
  padding: 9px 12px; margin-top: 10px; font-size: 12px; color: var(--ink-2);
}
.h-summary .h-sum-title { font-weight: 600; color: var(--ink); flex: 0 0 auto; }
.h-summary .h-sum-who { display: flex; gap: 4px; flex-wrap: wrap; }
.h-summary .h-sum-who span {
  background: var(--paper-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 1px 8px; color: var(--ink-2); font-size: 11px;
}
.h-summary .h-sum-who span i { font-style: normal; color: var(--red); font-weight: 700; margin-right: 2px; }
/* display:flex 会盖过 hidden 的 UA 样式，显式补一条，避免没数据时留一条空灰条 */
.h-summary[hidden] { display: none; }
/* 自己那一格：朱砂细描边，扫一眼就能找到 */
.h-summary .h-sum-who span.me { border-color: var(--red-line); background: var(--red-soft); color: var(--ink); }

/* ---------- 6.5 空链建议成语：给三个能接的，点一下填进输入框 ---------- */
.h-sug { padding: 0 0 12px; }
.h-sug-tip { font-size: 12px; color: var(--ink-3); margin-bottom: 7px; padding-left: 2px; }
.h-sug-list { display: flex; gap: 6px; }
.h-sug-btn {
  flex: 1 1 0; min-width: 0; min-height: 0; cursor: pointer;
  background: var(--paper-card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 9px 4px 8px;
  font-family: inherit; text-align: center; line-height: 1.4;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.h-sug-btn .w {
  font-family: var(--font-serif); font-size: 17px; color: var(--ink);
  letter-spacing: .12em; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.h-sug-btn .use { font-size: 11px; color: var(--red); }
.h-sug-btn:active { background: var(--red-soft); border-color: var(--red-line); }

/* ---------- 7. 接龙输入区（规则条已并入空链提示，不再单独占一行） ---------- */

/* ---------- 8. 断线横幅（连续失败 2 次后出现，可手动重连） ---------- */
.hall-offline {
  display: none; flex: 0 0 auto; align-items: center; gap: 8px;
  padding: 7px 14px; font-size: 12px; color: var(--red);
  background: var(--red-soft); border-bottom: 1px solid var(--red-line);
}
.hall-offline.show { display: flex; }
.hall-offline .dot {
  flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); animation: hallOffPulse 1.2s ease-in-out infinite;
}
.hall-offline .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hall-offline button {
  flex: 0 0 auto; min-height: 0; cursor: pointer;
  border: 1px solid var(--red-line); background: var(--paper-card);
  color: var(--red); font-family: inherit; font-size: 12px; line-height: 1.5;
  border-radius: 999px; padding: 2px 11px;
}
.hall-offline button:active { background: var(--red-soft); }
@keyframes hallOffPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---------- 键盘折叠协同：聊天键盘弹起时隐藏的区块包含新组件，无需额外处理 ---------- */

/* ---------- 响应式 ---------- */
@media (max-width: 600px) {
  /* 小屏优先保成语：牌匾压成一行「起点 逢 → 要接 故」，字号与留白全部收紧 */
  body.page-hall .hall-top { padding: 6px 10px 0; }
  .h-hero { padding: 7px 10px 6px; }
  .h-hero::before, .h-hero::after { display: none; }
  .h-corner-tag { display: none; }
  .h-hero-row { gap: 6px; align-items: center; }
  .h-char-col {
    display: flex; align-items: baseline; justify-content: center; gap: 5px;
  }
  .h-label {
    margin-bottom: 0; padding-left: 0; letter-spacing: .05em; font-size: 11px;
    flex: 0 0 auto;
  }
  .h-char { font-size: 26px; line-height: 1.1; }
  .h-hero-row.solo .h-target-col .h-char { font-size: 28px; }
  .h-char-py { font-size: 10px; }
  .h-bridge { flex-basis: 20px; }
  .h-bridge .h-arrow { font-size: 15px; }
  .h-bridge-line { display: none; }
  .h-status { font-size: 11px; padding: 4px 2px; margin-top: 5px; }
  .h-status b { font-size: 12px; }
  body.page-hall .h-chain-head { padding: 4px 2px 6px; }
  body.page-hall .hall-chain { padding: 6px 12px 8px; }
  .h-chain-head { gap: 6px; }
  .h-chip-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 5px; padding-bottom: 4px; }
  .h-chip { padding: 7px 4px 6px; font-size: 15px; }
  body .hall-compose { padding: 6px 12px 4px; }
  /* 小屏聊天区不留标题行：下面就是发言框，省一行高度给成语 */
  body.page-hall .hall-chat-head { display: none; }
  body.page-hall .hall-chat-list { padding-top: 6px; }
  /* 小屏聊天让出高度，链条区才有空间显示成语 */
  body.page-hall:not(.kb-chat) .hall-chat { max-height: 24vh; }
  body.page-hall:not(.kb-chat) .hall-chat-list { max-height: 13vh; }
  body.page-hall .hall-jump { right: 12px; bottom: calc(24vh + 78px); padding: 5px 11px; font-size: 11px; }
}

/* 桌面：链区字号与旧版一致，牌匾与聊天右栏并排 */
@media (min-width: 1024px) {
  body.page-hall .hall-top { padding: 14px 16px 12px; }
  .h-char { font-size: 44px; }
  .h-status { margin: 10px 0 0; }
}
