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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  font-size: 15px;
}

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

h1 {
  font-size: 1.5rem;
  color: #2563eb;
  text-align: center;
  margin-bottom: 20px;
  font-weight: 700;
}

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

h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #dbeafe;
}

h3 {
  font-size: .9rem;
  font-weight: 700;
  margin: 14px 0 8px;
  color: #374151;
}

/* チーム登録 */
.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .95rem;
}

.input-row button,
.btn-primary {
  padding: 8px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  white-space: nowrap;
}

.input-row button:hover,
.btn-primary:hover {
  background: #1d4ed8;
}

.team-list {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.team-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .9rem;
}

.team-list li button {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: .85rem;
  padding: 0 2px;
  line-height: 1;
}

.team-list li button:hover {
  color: #ef4444;
}

/* 試合結果入力 */
.match-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-row select {
  flex: 1;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .9rem;
  background: #fff;
}

.vs-label {
  font-weight: 700;
  color: #6b7280;
  white-space: nowrap;
}

.score-row {
  justify-content: center;
}

.score-input {
  width: 70px;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1.1rem;
  text-align: center;
}

.score-sep {
  font-size: 1.2rem;
  font-weight: 700;
  color: #374151;
}

.btn-primary {
  align-self: flex-start;
}

/* 試合一覧 */
.match-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.match-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: .9rem;
}

.match-list li .match-info {
  flex: 1;
}

.match-list li button {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: .85rem;
  padding: 0 4px;
}

.match-list li button:hover {
  color: #ef4444;
}

/* 順位表 */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 420px;
}

thead th {
  background: #eff6ff;
  padding: 8px 6px;
  text-align: center;
  font-weight: 700;
  color: #1e40af;
  white-space: nowrap;
}

thead th:nth-child(2) {
  text-align: left;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

tbody td {
  padding: 7px 6px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
}

tbody td:nth-child(2) {
  text-align: left;
  font-weight: 600;
}

tbody tr:first-child td {
  color: #d97706;
  font-weight: 700;
}

/* リセット */
.reset-area {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 20px;
}

.btn-danger {
  padding: 8px 20px;
  background: #fff;
  color: #ef4444;
  border: 1px solid #ef4444;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
}

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

.empty-msg {
  color: #9ca3af;
  font-size: .85rem;
  padding: 8px 0;
}

@media (max-width: 480px) {
  .match-row {
    flex-wrap: wrap;
  }

  .match-row select {
    width: 100%;
  }
}
