* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  margin: 0;
  padding: 16px;
  background: #f9f9f9;
  color: #222;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 16px 0;
}

h2 {
  font-size: 1.1rem;
  margin: 24px 0 8px 0;
}

/* Tab strips */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 2px solid #ddd;
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  margin-bottom: -2px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #000;
  background: #f0f0f0;
}

.tab-btn.active {
  color: #1a6eb5;
  border-bottom-color: #1a6eb5;
  font-weight: 600;
}

/* Controls row */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.controls label {
  font-size: 13px;
  color: #555;
}

.controls select,
.controls input[type="number"],
.controls input[type="text"] {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

.controls input[type="number"] {
  width: 60px;
}

.controls input[type="text"] {
  width: 160px;
}

/* Class filter buttons */
.class-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.class-btn {
  background: #fff;
  border: 1px solid #ccc;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 3px;
  color: #555;
}

.class-btn:hover {
  background: #f0f0f0;
}

.class-btn.active {
  background: #1a6eb5;
  border-color: #1a6eb5;
  color: #fff;
  font-weight: 600;
}

/* Rankings table */
table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 2px solid #ddd;
  background: #f5f5f5;
  white-space: nowrap;
  color: #444;
  font-weight: 600;
}

td {
  padding: 5px 8px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

tr:nth-child(even) td {
  background: #fafafa;
}

tr:hover td {
  background: #eef4ff;
}

td.rank {
  text-align: right;
  color: #888;
  width: 40px;
}

td.class-rank {
  text-align: right;
  color: #888;
  width: 40px;
}

td.col-class {
  text-align: center;
}

td.col-uspsa-id {
  text-align: center;
}

td.avg {
  text-align: right;
  font-weight: 600;
  width: 70px;
}

td.scores {
  color: #666;
  font-size: 12px;
  white-space: normal;
  min-width: 160px;
}

td.name a {
  color: #1a6eb5;
  text-decoration: none;
}

td.name a:hover {
  text-decoration: underline;
}

/* Match list */
.match-list {
  margin-top: 24px;
  border-top: 1px solid #ddd;
  padding-top: 12px;
}

.match-list h3 {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin: 0 0 8px 0;
}

.match-list table {
  font-size: 12px;
  color: #555;
}

.match-list td {
  padding: 3px 8px;
}

/* Shooter page */
.shooter-header {
  margin-bottom: 16px;
}

.shooter-header h1 {
  margin-bottom: 4px;
}

.shooter-header .uspsa-id {
  color: #888;
  font-size: 0.95rem;
}

.division-section {
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

.division-header {
  background: #f5f5f5;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid #e0e0e0;
  color: #333;
}

.division-header .meta {
  font-weight: normal;
  color: #666;
  margin-left: 8px;
}

.division-section table {
  font-size: 12px;
}

.division-section td {
  padding: 4px 8px;
}

.used-star {
  color: #e8a000;
  font-size: 14px;
}

tr.reentry-row td {
  color: #aaa;
}

.reentry-label {
  color: #aaa;
  font-size: 11px;
  font-style: italic;
}

/* Loading / error */
#loading {
  color: #888;
  padding: 20px 0;
  font-style: italic;
}

#error-msg {
  color: #c00;
  padding: 12px;
  background: #fff0f0;
  border: 1px solid #fcc;
  border-radius: 4px;
  display: none;
}

/* Summary panel */
#summary-panel {
  padding: 8px 0;
}

.charts-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.chart-container {
  flex: 1;
  min-width: 280px;
  max-width: 500px;
  position: relative;
  height: 380px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 16px;
}

/* Responsive tweaks */
@media (max-width: 600px) {
  body {
    padding: 8px;
  }
  .controls {
    gap: 8px;
  }
  td.scores {
    display: none;
  }
  .tab-btn {
    padding: 5px 8px;
    font-size: 12px;
  }
}
