.page.history-page {
  min-height: 100vh;
  position: relative;
}

.history-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.history-topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 46px;
  padding: 0 6px;
  background: linear-gradient(180deg, #35b65a 0%, #1f9a47 100%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.history-topbar-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 88px);
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.history-topbar-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.history-topbar-home {
  font-size: 22px;
}

.history-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.history-filter-label {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: bold;
  color: #333;
}

.history-year-select {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  color: #333;
}

.history-pull {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  font-size: 13px;
  color: #666;
  background: #f5f5f5;
  transition: height 0.2s;
}

.history-pull.is-visible {
  height: 40px;
}

.history-pull.is-loading {
  height: 40px;
}

.history-pull-spin {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(31, 154, 71, 0.25);
  border-top-color: #1f9a47;
  border-radius: 50%;
  animation: history-spin 0.7s linear infinite;
}

.history-pull.is-loading .history-pull-spin {
  display: inline-block;
}

.history-main {
  min-height: calc(100vh - 46px - 57px - 8px);
  background: #fff;
  padding-bottom: 12px;
}

.history-list {
  background: #fff;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-bottom: 1px solid #eee;
}

.history-item-meta {
  flex-shrink: 0;
  width: 74px;
}

.history-item-date {
  font-size: 12px;
  color: #999;
  line-height: 1.3;
}

.history-item-period {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 900;
  color: #111;
  line-height: 1.2;
}

.history-item-balls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2px;
}

.history-ball-wrap {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.history-ball {
  width: 100%;
  max-width: 42px;
  height: 42px;
  border: none;
  border-radius: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  color: #111;
  line-height: 1;
  padding: 0;
  box-sizing: border-box;
}

.history-ball-label {
  margin-top: 1px;
  font-size: 10px;
  color: #888;
  white-space: nowrap;
  line-height: 1.1;
  transform: scale(0.95);
}

.history-plus {
  flex: 0.55 1 0;
  min-width: 0;
  margin: 6px 0 0;
  font-size: 18px;
  font-weight: 900;
  color: #666;
  line-height: 1;
  text-align: center;
}

.history-status {
  padding: 16px 12px 24px;
  text-align: center;
  font-size: 14px;
  color: #999;
  background: #fff;
}

.history-status.is-error {
  color: #cc0000;
}

.history-wave-footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  transform: translateX(-50%);
  width: 100%;
  max-width: 640px;
  display: flex;
  height: 8px;
}

.history-wave-red {
  flex: 1;
  background: #cc0000;
}

.history-wave-blue {
  flex: 1;
  background: #0066cc;
}

.history-wave-green {
  flex: 1;
  background: #008800;
}

@keyframes history-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 360px) {
  .history-item-meta {
    width: 66px;
  }

  .history-item-period {
    font-size: 16px;
  }

  .history-ball {
    max-width: 36px;
    height: 36px;
    font-size: 13px;
  }
}
