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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

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

header {
  text-align: center;
  padding: 20px 0 16px;
}

header h1 {
  font-size: 1.6rem;
  color: #c0392b;
}

section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #555;
}

/* フォーム */
.form-row {
  margin-bottom: 10px;
}

.form-row label {
  display: block;
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 4px;
}

.form-row input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fafafa;
  transition: border-color 0.2s;
}

.form-row input:focus {
  outline: none;
  border-color: #e74c3c;
  background: #fff;
}

.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.btn-primary {
  width: 100%;
  padding: 11px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #c0392b;
}

/* 自己ベスト */
.best-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.best-card {
  background: #fff8f8;
  border: 1px solid #f5c6c6;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.best-card .exercise-name {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
  word-break: break-all;
}

.best-card .best-weight {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e74c3c;
}

.best-card .best-weight span {
  font-size: 0.8rem;
  font-weight: 400;
}

.best-card .best-date {
  font-size: 0.75rem;
  color: #999;
  margin-top: 2px;
}

/* フィルター */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-row label {
  font-size: 0.85rem;
  color: #666;
}

.filter-row select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fafafa;
}

/* 履歴 */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.record-info {
  flex: 1;
}

.record-exercise {
  font-weight: 700;
  font-size: 0.95rem;
  color: #333;
}

.record-detail {
  font-size: 0.82rem;
  color: #666;
  margin-top: 2px;
}

.record-weight-big {
  color: #e74c3c;
  font-weight: 700;
}

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

.record-date {
  font-size: 0.78rem;
  color: #aaa;
  white-space: nowrap;
  margin-left: 8px;
  margin-top: 2px;
}

.btn-delete {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  align-self: center;
  transition: color 0.2s;
}

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

/* 自己ベストバッジ */
.badge-best {
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

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

@media (max-width: 480px) {
  .three-col {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }

  .best-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
