/* Rival explorer-only rules. Personal Opening Explorer is unchanged. */
.cxo-wrap.is-rival.is-no-eval .cxo-eval,
.cxo-wrap.is-rival.is-no-eval .cxo-icon-legend,
.cxo-wrap.is-rival.is-no-eval .cxo-comp-tip {
  display: none;
}
.cxo-wrap.is-rival.is-no-eval .cxo-board-nav {
  padding-left: 0;
}
.cxo-wrap.is-rival.is-no-eval .cxo-table th:nth-child(5),
.cxo-wrap.is-rival.is-no-eval .cxo-table td:nth-child(5) {
  display: none;
}
.cxo-wrap.is-rival .cxo-field.is-hidden-filter,
.cxo-wrap.is-rival .cxo-field[hidden] {
  display: none;
}

/* ---- Rival landing (list, search, pending placeholder) ---- */
#cxo-app[data-cxo-view="list"] .cxo-view-detail,
#cxo-app[data-cxo-view="list"] .cxo-view-pending,
#cxo-app[data-cxo-view="detail"] .cxo-view-list,
#cxo-app[data-cxo-view="detail"] .cxo-view-pending,
#cxo-app[data-cxo-view="pending"] .cxo-view-list,
#cxo-app[data-cxo-view="pending"] .cxo-view-detail,
#cxo-app:not([data-cxo-view]) .cxo-view-detail,
#cxo-app:not([data-cxo-view]) .cxo-view-pending,
html[data-cxo-view="list"] .cxo-view-detail,
html[data-cxo-view="list"] .cxo-view-pending,
html[data-cxo-view="detail"] .cxo-view-list,
html[data-cxo-view="detail"] .cxo-view-pending,
html[data-cxo-view="pending"] .cxo-view-list,
html[data-cxo-view="pending"] .cxo-view-detail {
  display: none;
}

.cxo-back {
  margin: 0 0 16px;
}
.cxo-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  font-weight: 650;
}

.cxo-lookup-heading {
  margin: 0 0 14px;
  font-size: 20px;
  color: var(--cxp-navy);
}
.cxo-lookup {
  margin: 0 0 28px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--cxp-border);
  border-radius: var(--cxp-radius);
  box-shadow: var(--cxp-shadow);
}
.cxo-lookup-form {
  display: grid;
  gap: 16px;
}
.cxo-seg-field {
  margin: 0;
  border: 0;
  padding: 0;
  min-width: 0;
}
.cxo-seg-field legend,
.cxo-lookup-label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--cxp-muted);
}
.cxo-seg {
  display: flex;
  width: 100%;
  max-width: 420px;
  padding: 4px;
  border-radius: 10px;
  background: var(--cxp-accent-050);
  border: 1px solid var(--cxp-border);
}
.cxo-seg-opt {
  flex: 1 1 0;
  position: relative;
  margin: 0;
  display: flex;
}
.cxo-seg-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cxo-seg-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 650;
  color: var(--cxp-navy);
  cursor: pointer;
}
.cxo-seg-opt input:checked + span {
  background: #fff;
  color: var(--cxp-navy);
  box-shadow: 0 1px 2px rgba(14,31,58,.08);
}
.cxo-seg-opt input:focus-visible + span {
  box-shadow: var(--cxp-focus);
}
.cxo-lookup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.cxo-lookup-field {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
}
.cxo-lookup-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--cxp-border);
  border-radius: 8px;
  background: #fff;
  color: var(--cxp-navy);
  font-size: 16px;
}
.cxo-lookup-field input:focus-visible {
  outline: none;
  border-color: var(--cxp-accent-700);
  box-shadow: 0 0 0 3px rgba(29,111,209,.25);
}
.cxo-lookup-submit {
  flex: 0 0 auto;
}
.cxo-lookup-status {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--cxp-text);
}
.cxo-lookup-status.is-error { color: #8a1c12; }
.cxo-lookup-status.is-loading { color: var(--cxp-muted); }

.cxo-lookup-result { margin-top: 16px; }
.cxo-result-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 12px;
  background: var(--cxp-accent-050);
  border: 1px solid var(--cxp-border);
}
.cxo-result-avatar {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: #fff;
}
.cxo-result-body { flex: 1 1 auto; min-width: 0; }
.cxo-result-name,
.cxo-rival-name {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  color: var(--cxp-navy);
  line-height: 1.25;
}
.cxo-result-realname,
.cxo-rival-realname {
  margin: 4px 0 0;
  color: var(--cxp-muted);
  font-size: 14.5px;
}
.cxo-result-platform,
.cxo-rival-platform { margin: 8px 0 0; }
.cxo-platform-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--cxp-border);
  color: var(--cxp-navy);
}
.cxo-platform-badge.is-lichess { background: #efefef; }
.cxo-platform-badge.is-chesscom { background: #fff; border-color: #8FB4D8; }
.cxo-rival-title,
.cxo-result-name .cxo-rival-title {
  display: inline-block;
  margin-right: 6px;
  color: var(--cxp-accent-700);
  font-weight: 800;
  letter-spacing: .02em;
}
.cxo-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.cxo-ratings li { margin: 0; font-size: 15px; }
.cxo-rating-label { color: var(--cxp-muted); font-weight: 600; }
.cxo-rating-val { font-weight: 750; color: var(--cxp-navy); }
.cxo-result-link { margin: 10px 0 0; }
.cxo-result-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cxo-result-already { margin: 0; font-weight: 650; color: var(--cxp-muted); }

.cxo-rivals-sec { margin: 8px 0 24px; }
.cxo-rivals-sec h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--cxp-navy);
}
.cxo-save-note,
.cxo-empty {
  margin: 0 0 14px;
  color: var(--cxp-muted);
  font-size: 15px;
}
.cxo-rival-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cxo-rival-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--cxp-border);
  border-radius: var(--cxp-radius);
  box-shadow: var(--cxp-shadow);
}
.cxo-rival-id {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  flex: 1 1 220px;
}
.cxo-rival-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
  background: var(--cxp-accent-050);
}
.cxo-rival-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--cxp-accent-700);
}
.cxo-rival-meta { min-width: 0; }
.cxo-rival-rating,
.cxo-rival-refreshed {
  margin: 2px 0 0;
  font-size: 14.5px;
  color: var(--cxp-muted);
}
.cxo-rival-rating { font-weight: 650; color: var(--cxp-text); }
.cxo-rival-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 1 auto;
}
.cxo-rival-actions .cxp-btn { min-height: 44px; }
.cxo-row-error {
  flex: 1 1 100%;
  margin: 0;
  color: #8a1c12;
  font-weight: 650;
  font-size: 14.5px;
}

.cxo-btn-danger {
  background: #b42318;
  color: #fff !important;
  border-color: #b42318;
}
.cxo-btn-danger:hover { background: #8f1b12; border-color: #8f1b12; }

.cxo-del-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 31, 58, .45);
  z-index: 80;
}
.cxo-del-dialog {
  position: fixed;
  z-index: 81;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 22px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(14,31,58,.2);
}
.cxo-del-dialog h2 {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--cxp-navy);
}
.cxo-del-dialog p { margin: 0 0 18px; color: var(--cxp-text); }
.cxo-del-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.cxo-toast {
  position: fixed;
  z-index: 82;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  max-width: calc(100% - 24px);
  padding: 8px 8px 8px 16px;
  background: var(--cxp-navy);
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(14,31,58,.25);
}
.cxo-toast[hidden] { display: none !important; }
.cxo-toast p { margin: 0; font-weight: 600; }
.cxo-toast button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--cxp-accent);
  color: var(--cxp-navy);
  font-weight: 750;
  cursor: pointer;
}
.cxo-toast button:focus-visible { box-shadow: var(--cxp-focus); outline: none; }

.cxo-pending-box {
  margin: 0 0 24px;
  padding: 20px;
  background: var(--cxp-accent-050);
  border: 1px solid var(--cxp-border);
  border-radius: var(--cxp-radius);
}

@media (max-width: 640px) {
  .cxo-lookup-row { flex-direction: column; align-items: stretch; }
  .cxo-lookup-submit { width: 100%; }
  .cxo-rival-actions { width: 100%; }
  .cxo-rival-actions .cxp-btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .cxo-result-card { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .cxo-seg-opt span, .cxp-btn, .cxo-del-dialog { transition: none; }
}

.cxo-job {
  margin: 8px 0 0;
}
.cxo-job-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14.5px;
  font-weight: 750;
  color: var(--cxp-navy);
}
.cxo-job[data-job-status="ready"] .cxo-job-status { color: var(--cxp-win); }
.cxo-job[data-job-status="queued"] .cxo-job-status,
.cxo-job[data-job-status="downloading"] .cxo-job-status,
.cxo-job[data-job-status="computing"] .cxo-job-status { color: var(--cxp-accent-700); }
.cxo-job-note {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--cxp-muted);
  font-weight: 500;
}
.cxo-job-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--cxp-accent);
  border-top-color: var(--cxp-accent-700);
  flex: none;
  animation: cxo-spin 0.8s linear infinite;
}
@keyframes cxo-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .cxo-job-spinner { animation: none; border-top-color: var(--cxp-accent-700); opacity: 1; }
}

.cxo-open-wrap {
  position: relative;
  display: inline-flex;
}
.cxo-open-btn.is-disabled,
.cxo-open-wrap .cxo-open-btn[aria-disabled="true"] {
  background: #c7d2cc;
  color: #3d4a43 !important;
  cursor: not-allowed;
  pointer-events: auto;
}
.cxo-open-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--cxp-navy);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 8px 20px rgba(14,31,58,.2);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
.cxo-open-wrap:hover .cxo-open-tip,
.cxo-open-wrap:focus-within .cxo-open-tip {
  opacity: 1;
}
