.history-page-body {
  --history-ball-red: #e34e4c;
  --history-ball-blue: #3980c5;
  --history-ball-green: #48a36c;
  min-height: 100vh;
  margin: 0;
  background: #f3f6f5;
  color: #23332f;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.history-page-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 54px;
  padding: 0 12px;
  border-bottom: 1px solid #e6ece9;
  background: rgba(255, 255, 255, 0.97);
}

.history-back {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #17766a;
  font-size: 32px;
  line-height: 1;
  text-decoration: none;
}

.history-back:hover {
  background: #edf5f2;
}

.history-page-header h1 {
  overflow: hidden;
  margin: 0;
  color: #253832;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-page-main {
  width: min(100%, 760px);
  min-height: calc(100vh - 54px);
  margin: 0 auto;
  padding: 14px 14px 32px;
}

.history-year-filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 1px 0 10px;
  scrollbar-width: thin;
}

.history-year-filter {
  flex: 0 0 auto;
  min-width: 70px;
  padding: 8px 13px;
  border: 1px solid #dfe8e4;
  border-radius: 18px;
  background: #fff;
  color: #52635d;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.history-year-filter.is-selected {
  border-color: #187b6c;
  background: #187b6c;
  color: #fff;
}

.history-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid #e5ece8;
  border-radius: 10px;
  background: #eaf0ed;
}

.history-view-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #60716b;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.history-view-switch button.is-selected {
  background: #fff;
  box-shadow: 0 1px 4px rgba(27, 55, 45, 0.1);
  color: #167465;
  font-weight: 700;
}

.history-page-status {
  margin: 12px 2px 10px;
  color: #71817b;
  font-size: 12px;
  line-height: 1.6;
}

.history-list-panel {
  display: grid;
  gap: 11px;
}

.history-record-card {
  overflow: hidden;
  border: 1px solid #e8eeeb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(38, 65, 54, 0.04);
}

.history-record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin: 0;
  padding: 0 13px;
  background: #15776a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.history-record-heading time {
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 400;
}

.history-record-result {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(2px, 1.25vw, 9px);
  padding: 12px 8px 11px;
}

.history-number {
  display: flex;
  flex: 0 1 43px;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 5px;
}

.history-number-ball {
  position: relative;
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.history-number-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.history-number-label {
  position: relative;
  z-index: 1;
  color: #212121;
}

.history-number-ball--red,
.history-number-ball--blue,
.history-number-ball--green {
  color: #212121;
}

.history-number-ball.is-special {
  outline: 2px solid #e6c876;
  outline-offset: 1px;
}

.history-number-attribute {
  color: #667771;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.history-special-plus {
  align-self: flex-start;
  padding-top: 10px;
  color: #87958f;
  font-size: 16px;
  font-weight: 700;
}

.history-empty-state {
  margin: 0;
  padding: 30px 16px;
  border: 1px dashed #dce5e1;
  border-radius: 10px;
  background: #fff;
  color: #73827c;
  font-size: 14px;
  text-align: center;
}

.history-trend-panel {
  overflow: hidden;
  border: 1px solid #e8eeeb;
  border-radius: 10px;
  background: #fff;
}

.history-trend-panel[hidden],
.history-list-panel[hidden] {
  display: none !important;
}

.history-trend-controls {
  padding: 8px 10px 0;
}

.history-trend-categories {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.history-trend-category,
.history-trend-period,
.history-trend-scroll-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #d8dfdc;
  border-radius: 4px;
  background: #f7f8f8;
  color: #34443e;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
}

.history-trend-category.is-selected,
.history-trend-period.is-selected {
  border-color: #278b5e;
  background: #278b5e;
  color: #fff;
}

.history-trend-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding-bottom: 8px;
  color: #667771;
  font-size: 12px;
}

.history-trend-scroll-button.is-left {
  margin-left: auto;
}

.history-trend-scroll {
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
}

.history-trend-table {
  border-collapse: collapse;
  color: #9aa5a0;
  font-size: 11px;
  text-align: center;
  table-layout: fixed;
  width: 100%;
}

.history-trend-table--numbers {
  min-width: 1246px;
  width: 1246px;
}

.history-trend-table--numbers th:not(.history-trend-issue),
.history-trend-table--numbers td {
  width: 24px;
  min-width: 24px;
  padding-right: 1px;
  padding-left: 1px;
}

.history-trend-table:not(.history-trend-table--numbers) {
  min-width: 480px;
}

.history-trend-table th,
.history-trend-table td {
  height: 23px;
  padding: 1px 2px;
  border: 1px solid #e8ecef;
  font-weight: 400;
  white-space: nowrap;
}

.history-trend-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #f7f8f9;
  color: #34443e;
  font-weight: 600;
}

.history-trend-table .history-trend-issue {
  position: sticky;
  z-index: 1;
  left: 0;
  width: 64px;
  min-width: 64px;
  background: #f7f8f9;
  color: #697771;
}

.history-trend-table thead .history-trend-issue {
  z-index: 3;
}

.history-trend-miss {
  color: #a9b2ae;
}

.history-trend-hit {
  box-sizing: border-box;
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.history-trend-hit--red {
  background: #e53935;
}

.history-trend-hit--blue {
  background: #1e88e5;
}

.history-trend-hit--green {
  background: #43a047;
}

.history-trend-hit.is-special {
  border: 2px solid #f5d431;
}

.history-trend-table tfoot th,
.history-trend-table tfoot td {
  background: #fff;
  color: #56665f;
  font-size: 10px;
}

.history-page-pagination[hidden] {
  display: none;
}

@media (max-width: 390px) {
  .history-trend-controls {
    padding-right: 7px;
    padding-left: 7px;
  }

  .history-trend-options {
    gap: 4px;
  }

  .history-trend-category,
  .history-trend-period,
  .history-trend-scroll-button {
    padding-right: 7px;
    padding-left: 7px;
  }
}

.history-page-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  padding: 18px 0 4px;
  color: #65756e;
  font-size: 13px;
}

.history-page-pagination button {
  min-width: 78px;
  padding: 8px 12px;
  border: 1px solid #dce6e1;
  border-radius: 7px;
  background: #fff;
  color: #3d554b;
  cursor: pointer;
  font: inherit;
}

.history-page-pagination button:disabled {
  color: #a7b2ad;
  cursor: not-allowed;
}

@media (max-width: 390px) {
  .history-page-main {
    padding-right: 9px;
    padding-left: 9px;
  }

  .history-record-result {
    gap: 2px;
    padding-right: 5px;
    padding-left: 5px;
  }

  .history-number-ball {
    width: 35px;
    height: 35px;
    flex-basis: 35px;
    font-size: 14px;
  }

  .history-number-attribute {
    font-size: 9px;
  }
}
