* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f7f8fa;
  color: #172033;
}

header {
  padding: 28px 20px 18px;
  text-align: center;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

header h1 {
  margin: 0 0 7px;
  font-size: clamp(28px, 5vw, 42px);
}

header p {
  margin: 0 auto 18px;
  color: #64748b;
  max-width: 720px;
  line-height: 1.5;
}

.tool-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-option {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
}

.nav-option.active {
  background: #172033;
  color: #fff;
  border-color: #172033;
}

.container {
  width: min(1180px, calc(100% - 28px));
  margin: 24px auto 40px;
}

.card {
  background: #fff;
  border: 1px solid #e1e5ea;
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 21px;
}

.card h3 {
  margin: 0;
}

.section-kicker {
  color: #64748b;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-subtitle {
  color: #64748b;
  line-height: 1.55;
  margin: 0 0 18px;
}

.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pipeline-step {
  min-width: 145px;
  padding: 14px 16px;
  border: 1px solid #dbe1e8;
  border-radius: 9px;
  background: #fafafa;
  text-align: center;
}

.pipeline-step strong {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.pipeline-step span {
  font-weight: 700;
}

.pipeline-arrow {
  color: #64748b;
  font-size: 22px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.file-label,
#run-btn {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 16px;
  background: #172033;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

#file-input {
  max-width: 100%;
}

#run-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.image-row,
.evaluation-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.image-box > p,
.chart-label {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.image-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #dfe4ea;
  border-radius: 9px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #94a3b8;
  text-align: center;
  padding: 8px;
}

.image-frame img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat-box {
  min-width: 0;
  border: 1px solid #e1e5ea;
  border-radius: 9px;
  padding: 14px 10px;
  text-align: center;
  background: #fafafa;
}

.stat-box .value {
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.stat-box .label {
  margin-top: 6px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.3;
}

.chart-note {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chart-panel {
  min-width: 0;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 290px;
  border: 1px solid #e1e5ea;
  border-radius: 9px;
  background: #fff;
}

.evaluation-badge {
  display: inline-block;
  margin-bottom: 18px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.evaluation-subheading {
  margin: 22px 0 10px !important;
  font-size: 16px;
}

#status {
  border: 1px solid #dbe1e8;
  background: #fff;
  border-radius: 9px;
  padding: 12px 14px;
  color: #475569;
}

footer {
  text-align: center;
  color: #94a3b8;
  padding: 10px 20px 30px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-row,
  .evaluation-images,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-panel canvas {
    height: 260px;
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 18px, 1180px);
    margin-top: 12px;
  }

  .card {
    padding: 15px;
    border-radius: 10px;
  }

  .pipeline {
    flex-direction: column;
  }

  .pipeline-arrow {
    transform: rotate(90deg);
  }

  .pipeline-step {
    width: 100%;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .file-label,
  #run-btn,
  #file-input {
    width: 100%;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .chart-panel canvas {
    height: 235px;
  }

  header {
    padding-left: 12px;
    padding-right: 12px;
  }
}
