* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.container {
  background: #fff;
  padding: 2rem 2.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  min-width: 360px;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.row-center {
  justify-content: center;
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
}

label {
  flex-shrink: 0;
  font-weight: 600;
  min-width: 140px;
}

select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  min-width: 120px;
}

input[type="number"] {
  flex: 0 1 auto;
  width: 100%;
  max-width: 6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

#chooseFile {
  padding: 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
}

#chooseFile:hover {
  background: #f8f8f8;
}

.file-name {
  color: #666;
  font-size: 0.9rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-analyze {
  padding: 0.6rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: #e8a64a;
  color: #1a1a1a;
  cursor: pointer;
}

.btn-analyze:hover {
  background: #df9a3d;
}

.btn-analyze:active {
  transform: scale(0.98);
}

.btn-auto-analyze {
  padding: 0.6rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: #16a34a;
  color: #fff;
  cursor: pointer;
}

.btn-auto-analyze:hover {
  background: #15803d;
}

.btn-auto-analyze:active {
  transform: scale(0.98);
}

.summary-by-grade {
  margin-top: 0.25rem;
}

.summary-by-grade[hidden] {
  display: none;
}

.summary-by-grade .grade-line {
  margin-bottom: 0.25rem;
}

.btn-export {
  padding: 0.6rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.btn-export:hover {
  background: #1d4ed8;
}

.btn-export:active {
  transform: scale(0.98);
}

.row-buttons {
  gap: 1rem;
}

.summary {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.summary-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.summary-line {
  color: #333;
}

#resultCount {
  font-weight: 600;
}

.error {
  color: #c00;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.segment-list-wrap {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.segment-list-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.segment-list {
  max-height: 320px;
  overflow-y: auto;
  font-size: 0.85rem;
  font-family: ui-monospace, monospace;
}

.segment-list table {
  width: 100%;
  border-collapse: collapse;
}

.segment-list th,
.segment-list td {
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #eee;
}

.segment-list th {
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
  background: #fff;
}

.segment-list tr:hover td {
  background: #f8f8f8;
}

.segment-list-empty {
  color: #888;
  margin: 0;
  padding: 0.5rem 0;
}
