/* =====================================================================
   TRPG Desk v2.4.32 - 跑团主持人辅助器
   v2.4.32: 支持 1~6 玩家 + 扫码加入弹窗 + 6 玩家配色
   风格:Dark Academia + 羊皮纸 + 烛光
   ===================================================================== */
:root {
  --bg: #1a1410;
  --bg-2: #221a14;
  --card: #2a211a;
  --card-2: #34281f;
  --line: #4a3a2c;
  --line-soft: #3a2d22;
  --text: #e8dcc4;
  --text-dim: #a89880;
  --text-mute: #756857;
  --amber: #d4a574;
  --amber-bright: #f5cb87;
  --amber-deep: #a07a4f;
  --purple: #9b59b6;
  --red: #c0392b;
  --red-bright: #e74c3c;
  --blue: #3498db;
  --green: #2ecc71;
  --candle: #f39c12;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 165, 116, 0.08);
  --shadow-glow: 0 0 32px rgba(212, 165, 116, 0.18);
  --serif: 'Crimson Pro', 'Georgia', serif;
  --display: 'Cinzel', 'Trajan Pro', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
  user-select: text;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.15);
}
textarea { resize: vertical; min-height: 60px; font-family: var(--serif); }

/* 背景噪点纹理 */
.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* ========== 通用视图切换 ========== */
.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 24px;
  border: 1px solid var(--amber-deep);
  font-family: var(--sans);
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
}
.toast.error { border-color: var(--red); color: var(--red-bright); }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* =================================================================
   首页
   ================================================================= */
.home-view {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 165, 116, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(155, 89, 182, 0.04) 0%, transparent 60%),
    var(--bg);
}
.home-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  text-align: center;
}
.home-header { margin-bottom: 36px; }
.home-crest {
  font-size: 44px;
  filter: drop-shadow(0 0 16px rgba(243, 156, 18, 0.5));
  animation: flicker 3s infinite alternate;
}
@keyframes flicker {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 16px rgba(243, 156, 18, 0.5)); }
  50% { opacity: 0.85; filter: drop-shadow(0 0 8px rgba(243, 156, 18, 0.3)); }
}
.home-title {
  font-family: var(--display);
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 12px 0 6px;
  color: var(--amber-bright);
  text-shadow: 0 0 24px rgba(212, 165, 116, 0.3);
}
.home-dot { color: var(--purple); margin: 0 4px; }
.home-subtitle {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
.home-status {
  display: inline-block;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.home-status.online { color: var(--green); border-color: var(--green); }
.home-status.static-mode { color: var(--amber-bright); border-color: var(--amber-bright); }

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
@media (max-width: 480px) {
  .role-grid { grid-template-columns: 1fr; }
}
.role-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.role-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.05) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.2s;
}
.role-btn:hover {
  transform: translateY(-2px);
  border-color: var(--amber);
  box-shadow: var(--shadow-glow);
}
.role-btn:hover::before { opacity: 1; }
.role-btn:active { transform: translateY(0); }
.role-btn.taken { opacity: 0.55; }
.role-btn.hidden { display: none !important; }
.role-btn.taken::after {
  content: '已占用';
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  color: var(--red-bright);
  border: 1px solid var(--red);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--sans);
}
.role-emoji { font-size: 36px; line-height: 1; }
.role-name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  color: var(--amber-bright);
  letter-spacing: 0.04em;
}
.role-desc {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.role-status {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}
.role-status.online {
  color: var(--green);
}
.home-footer {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.8;
}
.home-tip { color: var(--text-dim); }
.home-url { color: var(--amber-deep); font-family: var(--sans); }

/* =================================================================
   Pad 视图
   ================================================================= */
.pad-view { background: #0a0805; overflow: hidden; }
.pad-stage {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(45deg, #0a0805 0 20px, #110a06 20px 40px);
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.pad-map-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.pad-map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-family: var(--serif);
  gap: 16px;
}
.pad-placeholder-icon { font-size: 80px; opacity: 0.4; }
.pad-placeholder-text { font-size: 18px; letter-spacing: 0.1em; }

.pad-map-items {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pad-map-item {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 220px;
  background: rgba(42, 33, 26, 0.95);
  border: 1px solid var(--amber-deep);
  border-radius: 8px;
  padding: 8px 12px;
  pointer-events: auto;
  font-family: var(--serif);
  box-shadow: var(--shadow);
  text-align: center;
}
.pad-map-item.clue { border-color: var(--purple); background: rgba(60, 30, 60, 0.95); }
.pad-map-item .item-title {
  font-family: var(--display);
  font-size: 14px;
  color: var(--amber-bright);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.pad-map-item.clue .item-title { color: #d9a6e8; }
.pad-map-item .item-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
  max-height: 100px;
  overflow: auto;
}
.pad-map-item .item-thumb {
  max-width: 180px;
  max-height: 100px;
  border-radius: 4px;
  display: block;
  margin: 4px auto 0;
}

.pad-pieces {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* .pad-piece 样式见下方"棋子缩小"区块 */

.pad-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  z-index: 100;
  pointer-events: none;
}
.pad-topbar > * { pointer-events: auto; }
.pad-title {
  font-family: var(--display);
  font-size: 18px;
  color: var(--amber-bright);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.pad-actions { display: flex; gap: 8px; }
.pad-btn {
  background: rgba(42, 33, 26, 0.85);
  border: 1px solid var(--amber-deep);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
}
.pad-btn:hover { border-color: var(--amber); background: var(--card-2); }
.pad-btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  height: 18px;
  line-height: 18px;
  background: var(--red);
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  margin-left: 4px;
}

.pad-feed {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 340px;
  max-width: 90vw;
  background: var(--card);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  z-index: 200;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
}
.pad-feed.open { transform: translateX(0); }
.pad-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: 14px;
  color: var(--amber-bright);
  letter-spacing: 0.05em;
}
.pad-feed-close {
  font-size: 18px;
  color: var(--text-dim);
  padding: 4px 8px;
}
.pad-feed-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pad-feed-empty {
  text-align: center;
  color: var(--text-mute);
  font-family: var(--sans);
  font-size: 13px;
  padding: 40px 20px;
}
.pad-feed-card {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
}
.pad-feed-card.clue { border-left-color: var(--purple); }
.pad-feed-card.image { border-left-color: var(--blue); }
.pad-feed-card.audio { border-left-color: var(--green); }
.pad-feed-card.video { border-left-color: #e67e22; }
.pad-feed-card .feed-from {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.pad-feed-card .feed-title {
  font-family: var(--display);
  font-size: 14px;
  color: var(--amber-bright);
  margin-bottom: 4px;
}
.pad-feed-card.clue .feed-title { color: #d9a6e8; }
.pad-feed-card .feed-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.pad-feed-card .feed-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  margin-top: 6px;
  cursor: zoom-in;
}
.pad-feed-card .feed-audio, .pad-feed-card .feed-video {
  width: 100%;
  margin-top: 6px;
}
.pad-feed-card .feed-close {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pad-feed-card .feed-close:hover { color: var(--red-bright); background: var(--bg); }

/* =================================================================
   玩家视图
   ================================================================= */
.player-view { background: var(--bg); }
.player-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.player-id { display: flex; align-items: center; gap: 10px; }
.player-emoji { font-size: 28px; }
.player-name {
  font-family: var(--display);
  font-size: 20px;
  color: var(--amber-bright);
  letter-spacing: 0.05em;
}
.player-sub {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.player-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.player-empty {
  text-align: center;
  color: var(--text-mute);
  font-family: var(--serif);
  font-size: 16px;
  padding: 60px 20px;
  font-style: italic;
}
.player-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}
.player-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  padding: 14px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}
.player-card:active { transform: scale(0.99); }
.player-card.clue { border-left-color: var(--purple); background: linear-gradient(135deg, var(--card), rgba(155, 89, 182, 0.08)); }
.player-card.image { border-left-color: var(--blue); }
.player-card.audio { border-left-color: var(--green); }
.player-card.video { border-left-color: #e67e22; }

.player-card .card-type {
  font-family: var(--sans);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.player-card.clue .card-type { color: #d9a6e8; }
.player-card .card-title {
  font-family: var(--display);
  font-size: 18px;
  color: var(--amber-bright);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.player-card.clue .card-title { color: #d9a6e8; }
.player-card .card-body {
  font-size: 16px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}
.player-card .card-img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 6px;
  display: block;
  margin-top: 8px;
  border: 1px solid var(--line);
}
.player-card audio, .player-card video {
  width: 100%;
  max-height: 280px;
  margin-top: 8px;
  outline: none;
  border-radius: 6px;
  background: #000;
  display: block;
}
.player-card .card-time {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 8px;
}
.player-card .card-push {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--amber);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.05em;
}
.player-card .card-push:active { background: var(--amber-bright); }

.player-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  background: var(--card);
}
.player-btn {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.player-btn:hover { color: var(--text); border-color: var(--text-dim); }

/* =================================================================
   主持人视图
   ================================================================= */
.host-view { background: var(--bg); }
.host-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.host-title-row { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.host-emoji { font-size: 22px; }
.host-title-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  font-family: var(--display);
  font-size: 16px;
  color: var(--amber-bright);
  letter-spacing: 0.04em;
}
.host-title-input:hover { border-color: var(--line-soft); }
.host-title-input:focus { border-color: var(--amber); background: var(--bg-2); }
.host-online { display: flex; gap: 6px; }
.host-dot {
  font-size: 18px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  opacity: 0.4;
  filter: grayscale(0.7);
}
.host-dot.online { opacity: 1; filter: none; border-color: var(--green); box-shadow: 0 0 8px rgba(46, 204, 113, 0.4); }
.host-btn-exit {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  white-space: nowrap;
}
.host-btn-exit:hover { color: var(--text); }

.host-main {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  padding-bottom: 80px;
}
.host-tab { display: flex; flex-direction: column; gap: 16px; }
.host-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.host-section-danger { border-color: rgba(192, 57, 43, 0.4); }
.host-section-title {
  font-family: var(--display);
  font-size: 14px;
  color: var(--amber-bright);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.host-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.host-row:last-child { margin-bottom: 0; }
.host-row-end { align-items: center; }
.host-input { flex: 1; min-width: 0; }
.host-textarea { min-height: 60px; font-family: var(--serif); width: 100%; }
.host-input-num { width: 64px; padding: 6px 8px; }
.host-label {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.host-check, .host-radio, .host-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.host-check input, .host-radio input, .host-checkbox input { width: 16px; height: 16px; accent-color: var(--amber); }

.host-btn {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.2s;
}
.host-btn:hover { border-color: var(--amber); }
.host-btn-primary {
  background: linear-gradient(135deg, var(--amber), var(--amber-deep));
  color: var(--bg);
  font-weight: 600;
  border-color: var(--amber);
}
.host-btn-primary:hover { background: linear-gradient(135deg, var(--amber-bright), var(--amber)); }
.host-btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  font-weight: 600;
}
.host-btn-danger:hover { background: var(--red-bright); }
.host-btn-warn {
  background: linear-gradient(135deg, #d35400, #a04000);
  color: #fff;
  border-color: #d35400;
  font-weight: 600;
  margin-top: 6px;
}
.host-btn-warn:hover { background: linear-gradient(135deg, #e67e22, #c06100); }

/* 主持人版图预览 */
.host-map-preview {
  margin-top: 10px;
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.host-map-preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-family: var(--serif);
  font-size: 14px;
}
.host-map-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.host-map-preview-items { position: absolute; inset: 0; pointer-events: none; }
.host-map-preview-item {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 140px;
  background: rgba(42, 33, 26, 0.95);
  border: 1px solid var(--amber-deep);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text);
  pointer-events: auto;
  cursor: move;
  touch-action: none;
}
.host-map-preview-item.clue { border-color: var(--purple); }
.host-map-preview-item .del {
  position: absolute;
  top: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}

/* 主持人 mini list */
.host-mini-list { display: flex; flex-direction: column; gap: 6px; }
.host-mini-empty {
  text-align: center;
  color: var(--text-mute);
  font-family: var(--sans);
  font-size: 12px;
  padding: 20px;
}
.host-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
}
.host-mini-item.clue { border-left-color: var(--purple); }
.host-mini-item.image { border-left-color: var(--blue); }
.host-mini-item.audio { border-left-color: var(--green); }
.host-mini-item.video { border-left-color: #e67e22; }
.host-mini-item .mini-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
}
.host-mini-item .mini-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.host-mini-item .mini-del {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-mute);
  font-size: 16px;
  line-height: 22px;
  text-align: center;
}
.host-mini-item .mini-del:hover { color: var(--red-bright); background: var(--bg); }

.host-dual-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .host-dual-list { grid-template-columns: 1fr; }
}
.host-mini-col h3 {
  font-family: var(--display);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

/* 主持人日志 */
.host-log {
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.host-log .log-row {
  display: flex;
  gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px dashed var(--line-soft);
}
.host-log .log-row:last-child { border-bottom: none; }
.host-log .log-time {
  color: var(--text-mute);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.host-log .log-msg { color: var(--text); flex: 1; word-break: break-word; }

/* 主持人底部 tab */
.host-tabs {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 50;
}
.host-tab-btn {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-dim);
  padding: 10px 4px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border-top: 2px solid transparent;
  transition: all 0.2s;
}
.host-tab-btn .tab-emoji { font-size: 20px; line-height: 1; }
.host-tab-btn span { letter-spacing: 0.05em; }
.host-tab-btn.active {
  color: var(--amber-bright);
  border-top-color: var(--amber);
  background: linear-gradient(180deg, rgba(212, 165, 116, 0.08) 0%, transparent 100%);
}
.host-tab-btn:active { background: var(--bg-2); }

/* =================================================================
   放大弹窗
   ================================================================= */
.zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.zoom-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.zoom-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  width: 600px;
  background: var(--card);
  border: 1px solid var(--amber-deep);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow), var(--shadow-glow);
  animation: zoomIn 0.25s ease;
  overflow: auto;
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.zoom-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text);
  font-size: 16px;
  z-index: 1;
}
.zoom-close:hover { background: var(--red); }
.zoom-title {
  font-family: var(--display);
  font-size: 22px;
  color: var(--amber-bright);
  letter-spacing: 0.05em;
  padding-right: 32px;
}
.zoom-body {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
  overflow: auto;
}
.zoom-body img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}
.zoom-body audio, .zoom-body video {
  width: 100%;
  outline: none;
}
.zoom-meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-mute);
  text-align: right;
  letter-spacing: 0.05em;
}

/* =================================================================
   小屏适配
   ================================================================= */
@media (max-width: 380px) {
  .home-title { font-size: 32px; }
  .role-name { font-size: 18px; }
  .role-emoji { font-size: 30px; }
  .player-card .card-title { font-size: 16px; }
  .player-card .card-body { font-size: 14px; }
}

/* =================================================================
   v1.1 新增:大屏高亮(文字/骰子/线索临时显示)
   ================================================================= */
.pad-highlight {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: highlightFadeIn 0.25s ease-out;
  cursor: pointer;
  padding: 24px;
}
@keyframes highlightFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.pad-highlight-content {
  max-width: 80vw;
  max-height: 80vh;
  text-align: center;
  color: var(--amber-bright);
  font-family: var(--display);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.pad-highlight-content .ph-title {
  font-size: 28px;
  letter-spacing: 0.1em;
  text-shadow: 0 0 20px rgba(212, 165, 116, 0.5);
}
.pad-highlight-content .ph-body-large {
  font-size: 42px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff8e7;
  text-shadow: 0 0 16px rgba(212, 165, 116, 0.4);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 70vw;
}
.pad-highlight-content .ph-body {
  font-size: 20px;
  line-height: 1.5;
  color: var(--text);
}
.pad-highlight-content .ph-img {
  max-width: 60vw;
  max-height: 50vh;
  border-radius: 12px;
  border: 2px solid var(--amber);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  cursor: zoom-in;
}
.pad-highlight-content .ph-video {
  max-width: 70vw;
  max-height: 70vh;
  border-radius: 12px;
  border: 2px solid var(--amber);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  background: #000;
  cursor: zoom-in;
}
.pad-highlight-content .ph-audio {
  width: 70vw;
  max-width: 480px;
}
.pad-highlight-content .ph-dice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.pad-highlight-content .ph-dice .ph-from {
  font-size: 22px;
  color: var(--amber);
  letter-spacing: 0.08em;
}
.pad-highlight-content .ph-dice .ph-notation {
  font-size: 32px;
  color: #fff8e7;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.pad-highlight-content .ph-dice .ph-detail {
  font-size: 16px;
  color: var(--text-dim);
  font-family: var(--sans);
  letter-spacing: 0.03em;
}
.pad-highlight-content .ph-dice .ph-total {
  font-size: 120px;
  font-weight: 700;
  color: var(--candle);
  text-shadow: 0 0 30px rgba(243, 156, 18, 0.6);
  line-height: 1;
  margin-top: 8px;
}
.pad-highlight-content .ph-tip {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.1em;
  margin-top: 12px;
  opacity: 0.6;
}

/* 棋子缩小 */
.pad-piece {
  position: absolute;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(42, 33, 26, 0.95);
  border: 2px solid var(--amber);
  color: var(--amber-bright);
  font-family: var(--display);
  cursor: grab;
  touch-action: none;
  z-index: 20;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.pad-piece:active { cursor: grabbing; }
.pad-piece-emoji { font-size: 18px; line-height: 1; }
.pad-piece-label {
  font-size: 9px;
  letter-spacing: 0.05em;
  margin-top: 1px;
  opacity: 0.85;
}

/* Pad feed 抽屉开启状态 */
.pad-feed {
  position: fixed;
  top: 0; right: 0;
  width: 360px;
  max-width: 100vw;
  height: 100vh;
  background: rgba(20, 16, 12, 0.96);
  border-left: 1px solid var(--amber-deep);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
}
.pad-feed.open { transform: translateX(0); }
.pad-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-family: var(--display);
  font-size: 16px;
  color: var(--amber-bright);
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.05em;
}
.pad-feed-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--amber-bright);
  font-size: 14px;
  border: 1px solid var(--amber-deep);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.pad-feed-close:hover { background: var(--red); color: #fff; border-color: var(--red); }
.pad-feed-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pad-feed-empty {
  text-align: center;
  color: var(--text-mute);
  padding: 40px 20px;
  font-style: italic;
}
.pad-feed-card {
  position: relative;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--sans);
  animation: feedSlideIn 0.25s ease-out;
}
@keyframes feedSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.pad-feed-card .feed-from {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.pad-feed-card .feed-title {
  font-family: var(--display);
  font-size: 15px;
  color: var(--amber-bright);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.pad-feed-card .feed-body {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 4px;
}
.pad-feed-card .feed-img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 6px;
  margin-top: 6px;
  cursor: zoom-in;
  display: block;
}
.pad-feed-card .feed-audio,
.pad-feed-card .feed-video {
  width: 100%;
  margin-top: 6px;
  max-height: 240px;
  border-radius: 6px;
  background: #000;
}
.pad-feed-card .feed-close {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--amber-bright);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--amber-deep);
  cursor: pointer;
}
.pad-feed-card .feed-close:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* =================================================================
   v1.1 新增:重连 banner
   ================================================================= */
.reconnect-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 3000;
  background: linear-gradient(180deg, #c0392b 0%, #a93226 100%);
  color: #fff;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  animation: bannerPulse 1.4s ease-in-out infinite;
}
@keyframes bannerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.reconnect-banner.connected {
  background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%);
  animation: none;
}

/* =================================================================
   v1.2 新增:静态演示模式 banner
   ================================================================= */
.demo-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 2500;
  background: linear-gradient(180deg, #f5cb87 0%, #d4a574 100%);
  color: #1a120b;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid #a07a4f;
}
.demo-banner strong {
  font-family: var(--display);
  letter-spacing: 1px;
}
/* 当 demo-banner 显示时,首页内容下移一点避免遮挡 */
.home-view.has-demo-banner .home-wrap {
  padding-top: 70px;
}

/* ===================================================================
   v2.4.36: 角色选择页 (/join) - 手机扫码专用
   =================================================================== */
.join-view {
  align-items: center;
  justify-content: flex-start;
  padding: 16px 14px 28px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 165, 116, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(93, 173, 226, 0.06) 0%, transparent 60%),
    var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.join-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  text-align: center;
}
.join-header { margin-bottom: 16px; }
.join-crest {
  font-size: 36px;
  filter: drop-shadow(0 0 12px rgba(243, 156, 18, 0.5));
  animation: flicker 3s infinite alternate;
}
.join-title {
  font-family: var(--display);
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 6px 0 4px;
  color: var(--amber-bright);
  text-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
}
.join-dot { color: var(--purple); margin: 0 4px; }
.join-subtitle {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.join-status {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.join-status.online { color: var(--green); border-color: var(--green); }
.join-status.offline { color: #c0392b; border-color: #c0392b; }

.join-room-info {
  margin: 14px auto 18px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
}
.join-room-title {
  font-family: var(--display);
  font-size: 15px;
  color: var(--amber-bright);
  margin-bottom: 4px;
}
.join-room-meta {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.join-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 380px) {
  .join-grid { grid-template-columns: 1fr; }
}
.join-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}
.join-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.06) 0%, transparent 100%);
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}
.join-card:hover { border-color: var(--amber); transform: translateY(-1px); }
.join-card:hover::before { opacity: 1; }
.join-card:active { transform: scale(0.97); }
.join-card.taken {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}
.join-card.hidden { display: none !important; }
.join-card-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0,0,0,0.3) inset, 0 0 8px rgba(255,255,255,0.06);
}
.join-card-name {
  font-family: var(--display);
  font-size: 15px;
  color: var(--text);
  letter-spacing: 0.04em;
}
.join-card-status {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.join-card-status.online { color: var(--green); }
.join-card-hint {
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.join-pad-row {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.join-card-pad {
  width: 50%;
  max-width: 220px;
}
@media (max-width: 380px) {
  .join-card-pad { width: 100%; }
}

.join-footer {
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.6;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.join-version {
  font-family: var(--mono);
  color: var(--text-mute);
  margin-top: 2px;
}
.host-view.has-demo-banner .host-header,
.pad-view.has-demo-banner .pad-topbar {
  top: 36px;
}

/* =================================================================
   v1.1 新增:骰子弹窗
   ================================================================= */
.dice-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dice-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.dice-content {
  position: relative;
  max-width: 90vw;
  width: 420px;
  background: var(--card);
  border: 1px solid var(--amber-deep);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow), var(--shadow-glow);
  animation: zoomIn 0.25s ease;
}
.dice-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text);
  font-size: 16px;
  z-index: 1;
}
.dice-close:hover { background: var(--red); }
.dice-title {
  font-family: var(--display);
  font-size: 22px;
  color: var(--amber-bright);
  letter-spacing: 0.05em;
  text-align: center;
  padding: 4px 32px 0 0;
}
.dice-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.dice-btn {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--amber-bright);
  background: linear-gradient(135deg, var(--bg-2), var(--card-2));
  border: 1px solid var(--amber-deep);
  border-radius: 10px;
  padding: 14px 4px;
  letter-spacing: 0.05em;
  transition: all 0.15s;
  cursor: pointer;
}
.dice-btn:hover {
  background: linear-gradient(135deg, var(--amber-deep), var(--amber));
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}
.dice-btn:active { transform: translateY(0); }
.dice-btn[data-sides="100"] { grid-column: span 2; }
.dice-custom {
  display: flex;
  gap: 8px;
}
.dice-input {
  flex: 1;
  min-width: 0;
}
.dice-roll-btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--bg);
  background: linear-gradient(135deg, var(--amber), var(--amber-deep));
  border: 1px solid var(--amber);
  border-radius: 8px;
  padding: 8px 16px;
  white-space: nowrap;
}
.dice-roll-btn:hover {
  background: linear-gradient(135deg, var(--amber-bright), var(--amber));
}
.dice-tip {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

/* 玩家 header 骰子按钮 */
.player-btn-dice {
  background: linear-gradient(135deg, var(--amber), var(--amber-deep));
  color: var(--bg);
  font-weight: 700;
  border-color: var(--amber);
  padding: 6px 14px;
}
.player-btn-dice:hover {
  background: linear-gradient(135deg, var(--amber-bright), var(--amber));
  color: var(--bg);
}

/* 投喂流 / 主持人迷你列表中骰子卡片 */
.pad-feed-card.dice {
  border-left-color: var(--candle);
  background: linear-gradient(135deg, var(--card-2), rgba(243, 156, 18, 0.08));
}
.host-mini-item.dice { border-left-color: var(--candle); }
.dice-result {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 2px;
}
.dice-result .dice-emoji { font-size: 22px; }
.dice-result .dice-total {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  color: var(--candle);
  text-shadow: 0 0 8px rgba(243, 156, 18, 0.4);
  line-height: 1;
}
.dice-result .dice-mod {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}
.dice-detail {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.03em;
  margin-top: 4px;
  word-break: break-all;
}

/* 投喂卡片的钉到版图按钮(仅主持人) */
.feed-pin {
  position: absolute;
  top: 6px; right: 36px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--amber-bright);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--amber-deep);
}
.feed-pin:hover {
  background: var(--amber);
  color: var(--bg);
}

/* 投喂卡片 dice 类型时把 close 按钮位置调整 */
.pad-feed-card.dice .feed-close { top: 6px; right: 6px; }
.pad-feed-card:not(.dice) .feed-pin { right: 36px; }

/* =================================================================
   v1.1 新增:上传按钮
   ================================================================= */
.host-btn-upload {
  padding: 8px 10px;
  font-size: 14px;
  flex-shrink: 0;
}
.host-btn-upload:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.upload-progress {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-dim);
}

/* =================================================================
   v1.1 新增:BGM 标签页与状态
   ================================================================= */
.host-bgm-status {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
}
.host-bgm-status.active {
  color: var(--candle);
  border-color: var(--candle);
}
.host-tip-box {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 12px 14px;
  line-height: 1.7;
}
.host-tip-box p { margin: 2px 0; }

/* BGM 浮动指示器(Pad 和玩家视图显示) */
.bgm-indicator {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(42, 33, 26, 0.92);
  border: 1px solid var(--amber-deep);
  border-radius: 22px;
  padding: 6px 8px 6px 12px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  max-width: 260px;
}
.bgm-icon {
  font-size: 16px;
  animation: bgmFloat 2s ease-in-out infinite;
}
@keyframes bgmFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.bgm-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.bgm-toggle {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--amber-bright);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}
.bgm-toggle:hover {
  background: var(--amber);
  color: var(--bg);
}

/* 5-tab 布局 */
.host-tabs-5 {
  grid-template-columns: repeat(5, 1fr);
}
.host-tab-btn .tab-emoji { font-size: 20px; line-height: 1; }

/* 主持人 feed 列表加钉按钮(只 host 自己用) */
.host-mini-item.has-pin .mini-pin {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--amber-bright);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--amber-deep);
}
.host-mini-item.has-pin .mini-pin:hover {
  background: var(--amber);
  color: var(--bg);
}

/* =====================================================================
   v2.0 新增组件样式
   ===================================================================== */

/* Pad:线索卡(版图上,竖版长方形) */
.pad-clue-card {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 130px;
  padding: 10px 8px;
  background: linear-gradient(135deg, #d4a574 0%, #c08a4e 100%);
  color: #1a120b;
  border-radius: 8px;
  border: 2px solid #6b4924;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(255,255,255,0.2);
  font-family: var(--serif);
  cursor: default;
  z-index: 5;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pad-clue-card.clickable { cursor: pointer; }
.pad-clue-card.clickable:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(212,165,116,0.4), inset 0 0 0 2px rgba(255,255,255,0.3);
}
.clue-card-title {
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  letter-spacing: 0.05em;
}
.clue-card-hint {
  font-size: 10px;
  text-align: center;
  opacity: 0.7;
  margin-top: 4px;
  font-family: var(--sans);
}

/* v2.3: 物品卡(版图上,正方形,只显示名称) */
.pad-item-card {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  padding: 6px 8px;
  background: linear-gradient(135deg, #6b4f3a 0%, #4a3525 100%);
  color: #f4d99a;
  border-radius: 6px;
  border: 2px solid #c08a4e;
  box-shadow: 0 3px 12px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.15);
  font-family: var(--serif);
  cursor: default;
  z-index: 5;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pad-item-card.clickable { cursor: pointer; }
.pad-item-card.clickable:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 5px 16px rgba(192,138,78,0.4), inset 0 0 0 1px rgba(255,255,255,0.25);
  border-color: #f4d99a;
}
.pad-item-card .clue-card-title {
  font-size: 13px;
  line-height: 1.2;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pad:NPC 棋子 */
.pad-npc {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;
  z-index: 4;
  user-select: none;
}
.pad-npc.clickable { cursor: pointer; }
.pad-npc-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--amber);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  background: var(--card);
}
.pad-npc-initial {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-deep) 100%);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  font-family: var(--display);
  border: 3px solid var(--bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.pad-npc-name {
  margin-top: 4px;
  padding: 2px 8px;
  background: rgba(0,0,0,0.7);
  color: var(--amber-bright);
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  font-family: var(--sans);
  font-weight: 600;
}

/* Pad:棋子(玩家) */
.pad-piece {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  z-index: 6;
  user-select: none;
  transition: transform 0.15s;
}
.pad-piece:active { cursor: grabbing; }
.pad-piece.active-turn {
  filter: drop-shadow(0 0 8px var(--amber-bright));
}
.pad-piece.not-your-turn {
  opacity: 0.32;
  filter: grayscale(0.7);
  cursor: not-allowed;
}
.pad-piece-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--card) 0%, var(--card-2) 100%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--display);
  border: 3px solid var(--amber-deep);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  overflow: hidden;
}
.pad-piece-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.pad-piece-avatar.has-img { padding: 0; border: 3px solid var(--amber-bright); }
.pad-piece-label {
  margin-top: 2px;
  padding: 1px 6px;
  background: rgba(0,0,0,0.75);
  color: var(--text);
  font-size: 10px;
  border-radius: 3px;
  font-family: var(--sans);
  font-weight: 600;
  white-space: nowrap;
}
.pad-piece-hp {
  margin-top: 2px;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 3px;
  font-family: var(--sans);
  font-weight: 700;
  background: rgba(0,0,0,0.7);
  white-space: nowrap;
}
.pad-piece-hp.hp-high { color: #5ddc7b; }
.pad-piece-hp.hp-mid  { color: #f5cb87; }
.pad-piece-hp.hp-low  { color: #ff6b6b; animation: hpPulse 1.2s infinite; }
@keyframes hpPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Pad 顶部按钮组(增加 v2.0 nextTurn) */
.pad-actions { display: flex; gap: 8px; align-items: center; }

/* Pad 端"下一回合"按钮(显示当前玩家) */
.pad-btn-turn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  transition: all 0.2s;
}
.pad-btn-turn:hover {
  background: var(--card);
  border-color: var(--amber-deep);
  color: var(--amber-bright);
}
.pad-turn-label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pad-turn-current {
  font-weight: 700;
  color: var(--amber-bright);
  font-size: 14px;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pad-turn-sep { color: var(--text-mute); }
.pad-turn-next {
  color: var(--text-dim);
  font-size: 12px;
}
.pad-btn-turn.turn-p1 {
  border-color: #d96565;
  background: linear-gradient(135deg, rgba(217, 101, 101, 0.15) 0%, var(--card-2) 100%);
}
.pad-btn-turn.turn-p1 .pad-turn-current { color: #ff8a8a; }
.pad-btn-turn.turn-p2 {
  border-color: #5a8fd9;
  background: linear-gradient(135deg, rgba(90, 143, 217, 0.15) 0%, var(--card-2) 100%);
}
.pad-btn-turn.turn-p2 .pad-turn-current { color: #8ab4ff; }

/* 通用 Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  max-width: 540px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 32px; height: 32px;
  color: var(--text-dim);
  font-size: 14px;
}
.modal-close:hover { color: var(--amber-bright); border-color: var(--amber); }
.modal-title {
  font-family: var(--display);
  color: var(--amber-bright);
  font-size: 18px;
  margin-bottom: 14px;
  letter-spacing: 0.05em;
}
.modal-body { font-family: var(--sans); font-size: 14px; color: var(--text); }
.modal-empty { text-align: center; color: var(--text-mute); padding: 20px 0; }
.modal-footer { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
.clue-card-preview img { max-width: 100%; max-height: 300px; border-radius: 6px; }

/* 玩家端 4-tab */
.player-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-2);
  padding: 4px 6px 0;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.player-tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px 6px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
}
.player-tab.active {
  background: var(--card);
  color: var(--amber-bright);
  border-color: var(--line);
}
.player-pane {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.player-main { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* v2.4.21: 玩家聊天面板 - flex column,输入框固定在底部 */
/* 注意:不能加 !important,否则会覆盖 JS 的 display: none (切 tab 时该面板不显示) */
/* v2.4.26: 加 max-height 强制可滚动,避免父容器 flex 不生效时无法滚动 */
.player-pane.player-pane-flex:not([style*="display: none"]) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  max-height: 75vh;
}
.player-pane-flex .player-chat-log {
  flex: 1;
  min-height: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: #1a1a2e;
  color: #eee;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.player-pane-flex .player-chat-input {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.player-pane-flex .player-chat-input input { flex: 1; }

/* v2.4.21: 玩家 Tab 上的未读消息徽章 */
.player-tab-badge {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  min-width: 18px;
  text-align: center;
  animation: badge-pulse 1.5s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* 角色卡 */
.char-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.char-row { display: flex; gap: 14px; align-items: center; }
.char-avatar-box {
  position: relative;
  width: 72px; height: 72px;
  flex-shrink: 0;
}
.char-avatar-img, .char-avatar-placeholder {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--amber-deep);
  background: var(--bg-2);
}
.char-avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.char-avatar-upload {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 11px;
  padding: 0;
  background: var(--amber);
  color: var(--bg);
  border: 2px solid var(--bg);
}
.char-basic { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.char-vitals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: var(--bg-2);
  padding: 10px;
  border-radius: 8px;
  overflow: hidden;
}
.char-vital {
  min-width: 0;  /* 防止 grid 子项溢出 */
  overflow: hidden;
}
.char-vital label {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}
.char-vital-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--sans);
  color: var(--text-dim);
  min-width: 0;
}
.char-vital-row input {
  width: 100%;
  min-width: 0;
  max-width: 60px;
  text-align: center;
  padding: 4px 2px;
  box-sizing: border-box;
}
.char-vital-row span { flex-shrink: 0; }
/* v2.4.31: 金币格子(单值,不要 "/ max") */
.char-vital-gold .char-vital-row input {
  max-width: 90px;
  color: #ffd700;
  font-weight: 600;
}
.char-gold-suffix {
  color: #ffd700;
  font-weight: 600;
  font-size: 14px;
  margin-left: 2px;
}
.char-section-title {
  font-family: var(--display);
  font-size: 14px;
  color: var(--amber-bright);
  margin: 8px 0 6px;
  letter-spacing: 0.05em;
}
.char-attrs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.char-attr-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.char-attr-name { flex: 1; }
.char-attr-val { width: 80px; }
/* v2.4.30: 技能列表 (4列网格: 名称/值/分类/删除) */
.char-skills {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.char-skill-row {
  display: grid;
  grid-template-columns: 1fr 80px 110px 28px;
  gap: 6px;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  padding: 4px 2px;
}
.char-skill-name { min-width: 0; }
.char-skill-val { width: 80px; text-align: center; }
.char-skill-group { min-width: 0; font-size: 12px; }
.char-skill-del {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}
.char-skill-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.char-skill-presets {
  flex: 1;
  min-width: 180px;
  cursor: pointer;
}
@media (max-width: 480px) {
  .char-skill-row {
    grid-template-columns: 1fr 60px 80px 24px;
    gap: 4px;
  }
  .char-skill-group { font-size: 11px; }
}
.char-intro { min-height: 100px; resize: vertical; }
.char-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 玩家背包 */
.player-bag-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.player-bag-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  position: relative;
  font-family: var(--sans);
}
.bag-title { font-weight: 700; color: var(--amber-bright); font-size: 15px; margin-bottom: 6px; }
.bag-img { max-width: 100%; max-height: 240px; border-radius: 6px; margin: 6px 0; }
.bag-body { font-size: 13px; color: var(--text); white-space: pre-wrap; line-height: 1.5; }
.bag-time { font-size: 11px; color: var(--text-mute); margin-top: 6px; }
.bag-from { font-size: 11px; color: var(--text-mute); margin-top: 4px; font-style: italic; }
.bag-media { width: 100%; max-height: 240px; margin: 6px 0; border-radius: 6px; }
.bag-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.bag-actions .mini-del { position: static; }
/* v2.3: 交易按钮 */
.mini-trade {
  background: rgba(255, 196, 102, 0.12);
  color: var(--amber-bright);
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  transition: background 0.15s;
}
.mini-trade:hover {
  background: rgba(255, 196, 102, 0.25);
  color: var(--amber-bright);
}
.player-bag-item .mini-del { position: absolute; top: 8px; right: 8px; }

/* 玩家笔记 */
.player-note { min-height: 280px; resize: vertical; font-family: var(--serif); font-size: 14px; }
.player-note-save { margin-top: 8px; }
.player-note-tip { font-size: 11px; color: var(--text-mute); margin-top: 6px; font-family: var(--sans); }

/* 玩家分享表单 */
.player-share {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.player-share summary {
  font-family: var(--display);
  color: var(--amber-bright);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}
.player-share-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 玩家卡片"分享"按钮 */
.card-share {
  background: var(--amber-deep);
  color: var(--bg);
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 600;
  margin-left: 6px;
}
.card-share:hover { background: var(--amber); }

/* 主持人回合面板 */
.host-turn-panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.host-turn-current {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
}
.host-turn-current strong {
  color: var(--amber-bright);
  font-family: var(--display);
  font-size: 18px;
}

/* 主持人 HP 扣血面板 */
.host-hp-panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.host-hp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.host-hp-target {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  min-width: 110px;
}
.host-hp-target span {
  margin-left: 6px;
  color: var(--amber-bright);
  font-weight: 700;
}
/* v2.4.31: 主持人起始属性的金币输入框 */
.host-label-gold {
  color: #ffd700;
  font-weight: 600;
}
.host-label-gold input {
  border-color: #ffd700;
  max-width: 100px;
}
/* v2.4.31: 金币调整面板 - 当前金币显示 */
.host-gold-current {
  display: inline-block;
  font-family: var(--display);
  font-size: 16px;
  color: #ffd700;
  font-weight: 700;
  min-width: 80px;
  text-align: center;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
}
/* v2.4.31: 小型按钮(±10/±50) */
.host-btn-mini {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  min-width: 44px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  transition: background 0.15s, transform 0.1s;
}
.host-btn-mini:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: #ffd700;
}
.host-btn-mini:active {
  transform: scale(0.96);
}
.host-gold-custom {
  max-width: 90px;
  text-align: center;
  color: #ffd700;
  font-weight: 600;
}
.host-hint {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-mute);
}

/* v2.4.42: AI 生成模态框状态 + 进度条 + spinner */
.ai-gen-status {
  font-family: var(--sans);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
  margin: 10px 0;
  text-align: center;
  font-weight: 500;
  line-height: 1.6;
}
.ai-gen-status:empty { display: none; }
.ai-gen-loading {
  color: #d4a017;
  background: rgba(212, 160, 23, 0.08);
  border: 1px solid rgba(212, 160, 23, 0.25);
}
.ai-gen-success {
  color: #27ae60;
  background: rgba(39, 174, 96, 0.08);
  border: 1px solid rgba(39, 174, 96, 0.25);
}
.ai-gen-error {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.25);
}
/* v2.4.42: spinner 旋转动画 */
.ai-gen-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(212, 160, 23, 0.25);
  border-top-color: #d4a017;
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 8px;
  animation: ai-gen-spin 0.8s linear infinite;
}
@keyframes ai-gen-spin {
  to { transform: rotate(360deg); }
}
/* v2.4.42: 进度条 */
.ai-gen-progress {
  margin-top: 8px;
  height: 6px;
  background: rgba(212, 160, 23, 0.15);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.ai-gen-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #d4a017, #f39c12);
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(212, 160, 23, 0.4);
}
.ai-gen-progress-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: ai-gen-shimmer 1.5s infinite;
}
@keyframes ai-gen-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ai-gen-preview {
  background: rgba(0, 0, 0, 0.03);
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed rgba(0, 0, 0, 0.15);
  margin: 10px 0;
}
.ai-gen-preview p {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* v2.4.46: AI 生成模态框布局优化 - 解决内容拥挤 */
.ai-gen-card {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}
.ai-gen-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 16px 20px;
}
.ai-gen-hint {
  margin: 0;
  padding: 8px 12px;
  background: rgba(212, 165, 116, 0.08);
  border-left: 3px solid #d4a574;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}
.ai-gen-field {
  display: block;
  margin: 0;
}
.ai-gen-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
}
.ai-gen-options-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.ai-gen-size-field {
  flex: 1;
  min-width: 180px;
  margin: 0;
}
.ai-gen-translate-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
  padding-bottom: 8px;
  cursor: pointer;
  user-select: none;
}
.ai-gen-translate-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.ai-gen-preview {
  padding: 14px;
  text-align: center;
}
.ai-gen-preview-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.ai-gen-prompt-display {
  font-size: 11px !important;
  margin-top: 8px !important;
  text-align: left;
  color: #888;
}
.ai-gen-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 4px;
}
.ai-gen-status {
  margin: 0;
}

.host-btn[data-ai-generate] {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.15s, opacity 0.15s;
}
.host-btn[data-ai-generate]:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #5f4dd0, #8b80e8);
}
.host-btn[data-ai-generate]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 主持人笔记展示 */
.host-dual-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.host-mini-col h3 {
  font-family: var(--display);
  font-size: 13px;
  color: var(--amber-bright);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.host-note-display {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 60px;
  max-height: 200px;
  overflow-y: auto;
}

/* 主持人 NPC 列表 */
.host-npc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.host-mini-item.npc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.npc-mini-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--amber);
  flex-shrink: 0;
}
.npc-mini-initial {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.npc-mini-body { flex: 1; }
.npc-mini-name { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--text); }
.npc-mini-meta { font-family: var(--sans); font-size: 11px; color: var(--text-mute); }
.host-mini-item .mini-edit {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--amber-bright);
  border-radius: 4px;
  width: 28px; height: 28px;
  font-size: 12px;
}
.host-mini-item .mini-edit:hover { background: var(--amber); color: var(--bg); }

/* NPC 编辑器弹窗 */
.npc-editor-card { max-width: 720px; }
.npc-dialog-row {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.npc-dialog-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12px;
}
.npc-dialog-row-title { font-weight: 700; color: var(--text); flex: 1; }
.npc-dialog-row-type { color: var(--text-dim); }
.npc-dialog-row-target { color: var(--amber-bright); }
.npc-dialog-row-body { font-size: 12px; color: var(--text-dim); }
.npc-dialog-row-img { max-width: 100%; max-height: 120px; border-radius: 4px; }
.npc-dialog-row-text { white-space: pre-wrap; word-break: break-word; }
.npc-dialog-row .mini-del { position: absolute; top: 6px; right: 6px; }
.host-npc-add-dialog { margin-top: 8px; }
.host-npc-add-dialog summary { cursor: pointer; color: var(--amber-bright); padding: 4px 0; font-family: var(--sans); font-size: 13px; font-weight: 600; }

/* v2.4.47: 已移除原 .npc-dialog-item/.npc-dialog-head/.npc-dialog-tag/.npc-dialog-body/.npc-dialog-btn 样式(旧对话功能已删除) */

/* 主持人骰子面板 */
.host-dice-panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.host-dice-public-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  user-select: none;
}
.host-dice-public-toggle input { display: none; }
.host-dice-public-slider {
  position: relative;
  width: 38px;
  height: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background 0.2s;
}
.host-dice-public-slider::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: left 0.2s, background 0.2s;
}
.host-dice-public-toggle input:checked + .host-dice-public-slider {
  background: rgba(245, 185, 66, 0.3);
  border-color: var(--amber);
}
.host-dice-public-toggle input:checked + .host-dice-public-slider::after {
  left: 19px;
  background: var(--amber-bright);
}
.host-dice-public-label { font-weight: 600; }

.host-dice-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.host-dice-custom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.host-dice-log-details { margin-top: 6px; }
.host-dice-log-details summary {
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--amber-bright);
  padding: 4px 0;
  font-weight: 600;
}
.host-dice-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.host-dice-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--amber);
  border-radius: 4px;
  padding: 6px 10px;
  font-family: var(--sans);
  font-size: 12px;
}
.host-dice-log-item.hidden { border-left-color: var(--text-mute); opacity: 0.6; }
.hd-time { color: var(--text-mute); font-size: 11px; }
.hd-notation { color: var(--amber-bright); font-weight: 700; }
.hd-detail { color: var(--text-dim); flex: 1; }
.hd-total { color: var(--amber-bright); font-weight: 700; font-size: 14px; }
.hd-toggle {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--sans);
  cursor: pointer;
}
.hd-toggle:hover { background: var(--card-2); color: var(--amber-bright); }

/* 主持人剧本查看器 */
.host-script-viewer {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 320px;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.host-script-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-family: var(--sans);
  font-size: 13px;
}
.host-script-bar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.host-script-bar code {
  color: var(--amber-bright);
  font-size: 11px;
  word-break: break-all;
}
.host-script-bar a {
  color: var(--amber-bright);
  text-decoration: none;
  margin-left: auto;
  font-size: 11px;
}
.host-script-bar a:hover { text-decoration: underline; }
.host-script-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 400px;
}
.host-script-text {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 16px;
  background: #fdf6e3;
  color: #1a120b;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.host-script-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-family: var(--sans);
  font-size: 13px;
}

/* v2.2: BGM 音量调节 */
.host-input-range {
  width: 180px;
  cursor: pointer;
  accent-color: var(--amber);
}
.host-volume-label {
  display: inline-block;
  min-width: 40px;
  font-family: var(--display);
  color: var(--amber-bright);
  font-size: 13px;
  margin-left: 4px;
}
.host-bgm-hint {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-mute);
  margin-left: 12px;
}
.host-bgm-status {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  padding: 4px 0;
}
.host-bgm-status.active {
  color: var(--amber-bright);
}

/* v2.2: 玩家端版图 */
.player-map-stage {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 16 / 10;
  margin: 12px auto;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--amber);
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
}
.player-map-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}
.player-map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-family: var(--sans);
  font-size: 14px;
}
.player-map-items,
.player-map-npcs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.player-map-items > *,
.player-map-npcs > * {
  pointer-events: auto;
}
.player-map-piece {
  position: absolute;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(42, 33, 26, 0.95);
  border: 2px solid var(--amber);
  color: var(--amber-bright);
  font-family: var(--display);
  cursor: grab;
  touch-action: none;
  z-index: 20;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.player-map-piece:active { cursor: grabbing; }
.player-map-piece-avatar {
  font-size: 16px;
  line-height: 1;
  font-weight: bold;
}
.player-map-piece-label {
  font-size: 9px;
  margin-top: 1px;
  line-height: 1;
  text-align: center;
  max-width: 38px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-map-piece-hp {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--amber-bright);
  font-family: var(--display);
  white-space: nowrap;
}
.player-map-hint {
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-mute);
  padding: 4px 12px 12px;
  line-height: 1.5;
}
.player-map-piece.not-your-turn {
  opacity: 0.6;
  filter: grayscale(0.5);
}
.player-map-piece.active-turn {
  border-color: var(--amber-bright);
  box-shadow: 0 0 12px var(--amber-bright);
}

/* v2.3: 剧本链接卡片 */
.card-script-url {
  margin-top: 4px;
  font-family: monospace;
  font-size: 11px;
  color: var(--text-mute);
  word-break: break-all;
  opacity: 0.7;
}
.player-card.script .card-body a {
  display: inline-block;
  color: var(--amber-bright);
  text-decoration: none;
  font-family: var(--display);
  font-size: 14px;
  padding: 6px 12px;
  border: 1px solid var(--amber);
  border-radius: 4px;
  margin-bottom: 4px;
}
.player-card.script .card-body a:hover {
  background: rgba(255, 196, 102, 0.15);
}

/* =====================================================================
   v2.4: 多版图 / 事件 / 图片叠加 / NPC 音频
   ===================================================================== */

/* ---- 问号事件卡 ---- */
.pad-event-card {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 14px;
  background: linear-gradient(135deg, #9b59b6 0%, #6c5ce7 100%);
  border: 2px solid #a29bfe;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(155, 89, 182, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 5;
  overflow: hidden;
  text-align: center;
  padding: 4px;
  user-select: none;
}
.pad-event-card:hover {
  box-shadow: 0 6px 18px rgba(155, 89, 182, 0.6);
  z-index: 6;
}
.pad-event-card.clickable {
  cursor: pointer;
  animation: event-pulse 2.5s ease-in-out infinite;
}
.pad-event-card:not(.clickable) {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
@keyframes event-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(155, 89, 182, 0.4); }
  50% { box-shadow: 0 4px 22px rgba(162, 155, 254, 0.7); }
}
.pad-event-icon {
  font-size: 32px;
  font-weight: bold;
  line-height: 1;
  font-family: var(--display, serif);
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.pad-event-title {
  font-size: 10px;
  margin-top: 2px;
  font-weight: 600;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 图片叠加 (装饰) ---- */
.pad-image-overlay {
  position: absolute;
  width: 200px;
  height: 200px;
  z-index: 4;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pad-image-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
  cursor: zoom-in;
}

/* ---- 多版图管理 ---- */
.host-section-maps .host-maps-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.host-map-card {
  background: var(--card-2);
  border: 1px solid var(--border, #3a2a1c);
  border-radius: 6px;
  padding: 8px 10px;
  transition: border-color 0.15s, background 0.15s;
}
.host-map-card.active {
  border-color: var(--amber);
  background: linear-gradient(135deg, rgba(255, 196, 102, 0.08) 0%, rgba(255, 196, 102, 0.02) 100%);
  box-shadow: 0 0 0 1px var(--amber) inset;
}
.host-map-card-name {
  font-weight: 600;
  color: var(--amber-bright, #ffd47a);
  font-size: 14px;
  margin-bottom: 4px;
  word-break: break-all;
}
.host-map-card-meta {
  font-size: 11px;
  color: var(--muted, #a08070);
  margin-bottom: 6px;
}
.host-map-card-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.mini-btn {
  background: var(--card);
  border: 1px solid var(--border, #3a2a1c);
  color: var(--text, #e0c5a0);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--sans, sans-serif);
  transition: background 0.12s, border-color 0.12s;
}
.mini-btn:hover {
  background: var(--card-2);
  border-color: var(--amber);
}
.mini-btn.mini-btn-danger:hover {
  background: #5a2a1c;
  border-color: #e74c3c;
  color: #fff;
}
.mini-btn-primary {
  background: var(--amber);
  color: #1a1410;
  border-color: var(--amber);
  font-weight: 600;
}
.mini-btn-primary:hover {
  background: var(--amber-bright, #ffd47a);
}

/* ---- 玩家版图徽章 ---- */
.player-map-badge {
  display: inline-block;
  background: rgba(255, 196, 102, 0.15);
  color: var(--amber-bright, #ffd47a);
  border: 1px solid var(--amber);
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 8px;
  margin-left: 8px;
  font-weight: 500;
  font-family: var(--sans, sans-serif);
}

/* ---- 事件高亮效果信息 ---- */
.ph-effects {
  margin-top: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.2) 0%, rgba(108, 92, 231, 0.2) 100%);
  border: 1px solid #9b59b6;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* ---- 事件配置/版图选择器/移动玩家 ---- */
.host-row.host-row-event-only {
  background: rgba(155, 89, 182, 0.05);
  border-left: 2px solid #9b59b6;
  padding-left: 8px;
  margin-top: 4px;
}
.host-row-event-only .host-label {
  font-size: 12px;
  color: var(--muted, #a08070);
}
.host-input-num {
  width: 70px;
  background: var(--card);
  color: var(--text, #e0c5a0);
  border: 1px solid var(--border, #3a2a1c);
  border-radius: 4px;
  padding: 4px 6px;
  font-family: var(--sans, sans-serif);
  font-size: 13px;
}

/* ---- 事件高亮弹窗(v2.4) ---- */
.event-highlight {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  animation: fade-in 0.2s ease;
}
.event-highlight-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}
.event-highlight-card {
  position: relative;
  background: var(--card-2, #34281f);
  border: 2px solid #9b59b6;
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  color: #fff;
  box-shadow: 0 8px 32px rgba(155, 89, 182, 0.5);
}
.event-highlight-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px;
}
.event-highlight-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 12px;
  color: #a29bfe;
  font-family: var(--display, serif);
}
.event-highlight-body {
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #e0c5a0;
}
.event-highlight-effects {
  margin-top: 16px;
  padding: 10px;
  background: rgba(155, 89, 182, 0.2);
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
}
.event-highlight-meta {
  margin-top: 12px;
  font-size: 12px;
  color: #a08070;
  text-align: right;
}

/* ---- NPC 头像占位符 ---- */
.pad-npc-initial {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber) 0%, #d35400 100%);
  border: 3px solid var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: #1a1410;
  text-transform: uppercase;
}

/* 版图项选中态 */
.host-map-preview-item.selected {
  outline: 2px solid var(--amber-bright);
  outline-offset: 2px;
  z-index: 10;
}
.host-map-npc {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: auto;
  cursor: grab;
  z-index: 7;
  user-select: none;
}
.host-map-npc:active { cursor: grabbing; }
.host-map-npc-img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--purple);
  background: var(--card);
}
.host-map-npc-initial {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple) 0%, #6a4c93 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--display);
  border: 2px solid var(--purple);
}
.host-map-npc-name {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text);
  background: rgba(0,0,0,0.6);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* v2.4.28: 主持人端版图上显示玩家棋子(只读) */
.host-map-preview-pieces { position: absolute; inset: 0; pointer-events: none; }
.host-map-piece {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: default;
  z-index: 8;
  user-select: none;
}
.host-map-piece-readonly {
  /* 主持人端只读,不允许拖动 */
  pointer-events: auto;
  cursor: help;
  opacity: 0.95;
}
.host-map-piece-img {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  background: var(--card);
}
.host-map-piece-initial {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--display);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.host-map-piece-initial:has(+ .host-map-piece-label) { /* noop */ }
.host-map-piece-label {
  font-family: var(--sans);
  font-size: 11px;
  color: #fff;
  background: rgba(0,0,0,0.65);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* v2.4.29: pad/host 端版图视频叠加(play inline,自动循环) */
.pad-video-overlay,
.host-map-preview-item.video {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 5;
}
.pad-video-overlay video {
  max-width: 240px;
  max-height: 240px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  background: #000;
  display: block;
}
.pad-video-overlay video.clickable,
.host-map-preview-item.video video.clickable {
  cursor: pointer;
  transition: transform 0.15s;
}
.pad-video-overlay video.clickable:hover {
  transform: scale(1.04);
}
/* 视频在版图上的装饰性背景提示 */
.host-map-preview-item.video::after {
  content: '🎬';
  position: absolute;
  top: -8px;
  right: -8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
}
.host-scale-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
}
.host-scale-panel input[type="range"] { flex: 1; }

/* 主持人 4-tab 网格 (v2.4.18: 从 6 tab 缩到 4 tab) */
.host-tabs-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ========== v2.4.18: 新增组件样式 ========== */

/* 地图标记(箭头) - 用于 hostMapPreview + pad 端 */
.pad-map-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
.pad-map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.pad-map-marker-pulse {
  position: absolute;
  inset: 0;
  border: 4px solid currentColor;
  border-radius: 50%;
  opacity: 0.6;
  animation: pad-marker-pulse 1.4s ease-out infinite;
}
@keyframes pad-marker-pulse {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.pad-map-marker-arrow {
  font-size: 48px;
  text-shadow: 0 0 12px currentColor, 0 2px 4px rgba(0,0,0,0.6);
  animation: pad-marker-bounce 0.8s ease-in-out infinite alternate;
  z-index: 1;
}
@keyframes pad-marker-bounce {
  0% { transform: translateY(-6px); }
  100% { transform: translateY(6px); }
}

/* NPC 对话弹窗 (Pad 端大屏) */
.pad-npc-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.pad-npc-dialog-card {
  background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1e 100%);
  border: 2px solid #5d3a8e;
  border-radius: 12px;
  padding: 22px 28px;
  max-width: 80vw;
  max-height: 80vh;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.7);
}
.pad-npc-dialog-header {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
}
.pad-npc-dialog-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.pad-npc-dialog-name {
  font-size: 20px;
  font-weight: 700;
  color: #f1c40f;
  flex: 1;
}
.pad-npc-dialog-close {
  background: #5d3a8e;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 16px;
}
.pad-npc-dialog-close:hover { background: #7a4eb3; }
.pad-npc-dialog-title {
  font-size: 16px;
  color: #ccc;
  font-style: italic;
}
.pad-npc-dialog-body {
  font-size: 18px;
  color: #fff;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 40vh;
  overflow-y: auto;
}
.pad-npc-dialog-image {
  max-width: 100%;
  max-height: 50vh;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}
.pad-npc-dialog-audio { width: 100%; }
.pad-npc-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-top: 1px solid #333;
  padding-top: 12px;
}
.pad-npc-dialog-nav {
  background: #5d3a8e;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 14px;
}
.pad-npc-dialog-nav:hover { background: #7a4eb3; }
.pad-npc-dialog-counter {
  color: #aaa;
  font-size: 14px;
  font-family: monospace;
}
/* v2.4.21: NPC 对话点击切换提示 */
.pad-npc-dialog-hint {
  text-align: center;
  font-size: 12px;
  color: #bdc3c7;
  margin-top: 12px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  animation: hint-fade 2s ease-in-out infinite;
}
@keyframes hint-fade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.pad-npc-dialog-card { cursor: pointer; }

/* v2.4.24: 玩家端 NPC 对话流(展示在地图下方,galgame 风格) */
/* v2.4.26: 加 section 标识,让用户清楚这是 NPC 对话区 */
.player-npc-dialog {
  display: block;
  margin: 8px 12px 12px;
  padding: 0;
  /* 注意:不能用 position: fixed,否则会覆盖整个屏幕 */
}
.player-npc-dialog-label {
  font-size: 12px;
  font-weight: 700;
  color: #6c5ce7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  padding-left: 4px;
}
.player-npc-dialog-card {
  background: linear-gradient(135deg, #1f1033 0%, #2a164d 100%);
  color: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border: 2px solid #6c5ce7;
  cursor: pointer;
}
.player-npc-dialog-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.player-npc-dialog-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #6c5ce7;
}
.player-npc-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.player-npc-dialog-info {
  flex: 1;
  min-width: 0;
}
.player-npc-dialog-name {
  font-size: 16px;
  font-weight: 700;
  color: #f1c40f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-npc-dialog-close {
  background: transparent;
  border: 1px solid #555;
  color: #aaa;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  flex-shrink: 0;
}
.player-npc-dialog-close:hover { color: #fff; border-color: #fff; }
.player-npc-dialog-title {
  font-size: 13px;
  color: #bdc3c7;
  margin-top: 2px;
  border-left: 2px solid #6c5ce7;
  padding-left: 6px;
  font-style: italic;
}
.player-npc-dialog-body-wrap {
  margin: 8px 0;
}
.player-npc-dialog-body {
  font-size: 15px;
  line-height: 1.6;
  color: #fff;
  white-space: pre-wrap;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
}
.player-npc-dialog-image {
  max-width: 100%;
  max-height: 30vh;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
}
.player-npc-dialog-audio, .player-npc-dialog-video {
  width: 100%;
  margin: 4px 0;
  border-radius: 6px;
}
.player-npc-dialog-counter {
  text-align: right;
  color: #aaa;
  font-size: 12px;
  font-family: monospace;
  margin-top: 4px;
}
.player-npc-dialog-hint {
  text-align: center;
  font-size: 11px;
  color: #bdc3c7;
  margin-top: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  animation: hint-fade 2s ease-in-out infinite;
}
@keyframes hint-fade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* 全局剧本浮窗按钮(右下角圆形浮动) */
.host-script-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5d3a8e, #2c3e95);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.3);
  font-size: 24px;
  cursor: pointer;
  z-index: 150;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  transition: transform 0.2s, box-shadow 0.2s;
}
.host-script-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.host-script-floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: min(640px, 92vw);
  height: min(70vh, 600px);
  background: var(--bg-1, #1a1a2e);
  border: 2px solid #5d3a8e;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  z-index: 160;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.host-script-floating-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(135deg, #5d3a8e, #2c3e95);
  color: #fff;
  font-weight: 700;
}
.host-script-floating-header button {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}
.host-script-floating-header button:hover { background: rgba(255,255,255,0.3); }
.host-script-viewer-floating {
  flex: 1;
  overflow: auto;
  padding: 12px;
}
.host-script-viewer-floating .host-script-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
}

/* v2.4.19: 选点模式按钮高亮 + 版图预览光标 */
[data-pick-mode].active-pick {
  background: #e67e22 !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.4) !important;
}
.pick-mode-active {
  cursor: crosshair !important;
  outline: 3px dashed rgba(230, 126, 34, 0.6) !important;
  outline-offset: -3px;
}
.host-pick-hint {
  font-size: 13px;
  margin-left: 8px;
}
.host-chat-log,
.player-chat-log {
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
}
.host-msg,
.player-msg {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.host-hp-target {
  display: inline-block;
  min-width: 80px;
  font-weight: bold;
}

/* 玩家所在版图标签(主持人端 + 玩家端) */
.player-map-badge {
  display: inline-block;
  background: rgba(93, 58, 142, 0.18);
  color: #b48cd9;
  border: 1px solid rgba(93, 58, 142, 0.4);
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* =====================================================================
   v2.4.33 移动端响应式 + 空状态 + 分享目标下拉框
   ===================================================================== */

/* 空状态 - 没有玩家在线时显示 */
.host-empty-rows {
  padding: 18px;
  text-align: center;
  color: var(--text-mute, #888);
  font-size: 14px;
  background: var(--card-2, #1a1410);
  border: 1px dashed var(--line, #333);
  border-radius: 8px;
  margin: 10px 0;
}

/* 玩家分享 - 目标下拉框 */
.bag-trade-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.bag-trade-target {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg-2, #1a1410);
  color: var(--text, #e8d5a3);
  border: 1px solid var(--line, #444);
  border-radius: 4px;
  font-family: var(--sans, sans-serif);
  min-width: 0;
}
.bag-trade-target:focus {
  outline: none;
  border-color: var(--amber, #d4a574);
}
.bag-no-target {
  font-size: 11px;
  color: var(--text-mute, #888);
  font-style: italic;
  padding: 4px 0;
}

/* v2.4.34: 物品交易网格(下拉 + 金币 + 3个按钮) */
.bag-trade-grid {
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 4px;
  margin-top: 4px;
}
.bag-trade-grid .bag-trade-target {
  grid-column: 1;
  grid-row: 1;
}
.bag-trade-grid .bag-trade-gold {
  grid-column: 2;
  grid-row: 1;
}
.bag-trade-grid .mini-trade {
  font-size: 11px;
  padding: 4px 6px;
}
.bag-trade-grid .mini-trade:nth-of-type(1) { grid-column: 1; grid-row: 2; }
.bag-trade-grid .mini-trade:nth-of-type(2) { grid-column: 1; grid-row: 3; }
.bag-trade-grid .mini-trade:nth-of-type(3) { grid-column: 2; grid-row: 2; }
.bag-trade-grid .mini-trade:nth-of-type(4) { grid-column: 2; grid-row: 3; }
.bag-trade-gold {
  padding: 4px 6px;
  font-size: 11px;
  background: var(--bg-2, #1a1410);
  color: var(--text, #e8d5a3);
  border: 1px solid var(--line, #444);
  border-radius: 4px;
  min-width: 0;
}

/* v2.4.34: 玩家赠金币面板 */
.player-gold-panel {
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed var(--amber, #d4a574);
  border-radius: 6px;
  background: rgba(212, 165, 116, 0.06);
}
.player-gold-panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.player-gold-label {
  font-size: 13px;
  flex: 1 0 100%;
  margin-bottom: 4px;
}
.player-gold-panel-row .bag-trade-target,
.player-gold-panel-row .bag-trade-gold {
  flex: 1 1 100px;
  min-width: 0;
}
.player-gold-panel-row .mini-trade {
  flex: 0 0 auto;
}
.player-gold-panel-empty {
  font-size: 12px;
  color: var(--text-mute, #888);
  font-style: italic;
}

/* v2.4.34: 查看副本(只读) */
.player-viewed-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #444);
}
.player-bag-item.viewed-clue {
  border-left: 3px solid #9b59b6;
  background: rgba(155, 89, 182, 0.05);
}
.player-bag-item.viewed-clue .bag-from {
  color: #bb8fce;
}

/* v2.4.35: 物换物选择对话框 */
.swap-picker-list {
  max-height: 60vh;
  overflow-y: auto;
  margin: 12px 0;
}
.player-bag-item.mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  margin-bottom: 4px;
}
.player-bag-item.mini .bag-title {
  flex: 1;
  font-size: 12px;
}
.player-bag-item.mini button {
  font-size: 11px;
  padding: 3px 8px;
}

/* v2.4.35: 物品 vs 线索的视觉区分 */
.player-bag-item.bag-item {
  border-left: 3px solid #d4a574;  /* 物品:金色 */
}
.player-bag-item.bag-clue {
  border-left: 3px solid #5dade2;  /* 线索:蓝色 */
}

/* v2.4.35: 物品 / 线索交易网格差异 */
.bag-trade-grid.bag-trade-item {
  grid-template-columns: 1fr 70px;
}
.bag-trade-grid.bag-trade-item .bag-trade-target { grid-column: 1; grid-row: 1; }
.bag-trade-grid.bag-trade-item .bag-trade-gold { grid-column: 2; grid-row: 1; }
.bag-trade-grid.bag-trade-item .mini-trade:nth-of-type(1) { grid-column: 1; grid-row: 2; }
.bag-trade-grid.bag-trade-item .mini-trade:nth-of-type(2) { grid-column: 1; grid-row: 3; }
.bag-trade-grid.bag-trade-item .mini-trade:nth-of-type(3) { grid-column: 2; grid-row: 2; }
.bag-trade-grid.bag-trade-item .mini-trade:nth-of-type(4) { grid-column: 2; grid-row: 3; }
.bag-trade-grid.bag-trade-clue {
  grid-template-columns: 1fr;
}
.bag-trade-grid.bag-trade-clue .bag-trade-target { grid-column: 1; grid-row: 1; }
.bag-trade-grid.bag-trade-clue .mini-trade:nth-of-type(1) { grid-column: 1; grid-row: 2; }
.bag-trade-grid.bag-trade-clue .mini-trade:nth-of-type(2) { grid-column: 1; grid-row: 3; }

/* ---------------------------------------------------------------------
   v2.4.33 移动端响应式(< 720px)
   --------------------------------------------------------------------- */
@media (max-width: 720px) {
  /* 主持人端每行 - 允许换行 */
  .host-row,
  .host-hp-row,
  .host-row-end,
  .host-row.host-clue-target-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  /* 输入框在手机端自适应宽度 */
  .host-input,
  .host-input-num,
  .host-input-sm {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 14px;     /* 防止 iOS 自动放大 */
  }
  .host-input[type="text"],
  .host-input[type="number"] {
    width: 100%;
    box-sizing: border-box;
  }
  /* select 在手机端最小可点尺寸 */
  select.host-input,
  select.bag-trade-target,
  select.bag-share-target {
    min-height: 38px;
    padding: 6px 10px;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #d4a574 50%),
                      linear-gradient(135deg, #d4a574 50%, transparent 50%);
    background-position: calc(100% - 14px) center, calc(100% - 9px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 28px;
  }
  /* v2.4.34: 移动端交易按钮更大更易点 */
  .bag-trade-grid .mini-trade {
    min-height: 36px;
    font-size: 12px;
  }
  .player-gold-panel-row .mini-trade {
    min-height: 38px;
    font-size: 13px;
  }
  /* 玩家 HP/MP/SAN 行 - 在手机端堆叠 */
  .host-hp-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "target target target"
      "select select select"
      "display delta btn"
      "btn2 . .";
    align-items: center;
    gap: 6px;
  }
  .host-hp-row .host-hp-target { grid-area: target; }
  .host-hp-row select { grid-area: select; }
  .host-hp-row .host-hp-display { grid-area: display; }
  .host-hp-row input { grid-area: delta; }
  .host-hp-row button:nth-of-type(1) { grid-area: btn; }
  .host-hp-row button:nth-of-type(2) { grid-area: btn2; }
  /* 起始属性 - 在手机端单列 */
  .host-row:has(#hostP1InitHp),
  #hostInitPropsList {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  #hostInitPropsList > [data-pid] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  #hostInitPropsList > [data-pid] .host-hp-target {
    grid-column: 1 / -1;
  }
  #hostInitPropsList > [data-pid] .host-btn {
    grid-column: 1 / -1;
  }
  /* 金币调整 - 在手机端单列 */
  #hostGoldList > [data-pid] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  #hostGoldList > [data-pid] .host-hp-target {
    grid-column: 1 / -1;
  }
  #hostGoldList > [data-pid] .host-gold-current {
    grid-column: 1 / -1;
    text-align: center;
    font-weight: bold;
  }
  #hostGoldList > [data-pid] .host-gold-custom {
    grid-column: 1 / -1;
  }
  #hostGoldList > [data-pid] .host-btn-primary {
    grid-column: 1 / -1;
  }
  /* 已收列表 - 2 列变 1 列 */
  .host-dual-list-6 {
    grid-template-columns: 1fr !important;
  }
  /* 玩家跟随勾选 - 单列 */
  #hostFollowList {
    flex-direction: column;
    align-items: flex-start;
  }
  /* 出生点选点按钮 - 2 列 */
  #hostStartPickList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  /* 首页角色按钮 - 2 列 */
  .role-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  /* 首页 home-actions */
  .home-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .home-qr-btn {
    width: 100%;
  }
  /* 扫码弹窗 - 在手机端全屏 */
  .join-qr-modal {
    padding: 10px;
    align-items: flex-start;
    padding-top: 20px;
  }
  .join-qr-content {
    max-width: 100%;
    padding: 16px 14px 14px;
  }
  .join-qr-img {
    width: 180px;
    height: 180px;
  }
  .join-qr-title {
    font-size: 18px;
  }
  .join-qr-hint {
    font-size: 12px;
  }
  .join-qr-url {
    font-size: 11px;
  }
  .join-qr-copy {
    padding: 6px 10px;
  }
  /* 玩家端背包 - 在手机端单列 */
  .player-bag-list {
    grid-template-columns: 1fr !important;
  }
  .player-bag-item {
    padding: 8px;
  }
  /* 主持人 tab 标题 */
  .host-section-title {
    font-size: 14px;
  }
  /* 主持人端 container 减少内边距 */
  .host-section {
    padding: 8px;
  }
  .host-tabs {
    flex-wrap: wrap;
  }
  .host-tab-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 8px;
    font-size: 12px;
  }
  /* pad 视图 */
  .pad-piece {
    width: 36px !important;
    height: 36px !important;
    font-size: 11px !important;
  }
  .pad-turn-bar {
    flex-wrap: wrap;
  }
  .pad-btn-turn {
    flex: 1 1 30%;
    min-width: 0;
    font-size: 11px;
    padding: 4px 6px;
  }
  /* 整体字体 */
  body {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .role-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .host-hp-row {
    grid-template-areas:
      "target target"
      "select display"
      "delta delta"
      "btn btn2";
  }
  .host-hp-row input { grid-area: delta; }
  /* 玩家视图 */
  .player-tabs {
    flex-wrap: wrap;
  }
}

/* ---------------------------------------------------------------------
   v2.4.33 通用 - 修复下拉框溢出
   --------------------------------------------------------------------- */
.host-row select,
.host-hp-row select,
select.host-input,
select.bag-trade-target {
  min-width: 0;
  max-width: 100%;
}

/* 修复 host-row 在窄屏下溢出 */
.host-row,
.host-hp-row {
  min-width: 0;
  overflow-x: auto;
}

/* 修复 .host-row 内 label + input 不换行问题 */
.host-row label.host-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.host-row .host-input-num {
  max-width: 90px;
}

/* v2.4.33: 玩家端分享选择 - 全宽(在手机端) */
.bag-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.bag-actions .mini-del {
  flex-shrink: 0;
}

/* v2.4.33: 扫码弹窗 - 手动输入 IP 兑底 */
.join-qr-fallback {
  margin-top: 12px;
  background: var(--bg-2, #1a1410);
  border: 1px solid var(--line, #444);
  border-radius: 8px;
  padding: 8px 10px;
}
.join-qr-fallback summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--amber-bright, #f0c8a0);
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.join-qr-fallback summary::-webkit-details-marker { display: none; }
.join-qr-fallback summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.2s;
}
.join-qr-fallback[open] summary::before {
  transform: rotate(90deg);
}
.join-qr-fallback-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line, #444);
}
.join-qr-manual-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.join-qr-manual-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg, #0e0a08);
  border: 1px solid var(--line, #444);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: monospace;
}
.join-qr-manual-item code {
  flex: 1;
  font-size: 12px;
  color: var(--amber-bright, #f0c8a0);
  user-select: all;
  word-break: break-all;
}
.join-qr-copy-mini {
  background: var(--amber, #d4a574);
  color: #1a1410;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--sans, sans-serif);
  flex-shrink: 0;
}
.join-qr-copy-mini:hover { background: var(--amber-bright, #f0c8a0); }

/* v2.4.34: 主持人端 - 离线玩家半透明(用于发送目标的 checkbox) */
.host-checkbox.host-offline {
  opacity: 0.4;
  filter: grayscale(0.7);
}
.host-checkbox.host-offline input[type="checkbox"] {
  cursor: not-allowed;
}

/* =====================================================================
   v2.4.32 新增样式
   - 6 玩家配色(对应 PLAYER_COLORS)
   - 6 玩家回合高亮(turn-p1 ~ turn-p6)
   - 6 玩家棋子(在版图上的 piece 颜色)
   - 6 列布局(host-dual-list-6 等)
   - 首页扫码加入弹窗(join-qr-modal)
   - 首页 home-actions / home-qr-btn
   ===================================================================== */

/* ---------- 6 玩家棋子配色(版图上) ---------- */
.piece-p1 { background: #e74c3c; border-color: #c0392b; }
.piece-p2 { background: #3498db; border-color: #2980b9; }
.piece-p3 { background: #2ecc71; border-color: #27ae60; }
.piece-p4 { background: #f39c12; border-color: #d35400; }
.piece-p5 { background: #9b59b6; border-color: #8e44ad; }
.piece-p6 { background: #e67e22; border-color: #d35400; }

/* ---------- 6 玩家回合高亮(pad 顶部回合条) ---------- */
.pad-btn-turn.turn-p3 {
  border-color: #4ec47a;
  background: linear-gradient(135deg, rgba(78, 196, 122, 0.15) 0%, var(--card-2) 100%);
}
.pad-btn-turn.turn-p3 .pad-turn-current { color: #4ec47a; }
.pad-btn-turn.turn-p4 {
  border-color: #f5b041;
  background: linear-gradient(135deg, rgba(245, 176, 65, 0.15) 0%, var(--card-2) 100%);
}
.pad-btn-turn.turn-p4 .pad-turn-current { color: #f5b041; }
.pad-btn-turn.turn-p5 {
  border-color: #b07cc6;
  background: linear-gradient(135deg, rgba(176, 124, 198, 0.15) 0%, var(--card-2) 100%);
}
.pad-btn-turn.turn-p5 .pad-turn-current { color: #b07cc6; }
.pad-btn-turn.turn-p6 {
  border-color: #e67e22;
  background: linear-gradient(135deg, rgba(230, 126, 34, 0.15) 0%, var(--card-2) 100%);
}
.pad-btn-turn.turn-p6 .pad-turn-current { color: #e67e22; }

/* ---------- 6 玩家棋子: 走中(active)与未走(not) ---------- */
.pad-piece.active-turn {
  box-shadow: 0 0 0 4px rgba(255, 235, 130, 0.6), 0 0 20px rgba(255, 235, 130, 0.4);
  z-index: 10;
  animation: turn-pulse 1.6s ease-in-out infinite;
}
.pad-piece.not-your-turn {
  opacity: 0.65;
  filter: saturate(0.6);
}
@keyframes turn-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* ---------- 6 玩家(角色选择按钮)状态色边框 ---------- */
.role-btn[data-role="p1"]:not(.taken) { border-left: 4px solid #e74c3c; }
.role-btn[data-role="p2"]:not(.taken) { border-left: 4px solid #3498db; }
.role-btn[data-role="p3"]:not(.taken) { border-left: 4px solid #2ecc71; }
.role-btn[data-role="p4"]:not(.taken) { border-left: 4px solid #f39c12; }
.role-btn[data-role="p5"]:not(.taken) { border-left: 4px solid #9b59b6; }
.role-btn[data-role="p6"]:not(.taken) { border-left: 4px solid #e67e22; }

/* ---------- 6 玩家聊天来源徽章 ---------- */
.chat-from-p1 { color: #ff8a8a; }
.chat-from-p2 { color: #8ab4ff; }
.chat-from-p3 { color: #4ec47a; }
.chat-from-p4 { color: #f5b041; }
.chat-from-p5 { color: #b07cc6; }
.chat-from-p6 { color: #e67e22; }

/* ---------- 6 玩家行通用徽章(主持人面板上高亮某一玩家) ---------- */
.host-p1-accent { border-color: #e74c3c !important; }
.host-p2-accent { border-color: #3498db !important; }
.host-p3-accent { border-color: #2ecc71 !important; }
.host-p4-accent { border-color: #f39c12 !important; }
.host-p5-accent { border-color: #9b59b6 !important; }
.host-p6-accent { border-color: #e67e22 !important; }

/* ---------- 6 玩家初始属性卡片 6 列布局(可选) ---------- */
.host-init-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.host-init-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.host-init-card-p1 { border-top: 3px solid #e74c3c; }
.host-init-card-p2 { border-top: 3px solid #3498db; }
.host-init-card-p3 { border-top: 3px solid #2ecc71; }
.host-init-card-p4 { border-top: 3px solid #f39c12; }
.host-init-card-p5 { border-top: 3px solid #9b59b6; }
.host-init-card-p6 { border-top: 3px solid #e67e22; }

/* ---------- 6 列已收列表(主持人端 6 玩家收件箱) ---------- */
.host-received-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
@media (max-width: 720px) {
  .host-received-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .host-received-grid { grid-template-columns: 1fr; }
}
.host-received-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.host-received-card-p1 { border-left: 3px solid #e74c3c; }
.host-received-card-p2 { border-left: 3px solid #3498db; }
.host-received-card-p3 { border-left: 3px solid #2ecc71; }
.host-received-card-p4 { border-left: 3px solid #f39c12; }
.host-received-card-p5 { border-left: 3px solid #9b59b6; }
.host-received-card-p6 { border-left: 3px solid #e67e22; }
.host-received-card h3 {
  font-family: var(--display);
  font-size: 14px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.host-received-card ul { list-style: none; padding: 0; margin: 0; }
.host-received-card li {
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line-soft);
  color: var(--text-dim);
}

/* ---------- 首页底部 home-actions + 扫码按钮 ---------- */
.home-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.home-qr-btn {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 12px 24px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(46, 204, 113, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.home-qr-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
}
.home-qr-btn:active { transform: translateY(0); }

/* ---------- 扫码加入弹窗 ---------- */
.join-qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: qr-fade-in 0.2s ease;
}
@keyframes qr-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.join-qr-content {
  background: var(--card);
  border: 1px solid var(--amber-deep);
  border-radius: 16px;
  padding: 24px 22px 22px;
  max-width: 420px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(212, 165, 116, 0.12);
  animation: qr-pop-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes qr-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.join-qr-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.join-qr-close:hover {
  color: var(--amber-bright);
  border-color: var(--amber);
}
.join-qr-title {
  font-family: var(--display);
  font-size: 22px;
  color: var(--amber-bright);
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: 0.05em;
}
.join-qr-hint {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.5;
}
.join-qr-img-wrap {
  display: flex;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--amber-deep);
  box-shadow: 0 0 24px rgba(212, 165, 116, 0.18);
}
.join-qr-img {
  display: block;
  width: 240px;
  height: 240px;
  max-width: 100%;
}
.join-qr-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  font-family: var(--sans);
}
.join-qr-url-label {
  font-size: 12px;
  color: var(--text-mute);
  flex-shrink: 0;
}
.join-qr-url {
  flex: 1;
  font-size: 12px;
  color: var(--amber-bright);
  word-break: break-all;
  font-family: monospace;
  user-select: text;
  background: transparent;
  border: none;
  padding: 0;
}
.join-qr-copy {
  background: var(--amber);
  color: #1a1410;
  border: 1px solid var(--amber-bright);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  font-family: var(--sans);
}
.join-qr-copy:hover { background: var(--amber-bright); }
.join-qr-copy.copied { background: var(--green); color: #fff; border-color: var(--green); }
.join-qr-foot {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
  margin: 0;
}
@media (max-width: 480px) {
  .join-qr-content { padding: 18px 16px 16px; }
  .join-qr-img { width: 200px; height: 200px; }
  .join-qr-title { font-size: 18px; }
}

/* ---------- 主持人端:6 玩家同时高亮(批量) ---------- */
.host-batch-accent {
  background: linear-gradient(90deg, rgba(212, 165, 116, 0.06), transparent);
}

/* =====================================================================
   v2.4.45: NPC AI 对话 - Galgame 风格全屏对话框(手机端)
   ===================================================================== */
.galgame-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  background: #000;
  display: flex;
  flex-direction: column;
  font-family: "Crimson Pro", "PingFang SC", "Microsoft YaHei", sans-serif;
  animation: galgame-fade-in 0.3s ease;
}
@keyframes galgame-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.galgame-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #1a1410;
  background-image: linear-gradient(135deg, #1a1410 0%, #2a1640 50%, #1a1410 100%);
  filter: brightness(0.55) saturate(0.85);
  z-index: 1;
}
.galgame-char {
  position: absolute;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 80vw;
  max-width: 420px;
  max-height: 55vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  animation: galgame-char-in 0.4s ease;
}
@keyframes galgame-char-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.galgame-char img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.7));
}
.galgame-char-placeholder {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 32px rgba(108, 92, 231, 0.5);
}
.galgame-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s;
}
.galgame-close:hover { background: rgba(220, 53, 69, 0.75); }
.galgame-dialog-box {
  position: absolute;
  bottom: 64px;
  left: 12px;
  right: 12px;
  z-index: 5;
  background: linear-gradient(180deg, rgba(20, 14, 10, 0.92) 0%, rgba(34, 26, 20, 0.95) 100%);
  border: 1.5px solid rgba(212, 165, 116, 0.55);
  border-radius: 14px;
  padding: 14px 16px 16px;
  min-height: 120px;
  max-height: 45vh;
  overflow-y: auto;
  color: #f4e9d8;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.galgame-name-tag {
  display: inline-block;
  background: linear-gradient(135deg, #d4a574 0%, #b8864a 100%);
  color: #1a1410;
  font-weight: 700;
  font-size: 14px;
  padding: 3px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.galgame-text {
  font-size: 16px;
  line-height: 1.65;
  color: #f4e9d8;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.65em;
}
.galgame-text::after {
  content: '▼';
  display: inline-block;
  margin-left: 4px;
  color: #d4a574;
  font-size: 12px;
  animation: galgame-blink 1s infinite;
  opacity: 0;
}
.galgame-text.is-typing::after { opacity: 1; }
@keyframes galgame-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.galgame-thinking {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #d4a574;
  font-size: 14px;
  font-style: italic;
  padding: 4px 0;
}
.galgame-dots { margin-right: 2px; }
.galgame-dot {
  display: inline-block;
  animation: galgame-dot-bounce 1.2s infinite;
  font-weight: 700;
}
.galgame-dot:nth-child(2) { animation-delay: 0.2s; }
.galgame-dot:nth-child(3) { animation-delay: 0.4s; }
.galgame-dot:nth-child(4) { animation-delay: 0.6s; }
@keyframes galgame-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.galgame-input-area {
  position: absolute;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 14, 10, 0.92);
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 24px;
  padding: 6px 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.galgame-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #f4e9d8;
  font-size: 15px;
  padding: 8px 10px;
  font-family: inherit;
}
.galgame-input::placeholder { color: rgba(244, 233, 216, 0.4); }
.galgame-btn-send {
  background: linear-gradient(135deg, #d4a574 0%, #b8864a 100%);
  color: #1a1410;
  border: none;
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
}
.galgame-btn-send:active { transform: scale(0.96); }
.galgame-btn-send:disabled { opacity: 0.5; cursor: not-allowed; }
.galgame-btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(212, 165, 116, 0.18);
  color: #d4a574;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.galgame-btn-icon:hover { background: rgba(212, 165, 116, 0.32); }
.galgame-btn-icon:active { transform: scale(0.92); }
.galgame-btn-icon.is-active {
  background: #d4a574;
  color: #1a1410;
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.6);
}
.galgame-btn-icon.is-recording {
  background: #e74c3c;
  color: #fff;
  animation: galgame-rec-pulse 1s infinite;
}
@keyframes galgame-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}
.galgame-chat-log {
  position: absolute;
  top: max(48px, env(safe-area-inset-top));
  bottom: 64px;
  left: 0;
  right: 0;
  z-index: 8;
  background: rgba(10, 7, 5, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(212, 165, 116, 0.3);
  border-bottom: 1px solid rgba(212, 165, 116, 0.3);
}
.galgame-chat-log .log-item {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: #f4e9d8;
  word-break: break-word;
}
.galgame-chat-log .log-item.log-user {
  background: rgba(108, 92, 231, 0.18);
  border-left: 3px solid #6c5ce7;
  align-self: flex-end;
  max-width: 85%;
}
.galgame-chat-log .log-item.log-npc {
  background: rgba(212, 165, 116, 0.12);
  border-left: 3px solid #d4a574;
  align-self: flex-start;
  max-width: 85%;
}
.galgame-chat-log .log-item .log-name {
  font-size: 11px;
  font-weight: 700;
  color: #d4a574;
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.galgame-chat-log .log-item.log-user .log-name { color: #a29bfe; }
.galgame-chat-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #d4a574;
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
  margin-bottom: 4px;
  position: sticky;
  top: 0;
  background: rgba(10, 7, 5, 0.95);
  backdrop-filter: blur(6px);
  z-index: 1;
}
.galgame-chat-log-close {
  background: transparent;
  border: none;
  color: #d4a574;
  font-size: 16px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.galgame-chat-log-close:hover { background: rgba(212, 165, 116, 0.2); }
.galgame-chat-log-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =====================================================================
   v2.4.45: Pad 端 NPC AI 对话浮窗(右下角)
   ===================================================================== */
.pad-ai-chat-box {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 800;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 50vh;
  background: linear-gradient(180deg, rgba(26, 20, 16, 0.96) 0%, rgba(42, 33, 26, 0.96) 100%);
  border: 1.5px solid rgba(212, 165, 116, 0.5);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: pad-ai-slide-in 0.3s ease;
}
@keyframes pad-ai-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pad-ai-chat-box.is-collapsed { max-height: 42px; }
.pad-ai-chat-box.is-collapsed .pad-ai-chat-body { display: none; }
.pad-ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(212, 165, 116, 0.18), transparent);
  border-bottom: 1px solid rgba(212, 165, 116, 0.25);
  cursor: pointer;
  user-select: none;
}
.pad-ai-chat-header span {
  font-size: 13px;
  font-weight: 700;
  color: #d4a574;
  letter-spacing: 0.03em;
}
.pad-ai-chat-toggle {
  background: transparent;
  border: none;
  color: #d4a574;
  font-size: 16px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}
.pad-ai-chat-toggle:hover { background: rgba(212, 165, 116, 0.18); }
.pad-ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pad-ai-chat-empty {
  color: rgba(244, 233, 216, 0.4);
  font-size: 12px;
  text-align: center;
  padding: 16px 8px;
  font-style: italic;
}
.pad-ai-chat-msg {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #f4e9d8;
  word-break: break-word;
  animation: pad-ai-msg-in 0.25s ease;
}
@keyframes pad-ai-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pad-ai-chat-msg.msg-user {
  background: rgba(108, 92, 231, 0.18);
  border-left: 3px solid #6c5ce7;
}
.pad-ai-chat-msg.msg-npc {
  background: rgba(212, 165, 116, 0.12);
  border-left: 3px solid #d4a574;
}
.pad-ai-chat-msg .msg-meta {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 3px;
  letter-spacing: 0.03em;
  opacity: 0.85;
}
.pad-ai-chat-msg.msg-user .msg-meta { color: #a29bfe; }
.pad-ai-chat-msg.msg-npc .msg-meta { color: #d4a574; }

/* v2.4.45: NPC 编辑器 AI 配置区微调 */
#npcEditorClearChatBtn { margin-left: auto; }

/* =====================================================================
   v2.4.46: NPC 对话监控/干预面板(主持人)
   ===================================================================== */
.npc-monitor-card {
  max-width: 680px;
  max-height: 90vh;
}
.npc-monitor-body {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.npc-monitor-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid rgba(212, 165, 116, 0.2);
  padding-bottom: 8px;
}
.npc-monitor-tab {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  color: #7f8c8d;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
  transition: all 0.2s;
}
.npc-monitor-tab:hover { background: rgba(212, 165, 116, 0.1); }
.npc-monitor-tab.active {
  color: #d4a574;
  background: rgba(212, 165, 116, 0.15);
  border-bottom: 2px solid #d4a574;
  margin-bottom: -10px;
}
.npc-monitor-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
}
.npc-monitor-panel.active {
  display: flex;
}
.npc-monitor-chat-list {
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px;
}
.npc-monitor-empty {
  text-align: center;
  color: #999;
  padding: 24px;
  font-style: italic;
  font-size: 13px;
}
.npc-monitor-chat-group {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.npc-monitor-chat-group-head {
  font-size: 12px;
  font-weight: 700;
  color: #d4a574;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}
.npc-monitor-chat-item {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin: 4px 0;
  line-height: 1.5;
}
.npc-monitor-chat-item.msg-user {
  background: rgba(108, 92, 231, 0.1);
  border-left: 3px solid #6c5ce7;
}
.npc-monitor-chat-item.msg-npc {
  background: rgba(212, 165, 116, 0.08);
  border-left: 3px solid #d4a574;
}
.npc-monitor-chat-item .msg-meta {
  font-size: 10px;
  font-weight: 700;
  color: #888;
  display: block;
  margin-bottom: 2px;
}
.npc-monitor-chat-item.msg-user .msg-meta { color: #6c5ce7; }
.npc-monitor-chat-item.msg-npc .msg-meta { color: #d4a574; }
.npc-monitor-chat-item .msg-text {
  color: #2c3e50;
  word-break: break-word;
}

/* =====================================================================
   v2.4.48: NPC 内联卡片(主持人 NPC tab,无弹窗、无折叠)
   ===================================================================== */
.npc-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.npc-card + .npc-card { margin-top: 4px; }
.npc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.18), rgba(212, 165, 116, 0.06));
  border-bottom: 1px solid var(--line);
}
.npc-card-header .npc-mini-avatar,
.npc-card-header .npc-mini-initial {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.npc-card-name {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Cinzel', 'Crimson Pro', serif;
}
.npc-card-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.npc-card-section:last-child { border-bottom: none; }
.npc-card-section-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(212, 165, 116, 0.25);
}
.npc-card-section-title small.host-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 4px;
}
.npc-card-subtitle {
  margin: 8px 0 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 8px;
  background: rgba(212, 165, 116, 0.1);
  border-left: 3px solid var(--amber);
  border-radius: 0 4px 4px 0;
}
.npc-card-chat-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--line);
  border-radius: 6px;
}
/* 复用 npc-monitor-* 子元素样式(chat-group / chat-item / empty) */
.npc-card-chat-list .npc-monitor-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 18px;
  font-style: italic;
  font-size: 12px;
}
.npc-card-chat-list .npc-monitor-chat-group {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.npc-card-chat-list .npc-monitor-chat-group-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  padding: 2px 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}
.npc-card-chat-list .npc-monitor-chat-item {
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 12px;
  margin: 3px 0;
  line-height: 1.45;
}
.npc-card-chat-list .npc-monitor-chat-item.msg-user {
  background: rgba(108, 92, 231, 0.1);
  border-left: 3px solid #6c5ce7;
}
.npc-card-chat-list .npc-monitor-chat-item.msg-npc {
  background: rgba(212, 165, 116, 0.08);
  border-left: 3px solid var(--amber);
}
.npc-card-chat-list .npc-monitor-chat-item .msg-meta {
  font-size: 10px;
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}
.npc-card-chat-list .npc-monitor-chat-item.msg-user .msg-meta { color: #6c5ce7; }
.npc-card-chat-list .npc-monitor-chat-item.msg-npc .msg-meta { color: var(--amber); }
.npc-card-chat-list .npc-monitor-chat-item .msg-text {
  color: var(--text);
  word-break: break-word;
}
/* 卡片内 host-row 紧凑化 */
.npc-card .host-row {
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
}
.npc-card .host-label {
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
  min-width: 180px;
}
.npc-card .host-input,
.npc-card .host-input-num {
  font-size: 12px;
}
.npc-card .host-textarea {
  font-size: 12px;
  resize: vertical;
}

/* 小屏适配 */
@media (max-width: 480px) {
  .pad-ai-chat-box {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 72px;
    max-height: 45vh;
  }
  .npc-monitor-card { max-width: 95vw; }
  .npc-monitor-tabs { flex-wrap: wrap; }
}

/* ========== v2.4.47: NPC 商店 / 商品管理 / 头像双按钮 ========== */

/* 玩家端 galgame 商店面板 */
.galgeme-shop-wrap { position: relative; }
.galgame-shop {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 56px;
  max-height: 60vh;
  background: linear-gradient(180deg, #1f1033 0%, #2a164d 100%);
  border: 2px solid #6c5ce7;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
  color: #fff;
}
.galgame-shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(108, 92, 231, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 700;
}
.galgame-shop-close {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
}
.galgame-shop-close:hover { background: rgba(231, 76, 60, 0.6); }
.galgame-shop-refresh {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 13px;
  margin-right: 4px;
}
.galgame-shop-refresh:hover { background: rgba(108, 92, 231, 0.6); }
.galgame-shop-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.galgame-shop-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  padding: 24px 8px;
  font-size: 13px;
}
.galgame-shop-item {
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px;
  align-items: center;
}
.galgame-shop-item-img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}
.galgame-shop-item-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.galgame-shop-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.galgame-shop-item-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1c40f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.galgame-shop-item-body {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
  max-height: 32px;
  overflow: hidden;
}
.galgame-shop-item-price {
  font-size: 13px;
  color: #f1c40f;
  font-weight: 700;
  white-space: nowrap;
}
.galgame-shop-item-stock {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}
.galgame-shop-item-buy {
  background: #f1c40f;
  color: #1a1410;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
}
.galgame-shop-item-buy:hover { background: #f39c12; }
.galgame-shop-item-buy:active { transform: scale(0.94); }
.galgame-shop-item-buy:disabled {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}
.galgame-shop-footer {
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  text-align: right;
}
.galgame-shop-footer strong { color: #f1c40f; font-size: 15px; }

/* 主持人端 NPC 编辑器商品列表 */
.host-npc-shop-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.npc-shop-row {
  display: flex;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  align-items: center;
}
.npc-shop-row-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.npc-shop-row-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-dim);
}
.npc-shop-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.npc-shop-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.npc-shop-row-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
}
.npc-shop-row-meta .price { color: #d4a574; font-weight: 700; }
.npc-shop-row-del {
  background: rgba(231, 76, 60, 0.12);
  color: #e74c3c;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.npc-shop-row-del:hover { background: rgba(231, 76, 60, 0.25); }

/* 玩家头像双按钮(上传 + AI 生图) - 调整位置避免重叠 */
.char-avatar-upload {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 10px;
  padding: 0;
  background: var(--amber);
  color: var(--bg);
  border: 2px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
#charAvatarUploadBtn {
  bottom: -4px;
  right: -4px;
}
#charAvatarAiBtn {
  bottom: -4px;
  right: 22px;
  background: #6c5ce7;
  color: #fff;
}
#charAvatarAiBtn:hover { background: #5a4bd1; }

/* NPC 监控面板 - 控制玩家子面板额外样式 */
#npcMonitorControlPanel .host-section-title {
  font-size: 13px;
  margin: 4px 0 6px;
  color: var(--text);
}
#npcMonitorControlPanel hr {
  margin: 10px 0;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
#npcMonitorControlPanel .host-row {
  flex-wrap: wrap;
  gap: 8px;
}

/* 在版图上放内容 - NPC 快速放置入口 */
.host-place-npc-quick {
  background: rgba(108, 92, 231, 0.06);
  border: 1px dashed rgba(108, 92, 231, 0.4);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
}
.host-place-npc-quick .host-row {
  margin: 0 0 6px;
}
.host-place-npc-quick-title {
  font-size: 13px;
  font-weight: 700;
  color: #6c5ce7;
  margin-bottom: 6px;
}
