/* ========================================
   Cognitive Trap Repository
   Design system: Coral accent, Stripe-minimal
   ======================================== */

:root {
  --coral: #DA7756;
  --coral-hover: #c86a4a;
  --coral-active: #b55e40;
  --coral-subtle: rgba(218, 119, 86, 0.12);
  --coral-light: #FDF4F0;

  --gray-900: #1a1a1a;
  --gray-800: #2d2d4a;
  --gray-700: #444b6e;
  --gray-600: #5a6178;
  --gray-500: #6b7280;
  --gray-300: #cfd7df;
  --gray-200: #e8e8ee;
  --gray-100: #f6f9fc;
  --gray-50: #fafbfc;
  --white: #ffffff;

  --success: #24b47e;
  --success-bg: #f0fdf8;
  --danger: #e25950;
  --danger-bg: #fef2f2;
  --warning: #f5be58;
  --warning-bg: #fffbeb;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.16);

  --radius: 4px;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'SF Mono', 'Fira Code', Consolas, Monaco, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 32px; }

a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Hero ---- */
.hero {
  background: var(--white);
  border-bottom: 2px solid var(--coral);
  padding: 48px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  font-size: 16px;
  color: var(--gray-700);
  margin-bottom: 16px;
}
.hero-description {
  max-width: 640px;
  margin: 0 auto 24px;
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.6;
}

.hero-small { padding: 32px 0 28px; }
.hero-small h1 { font-size: 24px; }

.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.back-link {
  display: inline-block;
  color: var(--gray-500);
  font-size: 13px;
  margin-bottom: 12px;
}
.back-link:hover { color: var(--coral); text-decoration: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--coral); color: var(--white); }
.btn-primary:hover { background: var(--coral-hover); box-shadow: var(--shadow); }
.btn-secondary { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { border-color: var(--coral); color: var(--coral); }
.btn-ghost { background: none; color: var(--coral); padding: 0 12px; }
.btn-ghost:hover { background: var(--coral-subtle); }
.btn-large { height: 48px; padding: 0 28px; font-size: 15px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: none;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--coral); color: var(--coral); }

/* ---- Stats Bar ---- */
.stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 0;
}
.stats-grid { display: flex; justify-content: center; gap: 48px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-number { display: block; font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 11px; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* ---- Controls ---- */
.controls { padding: 28px 0 12px; }
.search-wrapper {
  position: relative;
  max-width: 520px;
  margin: 0 auto 14px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  pointer-events: none;
}
#search,
.search-wrapper input[type="text"] {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search:focus,
.search-wrapper input[type="text"]:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-subtle);
}
#search::placeholder,
.search-wrapper input[type="text"]::placeholder { color: var(--gray-600); }

.filters { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.filter-btn {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.filter-btn:hover { border-color: var(--coral); color: var(--coral); }
.filter-btn.active { background: var(--coral); color: var(--white); border-color: var(--coral); }

/* ---- Sort Bar ---- */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 14px;
  flex-wrap: wrap;
}
.sort-label {
  font-size: 11px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  white-space: nowrap;
}
.sort-options { display: flex; gap: 4px; }
.sort-btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.sort-btn:hover { border-color: var(--coral); color: var(--coral); }
.sort-btn.active { background: var(--gray-900); color: var(--white); border-color: var(--gray-900); }
.results-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
}

/* ---- Trap Grid ---- */
.trap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding-bottom: 40px;
}

/* ---- Trap Card ---- */
.trap-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.trap-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--gray-300);
  transform: translateY(-1px);
}

.trap-card-image {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: var(--gray-100);
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.trap-card-image-placeholder {
  width: 100%;
  height: 180px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 13px;
  border-bottom: 1px solid var(--gray-200);
}

.trap-card-body { padding: 16px; }

.trap-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
  margin-bottom: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-category { background: var(--gray-100); color: var(--gray-700); }

.trap-card-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }

.trap-card-description {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Key Stats on Card */
.trap-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.trap-stat {
  text-align: center;
  padding: 8px 4px;
  background: var(--gray-50);
}
.trap-stat-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
}
.trap-stat-value.good { color: var(--success); }
.trap-stat-value.bad { color: var(--danger); }
.trap-stat-value.warn { color: var(--warning); }
.trap-stat-value.neutral { color: var(--gray-800); }
.trap-stat-value.muted { color: var(--gray-300); }
.trap-stat-label {
  font-size: 10px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.trap-stat-na {
  text-align: center;
  padding: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--gray-500);
  font-style: italic;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  transform: translateY(12px);
  transition: transform 0.2s;
  position: relative;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  color: var(--gray-500);
  cursor: pointer;
  font-size: 18px;
  z-index: 10;
  transition: all 0.15s;
}
.modal-close:hover { border-color: var(--gray-300); color: var(--gray-900); }

/* Modal: Image section */
.modal-image-section {
  position: relative;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  padding: 24px;
  text-align: center;
}
.modal-image {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}
.modal-download-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

/* Modal: Body */
.modal-body { padding: 24px; }

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.modal-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }

.modal-description {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Modal: Sections */
.modal-section {
  margin-bottom: 20px;
}
.modal-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-200);
}

/* Modal: Question box (copy-paste ready) */
.question-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
}
.question-box p { font-size: 14px; color: var(--gray-900); line-height: 1.5; }
.question-box .answer { color: var(--success); font-weight: 700; }
.question-box .options-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.question-box .options-list li {
  font-size: 13px;
  color: var(--gray-700);
  padding: 2px 0;
}
.question-box .options-list li.correct {
  color: var(--success);
  font-weight: 600;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* Modal: Stats grid */
.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.modal-stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--white);
}
.modal-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
}
.modal-stat-label {
  display: block;
  font-size: 10px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.modal-stat-sub {
  display: block;
  font-size: 11px;
  color: var(--gray-600);
  margin-top: 2px;
}
.modal-stat-value.muted { color: var(--gray-300); }

/* Modal: Discrimination tooltip (hover to show, floats above modal) */
.modal-stat.has-tooltip {
  cursor: help;
}
.modal-stat.has-tooltip .modal-stat-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  text-decoration-color: var(--gray-400);
}
.stat-tooltip-float {
  position: fixed;
  width: 300px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.1);
  font-size: 12px;
  color: var(--gray-700);
  line-height: 1.6;
  z-index: 2000;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  pointer-events: auto;
  animation: tooltipFadeIn 0.15s ease;
}
@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.stat-tooltip-float p {
  margin: 4px 0;
}
.stat-popover-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-900);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.stat-popover-formula {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--coral);
  font-weight: 600;
  padding: 6px 10px;
  background: var(--coral-light);
  border-radius: 4px;
  margin-bottom: 8px;
}
.stat-popover-note {
  font-size: 10px;
  color: var(--gray-500);
  font-style: italic;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-200);
}

/* Modal: Model table */
.model-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.model-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.model-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-900);
}
.model-table tr:last-child td { border-bottom: none; }
.model-table .rate { font-weight: 600; font-family: var(--mono); font-size: 12px; }
.model-table .rate-zero { color: var(--danger); }
.model-table .rate-low { color: var(--warning); }
.model-table .rate-high { color: var(--success); }

/* Provider badges in model table */
.provider-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.provider-anthropic { background: #fce7e1; color: #b94c2e; }
.provider-openai { background: #e1f5e4; color: #2e7d32; }
.provider-google { background: #dbeafe; color: #1e40af; }

.method-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.method-chat { background: #fef3c7; color: #92400e; }
.method-api { background: #e0e7ff; color: #3730a3; }

/* Subtle "more info on hover" marker next to model names that have config metadata */
.config-marker {
  color: var(--gray-500);
  font-size: 11px;
  cursor: help;
  margin-left: 2px;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.model-table tr:hover .config-marker { opacity: 1; }

/* ===========================================================
   View toggle (Browse Traps / Browse Models)
   =========================================================== */
.view-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: 10px;
  margin: 28px auto 20px;
}
.view-toggle-wrapper {
  display: flex;
  justify-content: center;
}
.view-btn {
  padding: 9px 22px;
  border: none;
  background: transparent;
  border-radius: 7px;
  color: var(--gray-700);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.view-btn.active {
  background: white;
  color: var(--gray-900);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.view-btn:hover:not(.active) { color: var(--gray-900); }

.view-help {
  margin: 4px 0 20px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--gray-600);
  max-width: 720px;
}
.view-help strong { color: var(--gray-900); font-weight: 600; }

/* Sub-view + group-by control row */
.model-control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin: 16px 0 18px;
  padding: 12px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.control-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.sub-view-toggle {
  display: inline-flex;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 3px;
}
.sub-view-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sub-view-btn.active {
  background: var(--gray-900);
  color: white;
}
.sub-view-btn:hover:not(.active) { color: var(--gray-900); background: var(--gray-100); }

/* ===========================================================
   Top summary banner (shared by all model sub-views)
   =========================================================== */
.model-summary-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  padding: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  margin-bottom: 22px;
  overflow: hidden;
}
.msb-stat {
  padding: 18px 22px;
  border-right: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msb-stat:last-child { border-right: none; }
.msb-stat.msb-wide { grid-column: span 2; }
.msb-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.msb-num.msb-good { color: var(--success); }
.msb-num.msb-bad  { color: var(--danger); }
.msb-sub {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  line-height: 1.4;
}
.msb-lbl {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 4px;
}

/* ===========================================================
   Group header (when Group-by: provider/family/thinking)
   =========================================================== */
.model-group-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 18px;
  margin: 24px 0 12px;
  background: var(--gray-50);
  border-left: 3px solid var(--gray-300);
  border-radius: 0 8px 8px 0;
}
.model-group-header.provider-anthropic { border-left-color: #B8521C; background: #fef6f1; }
.model-group-header.provider-openai    { border-left-color: #047857; background: #f0fdf6; }
.model-group-header.provider-google    { border-left-color: #1d4ed8; background: #eff6ff; }

.mg-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
}
.mg-meta {
  font-size: 12px;
  color: var(--gray-600);
  font-variant-numeric: tabular-nums;
}
.mg-avg {
  margin-left: auto;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mg-avg-lbl {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 4px;
}

/* ===========================================================
   Provider badges (shared)
   =========================================================== */
.provider-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.provider-anthropic { background: #fde7df; color: #B8521C; }
.provider-openai    { background: #d1f5eb; color: #047857; }
.provider-google    { background: #dceaff; color: #1d4ed8; }

.thinking-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #f3e8ff;
  color: #7c3aed;
}

/* ===========================================================
   Pass-rate semantic colors (used everywhere)
   =========================================================== */
.rate-high { color: var(--success); }
.rate-mid  { color: #d97706; }
.rate-low  { color: #ea580c; }
.rate-zero { color: var(--danger); }

.rate-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 13px;
  min-width: 56px;
  text-align: center;
}
.rate-badge.rate-high { background: #d1fae5; color: #047857; }
.rate-badge.rate-mid  { background: #fef3c7; color: #b45309; }
.rate-badge.rate-low  { background: #ffedd5; color: #c2410c; }
.rate-badge.rate-zero { background: #fee2e2; color: #b91c1c; }

/* ===========================================================
   SUB-VIEW: Card grid (default)
   =========================================================== */
.model-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}
.model-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 22px 22px 18px;
  cursor: pointer;
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.model-card:hover, .model-card:focus-visible {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  border-color: var(--gray-300);
  outline: none;
  transform: translateY(-1px);
}
.mc-header { display: flex; flex-direction: column; gap: 6px; }
.mc-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-title {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.25;
}
.mc-subtitle {
  font-size: 12px;
  color: var(--gray-500);
}
.mc-subtitle code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--gray-50);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
}

.mc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.mc-stat-tile {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mc-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.mc-stat-lbl {
  font-size: 10.5px;
  color: var(--gray-500);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mc-avg-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.mc-avg-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s;
}
.mc-avg-bar-fill.rate-high { background: var(--success); }
.mc-avg-bar-fill.rate-mid  { background: #f59e0b; }
.mc-avg-bar-fill.rate-low  { background: #ea580c; }
.mc-avg-bar-fill.rate-zero { background: var(--danger); }

.mc-cat-section {
  border-top: 1px solid var(--gray-100);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mc-cat-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.mc-cat-row {
  display: grid;
  grid-template-columns: 1fr 100px 50px;
  align-items: center;
  gap: 10px;
}
.mc-cat-name {
  font-size: 13px;
  color: var(--gray-900);
  font-weight: 500;
}
.mc-cat-n {
  font-weight: 400;
  color: var(--gray-500);
  font-size: 11px;
}
.mc-cat-bar {
  height: 5px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.mc-cat-bar-fill {
  height: 100%;
  border-radius: 999px;
}
.mc-cat-bar-fill.rate-high { background: var(--success); }
.mc-cat-bar-fill.rate-mid  { background: #f59e0b; }
.mc-cat-bar-fill.rate-low  { background: #ea580c; }
.mc-cat-bar-fill.rate-zero { background: var(--danger); }
.mc-cat-pct {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  text-align: right;
}

.mc-footer {
  margin-top: 4px;
  font-size: 12px;
  color: var(--gray-500);
  font-style: italic;
}
.model-card:hover .mc-footer { color: var(--gray-900); }

/* ===========================================================
   SUB-VIEW: List (compact table)
   =========================================================== */
.model-list-wrapper {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}
.model-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.model-list-table thead th {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.model-list-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.model-list-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.model-list-table tbody tr:hover { background: var(--gray-50); }
.model-list-table tbody tr:last-child td { border-bottom: none; }

.lt-rank   { width: 40px; color: var(--gray-400); font-variant-numeric: tabular-nums; }
.lt-num    { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lt-muted  { color: var(--gray-500); }
.lt-config { font-family: var(--mono); color: var(--gray-600); white-space: nowrap; }
.lt-config code {
  background: var(--gray-50);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
  font-size: 11.5px;
}
.lt-model strong { color: var(--gray-900); font-weight: 600; }

/* ===========================================================
   SUB-VIEW: Matrix (model × trap; horizontally scrollable)
   =========================================================== */
.model-matrix-wrapper {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow-x: auto;
  position: relative;
}
.mt-scroll-hint {
  font-size: 11px;
  color: var(--gray-500);
  padding: 8px 16px 0;
}
.model-matrix-table {
  border-collapse: collapse;
  font-size: 12.5px;
  margin: 4px 0 0;
}
.model-matrix-table thead th {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
  vertical-align: bottom;
}
.model-matrix-table thead th.mt-trap-col {
  min-width: 110px;
  max-width: 130px;
}
.mt-trap-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 2px;
}
.mt-trap-cat {
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.model-matrix-table tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--gray-100);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-weight: 600;
}
.model-matrix-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.model-matrix-table tbody tr:hover { background: var(--gray-50); }
.mt-rank   { color: var(--gray-400); width: 40px; }
.mt-model  { text-align: left !important; min-width: 200px; padding: 10px 14px !important; font-family: inherit; font-weight: normal; }
.mt-model strong { color: var(--gray-900); font-weight: 600; font-size: 13.5px; }
.mt-model-sub { margin-top: 4px; }
.mt-cell.rate-high  { background: #d1fae5; color: #047857; }
.mt-cell.rate-mid   { background: #fef3c7; color: #b45309; }
.mt-cell.rate-low   { background: #ffedd5; color: #c2410c; }
.mt-cell.rate-zero  { background: #fee2e2; color: #b91c1c; }
.mt-cell::after     { content: "%"; font-size: 10px; opacity: 0.7; margin-left: 1px; }
.mt-na     { color: var(--gray-400); }
.mt-avg    { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 60px; padding: 10px 14px !important; }
.mt-avg::after { content: "%"; font-size: 10px; opacity: 0.7; margin-left: 1px; }

/* ===========================================================
   Empty state inside model view
   =========================================================== */
.empty-state-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
  font-size: 14px;
  background: white;
  border: 1px dashed var(--gray-200);
  border-radius: 12px;
}

/* ===========================================================
   Modal meta row (model-detail modal)
   =========================================================== */
.modal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
  font-size: 13px;
  color: var(--gray-600);
}
.modal-meta-text strong { color: var(--gray-900); }
.modal-title-block h2 { margin: 0; }

/* ===========================================================
   Mobile responsiveness
   =========================================================== */
@media (max-width: 720px) {
  .model-cards-grid { grid-template-columns: 1fr; }
  .mc-stats { grid-template-columns: repeat(2, 1fr); }
  .model-control-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .control-group { flex-wrap: wrap; }
  .msb-stat.msb-wide { grid-column: span 1; }
}

.pass-bar-cell { width: 100px; }
.pass-bar {
  background: #fee2e2;
  border-radius: 2px;
  height: 14px;
  overflow: hidden;
}
.pass-bar-fill {
  background: var(--success);
  height: 100%;
  border-radius: 2px;
  min-width: 1px;
}

/* Modal: Source */
.source-list { list-style: none; }
.source-list li {
  font-size: 13px;
  color: var(--gray-700);
  padding: 3px 0;
  padding-left: 16px;
  position: relative;
}
.source-list li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--gray-500);
}

/* ---- Source Filter Chips ---- */
.source-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.source-chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.source-chip:hover { border-color: var(--coral); color: var(--coral); }
.source-chip.active {
  background: var(--gray-900);
  color: var(--white);
  border-color: var(--gray-900);
}

/* ---- Source Tags (inline in tables) ---- */
.source-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
}

/* ---- Contribution badge on card ---- */
.badge-contrib {
  background: var(--coral-subtle);
  color: var(--coral);
}

/* ---- Contribution Timeline ---- */
.contrib-timeline-section { margin-top: 8px; }
.contrib-timeline {
  position: relative;
  padding-left: 20px;
}
.contrib-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--gray-200);
}
.contrib-entry {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  position: relative;
}
.contrib-entry:last-child { padding-bottom: 0; }
.contrib-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  position: relative;
  z-index: 1;
  margin-left: -20px;
}
.contrib-content { flex: 1; min-width: 0; }
.contrib-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.contrib-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
}
.contrib-date {
  font-size: 11px;
  color: var(--gray-500);
  font-family: var(--mono);
}
.contrib-type {
  font-size: 11px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-top: 1px;
}
.contrib-desc {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 3px;
  line-height: 1.4;
}

/* Row fade for source filtering */
.model-table tr { transition: opacity 0.15s; }

/* ---- Model Summary Bar ---- */
.model-summary-bar {
  display: flex;
  gap: 16px;
  padding: 8px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.model-summary-item {
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 600;
  white-space: nowrap;
}

/* ---- Provider Filter Chips ---- */
.model-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.provider-chip {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.provider-chip:hover { border-color: var(--coral); color: var(--coral); }
.provider-chip.active {
  background: var(--gray-900);
  color: var(--white);
  border-color: var(--gray-900);
}
.chip-anthropic.active { background: #b94c2e; border-color: #b94c2e; }
.chip-openai.active { background: #2e7d32; border-color: #2e7d32; }
.chip-google.active { background: #1e40af; border-color: #1e40af; }

/* ---- Model Table Pagination ---- */
.model-row-hidden { /* initially hidden, toggled by JS */ }
.model-show-toggle { cursor: pointer; }

/* ---- Sortable Headers ---- */
.model-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.model-table th.sortable:hover { color: var(--coral); }
.model-table th.sortable.active-sort { color: var(--gray-900); }
.sort-arrow {
  font-size: 10px;
  margin-left: 2px;
  display: inline-block;
  width: 10px;
}

/* ---- Agent Summary Bar ---- */
.agent-summary-bar {
  display: flex;
  gap: 16px;
  padding: 8px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.agent-summary-item {
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 600;
  white-space: nowrap;
}
.agent-fail-highlight { color: var(--danger); }

/* ---- Trial Comparison (model vs agent) ---- */
.trial-comparison {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 6px 0;
  margin-top: 8px;
  font-size: 11px;
  color: var(--gray-600);
  flex-wrap: wrap;
}
.trial-comparison-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  color: var(--gray-500);
}
.trial-comparison-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.trial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.model-dot { background: #e0e7ff; border: 1px solid #3730a3; }
.agent-dot { background: #fce7e1; border: 1px solid var(--coral); }

/* ---- Submit Page ---- */
.submit-page { padding-top: 32px; padding-bottom: 48px; }

.submit-intro {
  max-width: 640px;
  margin: 0 auto 32px;
  font-size: 14px;
  color: var(--gray-700);
  text-align: center;
  line-height: 1.6;
}

.req-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.req-box {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
}
.req-box h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--gray-900); }
.req-box ul { list-style: none; }
.req-box li { padding: 3px 0; font-size: 13px; color: var(--gray-700); }
.req-required li::before { content: "\2713  "; color: var(--success); font-weight: 700; }
.req-optional li::before { content: "\25CB  "; color: var(--gray-500); }

.submit-action {
  text-align: center;
  margin-bottom: 32px;
  padding: 32px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}
.submit-action h2 { font-size: 18px; margin-bottom: 8px; }
.submit-action > p { color: var(--gray-700); max-width: 520px; margin: 0 auto 20px; font-size: 14px; }
.submit-alt { margin-top: 16px; font-size: 12px; color: var(--gray-500); }
.submit-alt a { color: var(--coral); }

.submit-guide h2 { font-size: 18px; margin-bottom: 16px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.guide-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
}
.guide-item h4 { font-size: 14px; color: var(--gray-900); margin-bottom: 6px; }
.guide-item p { font-size: 13px; color: var(--gray-700); line-height: 1.5; }

/* ---- CTA Section ---- */
.cta-section {
  background: var(--coral-light);
  border-top: 1px solid var(--coral-subtle);
  padding: 40px 0;
  text-align: center;
}
.cta-section h2 { font-size: 18px; margin-bottom: 6px; color: var(--gray-900); }
.cta-section p { color: var(--gray-700); margin-bottom: 16px; max-width: 500px; margin-left: auto; margin-right: auto; font-size: 14px; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-500);
  font-size: 14px;
}

/* ---- Footer ---- */
footer { background: var(--gray-900); color: rgba(255,255,255,0.6); padding-top: 32px; }
.footer-content { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; padding-bottom: 24px; }
.footer-heading { font-weight: 700; color: rgba(255,255,255,0.85); margin-bottom: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.footer-cite p { font-size: 13px; line-height: 1.5; }
.footer-cite em { font-style: italic; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 4px; }
.footer-links a { color: rgba(255,255,255,0.5); font-size: 13px; }
.footer-links a:hover { color: var(--coral); }
.footer-license { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.footer-license p { font-size: 12px; line-height: 1.5; }
.footer-license img { vertical-align: middle; margin-right: 4px; }
.footer-license a { color: rgba(255,255,255,0.7); }
.footer-license a:hover { color: var(--coral); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 12px 0;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-900);
  color: var(--white);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 2000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .hero { padding: 32px 0 28px; }
  .hero h1 { font-size: 22px; }
  .stats-grid { gap: 24px; }
  .trap-grid { grid-template-columns: 1fr; }
  .req-columns { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .footer-content { grid-template-columns: 1fr; gap: 20px; }
  .modal-overlay { padding: 16px; }
  .modal-stats { grid-template-columns: 1fr 1fr 1fr; }
}

/* ===========================================================
   Model-detail modal (clean header + meta + stats)
   =========================================================== */
.model-detail-header {
  margin-bottom: 18px;
  padding-right: 40px;          /* leave room for close button */
}
.model-detail-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.model-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 13px;
  color: var(--gray-700);
}
.model-detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.model-detail-chip strong {
  color: var(--gray-900);
  font-weight: 600;
}
.model-detail-chip code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--gray-900);
}
.model-detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
}

/* ===========================================================
   Evolution view — chart + controls
   =========================================================== */
.evo-chart-wrapper {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 12px 16px 8px;
  overflow: hidden;
}
.evo-svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: var(--font);
}
.evo-grid {
  stroke: var(--gray-200);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}
.evo-axis {
  stroke: var(--gray-400);
  stroke-width: 1;
}
.evo-tick {
  stroke: var(--gray-400);
  stroke-width: 1;
}
.evo-axis-label {
  font-size: 11px;
  fill: var(--gray-600);
}
.evo-axis-title {
  font-size: 12px;
  fill: var(--gray-700);
  font-weight: 600;
}
.evo-human {
  stroke: #c0392b;
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
  opacity: 0.7;
}
.evo-human-label {
  font-size: 10.5px;
  fill: #c0392b;
  font-weight: 600;
}
.evo-trend {
  stroke: #94a3b8;
  stroke-width: 1.5;
  opacity: 0.7;
}
.evo-pt {
  cursor: pointer;
  transition: opacity 0.12s, transform 0.12s;
  transform-origin: center;
  transform-box: fill-box;
}
.evo-pt:hover { opacity: 1; transform: scale(1.5); }
.evo-label {
  font-size: 9.5px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0.85;
}
.evo-tooltip {
  position: absolute;
  background: var(--gray-900);
  color: white;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  font-family: var(--font);
  white-space: nowrap;
}
.evo-trap-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.evo-trap-chip {
  padding: 5px 12px;
  border: 1px solid var(--gray-200);
  background: white;
  border-radius: 999px;
  color: var(--gray-700);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.evo-trap-chip:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}
.evo-trap-chip.active {
  background: var(--gray-900);
  border-color: var(--gray-900);
  color: white;
}
.evo-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--gray-700);
  cursor: pointer;
  user-select: none;
}
.evo-toggle-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--coral);
}
.evo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 4px 0;
  margin-bottom: 48px;       /* breathing room before the CTA section */
  font-size: 12.5px;
  color: var(--gray-700);
  align-items: center;
}
.evo-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.evo-legend-text {
  margin-left: auto;
  color: var(--gray-600);
  font-style: italic;
}
.evo-legend-divider {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--gray-200);
  margin: 0 4px;
}
.evo-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid;
}
.evo-dot-anthropic { background: #c44e2d; border-color: #c44e2d; }
.evo-dot-openai    { background: #3a7d5e; border-color: #3a7d5e; }
.evo-dot-google    { background: #2c5f7c; border-color: #2c5f7c; }
.evo-dot-filled    { background: var(--gray-900); border-color: var(--gray-900); }
.evo-dot-hollow    { background: white; border-color: var(--gray-900); }

/* ===========================================================
   Tightening: model-control-row spacing on smaller widths
   =========================================================== */
@media (max-width: 980px) {
  .model-control-row {
    gap: 14px;
    padding: 12px;
  }
  .model-detail-stats { grid-template-columns: 1fr 1fr; }
}

/* ===========================================================
   Consolidated Model-View / Evolution control panel
   ===========================================================
   One panel with: search bar, then a 3-row grid of label + segmented
   control. Replaces the previous scattered 4-row layout.
   =========================================================== */
.mv-controls {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 18px 0 18px;
  box-shadow: var(--shadow-sm);
}
.mv-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.mv-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  pointer-events: none;
}
.mv-search input[type="text"] {
  flex: 1;
  height: 38px;
  padding: 0 16px 0 38px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-900);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.mv-search input[type="text"]:focus {
  outline: none;
  background: white;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-subtle);
}
.mv-search input[type="text"]::placeholder { color: var(--gray-500); }
.mv-count {
  font-size: 12.5px;
  color: var(--gray-600);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
}

.mv-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.mv-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 70px;
  flex-shrink: 0;
}
.mv-label-mid {
  width: auto;
  margin-left: 12px;
  border-left: 1px solid var(--gray-200);
  padding-left: 14px;
}

.mv-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 3px;
}
.mv-seg {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--gray-700);
  font-weight: 500;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.mv-seg:hover:not(.active) {
  color: var(--gray-900);
  background: white;
}
.mv-seg.active {
  background: white;
  color: var(--gray-900);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.mv-seg-divider {
  margin-left: 6px;
  border-left: 1px solid var(--gray-300);
  padding-left: 14px !important;
  border-radius: 0 6px 6px 0;
}

/* Evolution-view trap filter chips: same look as segmented, but in
   "free-form chip" mode (multi-select) instead of segmented (single) */
.evo-trap-filter {
  background: transparent;
  padding: 0;
  flex-wrap: wrap;
  gap: 6px;
}
.evo-trap-filter .evo-trap-chip {
  padding: 6px 12px;
  background: var(--gray-100);
  border: 1px solid transparent;
  color: var(--gray-700);
  border-radius: 999px;
  font-weight: 500;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.evo-trap-filter .evo-trap-chip:hover { background: var(--gray-50); border-color: var(--gray-200); }
.evo-trap-filter .evo-trap-chip.active {
  background: var(--gray-900);
  color: white;
  border-color: var(--gray-900);
}

@media (max-width: 720px) {
  .mv-label { width: auto; }
  .mv-label-mid { margin-left: 0; padding-left: 0; border-left: none; }
}
