@font-face {
  font-family: 'JetBrains Mono';
  src: url('JetBrainsMono-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #262626;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

#sketch-pane {
  border-bottom: 1px solid #3a3a3a;
  width: 60%;
  height: 100%;
  overflow: hidden;
  position: relative;
  transition: width 0.3s ease;
}

/* Pane toggle button */
#pane-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 24px;
  height: 48px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.2;
  transition: opacity 0.3s, background 0.2s, color 0.2s;
}

#pane-toggle:hover {
  opacity: 1;
  background: #3a3a3a;
  color: #e0e0e0;
}

#pane-toggle svg {
  transition: transform 0.3s;
}

/* When pane is collapsed, flip the arrow */
#sketch-pane.pane-collapsed #pane-toggle svg {
  transform: rotate(180deg);
}

#search-pane {
  width: 40%;
  height: 100%;
  background-color: #1e1e1e;
  overflow: hidden;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, box-shadow 0.3s ease;
  min-width: 0;
}

/* Collapsed state */
#sketch-pane.pane-collapsed {
  width: 100%;
}

#sketch-pane.pane-collapsed+#search-pane {
  width: 0;
  box-shadow: none;
}

/* ====== Tab Bar ====== */

/* Keyboard shortcut key badges — realistic keycap */
.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #3a3a3a;
  border-bottom: none;
  background:
    linear-gradient(180deg, #333 0%, #2b2b2b 40%, #262626 100%);
  color: #777;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow:
    0 3px 0 0 #1a1a1a,
    0 4px 1px 0 rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 1px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  transition: all 0.06s ease;
  pointer-events: none;
  position: relative;
  top: 0;
}

/* Wider keys (Esc, etc.) */
.key-badge-wide {
  width: auto;
  padding: 0 5px;
}

.key-badge.key-active {
  background:
    linear-gradient(180deg, var(--accent-key1) 0%, var(--accent-key2) 40%, var(--accent-key3) 100%);
  color: var(--accent-dark);
  border-color: var(--accent-dim);
  top: 3px;
  box-shadow:
    0 0 0 0 #1a1a1a,
    0 1px 1px 0 rgba(0, 0, 0, 0.2),
    0 0 10px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

/* Badges inside search fields */
.field-key-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  font-size: 11px;
  opacity: 0.5;
  transition: all 0.06s ease, opacity 0.15s ease;
}

.field-key-badge.key-active {
  opacity: 1;
  top: 50%;
  transform: translate(-50%, calc(-50% + 3px));
}

/* Hide field badge when input has content or is focused */
.field-badge-container {
  position: relative;
}

.field-badge-container input {
  width: 100%;
}

/* Tournament wrapper needs the grid cell border */
#search-fields>.field-badge-container {
  border-right: 1px solid #444;
}

#search-fields>.field-badge-container>input {
  border-right: none;
}

.field-badge-container input:focus~.field-key-badge,
.field-badge-container input:not(:placeholder-shown)~.field-key-badge {
  opacity: 0;
  pointer-events: none;
}

/* Also for the date container which wraps differently */
#date-container input:focus~.field-key-badge,
#date-container input:not(:placeholder-shown)~.field-key-badge {
  opacity: 0;
  pointer-events: none;
}

/* Player wrapper badge */
#player-fields .field-key-badge {
  left: auto;
  right: 8px;
  transform: translateY(-50%);
}

#player-fields .field-key-badge.key-active {
  transform: translateY(calc(-50% + 3px));
}

#player-fields input:focus~.field-key-badge,
#player-fields.player1-has-content .field-key-badge {
  opacity: 0;
  pointer-events: none;
}

/* Pane toggle key badge positioning */
#pane-toggle .key-badge {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 4px;
  opacity: 0;
  transition: opacity 0.3s, all 0.06s ease;
}

#pane-toggle .key-badge.key-active {
  transform: translateY(calc(-50% + 3px));
}

#pane-toggle:hover .key-badge,
#pane-toggle .key-badge.key-active {
  opacity: 1;
}

#tab-bar {
  display: flex;
  padding: 0 0 0 2px;
  padding-top: 0;
  gap: 0;
  background: #171717;
  flex-shrink: 0;
  border-bottom: 1px solid #333;
  position: relative;
  align-items: flex-end;
  height: 40px;
}

/* Fullscreen button in the tab bar row */
#tab-bar-fullscreen {
  margin-left: auto;
  margin-right: 8px;
  margin-bottom: 4px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 4px;
  color: #888;
  font-size: 13px;
  padding: 0 10px;
  height: 26px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

#tab-bar-fullscreen:hover {
  background: #3a3a3a;
  border-color: var(--accent);
  color: #e0e0e0;
}

#tab-bar-fullscreen .icon {
  font-size: 14px;
  line-height: 1;
}

/* Tab button — styled directly with border and radius */
.tab-btn {
  padding: 0 18px;
  background: #232323;
  border: 1px solid #444;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  bottom: 0;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 -2px;
  z-index: 1;
  height: 32px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.tab-btn:first-child {
  margin-left: 6px;
}

.tab-btn:hover:not(.tab-active) {
  color: #bbb;
  background: #2a2a2a;
}

.tab-btn.tab-active {
  color: #e0e0e0;
  font-weight: 500;
  z-index: 3;
  height: 35px;
  bottom: -1px;
  background: #1e1e1e;
  border-color: #555;
}

.tab-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tab-icon svg {
  width: 14px;
  height: 14px;
}

/* ====== Tab Content ====== */
#tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.tab-panel-active {
  display: flex;
  flex-direction: column;
}

.tab-panel-inner {
  padding: 30px;
  color: #b3b3b3;
  font-size: 14px;
  line-height: 1.6;
}

.tab-panel-inner h2 {
  margin-bottom: 12px;
}

.tab-placeholder-text {
  color: #666;
  font-style: italic;
}

:root {
  --date-field-content-width: 4ch;
  --date-pad-left: 12px;
  --date-pad-right: 8px;
  --date-field-width: calc(var(--date-field-content-width) + var(--date-pad-left) + var(--date-pad-right));
  --col-tournament-min: 200px;
  --col-players-min: 300px;
  --search-grid-columns: var(--date-field-width) minmax(var(--col-tournament-min), 1fr) minmax(var(--col-players-min), 1fr);
  --current-match-height: 120px;
}

#search-container {
  padding: 0;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: 0;
  box-sizing: border-box;
  overflow: visible;
  position: relative;
}

#search-container>*:not(#search-labels):not(#search-fields):not(#search-scroll):not(#dropdown):not(#current-match):not(#search-stack) {
  padding-left: 30px;
  padding-right: 30px;
}

#search-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  align-self: stretch;
}

#gender-filters {
  display: flex;
  gap: 15px;
  align-items: center;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #b3b3b3;
  font-size: 14px;
  transition: color 0.2s ease;
}

.radio-label:hover {
  color: #e0e0e0;
}

.radio-label input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.radio-label input[type="radio"]:checked+.radio-text {
  color: var(--accent);
  font-weight: 500;
}

#top-controls {
  position: absolute;
  top: 10px;
  right: 30px;
  display: flex;
  gap: 12px;
  z-index: 10;
}

#fullscreen-section,
#random-match-section {
  margin: 0;
  padding: 0;
  border: none;
}

h2 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #e0e0e0;
  font-size: 24px;
}

#top-controls button {
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 13px;
  padding: 0 12px;
  height: 32px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

#top-controls button:hover {
  background: #3a3a3a;
  border-color: var(--accent);
}

#top-controls button:active {
  transform: scale(0.98);
}

#random-match-btn .icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#random-match-btn .icon svg {
  width: 14px;
  height: 14px;
}

#random-match-btn:hover {
  background: #3a3a3a;
  border-color: var(--accent);
}

#random-match-btn:active {
  transform: scale(0.98);
}

#random-match-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#random-match-btn:disabled:hover {
  background: #2d2d2d;
  border-color: #444;
  transform: none;
}

#fullscreen-btn .icon {
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

h3 {
  color: #b0b0b0;
  font-size: 18px;
  margin-top: 30px;
  margin-bottom: 10px;
}

/* Round selector segmented control */
#round-selector {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow: visible;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

#round-selector .round-label {
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 11px;
  white-space: nowrap;
  font-style: italic;
}

/* Gender selector */
#gender-selector {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  margin-right: 8px;
  padding-left: 8px;
  border-left: 1px solid #444;
}

#gender-selector .gender-btn {
  background: none;
  border: none;
  color: #888;
  padding: 2px 5px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3px;
  transition: color 0.15s;
  line-height: 1.2;
}

#gender-selector .gender-btn.gender-selected {
  color: var(--accent);
}

#gender-selector .gender-btn:hover {
  color: var(--accent);
}

#round-selector .round-btn {
  background: none;
  border: none;
  color: #888;
  padding: 2px 0;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3px;
  transition: color 0.15s;
  line-height: 1.2;
  position: relative;
}

#round-selector .round-btn sup {
  font-size: 7px;
  letter-spacing: 0;
}

/* Add arrow separator after each button except the last */
#round-selector .round-btn:not(:last-child)::after {
  content: '›';
  margin-left: 1px;
  margin-right: 1px;
  color: #444;
  font-weight: 400;
  transition: color 0.15s;
}

#round-selector .round-btn.round-in-range:not(:last-child)::after {
  color: var(--accent-dim);
}

#round-selector .round-btn:hover:not(:last-child)::after {
  color: var(--accent);
}

#round-selector .round-btn.round-preview-add:not(:last-child)::after,
#round-selector .round-btn.round-preview-remove:not(:last-child)::after {
  color: var(--accent-mid);
}

#round-selector .round-btn.round-in-range {
  color: var(--accent);
}

/* Hover state - bright accent highlight */
#round-selector .round-btn:hover {
  color: var(--accent);
}

/* Hover preview - mid accent */
#round-selector .round-btn.round-preview-add,
#round-selector .round-btn.round-preview-remove {
  color: var(--accent);
}

/* Round description in tournament cell */
.round-description {
  font-style: italic;
  font-weight: normal;
  opacity: 0.6;
  margin-left: 8px;
  white-space: nowrap;
  color: var(--accent-mid);
}

/* In the current match display, round/gender should not be green */
#match-display .round-description {
  color: inherit;
}

#search-scroll {
  overflow-x: hidden;
  overflow-y: hidden;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  align-self: stretch;
}

#search-labels {
  display: grid;
  grid-template-columns: var(--date-field-width) 1fr;
  margin-bottom: 6px;
  margin-top: 6px;
  padding-left: 0;
  overflow: visible;
  width: 100%;
  min-width: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  align-items: center;
}

.search-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-sizing: border-box;
  text-align: left;
  overflow: visible;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  line-height: 1.2;
}

#search-labels>.search-label:first-child {
  padding-left: var(--date-pad-left);
}

.search-label-with-round {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}

.players-label {
  margin-left: auto;
  padding-right: 12px;
}

/* Highlight label for focused field */

#search-scroll:has(#search-date-year:focus) #search-labels>.search-label:first-child {
  color: var(--accent);
}

#search-scroll:has(#search-tournament:focus) #search-labels .search-label-with-round>.search-label:first-child {
  color: var(--accent);
}

#search-scroll:has(#search-player1:focus) #search-labels .players-label,
#search-scroll:has(#search-player2:focus) #search-labels .players-label {
  color: var(--accent);
}


#search-fields {
  display: grid;
  grid-template-columns: var(--search-grid-columns);
  border-top: 1px solid #444;
  border-bottom: none;
  border-right: none;
  overflow: hidden;
  background-color: #2d2d2d;
  margin-bottom: 0;
  transition: border-color 0.2s;
  padding-left: 0;
  width: 100%;
  min-width: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

#search-fields:focus-within {
  border-color: var(--accent);
}

#search-fields input {
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.2;
  height: 32px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: bold;
  border: none;
  border-right: 1px solid #444;
  box-sizing: border-box;
  background-color: transparent;
  color: #e0e0e0;
  outline: none;
  flex-shrink: 0;
  text-align: left;
}

.date-container {
  display: flex;
  width: 100%;
  border-right: 1px solid #444;
  flex-shrink: 0;
  padding: 0 var(--date-pad-right) 0 var(--date-pad-left);
  box-sizing: border-box;
  align-items: center;
  height: 100%;
}

#date-container {
  display: flex;
  width: 100%;
  border-right: 1px solid #444;
  flex-shrink: 0;
  padding: 0 var(--date-pad-right) 0 var(--date-pad-left);
  box-sizing: border-box;
  align-items: center;
  height: 100%;
  cursor: text;
  position: relative;
}

#date-container input {
  border: none !important;
  padding: 0 !important;
  text-align: center;
  width: 100%;
  background: transparent;
  color: #e0e0e0;
  font-family: 'JetBrains Mono', monospace;
  font-weight: bold;
  outline: none;
  font-size: 14px;
}

#date-container input::placeholder {
  color: transparent;
}

#search-date-year {
  width: 100%;
}

#search-gender {
  width: var(--col-gender);
  text-align: center !important;
  padding: 12px 0 !important;
}

.player-field-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-right: 1px solid #444;
  box-sizing: border-box;
  position: relative;
}

.player-field-wrapper input {
  flex: 1 1 auto;
  padding: 12px 0;
  border: none;
  border-right: none;
  background: transparent;
  color: #e0e0e0;
  font-family: 'JetBrains Mono', monospace;
  font-weight: bold;
  outline: none;
}

#search-player1 {
  padding-right: 0 !important;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  border-right: none !important;
}

#search-player2 {
  padding-left: 0;
  flex: 1 1 auto;
}

.player-sep {
  color: #888;
  font-weight: bold;
  margin-right: 1ch;
  margin-left: 1ch;
  padding: 0;
  letter-spacing: 0;
}

.match-players .player-sep {
  display: inline;
}

#player-fields .player-sep {
  display: none;
  margin-right: 0;
}

.player-field-hidden {
  display: none;
}

#player-fields {
  border-right: none;
}

#player-fields.player1-has-content .player-sep {
  display: inline;
}

#player-fields.player2-visible .player-sep {
  display: inline;
}

#player-fields.player2-visible #search-player1,
#player-fields.player1-has-content #search-player1 {
  flex: 0 0 auto;
  min-width: 1ch;
}

#search-fields> :last-child {
  border-right: none;
}

#search-fields input::placeholder {
  color: #666;
  font-size: 13px;
}


#search-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #444;
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.2s;
  background-color: #2d2d2d;
  color: #e0e0e0;
}

#search-input:focus {
  outline: none;
  border-color: var(--accent);
}

#loading-indicator {
  margin-top: 8px;
  padding: 12px 16px;
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  color: #856404;
  font-size: 14px;
}

#match-count-bar {
  margin-top: 0;
  margin-bottom: 0;
  background: var(--accent-bg);
  border-top: 1px solid var(--accent);
  border-bottom: none;
  color: var(--accent-text);
  font-size: 14px;
  font-weight: bold;
  padding: 6px 12px;
  box-sizing: border-box;
  flex-shrink: 0;
  align-self: stretch;
  line-height: 1.2;
  height: 32px;
}

.match-count-hidden {
  display: none;
}

#progress-text {
  margin-bottom: 8px;
  text-align: center;
}

#progress-bar-container {
  width: 100%;
  height: 20px;
  background: #f8d7a6;
  border-radius: 10px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ffc107, #ff9800);
  width: 0%;
  transition: width 0.3s ease;
}

.loading-hidden {
  display: none;
}

#dropdown {
  margin-top: 0;
  margin-bottom: 20px;
  background-color: #2d2d2d !important;
  border: 2px solid #444;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: 1px solid var(--accent);
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  width: 100%;
  box-sizing: border-box;
  padding-left: 0;
  padding-right: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
}

.dropdown-empty-message {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 18px;
  pointer-events: none;
  background: none;
  z-index: 0;
  white-space: nowrap;
}

.dropdown-hidden {
  display: block;
}

/* Faceted dropdown styles */
.facet-group {
  flex-shrink: 0;
}

.facet-bar {
  display: grid;
  grid-template-columns: var(--search-grid-columns);
  grid-template-rows: 1fr;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-weight: bold;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1.2;
  height: 32px;
  cursor: pointer;
  min-width: 100%;
  box-sizing: border-box;
  width: 100%;
  overflow: visible;
  align-items: stretch;
}

.facet-bar:hover {
  background: var(--accent-bg-hover);
}

.facet-cell {
  padding: 6px 12px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.facet-value-btn {
  background: var(--accent-bg-hover);
  border: 1px solid var(--accent-border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--accent-text);
  font-family: 'JetBrains Mono', monospace;
  font-weight: bold;
  font-size: 13px;
  padding: 2px 10px 4px;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  margin-bottom: 0;
}

.facet-cell.facet-active-cell {
  position: relative;
  padding: 0;
  overflow: visible;
  display: block;
}

.facet-active-inner {
  position: absolute;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0;
  padding-right: 6px;
}

.facet-value-btn:hover {
  background: var(--accent);
  color: #1e1e1e;
  border-color: var(--accent);
}

.facet-count {
  color: var(--accent-mid);
  font-size: 12px;
  white-space: nowrap;
  padding: 0 4px;
  display: flex;
  align-items: center;
}

.facet-toggle-btn {
  background: none;
  border: none;
  color: var(--accent-mid);
  cursor: pointer;
  font-size: 10px;
  margin-left: 0;
  padding: 4px 8px;
  display: flex;
  align-items: center;
}

.facet-bar:hover .facet-toggle-btn {
  color: var(--accent-text);
}

.facet-bar:hover .facet-count {
  color: var(--accent-text);
}

.facet-matches {
  overflow: hidden;
}

.facet-collapsed {
  display: none;
}

.dropdown-item {
  cursor: pointer;
  border-bottom: 1px solid #3a3a3a;
  transition: background-color 0.15s;
  color: #e0e0e0;
  font-size: 14px;
  background-color: #2d2d2d;
  width: 100%;
  box-sizing: border-box;
}

.dropdown-item:nth-child(even) {
  background-color: #2a2a2a;
}

.dropdown-item:nth-child(even) .match-row {
  background-color: #2a2a2a;
}

.dropdown-item-text {
  color: #666;
  font-size: 15px;
  padding: 0;
  margin: 0;
  text-align: center;
  background: none;
  border: none;
  box-shadow: none;
  cursor: default;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
  width: 100%;
}

.dropdown-item-match {
  padding: 0;
  width: 100%;
  display: block;
}

.dropdown-item:last-child {
  border-bottom: 1px solid #3a3a3a;
}

.dropdown-item:hover {
  background-color: #3a3a3a;
}

.dropdown-item:hover .match-row {
  background-color: #3a3a3a;
}

.dropdown-item.selected {
  background-color: var(--accent-bg);
}

#match-display {
  background: #2d2d2d;
  padding: 0;
  border-radius: 0;
  border: 2px solid #444;
  border-left: none;
  border-right: none;
  color: #e0e0e0;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: visible;
}

#match-display .match-cell,
#match-display .match-date {
  position: relative;
  cursor: pointer;
}

#match-display .match-cell:hover,
#match-display .match-date:hover {
  background-color: var(--accent-tint);
}

#match-display .match-cell:hover::after,
#match-display .match-date:hover::after {
  content: 'Click to add this to search filters';
  position: absolute;
  left: 8px;
  top: -28px;
  background: #1f1f1f;
  border: 1px solid var(--accent);
  color: var(--accent-text);
  padding: 4px 6px;
  font-size: 11px;
  white-space: nowrap;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}

#dropdown .match-row,
#match-display .match-row {
  padding-left: 0;
  padding-right: 0;
}

#dropdown .date-container,
#match-display .date-container {
  padding-left: var(--date-pad-left);
  padding-right: var(--date-pad-right);
}

#current-match {
  margin-top: 10px;
  margin-bottom: 0;
  overflow: visible;
  border-bottom: none;
  flex-shrink: 0;
}

#current-match h3 {
  padding-left: 30px;
  padding-right: 30px;
}

.match-row {
  display: grid;
  grid-template-columns: var(--search-grid-columns);
  width: 100%;
  min-width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-weight: bold;
  color: #e0e0e0;
  font-size: 14px;
  line-height: 1.2;
  height: 32px;
  align-items: stretch;
  background-color: #2d2d2d;
  box-sizing: border-box;
}

.match-cell {
  padding: 0 12px;
  border-right: 1px solid #3a3a3a;
  box-sizing: border-box;
  text-align: left;
  display: flex;
  align-items: center;
  height: 100%;
}

.field-validated {
  color: var(--accent) !important;
  /* accent */
  border-color: var(--accent) !important;
}

.match-players {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
}

.match-player {
  cursor: pointer;
}

.match-cell:last-child {
  border-right: none;
  padding-right: 0;
}

/* Darker tail after the last candidate */
#dropdown::after {
  content: '';
  flex: 1 1 auto;
  min-height: 32px;
  background: #1f1f1f;
  width: 100%;
  pointer-events: none;
}

/* Darker tail after last candidate */
#dropdown::after {
  content: '';
  display: block;
  height: 100%;
  min-height: 40px;
  background: #1f1f1f;
}

.match-cell.centered {
  text-align: center;
}

.match-date {
  border-right: 1px solid #3a3a3a;
  height: 100%;
}

.match-date-part {
  flex-shrink: 0;
  text-align: right;
}

.match-date-part.year {
  width: 4ch;
}

.match-date-part.month,
.match-date-part.day {
  width: 2ch;
}

canvas {
  display: block;
  position: relative;
  z-index: 10;
}

main {
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
}

/* Custom tooltip styles */
.custom-tooltip {
  position: fixed;
  background: #333;
  color: var(--accent-text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  z-index: 10000;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid #555;
  transform: translateX(-50%);
}

.custom-tooltip.hidden {
  display: none;
}

/* Enhanced match field hover states */
.match-cell:hover,
.match-date:hover,
.match-player:hover {
  transition: background-color 0.1s ease, color 0.1s ease;
}

/* --- Color Picker --- */
#color-picker-section h3 {
  color: #ccc;
  font-size: 13px;
  margin: 0 0 12px 0;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#color-ring-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  position: relative;
}

/* Lab viewport toggle bar */
#lab-toggle-bar {
  display: flex;
  gap: 5px;
  justify-content: center;
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  z-index: 20;
  pointer-events: none;
}

#lab-toggle-bar.lab-toggle-hidden {
  display: none;
}

.lab-toggle-btn {
  pointer-events: auto;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lab-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.3);
}

.lab-toggle-btn.active {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.45);
  color: rgba(255, 255, 255, 0.85);
}

.lab-toggle-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.lab-toggle-row + .lab-toggle-row {
  margin-top: 3px;
}

/* Pareto parameter sliders — below viewport */
#lab-pareto-sliders {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 6px 12px;
  margin-bottom: 8px;
  font: 10px -apple-system, BlinkMacSystemFont, sans-serif;
  color: rgba(255, 255, 255, 0.7);
  transition: opacity 0.25s ease;
}

#lab-pareto-sliders.lab-toggle-hidden {
  display: none;
}

.pareto-slider-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pareto-slider-row label {
  width: 18px;
  text-align: center;
  font-weight: 600;
  font-size: 9px;
  cursor: default;
}

.pareto-slider {
  width: 80px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.pareto-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  cursor: pointer;
}

.pareto-val {
  width: 30px;
  text-align: right;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.5);
}

#color-ring-canvas {
  cursor: crosshair;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

#color-picker-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Sacrifice mode toggle button */
#color-sacrifice-btn.sacrifice-hidden,
#color-animate-btn.sacrifice-hidden {
  display: none;
}

.color-ctrl-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #2a2a2a;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.color-ctrl-btn:hover {
  background: #383838;
  color: #ddd;
  border-color: #666;
}

.color-ctrl-btn.color-locked {
  border-color: #6a6a6a;
  color: #ddd;
  background: #333;
}

/* Gamut / Circle switch toggle */
.shape-toggle {
  display: flex;
  border: 1px solid #444;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  font-size: 11px;
  user-select: none;
}

.shape-toggle-label {
  padding: 5px 10px;
  transition: background 0.2s, color 0.2s;
}

.shape-label-gamut {
  background: #555;
  color: #eee;
}

.shape-label-circle {
  background: #2a2a2a;
  color: #888;
}

.shape-toggle.shape-circle .shape-label-gamut {
  background: #2a2a2a;
  color: #888;
}

.shape-toggle.shape-circle .shape-label-circle {
  background: #555;
  color: #eee;
}

body.theme-light .shape-toggle {
  border-color: #ccc;
}

body.theme-light .shape-label-gamut {
  background: #bbb;
  color: #222;
}

body.theme-light .shape-label-circle {
  background: #e8e8e8;
  color: #999;
}

body.theme-light .shape-toggle.shape-circle .shape-label-gamut {
  background: #e8e8e8;
  color: #999;
}

body.theme-light .shape-toggle.shape-circle .shape-label-circle {
  background: #bbb;
  color: #222;
}

/* Warm dark toggle */
body.theme-warm .shape-toggle {
  border-color: #4a3e30;
}

body.theme-warm .shape-label-gamut {
  background: #4a3e30;
  color: #e0d0c0;
}

body.theme-warm .shape-label-circle {
  background: #2a2520;
  color: #887060;
}

body.theme-warm .shape-toggle.shape-circle .shape-label-gamut {
  background: #2a2520;
  color: #887060;
}

body.theme-warm .shape-toggle.shape-circle .shape-label-circle {
  background: #4a3e30;
  color: #e0d0c0;
}

/* Warm light toggle */
body.theme-light.theme-warm .shape-toggle {
  border-color: #d0c0a8;
}

body.theme-light.theme-warm .shape-label-gamut {
  background: #c8b898;
  color: #3a2a18;
}

body.theme-light.theme-warm .shape-label-circle {
  background: #f0e8d8;
  color: #a09080;
}

body.theme-light.theme-warm .shape-toggle.shape-circle .shape-label-gamut {
  background: #f0e8d8;
  color: #a09080;
}

body.theme-light.theme-warm .shape-toggle.shape-circle .shape-label-circle {
  background: #c8b898;
  color: #3a2a18;
}

/* Cool dark toggle */
body.theme-cool .shape-toggle {
  border-color: #3a4050;
}

body.theme-cool .shape-label-gamut {
  background: #3a4050;
  color: #c0d0e0;
}

body.theme-cool .shape-label-circle {
  background: #20242a;
  color: #607088;
}

body.theme-cool .shape-toggle.shape-circle .shape-label-gamut {
  background: #20242a;
  color: #607088;
}

body.theme-cool .shape-toggle.shape-circle .shape-label-circle {
  background: #3a4050;
  color: #c0d0e0;
}

/* Cool light toggle */
body.theme-light.theme-cool .shape-toggle {
  border-color: #b0c0d0;
}

body.theme-light.theme-cool .shape-label-gamut {
  background: #98b0c8;
  color: #182838;
}

body.theme-light.theme-cool .shape-label-circle {
  background: #dce8f0;
  color: #8090a0;
}

body.theme-light.theme-cool .shape-toggle.shape-circle .shape-label-gamut {
  background: #dce8f0;
  color: #8090a0;
}

body.theme-light.theme-cool .shape-toggle.shape-circle .shape-label-circle {
  background: #98b0c8;
  color: #182838;
}

/* Lab label: inactive by default, active when .shape-lab */
.shape-label-lab {
  background: #2a2a2a;
  color: #888;
}

.shape-toggle.shape-lab .shape-label-gamut {
  background: #2a2a2a;
  color: #888;
}

.shape-toggle.shape-lab .shape-label-lab {
  background: #555;
  color: #eee;
}

body.theme-light .shape-label-lab {
  background: #e8e8e8;
  color: #999;
}

body.theme-light .shape-toggle.shape-lab .shape-label-gamut {
  background: #e8e8e8;
  color: #999;
}

body.theme-light .shape-toggle.shape-lab .shape-label-lab {
  background: #bbb;
  color: #222;
}

body.theme-warm .shape-label-lab {
  background: #2a2520;
  color: #887060;
}

body.theme-warm .shape-toggle.shape-lab .shape-label-gamut {
  background: #2a2520;
  color: #887060;
}

body.theme-warm .shape-toggle.shape-lab .shape-label-lab {
  background: #4a3e30;
  color: #e0d0c0;
}

body.theme-light.theme-warm .shape-label-lab {
  background: #f0e8d8;
  color: #a09080;
}

body.theme-light.theme-warm .shape-toggle.shape-lab .shape-label-gamut {
  background: #f0e8d8;
  color: #a09080;
}

body.theme-light.theme-warm .shape-toggle.shape-lab .shape-label-lab {
  background: #c8b898;
  color: #3a2a18;
}

body.theme-cool .shape-label-lab {
  background: #20242a;
  color: #607088;
}

body.theme-cool .shape-toggle.shape-lab .shape-label-gamut {
  background: #20242a;
  color: #607088;
}

body.theme-cool .shape-toggle.shape-lab .shape-label-lab {
  background: #3a4050;
  color: #c0d0e0;
}

body.theme-light.theme-cool .shape-label-lab {
  background: #dce8f0;
  color: #8090a0;
}

body.theme-light.theme-cool .shape-toggle.shape-lab .shape-label-gamut {
  background: #dce8f0;
  color: #8090a0;
}

body.theme-light.theme-cool .shape-toggle.shape-lab .shape-label-lab {
  background: #98b0c8;
  color: #182838;
}

/* Strip label: same pattern as Lab — inactive by default, active when .shape-strip */
.shape-label-strip {
  background: #2a2a2a;
  color: #888;
}

.shape-toggle.shape-strip .shape-label-gamut {
  background: #2a2a2a;
  color: #888;
}

.shape-toggle.shape-strip .shape-label-strip {
  background: #555;
  color: #eee;
}

body.theme-light .shape-label-strip {
  background: #e8e8e8;
  color: #999;
}

body.theme-light .shape-toggle.shape-strip .shape-label-gamut {
  background: #e8e8e8;
  color: #999;
}

body.theme-light .shape-toggle.shape-strip .shape-label-strip {
  background: #bbb;
  color: #222;
}

body.theme-warm .shape-label-strip {
  background: #2a2520;
  color: #887060;
}

body.theme-warm .shape-toggle.shape-strip .shape-label-gamut {
  background: #2a2520;
  color: #887060;
}

body.theme-warm .shape-toggle.shape-strip .shape-label-strip {
  background: #4a3e30;
  color: #e0d0c0;
}

body.theme-light.theme-warm .shape-label-strip {
  background: #f0e8d8;
  color: #a09080;
}

body.theme-light.theme-warm .shape-toggle.shape-strip .shape-label-gamut {
  background: #f0e8d8;
  color: #a09080;
}

body.theme-light.theme-warm .shape-toggle.shape-strip .shape-label-strip {
  background: #c8b898;
  color: #3a2a18;
}

body.theme-cool .shape-label-strip {
  background: #20242a;
  color: #607088;
}

body.theme-cool .shape-toggle.shape-strip .shape-label-gamut {
  background: #20242a;
  color: #607088;
}

body.theme-cool .shape-toggle.shape-strip .shape-label-strip {
  background: #3a4050;
  color: #c0d0e0;
}

body.theme-light.theme-cool .shape-label-strip {
  background: #dce8f0;
  color: #8090a0;
}

body.theme-light.theme-cool .shape-toggle.shape-strip .shape-label-gamut {
  background: #dce8f0;
  color: #8090a0;
}

body.theme-light.theme-cool .shape-toggle.shape-strip .shape-label-strip {
  background: #98b0c8;
  color: #182838;
}

#color-swatches {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-swatch-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch-label {
  color: #888;
  font-size: 12px;
  width: 60px;
}

.swatch-chip {
  width: 28px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.swatch-chip.swatch-dark {
  opacity: 0.9;
}

/* ================================================================
   ACCENT COLOR OVERRIDES (uses CSS custom properties set by JS)
   ================================================================ */
body .key-badge.key-active {
  background: linear-gradient(180deg, var(--accent-key1) 0%, var(--accent-key2) 40%, var(--accent-key3) 100%);
  color: var(--accent-dark);
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 0 #1a1a1a, 0 1px 1px 0 rgba(0, 0, 0, 0.2), 0 0 10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

#tab-bar-fullscreen:hover {
  border-color: var(--accent);
}

.radio-label input[type="radio"]:checked+.radio-text {
  color: var(--accent);
}

#top-controls button:hover {
  border-color: var(--accent);
}

#random-match-btn:hover {
  border-color: var(--accent);
}

#gender-selector .gender-btn.gender-selected {
  color: var(--accent);
}

#gender-selector .gender-btn:hover {
  color: var(--accent);
}

#round-selector .round-btn.round-in-range:not(:last-child)::after {
  color: var(--accent-dim);
}

#round-selector .round-btn:hover:not(:last-child)::after {
  color: var(--accent);
}

#round-selector .round-btn.round-preview-add:not(:last-child)::after,
#round-selector .round-btn.round-preview-remove:not(:last-child)::after {
  color: var(--accent-mid);
}

#round-selector .round-btn.round-in-range {
  color: var(--accent);
}

#round-selector .round-btn:hover {
  color: var(--accent);
}

#round-selector .round-btn.round-preview-add,
#round-selector .round-btn.round-preview-remove {
  color: var(--accent);
}

.round-description {
  color: var(--accent-mid);
}

#search-scroll:has(#search-date-year:focus) #search-labels>.search-label:first-child {
  color: var(--accent);
}

#search-scroll:has(#search-tournament:focus) #search-labels .search-label-with-round>.search-label:first-child {
  color: var(--accent);
}

#search-scroll:has(#search-player1:focus) #search-labels .players-label,
#search-scroll:has(#search-player2:focus) #search-labels .players-label {
  color: var(--accent);
}

#search-fields:focus-within {
  border-color: var(--accent);
}

#search-input:focus {
  border-color: var(--accent);
}

#match-count-bar {
  background: var(--accent-bg);
  border-top-color: var(--accent);
  color: var(--accent-text);
}

#dropdown {
  border-top-color: var(--accent);
}

.facet-bar {
  background: var(--accent-bg);
  border-bottom-color: var(--accent-border);
  color: var(--accent-text);
}

.facet-bar:hover {
  background: var(--accent-bg-hover);
}

.facet-value-btn {
  background: var(--accent-bg-hover);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.facet-value-btn:hover {
  background: var(--accent);
  color: #1e1e1e;
  border-color: var(--accent);
}

.facet-count {
  color: var(--accent-mid);
}

.facet-toggle-btn {
  color: var(--accent-mid);
}

.facet-bar:hover .facet-toggle-btn {
  color: var(--accent-text);
}

.facet-bar:hover .facet-count {
  color: var(--accent-text);
}

#match-display .match-cell:hover,
#match-display .match-date:hover {
  background-color: var(--accent-tint);
}

#match-display .match-cell:hover::after,
#match-display .match-date:hover::after {
  border-color: var(--accent);
  color: var(--accent-text);
}

.custom-tooltip {
  border-color: var(--accent);
  color: var(--accent-text);
}

.field-validated {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* ================================================================
   THEME SECTION STYLES
   ================================================================ */
#theme-section,
#accent-section {
  margin-top: 20px;
}

#accent-viewport-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  margin-bottom: 8px;
}

#accent-viewport-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  border-radius: 6px;
  display: block;
  background: #000;
}

#accent-bg-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

#accent-bg-label {
  font-size: 11px;
  color: #888;
}

#accent-bg-chip {
  width: 28px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

#theme-section h3,
#accent-section h3 {
  font-size: 14px;
  color: #b3b3b3;
  margin: 0 0 10px 0;
  font-weight: 500;
}

#theme-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#theme-temp-controls {
  display: flex;
  gap: 0;
  border: 1px solid #444;
  border-radius: 6px;
  overflow: hidden;
}

.theme-temp-btn {
  background: #2d2d2d;
  border: none;
  color: #888;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.theme-temp-btn:not(:last-child) {
  border-right: 1px solid #444;
}

.theme-temp-btn:hover {
  color: #e0e0e0;
  background: #3a3a3a;
}

.theme-temp-btn.theme-temp-active {
  color: #e0e0e0;
  background: #444;
  font-weight: 500;
}

/* (accent slider replaced by accent viewport) */

/* ================================================================
   LIGHT THEME OVERRIDES
   ================================================================ */
body.theme-light {
  background: #f2f2f2;
}

body.theme-light #search-pane {
  background-color: #fafafa;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
}

body.theme-light #tab-bar {
  background: #e8e8e8;
  border-bottom-color: #ccc;
}

body.theme-light .tab-btn {
  background: #e0e0e0;
  border-color: #ccc;
  color: #666;
}

body.theme-light .tab-btn:hover:not(.tab-active) {
  color: #333;
  background: #eaeaea;
}

body.theme-light .tab-btn.tab-active {
  color: #222;
  background: #fafafa;
  border-color: #bbb;
}

body.theme-light .tab-panel-inner {
  color: #333;
}

body.theme-light h2 {
  color: #222;
}

body.theme-light h3 {
  color: #555;
}

body.theme-light .radio-label {
  color: #555;
}

body.theme-light .player-sep {
  color: #999;
}

body.theme-light #round-selector .round-label {
  color: #999;
}

body.theme-light #gender-selector {
  border-left-color: #ccc;
}

body.theme-light #round-selector .round-btn:not(:last-child)::after {
  color: #ccc;
}

body.theme-light .dropdown-item {
  background-color: #f5f5f5;
  color: #333;
}

body.theme-light .dropdown-item:nth-child(even) {
  background-color: #efefef;
}

body.theme-light .dropdown-item:nth-child(even) .match-row {
  background-color: #efefef;
}

body.theme-light .match-row {
  background-color: #f5f5f5;
  color: #333;
}

body.theme-light .match-cell {
  border-right-color: #ddd;
}

body.theme-light .match-date {
  border-right-color: #ddd;
}

body.theme-light #match-display {
  background: #f0f0f0;
  border-color: #ccc;
  color: #333;
}

body.theme-light #current-match h3 {
  color: #555;
}

body.theme-light #search-fields input::placeholder {
  color: #aaa;
}

body.theme-light #date-container input {
  color: #222;
}

body.theme-light .dropdown-item:last-child {
  border-bottom-color: #ddd;
}

body.theme-light .dropdown-item:hover {
  background-color: #e4e4e4;
}

body.theme-light .dropdown-item:hover .match-row {
  background-color: #e4e4e4;
}

body.theme-light .dropdown-item.selected {
  background-color: var(--accent-tint);
}

body.theme-light #search-fields {
  border-top-color: #ccc;
}

body.theme-light #search-fields>.field-badge-container {
  border-right-color: #ccc;
}

body.theme-light .player-field-wrapper {
  border-right-color: #ccc;
}

body.theme-light #search-fields input {
  border-right-color: #ccc;
}

body.theme-light .dropdown-item {
  border-bottom-color: #ddd;
}

body.theme-light #dropdown::after {
  background: #e8e8e8;
}

body.theme-light .custom-tooltip {
  background: #f5f5f5;
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.theme-light #match-display .match-cell:hover::after,
body.theme-light #match-display .match-date:hover::after {
  background: #f5f5f5;
}

body.theme-light .color-ctrl-btn.color-locked {
  border-color: #aaa;
  color: #333;
  background: #ddd;
}

body.theme-light #tab-bar-fullscreen {
  background: #e8e8e8;
  border-color: #ccc;
  color: #666;
}

body.theme-light #tab-bar-fullscreen:hover {
  background: #ddd;
  color: #222;
}

body.theme-light #pane-toggle {
  background: #e8e8e8;
  border-color: #ccc;
  color: #999;
}

body.theme-light #pane-toggle:hover {
  background: #ddd;
  color: #333;
}

body.theme-light #search-fields {
  background-color: #f0f0f0;
  border-top-color: #ccc;
}

body.theme-light #search-fields input {
  background-color: transparent;
  color: #222;
}

body.theme-light #search-fields input::placeholder {
  color: #999;
}

body.theme-light #search-input {
  background-color: #f0f0f0;
  border-color: #ccc;
  color: #222;
}

body.theme-light .search-label {
  color: #888;
}

body.theme-light #search-labels {
  border-bottom-color: #ddd;
}

body.theme-light #top-controls button {
  background: #e8e8e8;
  border-color: #ccc;
  color: #333;
}

body.theme-light #top-controls button:hover {
  background: #ddd;
}

body.theme-light #match-count-bar {
  border-top-color: var(--accent-mid);
}

body.theme-light #dropdown {
  background-color: #f5f5f5 !important;
  border-color: #ccc;
  border-top-color: var(--accent-mid);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.theme-light .dropdown-item {
  border-bottom-color: #e0e0e0;
}

body.theme-light .match-row {
  border-bottom-color: #e0e0e0;
}

body.theme-light .match-cell {
  color: #333;
}

body.theme-light .match-date {
  color: #666;
}

body.theme-light .dropdown-item:hover {
  background-color: #e8e8e8;
}

body.theme-light .match-score {
  color: #222;
}

body.theme-light .dropdown-empty-message {
  color: #999;
}

body.theme-light .key-badge {
  background: linear-gradient(180deg, #f8f8f8 0%, #e8e8e8 40%, #ddd 100%);
  color: #555;
  border-color: #bbb;
  box-shadow: 0 2px 0 0 #ccc, 0 3px 1px 0 rgba(0, 0, 0, 0.1);
}

body.theme-light .key-badge.key-active {
  background: linear-gradient(180deg, var(--accent-key1) 0%, var(--accent-key2) 40%, var(--accent-key3) 100%);
  color: var(--accent-dark);
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 0 #ccc, 0 1px 1px 0 rgba(0, 0, 0, 0.12), 0 0 10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 2px rgba(0, 0, 0, 0.05);
}

body.theme-light #gender-selector .gender-btn {
  color: #999;
}

body.theme-light #round-selector .round-btn {
  color: #999;
}

body.theme-light #round-selector .round-btn:not(:last-child)::after {
  color: #ccc;
}

body.theme-light .facet-value-btn:hover {
  color: #fff;
}

body.theme-light .swatch-label {
  color: #999;
}

body.theme-light .swatch-chip {
  border-color: rgba(0, 0, 0, 0.15);
}

body.theme-light #color-picker-section h3 {
  color: #555;
}

body.theme-light .color-ctrl-btn {
  background: #e8e8e8;
  border-color: #ccc;
  color: #666;
}

body.theme-light .color-ctrl-btn:hover {
  background: #ddd;
  color: #333;
}

body.theme-light #theme-section h3,
body.theme-light #accent-section h3 {
  color: #666;
}

body.theme-light .theme-temp-btn {
  background: #e8e8e8;
  border-color: #ccc;
  color: #888;
}

body.theme-light .theme-temp-btn:not(:last-child) {
  border-right-color: #ccc;
}

body.theme-light .theme-temp-btn:hover {
  color: #333;
  background: #ddd;
}

body.theme-light .theme-temp-btn.theme-temp-active {
  color: #222;
  background: #ccc;
}

body.theme-light #theme-temp-controls {
  border-color: #ccc;
}

body.theme-light .radio-label .radio-text {
  color: #555;
}

body.theme-light #sketch-pane {
  border-bottom-color: #ccc;
}

body.theme-light .custom-tooltip {
  background: #f5f5f5;
}

body.theme-light .facet-bar {
  border-bottom-color: var(--accent-border);
}

/* ================================================================
   WARM THEME OVERRIDES
   ================================================================ */
body.theme-warm {
  background: #2a2520;
}

body.theme-warm #search-pane {
  background-color: #221e19;
}

body.theme-warm #tab-bar {
  background: #1a1610;
}

body.theme-warm .tab-btn {
  background: #272218;
}

body.theme-warm .tab-btn.tab-active {
  background: #221e19;
}

body.theme-warm #search-fields,
body.theme-warm #dropdown {
  background-color: #302a20 !important;
}

body.theme-warm #pane-toggle {
  background: #302a20;
}

body.theme-warm .dropdown-item:hover {
  background-color: #3a3228;
}

body.theme-warm #top-controls button {
  background: #302a20;
}

body.theme-warm .key-badge {
  background: linear-gradient(180deg, #403828 0%, #302818 40%, #282010 100%);
}

/* Warm + light */
body.theme-light.theme-warm {
  background: #faf5ee;
}

body.theme-light.theme-warm #search-pane {
  background-color: #fffbf5;
}

body.theme-light.theme-warm #tab-bar {
  background: #f0e8dc;
}

body.theme-light.theme-warm .tab-btn {
  background: #ede5d8;
}

body.theme-light.theme-warm .tab-btn.tab-active {
  background: #fffbf5;
}

body.theme-light.theme-warm #search-fields,
body.theme-light.theme-warm #dropdown {
  background-color: #f8f0e4 !important;
}

body.theme-light.theme-warm #top-controls button {
  background: #f0e8dc;
}

body.theme-light.theme-warm .dropdown-item:hover {
  background-color: #f0e5d5;
}

body.theme-light.theme-warm .key-badge {
  background: linear-gradient(180deg, #faf5ee 0%, #f0e8dc 40%, #e5dbd0 100%);
}

/* ================================================================
   COOL THEME OVERRIDES
   ================================================================ */
body.theme-cool {
  background: #20242a;
}

body.theme-cool #search-pane {
  background-color: #191d22;
}

body.theme-cool #tab-bar {
  background: #10141a;
}

body.theme-cool .tab-btn {
  background: #1e2228;
}

body.theme-cool .tab-btn.tab-active {
  background: #191d22;
}

body.theme-cool #search-fields,
body.theme-cool #dropdown {
  background-color: #242830 !important;
}

body.theme-cool #pane-toggle {
  background: #242830;
}

body.theme-cool .dropdown-item:hover {
  background-color: #2a3038;
}

body.theme-cool #top-controls button {
  background: #242830;
}

body.theme-cool .key-badge {
  background: linear-gradient(180deg, #283040 0%, #1e2838 40%, #182030 100%);
}

/* Cool + light */
body.theme-light.theme-cool {
  background: #eef2f8;
}

body.theme-light.theme-cool #search-pane {
  background-color: #f5f8ff;
}

body.theme-light.theme-cool #tab-bar {
  background: #dce4f0;
}

body.theme-light.theme-cool .tab-btn {
  background: #d8e0ec;
}

body.theme-light.theme-cool .tab-btn.tab-active {
  background: #f5f8ff;
}

body.theme-light.theme-cool #search-fields,
body.theme-light.theme-cool #dropdown {
  background-color: #e8eef8 !important;
}

body.theme-light.theme-cool #top-controls button {
  background: #dce4f0;
}

body.theme-light.theme-cool .dropdown-item:hover {
  background-color: #d5dde8;
}

body.theme-light.theme-cool .key-badge {
  background: linear-gradient(180deg, #eef2f8 0%, #dce4f0 40%, #d0d8e5 100%);
}

/* ================================================================
   KEY PRESS HOVER HIGHLIGHT
   ================================================================ */
.tab-btn.key-pressing:not(.tab-active) {
  color: #bbb;
  background: #2a2a2a;
}

#tab-bar-fullscreen.key-pressing {
  background: #3a3a3a;
  border-color: var(--accent);
  color: #e0e0e0;
}

#pane-toggle.key-pressing {
  opacity: 1;
  background: #3a3a3a;
  color: #e0e0e0;
}

#random-match-btn.key-pressing,
#top-controls button.key-pressing {
  background: #3a3a3a;
  border-color: var(--accent);
}

body.theme-light .tab-btn.key-pressing:not(.tab-active) {
  color: #333;
  background: #eaeaea;
}

body.theme-light #tab-bar-fullscreen.key-pressing {
  background: #ddd;
  color: #222;
}

body.theme-light #pane-toggle.key-pressing {
  opacity: 1;
  background: #ddd;
  color: #333;
}

body.theme-light #random-match-btn.key-pressing,
body.theme-light #top-controls button.key-pressing {
  background: #ddd;
}

/* ================================================================
   WARM/COOL ADDITIONAL GREY OVERRIDES
   ================================================================ */
body.theme-warm .dropdown-item {
  background-color: #302a20;
}

body.theme-warm .dropdown-item:nth-child(even) {
  background-color: #2d2718;
}

body.theme-warm .dropdown-item:nth-child(even) .match-row {
  background-color: #2d2718;
}

body.theme-warm .match-row {
  background-color: #302a20;
}

body.theme-warm .color-ctrl-btn {
  background: #302a20;
}

body.theme-warm .theme-temp-btn {
  background: #302a20;
}

body.theme-warm #match-display {
  background: #302a20;
}

body.theme-cool .dropdown-item {
  background-color: #242830;
}

body.theme-cool .dropdown-item:nth-child(even) {
  background-color: #212530;
}

body.theme-cool .dropdown-item:nth-child(even) .match-row {
  background-color: #212530;
}

body.theme-cool .match-row {
  background-color: #242830;
}

body.theme-cool .color-ctrl-btn {
  background: #242830;
}

body.theme-cool .theme-temp-btn {
  background: #242830;
}

body.theme-cool #match-display {
  background: #242830;
}

body.theme-light.theme-warm .dropdown-item {
  background-color: #f8f0e4;
}

body.theme-light.theme-warm .dropdown-item:nth-child(even) {
  background-color: #f2eadc;
}

body.theme-light.theme-warm .dropdown-item:nth-child(even) .match-row {
  background-color: #f2eadc;
}

body.theme-light.theme-warm .match-row {
  background-color: #f8f0e4;
}

body.theme-light.theme-warm .color-ctrl-btn {
  background: #f0e8dc;
}

body.theme-light.theme-warm .theme-temp-btn {
  background: #f0e8dc;
}

body.theme-light.theme-warm #match-display {
  background: #f0e8dc;
}

body.theme-light.theme-warm #dropdown::after {
  background: #ede5d8;
}

body.theme-light.theme-cool .dropdown-item {
  background-color: #e8eef8;
}

body.theme-light.theme-cool .dropdown-item:nth-child(even) {
  background-color: #e2e8f2;
}

body.theme-light.theme-cool .dropdown-item:nth-child(even) .match-row {
  background-color: #e2e8f2;
}

body.theme-light.theme-cool .match-row {
  background-color: #e8eef8;
}

body.theme-light.theme-cool .color-ctrl-btn {
  background: #dce4f0;
}

body.theme-light.theme-cool .theme-temp-btn {
  background: #dce4f0;
}

body.theme-light.theme-cool #match-display {
  background: #dce4f0;
}

body.theme-light.theme-cool #dropdown::after {
  background: #d8e0ec;
}