/* EloTracker Archive Position Explorer (Lichess-style right-panel tab, Light & Dark Mode) */

/* Tighten 3-tab header slightly so Moves | Explorer | Insights + status fit cleanly at 260px+ */
.moves-panel .elo-side-tabs {
  gap: 1px;
  padding: 0 6px !important;
}

.moves-panel .elo-side-tab-btn {
  padding: 8px 6px;
  font-size: 11px;
  gap: 4px;
  letter-spacing: 0.03em;
}

.elo-exp-tab-ico {
  flex: none;
  opacity: 0.85;
}

/* Scrollable Explorer pane inside .moves-panel (matches #moves-list & .elo-side-insights height) */
.elo-side-explorer {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(var(--viewer-size, 560px) - 70px);
  overflow-y: auto;
  box-sizing: border-box;
  font-size: 12px;
  color: #1e293b;
  background: #ffffff;
}

.dark .elo-side-explorer {
  color: #e2e8f0;
  background: #1f2937;
}

.elo-side-explorer[hidden] {
  display: none !important;
}

/* Sub-toggle header strip: OTB Archive | Similar Structure */
.elo-exp-subtabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px 8px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 4;
}

.dark .elo-exp-subtabs {
  background: #182230;
  border-bottom-color: #334155;
}

.elo-exp-subtab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.elo-exp-subtab:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.elo-exp-subtab[aria-pressed="true"] {
  background: #ffffff;
  color: #1e40af;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.dark .elo-exp-subtab {
  color: #94a3b8;
}

.dark .elo-exp-subtab:hover {
  color: #f8fafc;
  background: #273449;
}

.dark .elo-exp-subtab[aria-pressed="true"] {
  background: #263244;
  color: #93c5fd;
  border-color: #475569;
  box-shadow: none;
}

.elo-exp-subtab-cnt {
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #334155;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.elo-exp-subtab[aria-pressed="true"] .elo-exp-subtab-cnt {
  background: #dbeafe;
  color: #1e40af;
}

.dark .elo-exp-subtab-cnt {
  background: #334155;
  color: #cbd5e1;
}

.dark .elo-exp-subtab[aria-pressed="true"] .elo-exp-subtab-cnt {
  background: rgba(59, 130, 246, 0.25);
  color: #bfdbfe;
}

/* Lichess-style Move Table */
.elo-exp-moves-head {
  display: grid;
  grid-template-columns: minmax(42px, auto) 28px 38px 1fr;
  align-items: center;
  gap: 5px;
  padding: 5px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dark .elo-exp-moves-head {
  color: #94a3b8;
  border-bottom-color: #334155;
  background: #1e293b;
}

.elo-exp-moves-head > :nth-child(2),
.elo-exp-moves-head > :nth-child(3) {
  text-align: right;
}

.elo-exp-moves-head > :nth-child(4) {
  text-align: center;
}

.elo-exp-move-row,
.elo-exp-sum-row {
  display: grid;
  grid-template-columns: minmax(42px, auto) 28px 38px 1fr;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 4px 8px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  color: inherit;
  text-align: left;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
}

.dark .elo-exp-move-row,
.dark .elo-exp-sum-row {
  border-bottom-color: #293548;
}

.elo-exp-move-row {
  cursor: pointer;
  transition: background 0.1s ease;
}

.elo-exp-move-row:hover {
  background: #eff6ff;
}

.dark .elo-exp-move-row:hover {
  background: #27364d;
}

.elo-exp-move-row:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.elo-exp-sum-row {
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  font-weight: 600;
}

.dark .elo-exp-sum-row {
  background: #182230;
  border-top-color: #334155;
  border-bottom-color: #334155;
}

.elo-exp-san {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .elo-exp-san {
  color: #f8fafc;
}

.elo-exp-pct {
  font-size: 11px;
  color: #64748b;
  text-align: right;
}

.dark .elo-exp-pct {
  color: #94a3b8;
}

.elo-exp-cnt {
  font-size: 11px;
  color: #475569;
  text-align: right;
  font-weight: 600;
}

.dark .elo-exp-cnt {
  color: #cbd5e1;
}

/* 3-segment Lichess W/D/L horizontal bar */
.elo-exp-wdl {
  display: flex;
  width: 100%;
  height: 17px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #9ca3af;
  box-sizing: border-box;
}

.dark .elo-exp-wdl {
  border-color: #475569;
  background: #64748b;
}

.elo-exp-wdl-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

.elo-exp-wdl-w {
  background: #ffffff;
  color: #1e293b;
}

.elo-exp-wdl-d {
  background: #9ca3af;
  color: #ffffff;
}

.elo-exp-wdl-b {
  background: #334155;
  color: #ffffff;
}

.dark .elo-exp-wdl-w {
  background: #f1f5f9;
  color: #0f172a;
}

.dark .elo-exp-wdl-d {
  background: #64748b;
  color: #ffffff;
}

.dark .elo-exp-wdl-b {
  background: #1e293b;
  color: #f8fafc;
}

/* Section bar for Top games / Same pawn structure & material */
.elo-exp-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.dark .elo-exp-sec-head {
  color: #cbd5e1;
  background: #182230;
  border-bottom-color: #334155;
}

.elo-exp-sec-badge {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.dark .elo-exp-sec-badge {
  color: #94a3b8;
}

/* Lichess 2-line compact Top games list */
.elo-exp-games {
  display: flex;
  flex-direction: column;
}

.elo-exp-game-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 38px 36px;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s ease;
}

.elo-exp-game-row:last-child {
  border-bottom: 0;
}

.elo-exp-game-row:hover {
  background: #eff6ff;
}

.dark .elo-exp-game-row {
  border-bottom-color: #293548;
}

.dark .elo-exp-game-row:hover {
  background: #27364d;
}

.elo-exp-g-elos,
.elo-exp-g-names,
.elo-exp-g-when {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.3;
}

.elo-exp-g-elos {
  font-size: 10.5px;
  color: #64748b;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dark .elo-exp-g-elos {
  color: #94a3b8;
}

.elo-exp-g-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .elo-exp-g-name {
  color: #f1f5f9;
}

.elo-exp-g-res {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.elo-exp-res-w {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.elo-exp-res-d {
  background: #9ca3af;
  color: #ffffff;
}

.elo-exp-res-b {
  background: #334155;
  color: #ffffff;
}

.dark .elo-exp-res-w {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.dark .elo-exp-res-d {
  background: #64748b;
  color: #ffffff;
}

.dark .elo-exp-res-b {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #475569;
}

.elo-exp-g-when {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.elo-exp-g-year {
  font-size: 10.5px;
  color: #475569;
  font-weight: 600;
}

.dark .elo-exp-g-year {
  color: #cbd5e1;
}

.elo-exp-g-ply {
  font-size: 10px;
  color: #64748b;
}

.dark .elo-exp-g-ply {
  color: #94a3b8;
}

.elo-exp-this-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  vertical-align: middle;
}

.dark .elo-exp-this-tag {
  background: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
}

/* Empty / status states */
.elo-exp-notice {
  padding: 10px 10px;
  font-size: 11.5px;
  color: #64748b;
  text-align: center;
  line-height: 1.45;
}

.dark .elo-exp-notice {
  color: #94a3b8;
}

.elo-exp-inline-banner {
  padding: 6px 8px;
  font-size: 11px;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  line-height: 1.35;
}

.dark .elo-exp-inline-banner {
  color: #cbd5e1;
  background: #182230;
  border-bottom-color: #334155;
}

@media (max-width: 699px) {
  .elo-side-explorer {
    max-height: 320px;
  }
}
