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

:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #f5f3ff;
  --accent: #059669;
  --accent-light: #ecfdf5;
  --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);
  --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;
}

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; }
.nav-links a:hover { color: var(--primary); }

.hero { text-align: center; padding: 2.5rem 1.5rem 1rem; }
.hero h1 { font-size: 2.25rem; font-weight: 800; }
.hero-sub { font-size: 1.05rem; color: var(--text-light); max-width: 500px; margin: 0.5rem auto 0; }

.ad-slot { max-width: 728px; margin: 1.5rem auto; text-align: center; }

.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 { 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);
}
.input-group input:focus, .input-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,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; }
.input-with-suffix input { padding-right: 2.5rem; }
.input-note { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

.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; 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 { min-width: 0; }
.results-panel h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; }
.results-cards { display: grid; grid-template-columns: 1fr 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(124,58,237,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); }
.result-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

.breakdown { background: var(--white); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.breakdown h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.75rem; }
.breakdown-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #f1f3f5; font-size: 0.85rem; }
.breakdown-row:last-child { border-bottom: none; }
.breakdown-label { color: var(--text-light); }
.breakdown-value { font-weight: 700; font-family: monospace; font-size: 0.9rem; }
.breakdown-row.subtract .breakdown-value { color: #dc2626; }
.breakdown-row.result { background: #f8f9fa; border-radius: 4px; padding: 0.5rem 0.5rem; }
.breakdown-row.result .breakdown-value { color: var(--primary); }
.breakdown-row.total { background: var(--primary-light); border-radius: 6px; padding: 0.6rem 0.5rem; margin-top: 0.5rem; }
.breakdown-row.total .breakdown-label { font-weight: 700; color: var(--text); }
.breakdown-row.total .breakdown-value { font-size: 1.1rem; color: var(--primary-dark); }

.deduction-ref { background: var(--white); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.deduction-ref h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.5rem; }
.section-note { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem 0.75rem; text-align: center; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
th { background: var(--bg); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; }
tr.highlight { background: var(--primary-light); font-weight: 700; }

.chart-section { background: var(--white); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.chart-section h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.25rem; }
.chart-container canvas { width: 100% !important; max-height: 300px; }

.advice-section { background: var(--primary-light); border: 1.5px solid rgba(124,58,237,0.15); border-radius: var(--radius); padding: 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; }

.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: 800px; margin-left: auto; margin-right: auto; }
.info-section h2 { font-size: 1.6rem; font-weight: 800; text-align: center; margin-bottom: 0.5rem; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: 2rem; }
.info-card { background: var(--white); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.info-step { display: inline-block; background: var(--primary); color: var(--white); padding: 0.15rem 0.6rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; margin-bottom: 0.5rem; }
.info-card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.5rem; }
.info-card p { font-size: 0.85rem; color: var(--text-light); line-height: 1.6; margin-bottom: 0.25rem; }

.tax-table { max-width: 500px; margin: 1rem auto 0; }
.table-note { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }

.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 { 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); }

@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .input-panel { position: static; }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .results-cards { grid-template-columns: 1fr; }
  .result-card.primary { grid-column: span 1; }
}
