/* 极简狼人杀 H5 - 公共样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 主题变量 */
.theme-night {
  --bg: #0F1923; --bg-2: #1A2632; --text: #E8E8E8; --text-2: #8A99A8;
  --border: #2A3845; --accent: #F1C40F;
}
.theme-day {
  --bg: #F5F0E6; --bg-2: #FFFFFF; --text: #2C2416; --text-2: #8B7E6A;
  --border: #E5DDD0; --accent: #F39C12;
}

#app { min-height: 100vh; padding: 16px 14px 24px; }

/* 顶栏 */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 12px;
}
.top-bar .title-wrap { display: flex; align-items: center; gap: 10px; }
.top-bar .phase-icon { width: 28px; height: 28px; flex-shrink: 0; }
.top-bar .phase-text { font-size: 18px; font-weight: 600; }
.top-bar .day-num { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 倒计时 */
.countdown {
  font-size: 40px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--accent); text-align: right;
}
.countdown .unit { font-size: 13px; color: var(--text-2); font-weight: 400; margin-left: 2px; }
.countdown.urgent { color: #E74C3C; animation: countdownPulse 1s ease-in-out infinite; }
.countdown-label { font-size: 11px; color: var(--text-2); text-align: right; margin-bottom: 2px; }
@keyframes countdownPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.7; }
}

/* 阶段提示 */
.phase-hint {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 10px; margin-bottom: 14px; font-size: 15px;
}
.phase-hint .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.5s ease-in-out infinite; flex-shrink: 0; }
.phase-hint .sub { color: var(--text-2); font-size: 12px; margin-left: auto; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 按钮 */
.btn { display: block; width: 100%; height: 48px; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-primary { background: linear-gradient(135deg, #C8323C 0%, #8B1F26 100%); color: #fff; }
.btn-seer { background: linear-gradient(135deg, #4A90E2 0%, #2C5F94 100%); color: #fff; }
.btn-witch-save { background: linear-gradient(135deg, #27AE60 0%, #1E8449 100%); color: #fff; }
.btn-witch-poison { background: linear-gradient(135deg, #9B6DBF 0%, #6C3F8F 100%); color: #fff; }
.btn-vote { background: linear-gradient(135deg, #F39C12 0%, #B9770E 100%); color: #fff; height: 52px; font-size: 17px; }
.btn-host { background: linear-gradient(135deg, #F1C40F 0%, #E67E22 100%); color: #2C2416; height: 52px; font-size: 16px; }
.btn-skip { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.btn-danger { background: linear-gradient(135deg, #E74C3C 0%, #922B21 100%); color: #fff; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn + .btn { margin-top: 10px; }

/* 玩家网格 */
.players-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.player-cell {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px 6px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: transform 0.2s, border-color 0.2s;
}
.player-cell.selectable { cursor: pointer; }
.player-cell.selectable:active { transform: scale(0.96); }
.player-cell.selected { border-color: #C8323C; box-shadow: 0 0 0 2px rgba(200,50,60,0.35); }
.player-cell.checked { border-color: #4A90E2; box-shadow: 0 0 0 2px rgba(74,144,226,0.35); }
.player-cell.voted { border-color: #F39C12; box-shadow: 0 0 0 2px rgba(243,156,18,0.35); }
.player-cell.self { border-color: #F1C40F; }
.player-cell.self .self-flag { position: absolute; top: -6px; right: -2px; background: #F1C40F; color: #2C2416; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 6px; }

.avatar-wrap { position: relative; width: 52px; height: 52px; }
.avatar-wrap svg { display: block; width: 100%; height: 100%; border-radius: 50%; }
.wolf-mark { position: absolute; bottom: -2px; left: -2px; width: 18px; height: 18px; background: #C8323C; border: 2px solid var(--bg-2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.ai-mark { position: absolute; top: -2px; left: -2px; width: 16px; height: 16px; background: #4A90E2; border: 2px solid var(--bg-2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #fff; font-weight: 700; }
.player-cell.dead { opacity: 0.6; }
.player-cell.dead .avatar-wrap { filter: grayscale(1); }
.nick { font-size: 12px; margin-top: 5px; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-no { font-size: 10px; color: var(--text-2); }
.online { position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: #27AE60; border: 2px solid var(--bg-2); }
.offline-mark { position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: #8A99A8; border: 2px solid var(--bg-2); }

/* 角色信息条 */
.role-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.role-bar .role-icon { width: 36px; height: 36px; flex-shrink: 0; }
.role-bar .role-info { flex: 1; }
.role-bar .role-name { font-size: 15px; font-weight: 600; }
.role-bar .role-camp { font-size: 11px; color: var(--text-2); }
.role-bar .alive-count { font-size: 12px; color: var(--text-2); text-align: right; }
.role-bar .alive-count b { color: var(--text); font-size: 16px; }

/* Toast 提示 */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.85); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 9999; animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* 加载中 */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
