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

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

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

header {
  text-align: center;
  padding: 24px 0 16px;
}

header h1 {
  font-size: 1.5rem;
  color: #c0466a;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #888;
}

/* セクション */
section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #c0466a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count {
  font-size: 0.8rem;
  color: #888;
  font-weight: normal;
}

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

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

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

.form-group input:focus {
  outline: none;
  border-color: #e8748a;
  background: #fff;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ボタン */
.btn-calc {
  width: 100%;
  padding: 12px;
  background: #e8748a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

.btn-calc:hover {
  background: #c0466a;
}

/* 結果 */
.result {
  margin-top: 16px;
  padding: 16px;
  background: #fdf0f3;
  border-radius: 10px;
  border: 1.5px solid #f0c0cc;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.result-item {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.result-item.highlight {
  background: #c0466a;
  grid-column: 1 / -1;
}

.result-item.highlight .result-label {
  color: rgba(255,255,255,0.85);
}

.result-item.highlight .result-value {
  color: #fff;
  font-size: 1.4rem;
}

.result-label {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 4px;
}

.result-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #c0466a;
}

.btn-save {
  width: 100%;
  padding: 10px;
  background: #fff;
  color: #c0466a;
  border: 2px solid #c0466a;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-save:hover {
  background: #c0466a;
  color: #fff;
}

/* 履歴 */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.history-card {
  background: #fdf5f7;
  border-radius: 10px;
  padding: 14px;
  border: 1px solid #f0d0d8;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.history-card-name {
  font-weight: 700;
  color: #333;
  font-size: 0.95rem;
}

.history-card-date {
  font-size: 0.75rem;
  color: #aaa;
}

.history-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.history-card-item {
  display: flex;
  justify-content: space-between;
  background: #fff;
  border-radius: 6px;
  padding: 6px 8px;
}

.history-card-item-label {
  color: #888;
}

.history-card-item-value {
  font-weight: 600;
  color: #333;
}

.history-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #c0466a;
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
}

.history-price-label {
  font-size: 0.8rem;
  opacity: 0.9;
}

.history-price-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-delete {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  background: transparent;
  color: #ccc;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.btn-delete:hover {
  color: #e55;
  border-color: #e55;
}

@media (max-width: 400px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
  .history-card-grid {
    grid-template-columns: 1fr;
  }
}
