* {
  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: 20px 16px 40px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 24px;
}

/* 入力欄 */
.input-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

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

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

input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="number"]:focus {
  border-color: #3498db;
}

button#calcBtn {
  width: 100%;
  padding: 12px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

button#calcBtn:hover {
  background: #2176ae;
}

/* 結果 */
.result-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

.result-section h2,
.history-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 16px;
  border-left: 4px solid #3498db;
  padding-left: 10px;
}

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

.result-card {
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.result-card.nominal { background: #eaf4fb; }
.result-card.real { background: #e8f8f5; }
.result-card.loss { background: #fdecea; }
.result-card.annual { background: #fdecea; }

.card-label {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2c3e50;
}

.card-value.loss-value {
  color: #e74c3c;
}

/* 購買力バー */
.power-section {
  margin-bottom: 20px;
}

.power-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.power-bar-wrap {
  background: #eee;
  border-radius: 999px;
  height: 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 6px;
}

.power-bar {
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #f39c12);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.power-bar-label {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  font-weight: 700;
  color: #333;
}

.power-desc {
  font-size: 0.82rem;
  color: #e74c3c;
  font-weight: 500;
}

/* 具体例 */
.example-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 10px;
}

.examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.example-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
}

.example-item .item-name {
  color: #555;
}

.example-item .item-change {
  font-weight: 700;
  color: #e74c3c;
}

/* 履歴 */
.history-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

#historyList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

#historyList li {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #444;
  line-height: 1.5;
}

.clear-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: #888;
  cursor: pointer;
}

.clear-btn:hover {
  background: #f5f5f5;
}

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