* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--tg-theme-bg-color, #ffffff);
  color: var(--tg-theme-text-color, #111111);
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--tg-theme-link-color, #2481cc);
  text-decoration: none;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--tg-theme-secondary-bg-color, #f0f0f0);
  color: var(--tg-theme-text-color, #111);
  font-weight: 600;
  font-size: 14px;
}

.tab-btn.active {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.field { margin-bottom: 18px; }
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
  margin-bottom: 6px;
}

input[type="date"] {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--tg-theme-hint-color, #ccc);
  background: var(--tg-theme-secondary-bg-color, #f7f7f7);
  color: var(--tg-theme-text-color, #111);
  font-size: 15px;
}

.segmented {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--tg-theme-hint-color, #ccc);
}

.seg-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--tg-theme-secondary-bg-color, #f7f7f7);
  color: var(--tg-theme-text-color, #111);
  font-size: 14px;
}

.seg-btn.active {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
}

.players-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.link-btn {
  border: none;
  background: none;
  color: var(--tg-theme-link-color, #2481cc);
  font-size: 13px;
  padding: 0;
}

.players-list {
  border: 1px solid var(--tg-theme-hint-color, #e5e5e5);
  border-radius: 10px;
  overflow: hidden;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--tg-theme-hint-color, #eee);
}

.player-row:last-child { border-bottom: none; }
.player-row input { width: 20px; height: 20px; }
.player-row label { font-size: 15px; }

.primary-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
  font-size: 16px;
  font-weight: 600;
}

.status {
  margin-top: 10px;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

.status.ok { color: #2e9c4c; }
.status.err { color: #d0342c; }

.loading { padding: 16px; text-align: center; opacity: 0.6; font-size: 14px; }

.rating-list { display: flex; flex-direction: column; gap: 10px; }

.rating-row { font-size: 14px; }
.rating-row .name-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.rating-row .name { font-weight: 600; }
.rating-row .total { opacity: 0.7; }

.bar-track {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--tg-theme-secondary-bg-color, #f0f0f0);
}

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