@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700;800;900&display=swap');

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

:root {
  /* Unsloth inspired dark theme */
  --bg:        #000000;
  --bg-card:   rgba(255, 255, 255, 0.02);
  --bg-elev:   rgba(255, 255, 255, 0.05);
  --bg-glass:  rgba(0, 0, 0, 0.6);
  
  --border:    rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  
  --text:      #f5f5f7;
  --text-dim:  #a1a1a6;
  --text-faint:#6e6e73;
  
  /* Frog / Tech gradient */
  --primary:   #00ff87;
  --primary-alt: #60efff;
  --primary-glow: rgba(0, 255, 135, 0.25);
  --primary-gradient: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
  
  --gold:      #ffd700;
  --silver:    #c0c0c0;
  --bronze:    #cd7f32;

  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-pill: 9999px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  /* Unsloth style glow effect at the top */
  background-image: 
    radial-gradient(ellipse at 50% -20%, rgba(0, 255, 135, 0.12), transparent 60%),
    radial-gradient(ellipse at 80% 40%, rgba(96, 239, 255, 0.05), transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .logo-text, .bv-rank-num, th {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

a { color: var(--primary); text-decoration: none; transition: all .2s ease; }
a:hover { filter: brightness(1.2); text-shadow: 0 0 12px var(--primary-glow); }

/* ----- Custom Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ----- Header ----- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
}

.logo {
  display: flex; align-items: center; gap: .75rem;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.logo-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 16px rgba(0, 255, 135, 0.3));
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.logo:hover .logo-icon {
  transform: rotate(-8deg) scale(1.05);
}

.logo-text {
  color: var(--text);
}

.text-green {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 16px rgba(0, 255, 135, 0.3));
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 400;
  max-width: 600px;
}
.subtitle.source {
  font-size: .75rem;
  color: var(--text-faint);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

/* ----- Section headers ----- */
.rankings-section { margin-bottom: 5rem; }

.rankings-section h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 2rem;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  color: #fff;
}

.hint {
  font-size: .9rem;
  color: var(--text-faint);
  font-weight: 500;
  font-family: 'Inter', sans-serif;
}

/* ----- Tier cards ----- */
.tier-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.tier-card {
  flex: 1 1 320px;
  max-width: calc(33.333% - 1rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  /* Unsloth subtle inner shadow for depth */
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 32px -8px rgba(0,0,0,0.5);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.tier-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

@media (max-width: 1024px) {
  .tier-card { max-width: calc(50% - 0.75rem); }
}
@media (max-width: 640px) {
  .tier-card { max-width: 100%; }
}

.tier-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}
.tier-card:hover::before { opacity: 1; }

.tier-card h3 {
  font-size: 1rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.tier-list { display: flex; flex-direction: column; gap: .4rem; }

.tier-item {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .6rem;
  border-radius: var(--r-sm);
  font-size: .95rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.tier-item:hover { 
  background: rgba(255,255,255,0.04); 
  border-color: rgba(255,255,255,0.05);
}

.tier-rank {
  color: var(--text-faint);
  font-weight: 800;
  font-size: .9rem;
  font-family: 'Outfit', sans-serif;
  text-align: center;
}
.tier-rank.r1 { color: var(--gold); text-shadow: 0 0 12px rgba(255, 215, 0, 0.4); }
.tier-rank.r2 { color: var(--silver); }
.tier-rank.r3 { color: var(--bronze); }

.tier-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: #fff;
}
.tier-params {
  font-size: .8rem;
  color: var(--text-faint);
  margin-left: .5rem;
}

.tier-score {
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
}

/* ----- Tabs (Unsloth Pill Style) ----- */
.tabs {
  display: inline-flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  background: rgba(255,255,255,0.03);
  padding: 0.35rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
}
.tab-btn {
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  padding: .6rem 1.5rem;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all .2s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.tab-btn:hover { color: #fff; }
.tab-btn.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Hide number input arrows */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

.min-score-label {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
}

.min-input {
  width: 50px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--primary);
  font-weight: 800;
  padding: 0.35rem 0;
  border-radius: var(--r-pill);
  margin-left: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  outline: none;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.min-input:hover {
  background: rgba(255, 255, 255, 0.08);
}

.min-input:focus {
  background: rgba(0, 0, 0, 0.6);
  border-color: var(--primary);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 10px var(--primary-glow);
  cursor: text;
}

/* ----- Bar ranking (Best Value, Best Local) ----- */
.bestvalue-grid {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: .5rem;
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 32px -8px rgba(0,0,0,0.5);
}

.bv-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.25rem;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .2s;
  border: 1px solid transparent;
}
.bv-row:hover { 
  background: rgba(255,255,255,0.03); 
  border-color: rgba(255,255,255,0.05);
}
.bv-row + .bv-row { border-top: 1px solid var(--border); }

.bv-rank-num {
  font-size: 1.4rem;
  color: var(--text-faint);
  text-align: center;
}
.bv-rank-num.r1 { color: var(--gold); }
.bv-rank-num.r2 { color: var(--silver); }
.bv-rank-num.r3 { color: var(--bronze); }

.bv-info { min-width: 0; }
.bv-line1 {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .75rem;
  white-space: nowrap;
  overflow: hidden;
}
.bv-modelname {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.bv-creator-inline {
  font-size: .85rem;
  color: var(--text-faint);
}

.bv-bar-wrap {
  position: relative;
  background: rgba(0,0,0,0.5);
  height: 24px;
  border-radius: var(--r-pill);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.05);
}
.bv-bar {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--r-pill);
  transition: width .8s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 15px var(--primary-glow);
}
.bv-bar-label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  font-size: .8rem;
  font-weight: 800;
  color: #000;
  font-variant-numeric: tabular-nums;
  font-family: 'Outfit', sans-serif;
}

.bv-meta {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  text-align: right;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
  min-width: 5.5rem;
}
.bv-meta strong { color: #fff; font-weight: 700; }

/* ----- Filters panel ----- */
.filters-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 2.5rem;
  margin-bottom: 2.5rem;
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 32px -8px rgba(0,0,0,0.5);
}

.filters-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.filter-group { display: flex; flex-direction: column; gap: .75rem; }
.filter-group label {
  font-size: .8rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

.filter-group input,
.filter-group select {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-strong);
  color: #fff;
  padding: 1rem 1.25rem;
  border-radius: var(--r-sm);
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  transition: all .2s;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--primary);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 0 2px var(--primary-glow);
}

.filter-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.toggle {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .95rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
  font-weight: 500;
}
.toggle:hover { color: #fff; }
.toggle input {
  cursor: pointer;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  background: rgba(0,0,0,0.4);
  position: relative;
  transition: all 0.2s;
}
.toggle input:checked {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}
.toggle input:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 6px;
  width: 4px; height: 10px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.results-info {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .9rem;
  color: var(--text-faint);
  font-weight: 500;
}

/* ----- Table ----- */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 32px -8px rgba(0,0,0,0.5);
  margin-left: calc((50% - 50vw) / 2 + 2rem);
  margin-right: calc((50% - 50vw) / 2 + 2rem);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .95rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  background: rgb(10, 10, 10);
  text-align: left;
  padding: 1.25rem 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  transition: all .2s;
}
th:hover { color: #fff; background: rgba(255,255,255,0.03); }
th.num { text-align: right; }
th.sort-active { color: var(--primary); }
th.sort-active::after { content: ' ▼'; font-size: .7em; margin-left: 6px;}
th.sort-active.sort-asc::after { content: ' ▲'; }

td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
td.num { text-align: right; }

tbody tr {
  cursor: pointer;
  transition: background .2s;
  content-visibility: auto;
  contain-intrinsic-size: auto 54px;
}
tbody tr:hover { background: rgba(255,255,255,0.04); }
tbody tr:last-child td { border-bottom: none; }

#models-table th:nth-child(2),
#models-table td:nth-child(2),
#models-table th:nth-child(3),
#models-table td:nth-child(3) {
  padding-left: .75rem;
  padding-right: .75rem;
  font-size: .85rem;
}
#models-table th:nth-child(2),
#models-table td:nth-child(2) { max-width: 120px; }
#models-table th:nth-child(3),
#models-table td:nth-child(3) { width: 80px; }

.cell-name {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 350px;
}
.name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: #fff;
}

.cell-creator { display: flex; align-items: center; gap: .75rem; color: var(--text-dim); }
.creator-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.badges {
  display: inline-flex;
  gap: .5rem;
  margin-left: .75rem;
}
.badge {
  font-family: 'Outfit', sans-serif;
  font-size: .7rem;
  padding: .25rem .6rem;
  border-radius: var(--r-pill);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.b-reasoning { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.4); }
.b-open      { background: var(--primary-glow); color: var(--primary); border: 1px solid rgba(0, 255, 135, 0.4); }
.b-multi     { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.b-deprecated{ background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }

.intel-bar {
  display: inline-block;
  height: 8px;
  width: 60px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--r-pill);
  margin-right: .75rem;
  vertical-align: middle;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
.intel-bar > span {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--primary-gradient);
  border-radius: var(--r-pill);
}

.dim { color: var(--text-faint); }

/* ----- Modal ----- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}
.modal-content {
  position: relative;
  background: #09090b;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 3rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 32px 64px -16px rgba(0,0,0,0.9);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal:not(.hidden) .modal-content {
  transform: scale(1) translateY(0);
}
.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-close:hover { 
  background: rgba(255,255,255,0.1); 
  color: #fff;
  border-color: rgba(255,255,255,0.1);
  transform: rotate(90deg);
}

.modal-title {
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: .5rem;
  color: #fff;
  letter-spacing: -0.02em;
}
.modal-creator {
  color: var(--text-dim);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
  font-weight: 500;
}

.modal-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.modal-section h4 {
  font-size: .9rem;
  color: var(--primary);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  font-weight: 800;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
}
.kv {
  background: rgba(255,255,255,0.02);
  padding: 1.25rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.kv:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.04); }
.kv-label {
  font-size: .8rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}
.kv-value {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: .5rem;
  color: #fff;
}

/* ----- Loading ----- */
.loading-state {
  text-align: center;
  padding: 6rem 1rem;
  color: var(--text-dim);
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.05);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
  margin: 0 auto 1.5rem;
  box-shadow: 0 0 20px var(--primary-glow);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Footer ----- */
footer {
  text-align: center;
  padding: 3rem;
  font-size: .95rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  margin-top: 5rem;
}
footer p { margin: .25rem 0; }
.footer-by { font-size: .85rem; opacity: .7; }
.footer-by a { color: inherit; }
.footer-by a:hover { color: var(--primary); }

.hidden { display: none !important; }

@media (max-width: 768px) {
  .logo { font-size: 2.5rem; }
  .logo-icon { width: 42px; height: 42px; }
  header { padding: 1.5rem 1rem; }
  main { padding: 2rem 1rem 4rem; }
  .table-wrap { margin-left: 0; margin-right: 0; }
  .filter-toggles { flex-direction: column; gap: 1rem; }
  .modal-content { padding: 2rem; }
}
