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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f6f8;
  color: #333;
  font-size: 16px;
  line-height: 1.5;
}

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

h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 3px solid #e74c3c;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  color: #444;
  margin-bottom: 12px;
}

/* セクション */
.input-section,
.list-section,
.action-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.required {
  color: #e74c3c;
}

input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  color: #333;
  background: #fafafa;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  outline: none;
  border-color: #e74c3c;
  background: #fff;
}

/* ボタン */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.8;
}

.btn-primary {
  width: 100%;
  background: #e74c3c;
  color: #fff;
  margin-top: 4px;
}

.btn-secondary {
  background: #444;
  color: #fff;
  margin-right: 8px;
  margin-bottom: 4px;
}

.btn-danger {
  background: transparent;
  color: #e74c3c;
  border: 1px solid #e74c3c;
  font-size: 13px;
  padding: 6px 12px;
}

/* リストヘッダー */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.list-header h2 {
  margin-bottom: 0;
}

.count-badge {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  padding: 1px 8px;
  margin-left: 6px;
}

/* 空メッセージ */
.empty-message {
  color: #aaa;
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

/* アイテムリスト */
#itemList {
  list-style: none;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 8px;
}

.item:last-child {
  border-bottom: none;
}

.item.done .item-info {
  opacity: 0.4;
  text-decoration: line-through;
}

.item-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #27ae60;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.delete-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: #ccc;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

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

/* アクションセクション */
.action-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 100;
}

.toast.show {
  opacity: 1;
}

/* 印刷用 */
@media print {
  body {
    background: #fff;
  }

  .input-section,
  .action-section,
  .delete-btn,
  .item-check,
  #clearAllBtn {
    display: none !important;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .list-section {
    box-shadow: none;
    padding: 0;
  }

  h1 {
    font-size: 18px;
  }
}

@media (max-width: 375px) {
  .container {
    padding: 12px;
  }

  h1 {
    font-size: 19px;
  }
}
