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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f7fa;
  padding: 20px;
  line-height: 1.6;
  color: #333;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

.header h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.header p {
  opacity: 0.9;
  font-size: 1rem;
}

.form-container {
  padding: 30px;
}

.form-section {
  margin-bottom: 25px;
}

.form-section h2 {
  color: #2d3748;
  font-size: 1.4rem;
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 3px solid #e2e8f0;
  font-weight: 700;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: #2d3748;
  font-size: 1rem;
  letter-spacing: 0.025em;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s ease;
  background: #ffffff;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
}

.checkbox-group label {
  margin: 0 !important;
  cursor: pointer;
  font-weight: 600 !important;
  color: #4a5568 !important;
  font-size: 0.95rem !important;
}

.help-text {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.help-text strong {
  color: #2d3748;
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.example {
  color: #718096;
  font-style: italic;
  display: block;
  margin-top: 4px;
  padding-left: 8px;
  border-left: 3px solid #e2e8f0;
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #f7fafc;
  color: #4a5568;
  border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
  background: #edf2f7;
  transform: translateY(-1px);
}

.result {
  margin-top: 25px;
  padding: 20px;
  background: #f0fff4;
  border: 1px solid #9ae6b4;
  border-radius: 8px;
  border-left: 4px solid #38a169;
}

.result h2 {
  color: #2d3748;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.result-section {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #6c757d;
}

.result-section h3 {
  color: #495057;
  font-size: 1.1rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.result-item:hover {
  background: #f8f9fa;
  border-left-color: #dee2e6;
}

.result-label {
  font-weight: 500;
  color: #4a5568;
}

.result-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
}

.total-result {
  background: #e8f5e8 !important;
  border-left: 4px solid #28a745 !important;
  font-weight: 600;
}

.total-result .result-value {
  color: #28a745 !important;
  font-size: 1.2rem !important;
}

.final-total {
  background: #fff3cd !important;
  border-left: 4px solid #ffc107 !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.final-total .result-value {
  color: #856404 !important;
  font-size: 1.4rem !important;
  font-weight: 700;
}

/* セクション別の色分け */
.health-insurance-section {
  border-left-color: #007bff;
}

.health-insurance-section h3 {
  color: #007bff;
}

.resident-tax-section {
  border-left-color: #dc3545;
}

.resident-tax-section h3 {
  color: #dc3545;
}

.summary-section {
  border-left-color: #28a745;
}

.summary-section h3 {
  color: #28a745;
}

.error {
  background: #fed7d7;
  color: #9b2c2c;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #e53e3e;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .header {
    padding: 25px 20px;
  }

  .form-container {
    padding: 25px 20px;
  }

  .button-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* 印刷用スタイル */
@media print {
  body {
    background: white;
    padding: 0;
  }

  .container {
    box-shadow: none;
    border-radius: 0;
  }

  .header {
    background: #f8f9fa !important;
    color: #333 !important;
  }

  .form-container {
    display: none;
  }

  .result {
    background: white !important;
    border: 1px solid #ccc;
  }

  .help-text {
    display: none;
  }

  .result-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6c757d;
  }

  .result-section h3 {
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
  }

  .result-item {
    border-left: 3px solid transparent;
  }

  .result-item:hover {
    background: #f8f9fa !important;
    border-left-color: #dee2e6;
  }

  .total-result {
    background: #e8f5e8 !important;
    border-left: 4px solid #28a745 !important;
  }

  .final-total {
    background: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
  }

  .health-insurance-section {
    border-left-color: #007bff;
  }

  .resident-tax-section {
    border-left-color: #dc3545;
  }

  .summary-section {
    border-left-color: #28a745;
  }
}