:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --success: #059669;
  --success-light: #D1FAE5;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-secondary: #64748B;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; opacity: 0.85; }

nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-item {
  position: relative;
}

.nav-link {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 20px;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.nav-item:hover .nav-link,
.nav-item.open .nav-link {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}
.nav-item.active .nav-link {
  background: var(--primary);
  color: #fff;
}
.nav-item.active:hover .nav-link,
.nav-item.active.open .nav-link {
  background: var(--primary-dark);
  color: #fff;
}

.nav-arrow {
  font-size: 10px;
  line-height: 1;
  transition: transform 0.2s;
  opacity: 0.7;
}
.nav-item:hover .nav-arrow,
.nav-item.open .nav-arrow {
  transform: rotate(180deg);
}

.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 300;
  min-width: 210px;
  padding: 6px 0;
}
.nav-item:hover .dropdown,
.nav-item.open .dropdown {
  display: block;
}
.dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s;
}
.dropdown a:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

/* ===== LAYOUT ===== */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

main { padding: 32px 0 60px; }

/* ===== AD PLACEHOLDER ===== */
.ad-area {
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: var(--radius);
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  margin: 24px 0;
}

/* ===== HERO (トップページ) ===== */
.hero {
  text-align: center;
  padding: 48px 20px 40px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}
.hero p {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 500px;
  margin: 0 auto;
}

/* ===== CATEGORY SECTION ===== */
.category-section { margin-bottom: 40px; }
.category-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 4px solid var(--primary);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.15s;
  text-decoration: none;
  display: block;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-card .icon { font-size: 28px; margin-bottom: 10px; }
.tool-card .name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.tool-card .desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 24px;
}
.page-header .breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.page-header .breadcrumb a { color: var(--text-secondary); }
.page-header .breadcrumb a:hover { color: var(--primary); }
.page-header h1 {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ===== CALCULATOR CARD ===== */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group .hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-wrap input,
.input-wrap select {
  flex: 1;
}
.input-wrap .unit {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s;
  font-size: 15px;
}
.radio-group input[type="radio"] { display: none; }
.radio-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  width: 100%;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

/* ===== RESULT ===== */
.result-area {
  display: none;
  margin-top: 24px;
}
.result-area.show { display: block; }

.result-main {
  background: var(--success-light);
  border: 1px solid #6EE7B7;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  text-align: center;
}
.result-main .label {
  font-size: 14px;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 6px;
}
.result-main .value {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  color: var(--success);
}
.result-main .sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.result-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.result-table table {
  width: 100%;
  border-collapse: collapse;
}
.result-table th,
.result-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.result-table tr:last-child td { border-bottom: none; }
.result-table th {
  background: #F8FAFC;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
}
.result-table td:last-child {
  text-align: right;
  font-weight: 600;
}
.result-table tr.total td {
  font-weight: 700;
  background: #F8FAFC;
}
.result-table tr.deduct td { color: var(--danger); }

/* ===== INFO BOX ===== */
.info-box {
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 14px;
  color: #92400E;
  margin-top: 16px;
}
.info-box strong { font-weight: 700; }

/* ===== ARTICLE (SEO用解説) ===== */
.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.article h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.article h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 8px;
}
.article p { font-size: 15px; color: var(--text); margin-bottom: 10px; }
.article ul { padding-left: 20px; margin-bottom: 10px; }
.article li { font-size: 15px; margin-bottom: 4px; }

/* ===== FOOTER ===== */
footer {
  background: var(--text);
  color: #94A3B8;
  padding: 32px 20px;
  text-align: center;
  font-size: 13px;
}
footer .footer-logo {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}
footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
footer a { color: #94A3B8; }
footer a:hover { color: #fff; }
footer .copyright { font-size: 12px; }

/* ===== BMI STATUS ===== */
.bmi-bar {
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(to right, #60A5FA, #34D399, #FBBF24, #F87171, #EF4444);
  position: relative;
  margin: 12px 0;
}
.bmi-indicator {
  position: absolute;
  top: -6px;
  width: 4px;
  height: 28px;
  background: var(--text);
  border-radius: 2px;
  transform: translateX(-50%);
}

/* ===== FAQ ===== */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-q {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  font-size: 15px;
}
.faq-a {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  header .container { gap: 10px; }
  .calc-card { padding: 20px; }
  .article { padding: 20px; }
  .result-main .value { font-size: 28px; }
}
