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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f1f8f1;
  color: #222;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* ヘッダー */
header {
  text-align: center;
  padding: 20px 0 16px;
}

header h1 {
  font-size: 1.5rem;
  color: #2e7d32;
}

/* サマリーカード */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card-label {
  font-size: 0.72rem;
  color: #666;
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2e7d32;
}

/* フォームセクション */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-section h2 {
  font-size: 1rem;
  color: #2e7d32;
  margin-bottom: 14px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row label {
  font-size: 0.82rem;
  color: #555;
  font-weight: 600;
}

.form-row input {
  border: 1px solid #cde0cd;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  background: #f9fdf9;
  width: 100%;
}

.form-row input:focus {
  border-color: #2e7d32;
  background: #fff;
}

.btn-primary {
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  margin-top: 4px;
}

.btn-primary:hover {
  background: #1b5e20;
}

/* 履歴セクション */
.history-section {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.history-header h2 {
  font-size: 1rem;
  color: #2e7d32;
}

#history-count {
  font-size: 0.8rem;
  color: #888;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  padding: 20px 0;
}

/* 履歴アイテム */
.history-item {
  border: 1px solid #e0ede0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  background: #fafffe;
  transition: box-shadow 0.2s;
}

.history-item.best {
  border-color: #ffd700;
  background: #fffdf0;
}

.history-item:hover {
  box-shadow: 0 2px 8px rgba(46,125,50,0.12);
}

.score-badge {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2e7d32;
  min-width: 48px;
  text-align: center;
}

.history-item.best .score-badge {
  color: #b8860b;
}

.item-info {
  flex: 1;
}

.item-course {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.item-date {
  font-size: 0.78rem;
  color: #888;
  margin-top: 2px;
}

.item-memo {
  font-size: 0.78rem;
  color: #666;
  margin-top: 3px;
}

.best-badge {
  font-size: 0.7rem;
  background: #ffd700;
  color: #7a5c00;
  border-radius: 4px;
  padding: 2px 6px;
  font-weight: 700;
  position: absolute;
  top: 8px;
  right: 42px;
}

.delete-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.delete-btn:hover {
  color: #e53935;
}

/* レスポンシブ */
@media (max-width: 400px) {
  .summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .card-value {
    font-size: 1.2rem;
  }

  .card-label {
    font-size: 0.65rem;
  }
}
