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

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

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #222;
  text-align: center;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.82rem;
  color: #888;
  text-align: center;
  margin-bottom: 20px;
}

/* カード */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

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

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

.optional {
  font-weight: 400;
  font-size: 0.75rem;
  color: #aaa;
  margin-left: 6px;
}

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

input[type="number"]:focus,
input[type="text"]:focus {
  border-color: #e07020;
}

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

button#calcBtn:hover {
  background: #c05e10;
}

/* 結果カード */
.result-card {
  background: #fff3e8;
  border: 2px solid #e07020;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.result-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.result-label {
  font-size: 0.82rem;
  color: #888;
  font-weight: 600;
}

.result-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #e07020;
}

.result-sub {
  margin-bottom: 10px;
}

.result-label-sm {
  font-size: 0.78rem;
  color: #888;
  display: block;
  margin-bottom: 2px;
}

.result-diff {
  font-size: 1.1rem;
  font-weight: 700;
}

.result-diff.down {
  color: #d00;
}

.result-diff.up {
  color: #080;
}

.result-note {
  font-size: 0.8rem;
  color: #666;
}

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

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

.history-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.clear-btn {
  font-size: 0.78rem;
  color: #e07020;
  background: none;
  border: 1.5px solid #e07020;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

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

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

.history-item {
  border-bottom: 1px solid #f0f0f0;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.history-item .h-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item .h-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
}

.history-item .h-min {
  font-size: 1rem;
  font-weight: 700;
  color: #e07020;
}

.history-item .h-detail {
  font-size: 0.78rem;
  color: #999;
}

@media (max-width: 375px) {
  h1 { font-size: 1.2rem; }
  .result-value { font-size: 1.8rem; }
}
