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

:root {
  --bg:       #0e0e0e;
  --surface:  #161616;
  --surface2: #1e1e1e;
  --border:   #2a2a2a;
  --text:     #d4d4d4;
  --muted:    #666;
  --gold:     #c8a84b;
  --gold-dim: #9c7e35;
  --red:      #e05252;
  --orange:   #e0874a;
  --hover:    #1c1c1c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.4;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
}

.logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-row {
  display: flex;
  gap: 6px;
  flex: 1;
}

input[type="text"] {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus { border-color: var(--gold-dim); }
input[type="text"]::placeholder { color: var(--muted); }

button {
  background: var(--gold);
  color: #000;
  border: none;
  padding: 7px 18px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

button:hover:not(:disabled) { opacity: 0.85; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Main container ──────────────────────────────────────── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
}

#status {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

/* ── Report header ───────────────────────────────────────── */
.report-header {
  margin-bottom: 20px;
}

.report-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--muted);
  font-size: 12px;
}

.meta-badge {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-badge::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  background: var(--muted);
  border-radius: 50%;
}

.meta-badge:first-child::before { display: none; }

/* ── Role tabs ───────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 4px 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.3px;
  transition: color 0.15s;
  position: relative;
  bottom: -1px;
}

.tab:hover:not(:disabled) { color: var(--text); opacity: 1; }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); background: transparent; }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead { position: sticky; top: 52px; z-index: 5; }

th {
  background: var(--surface2);
  padding: 9px 12px;
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  user-select: none;
  transition: color 0.15s;
}

th:hover { color: var(--text); }
th.sort-active { color: var(--gold); }

th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.5;
  font-size: 10px;
}

th.sort-active .sort-arrow { opacity: 1; }

td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--hover); }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.player-name {
  font-weight: 600;
  font-size: 13px;
}

.class-cell { font-size: 12px; }
.spec-cell  { font-size: 12px; color: var(--muted); }

.role-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.role-Tank     { background: #1a2a3a; color: #5ba3e0; }
.role-Healer   { background: #1a3020; color: #5bc47a; }
.role-Caster   { background: #2a1a3a; color: #a07ae0; }
.role-Physical { background: #3a2010; color: #e0904a; }

.deaths-ok   { color: var(--muted); }
.deaths-mid  { color: var(--orange); font-weight: 600; }
.deaths-high { color: var(--red);    font-weight: 700; }

/* Bar sparkline for dmg/heal */
.bar-cell { min-width: 80px; }

.bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-bg {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  min-width: 40px;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.bar-fill-dmg  { background: #c07a3a; }
.bar-fill-heal { background: #3a9a4a; }

.bar-val {
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* Loading skeleton pulse */
.loading-text {
  color: var(--muted);
  font-size: 13px;
  padding: 32px 0;
  text-align: center;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 0;
  color: var(--muted);
  font-size: 14px;
}

.empty-state p { margin-top: 8px; font-size: 12px; }
