*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f0f1a;
  color: #e0e0f0;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 32px 40px 24px;
  border-bottom: 1px solid #2a2a4a;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}

header h1 span { color: #e94560; }

header p {
  margin-top: 6px;
  color: #8888aa;
  font-size: 0.95rem;
}

.stat-bar {
  display: flex;
  gap: 24px;
  padding: 20px 40px;
  background: #12122a;
  border-bottom: 1px solid #2a2a4a;
  flex-wrap: wrap;
}

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

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #e94560;
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: #6666aa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-sep { width: 1px; background: #2a2a4a; align-self: stretch; }

.controls {
  display: flex;
  gap: 16px;
  padding: 18px 40px;
  background: #0f0f1a;
  border-bottom: 1px solid #1e1e3a;
  flex-wrap: wrap;
  align-items: center;
}

.controls label { font-size: 0.85rem; color: #8888aa; margin-right: 6px; }

.controls select, .controls input {
  background: #1a1a30;
  border: 1px solid #2a2a4a;
  color: #e0e0f0;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.controls select:hover, .controls input:hover { border-color: #e94560; }

.controls input[type="text"] { min-width: 200px; }

.btn-reset {
  background: #e94560;
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-reset:hover { background: #c73550; }

.main {
  padding: 28px 40px;
  display: grid;
  gap: 28px;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.chart-row.wide { grid-template-columns: 2fr 1fr; }

.card {
  background: #12122a;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 22px 24px;
  position: relative;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #cccce0;
  margin-bottom: 18px;
  letter-spacing: 0.2px;
}

.card h2 small {
  font-size: 0.75rem;
  font-weight: 400;
  color: #5555aa;
  margin-left: 8px;
}

.chart-wrap {
  position: relative;
  width: 100%;
}

/* Table */
.table-card { overflow: hidden; }

.table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead th {
  background: #1a1a35;
  padding: 10px 14px;
  text-align: left;
  color: #8888bb;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.73rem;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

thead th:hover { color: #e94560; }

thead th.asc::after { content: ' ↑'; }
thead th.desc::after { content: ' ↓'; }

tbody tr { border-bottom: 1px solid #1e1e38; transition: background 0.15s; }
tbody tr:hover { background: #1a1a38; }

td {
  padding: 9px 14px;
  color: #ccccee;
  white-space: nowrap;
}

td.studio { color: #fff; font-weight: 500; }
td.headcount { color: #e94560; font-weight: 600; }
td.unknown { color: #444466; font-style: italic; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-console   { background: #1e3a5f; color: #5badf0; }
.badge-indie     { background: #2d1f4a; color: #b380f5; }
.badge-mobile    { background: #1f3d2a; color: #50c878; }
.badge-online    { background: #3d2a1a; color: #f5a050; }
.badge-arvr      { background: #3d1a2a; color: #f080a0; }
.badge-publisher { background: #2a2a1a; color: #d4c050; }
.badge-tech      { background: #1a2a3a; color: #50d0d0; }
.badge-other     { background: #2a2a2a; color: #888; }

.no-results {
  text-align: center;
  padding: 40px;
  color: #444466;
  font-size: 0.9rem;
}

#result-count {
  font-size: 0.8rem;
  color: #5555aa;
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .chart-row, .chart-row.wide { grid-template-columns: 1fr; }
  .main, .stat-bar, .controls { padding-left: 16px; padding-right: 16px; }
  header { padding: 24px 16px 18px; }
}
