:root {
  --map-promising: #916b21;
  --map-promising-arrow: #a67c29;
}

html[data-theme="dark"] {
  --map-promising: #d8b96c;
}

:is(.inspector-board, .opening-map-repertoire-document-diagram) .cm-chessboard.opening-book .arrow-warning .arrow-head {
  fill: var(--map-promising-arrow);
}

:is(.inspector-board, .opening-map-repertoire-document-diagram) .cm-chessboard.opening-book .arrow-warning .arrow-line {
  stroke: var(--map-promising-arrow);
  stroke-linecap: round;
  opacity: 0.65;
}

.opening-map-explorer-database[hidden],
.opening-map-explorer-footer-database[hidden],
.opening-map-explorer-database [hidden] { display: none; }

.opening-map-explorer-database-description {
  margin: 0 0 20px;
  color: var(--map-muted);
  font: 400 15px/1.5 var(--map-ui-font);
}

.opening-map-explorer-database-actions {
  display: block;
  margin-top: 6px;
}

.opening-map-explorer-database-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--map-text);
  font: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.opening-map-explorer-database-action:hover { color: var(--map-accent); }
.opening-map-explorer-database-action:focus-visible,
.opening-map-explorer-database-score:focus-visible {
  outline: 1px solid var(--map-accent);
  outline-offset: 3px;
}

.opening-map-explorer-footer-database {
  display: inline-flex;
  align-items: center;
  color: var(--map-muted);
  font: 400 15px/1.3 var(--map-ui-font);
}
.opening-map-explorer-database-score {
  display: inline-grid;
  grid-template-columns: 16px 4ch auto;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.opening-map-explorer-database-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: currentColor;
  mask: url('/static/img/lichesslogo.svg') center / contain no-repeat;
}
.opening-map-explorer-database-score[data-sentiment="good"] > :is(.opening-map-explorer-database-icon, .opening-map-explorer-database-value) {
  color: var(--map-good);
}
.opening-map-explorer-database-score[data-sentiment="bad"] > :is(.opening-map-explorer-database-icon, .opening-map-explorer-database-value) {
  color: var(--map-bad);
}
.opening-map-explorer-database-games { display: none; }

.opening-map-settings-select,
.opening-map-settings-number {
  min-height: 32px;
  min-width: 0;
  box-sizing: border-box;
  padding: 5px 7px;
  border: 1px solid var(--map-border);
  border-radius: 5px;
  background: var(--map-control);
  color: var(--map-text);
  font: 400 15px/1.4 var(--map-ui-font);
}
.opening-map-settings-select:focus-visible {
  outline: 2px solid var(--map-accent);
  outline-offset: 4px;
}
.opening-map-settings-field:has(select:disabled) { opacity: 0.5; }
.opening-map-settings-select:disabled { cursor: default; }


.opening-map-explorer-database-games:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.opening-map-explorer-database-games-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: currentColor;
  mask: url('/static/img/chessboard-stacked.svg') center / contain no-repeat;
}

html[data-map-sidebar-tab="explorer"][data-map-explorer-card="true"][data-map-context-games-source="explorer"][data-map-context-window="games"]
  :is(.opening-map-explorer-strip, .opening-map-explorer-tabbed) .opening-map-position-footer .opening-map-position-footer-row {
  grid-template-columns: max-content max-content minmax(0, 1fr);
  grid-template-rows: repeat(2, 20px);
  column-gap: 12px;
  row-gap: 0;
}

html[data-map-sidebar-tab="explorer"][data-map-explorer-card="true"][data-map-context-games-source="explorer"][data-map-context-window="games"]
  :is(.opening-map-explorer-strip, .opening-map-explorer-tabbed) .opening-map-position-footer-row > .opening-map-analysis-pane-stockfish {
  grid-area: 1 / 1;
  height: 20px;
  min-height: 20px;
}

html[data-map-sidebar-tab="explorer"][data-map-explorer-card="true"][data-map-context-games-source="explorer"][data-map-context-window="games"]
  :is(.opening-map-explorer-strip, .opening-map-explorer-tabbed) .opening-map-position-footer-row .opening-map-analysis-pane-stockfish-live {
  height: 20px;
}

html[data-map-sidebar-tab="explorer"][data-map-explorer-card="true"][data-map-context-games-source="explorer"][data-map-context-window="games"]
  :is(.opening-map-explorer-strip, .opening-map-explorer-tabbed) .opening-map-position-footer-row > .opening-map-explorer-footer-performance {
  grid-area: 2 / 1;
  margin-left: 0;
  height: 20px;
  line-height: 20px;
}

html[data-map-sidebar-tab="explorer"][data-map-explorer-card="true"][data-map-context-games-source="explorer"][data-map-context-window="games"]
  :is(.opening-map-explorer-strip, .opening-map-explorer-tabbed) .opening-map-position-footer-row > .opening-map-explorer-footer-database:not([hidden]) {
  grid-area: 1 / 2 / 3 / 3;
  display: grid;
  grid-template-rows: repeat(2, 20px);
  align-items: center;
  color: var(--map-muted);
  font: 400 15px/20px var(--map-ui-font);
}

.opening-map-explorer-footer-database > .opening-map-explorer-database-score[hidden] {
  display: none;
}

.opening-map-explorer-footer-database > .opening-map-explorer-database-score[data-database="lichess"] {
  grid-row: 1;
}

.opening-map-explorer-footer-database > .opening-map-explorer-database-score[data-database="masters"] {
  grid-row: 2;
}

.opening-map-explorer-database-score[data-database="masters"] > .opening-map-explorer-database-icon {
  mask-image: url('/static/img/swords.svg');
}

html[data-map-sidebar-tab="explorer"][data-map-explorer-card="true"][data-map-context-games-source="explorer"][data-map-context-window="games"]
  :is(.opening-map-explorer-strip, .opening-map-explorer-tabbed) .opening-map-position-footer-row > .opening-map-analysis-pane-metrics {
  grid-area: 1 / 3 / 3 / 4;
  justify-self: end;
}

html[data-map-sidebar-tab="explorer"][data-map-explorer-card="true"][data-map-context-games-source="explorer"][data-map-context-window="games"]
  :is(.opening-map-explorer-strip, .opening-map-explorer-tabbed) .opening-map-position-footer-row .opening-map-analysis-pane-stockfish > .opening-map-card-engine-disclosure:focus-visible {
  box-shadow: none;
  outline: 1px solid var(--map-accent);
  outline-offset: 2px;
}

.opening-map-explorer-position-status[hidden] { display: none; }
.opening-map-explorer-position-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.opening-map-explorer-move-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--map-text);
  font: 400 15px/1.5 var(--map-ui-font);
  cursor: help;
}
.opening-map-explorer-move-label:focus-visible {
  outline: 1px solid var(--map-accent);
  outline-offset: 3px;
}
button.opening-map-explorer-move-label {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
button.opening-map-explorer-move-label:hover > span:last-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.opening-map-explorer-move-label-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background: currentColor;
  mask: url('/static/img/star.svg') center / contain no-repeat;
}
.opening-map-explorer-move-label[data-kind="masters"] .opening-map-explorer-move-label-icon {
  mask-image: url('/static/img/trophy.svg');
}
.opening-map-explorer-position-status { margin-top: 20px; }
.opening-map-explorer-move-label[data-kind^="outlier-"] .opening-map-explorer-move-label-icon {
  mask-image: url('/static/img/icons.svg');
}
.opening-map-explorer-move-label[data-kind="outlier-bad"] { color: var(--map-bad); }
.opening-map-explorer-move-label[data-kind="outlier-good"] { color: var(--map-good); }
.opening-map-explorer-move-label[data-kind="promising"],
.opening-map-explorer-move-label[data-kind="promising-alternative"] { color: var(--map-promising); }
.opening-map-explorer-move-label[data-kind="outlier-dismissed"],
.opening-map-explorer-move-label[data-kind="score-normal"],
.opening-map-explorer-move-label[data-kind="score-unassessed"] { color: var(--map-muted); }
.opening-map-explorer-move-label[data-kind="score-normal"] .opening-map-explorer-move-label-icon {
  mask-image: url('/static/img/circle-check.svg');
}
.opening-map-explorer-move-label[data-kind="score-unassessed"] .opening-map-explorer-move-label-icon {
  mask-image: url('/static/img/chart-column.svg');
}
.opening-map-explorer-move-label[data-kind^="key-moment"] .opening-map-explorer-move-label-icon {
  mask-image: url('/static/img/flag-3.svg');
}
