:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-hover: #232736;
  --border: #2a2e3d;
  --text: #e1e4ed;
  --text-muted: #8b90a0;
  --primary: #6c8cff;
  --primary-hover: #8aa4ff;
  --positive: #4ade80;
  --negative: #f87171;
  --neutral: #94a3b8;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.report-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-selector label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.report-selector select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.report-selector select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Summary Bar */
.summary-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.badge strong {
  color: var(--text);
}

/* Overview Table */
.overview-table-wrapper {
  overflow-x: auto;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 700px;
}

.overview-table thead th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.overview-table thead th.sticky-col {
  text-align: left;
  z-index: 3;
}

.overview-table tbody td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0;
  vertical-align: middle;
}

.overview-table tbody td:last-child {
  border-right: none;
}

.overview-table .sticky-col {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 1;
  border-right: 2px solid var(--border);
}

.image-name-cell {
  padding: 10px 14px !important;
  font-weight: 500;
  white-space: nowrap;
}

.image-name-cell span {
  vertical-align: middle;
}

.mini-thumb {
  width: 40px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  vertical-align: middle;
  margin-right: 10px;
}

.overview-cell {
  cursor: pointer;
  padding: 8px 12px !important;
  transition: background 0.12s;
}

.overview-cell:hover {
  background: var(--bg-hover);
}

.cell-version {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
}

.cell-version.muted {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.cell-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  background: #2563eb22;
  color: #60a5fa;
  min-width: 22px;
  text-align: center;
}

.cell-label.v2 {
  background: #8b5cf622;
  color: #a78bfa;
}

.cell-label.vs {
  background: #f59e0b22;
  color: #fbbf24;
}

.cell-value {
  font-size: 0.82rem;
  color: var(--text);
}

.cell-score {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary);
}

/* Image Section */
.image-section {
  margin-bottom: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.image-section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.image-thumb-wrapper {
  flex-shrink: 0;
}

.image-thumb {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s;
}

.image-thumb:hover {
  transform: scale(1.05);
}

.image-section-title h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.image-section-title .subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Models Grid */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1px;
  background: var(--border);
}

.model-card {
  background: var(--bg-card);
}

.model-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.model-card-header h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary);
}

.model-card-body {
  padding: 12px 16px 16px;
}

/* Comparison Table */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.comparison-table th,
.comparison-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.comparison-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.comparison-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.comparison-table td.diff {
  font-weight: 600;
}

.positive { color: var(--positive); }
.negative { color: var(--negative); }
.neutral  { color: var(--neutral); }

/* Buttons */
.detail-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-detail {
  font-weight: 500;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
  min-width: 600px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px;
}

/* Run Section inside modal */
.run-section {
  margin-bottom: 24px;
}

.run-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.run-section-header h4 {
  font-size: 0.9rem;
  color: var(--primary);
}

.run-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.overall-summary {
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.84rem;
}

.overall-summary .score-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.82rem;
  margin-right: 8px;
}

/* Activity Table */
.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.activity-table th,
.activity-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.activity-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.activity-table td.score-cell {
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.score-high  { color: var(--positive); }
.score-mid   { color: #facc15; }
.score-low   { color: var(--negative); }

/* Image Preview */
.image-preview-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-width: auto;
}

.image-preview-content img {
  max-width: 85vw;
  max-height: 85vh;
  border-radius: 8px;
}

.image-preview-content .btn-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.6rem;
  color: #fff;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

/* Compare Modal */
.compare-modal-content {
  min-width: 700px;
  max-width: 1100px;
}

.videoscript-cell .activity-cell-explanation {
  font-style: italic;
}

/* Accordion */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.accordion-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg);
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.86rem;
  text-align: left;
  transition: background 0.12s;
}

.accordion-trigger:hover {
  background: var(--bg-hover);
}

.accordion-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.accordion-question {
  flex: 1;
  line-height: 1.4;
}

.accordion-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.accordion-panel {
  padding: 0 16px 16px;
  background: var(--bg-card);
}

/* Run Compare Table */
.run-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 8px;
  table-layout: fixed;
}

.run-compare-table th,
.run-compare-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.run-compare-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
}

.run-compare-table th.col-run {
  width: 50px;
}

.run-compare-table td.run-num {
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
}

.activity-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity-cell-score {
  font-weight: 700;
  font-size: 1rem;
}

.activity-cell-explanation {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .models-grid {
    grid-template-columns: 1fr;
  }
  .modal-content {
    min-width: auto;
    max-width: 98vw;
  }
  .image-section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
