/* ===== TetrisBench Page ===== */

.tetrisbench-page {
  min-height: 100vh;
  padding: 30px 20px 60px;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* ===== Header ===== */
.tetrisbench-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.back-link:hover {
  color: var(--human-primary);
  border-color: var(--human-primary);
  background: rgba(0, 255, 200, 0.05);
}

.back-arrow {
  font-size: 1.2rem;
}

.tetrisbench-title {
  font-family: "Orbitron", monospace;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 4px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #ff00ff, #00f5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-icon {
  font-size: 1.3em;
  -webkit-text-fill-color: initial;
}

.header-spacer {
  width: 120px;
}

/* ===== Subtitle ===== */
.page-subtitle {
  text-align: center;
}

.page-subtitle p {
  font-family: "Rajdhani", sans-serif;
  font-size: 1.1rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ===== Benchmark Section ===== */
.benchmark-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 32px;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: "Orbitron", monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 4px;
  margin: 0 0 28px 0;
  text-align: center;
}

.section-icon {
  font-size: 1.5rem;
}

/* ===== Benchmark Grid ===== */
.benchmark-grid {
  overflow-x: auto;
  padding-bottom: 12px;
}

/* ===== Benchmark Matrix Table ===== */
.benchmark-matrix {
  width: 100%;
  border-collapse: collapse;
  font-family: "Rajdhani", sans-serif;
  min-width: 800px;
}

.benchmark-matrix th,
.benchmark-matrix td {
  padding: 16px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.benchmark-matrix thead th {
  background: var(--bg-tertiary);
  font-family: "Orbitron", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ai-primary);
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.matrix-corner {
  width: 180px;
  color: var(--text-muted) !important;
  text-align: left !important;
  padding-left: 20px !important;
}

.matrix-header {
  min-width: 120px;
}

.matrix-header .header-icon {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.model-col {
  color: var(--ai-primary) !important;
}

.winrate-col {
  color: var(--accent-gold) !important;
  min-width: 100px;
}

/* ===== Matrix Rows ===== */
.matrix-row {
  transition: all 0.2s ease;
}

.matrix-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.matrix-row:last-child td {
  border-bottom: none;
}

.matrix-model-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left !important;
  padding-left: 20px !important;
}

.model-icon {
  font-size: 1.4rem;
}

.model-name-text {
  font-family: "Orbitron", monospace;
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: #e0e0e0;
}

/* ===== Matrix Cells ===== */
.matrix-cell {
  vertical-align: middle;
}

.self-cell {
  background: rgba(255, 255, 255, 0.02);
}

.self-indicator {
  color: var(--text-muted);
  font-size: 1.4rem;
  font-weight: 300;
}

.no-games {
  opacity: 0.5;
}

.no-games-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== Battle Record Styling ===== */
.battle-record {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 10px;
  font-family: "Orbitron", monospace;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.battle-record.winning {
  background: rgba(0, 255, 200, 0.12);
  border: 1px solid rgba(0, 255, 200, 0.35);
}

.battle-record.losing {
  background: rgba(255, 100, 100, 0.12);
  border: 1px solid rgba(255, 100, 100, 0.35);
}

.battle-record.neutral {
  background: rgba(255, 200, 50, 0.12);
  border: 1px solid rgba(255, 200, 50, 0.35);
}

.battle-record .wins {
  color: #00ffc8;
}

.battle-record .losses {
  color: #ff6b6b;
}

.battle-record .draws {
  color: #ffc832;
}

.battle-record .separator {
  color: var(--text-muted);
  opacity: 0.5;
}

.total-games {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ===== Win Rate Cell ===== */
.win-rate-cell {
  min-width: 100px;
}

.win-rate {
  font-family: "Orbitron", monospace;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.win-rate.high {
  color: #00ffc8;
  text-shadow: 0 0 12px rgba(0, 255, 200, 0.4);
}

.win-rate.medium {
  color: #ffc832;
  text-shadow: 0 0 12px rgba(255, 200, 50, 0.3);
}

.win-rate.low {
  color: #ff6b6b;
  text-shadow: 0 0 12px rgba(255, 100, 100, 0.3);
}

.win-rate.neutral {
  color: var(--text-muted);
}

.total-record {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: "Orbitron", monospace;
  letter-spacing: 0.5px;
}

/* ===== Legend ===== */
.benchmark-legend {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-record {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: "Orbitron", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

.legend-record .wins {
  color: #00ffc8;
}

.legend-record .losses {
  color: #ff6b6b;
}

.legend-record .draws {
  color: #ffc832;
}

.legend-record .sep {
  color: var(--text-muted);
  opacity: 0.5;
}

.legend-label {
  font-family: "Rajdhani", sans-serif;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ===== Navigation Links ===== */
.bench-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 12px;
  font-family: "Orbitron", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-decoration: none;
  transition: all 0.3s ease;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.nav-link:hover {
  border-color: var(--ai-primary);
  color: var(--ai-primary);
  background: rgba(255, 0, 255, 0.05);
}

.nav-link.primary {
  background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
  color: #fff;
  border: none;
  box-shadow: 0 0 30px rgba(255, 0, 255, 0.3);
}

.nav-link.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(255, 0, 255, 0.5);
  color: #fff;
}

.nav-icon {
  font-size: 1.1rem;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .tetrisbench-page {
    padding: 20px 16px 40px;
    gap: 24px;
  }

  .tetrisbench-header {
    flex-wrap: wrap;
    justify-content: center;
  }

  .back-link {
    order: -1;
    width: 100%;
    justify-content: center;
  }

  .header-spacer {
    display: none;
  }

  .tetrisbench-title {
    text-align: center;
  }

  .benchmark-section {
    padding: 24px 16px;
  }

  .section-title {
    font-size: 0.95rem;
    letter-spacing: 2px;
  }

  .benchmark-matrix th,
  .benchmark-matrix td {
    padding: 12px 8px;
  }

  .benchmark-matrix thead th {
    font-size: 0.6rem;
  }

  .matrix-header .header-icon {
    font-size: 1.1rem;
  }

  .matrix-corner {
    width: 140px;
    padding-left: 12px !important;
  }

  .matrix-header {
    min-width: 90px;
  }

  .matrix-model-name {
    padding-left: 12px !important;
  }

  .model-icon {
    font-size: 1.2rem;
  }

  .model-name-text {
    font-size: 0.8rem;
  }

  .battle-record {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .total-games {
    font-size: 0.65rem;
  }

  .win-rate {
    font-size: 1rem;
  }

  .total-record {
    font-size: 0.65rem;
  }

  .bench-nav {
    flex-direction: column;
  }

  .nav-link {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .tetrisbench-title {
    font-size: 1.4rem;
    letter-spacing: 2px;
  }

  .title-icon {
    font-size: 1.1em;
  }

  .page-subtitle p {
    font-size: 0.9rem;
    letter-spacing: 1px;
  }

  .benchmark-legend {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
}
