* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f5f5;
  transition: background 0.3s ease;
  margin: 0;
  padding: 16px;
  min-height: 100vh;
}

body.dark-mode {
  background: #1e1e1e;
}

/* ダークモード切替ボタン */
.dark-mode-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #333;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 1000;
  transition: background 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.dark-mode-toggle:hover {
  background: #555;
}

body.dark-mode .dark-mode-toggle {
  background: #f0e68c;
  color: #333;
}

body.dark-mode .dark-mode-toggle:hover {
  background: #ffd700;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode .container {
  background: #2d2d2d;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.title {
  text-align: center;
  margin: 0 0 20px 0;
  font-size: 28px;
  color: #333;
}

body.dark-mode .title {
  color: #e0e0e0;
}

/* 入力エリア - 1 行で整える */
.input-area {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

body.dark-mode .input-area {
  background: #3a3a3a;
  padding: 12px;
  border-radius: 10px;
}

input {
  flex: 1;
  min-width: 150px;
  padding: 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

input:focus {
  outline: none;
  border-color: #42a5f5;
}

body.dark-mode input {
  background: #3a3a3a;
  border-color: #555;
  color: #e0e0e0;
}

select {
  padding: 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.dark-mode select {
  background: #3a3a3a;
  border-color: #555;
  color: #e0e0e0;
}

button {
  padding: 12px 20px;
  cursor: pointer;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s ease, transform 0.2s ease;
}

button:hover {
  background: #1565c0;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

body.dark-mode button {
  background: #42a5f5;
  color: #1e1e1e;
}

body.dark-mode button:hover {
  background: #64b5f6;
}

/* 追加ボタン */
.add-btn {
  background: #4caf50;
  min-width: 80px;
}

.add-btn:hover {
  background: #43a047;
}

body.dark-mode .add-btn {
  background: #66bb6a;
}

body.dark-mode .add-btn:hover {
  background: #81c784;
}

/* Todo リスト - カード風デザイン */
#todoList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fafafa;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  flex-wrap: wrap;
}

li:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

body.dark-mode li {
  background: #3a3a3a;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-mode li:hover {
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

li span:first-child {
  flex: 1;
  min-width: 120px;
  word-break: break-word;
}

/* 完了ボタン - 緑系 */
.complete-btn {
  background: #4caf50;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.complete-btn:hover {
  background: #43a047;
  transform: scale(1.05);
}

body.dark-mode .complete-btn {
  background: #66bb6a;
}

body.dark-mode .complete-btn:hover {
  background: #81c784;
}

/* 削除ボタン - 赤系 */
.delete-btn {
  background: #f44336;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.delete-btn:hover {
  background: #e53935;
  transform: scale(1.05);
}

body.dark-mode .delete-btn {
  background: #ef5350;
}

body.dark-mode .delete-btn:hover {
  background: #e53935;
}

.completed {
  text-decoration: line-through;
  color: #888;
}

body.dark-mode .completed {
  color: #999;
}

/* 優先度バッジ */
.priority-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.priority-high {
  background: #ffebee;
  color: #c62828;
}

.priority-medium {
  background: #fff3e0;
  color: #ef6c00;
}

.priority-low {
  background: #e8f5e9;
  color: #2e7d32;
}

body.dark-mode .priority-high {
  background: #c62828;
  color: #ffebee;
}

body.dark-mode .priority-medium {
  background: #ef6c00;
  color: #fff3e0;
}

body.dark-mode .priority-low {
  background: #2e7d32;
  color: #e8f5e9;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
  .container {
    padding: 16px;
  }

  .title {
    font-size: 24px;
  }

  .input-area {
    flex-direction: column;
  }

  input, select, button {
    width: 100%;
  }

  li {
    flex-direction: column;
    align-items: stretch;
  }

  li span:first-child {
    margin-bottom: 8px;
  }

  .actions {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .complete-btn, .delete-btn {
    flex: 1;
  }
}
