/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #059669;
  --accent-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --text: #1a1b1e;
  --text-light: #495057;
  --text-muted: #868e96;
  --bg: #f8f9fa;
  --white: #ffffff;
  --border: #dee2e6;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-links { display: flex; gap: 1.25rem; }
.nav-links a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--primary); }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 2.5rem 1.5rem 1rem;
}

.badge {
  display: inline-block;
  background: var(--danger);
  color: var(--white);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-light);
  max-width: 550px;
  margin: 0 auto;
}

/* ===== Ad Slots ===== */
.ad-slot {
  max-width: 728px;
  margin: 1.5rem auto;
  min-height: 0;
  text-align: center;
}

/* ===== Calculator ===== */
.calculator-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2rem;
  align-items: start;
}

/* ===== Input Panel ===== */
.input-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 70px;
}

.input-panel h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.input-group {
  margin-bottom: 1.1rem;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.3rem;
}

.input-group input[type="number"],
.input-group select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-with-suffix {
  position: relative;
}

.input-with-suffix .suffix {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
}

.input-with-suffix input {
  padding-right: 2.5rem;
}

.input-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Slider */
.slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  outline: none;
  margin-top: 0.5rem;
  border: none;
  padding: 0;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ===== Results Panel ===== */
.results-panel { min-width: 0; }

.results-panel h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.results-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.result-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.result-card.primary {
  background: var(--primary-light);
  border: 1.5px solid rgba(37, 99, 235, 0.15);
  grid-column: span 2;
}

.result-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.result-card.primary .result-value {
  font-size: 2rem;
  color: var(--primary-dark);
}

/* ===== Wall Status ===== */
.wall-status {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.wall-status h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.wall-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}

.wall-item.under {
  background: var(--accent-light);
  color: var(--accent);
}

.wall-item.over {
  background: var(--danger-light);
  color: var(--danger);
}

.wall-item.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.wall-item-icon { font-size: 1rem; flex-shrink: 0; }
.wall-item-text { flex: 1; font-weight: 500; }
.wall-item-amount { font-weight: 700; white-space: nowrap; }

/* ===== Spouse Section ===== */
.spouse-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.spouse-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.spouse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.spouse-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.spouse-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.spouse-note {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ===== Chart ===== */
.comparison-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.comparison-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.section-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 300px;
}

/* ===== Advice ===== */
.advice-section {
  background: var(--primary-light);
  border: 1.5px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.advice-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.advice-item {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.6;
}

.advice-icon { flex-shrink: 0; }

/* ===== Info Section ===== */
.info-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.info-section.alt-bg {
  max-width: none;
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.info-section.alt-bg > * {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.info-section h2 {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-desc {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 2rem;
}

/* ===== Walls Timeline ===== */
.walls-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.wall-card {
  display: grid;
  grid-template-columns: 100px auto 1fr;
  gap: 0.75rem;
  align-items: start;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
}

.wall-card.changed {
  border-left-color: var(--danger);
  background: #fffbfb;
}

.wall-amount {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.wall-type {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.wall-type.tax { background: #dbeafe; color: #1d4ed8; }
.wall-type.insurance { background: #fce7f3; color: #be185d; }

.wall-badge {
  grid-column: 1 / -1;
  display: inline-block;
  background: var(--danger);
  color: var(--white);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  width: fit-content;
  order: -1;
}

.wall-detail { grid-column: 1 / -1; }
.wall-detail h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.25rem; }
.wall-detail p { font-size: 0.85rem; color: var(--text-light); line-height: 1.6; margin-bottom: 0.25rem; }
.wall-note { font-size: 0.8rem; color: var(--danger); font-weight: 500; }

/* ===== FAQ ===== */
.faq-list {
  max-width: 800px;
  margin: 2rem auto 0;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  background: var(--white);
  overflow: hidden;
}

.faq-item summary {
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
}
.faq-item[open] summary::after { content: '−'; }

.faq-item p {
  padding: 0 1.1rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* ===== Footer ===== */
footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: 2rem;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.85rem;
}

.disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.copyright {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .input-panel { position: static; }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .results-cards { grid-template-columns: 1fr; }
  .result-card.primary { grid-column: span 1; }
  .spouse-grid { grid-template-columns: 1fr; }
  .wall-card {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .nav-links { gap: 0.75rem; }
  .nav-links a { font-size: 0.75rem; }
}
