/* ═══════════════════════════════════════════
   H5 有轨电车聊天室 - 公共样式
   对齐小程序版玩法风格
   ═══════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }

/* ── 顶栏 ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #1d1d1f; color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .brand { font-size: 15px; font-weight: 600; letter-spacing: 2px; }
.topbar .brand .ico { margin-right: 6px; }
.topbar .nav-links { display: flex; gap: 4px; }
.topbar .nav-links a {
  color: rgba(255,255,255,0.7); font-size: 13px; padding: 6px 10px; border-radius: 16px;
  transition: all .2s;
}
.topbar .nav-links a:hover, .topbar .nav-links a.active { background: rgba(255,255,255,0.15); color:#fff; }
.topbar .nav-links a.active { font-weight:600; }

/* ── 容器 ── */
.page { max-width: 720px; margin: 0 auto; padding: 16px; padding-bottom: 40px; }
.card {
  background: #fff; border-radius: 12px; padding: 16px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.card-title .ico { margin-right: 5px; }
.card-gold { border-left: 3px solid #e8a850; }

/* ── 按钮 ── */
.btn {
  display: inline-block; padding: 9px 18px; border: none; border-radius: 8px;
  background: #1d1d1f; color: #fff; font-size: 14px; cursor: pointer;
  transition: opacity .2s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: #eaeaea; color: #1d1d1f; }
.btn-warn { background: #e8a850; color: #fff; }
.btn-danger { background: #e2434b; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-primary { background: #1d1d1f; color: #fff; }

/* ── 表单 ── */
.input {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 14px; outline: none; background: #fafafa;
}
.input:focus { border-color: #1d1d1f; background: #fff; }
.input-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.form-group { margin-bottom: 14px; }
.err { color: #e2434b; font-size: 12px; min-height: 16px; margin-top: 6px; }

/* ── 消息列表（聊天室） ── */
.chat-box { height: calc(100vh - 200px); overflow-y: auto; padding: 10px; }
.msg { margin-bottom: 10px; font-size: 14px; }
.msg .nm { font-weight: 600; font-size: 13px; margin-right: 8px; }
.msg .tm { font-size: 11px; color: #999; }
.msg .rb {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-left: 6px;
  background: rgba(136,136,136,0.12); color: #888; border: 1px solid rgba(136,136,136,0.25);
}
.msg .text { word-break: break-word; line-height: 1.5; margin-top: 2px; }
.msg.sys { text-align: center; font-size: 12px; color: #999; }
.msg.sys .text { background: #f0f0f0; display: inline-block; padding: 4px 12px; border-radius: 12px; }
.msg img.msg-img { max-width: 220px; border-radius: 8px; margin-top: 4px; cursor: pointer; }
.msg.me .text { color: #1d1d1f; }

/* ── 聊天输入 ── */
.chat-input {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
  border-top: 1px solid #eee; padding: 10px 16px; display: flex; gap: 8px;
  max-width: 720px; margin: 0 auto;
}
.chat-input input { flex: 1; padding: 9px 12px; border: 1px solid #ddd; border-radius: 20px; font-size: 14px; outline: none; }
.chat-input button { border-radius: 20px; }
.chat-input .tool-btn { background: transparent; border: none; font-size: 20px; cursor: pointer; padding: 0 4px; }

/* ── 房间列表 / 大厅 ── */
.room-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.room-card {
  background: #fff; border-radius: 12px; padding: 14px; display: block;
  border: 1px solid #eee; transition: all .2s; cursor: pointer;
}
.room-card:hover { border-color: #1d1d1f; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.room-card .rn { font-size: 15px; font-weight: 600; }
.room-card .rc { font-size: 12px; color: #999; margin: 4px 0; }
.room-card .ol {
  display: inline-block; font-size: 11px; color: #10a37f; background: rgba(16,163,127,0.1);
  padding: 2px 8px; border-radius: 10px;
}
.room-card.main { border-color: #1d1d1f; background: linear-gradient(135deg,#1d1d1f,#333); color:#fff; }
.room-card.main .rc, .room-card.main .ol { color: rgba(255,255,255,0.7); }

/* ── 广播跑马灯 ── */
.broadcast-bar {
  background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: #8a6d3b;
}
.broadcast-bar .bi { margin-right: 6px; }

/* ── 属性网格 ── */
.attr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.attr-item { background: #fafafa; border-radius: 8px; padding: 8px; text-align: center; }
.attr-item .attr-val { font-size: 16px; font-weight: 600; display: block; }
.attr-item .attr-label { font-size: 11px; color: #999; margin-top: 2px; }

/* ── 状态条 ── */
.stat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-label { font-size: 13px; width: 44px; }
.stat-bar-bg { flex: 1; height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.stat-bar-fill.hp { background: linear-gradient(90deg,#ff6b6b,#e2434b); }
.stat-bar-fill.mp { background: linear-gradient(90deg,#4ecdc4,#45b7d1); }
.stat-val { font-size: 12px; color: #666; width: 70px; text-align: right; }

/* ── 用户头 ── */
.user-header { display: flex; align-items: center; gap: 14px; }
.avatar-lg { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; flex-shrink: 0;
}
.rank-badge { font-size: 12px; color: #666; margin-top: 4px; }

/* ── 菜单 ── */
.menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; border-bottom: 1px solid #f2f2f2; cursor: pointer; font-size: 14px;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: #fafafa; }
.menu-item .arrow { color: #ccc; }
.menu-danger { color: #e2434b; }

/* ── 头像选择 ── */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-option { font-size: 28px; text-align: center; padding: 8px; border: 2px solid transparent; border-radius: 10px; cursor: pointer; }
.avatar-option.active { border-color: #1d1d1f; background: #f0f0f0; }

/* ── PK 结果 ── */
.pk-result { text-align: center; }
.pk-result .battle-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.pk-result .battle-summary { font-size: 14px; margin-bottom: 10px; }
.pk-result .battle-summary.win { color: #10a37f; }
.pk-result .battle-summary.lose { color: #e2434b; }
.pk-result .battle-detail { font-size: 13px; color: #666; line-height: 1.8; }

/* ── 武功卡片 ── */
.art-card { border: 1px solid #eee; border-radius: 10px; padding: 12px; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; }
.art-icon { font-size: 28px; }
.art-info { flex: 1; }
.art-name { font-size: 15px; font-weight: 600; }
.art-desc { font-size: 12px; color: #999; margin-top: 2px; }
.art-meta { font-size: 12px; color: #666; display: flex; flex-direction: column; gap: 2px; text-align: right; margin-right: 10px; }

/* ── 命运墙 ── */
.fate-post { border-bottom: 1px solid #f2f2f2; padding: 12px 0; }
.fate-post:last-child { border-bottom: none; }
.fate-content { font-size: 14px; line-height: 1.6; margin-bottom: 6px; }
.fate-meta { font-size: 12px; color: #999; }

/* ── 动作面板 ── */
.action-panel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.action-btn { padding: 8px 4px; border: 1px solid #eee; border-radius: 8px; text-align: center; font-size: 12px; cursor: pointer; background: #fff; }
.action-btn:hover { border-color: #1d1d1f; }

/* ── 登录页专用 ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#1d1d1f,#333); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px 28px; }
.login-logo { text-align: center; font-size: 48px; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 20px; font-weight: 600; letter-spacing: 4px; }
.login-sub { text-align: center; font-size: 12px; color: #999; margin-bottom: 24px; margin-top: 4px; }
.tab-row { display: flex; border-bottom: 1px solid #eee; margin-bottom: 20px; }
.tab { flex: 1; text-align: center; padding: 10px; cursor: pointer; color: #999; font-size: 14px; border-bottom: 2px solid transparent; }
.tab.active { color: #1d1d1f; border-bottom-color: #1d1d1f; font-weight: 600; }
.or-divider { text-align: center; color: #ccc; font-size: 12px; margin: 16px 0; }

/* ── 响应式 ── */
@media (max-width: 480px) {
  .room-grid { grid-template-columns: 1fr; }
  .topbar .nav-links { display: none; }
  .topbar .nav-links-mobile { display: flex; }
}
.topbar .nav-links-mobile { display: none; }

/* 底部导航（移动端） */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
  border-top: 1px solid #eee; display: none; justify-content: space-around; padding: 6px 0;
  z-index: 100; max-width: 720px; margin: 0 auto;
}
.bottom-nav a { text-align: center; font-size: 10px; color: #999; padding: 4px 2px; }
.bottom-nav a.active { color: #1d1d1f; }
.bottom-nav a .ni { font-size: 20px; display: block; }
@media (max-width: 480px) { .bottom-nav { display: flex; } .page { padding-bottom: 80px; } }

/* 在线徽章 */
.ol-badge { float: right; }
