*,*::before,*::after{
  box-sizing:border-box;
  margin:0;
  padding:0;
}
html{
  font-size:16px;
}
body{
  font-family:-apple-system,BlinkMacSystemFont,'Hiragino Sans','Hiragino Kaku Gothic ProN','Noto Sans JP',sans-serif;
  background:#f0f4f8;
  color:#1e293b;
  line-height:1.7;
}
:root{
  --blue:#2563eb;
  --blue-dark:#1d4ed8;
  --blue-pale:#eff6ff;
  --navy:#1e3a5f;
  --green:#16a34a;
  --green-light:#dcfce7;
  --amber:#d97706;
  --amber-light:#fef3c7;
  --red:#dc2626;
  --red-light:#fee2e2;
  --gray:#64748b;
  --border:#e2e8f0;
  --shadow:0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.05);
  --shadow-md:0 4px 6px rgba(0,0,0,.07),0 2px 4px rgba(0,0,0,.05);
  --r:8px;
  --rs:4px;
}

.wrap{
  max-width:1120px;
  margin:0 auto;
  padding:0 16px;
}

.tool-header{
  background:#fff;
  border-bottom:3px solid var(--blue);
  padding:28px 0 20px;
  margin-bottom:28px;
}
.tool-title{
  font-size:clamp(1.25rem,3vw,1.65rem);
  font-weight:700;
  color:var(--navy);
  margin-bottom:6px;
}
.tool-subtitle{
  color:var(--gray);
  font-size:.9rem;
}

.sec{
  background:#fff;
  border-radius:var(--r);
  padding:24px 24px 28px;
  margin-bottom:20px;
  box-shadow:var(--shadow);
}
.sec-title{
  font-size:1.05rem;
  font-weight:700;
  color:var(--navy);
  margin-bottom:18px;
  padding-bottom:10px;
  border-bottom:2px solid var(--border);
  display:flex;
  align-items:center;
  gap:8px;
}
.sec-title::before{
  content:'';
  display:block;
  width:4px;
  height:20px;
  background:var(--blue);
  border-radius:2px;
  flex-shrink:0;
}

.lead-sec p{
  color:#334155;
  font-size:.95rem;
  line-height:1.85;
}
.lead-sec p+p{
  margin-top:12px;
}

.quick-start-box{
  background:linear-gradient(135deg,#eff6ff,#f8fafc);
  border:1px solid #bfdbfe;
  border-radius:var(--r);
  padding:18px 20px;
  margin-bottom:20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  box-shadow:var(--shadow);
}
.quick-start-box p{
  color:#334155;
  font-size:.92rem;
  line-height:1.7;
}
.quick-start-box b{
  color:#1e40af;
}

.howto-sec{
  background:var(--blue-pale);
  border-radius:var(--r);
  padding:20px 24px;
  margin-bottom:20px;
}
.howto-sec h2{
  font-size:.95rem;
  font-weight:700;
  color:var(--navy);
  margin-bottom:12px;
}
.howto-steps{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}
.howto-step{
  display:flex;
  align-items:flex-start;
  gap:8px;
  font-size:.875rem;
  color:#1e40af;
}
.step-num{
  background:var(--blue);
  color:#fff;
  width:22px;
  height:22px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.72rem;
  font-weight:700;
  flex-shrink:0;
  margin-top:2px;
}

.feature-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(230px,1fr));
  gap:12px;
}
.feature-card{
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:var(--rs);
  padding:14px 16px;
}
.feature-card strong{
  display:block;
  color:var(--navy);
  font-size:.92rem;
  margin-bottom:6px;
}
.feature-card p{
  color:#475569;
  font-size:.86rem;
  line-height:1.65;
}

.mis-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.mis-item{
  display:flex;
  gap:10px;
  padding:12px 14px;
  background:#fffbeb;
  border:1px solid #fde68a;
  border-radius:var(--rs);
  font-size:.87rem;
  color:#78350f;
}
.mis-ico{
  flex-shrink:0;
  margin-top:1px;
}

.preset-box{
  background:linear-gradient(135deg,#eff6ff,#f8fafc);
  border:1px solid #bfdbfe;
  border-radius:var(--r);
  padding:16px 18px;
  margin-bottom:20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.preset-box p{
  color:#334155;
  font-size:.88rem;
  line-height:1.65;
}
.preset-box p+p{
  margin-top:3px;
}
.preset-box b{
  color:#1e40af;
}
.preset-buttons{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:flex-end;
}

.form-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:18px;
}
.form-block.wide{
  grid-column:1/-1;
}
.check-block{
  display:flex;
  flex-direction:column;
  justify-content:center;
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:var(--rs);
  padding:12px 14px;
}
.check-label{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:.9rem;
  font-weight:600;
  color:#334155;
  cursor:pointer;
}
.check-label input{
  width:16px;
  height:16px;
}

input[type=text],
input[type=number],
select{
  width:100%;
  padding:8px 10px;
  border:1px solid #cbd5e1;
  border-radius:var(--rs);
  font-size:.9rem;
  color:#1e293b;
  background:#fff;
  font-family:inherit;
  transition:border-color .15s,box-shadow .15s;
}
input[type=text]:focus,
input[type=number]:focus,
select:focus{
  outline:none;
  border-color:var(--blue);
  box-shadow:0 0 0 3px rgba(37,99,235,.12);
}
.lbl{
  font-size:.82rem;
  font-weight:600;
  color:var(--gray);
  display:block;
  margin-bottom:4px;
}
.note{
  font-size:.72rem;
  color:#94a3b8;
  margin-top:3px;
}
.with-unit{
  display:flex;
  align-items:center;
  gap:6px;
}
.unit{
  font-size:.82rem;
  color:#94a3b8;
  white-space:nowrap;
}

.btn-group{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:22px;
}
.btn{
  display:inline-block;
  padding:10px 18px;
  border:none;
  border-radius:var(--rs);
  font-size:.9rem;
  font-weight:600;
  cursor:pointer;
  transition:all .15s;
  font-family:inherit;
  white-space:nowrap;
  text-decoration:none;
}
.btn-calc{
  background:var(--blue);
  color:#fff;
  padding:11px 26px;
  font-size:1rem;
}
.btn-calc:hover{
  background:var(--blue-dark);
  color:#fff;
}
.btn-add{
  background:#ecfdf5;
  color:var(--green);
  border:1px solid #86efac;
}
.btn-add:hover{
  background:#dcfce7;
}
.btn-sample{
  background:#fff;
  color:var(--gray);
  border:1px solid #cbd5e1;
}
.btn-sample:hover{
  background:#f8fafc;
  border-color:#94a3b8;
}
.btn-reset{
  background:#fff7ed;
  color:#c2410c;
  border:1px solid #fdba74;
}
.btn-reset:hover{
  background:#ffedd5;
}

.g-err{
  background:var(--red-light);
  border:1px solid #fca5a5;
  border-radius:var(--rs);
  padding:11px 15px;
  font-size:.87rem;
  color:var(--red);
  margin-top:12px;
  display:none;
}
.g-err.show{
  display:block;
}

.results-ph{
  text-align:center;
  padding:48px 20px;
  color:#94a3b8;
}
.results-ph svg{
  margin-bottom:12px;
  opacity:.45;
}
.results-ph p{
  font-size:.9rem;
  line-height:1.8;
}
.results-ph .ph-sub{
  font-size:.82rem;
  color:#b0bac6;
  margin-top:6px;
}

.res-cards{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(195px,1fr));
  gap:14px;
  margin-bottom:20px;
}
.res-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--r);
  padding:16px 18px;
  box-shadow:var(--shadow);
}
.res-card.hi{
  background:var(--blue-pale);
  border-color:#93c5fd;
}
.res-label{
  font-size:.78rem;
  color:var(--gray);
  margin-bottom:6px;
  font-weight:500;
}
.res-val{
  font-size:1.4rem;
  font-weight:700;
  color:var(--navy);
}
.res-card.hi .res-val{
  color:#1d4ed8;
}
.res-unit{
  font-size:.78rem;
  color:var(--gray);
  font-weight:400;
}

.result-box{
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:var(--r);
  padding:18px;
}
.result-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:12px;
}
.result-title{
  font-size:.95rem;
  font-weight:700;
  color:var(--navy);
}
.mini-copy{
  border:1px solid #93c5fd;
  background:#eff6ff;
  color:#1d4ed8;
  border-radius:var(--rs);
  padding:6px 12px;
  font-size:.82rem;
  cursor:pointer;
}
.mini-copy:hover{
  background:#dbeafe;
}
.result-output{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--rs);
  padding:16px;
  min-height:74px;
  color:#334155;
  font-size:.95rem;
  line-height:1.8;
}
.result-output pre{
  white-space:pre-wrap;
  word-break:break-word;
  font-family:inherit;
  line-height:1.8;
}
.comma-result{
  word-break:break-word;
}

.order-list{
  padding-left:1.5em;
}
.order-list li{
  padding:4px 0;
  border-bottom:1px solid #f1f5f9;
}
.order-list li:last-child{
  border-bottom:none;
}

.tbl-wrap{
  overflow-x:auto;
}
.tbl-wrap.always{
  display:block;
}
.result-table{
  width:100%;
  border-collapse:collapse;
  font-size:.88rem;
}
.result-table th{
  text-align:left;
  padding:9px 10px;
  background:#f8fafc;
  border-bottom:2px solid var(--border);
  color:var(--gray);
  font-weight:600;
  font-size:.78rem;
  white-space:nowrap;
}
.result-table td{
  padding:9px 10px;
  border-bottom:1px solid var(--border);
  color:#334155;
}
.result-table tr:last-child td{
  border-bottom:none;
}

.group-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
  gap:12px;
}
.group-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--rs);
  padding:13px 15px;
}
.group-card strong{
  display:block;
  color:var(--navy);
  font-size:.9rem;
  margin-bottom:6px;
}
.group-card p{
  color:#334155;
  font-size:.88rem;
  line-height:1.65;
  word-break:break-word;
}

.history-box{
  margin-top:20px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--r);
  padding:16px;
}
.history-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.sub-h{
  font-size:.95rem;
  font-weight:700;
  color:var(--navy);
}
.history-clear{
  background:#fff7ed;
  color:#c2410c;
  border:1px solid #fdba74;
  border-radius:var(--rs);
  padding:5px 10px;
  font-size:.78rem;
  cursor:pointer;
}
.history-clear:hover{
  background:#ffedd5;
}
.history-list{
  display:flex;
  flex-direction:column;
  gap:9px;
}
.history-item{
  display:flex;
  gap:10px;
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:var(--rs);
  padding:10px 12px;
}
.history-num{
  width:24px;
  height:24px;
  border-radius:50%;
  background:#dbeafe;
  color:#1d4ed8;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.75rem;
  font-weight:700;
  flex-shrink:0;
  margin-top:2px;
}
.history-item strong{
  display:block;
  color:var(--navy);
  font-size:.85rem;
  margin-bottom:3px;
}
.history-item small{
  color:#94a3b8;
  font-weight:400;
}
.history-item p{
  color:#475569;
  font-size:.82rem;
  line-height:1.55;
  word-break:break-word;
}

.next-action-list{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
}
.next-action-list div{
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:var(--rs);
  padding:14px 16px;
}
.next-action-list strong{
  display:block;
  color:var(--navy);
  font-size:.92rem;
  margin-bottom:6px;
}
.next-action-list p{
  color:#475569;
  font-size:.86rem;
  line-height:1.65;
}

.body-text{
  color:#334155;
  font-size:.92rem;
  line-height:1.8;
}
.body-text+.body-text{
  margin-top:12px;
}
.formula-box{
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:var(--rs);
  padding:14px 16px;
  margin:14px 0;
}
.formula-box p{
  font-size:.88rem;
  color:#334155;
  line-height:1.75;
}
.formula-box p+p{
  margin-top:6px;
}

.rel-label{
  font-size:.85rem;
  color:var(--gray);
  margin-bottom:14px;
  font-weight:600;
}
.rel-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:10px;
}
.rel-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:13px 15px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--rs);
  text-decoration:none;
  color:var(--navy);
  font-size:.87rem;
  font-weight:500;
  transition:all .15s;
  box-shadow:var(--shadow);
}
.rel-link:hover{
  border-color:var(--blue);
  color:var(--blue);
  transform:translateY(-1px);
  box-shadow:var(--shadow-md);
}
.rel-link::before{
  content:'→';
  color:var(--blue);
  font-weight:700;
  flex-shrink:0;
}

.hidden{
  display:none!important;
}

@media(max-width:700px){
  .sec{
    padding:20px 18px 24px;
  }
  .quick-start-box{
    display:block;
  }
  .quick-start-box .btn{
    margin-top:12px;
    width:100%;
    text-align:center;
  }
  .preset-box{
    display:block;
  }
  .preset-buttons{
    margin-top:12px;
    justify-content:flex-start;
  }
  .preset-buttons .btn{
    flex:1 1 calc(50% - 8px);
    text-align:center;
    padding-left:10px;
    padding-right:10px;
  }
  .form-grid{
    grid-template-columns:1fr;
  }
  .btn-group .btn{
    width:100%;
    text-align:center;
  }
  .result-head,
  .history-head{
    align-items:flex-start;
    flex-direction:column;
  }
  .mini-copy,
  .history-clear{
    width:100%;
  }
}