/* =========================================================================
   MODALS — shared overlay + the rating history & profile dialogs
   ========================================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;              /* floats above the backdrop */
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Clickable rating badges — same look, plus an inviting hover ring */
.stats-badge-btn { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.stats-badge-btn:hover,
button.rating-chip:hover { box-shadow: 0 0 0 2px rgba(147, 197, 253, .45); transform: translateY(-1px); }
button.rating-chip { cursor: pointer; transition: box-shadow .15s, transform .15s; }

/* ---------- Rating history ---------- */
.history-card { width: min(920px, 100%); }

.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-top h3 { font-size: 17px; }

.history-top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-top-actions .ghost-btn { margin-top: 0; }

.history-modes {
  display: flex;
  gap: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.mode-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}

.mode-chip.active { background: var(--accent-green); color: #fff; }
.mode-chip:not(.active):hover { color: var(--text-main); }

.bots-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }

.history-chart-wrap {
  position: relative;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
}

.history-chart-wrap.dragging { cursor: grabbing; }

#history-chart { display: block; width: 100%; height: min(42vh, 340px); }

.history-tooltip {
  position: absolute;
  pointer-events: none;
  background: #191816;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-main);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
  max-width: 240px;
  z-index: 5;
}

.history-list {
  overflow-y: auto;
  min-height: 0;
  max-height: 22vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.history-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--line);
  background: rgba(255, 255, 255, .03);
}

.history-row.row-win  { border-left-color: var(--accent-emerald); }
.history-row.row-loss { border-left-color: #EF4444; }
.history-row.row-hint { border-left-color: #f59e0b; }
.history-row.row-hint .row-delta { color: #FDBA74; }

.history-row .row-time  { color: var(--text-muted); white-space: nowrap; }
.history-row .row-what  { flex: 1; }
.history-row .row-delta { font-weight: 800; white-space: nowrap; }
.history-row.row-win  .row-delta { color: #6EE7B7; }
.history-row.row-loss .row-delta { color: #FCA5A5; }

.history-empty { color: var(--text-muted); font-size: 13.5px; text-align: center; padding: 20px; }

/* ---------- Local profile ---------- */
.profile-card { width: min(430px, 100%); }

.field-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-top: 4px;
}

.field-input {
  font: inherit;
  color: var(--text-main);
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field-input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(129, 182, 76, .18);
}

.modal-actions { display: flex; gap: 10px; margin-top: 6px; }

/* The signed-in chip that replaces Sign Up / Log In in the sidebar */
.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(129, 182, 76, .1);
  border: 1px solid rgba(129, 182, 76, .35);
  text-align: left;
  transition: background .15s, border-color .15s;
}

.profile-chip:hover { background: rgba(129, 182, 76, .18); border-color: var(--accent-green); }

.profile-avatar { font-size: 22px; }

.profile-meta { display: flex; flex-direction: column; line-height: 1.25; }
.profile-meta b { font-size: 14px; }
.profile-meta small { font-size: 11px; color: var(--text-muted); }

