.result {
  text-align: center;
  padding: 18px 6px 6px;
  min-width: 0;
  overflow: hidden;
}

.result h2 {
  margin: 0 0 10px;
  font-size: clamp(1.2rem, 4.5vw, 1.7rem);
  line-height: 1.25;
  word-wrap: break-word;
}

.score-cards {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.score-card {
  border: 1px solid #f3c6dc;
  border-radius: 12px;
  padding: 16px 12px;
  background: #fff8fb;
}

.score-card-correct {
  background: #f0fdf6;
  border-color: #a7f3d0;
}

.score-card-wrong {
  background: #fff1f2;
  border-color: #fecdd3;
}

.score-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.score-value {
  margin: 8px 0 0;
  font-size: 1.9rem;
  font-weight: 800;
}

.result-metrics {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.metric-item {
  border: 1px solid #f3c6dc;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  min-width: 0;
  overflow: hidden;
}

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric-value {
  margin: 5px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.result-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.result-actions .restart-btn {
  margin-top: 0;
}

.review-btn.is-warning {
  background: #fff1f2;
  border-color: #fb7185;
  color: #be123c;
}

.history {
  margin-top: 0;
  text-align: left;
  border: 1px solid #f3c6dc;
  border-radius: 12px;
  padding: 10px 12px 8px;
  background: #fff;
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
}

.history-header,
.history-row {
  display: grid;
  grid-template-columns:
    36px minmax(72px, 1fr) minmax(64px, 1fr) minmax(72px, 1fr)
    minmax(100px, 1.2fr);
  gap: clamp(6px, 2vw, 12px);
  align-items: center;
}

.history-header {
  padding: 6px 8px;
  border-radius: 8px;
  background: #fff4f8;
  color: #9d174d;
  font-size: clamp(0.68rem, 2.2vw, 0.78rem);
  font-weight: 700;
  min-width: 0;
}

.history-header span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 380px) {
  .history-header span {
    white-space: normal;
  }
}

.history-rows {
  margin-top: 0;
  max-height: min(92px, 22dvh);
  overflow: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.history-rows::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.history-row {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #f2d4e2;
  font-size: clamp(0.72rem, 2.4vw, 0.84rem);
  min-width: 0;
}

.history-row.is-latest {
  background: #f7e9f0;
  border-color: #e9b8cf;
}

@media (max-width: 700px) {
  .score-cards,
  .result-metrics {
    grid-template-columns: 1fr;
  }

  .history-header,
  .history-row {
    grid-template-columns:
      30px minmax(60px, 1fr) minmax(56px, 1fr) minmax(60px, 1fr)
      minmax(84px, 1.1fr);
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .result-actions .restart-btn,
  .result-actions .review-btn {
    width: 100%;
  }
}
