:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #151515;
  --muted: #696560;
  --line: #dedbd4;
  --line-strong: #c9c5bd;
  --red: #c8102e;
  --green: #00875a;
  --blue: #2868a8;
  --gold: #b4842f;
  --shadow: 0 14px 34px rgba(22, 22, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 18px clamp(14px, 4vw, 42px) 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.1;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 0.96rem;
}

.dashboard {
  display: grid;
  gap: 12px;
  padding: 12px clamp(14px, 4vw, 42px) 32px;
}

.panel,
.filter-bar,
.table-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 12px;
}

.panel-header,
.table-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.meta,
.status {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.status {
  min-height: 1.2em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(94px, 1fr));
  gap: 8px;
}

.summary-item {
  min-width: 94px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.summary-item strong,
.summary-item span {
  display: block;
}

.summary-item strong {
  font-size: 0.92rem;
}

.summary-item span {
  color: var(--muted);
  font-size: 0.72rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

button:hover,
button:focus-visible {
  border-color: var(--red);
  outline: none;
}

.weight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 9px;
}

.weight-control {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.weight-label {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 800;
}

.weight-label span:last-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.weight-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 7px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--metric-color, var(--red));
}

input[type="number"],
input[type="search"],
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input[type="number"] {
  padding: 0 9px;
}

input[type="search"],
select {
  padding: 0 11px;
}

input:focus,
select:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(40, 104, 168, 0.16);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) minmax(130px, 160px);
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  border-left: 4px solid var(--red);
  background: linear-gradient(90deg, rgba(200, 16, 46, 0.08), #ffffff 76%);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.table-shell {
  overflow: hidden;
}

.table-header {
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1efe9;
  color: #3f3b36;
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

th:nth-child(3),
td:nth-child(3) {
  min-width: 210px;
  text-align: left;
}

tbody tr:hover {
  background: #fbfaf7;
}

.rank {
  color: var(--red);
  font-weight: 900;
}

.player-name {
  font-weight: 850;
}

.move {
  color: var(--muted);
  font-weight: 800;
}

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

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

.breakdown {
  display: flex;
  width: 210px;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e3dc;
}

.segment {
  min-width: 1px;
  background: var(--segment-color);
}

.empty-state {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .app-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-header,
  .table-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row {
    justify-content: flex-start;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 1.35rem;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .weight-grid {
    grid-template-columns: 1fr;
  }
}
