* {
  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;
}

header {
  background: #4CAF50;
  color: white;
  padding: 16px 20px;
  text-align: center;
}

header h1 {
  font-size: 1.3rem;
  font-weight: bold;
}

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

/* 目標追加フォーム */
.add-goal {
  background: white;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.add-goal h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #555;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

.form-row input:focus {
  outline: none;
  border-color: #4CAF50;
}

.form-row button,
button {
  padding: 10px 20px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.form-row button:hover,
button:hover {
  background: #43a047;
}

/* 目標カード */
.goals {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.goal-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

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

.goal-name {
  font-size: 1.1rem;
  font-weight: bold;
}

.delete-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.delete-btn:hover {
  color: #e53935;
  background: none;
}

.goal-amounts {
  display: flex;
  gap: 12px;
  font-size: 0.9rem;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.amount-saved {
  color: #4CAF50;
  font-weight: bold;
}

.amount-target {
  color: #888;
}

.amount-remaining {
  color: #e53935;
}

.amount-remaining.done {
  color: #4CAF50;
}

/* プログレスバー */
.progress-bar-wrap {
  background: #eee;
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: #4CAF50;
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 0;
}

.progress-bar.complete {
  background: #388E3C;
}

.progress-label {
  font-size: 0.85rem;
  color: #666;
  text-align: right;
  margin-bottom: 12px;
  margin-top: -8px;
}

/* 積立入力欄 */
.deposit-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.deposit-row input:focus {
  outline: none;
  border-color: #4CAF50;
}

.deposit-row button {
  padding: 8px 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* 履歴 */
.history-toggle {
  background: none;
  border: none;
  color: #4CAF50;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 10px;
  padding: 0;
  text-decoration: underline;
}

.history-toggle:hover {
  background: none;
  color: #2e7d32;
}

.history-list {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #666;
  display: none;
}

.history-list.open {
  display: block;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.no-goals {
  text-align: center;
  color: #aaa;
  font-size: 0.95rem;
  margin-top: 40px;
}

@media (min-width: 500px) {
  .form-row {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .form-row input {
    flex: 1;
    min-width: 120px;
  }
  .form-row button {
    flex-shrink: 0;
  }
}
