/* ==========================================================================
   card-game Duel Arena Design System & Themes
   ========================================================================== */

:root {
  /* Default "战斗 (Battle)" Theme Palette */
  --bg-primary: #0b0f19;
  --bg-surface: #131b2e;
  --bg-surface-hover: #1b2640;
  --bg-card: rgba(19, 27, 46, 0.85);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(19, 27, 46, 0.82);

  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --accent-gradient-warm: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --accent-gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --accent-gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --accent-gradient-purple: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);

  --card-attack: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  --card-defense: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --card-heal: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --card-poison: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  --card-curse: linear-gradient(135deg, #a855f7 0%, #6b21a8 100%);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #6366f1;

  --hp-bar-color: #10b981;
  --hp-bar-bg: rgba(0, 0, 0, 0.5);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow-cyan: 0 0 20px rgba(99, 102, 241, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ==========================================================================
   Dynamic Theme 2: "狂热 (Frenzy)" Theme (Opponent HP <= 30)
   ========================================================================== */
body.theme-frenzy {
  --bg-primary: #150909;
  --bg-surface: #261111;
  --bg-surface-hover: #3b1717;
  --bg-card: rgba(38, 17, 17, 0.9);
  --bg-card-border: rgba(245, 158, 11, 0.25);
  --bg-glass: rgba(38, 17, 17, 0.88);

  --border-color: rgba(245, 158, 11, 0.3);
  --border-focus: #f59e0b;
  --accent-primary: #ea580c;
  --accent-primary-hover: #c2410c;
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
  --shadow-glow-cyan: 0 0 25px rgba(239, 68, 68, 0.5);

  background-image: 
    radial-gradient(at 0% 0%, rgba(239, 68, 68, 0.2) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.15) 0px, transparent 50%),
    radial-gradient(circle, rgba(220, 38, 38, 0.08) 0%, transparent 70%);
}

/* ==========================================================================
   Dynamic Theme 3: "虚弱 (Weakened)" Theme (Self HP <= 30 - Highest Priority)
   ========================================================================== */
body.theme-weakened {
  --bg-primary: #0a060f;
  --bg-surface: #170d22;
  --bg-surface-hover: #231336;
  --bg-card: rgba(23, 13, 34, 0.92);
  --bg-card-border: rgba(168, 85, 247, 0.3);
  --bg-glass: rgba(23, 13, 34, 0.9);

  --border-color: rgba(239, 68, 68, 0.35);
  --border-focus: #ef4444;
  --accent-primary: #9333ea;
  --accent-primary-hover: #7e22ce;
  --accent-gradient: linear-gradient(135deg, #ef4444 0%, #7e22ce 100%);
  --shadow-glow-cyan: 0 0 30px rgba(168, 85, 247, 0.6);

  animation: weakenedHeartbeat 2.2s infinite ease-in-out;
}

@keyframes weakenedHeartbeat {
  0% {
    box-shadow: inset 0 0 40px rgba(239, 68, 68, 0.2), inset 0 0 90px rgba(126, 34, 206, 0.35);
  }
  50% {
    box-shadow: inset 0 0 80px rgba(239, 68, 68, 0.45), inset 0 0 160px rgba(126, 34, 206, 0.65);
  }
  100% {
    box-shadow: inset 0 0 40px rgba(239, 68, 68, 0.2), inset 0 0 90px rgba(126, 34, 206, 0.35);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.14) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
  color: var(--text-primary);
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.8s ease, background-image 0.8s ease;
}

/* ===== 游戏类 Worker：强制横屏一屏显示外壳（4.9.2）===== */
.landscape-frame {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.landscape-frame > .header {
  flex-shrink: 0;
}

.landscape-frame > .container,
.landscape-frame > .arena-container,
.landscape-frame > #errorContainer {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.header-brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.25rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.zoom-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  padding: 0;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  transform: scale(1.08);
}

.zoom-btn:active {
  transform: scale(0.92);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 22px;
  height: 22px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

/* Container — 横屏一屏内自适应，禁用 body 滚动 */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 大厅主容器内部可滚动区域由 rooms-grid 承担，container 本身不滚动 */
.container > .page-toolbar {
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  outline: none;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:not(:disabled):hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--accent-gradient-danger);
  color: #ffffff;
}

.btn-danger:not(:disabled):hover {
  filter: brightness(1.15);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
}

.btn-warning:not(:disabled):hover {
  filter: brightness(1.15);
}

.btn-warm {
  background: var(--accent-gradient-warm);
  color: #1e1b4b;
  font-weight: 700;
}

.btn-warm:not(:disabled):hover {
  filter: brightness(1.1);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-owner {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-member {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-playing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-waiting {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Room List View (index.html)
   ========================================================================== */
.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  padding-right: 0.25rem;
  padding-bottom: 0.5rem;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.rooms-grid::-webkit-scrollbar { width: 6px; }
.rooms-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 9999px; }

.room-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.22s ease;
  box-shadow: var(--shadow-sm);
}

.room-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-md);
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.room-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.room-meta {
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.room-card-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.room-card-actions .btn {
  flex: 1;
}

/* Custom Card Names List inside Create Modal — 横屏下限高防一屏溢出 */
.card-custom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  max-height: min(34dvh, 280px);
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-top: 0.75rem;
  overscroll-behavior: contain;
}

.card-custom-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-custom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-custom-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.card-custom-tag.attack { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.card-custom-tag.defense { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.card-custom-tag.heal { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.card-custom-tag.special { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }

/* ==========================================================================
   Duel Battle Arena View (room.html) — 横屏一屏锁，无 body 滚动
   ========================================================================== */
.arena-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.35rem 0.55rem;
  gap: 0.28rem;
  min-height: 0;
  overflow: visible;
}

.arena-topbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.45rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.round-badge {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.deck-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
}

/* Player & Opponent Status Bars — 横屏下固定高度不挤压 */
.player-status-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  gap: 0.75rem;
  flex-shrink: 0;
}

.player-info-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 140px;
}

.player-name-text {
  font-size: 1rem;
  font-weight: 700;
}

.player-name-line {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: wrap;
  min-width: 0;
}

.player-sub-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

/* HP Progress Bar — 文本内移到填充区域，移除外部 label 节省高度 */
.hp-container {
  flex: 1;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hp-track {
  height: 18px;
  background: var(--hp-bar-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
  display: flex;
  align-items: center;
}

.hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 2;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.hp-fill {
  height: 100%;
  background: var(--accent-gradient-success);
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s ease;
}

.hp-fill.critical {
  background: var(--accent-gradient-danger);
}

.hp-fill.frenzy {
  background: var(--accent-gradient-warm);
}

/* Passes Indicator Pips */
.pass-pips-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pass-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.8);
  transition: all 0.3s ease;
}

.pass-pip.used {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

/* Status Effect Badges (Delayed Curse/Poison) */
.effect-chips-row {
  display: flex;
  gap: 0.4rem;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  animation: pulseChip 1.5s infinite alternate;
}

.effect-chip-poison {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.effect-chip-whisper {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.effect-chip-bomb {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.effect-chip-sweet {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.effect-chip-heal {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.effect-chip-rhino {
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.effect-chip-gamble {
  background: rgba(217, 70, 239, 0.2);
  color: #f0abfc;
  border: 1px solid rgba(217, 70, 239, 0.4);
}

@keyframes pulseChip {
  from { opacity: 0.75; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1.03); }
}

/* Central Battle Clash Arena — 紧凑高度，释放空间给手牌，避免大片空白 */
.battle-arena {
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  background: radial-gradient(circle, rgba(19, 27, 46, 0.7) 0%, rgba(11, 15, 25, 0.95) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  padding: 0.4rem 0.75rem;
}

.clash-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
  width: 100%;
}

.clash-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.clash-vs-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(28px, 4.5vw, 38px);
  height: clamp(28px, 4.5vw, 38px);
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #a855f7 100%);
  color: #ffffff;
  font-weight: 900;
  font-size: clamp(0.7rem, 1.2vw, 0.88rem);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
  user-select: none;
}

.clash-turn-indicator {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* 己方/对方出牌标签内移到卡牌内部（节省纵向空间，替代原外部 .clash-slot-label） */
.duel-card[data-label]::before {
  content: attr(data-label);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.58);
  color: #cbd5e1;
  font-size: 0.58rem;
  font-weight: 700;
  text-align: center;
  padding: 0.16rem 0;
  z-index: 4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.04em;
  line-height: 1;
  backdrop-filter: blur(2px);
  pointer-events: none;
}

/* Duel Card Design — 384×512 jpg art cover，横屏下等比缩放 */
.duel-card {
  width: clamp(88px, 10vw, 130px);
  height: clamp(110px, 13vw, 148px);
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  padding: 0;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.duel-card-back {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  border-color: rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
}

.duel-card.is-attack { border-color: #ef4444; background: linear-gradient(180deg, rgba(239, 68, 68, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-defense { border-color: #3b82f6; background: linear-gradient(180deg, rgba(59, 130, 246, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-heal { border-color: #10b981; background: linear-gradient(180deg, rgba(16, 185, 129, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-poison { border-color: #f59e0b; background: linear-gradient(180deg, rgba(245, 158, 11, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-curse { border-color: #a855f7; background: linear-gradient(180deg, rgba(168, 85, 247, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-gamble { border-color: #d946ef; background: linear-gradient(180deg, rgba(217, 70, 239, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-truedmg { border-color: #f43f5e; background: linear-gradient(180deg, rgba(244, 63, 94, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-sweet { border-color: #10b981; background: linear-gradient(180deg, rgba(16, 185, 129, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }
.duel-card.is-rhino { border-color: #f97316; background: linear-gradient(180deg, rgba(249, 115, 22, 0.15) 0%, rgba(19, 27, 46, 0.95) 100%); }

.card-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  z-index: 0;
}

.card-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.55rem 0.6rem 0.5rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 38%, rgba(0,0,0,0.58) 72%, rgba(11,15,25,0.88) 100%);
}

.card-header-icon {
  font-size: 1.15rem;
  margin-bottom: 0.15rem;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
}

.card-name-title {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.2rem;
  text-shadow: 0 1px 8px rgba(0,0,0,0.85);
}

.card-stats-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.14rem 0.38rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(4px);
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 0.25rem;
}

.card-desc-text {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: auto;
}

/* lobby card-create preview thumb */
.card-custom-thumb {
  width: 44px;
  height: 58px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  background: rgba(0,0,0,0.35);
}

.card-locked-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.85);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fbbf24;
  backdrop-filter: blur(2px);
}

/* Hand Cards Rack — 横屏一屏内自适应，顶部预留弹起高度，消除底部多余空白 */
.hand-rack-container {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  justify-content: center;
  padding-top: 0.12rem;
  padding-bottom: env(safe-area-inset-bottom, 0);
  overflow: visible;
}

.hand-cards-list {
  display: flex;
  justify-content: safe center;
  justify-content: center;
  align-items: flex-end;
  gap: 0.5rem;
  min-height: 0;
  max-height: none;
  flex: 0 0 auto;
  padding: 2rem 0.5rem 0.35rem;
  overflow-x: auto;
  overflow-y: visible;
  flex-wrap: nowrap;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.hand-card-item {
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.hand-card-item:hover:not(.locked) {
  transform: translateY(-16px) scale(1.05);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), var(--shadow-glow-cyan);
  z-index: 10;
}

.hand-card-item.selected {
  transform: translateY(-24px) scale(1.08);
  border-color: #f59e0b !important;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.8) !important;
  z-index: 15;
}

.hand-card-item.locked {
  filter: grayscale(0.85);
  opacity: 0.6;
  cursor: not-allowed;
}

/* Action Controls Bar — 横屏拇指热区，小屏防截断 */
.action-controls-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0.2rem 0 calc(0.2rem + env(safe-area-inset-bottom, 0));
  flex-shrink: 0;
  flex-wrap: wrap;
  width: 100%;
}

.action-controls-bar .btn {
  min-height: 40px;
  flex: 1 1 0;
  min-width: 120px;
  max-width: 200px;
  white-space: nowrap;
}

/* Settlement Broadcast Box — 固定全屏居中 */
.settlement-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 150;
  animation: fadeIn 0.25s ease;
  overflow: hidden;
}

.settlement-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: min(600px, 92vw);
  width: 100%;
  max-height: 82dvh;
  padding: 1.2rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: hidden;
  margin: auto;
}

.settlement-step-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border-left: 4px solid #6366f1;
  font-size: 0.9rem;
  line-height: 1.4;
}

.settlement-step-row.phase3 { border-left-color: #a855f7; }
.settlement-step-row.phase4 { border-left-color: #10b981; }
.settlement-step-row.phase5 { border-left-color: #ef4444; }
.settlement-step-row.phase6 { border-left-color: #3b82f6; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: min(520px, 92vw);
  max-height: 88dvh;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.modal-backdrop.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1;
}

.modal-footer {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
}

.code-input {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: 0.35em;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.25s ease forwards;
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid #6366f1; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Idle Prompt Pulse */
.idle-prompt-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  animation: pulseChip 1s infinite alternate;
}

/* ===== 邀请页横屏居中容器 ===== */
.invite-center {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  overflow: hidden;
}

.invite-center > .modal {
  margin: 0 auto;
}

/* 错误容器横屏居中 */
#errorContainer.container {
  justify-content: center;
  align-items: center;
}

/* 结算步骤容器横屏限高 */
#settlementStepsContainer {
  max-height: 38dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ===== 游戏类 Worker：强制横屏竖屏引导层（4.9.2）===== */
#rotateOverlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  background: radial-gradient(at 0% 0%, rgba(99,102,241,0.18) 0, transparent 55%),
              radial-gradient(at 100% 100%, rgba(168,85,247,0.16) 0, transparent 55%),
              rgba(11, 15, 25, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.rotate-overlay-icon {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 1rem;
  animation: rotateHint 1.6s infinite ease-in-out;
  filter: drop-shadow(0 4px 16px rgba(99,102,241,0.5));
}

.rotate-overlay-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.rotate-overlay-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 22rem;
}

.rotate-overlay-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  width: 100%;
}

@keyframes rotateHint {
  0%, 100% { transform: rotate(-10deg) scale(1); }
  50% { transform: rotate(10deg) scale(1.06); }
}

@media (orientation: portrait) {
  #rotateOverlay { display: flex; }
  .landscape-frame { filter: blur(8px); pointer-events: none; user-select: none; }
}

@media (max-aspect-ratio: 1/1) {
  #rotateOverlay { display: flex; }
}

/* 横屏小高度等比压缩 — 手机横屏可用高度仅 320-420px，必须一屏完整显示 */
@media (orientation: landscape) and (max-height: 520px) {
  /* VS 文案在极矮视口下需同步缩小，避免撑高 battle-arena */
  .clash-stage > div:nth-child(2) { font-size: 1.2rem !important; }
  .header { padding: 0.4rem 0.85rem; }
  .brand { font-size: 0.95rem; gap: 0.5rem; }
  .brand-icon { width: 28px; height: 28px; font-size: 1rem; }
  .zoom-btn { width: 22px; height: 22px; }
  .zoom-btn svg { width: 12px; height: 12px; }
  .container { padding: 0.6rem 0.85rem; }
  .page-toolbar { margin-bottom: 0.6rem; gap: 0.5rem; }
  .page-title { font-size: 1.15rem; }
  .page-desc { font-size: 0.75rem; }
  .rooms-grid { gap: 0.75rem; }
  .room-card { padding: 0.85rem; }

  .arena-container { padding: 0.35rem 0.5rem; gap: 0.3rem; }
  .arena-topbar { padding: 0.3rem 0.6rem; gap: 0.4rem; flex-wrap: wrap; }
  .round-badge { font-size: 0.75rem; }
  .deck-counter-badge { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
  .idle-prompt-banner { font-size: 0.68rem; padding: 0.2rem 0.5rem; }

  .player-status-bar { padding: 0.3rem 0.6rem; gap: 0.5rem; border-radius: 10px; }
  .player-info-block { min-width: 92px; gap: 0.5rem; }
  .player-info-block .user-avatar { width: 20px; height: 20px; font-size: 0.68rem; }
  .player-name-text { font-size: 0.78rem; }
  .player-sub-text { font-size: 0.62rem; }
  .hp-container { max-width: 42%; }
  .hp-track { height: 14px; }
  .hp-text { font-size: 0.6rem; }
  .pass-pip { width: 7px; height: 7px; }
  .effect-chip { font-size: 0.6rem; padding: 0.12rem 0.32rem; }

  .battle-arena { padding: 0.22rem 0.4rem; flex: 0 0 auto; min-height: 0; height: auto; }
  .clash-stage { gap: clamp(0.6rem, 2vw, 1.2rem); }
  .clash-slot { gap: 0; }
  .duel-card[data-label]::before { font-size: 0.5rem; padding: 0.1rem 0; }
  .duel-card { width: clamp(68px, 10dvh, 104px); height: clamp(88px, 12.5dvh, 122px); border-width: 1.5px; }
  .duel-card-back { font-size: 1.2rem; }
  .card-content { padding: 0.32rem 0.38rem 0.3rem; }
  .card-header-icon { font-size: 0.75rem; margin-bottom: 0; }
  .card-name-title { font-size: 0.62rem; margin-bottom: 0.08rem; }
  .card-stats-pill { font-size: 0.52rem; padding: 0.08rem 0.24rem; }
  .card-custom-thumb { width: 36px; height: 46px; }

  .hand-rack-container { gap: 0.18rem; max-height: none; flex: 0 0 auto; overflow: visible; padding-top: 0.15rem; padding-bottom: env(safe-area-inset-bottom, 0); }
  .hand-cards-list { gap: 0.4rem; min-height: 0; max-height: none; padding: 0.9rem 0.3rem 0.28rem; overflow-x: auto; overflow-y: visible; }
  .hand-card-item:hover:not(.locked) { transform: translateY(-6px) scale(1.03); }
  .hand-card-item.selected { transform: translateY(-8px) scale(1.04); }
  .action-controls-bar { gap: 0.45rem; padding: 0.12rem 0 calc(0.12rem + env(safe-area-inset-bottom, 0)); flex-wrap: nowrap; }
  .action-controls-bar .btn { min-height: 30px; padding: 0.24rem 0.55rem; font-size: 0.68rem; min-width: 0; flex: 1 1 0; }

  .settlement-overlay { padding: 0.5rem; }
  .settlement-card { padding: 0.75rem; gap: 0.5rem; max-height: 78dvh; }
  #settlementStepsContainer { max-height: 30dvh; }
  .settlement-step-row { padding: 0.4rem 0.55rem; font-size: 0.72rem; }

  .modal { max-height: 84dvh; }
  .modal-header { padding: 0.75rem 1rem; }
  .modal-body { padding: 0.85rem 1rem; }
  .modal-footer { padding: 0.6rem 1rem; }
}

@media (orientation: landscape) and (max-height: 400px) {
  .header { padding: 0.28rem 0.6rem; }
  .brand { font-size: 0.84rem; }
  .arena-container { padding: 0.22rem 0.4rem; gap: 0.22rem; }
  .arena-topbar { padding: 0.22rem 0.45rem; }
  .round-badge { font-size: 0.68rem; }
  .player-status-bar { padding: 0.22rem 0.45rem; gap: 0.35rem; }
  .hp-track { height: 12px; }
  .hp-text { font-size: 0.55rem; }
  .battle-arena { padding: 0.2rem 0.35rem; }
  .clash-stage { gap: 0.5rem; }
  .duel-card { width: clamp(60px, 9.5dvh, 88px); height: clamp(76px, 11.5dvh, 106px); }
  .card-name-title { font-size: 0.56rem; }
  .card-stats-pill { font-size: 0.48rem; }
  .hand-rack-container { max-height: none; flex: 0 0 auto; overflow: visible; padding-top: 0.15rem; padding-bottom: env(safe-area-inset-bottom, 0); }
  .hand-cards-list { min-height: 0; max-height: none; gap: 0.32rem; padding: 0.75rem 0.3rem 0.22rem; overflow-x: auto; overflow-y: visible; }
  .hand-card-item:hover:not(.locked) { transform: translateY(-4px) scale(1.02); }
  .hand-card-item.selected { transform: translateY(-6px) scale(1.03); }
  .action-controls-bar { gap: 0.35rem; padding-bottom: calc(0.1rem + env(safe-area-inset-bottom, 0)); }
  .action-controls-bar .btn { min-height: 26px; font-size: 0.64rem; padding: 0.18rem 0.4rem; min-width: 0; }
}

@media (orientation: landscape) and (max-height: 360px) {
  .header { padding: 0.22rem 0.5rem; }
  .brand { font-size: 0.78rem; }
  .user-badge { padding: 0.2rem 0.5rem; font-size: 0.72rem; }
  .btn-sm { padding: 0.2rem 0.45rem; font-size: 0.68rem; }
  .arena-container { gap: 0.15rem; padding: 0.15rem 0.3rem; }
  .battle-arena { min-height: 68px; padding: 0.15rem 0.25rem; }
  .duel-card { width: 56px; height: 72px; }
  .duel-card[data-label]::before { font-size: 0.42rem; padding: 0.08rem 0; }
  .card-content { padding: 0.2rem 0.25rem 0.15rem; }
  .card-name-title { font-size: 0.5rem; }
  .card-stats-pill { font-size: 0.42rem; padding: 0.06rem 0.18rem; }
  .hand-rack-container { max-height: none; flex: 0 0 auto; overflow: visible; padding-top: 0.12rem; padding-bottom: env(safe-area-inset-bottom, 0); }
  .hand-cards-list { min-height: 0; max-height: none; gap: 0.26rem; padding: 0.65rem 0.2rem 0.2rem; overflow-x: auto; overflow-y: visible; }
  .hand-card-item:hover:not(.locked) { transform: translateY(-3px) scale(1.02); }
  .hand-card-item.selected { transform: translateY(-5px) scale(1.03); }
  .action-controls-bar { gap: 0.3rem; }
  .action-controls-bar .btn { min-height: 24px; font-size: 0.6rem; padding: 0.15rem 0.35rem; }
}

/* ==========================================================================
   Local Leaderboard Styles (IndexedDB: ys_card_game)
   ========================================================================== */

.header-leaderboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.header-leaderboard-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.leaderboard-summary-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.summary-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.summary-val.highlight {
  background: var(--accent-gradient-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.summary-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.leaderboard-table-wrap {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.leaderboard-table-scroll {
  overflow-x: auto;
  max-height: min(48dvh, 380px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  white-space: nowrap;
}

.leaderboard-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #172036;
}

.leaderboard-table th {
  padding: 0.65rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.leaderboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-table tbody tr.my-rank-row {
  background: rgba(99, 102, 241, 0.1);
  border-left: 3px solid #6366f1;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.3rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  color: #fff;
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
  color: #fff;
}

.rank-badge.rank-normal {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.mini-rate-bar {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.mini-rate-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

@media (orientation: landscape) and (max-height: 480px) {
  .header-leaderboard-btn { padding: 0.18rem 0.45rem; font-size: 0.72rem; }
  .leaderboard-summary-card { padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; gap: 0.5rem; }
  .summary-val { font-size: 1.1rem; }
  .leaderboard-table th, .leaderboard-table td { padding: 0.4rem 0.5rem; font-size: 0.75rem; }
}
