/* assets/css/ranking_catchmon.css */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #080818;
  color: white;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(78,205,196,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78,205,196,0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none; z-index: 0;
}

.orb { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; }
.orb-1 { width: 500px; height: 500px; background: rgba(78,205,196,0.08); top: -150px; left: -150px; }
.orb-2 { width: 400px; height: 400px; background: rgba(255,107,107,0.07); bottom: 0; right: -100px; }

.connection-status {
  position: fixed; top: 12px; left: 12px;
  background: rgba(0,0,0,0.7); color: white;
  padding: 6px 13px; border-radius: 16px; font-size: 12px; font-weight: 600;
  z-index: 900; border: 1px solid rgba(255,255,255,0.12);
}
.connection-status.connected    { background: rgba(76,175,80,0.85); }
.connection-status.disconnected { background: rgba(244,67,54,0.85); }

.container { max-width: 1300px; margin: auto; padding: 28px 20px 80px; position: relative; z-index: 1; }

/* Top bar */
.top-bar { margin-bottom: 32px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: rgba(255,255,255,0.45); font-size: 13px; font-weight: 500;
  padding: 9px 16px; border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
  transition: all 0.2s;
}
.back-btn:hover { color: white; border-color: rgba(255,255,255,0.22); }

/* Header */
.page-header { margin-bottom: 28px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: #4ECDC4; opacity: 0.7; margin-bottom: 12px; }
h1 { font-size: clamp(2.2rem, 7vw, 4.5rem); font-weight: 900; line-height: 0.95; letter-spacing: -2px; }
.line-white { display: block; color: white; }
.line-grad {
  display: block;
  background: linear-gradient(90deg, #FF6B6B, #FFD700, #4ECDC4);
  background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-size: 200% auto; animation: gradMove 4s linear infinite;
}
@keyframes gradMove { to { background-position: -200% center; } }

/* Controls */
.controls {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.rarity-filters { display: flex; gap: 7px; flex-wrap: wrap; }
.rarity-btn {
  padding: 8px 14px; border-radius: 24px; border: 1px solid rgba(255,255,255,0.1);
  font-size: 12px; font-weight: 700; cursor: pointer;
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.65);
  transition: all 0.2s;
}
.rarity-btn:hover { background: rgba(255,255,255,0.1); color: white; transform: translateY(-1px); }
.rarity-btn.active { transform: translateY(-1px); }
.rarity-btn[data-rarity="all"].active      { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.4); color: white; }
.rarity-btn[data-rarity="Common"].active   { background: rgba(158,158,158,0.3); border-color: #bdbdbd; color: #e0e0e0; }
.rarity-btn[data-rarity="Starter"].active  { background: rgba(76,175,80,0.3);  border-color: #81c784; color: #a5d6a7; }
.rarity-btn[data-rarity="Rare"].active     { background: rgba(33,150,243,0.3); border-color: #64b5f6; color: #90caf9; }
.rarity-btn[data-rarity="Legendary"].active{ background: rgba(255,152,0,0.3);  border-color: #ffb74d; color: #ffcc80; }
.rarity-btn[data-rarity="Mythical"].active { background: rgba(156,39,176,0.3); border-color: #ce93d8; color: #e1bee7; }
.rarity-btn[data-rarity="God"].active      { background: rgba(128,0,128,0.3);  border-color: #ba68c8; color: #ce93d8; }

.checkbox-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.65); cursor: pointer;
  padding: 8px 16px; background: rgba(255,255,255,0.05); border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1); transition: all 0.2s;
}
.checkbox-label:hover { background: rgba(255,255,255,0.1); color: white; }
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: #FFD700; cursor: pointer; }

/* Table */
.table-wrap {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px; overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  background: rgba(255,107,107,0.07); color: rgba(255,255,255,0.6);
  padding: 14px 12px; text-align: center; font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
  border: none; position: sticky; top: 0; z-index: 10;
}
td { padding: 11px 12px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.05); color: white; }
tbody tr { cursor: pointer; transition: background-color 0.15s ease; }
tbody tr:hover td { background: rgba(255,215,0,0.06); }

/* Medal rows */
.gold-row   td { background: rgba(255,215,0,0.08);   border-bottom-color: rgba(255,215,0,0.15); }
.silver-row td { background: rgba(192,192,192,0.07); border-bottom-color: rgba(192,192,192,0.12); }
.bronze-row td { background: rgba(205,127,50,0.07);  border-bottom-color: rgba(205,127,50,0.12); }

/* My row */
tbody tr.my-row td { background: rgba(78,205,196,0.1) !important; border-bottom: 1px solid rgba(78,205,196,0.2) !important; }
tbody tr.my-row td:first-child { border-left: 3px solid #4ECDC4; }
tbody tr.my-row:hover td { background: rgba(78,205,196,0.18) !important; }
.you-tag { display: inline-block; font-size: 8px; font-weight: 800; padding: 1px 5px; border-radius: 5px; margin-left: 5px; background: rgba(78,205,196,0.25); color: #4ECDC4; border: 1px solid rgba(78,205,196,0.4); vertical-align: middle; }

/* Rank badges */
.rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; font-size: 0.9rem; color: white; }
.rank-1 { background: linear-gradient(45deg,#FFD700,#FFA500); box-shadow: 0 0 12px rgba(255,215,0,0.35); }
.rank-2 { background: linear-gradient(45deg,#C0C0C0,#E8E8E8); color: #333; }
.rank-3 { background: linear-gradient(45deg,#CD7F32,#DAA520); }
.rank-other { background: rgba(60,60,80,0.8); font-size: 0.8rem; }

/* Sprite */
img.catchmon-sprite { width: 54px; height: 54px; object-fit: contain; border-radius: 10px; transition: transform 0.2s; border: 1px solid rgba(255,255,255,0.1); }
img.catchmon-sprite:hover { transform: scale(1.12); }

/* Cells */
.name-cell   { font-weight: 700; font-size: 0.9rem; }
.points-cell { font-weight: 800; color: #FFD700; }
.level-cell  { font-weight: 700; color: #4ECDC4; }
.stats-cell  { font-weight: 600; color: #FF6B6B; }
.shiny-badge { font-size: 18px; }
.catcher-cell { font-weight: 600; }

/* Rarity pills */
.rarity-pill { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 7px; margin-left: 4px; vertical-align: middle; }
.rarity-common   { background: rgba(158,158,158,0.2); color: #e0e0e0; }
.rarity-starter  { background: rgba(76,175,80,0.2);   color: #a5d6a7; }
.rarity-rare     { background: rgba(33,150,243,0.2);  color: #90caf9; }
.rarity-legendary{ background: rgba(255,152,0,0.2);   color: #ffcc80; }
.rarity-mythical { background: rgba(156,39,176,0.2);  color: #e1bee7; }
.rarity-god      { background: rgba(128,0,128,0.2);   color: #ce93d8; }

/* Name tiers */
.catcher-name { font-weight: 800; background-size: 200% auto; background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: shine 3s linear infinite; cursor: pointer; }
.king,.god { background-image: linear-gradient(90deg,#ffd700,#fff,#ffd700); }
.flame     { background-image: linear-gradient(90deg,#ff4444,#fff,#ff4444); }
.diamond   { background-image: linear-gradient(90deg,#00bfff,#fff,#00bfff); }
.shine     { background-image: linear-gradient(90deg,#32cd32,#fff,#32cd32); }
.normal    { color: white; background: none; -webkit-text-fill-color: white; animation: none; }
@keyframes shine { to { background-position: -200% center; } }

/* Loading */
.loading { text-align: center; padding: 48px; color: rgba(255,255,255,0.4); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.spinner { width: 22px; height: 22px; border: 2px solid rgba(255,255,255,0.15); border-top-color: #FFD700; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* FAB */
.refresh-fab {
  position: fixed; bottom: 20px; right: 20px;
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(45deg,#4ECDC4,#44A08D);
  border: none; color: white; font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3); z-index: 1000; transition: transform 0.2s;
}
.refresh-fab:hover { transform: scale(1.1); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 1024px) { th:nth-child(6), td:nth-child(6) { display: none; } }
@media (max-width: 768px) {
  .controls { flex-direction: column; align-items: flex-start; }
  .rarity-btn { padding: 6px 11px; font-size: 11px; }
  th:nth-child(7), td:nth-child(7) { display: none; }
  img.catchmon-sprite { width: 42px; height: 42px; }
  td, th { padding: 9px 6px; }
  h1 { letter-spacing: -1px; }
}
@media (max-width: 600px) { .table-wrap { overflow-x: auto; } table { min-width: 400px; } }
@media (max-width: 480px) {
  table { font-size: 12px; }
  img.catchmon-sprite { width: 34px; height: 34px; }
  .rank-badge { width: 28px; height: 28px; font-size: 0.75rem; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }