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

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

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

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

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

/* タブ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #666;
  transition: background 0.2s, color 0.2s;
}

.tab.active {
  background: #4a7fcb;
  color: #fff;
  font-weight: bold;
}

/* タブコンテンツ */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* カード */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #4a7fcb;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
}

/* ボタン */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: bold;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.7;
}

.btn-primary {
  background: #4a7fcb;
  color: #fff;
  width: 100%;
}

.btn-danger {
  background: #e05252;
  color: #fff;
  width: 100%;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
  background: #f0f4f8;
  color: #666;
  border: 1px solid #ddd;
}

/* メッセージ */
.msg {
  font-size: 0.85rem;
  margin-top: 8px;
  color: #4a7fcb;
  min-height: 1.2em;
}

.msg.center {
  text-align: center;
  color: #aaa;
}

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

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

.filter-row select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 120px;
}

/* 生徒カード */
.student-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

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

.student-avg {
  font-size: 0.85rem;
  color: #4a7fcb;
  font-weight: bold;
}

/* 科目テーブル */
.subject-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.subject-table th {
  background: #f0f4f8;
  padding: 6px 8px;
  text-align: left;
  color: #666;
  font-weight: normal;
}

.subject-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f4f8;
  vertical-align: middle;
}

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

.subject-table tr.weak-subject {
  background: #fff5f5;
}

.subject-table tr.weak-subject td:first-child {
  color: #e05252;
  font-weight: bold;
}

.weak-badge {
  display: inline-block;
  background: #e05252;
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}

.score-latest {
  font-weight: bold;
}

.score-count {
  color: #aaa;
  font-size: 0.8rem;
}

/* 削除ゾーン */
.danger-zone {
  background: #fff5f5;
  border: 1px solid #fdd;
}

/* Canvas グラフ */
canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* レスポンシブ */
@media (max-width: 480px) {
  h1 {
    font-size: 1.2rem;
  }

  .tab {
    font-size: 0.78rem;
    padding: 7px 2px;
  }

  .subject-table th,
  .subject-table td {
    padding: 5px 6px;
    font-size: 0.83rem;
  }
}
