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

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

header {
  background: #27ae60;
  color: #fff;
  padding: 20px 16px;
  text-align: center;
}

header h1 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

header p {
  font-size: 0.82rem;
  opacity: 0.88;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.card h2 {
  font-size: 1rem;
  color: #27ae60;
  margin-bottom: 14px;
  border-bottom: 2px solid #e8f5e9;
  padding-bottom: 8px;
}

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

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

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

.form-group input:focus {
  outline: none;
  border-color: #27ae60;
}

.hint {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-top: 3px;
}

.btn-calc {
  width: 100%;
  padding: 13px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

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

/* Result */
.result-card {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

.result-item.highlight {
  background: #e8f5e9;
}

.result-item .label {
  font-size: 0.72rem;
  color: #666;
  margin-bottom: 6px;
  line-height: 1.3;
}

.result-item .value {
  font-size: 1.05rem;
  font-weight: bold;
  color: #333;
}

.result-item .value.green {
  color: #27ae60;
}

.result-item .value.red {
  color: #e74c3c;
}

.result-item .sub {
  font-size: 0.68rem;
  color: #999;
  margin-top: 3px;
}

hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 14px 0;
}

/* Judgment */
.judgment {
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  margin-top: 4px;
}

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

.judgment-result {
  font-size: 1.3rem;
  font-weight: bold;
}

.judgment-note {
  font-size: 0.78rem;
  color: #666;
  margin-top: 6px;
  line-height: 1.5;
}

.judgment.required {
  background: #fdecea;
}

.judgment.required .judgment-result {
  color: #e74c3c;
}

.judgment.not-required {
  background: #e8f5e9;
}

.judgment.not-required .judgment-result {
  color: #27ae60;
}

.judgment.check {
  background: #fff8e1;
}

.judgment.check .judgment-result {
  color: #f39c12;
}

/* History */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 2px solid #e8f5e9;
  padding-bottom: 8px;
}

.history-header h2 {
  border: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

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

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

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-list li.no-history {
  text-align: center;
  color: #aaa;
  font-size: 0.85rem;
  padding: 12px 0;
}

.history-item {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.82rem;
}

.history-item .h-date {
  color: #888;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.history-item .h-main {
  font-weight: bold;
  color: #333;
}

.history-item .h-sub {
  color: #666;
  margin-top: 2px;
}

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