:root {
  --primary: #f97316;
  --primary-dark: #ea6c0a;
  --primary-light: #fff7ed;
  --secondary: #fb923c;
  --accent: #fde68a;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
}

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

body {
  font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
  background: #f9fafb;
  color: var(--text);
  line-height: 1.6;
}

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

/* Header */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 32px 0 28px;
  text-align: center;
}
header h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700; margin-bottom: 8px; }
.subtitle { font-size: 0.95rem; opacity: 0.9; }

/* Layout */
.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 32px 0;
}
@media (max-width: 768px) {
  .calculator-layout { grid-template-columns: 1fr; }
}

/* Panels */
.input-panel, .result-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-light);
}

/* Notice */
.notice-box {
  background: var(--primary-light);
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 24px;
}
.notice-box strong { color: var(--primary-dark); display: block; margin-bottom: 6px; }
.notice-box ul { margin-left: 18px; font-size: 0.88rem; }
.notice-box li { margin-bottom: 2px; }

/* Children section */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-header label { font-weight: 600; font-size: 0.95rem; }

.btn-add {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-add:hover { background: var(--primary-dark); }

/* Child card */
.child-card {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
}
.child-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.child-label { font-weight: 700; color: var(--primary); font-size: 0.95rem; }
.btn-remove {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.8rem;
  line-height: 1;
}
.btn-remove:hover { border-color: #ef4444; color: #ef4444; }

.child-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.child-inputs select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.88rem;
  width: 100%;
  background: white;
}

/* Form group */
.form-group { margin-top: 20px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.tooltip-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--text-light);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  font-size: 0.72rem;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

.counter-input {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.05rem;
  font-weight: 600;
}
.counter-btn {
  background: var(--primary-light);
  border: 1px solid #fed7aa;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 700;
  transition: background 0.2s;
}
.counter-btn:hover { background: #fed7aa; }
#olderCount { min-width: 20px; text-align: center; }

/* Calc button */
.btn-calc {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 24px;
  transition: background 0.2s, transform 0.1s;
}
.btn-calc:hover { background: var(--primary-dark); }
.btn-calc:active { transform: scale(0.98); }

/* Result cards */
.result-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.result-card {
  background: var(--primary-light);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.main-card {
  grid-column: 1 / -1;
  background: var(--primary);
  color: white;
}
.card-label { font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; opacity: 0.85; }
.card-value { font-size: 1.5rem; font-weight: 700; }
.main-card .card-label { color: rgba(255,255,255,0.85); }
.main-card .card-value { font-size: 2rem; color: white; }

/* Breakdown */
.breakdown-section { margin-bottom: 24px; }
.breakdown-section h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--text-light); }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.breakdown-table th {
  background: var(--primary-light);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
}
.breakdown-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.breakdown-table tr:last-child td { border-bottom: none; }
.amount-col { text-align: right; font-weight: 600; color: var(--primary-dark); }

/* Payment schedule */
.payment-schedule h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--text-light); }
.schedule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.schedule-item {
  background: var(--primary-light);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.schedule-month { font-size: 0.8rem; color: var(--text-light); margin-bottom: 2px; }
.schedule-amount { font-size: 0.95rem; font-weight: 700; color: var(--primary-dark); }

/* Table section */
.table-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.table-section h2 { font-size: 1.1rem; margin-bottom: 16px; }
.table-wrapper { overflow-x: auto; }
.rate-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rate-table th {
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  text-align: center;
}
.rate-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: center; }
.highlight-row td { background: #fff7ed; }
.new-row td { background: #fef3c7; }
.gray-row td { background: #f3f4f6; color: var(--text-light); }
.new-badge {
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.table-note { font-size: 0.82rem; color: var(--text-light); margin-top: 10px; }

/* FAQ */
.faq-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.faq-section h2 { font-size: 1.1rem; margin-bottom: 16px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-question {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 16px 0;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}
.faq-icon { font-size: 1.2rem; color: var(--primary); transition: transform 0.2s; min-width: 20px; text-align: center; }
.faq-question.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: none;
  padding: 0 0 16px;
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.7;
}
.faq-answer p { margin-bottom: 8px; }
.faq-answer ul, .faq-answer ol { margin-left: 20px; margin-top: 6px; }
.faq-answer li { margin-bottom: 4px; }

/* Footer */
footer {
  background: #1f2937;
  color: #9ca3af;
  padding: 24px 0;
  text-align: center;
}
footer a { color: #9ca3af; text-decoration: underline; margin: 0 6px; }
.disclaimer { font-size: 0.78rem; margin-top: 8px; }

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 40px 20px;
  font-size: 0.9rem;
}
