/* ─── CSS 变量 ─────────────────────────────────────────────────────────────── */
:root {
  --bg-primary: #060a14;
  --bg-secondary: #0d1525;
  --bg-glass: rgba(15, 20, 35, 0.55);
  --bg-glass-hover: rgba(15, 20, 35, 0.68);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-hover: rgba(0, 240, 255, 0.4);
  --accent-cyan: #00f0ff;
  --accent-cyan-dim: rgba(0, 240, 255, 0.2);
  --accent-purple: #a855f7;
  --accent-purple-dim: rgba(168, 85, 247, 0.2);
  --accent-green: #00ff88;
  --accent-red: #ff4444;
  --accent-yellow: #ffaa00;
  --accent-blue: #3b82f6;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --text-muted: rgba(255, 255, 255, 0.55);
  /* 卡片内部的内容面：统一比外层玻璃亮一档，避免出现"黑洞" */
  --surface-1: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.085);
  --surface-border: rgba(255, 255, 255, 0.1);
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --blur-amount: 20px;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── 重置与基础 ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.3);
}

/* ─── 背景层 ─────────────────────────────────────────────────────────────── */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0, 100, 180, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 60%, rgba(100, 0, 180, 0.1) 0%, transparent 60%),
    linear-gradient(135deg, #060a14 0%, #0d1525 50%, #060a14 100%);
  background-attachment: fixed;
}

#bg-layer.has-image {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

#bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to bottom, rgba(6,10,20,0.45) 0%, rgba(6,10,20,0.25) 30%, rgba(6,10,20,0.25) 70%, rgba(6,10,20,0.8) 100%),
    radial-gradient(ellipse at center, rgba(6,10,20,0.05) 0%, rgba(6,10,20,0.55) 100%);
  pointer-events: none;
}

/* ─── 玻璃面板 ───────────────────────────────────────────────────────────── */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ─── 主容器 ─────────────────────────────────────────────────────────────── */
#app {
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  gap: 24px;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  color: var(--accent-cyan);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(0,240,255,0.4)); }
  50%       { filter: drop-shadow(0 0 12px rgba(0,240,255,0.8)); }
}

.logo-icon svg {
  width: 100%;
  height: 100%;
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.refresh-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.refresh-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.refresh-time {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent-cyan-dim);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-refresh svg {
  width: 16px;
  height: 16px;
  transition: transform 0.5s ease;
}

.btn-refresh:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.btn-refresh:hover svg {
  transform: rotate(180deg);
}

.btn-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ─── Section ────────────────────────────────────────────────────────────── */
.section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.steam-icon, .ts-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.steam-icon svg { fill: #c7d5e0; }
.ts-icon {
  filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.5));
  border-radius: 4px;
  object-fit: contain;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.page-indicator {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.page-indicator .current-page {
  color: var(--accent-cyan);
  font-weight: 600;
}

.ts-online-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

.ts-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-join-ts {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: linear-gradient(135deg, rgba(0,240,255,0.22), rgba(168,85,247,0.22));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,240,255,0.55);
  border-radius: var(--radius-sm);
  color: #7df9ff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition);
  letter-spacing: 0.5px;
}

.btn-join-ts:hover {
  background: linear-gradient(135deg, rgba(0,240,255,0.2), rgba(168,85,247,0.2));
  border-color: rgba(0,240,255,0.4);
  box-shadow: 0 0 16px rgba(0,240,255,0.2), 0 0 8px rgba(168,85,247,0.15);
  transform: translateY(-1px);
}

.btn-join-ts svg {
  transition: transform 0.3s ease;
}

.btn-join-ts:hover svg {
  transform: rotate(45deg);
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.online-sep { color: var(--text-muted); }

/* ─── Steam Carousel ─────────────────────────────────────────────────────── */
.steam-carousel-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.carousel-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.carousel-btn svg {
  width: 20px;
  height: 20px;
}

.carousel-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.carousel-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.steam-card-wrapper {
  flex: 1;
  overflow: hidden;
  border-radius: var(--radius);
}

.steam-cards-track {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Steam Card ─────────────────────────────────────────────────────────── */
.steam-card {
  flex: 0 0 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  /* 磨砂玻璃，和 TeamSpeak 卡片同一套变量 */
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: cardFadeIn 0.5s ease-out;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.steam-card-left {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  min-width: 180px;
  transition: all var(--transition);
}

.steam-card:hover .steam-card-left {
  border-color: rgba(0, 240, 255, 0.15);
}

.steam-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
}

.steam-avatar {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  border: 2px solid var(--glass-border);
  transition: border-color var(--transition);
}

.steam-status-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.status-online   { background: var(--accent-green); }
.status-offline  { background: var(--text-muted); }
.status-busy     { background: var(--accent-red); }
.status-away     { background: var(--accent-yellow); }
.status-snooze   { background: var(--accent-yellow); }
.status-trade    { background: var(--accent-purple); }
.status-play     { background: var(--accent-cyan); }

.steam-nickname {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
  line-height: 1.3;
  /* 长昵称完整换行显示；balance 让两行长度均匀，避免末行只剩一个字 */
  white-space: normal;
  text-wrap: balance;
}

.steam-state-text {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
}

.state-online  { color: var(--accent-green); background: rgba(0,255,136,0.1); }
.state-offline { color: var(--text-muted);   background: rgba(255,255,255,0.05); }
.state-busy    { color: var(--accent-red);   background: rgba(255,68,68,0.1); }
.state-away    { color: var(--accent-yellow);background: rgba(255,170,0,0.1); }
.state-snooze  { color: var(--accent-yellow);background: rgba(255,170,0,0.1); }
.state-trade   { color: var(--accent-purple);background: rgba(168,85,247,0.1); }
.state-play    { color: var(--accent-cyan);  background: rgba(0,240,255,0.1); }

.steam-friendcode {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-purple);
  background: rgba(168,85,247,0.1);
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
}

/* Steam 卡片右侧：游戏区 */
.steam-card-right {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 账号信息行 */
.account-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
}

.account-info-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  transition: all var(--transition);
}

.account-info-item:hover {
  background: rgba(0, 240, 255, 0.08);
  color: var(--accent-cyan);
}

.account-info-item.online {
  color: var(--accent-green);
  background: rgba(0, 255, 136, 0.08);
}

/* 信息行的颜色跟随真实状态，而不是一律"在线绿" */
.account-info-item.online.state-away {
  color: var(--accent-yellow);
  background: rgba(255, 170, 0, 0.08);
}
.account-info-item.online.state-busy {
  color: var(--accent-red);
  background: rgba(255, 68, 68, 0.08);
}
.account-info-item.online.state-snooze {
  color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.08);
}
.account-info-item.online.state-trade,
.account-info-item.online.state-play {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}

.account-info-item .info-icon {
  font-size: 0.85rem;
}

.current-game {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(0,240,255,0.06) 0%, rgba(168,85,247,0.06) 100%);
  border: 1px solid rgba(0,240,255,0.1);
  border-radius: var(--radius-sm);
}

.current-game-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.current-game-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.no-game {
  color: var(--text-secondary);
  font-style: italic;
}

/* 段标题：小圆点 + 标题 + 说明，全站统一（Steam 卡内用） */
.games-section-title,
.ach-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.games-section-title::before,
.ach-title::before {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.games-section-title {
  color: rgba(125, 249, 255, 0.9);
}

.games-section-title::before {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.ach-title {
  color: rgba(255, 214, 102, 0.92);
}

.ach-title::before {
  background: #ffcf4d;
  box-shadow: 0 0 8px #ffcf4d;
}

/* 段标题后面的灰色说明 */
.sec-hint {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: none;
  text-shadow: none;
}

.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.game-item {
  display: flex;
  align-items: center;
  /* 名称换行时保持整块垂直居中 */
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.game-item:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(0,240,255,0.15);
  transform: translateY(-1px);
}

.game-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.game-icon-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(0,240,255,0.1), rgba(168,85,247,0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.game-info {
  flex: 1;
  min-width: 0;
}

.game-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  /* 长游戏名允许折成两行 */
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.game-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-top: 2px;
}

.game-rank {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

/* ─── Page Dots ──────────────────────────────────────────────────────────── */
.page-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 0;
}

.page-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}

.page-dot.active {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0,240,255,0.5);
  width: 24px;
  border-radius: 4px;
}

.page-dot:hover:not(.active) {
  background: rgba(255,255,255,0.3);
}

/* ─── TeamSpeak Grid ─────────────────────────────────────────────────────── */
.ts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.ts-server-card {
  grid-column: 1;
  grid-row: 1;
  padding: 24px 28px;
  background: linear-gradient(135deg, rgba(0,240,255,0.05) 0%, rgba(168,85,247,0.05) 100%);
  border-color: rgba(0,240,255,0.12);
  transition: all var(--transition);
}

.ts-server-card:hover {
  border-color: rgba(0,240,255,0.25);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 24px rgba(0,240,255,0.05);
}

.ts-server-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ts-server-name::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: dotPulse 2s ease-in-out infinite;
}

.ts-server-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.ts-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ts-stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.ts-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 频道卡片 */
.ts-channels-card {
  grid-column: 2;
  grid-row: 1;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
  max-height: 280px;
  overflow: hidden;
}

.card-subtitle {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.channels-list, .clients-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.channel-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border-left: 2px solid rgba(0,240,255,0.2);
  transition: all var(--transition);
}

.channel-item:hover {
  background: rgba(255,255,255,0.04);
  border-left-color: var(--accent-cyan);
}

.channel-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.channel-icon {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.channel-icon svg {
  width: 14px;
  height: 14px;
}

.channel-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan);
  background: rgba(0,240,255,0.08);
  padding: 1px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.channel-count.empty {
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
}

/* 频道内成员列表 */
.channel-members {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 24px;
  border-left: 1px solid rgba(0,255,136,0.15);
  margin-left: 6px;
}

.ch-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
  cursor: default;
}

.ch-user-row:hover {
  background: rgba(0,255,136,0.05);
}

.ch-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(0,255,136,0.15), rgba(0,240,255,0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent-green);
  flex-shrink: 0;
}

.ch-user-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-user-idle {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.client-channel {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 在线用户卡片 */
.ts-clients-card {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
  max-height: 320px;
  overflow: hidden;
}

.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.client-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.client-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(168,85,247,0.2);
  transform: translateY(-1px);
}

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-cyan-dim), var(--accent-purple-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

.client-info {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-idle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.client-id-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
}

/* ─── Skeleton / Loading ─────────────────────────────────────────────────── */
.loading-card {
  padding: 28px;
  min-height: 200px;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  margin-bottom: 10px;
}

.skeleton-line.short { width: 40%; }

.shimmer-block {
  height: 80px;
  border-radius: 8px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  margin-top: 16px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  display: flex;
  flex-wrap: wrap;          /* 窄屏换行，否则会把整页撑宽 */
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 14px 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-sep {
  opacity: 0.4;
}

.footer-icp {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-icp:hover {
  color: var(--accent-cyan);
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(16px);
  color: var(--accent-cyan);
  font-size: 0.88rem;
  font-weight: 600;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ─── 响应式 ─────────────────────────────────────────────────────────────── */
@media (min-width: 769px) {
  /* 桌面端：隐藏移动端布局，显示桌面布局 */
  .steam-card .desktop-layout { display: grid; }
  .steam-card .mobile-layout { display: none; }

  /* 桌面端卡片容器 */
  .steam-card .desktop-layout {
    flex: 0 0 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto;
    gap: 20px;
    padding: 28px;
    border-radius: var(--radius);
  }

  /* 桌面端左侧 */
  .steam-card .desktop-layout .steam-card-left {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    min-width: 180px;
  }

  /* 桌面端右侧 */
  .steam-card .desktop-layout .steam-card-right {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 768px) {
  #app { padding: 12px; gap: 16px; }

  .header {
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px;
  }

  .site-title { font-size: 1.1rem; }

  /* Steam 轮播：横向切换，每次只显示一张 */
  .steam-carousel-container {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .steam-card-wrapper {
    flex: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
  }

  .steam-cards-track {
    display: flex;
    flex-direction: row;
    width: 100%;
    will-change: transform;
  }

  /* Steam 卡片：每张占满容器宽度 */
  .steam-card {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 14px;
    display: flex;
    flex-direction: column;
  }

  /* 移动端：隐藏桌面布局，显示移动端布局 */
  .steam-card .desktop-layout { display: none; }
  /* 外层 .steam-card 已经是磨砂面板，这里不再重复画一层底 */
  .steam-card .mobile-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 14px;
  }

  /* 真正装各行的容器：原来没有 gap，六行全贴在一起 */
  .steam-card-left-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
  }

  .mobile-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mobile-row-1 {
    justify-content: flex-start;
  }

  .mobile-row-2 {
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(0,240,255,0.06) 0%, rgba(168,85,247,0.06) 100%);
    border-radius: var(--radius-sm);
  }

  .mobile-row-3 {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .mobile-row-4 {
    justify-content: center;
  }

  .mobile-row .steam-nickname {
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
  }

  .mobile-row .current-game-label {
    font-size: 0.7rem;
    color: var(--accent-cyan);
    font-weight: 600;
    text-transform: uppercase;
  }

  .mobile-row .current-game-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    flex: 1;
    margin-left: 8px;
  }

  .mobile-row .games-section-title {
    font-size: 0.7rem;
    letter-spacing: 1px;
  }

  .mobile-row .games-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-row .game-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }

  .mobile-row .game-icon {
    width: 28px;
    height: 28px;
  }

  .mobile-row .game-name {
    font-size: 0.8rem;
    flex: 1;
  }

  .mobile-row .game-time {
    font-size: 0.7rem;
    color: var(--text-muted);
  }

  .mobile-row .steam-friendcode {
    font-size: 0.75rem;
    color: var(--accent-purple);
    background: rgba(168,85,247,0.1);
    padding: 4px 10px;
    border-radius: 20px;
  }

  .steam-avatar-wrap { width: 48px; height: 48px; flex-shrink: 0; }
  .steam-avatar { width: 48px; height: 48px; }

  .carousel-btn {
    display: none;
  }

  /* TS：改为上下单列 */
  .ts-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .ts-server-card,
  .ts-channels-card {
    grid-column: unset;
    grid-row: unset;
  }

  .ts-server-stats { gap: 14px; flex-wrap: wrap; }
  .ts-stat-value { font-size: 1rem; }
}

@media (max-width: 480px) {
  /* Header */
  .header-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .refresh-info {
    align-items: flex-start;
  }

  .btn-refresh span { display: none; }
  .btn-refresh { padding: 8px; }

  /* Footer：去掉分隔点，紧凑换行 */
  .footer { font-size: 0.72rem; padding: 12px 14px; }
  .footer-sep { display: none; }

  /* Steam cards */
  .steam-card {
    padding: 14px;
    gap: 10px;
  }

  .steam-avatar-wrap { width: 52px; height: 52px; }
  .steam-avatar { width: 52px; height: 52px; }

  .game-item { padding: 10px; }
  .game-icon { width: 36px; height: 36px; }
  .game-name { font-size: 0.82rem; }
  .game-playtime { font-size: 0.7rem; }

  /* TS header */
  .ts-header-right {
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-join-ts {
    padding: 6px 12px;
    font-size: 0.78rem;
    letter-spacing: 0;
  }

  /* TS server card */
  .ts-server-stats {
    gap: 12px;
  }

  .ts-stat-value { font-size: 1rem; }
  .ts-stat-label { font-size: 0.7rem; }

  /* Channel members */
  .channel-item {
    padding: 8px 10px;
  }

  .channel-name {
    font-size: 0.82rem;
    white-space: normal;
    word-break: break-all;
  }

  .ch-user-row {
    flex-wrap: nowrap;
    gap: 6px;
    overflow: hidden;
  }

  .ch-user-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
  }

  .ch-user-idle { display: none; }

  /* Footer */
  .footer {
    font-size: 0.7rem;
    padding: 10px 14px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  /* Carousel buttons */
  .carousel-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .carousel-btn svg {
    width: 16px;
    height: 16px;
  }

  .steam-carousel-container {
    gap: 8px;
  }
}

@media (max-width: 360px) {
  .site-title { font-size: 0.95rem; }
  .steam-nickname { font-size: 0.9rem; }
  .ts-online-count { font-size: 0.85rem; }
  .btn-join-ts span:last-child { display: none; }
}

.steam-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.steam-header-right .carousel-btn {
  width: 34px;
  height: 34px;
}

.steam-header-right .carousel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ─── Steam 卡片：网格区域布局 + 统计条（2026-11-01）─────────────────────── */
.steam-stats {
  display: grid;
  /* 有几项就铺几列，不满 4 项也不会留空 */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.steam-stat {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  min-width: 0;
}

.steam-stat-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(0, 240, 255, 0.22);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.14), rgba(0, 240, 255, 0.04));
  color: var(--accent-cyan);
}

.steam-stat-icon svg {
  width: 19px;
  height: 19px;
}

.steam-stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* 每个指标一种色调 */
.steam-stat.tone-purple .steam-stat-icon {
  color: var(--accent-purple);
  border-color: rgba(168, 85, 247, 0.25);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(168, 85, 247, 0.04));
}
.steam-stat.tone-purple .steam-stat-value { color: var(--accent-purple); }

.steam-stat.tone-amber .steam-stat-icon {
  color: var(--accent-yellow);
  border-color: rgba(255, 170, 0, 0.25);
  background: linear-gradient(135deg, rgba(255, 170, 0, 0.16), rgba(255, 170, 0, 0.04));
}

.steam-stat.tone-green .steam-stat-icon {
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.25);
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.16), rgba(0, 255, 136, 0.04));
}
.steam-stat.tone-green .steam-stat-value { color: var(--accent-green); }

.steam-stat-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.steam-stat-value.small {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.steam-stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

@media (min-width: 769px) {
  /* 网格区域：左资料 | 右信息 / 右 TOP3（一行三卡） / 统计条横跨整行 */
  .steam-card .desktop-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "profile info"
      "profile games"
      "stats   stats";
    gap: 14px 20px;
    /* 左边距和 "STEAM 状态" 标题对齐（标题行有 4px padding） */
    padding: 22px 22px 20px 4px;
    align-items: start;
    width: 100%;
  }

  .steam-card .desktop-layout .steam-card-left  { grid-area: profile; align-self: stretch; }
  .steam-card .desktop-layout .steam-card-mid   {
    grid-area: info;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }
  .steam-card .desktop-layout .steam-card-right { grid-area: games; min-width: 0; }
  .steam-card .desktop-layout .steam-stats      { grid-area: stats; }

  /* TOP3 固定一行三列，不再随意折行 */
  .steam-card .desktop-layout .steam-card-right .games-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .steam-card .desktop-layout .steam-card-right .games-section-title {
    margin-bottom: 8px;
  }
}

@media (max-width: 768px) {
  .steam-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* .mobile-row 是 flex，这里必须改成块级，否则统计条被内容宽度卡住 */
  .mobile-row-stats { display: block; width: 100%; }
  .mobile-row-stats .steam-stats { width: 100%; }
  .mobile-identity {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    min-width: 0;
  }
  .mobile-row-info { display: block; }
  .mobile-row-info .account-info-row { width: 100%; padding: 8px 10px; }
  .mobile-row-info .account-info-item { font-size: 0.78rem; }
}

/* 统计项为奇数时，最后一项在窄屏铺满整行，避免半行空白 */
@media (max-width: 768px) {
  .steam-stats .steam-stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* ─── 最稀有成就：动态金色边框（2026-11-01）──────────────────────────────── */
.steam-achievements {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}


.ach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* 金边：@property 让 --ach-angle 可动画，2px 描边绕圈流转 */
@property --ach-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.ach-card {
  position: relative;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  overflow: hidden;
}

/* 金边：用遮罩只保留 2px 的环，卡身保持和外层一致的浅玻璃 */
.ach-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from var(--ach-angle),
    #6b4f12, #ffd75e, #fff6c9, #ffb400, #a97d16, #ffd75e, #fff3b0, #6b4f12
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  animation: achSpin 5s linear infinite;
}

.ach-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-width: 0;
}

.ach-rank {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: #1a1206;
  background: linear-gradient(135deg, #ffe89a, #ffb400);
  box-shadow: 0 0 8px rgba(255, 200, 80, 0.45);
}

.ach-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid rgba(255, 200, 80, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.ach-icon-empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ach-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ach-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffe9a8;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.ach-game {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ach-pct {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffcf4d;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255, 190, 60, 0.12);
  border: 1px solid rgba(255, 190, 60, 0.3);
}

@keyframes achSpin {
  to { --ach-angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .ach-card::before { animation: none; }
}

@media (min-width: 769px) {
  .steam-card .desktop-layout {
    grid-template-areas:
      "profile info"
      "profile games"
      "stats   stats"
      "ach     ach";
  }
  .steam-card .desktop-layout .steam-achievements { grid-area: ach; }
}

@media (max-width: 768px) {
  .ach-grid { grid-template-columns: minmax(0, 1fr); }
  .mobile-row-ach { display: block; width: 100%; }
  .mobile-row-ach .steam-achievements { width: 100%; }
}
