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

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

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #222;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #4a90d9;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #444;
}

/* 追加フォーム */
.add-section {
  margin-bottom: 20px;
}

#add-form {
  display: flex;
  gap: 8px;
}

#category-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

#category-input:focus {
  border-color: #4a90d9;
}

#add-form button {
  padding: 10px 16px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

#add-form button:hover {
  background: #357abd;
}

/* 種別リスト */
.categories-section {
  margin-bottom: 24px;
}

.category-item {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-item.running {
  border-color: #4a90d9;
  background: #eaf3fd;
}

.category-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
}

.category-time {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: #555;
  min-width: 70px;
  text-align: right;
}

.running .category-time {
  color: #4a90d9;
  font-weight: 600;
}

.timer-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.timer-btn.start {
  background: #4a90d9;
  color: #fff;
}

.timer-btn.start:hover {
  background: #357abd;
}

.timer-btn.stop {
  background: #e05555;
  color: #fff;
}

.timer-btn.stop:hover {
  background: #c43a3a;
}

.delete-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.2s;
}

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

/* サマリー */
.summary-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
}

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

.reset-btn {
  padding: 5px 12px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
  color: #555;
  transition: background 0.2s;
}

.reset-btn:hover {
  background: #e0e0e0;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

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

.summary-name {
  flex: 1;
  color: #444;
}

.summary-bar-wrap {
  width: 80px;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.summary-bar {
  height: 100%;
  background: #4a90d9;
  border-radius: 4px;
  transition: width 0.3s;
}

.summary-time {
  min-width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #555;
}

.summary-pct {
  min-width: 38px;
  text-align: right;
  color: #888;
  font-size: 0.82rem;
}

.total-display {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e0e0e0;
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
  text-align: right;
}

.empty-msg {
  color: #aaa;
  font-size: 0.9rem;
  text-align: center;
  padding: 10px 0;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.2rem;
  }

  .summary-bar-wrap {
    display: none;
  }
}
