/* ==========================================================================
   お金の計算ラボ (https://calc.shuno-blog.com/) 共通デザインシステム
   Main: Forest Green (#1b6b4a) / Accent: Amber Gold (#d97706) / BG: #f8faf9
   ========================================================================== */

:root {
  --primary: #1b6b4a;
  --primary-dark: #145238;
  --primary-soft: #e9f5ef;
  --primary-border: #bfe0d0;
  --accent: #d97706;
  --accent-soft: #fef3c7;
  --bg: #f8faf9;
  --surface: #ffffff;
  --surface-muted: #f1f5f3;
  --border: #dfe7e3;
  --border-strong: #c5d4cd;
  --text: #111f19;
  --text-sub: #3b4f46;
  --text-muted: #64786f;
  --danger: #dc2626;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 8px rgba(17, 31, 25, 0.04);
  --shadow-md: 0 8px 24px rgba(17, 31, 25, 0.07);
  --container-w: 980px;
}

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

html {
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

.num,
.tabular-nums {
  font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  font-variant-numeric: tabular-nums;
}

.container {
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 18px;
}

/* ─── HEADER ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 18px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 900;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, #24855d 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  box-shadow: 0 3px 10px rgba(27, 107, 74, 0.25);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.site-nav-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ─── BREADCRUMB ─── */
.breadcrumb {
  max-width: var(--container-w);
  width: 100%;
  margin: 14px auto 4px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
}

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

.breadcrumb .sep {
  opacity: 0.55;
}

/* ─── TOOL HERO ─── */
.tool-page-main {
  flex: 1;
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 8px 18px 40px;
}

.tool-head {
  margin-bottom: 18px;
}

.tool-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.badge-cat {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
}

.badge-safe {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.tool-title {
  font-size: clamp(1.38rem, 4.2vw, 1.9rem);
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.tool-lead {
  font-size: 0.9rem;
  color: var(--text-sub);
}

/* ─── SIMULATOR LAYOUT ─── */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.card-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 4px;
  background: var(--primary);
  flex-shrink: 0;
}

.card-title-left {
  display: inline-flex;
  align-items: center;
}

/* ─── FORM CONTROLS ─── */
.field-group {
  margin-bottom: 18px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.field-label {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text);
}

.input-unit-box {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  gap: 5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-unit-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 107, 74, 0.14);
  background: #ffffff;
}

.input-unit-box input[type="number"] {
  width: 92px;
  border: none;
  background: transparent;
  font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  text-align: right;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.input-unit {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Range Slider */
input[type="range"].calc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  margin: 8px 0 4px;
  cursor: pointer;
}

input[type="range"].calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(27, 107, 74, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease;
}

input[type="range"].calc-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

input[type="range"].calc-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(27, 107, 74, 0.35);
  cursor: pointer;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Preset buttons */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.preset-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-sub);
  font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.preset-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Segment radio buttons */
.seg-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-btn.active {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(17, 31, 25, 0.08);
}

/* ─── RESULT SUMMARY ─── */
.result-hero {
  background: linear-gradient(135deg, #16593d 0%, #1b6b4a 60%, #237c57 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
}

.result-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.88;
  margin-bottom: 3px;
}

.result-kpi-value {
  font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  font-size: clamp(1.45rem, 4.4vw, 1.95rem);
  font-weight: 900;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.result-kpi-value .unit {
  font-size: 0.56em;
  font-weight: 700;
  margin-left: 2px;
}

.result-kpi-sub {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  opacity: 0.94;
}

.chart-wrap {
  position: relative;
  max-width: 240px;
  margin: 4px auto 14px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin-bottom: 14px;
}

.breakdown-table th,
.breakdown-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.breakdown-table th {
  text-align: left;
  font-weight: 700;
  color: var(--text-sub);
}

.breakdown-table td {
  text-align: right;
  font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.breakdown-table tr.total-row th,
.breakdown-table tr.total-row td {
  border-top: 2px solid var(--border-strong);
  border-bottom: none;
  color: var(--primary-dark);
  font-weight: 900;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.btn-copy-result {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.btn-copy-result .btn-ico {
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.16s ease;
}

.btn-copy-result:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-copy-result:hover .btn-ico {
  opacity: 1;
}

.btn-copy-result:active {
  transform: translateY(1px);
}

.btn-copy-result.is-copied {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.btn-copy-result.is-copied .btn-ico {
  opacity: 1;
}

/* ─── DISCLAIMER BOX ─── */
.disclaimer-box {
  margin-top: 18px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
  font-size: 0.78rem;
  line-height: 1.6;
}

/* ─── NAVIGATION & RELATED TOOLS ─── */
.explore-wrap {
  margin: 24px 0 18px;
  text-align: center;
}

.explore-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 28px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.explore-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.related-section {
  margin-top: 20px;
}

.section-heading {
  font-size: 1.05rem;
  font-weight: 900;
  margin-bottom: 12px;
  padding-left: 11px;
  border-left: 4px solid var(--primary);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.tool-card:not(.coming-soon):hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.tool-card.coming-soon {
  opacity: 0.72;
  background: #fafcfb;
  cursor: default;
}

.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tool-card-cat {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.tool-card-soon {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.tool-card-pop {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #92400e;
}

.tool-card-title {
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.35;
  margin-bottom: 6px;
}

.tool-card-desc {
  font-size: 0.8rem;
  color: var(--text-sub);
  line-height: 1.55;
  flex: 1;
}

.tool-card-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tool-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  padding: 2px 7px;
  border-radius: 5px;
}

/* ─── AD SLOT PLACEHOLDER (24px+ MARGIN) ─── */
.ad-slot-wrap {
  width: 100%;
  margin: 26px auto;
  text-align: center;
}

.ad-slot-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ─── SEO ARTICLE / TABLE / FAQ ─── */
.seo-section {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.seo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.seo-card h2 {
  font-size: 1.12rem;
  font-weight: 900;
  margin-bottom: 12px;
  padding-left: 11px;
  border-left: 4px solid var(--primary);
  line-height: 1.4;
}

.seo-card p {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-bottom: 10px;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 10px;
}

.ref-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.ref-table th,
.ref-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ref-table th {
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 800;
}

.ref-table th:first-child,
.ref-table td:first-child {
  text-align: left;
  font-weight: 800;
}

.ref-table tbody tr:hover {
  background: #f5fbf8;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--bg);
}

.faq-q {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.faq-a {
  font-size: 0.85rem;
  color: var(--text-sub);
  line-height: 1.7;
}

/* ─── FOOTER ─── */
.site-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 28px 18px 34px;
  text-align: center;
}

.footer-inner {
  max-width: var(--container-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-brand {
  font-weight: 900;
  font-size: 0.98rem;
  color: var(--text);
}

.footer-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 580px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  font-size: 0.8rem;
  font-weight: 700;
}

.footer-links a {
  color: var(--text-sub);
}

.footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-copy {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 820px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .container,
  .site-header-inner,
  .breadcrumb,
  .tool-page-main {
    padding-left: 14px;
    padding-right: 14px;
  }
  .site-brand { font-size: 0.9rem; gap: 6px; }
  .site-brand-mark { width: 26px; height: 26px; font-size: 0.85rem; }
  .site-nav { gap: 5px; }
  .site-nav-link { padding: 5px 8px; font-size: 0.72rem; }
  .card,
  .seo-card {
    padding: 16px;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .result-hero-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
