.history-main {
  padding: 5rem 2rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.history-login-required {
  text-align: center;
  padding: 4rem 2rem;
}

.history-login-required h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.history-login-required p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}


.history-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.history-search {
  flex: 1;
  max-width: 400px;
}

.history-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.history-item-star {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s, transform 0.15s;
}

.history-filter-btn {
  font-size: 0.7rem;
  padding: 0.4rem 0.8rem;
  white-space: nowrap;
}

.history-filter-btn.active {
  border-color: #f5c518;
  color: #f5c518;
  background: rgba(245, 197, 24, 0.08);
}

.history-item-star:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

.history-item-star:hover {
  color: var(--text);
  transform: scale(1.2);
}

.history-item-star.active {
  color: #f5c518;
}

.history-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}

.history-item-players {
  flex: 1;
  min-width: 0;
}

.history-item-title {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.3rem;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.history-item-tag {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.6rem;
  color: var(--text-dim);
}

.history-item-tag-eco {
  color: var(--red);
  border-color: var(--red-dim);
}

.history-item-result {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
  min-width: 40px;
  text-align: right;
}

.history-item-actions {
  display: flex;
  gap: 0.5rem;
}

.history-item-delete {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.history-item-delete:hover {
  color: var(--red);
  border-color: var(--red-dim);
}

.history-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.history-empty a {
  color: var(--red);
  text-decoration: none;
}

.history-empty a:hover {
  text-decoration: underline;
}

/* ── Batch Selection ─────────────────────────────── */
.history-item-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 2px solid var(--text-dim);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  margin: 0;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.history-item-checkbox:hover {
  border-color: var(--red);
}

.history-item-checkbox:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.history-item-checkbox:checked {
  background: var(--red);
  border-color: var(--red);
}

.history-item-checkbox:checked::after {
  content: '\2713';
  position: absolute;
  top: -1px;
  left: 2px;
  font-size: 13px;
  color: #fff;
  font-weight: 700;
}

.history-item.selected {
  border-color: var(--red);
  background: rgba(255, 10, 43, 0.04);
}

.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  gap: 1rem;
}

.batch-count {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}

.batch-actions {
  display: flex;
  gap: 0.5rem;
}

.batch-delete-btn {
  color: var(--red) !important;
  border-color: var(--red) !important;
}

.batch-delete-btn:hover {
  background: rgba(255, 10, 43, 0.1) !important;
}

/* ── Confirm Modal ───────────────────────────────── */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.confirm-modal-overlay.hidden {
  display: none;
}

.confirm-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.confirm-modal-message {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.confirm-modal-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-delete-btn {
  background: var(--red) !important;
  border-color: var(--red) !important;
  color: #fff !important;
}

.confirm-delete-btn:hover {
  filter: brightness(1.1);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 600px) {
  .history-main {
    padding: 4rem 1rem 1rem;
  }

  .history-search {
    max-width: none;
  }

  .history-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .history-item {
    flex-wrap: wrap;
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .history-item-title {
    white-space: normal;
  }

  .history-item-delete {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }
}
