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

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

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  padding: 16px 0 20px;
  color: #1a1a2e;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 12px;
}

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #4a90d9;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}

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

/* サマリー */
.summary {
  background: #1a1a2e;
  color: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: none;
}

.summary.show {
  display: block;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.summary-row:last-child {
  margin-bottom: 0;
  font-weight: 700;
  font-size: 1rem;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

/* カードリスト */
.cards-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-item {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 14px;
  position: relative;
}

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

.card-name {
  font-weight: 700;
  font-size: 1rem;
}

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

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

.card-amounts {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 8px;
}

.card-remaining {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.remaining-label {
  color: #888;
  font-weight: 400;
  font-size: 0.8rem;
}

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

.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-bar.green { background: #27ae60; }
.progress-bar.yellow { background: #f39c12; }
.progress-bar.red { background: #e74c3c; }

.usage-label {
  text-align: right;
  font-size: 0.75rem;
  color: #888;
}

.usage-label.red { color: #e74c3c; font-weight: 700; }
.usage-label.yellow { color: #f39c12; font-weight: 700; }

.card-item.alert-red {
  border-color: #e74c3c;
  background: #fff8f8;
}

.card-item.alert-yellow {
  border-color: #f39c12;
  background: #fffbf0;
}

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

@media (max-width: 375px) {
  .card-amounts {
    flex-direction: column;
    gap: 2px;
  }
}
