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

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

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

h1 {
  font-size: 1.5rem;
  color: #4a7fcb;
  margin-bottom: 20px;
  text-align: center;
}

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

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 10px;
}

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

.form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-group input:focus {
  outline: none;
  border-color: #4a7fcb;
}

.btn-primary {
  width: 100%;
  padding: 10px;
  background: #4a7fcb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 4px;
}

.btn-primary:hover {
  background: #3a6fbb;
}

/* 結果エリア */
.result-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

.btn-danger {
  padding: 6px 12px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

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

.no-data {
  text-align: center;
  color: #aaa;
  padding: 30px 0;
}

/* 生徒カード */
.student-card {
  border: 1px solid #e0e6ef;
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

.student-header {
  background: #4a7fcb;
  color: #fff;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.student-name {
  font-weight: bold;
  font-size: 1rem;
}

.student-meta {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.student-meta span {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 12px;
}

.student-meta .weak-subject {
  background: rgba(255,180,0,0.6);
  color: #fff;
}

/* 成績テーブル */
.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.score-table th {
  background: #f0f4fb;
  padding: 8px 10px;
  text-align: left;
  color: #555;
  font-weight: 600;
  border-bottom: 1px solid #dde3ee;
}

.score-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
}

.score-table tr:last-child td {
  border-bottom: none;
}

.score-table .low-score {
  color: #e74c3c;
  font-weight: bold;
}

.del-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
}

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

/* 順位バッジ */
.rank-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: bold;
}

.rank-1 { background: #ffd700; color: #7a5c00; }
.rank-2 { background: #c0c0c0; color: #444; }
.rank-3 { background: #cd7f32; color: #fff; }
.rank-other { background: #e8eaf6; color: #444; }

@media (max-width: 480px) {
  .student-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .student-meta {
    width: 100%;
  }
}
