/* ════════════════════════════════════════════
   Chat (v3.22) — 即時聊天
   ════════════════════════════════════════════ */
.chat-shop {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--header-h) - var(--nav-h) - env(safe-area-inset-bottom) - var(--gap-sm) * 2);
  gap: 6px;
  padding: 4px 0;
}

.chat-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  flex-shrink: 0;
}
.chat-chan {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 3px 9px;
  color: var(--c-text-faint);
  font-size: 0.72em;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.5;
}
.chat-chan--on {
  opacity: 1;
  background: var(--c-surface3);
  border-color: var(--c-gold-dim);
}
.chat-chan-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 8px 10px;
  min-height: 200px;
}
.chat-msgs {
  font-size: 0.8em;
  line-height: 1.6;
  color: var(--c-text);
}
/* 移除 br + br hide rule —
   CSS 的「相鄰兄弟」不算 text node 為間隔，
   即便「測試一下<br>多謝晒」中間有文字，兩個 br 仍是 element-adjacent → 第二個被 hide。
   會破壞單筆訊息內 user 自己的多換行（公告 sanitize_announce_body 把 \n 轉 <br>）。 */
.chat-msgs img {
  vertical-align: middle;
  max-height: 20px;
  margin: 0 2px;
}
.chat-msgs a {
  color: var(--c-gold);
  text-decoration: none;
}
.chat-msgs a:hover { text-decoration: underline; }
.chat-empty {
  text-align: center;
  color: var(--c-text-faint);
  font-size: 0.8em;
  padding: 40px 0;
}

.chat-form {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 8px;
  flex-shrink: 0;
}
.chat-form-row {
  display: flex;
  gap: 6px;
  margin-bottom: 5px;
}
.chat-form-row:last-child { margin-bottom: 0; }
.chat-form .chat-type,
.chat-form .chat-toname,
.chat-form .chat-msg-input {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-family: var(--font);
  padding: 6px 8px;
  font-size: 0.82em;
}
.chat-type { flex-shrink: 0; min-width: 80px; }
.chat-toname { flex: 1; min-width: 0; }
.chat-color {
  width: 36px;
  height: 32px;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.chat-msg-input {
  flex: 1;
  resize: none;
  font-family: var(--font);
}
.chat-send-btn {
  background: linear-gradient(135deg, #7a5010, #c9a84c);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 0 16px;
  font-size: 0.85em;
  font-weight: bold;
  font-family: var(--font);
  cursor: pointer;
  flex-shrink: 0;
}
.chat-send-btn:active { opacity: 0.85; }
.chat-form-help {
  font-size: 0.68em;
  color: var(--c-text-faint);
  margin-top: 4px;
}
.chat-form-help code {
  background: var(--c-surface2);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--c-gold-dim);
  font-size: 0.95em;
}

/* ════════════════════════════════════════════
   Chat picker (v3.23) — 表情 + 快速代碼
   ════════════════════════════════════════════ */
.chat-picker-row {
  align-items: center;
  margin-bottom: 4px;
}
.chat-pick-btn {
  min-width: 32px;
  height: 32px;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-size: 0.82em;
  font-family: var(--font);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  gap: 4px;
  white-space: nowrap;
}
.chat-pick-btn:active { background: var(--c-surface3); border-color: var(--c-gold-dim); }
.chat-pick-hint {
  font-size: 0.7em;
  color: var(--c-text-faint);
  margin-left: 4px;
}

.chat-picker {
  position: relative;
  margin-top: 6px;
  background: var(--c-surface2);
  border: 1px solid var(--c-gold-dim);
  border-radius: var(--r-md);
  padding: 8px;
  max-height: 240px;
  overflow-y: auto;
  animation: pickerSlide 0.18s ease-out;
}
@keyframes pickerSlide {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78em;
  color: var(--c-gold);
  font-weight: bold;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--c-border);
}
.chat-picker-close {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  color: var(--c-text-faint);
  font-size: 1.2em;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.chat-picker-close:hover { color: var(--c-red); }
.chat-picker-loading {
  text-align: center;
  color: var(--c-text-faint);
  font-size: 0.78em;
  padding: 20px 0;
}

.chat-face-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.chat-face-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 4px 2px;
  cursor: pointer;
  font-family: var(--font);
}
.chat-face-cell:active {
  background: var(--c-surface3);
  border-color: var(--c-gold);
}
.chat-face-cell img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.chat-face-lbl {
  font-size: 0.58em;
  color: var(--c-text-faint);
  word-break: break-all;
  text-align: center;
  line-height: 1.1;
}

.chat-code-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-code-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
}
.chat-code-cell:active {
  background: var(--c-surface3);
  border-color: var(--c-gold);
}
.chat-code-name {
  flex-shrink: 0;
  font-size: 0.95em;
  color: var(--c-gold);
  font-weight: bold;
  min-width: 90px;
}
.chat-code-desc {
  font-size: 0.88em;
  color: var(--c-text);
  flex: 1;
  line-height: 1.45;
}

/* ════════════════════════════════════════════
   Chat target picker (v3.35)
   ════════════════════════════════════════════ */
.chat-toname-wrap {
  flex: 1;
  display: flex;
  gap: 4px;
  min-width: 0;
}
.chat-toname-wrap .chat-toname {
  flex: 1;
  min-width: 0;
}
.chat-pick-target {
  width: 32px;
  height: 32px;
  background: var(--c-surface3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-size: 1em;
  font-family: var(--font);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.chat-pick-target:active {
  background: var(--c-surface2);
  border-color: var(--c-gold-dim);
}

/* Online picker 模式 — 玩家可點擊高亮 */
.online-row--pickable {
  cursor: pointer;
  padding: 6px 8px !important;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.online-row--pickable:hover,
.online-row--pickable:active {
  background: rgba(200,160,60,0.15);
}
.online-pick-tag {
  font-size: 0.65em;
  color: var(--c-gold);
  background: rgba(200,160,60,0.2);
  padding: 1px 5px;
  border-radius: 7px;
  margin-left: 6px;
}
.online-pick-scout {
  color: #b0d9ff;
  background: rgba(80,140,220,0.22);
}
.online-pick-me {
  color: #999;
  background: rgba(150,150,150,0.18);
}
.online-row[data-me="1"] {
  opacity: 0.6;
  cursor: default;
}
/* 偵查 modal 內的 cp_view 容器（沒 sv-page，所以樣式繼承不到，加 padding）*/
.sv-page-scout {
  padding: 0;
}
.sv-page-scout .sv-section {
  margin-bottom: 8px;
}

/* gv-quick-btn todo（未實作功能） */
.gv-quick-btn--todo {
  opacity: 0.55;
  border-style: dashed;
}
.gv-quick-btn--todo::after {
  content: '◔';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.6em;
  color: var(--c-text-faint);
}
.gv-quick-btn { position: relative; }

