:root{
  --blue:#2563eb;
  --blue-dark:#1d4ed8;
  --blue-soft:#eff6ff;
  --green:#16a34a;
  --red:#dc2626;
  --ink:#1f2937;
  --muted:#6b7280;
  --line:#e5e7eb;
  --bg:#f6f8fb;
  --card:#ffffff;
  --yellow:#fff7ed;
}

body{
  background:var(--bg);
  color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;
}

.wrap{
  max-width:980px;
  margin:0 auto;
  padding-left:16px;
  padding-right:16px;
}

.tool-header{
  background:linear-gradient(135deg,#eff6ff,#dbeafe);
  border-bottom:1px solid #bfdbfe;
}

.tool-header .wrap{
  padding-top:34px;
  padding-bottom:34px;
}

.tool-title{
  font-size:clamp(1.8rem,4vw,2.55rem);
  line-height:1.25;
  font-weight:800;
  letter-spacing:.02em;
  color:#1e3a8a;
  margin:0 0 10px;
}

.tool-subtitle{
  color:#475569;
  font-size:1.02rem;
  margin:0;
}

.sec{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:24px;
  margin-top:24px;
  box-shadow:0 10px 26px rgba(15,23,42,.04);
}

.lead-sec{
  font-size:1.02rem;
  line-height:1.9;
}

.lead-sec p{
  margin:0 0 12px;
}

.lead-sec p:last-child{
  margin-bottom:0;
}

.sec-title{
  font-size:1.35rem;
  line-height:1.45;
  font-weight:800;
  color:#1e3a8a;
  margin:0 0 18px;
  padding-left:12px;
  border-left:5px solid var(--blue);
}

.quick-start-box{
  margin-top:24px;
  border-radius:18px;
  background:linear-gradient(135deg,#1d4ed8,#3b82f6);
  color:#fff;
  padding:22px;
  display:flex;
  gap:18px;
  align-items:center;
  justify-content:space-between;
  box-shadow:0 16px 34px rgba(37,99,235,.22);
}

.quick-start-box p{
  margin:0;
  line-height:1.8;
}

.howto-sec{
  margin-top:24px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  padding:22px;
}

.howto-sec h2{
  font-size:1.18rem;
  font-weight:800;
  color:#1e3a8a;
  margin:0 0 16px;
}

.howto-steps{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}

.howto-step{
  border:1px solid #dbeafe;
  background:#f8fbff;
  border-radius:14px;
  padding:13px 10px;
  display:flex;
  gap:8px;
  align-items:center;
  font-weight:700;
  color:#334155;
  font-size:.95rem;
  line-height:1.35;
  min-width:0;
}

.howto-step > div:last-child{
  white-space:nowrap;
}

.step-num{
  width:28px;
  height:28px;
  border-radius:50%;
  background:var(--blue);
  color:#fff;
  display:grid;
  place-items:center;
  font-size:.85rem;
  flex:0 0 28px;
}

.step-num{
  width:30px;
  height:30px;
  border-radius:50%;
  background:var(--blue);
  color:#fff;
  display:grid;
  place-items:center;
  font-size:.9rem;
  flex:0 0 auto;
}

.feature-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
}

.feature-card{
  border:1px solid #dbeafe;
  background:#f8fbff;
  border-radius:15px;
  padding:16px;
}

.feature-card strong{
  display:block;
  color:#1e40af;
  margin-bottom:8px;
}

.feature-card p{
  color:#475569;
  line-height:1.75;
  margin:0;
  font-size:.95rem;
}

.preset-box{
  background:#f8fbff;
  border:1px solid #dbeafe;
  border-radius:16px;
  padding:18px;
  display:flex;
  gap:18px;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px;
}

.preset-box p{
  margin:0 0 6px;
  line-height:1.75;
}

.preset-box p:last-child{
  margin-bottom:0;
  color:#475569;
  font-size:.95rem;
}

.preset-buttons{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.form-card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:20px;
  margin-top:18px;
}

.form-card-title{
  font-size:1.12rem;
  font-weight:800;
  color:#1f2937;
  margin:0 0 16px;
}

.form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}

.form-block{
  min-width:0;
}

.lbl{
  display:block;
  font-weight:800;
  color:#374151;
  margin-bottom:8px;
}

input,
select{
  width:100%;
  border:1px solid #cbd5e1;
  border-radius:12px;
  padding:12px 12px;
  background:#fff;
  color:#111827;
  font-size:1rem;
  outline:none;
}

input:focus,
select:focus{
  border-color:var(--blue);
  box-shadow:0 0 0 3px rgba(37,99,235,.15);
}

.with-unit{
  display:flex;
  align-items:center;
  gap:8px;
}

.with-unit input{
  flex:1;
  min-width:0;
}

.unit{
  color:#475569;
  font-weight:700;
  white-space:nowrap;
}

.period-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.note{
  color:var(--muted);
  font-size:.9rem;
  line-height:1.65;
  margin:7px 0 0;
}

.check-block{
  background:#f9fafb;
  border:1px solid #edf2f7;
  border-radius:14px;
  padding:14px;
}

.check-label{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  color:#374151;
}

.check-label input{
  width:18px;
  height:18px;
  accent-color:var(--blue);
}

.detail-box{
  margin-top:18px;
  border:1px solid #dbeafe;
  background:#f8fbff;
  border-radius:16px;
  overflow:hidden;
}

.detail-box summary{
  cursor:pointer;
  padding:16px 18px;
  font-weight:800;
  color:#1e40af;
}

.detail-box[open] summary{
  border-bottom:1px solid #dbeafe;
}

.detail-grid{
  padding:18px;
}

.compare-card{
  background:#fffdf7;
  border-color:#fed7aa;
}

.compare-lead{
  color:#6b4f2a;
  line-height:1.8;
  margin:0 0 16px;
}

.btn-group{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:22px;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:0;
  border-radius:999px;
  padding:11px 18px;
  font-weight:800;
  line-height:1.2;
  cursor:pointer;
  transition:.15s ease;
  text-decoration:none;
}

.btn:hover{
  transform:translateY(-1px);
}

.btn-calc{
  background:var(--blue);
  color:#fff;
}

.btn-calc:hover{
  background:var(--blue-dark);
}

.btn-add{
  background:#ecfdf5;
  color:#047857;
  border:1px solid #a7f3d0;
}

.btn-reset{
  background:#f3f4f6;
  color:#374151;
  border:1px solid #d1d5db;
}

.btn-sample{
  background:#fff;
  color:#1e40af;
  border:1px solid #bfdbfe;
  padding:9px 14px;
}

.g-err{
  display:none;
  margin-top:16px;
  border-radius:12px;
  padding:12px 14px;
  background:#fff7ed;
  border:1px solid #fed7aa;
  color:#9a3412;
  font-weight:700;
  line-height:1.6;
}

.g-err.show{
  display:block;
}

.results-ph{
  color:#64748b;
  text-align:center;
  padding:34px 16px;
  border:2px dashed #cbd5e1;
  border-radius:16px;
  background:#f8fafc;
}

.results-ph svg{
  margin:0 auto 12px;
  color:#94a3b8;
}

.results-ph p{
  margin:0;
  line-height:1.8;
}

.ph-sub{
  font-size:.92rem;
  color:#94a3b8;
  margin-top:8px!important;
}

.res-cards{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:14px;
  margin-bottom:20px;
}

.res-card{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:16px;
  padding:17px;
}

.res-card.hi{
  background:#eff6ff;
  border-color:#bfdbfe;
}

.res-label{
  color:#64748b;
  font-size:.9rem;
  font-weight:800;
  margin-bottom:8px;
}

.res-val{
  color:#0f172a;
  font-size:1.45rem;
  font-weight:900;
  line-height:1.35;
  word-break:break-all;
}

.res-unit{
  font-size:.85rem;
  color:#64748b;
  font-weight:800;
}

.condition-note{
  grid-column:1/-1;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:13px 15px;
  color:#475569;
  line-height:1.7;
}

.result-box,
.compare-result{
  margin-top:20px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
  overflow:hidden;
}

.result-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:15px 16px;
  background:#f8fafc;
  border-bottom:1px solid var(--line);
}

.result-title,
.sub-h{
  margin:0;
  font-weight:900;
  color:#1f2937;
}

.compare-result .sub-h{
  padding:15px 16px;
  background:#f8fafc;
  border-bottom:1px solid var(--line);
}

.result-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.mini-copy{
  border:1px solid #bfdbfe;
  background:#fff;
  color:#1e40af;
  border-radius:999px;
  padding:7px 12px;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}

.tbl-wrap{
  width:100%;
}

.tbl-wrap.always{
  overflow-x:auto;
}

.result-table,
.compare-table,
.explain-table{
  width:100%;
  border-collapse:collapse;
  font-size:.94rem;
}

.result-table th,
.result-table td,
.compare-table th,
.compare-table td,
.explain-table th,
.explain-table td{
  border-bottom:1px solid #e5e7eb;
  padding:12px 10px;
  text-align:right;
  white-space:nowrap;
}

.result-table th:first-child,
.result-table td:first-child,
.compare-table th:first-child,
.compare-table td:first-child,
.explain-table th:first-child,
.explain-table td:first-child,
.explain-table th:nth-child(2),
.explain-table td:nth-child(2),
.explain-table th:nth-child(3),
.explain-table td:nth-child(3){
  text-align:left;
}

.result-table th,
.compare-table th,
.explain-table th{
  background:#f8fafc;
  color:#475569;
  font-weight:900;
}

.monthly-table td,
.monthly-table th{
  font-size:.9rem;
}

.diff-plus{
  color:var(--red);
  font-weight:900;
}

.diff-minus{
  color:var(--green);
  font-weight:900;
}

.print-title{
  display:none;
}

.next-action-list{
  display:grid;
  gap:14px;
}

.next-action-list > div{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:15px;
  padding:17px;
}

.next-action-list strong{
  display:block;
  color:#1e40af;
  margin-bottom:8px;
}

.next-action-list p{
  margin:0;
  color:#475569;
  line-height:1.85;
}

.mistake-box{
  background:#fff7ed;
  border:1px solid #fed7aa;
  border-radius:16px;
  padding:17px;
  margin-bottom:14px;
}

.mistake-box p{
  margin:0 0 8px;
  line-height:1.8;
}

.mistake-box p:last-child{
  margin-bottom:0;
}

.body-text{
  color:#475569;
  line-height:1.9;
  margin:0;
}

.rel-label{
  color:#64748b;
  font-weight:800;
  margin:0 0 12px;
}

.rel-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
}

.rel-link{
  display:block;
  text-align:center;
  border:1px solid #dbeafe;
  background:#f8fbff;
  border-radius:14px;
  padding:13px 10px;
  color:#1e40af;
  font-weight:800;
  text-decoration:none;
}

.rel-link:hover{
  background:#eff6ff;
  text-decoration:underline;
}

.hidden{
  display:none!important;
}

@media (max-width:800px){
  .howto-steps,
  .feature-grid,
  .res-cards,
  .rel-grid{
    grid-template-columns:1fr 1fr;
  }

  .quick-start-box,
  .preset-box{
    display:block;
  }

  .quick-start-box .btn{
    margin-top:14px;
  }

  .preset-buttons{
    justify-content:flex-start;
    margin-top:14px;
  }

  .form-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width:560px){
  .sec{
    padding:19px;
    border-radius:16px;
  }

  .tool-header .wrap{
    padding-top:26px;
    padding-bottom:26px;
  }

  .howto-steps,
  .feature-grid,
  .res-cards,
  .rel-grid{
    grid-template-columns:1fr;
  }

  .period-row{
    grid-template-columns:1fr;
  }

  .btn-group{
    display:grid;
    grid-template-columns:1fr;
  }

  .btn{
    width:100%;
  }

  .result-head{
    display:block;
  }

  .result-actions,
  .mini-copy{
    margin-top:10px;
  }

  .res-val{
    font-size:1.28rem;
  }
}

.explain-wrap{
  overflow-x:visible;
}

.explain-table{
  table-layout:fixed;
}

.explain-table th,
.explain-table td{
  white-space:normal;
  vertical-align:top;
  line-height:1.75;
}

.explain-table th:first-child,
.explain-table td:first-child{
  width:24%;
}

.explain-table th:nth-child(2),
.explain-table td:nth-child(2){
  width:38%;
}

.explain-table th:nth-child(3),
.explain-table td:nth-child(3){
  width:38%;
}

@media print{
  body{
    background:#fff;
  }

  .no-print,
  header,
  footer,
  .tool-header,
  .quick-start-box,
  .howto-sec,
  #tool-area,
  .result-actions,
  .mini-copy,
  #monthly-note{
    display:none!important;
  }

  .wrap{
    max-width:none;
    padding:0;
  }

  .sec{
    border:0;
    box-shadow:none;
    margin:0;
    padding:0;
  }

  .result-sec{
    display:block;
  }

  .print-title{
    display:block;
    margin-bottom:18px;
  }

  .print-title h2{
    font-size:20px;
    margin:0 0 6px;
  }

  .print-title p{
    margin:0;
    color:#666;
  }

  .sec-title{
    display:none;
  }

  .res-cards{
    grid-template-columns:repeat(3,1fr);
  }

  .res-card{
    break-inside:avoid;
  }

  .result-box,
  .compare-result{
    border:1px solid #ccc;
    margin-top:16px;
    break-inside:avoid;
  }

  .result-table,
  .compare-table{
    font-size:11px;
  }

  .result-table th,
  .result-table td,
  .compare-table th,
  .compare-table td{
    padding:6px;
  }
}