/*
 * Source: cardflow-custom-editor.css .cf-folder-panel/.history-header/.history-selection-count/
 * .custom-card-row--identity/.custom-card-thumb and src/legacy/native-menu.css
 * .legacy-native-feature-body .custom-deck-icon-tool[aria-pressed="true"] plus
 * .options-selection-row.is-selected and index.html .spread-title-container input.
 * Unchanged editor slate/card-ring and 40px editor-input treatments leaked into this menu-only
 * picker, so this scoped adapter uses the source menu surfaces plus the reading question input's
 * exact 36px height, 1px border width, 5px radius, and 8px inline padding. Its border color stays
 * on the menu's --line token to match the content surface and inactive view control. Visible delta: the picker
 * removes editing labels, keeps view controls in the deck-summary header, and appends a
 * decorative compact thumb to its dense list. The picker keeps its previously requested white
 * input surface; only the source input's geometry is ported. The source .cf-folder-panel uses
 * 7px 11px 11px padding to join a folder tab, but this picker has no tab, so its scoped surface
 * reuses the existing 11px side/bottom inset on every edge; only the top inset grows by 4px.
 */
.legacy-card-picker .legacy-native-feature-body {
  display: flex;
  overflow: hidden;
}

.legacy-card-picker[hidden] {
  display: none;
}

.legacy-card-picker .custom-deck-editor {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.legacy-card-picker .legacy-card-picker__content-surface {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 11px;
}

.legacy-card-picker .legacy-card-picker__results {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}

.legacy-card-picker .custom-card-list {
  max-height: none;
}

.legacy-card-picker .legacy-card-picker__deck-summary .legacy-card-picker__view-buttons {
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: row;
  gap: 6px;
}

.legacy-card-picker .legacy-card-picker__code-field {
  width: 100%;
  min-width: 0;
  container-type: inline-size;
}

.legacy-card-picker .custom-card-tile-button {
  position: relative;
}

.legacy-card-picker .custom-card-thumb img {
  object-fit: contain;
}

.static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-editor button.custom-card-tile-button.is-selected {
  border-radius: var(--menu-radius-control);
  background: var(--cf-menu-accent-soft);
  box-shadow: none;
  outline: 1px solid var(--cf-menu-accent-focus);
  outline-offset: -1px;
}

.static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-editor button.custom-card-tile-button.is-selected .custom-card-thumb {
  border-color: var(--cf-menu-accent-focus);
  background: var(--cf-menu-panel-strong);
  box-shadow: none;
}

.legacy-card-picker .legacy-card-picker__grid-code {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-card-picker .custom-deck-editor button.custom-card-row--identity {
  grid-template-columns: 24px minmax(56px, 76px) minmax(0, 1fr) 18px;
  border: 0;
  border-radius: var(--menu-radius-control);
  background: transparent;
  color: inherit;
  padding: 3px 0;
  text-align: left;
}

.legacy-card-picker .legacy-card-picker__list-code,
.legacy-card-picker .legacy-card-picker__list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-card-picker .legacy-card-picker__list-code {
  grid-column: 2;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

.legacy-card-picker .legacy-card-picker__list-name {
  grid-column: 3;
  color: var(--text);
  font-size: 0.78rem;
}

.legacy-card-picker .custom-card-row--identity .legacy-card-picker__list-thumb {
  grid-column: 4;
  width: 18px;
  height: 24px;
  justify-self: end;
  border-radius: var(--menu-radius-control);
}

.legacy-card-picker .custom-card-row--identity .custom-card-order {
  grid-column: 1;
}

.static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-editor button.custom-card-row--identity.is-selected {
  background: var(--cf-menu-panel-strong);
  box-shadow: none;
}

.static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-editor button.custom-deck-icon-tool[aria-pressed="true"],
.static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-editor .legacy-card-picker__view-buttons button[aria-pressed="true"] {
  border-color: var(--cf-menu-accent-focus);
  background: var(--cf-menu-accent-soft);
  color: var(--text);
  box-shadow: none;
}

.static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-editor .legacy-card-picker__code-field input {
  box-sizing: border-box;
  width: 100%;
  height: var(--reading-control-height);
  padding: 0 8px;
  font-size: 1rem;
  line-height: 1.2;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--cf-color-card-bg);
  color: var(--text);
  outline: none;
  text-align: center;
}

.static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-editor .legacy-card-picker__code-field input::placeholder {
  font-size: 0.5rem;
  font-size: clamp(0.5rem, 3.6cqi, 0.82rem);
}

.static-menu-modal.legacy-card-picker .legacy-native-menu-dialog .legacy-card-picker__code-field input:focus-visible {
  border-color: var(--line);
  box-shadow: none;
  outline: none;
}

.legacy-card-picker .custom-card-tile-button:disabled,
.legacy-card-picker .custom-card-row--identity:disabled {
  opacity: 0.38;
}

.legacy-card-picker .legacy-card-picker__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (max-height: 420px) {
  .static-menu-modal.legacy-card-picker .legacy-native-feature-body {
    overflow: auto;
  }

  .static-menu-modal.legacy-card-picker .legacy-native-feature-body .custom-deck-builder-stage.legacy-card-picker__content-surface,
  .static-menu-modal.legacy-card-picker .legacy-native-feature-body .legacy-card-picker__results {
    flex: 0 0 auto;
    overflow: visible;
  }
}
