body {
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  background-color: #f0f0f0;
  margin: 0;
  padding: 10px;
}

.container {
  text-align: center;
  max-width: 900px;
  position: relative;
}

h1 {
  color: #333;
  margin: 10px 0;
}

#rouletteTitle {
  padding: 8px;
  width: 200px;
  margin-bottom: 10px;
}

canvas {
  border: 1px solid #333;
  background: #fff;
  margin: 10px 0;
  max-width: 100%;
  height: auto;
}

.copyright {
  position: absolute;
  bottom: 150px;
  right: 10px;
  font-size: 12px;
  color: #333;
}

#participantCount {
  position: absolute;
  bottom: 150px;
  left: 10px;
  font-size: 16px;
  color: #333;
}

.result {
  font-size: 24px;
  font-weight: bold;
  color: #d32f2f;
  min-height: 30px;
  margin: 10px 0;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.upper-controls, .lower-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.add-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
}

.participant-count {
  font-size: 16px;
  color: #333;
  margin: 10px 0;
  display: block;
}

table {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 10px;
  border-collapse: collapse;
}

th, td {
  border: 1px solid #ccc;
  padding: 4px;
}

th {
  background-color: #4caf50;
  color: white;
}

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 4px;
  box-sizing: border-box;
  height: 26px;
}

button {
  padding: 6px 12px;
  cursor: pointer;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
}

button:hover {
  background-color: #45a049;
}

.decide-button {
  background-color: #007bff;
  padding: 8px 20px;
  font-size: 1.2em;
  font-weight: bold;
  border: 2px solid #0056b3;
  border-radius: 6px;
}

.decide-button:hover {
  background-color: #0056b3;
  border-color: #003087;
}

.remove, .delete-history, button[onclick="clearTable()"] {
  background-color: #d32f2f;
}

.remove {
  height: 22px;
  padding: 0 6px;
  line-height: 22px;
}

.remove:hover, .delete-history:hover, button[onclick="clearTable()"]:hover {
  background-color: #b71c1c;
}

.input-form-table {
  max-height: 360px;
  overflow-y: auto;
  margin: 0 auto;
  width: 100%;
  max-width: 400px;
}

#historySelectContainer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin: 10px 0; /* 上下の余白を追加 */
}

.history-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

#historySelect {
  padding: 6px;
  width: 100%;
  max-width: 200px;
}

@media (max-width: 600px) {
  canvas {
    width: 100%;
    max-width: 400px;
    height: auto;
  }
  #rouletteTitle {
    width: 100%;
  }
  .copyright {
    font-size: 10px;
    bottom: 10%;
    right: 5px;
  }
  #participantCount {
    font-size: 14px;
    bottom: 10%;
    left: 5px;
  }
  .result {
    font-size: 20px;
  }
  .participant-count {
    font-size: 14px;
    margin-top: 8px;
  }
  .history-controls {
    flex-direction: column;
    gap: 5px;
  }
  .input-form-table {
    max-height: 300px;
  }
  .decide-button {
    padding: 6px 16px;
    font-size: 1.1em;
  }
  #historySelectContainer {
    margin: 8px 0; /* モバイルでの余白調整 */
  }
}