/* Poki Ranking page styles - dark theme matching analytics */
:root {
  --bg: #0f1923;
  --card: #1a2736;
  --card-border: #2a3a4a;
  --text: #e0e6ed;
  --text-muted: #8899aa;
  --accent: #00d4aa;
  --accent2: #667eea;
  --red: #ff6b6b;
  --orange: #ffa94d;
  --green: #51cf66;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

.content {
  padding: 24px 30px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cat-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.cat-btn.active {
  background: var(--accent);
  color: #0f1923;
  border-color: var(--accent);
}

/* Trending panel */
.trending-panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.trending-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.trending-icon-link {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.trending-icon-link:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--orange);
}

.trending-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Split view */
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Ranking Table */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.ranking-table thead th {
  background: #15202c;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.ranking-table tbody tr {
  border-bottom: 1px solid rgba(42, 58, 74, 0.5);
  transition: background 0.15s;
}

.ranking-table tbody tr:hover {
  background: rgba(0, 212, 170, 0.05);
}

.ranking-table tbody tr:last-child {
  border-bottom: none;
}

.ranking-table td {
  padding: 6px 10px;
  vertical-align: middle;
}

/* Rank cell */
.rank-cell {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}

.rank-cell .rank-num {
  display: block;
}

.rank-cell .rank-change {
  font-size: 10px;
  font-weight: 600;
  margin-top: 1px;
}

.rank-change.up {
  color: var(--green);
}

.rank-change.down {
  color: var(--red);
}

.rank-change.same {
  color: var(--text-muted);
  font-size: 10px;
}

/* Top 3 styling */
.ranking-table tbody tr:nth-child(1) .rank-cell .rank-num,
.ranking-table tbody tr:nth-child(2) .rank-cell .rank-num,
.ranking-table tbody tr:nth-child(3) .rank-cell .rank-num {
  color: var(--accent);
  font-size: 16px;
}

/* Column sub-header (sortable) */
.ranking-table thead tr.col-head th {
  font-size: 10px;
  padding: 6px 8px;
  text-align: center;
  background: #131c26;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.12s;
}
.ranking-table thead tr.col-head th:hover {
  color: var(--text);
}
.ranking-table thead tr.col-head th.sorted {
  color: var(--accent);
}
.ranking-table thead tr.col-head th.col-title,
.ranking-table thead tr.col-head th.col-developer {
  text-align: left;
}

/* Developer ranking */
.dev-col {
  text-align: left;
}

/* Our studio highlight (stronger than the generic .our-game).
   Uses both classes to outrank the .our-game background rule. */
.ranking-table tbody tr.our-game.our-studio {
  background: rgba(0, 212, 170, 0.18);
}
.ranking-table tbody tr.our-game.our-studio:hover {
  background: rgba(0, 212, 170, 0.26);
}
.ranking-table tbody tr.our-game.our-studio td {
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
}
.dev-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: color 0.12s;
}
.dev-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Single (unified) view: full-width table */
.single-view .ranking-table {
  width: 100%;
}

/* Genre filter banner */
.filter-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}
.filter-banner strong {
  color: var(--accent);
}
.filter-count {
  color: var(--text-muted);
  font-size: 12px;
}
.filter-clear {
  margin-left: auto;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid transparent;
  color: var(--red);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.filter-clear:hover {
  border-color: var(--red);
}

.empty-row {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

/* Play button overlay on the game icon */
.play-link {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
}
.play-link .game-icon {
  width: 100%;
  height: 100%;
}
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.15s;
}
.play-link:hover .play-overlay {
  opacity: 1;
}

/* Metadata cells */

/* Metadata cells */
.meta-cell {
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
}

.rating-cell .rating-val {
  font-weight: 700;
  font-size: 12px;
}
.rating-high { color: var(--green); }
.rating-mid  { color: var(--orange); }
.rating-low  { color: var(--red); }

.votes-cell {
  color: var(--text-muted);
  font-weight: 600;
}

.genre-cell {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.genre-badge {
  display: inline-block;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  background: rgba(102, 126, 234, 0.15);
  color: var(--accent2);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.game-updated {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.75;
  white-space: nowrap;
}

/* Game cell */
.game-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.game-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.game-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.game-title:hover {
  color: var(--accent);
}

.game-developer {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-trending {
  background: rgba(255, 169, 77, 0.15);
  color: var(--orange);
}

.badge-tile-3x3 {
  background: rgba(255, 107, 107, 0.15);
  color: var(--red);
}

.badge-tile-2x2 {
  background: rgba(102, 126, 234, 0.15);
  color: var(--accent2);
}

/* Our games highlight */
.ranking-table tbody tr.our-game {
  background: rgba(0, 212, 170, 0.08);
  border-left: 3px solid var(--accent);
}

.ranking-table tbody tr.our-game:hover {
  background: rgba(0, 212, 170, 0.12);
}

/* Loading */
#loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 16px;
}

.hidden {
  display: none !important;
}

/* Chart modal */
.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.chart-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  width: 90%;
  max-width: 720px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-game-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-game-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg);
}

.chart-game-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.chart-game-cat {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.chart-close:hover {
  color: var(--text);
}

.chart-container {
  height: 320px;
}

/* Responsive */
@media (max-width: 900px) {
  .split-view {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 16px;
  }
  .game-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }
  .ranking-table td, .ranking-table thead th {
    padding: 6px 8px;
  }
}
