<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>配膳ロボットの払い方と、元が取れるか</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Noto+Sans+JP:wght@400;500;700&display=swap">
<style>html{font-variant-numeric:tabular-nums}
  :root { --ink:#242424; --paper:#f7f7f7; --mute:#555; --soft:#f7f7f7; --rule:#e6e6e6; --blue:#2f6fdf; --red:#d85a30; }
  * { box-sizing:border-box; }
  body { margin:0; background:var(--paper); color:var(--ink); font-family:"Inter","Noto Sans JP",sans-serif; font-size:14px; line-height:1.7; padding:8px 0; }
  .wrap { max-width:860px; margin:0 auto; display:grid; gap:18px; background:#fff; border-radius:8px; padding:28px 24px; }
  h1 { margin:0; font-size:18px; font-weight:700; line-height:1.5; }
  .lead { margin:0; color:var(--mute); font-size:13px; }
  .lab { font-size:11px; letter-spacing:.08em; color:var(--mute); }
  .ctl { display:grid; gap:6px; }
  .btns { display:flex; flex-wrap:wrap; gap:6px; }
  button { font:inherit; font-size:13px; padding:7px 12px; border:1px solid var(--rule); background:#fff; color:var(--ink); cursor:pointer; border-radius:4px; }
  button[aria-pressed="true"] { background:var(--ink); color:#fff; border-color:var(--ink); }
  button:focus-visible { outline:2px solid var(--ink); outline-offset:2px; }
  .ctls { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
  .rows { display:grid; gap:16px; border-top:1px solid var(--rule); padding-top:16px; }
  .row { display:grid; grid-template-columns:54px minmax(0,1fr) 120px; gap:12px; align-items:center; }
  .n { font-weight:600; font-size:15px; }
  .axis { position:relative; height:18px; background:var(--soft); border-radius:3px; }
  .axis::after { content:""; position:absolute; left:50%; top:-3px; bottom:-3px; width:1px; background:var(--ink); }
  .fill { position:absolute; top:0; bottom:0; transition:all .45s ease; }
  .fill.up { left:50%; background:var(--blue); }
  .fill.down { right:50%; background:var(--red); }
  .sub { font-size:11px; color:var(--mute); margin-top:4px; }
  .net { text-align:right; font-size:16px; font-weight:600; }
  .net.up { color:var(--blue); }
  .net.down { color:var(--red); }
  .net small { display:block; font-size:11px; font-weight:400; color:var(--mute); }
  .note { margin:0; padding:12px 14px; font-size:13px; background:var(--soft); border-radius:8px; }
  .foot { margin:0; font-size:11px; color:var(--mute); }
  @media (max-width:599px) {
    .wrap { padding:20px 14px; }
    .ctls { grid-template-columns:1fr; }
    .row { grid-template-columns:44px minmax(0,1fr); }
    .net { grid-column:2; text-align:left; }
  }
  @media (prefers-reduced-motion:reduce) { .fill { transition:none; } }
</style>
</head>
<body>
<div class="wrap">
  <div>
    <span class="lab">PAYBACK · RENT OR BUY</span>
    <h1>配膳ロボットの払い方と、ひと月の差し引き</h1>
    <p class="lead">店と混み具合と払い方を選ぶと、ロボット1〜3台それぞれで、浮く人件費からロボットの費用を引いた額（ひと月）が並びます。青は浮く方が多い（黒字）、赤は費用の方が多い（赤字）。人件費は、試算で店が回る最少のスタッフが、ロボットなしより何人減るかで数えています。</p>
  </div>
  <div class="ctl"><span class="lab">店</span><div class="btns" id="store"></div></div>
  <div class="ctls">
    <div class="ctl"><span class="lab">混み具合</span><div class="btns" id="crowd"></div></div>
    <div class="ctl"><span class="lab">払い方</span><div class="btns" id="pay"></div></div>
  </div>
  <div class="rows" id="rows" aria-live="polite"></div>
  <p class="note" id="note"></p>
  <p class="foot">前提：時給1,177円・混む時間（2時間、焼肉食べ放題は2時間半）だけ人が浮く・1日2回・30日。借りる＝1台 月6万円＋保守1万円＋充電0.2万円。買う＝1台250万円を5年で割り、保守・充電を足す。補助金＝買う値段の1/2（中小企業省力化投資補助金・カタログ注文型）。売るときの値段は入れていない。店が回る最少のスタッフは、配膳ロボットの試算（上げ膳だけ・1往復で最大3卓）の結果。</p>
</div>
<script>
// ガイド /guide/serving-robot-cost 用（2026-11-23）。店が回る最少のスタッフ（ロボット0〜3台）は、
// public/sim/serving-robot.html の試算の結果を、試算のページと同じ決め方（minStaff）で数えた値。試算を直したらここも数え直す
const D = [{"store":"small","l":"小型店","tables":18,"crowd":0,"arr":15,"peak":120,"staff":[1,1,1,1]},{"store":"small","l":"小型店","tables":18,"crowd":1,"arr":22,"peak":120,"staff":[2,2,2,2]},{"store":"small","l":"小型店","tables":18,"crowd":2,"arr":30,"peak":120,"staff":[2,2,2,2]},{"store":"family","l":"標準ファミレス","tables":35,"crowd":0,"arr":25,"peak":120,"staff":[2,2,2,2]},{"store":"family","l":"標準ファミレス","tables":35,"crowd":1,"arr":35,"peak":120,"staff":[3,3,3,3]},{"store":"family","l":"標準ファミレス","tables":35,"crowd":2,"arr":45,"peak":120,"staff":[4,3,3,3]},{"store":"large","l":"大型店","tables":60,"crowd":0,"arr":45,"peak":120,"staff":[5,4,3,3]},{"store":"large","l":"大型店","tables":60,"crowd":1,"arr":60,"peak":120,"staff":[6,5,5,5]},{"store":"large","l":"大型店","tables":60,"crowd":2,"arr":75,"peak":120,"staff":[8,7,6,6]},{"store":"hotel","l":"洗い場が遠い店","tables":30,"crowd":0,"arr":16,"peak":120,"staff":[2,1,1,1]},{"store":"hotel","l":"洗い場が遠い店","tables":30,"crowd":1,"arr":22,"peak":120,"staff":[3,2,2,2]},{"store":"hotel","l":"洗い場が遠い店","tables":30,"crowd":2,"arr":28,"peak":120,"staff":[3,3,3,3]},{"store":"buffet","l":"焼肉食べ放題","tables":35,"crowd":0,"arr":14,"peak":150,"staff":[2,1,1,1]},{"store":"buffet","l":"焼肉食べ放題","tables":35,"crowd":1,"arr":20,"peak":150,"staff":[3,2,2,2]},{"store":"buffet","l":"焼肉食べ放題","tables":35,"crowd":2,"arr":26,"peak":150,"staff":[4,3,3,2]}];
const WAGE = 1177, PEAKS = 2, DAYS = 30, RUN = 10000 + 2000, RENT = 60000, PRICE = 2500000, YEARS = 5, CAP = 7500000;
const CROWD = ["空いている", "普通", "混雑"];
const STORES = [["small", "小型店（18卓）"], ["family", "標準ファミレス（35卓）"], ["large", "大型店（60卓）"], ["hotel", "洗い場が遠い店（30卓）"], ["buffet", "焼肉食べ放題（35卓）"]];
const st = { store: "family", crowd: "2", pay: "rent" };
const man = v => { if (Math.round(v / 1000) === 0) return "0円"; const a = Math.abs(v) / 10000, r = Math.round(a * 10) / 10; return `${v < 0 ? "−" : v > 0 ? "+" : ""}${Number.isInteger(r) ? r : r.toFixed(1)}万円`; };
const plain = v => man(v).replace(/^\+/, "");
function cost(n) {
  if (st.pay === "rent") return { month: n * (RENT + RUN), first: 0 };
  const total = n * PRICE, sub = st.pay === "sub" ? Math.min(total / 2, CAP) : 0, first = total - sub;
  return { month: first / (YEARS * 12) + n * RUN, first };
}
function group(id, opts, key) {
  const el = document.getElementById(id);
  el.innerHTML = opts.map(([v, l]) => `<button type="button" data-v="${v}" aria-pressed="${String(st[key]) === String(v)}">${l}</button>`).join("");
  el.onclick = e => { const b = e.target.closest("button"); if (!b) return; st[key] = b.dataset.v; group(id, opts, key); render(); };
}
function render() {
  const s = D.find(x => x.store === st.store && String(x.crowd) === String(st.crowd));
  const per = s.peak / 60 * PEAKS * DAYS * WAGE;
  const data = [1, 2, 3].map(n => {
    const saved = s.staff[0] - s.staff[n], c = cost(n), labor = saved * per, net = labor - c.month;
    const back = st.pay !== "rent" && labor > n * RUN ? Math.ceil(c.first / (labor - n * RUN)) : null;
    return { n, saved, c, labor, net, back };
  });
  const max = Math.max(...data.map(d => Math.abs(d.net)), 1);
  document.getElementById("rows").innerHTML = data.map(d => {
    const w = (Math.abs(d.net) / max * 50).toFixed(1);
    const cls = Math.round(d.net / 1000) === 0 ? "" : d.net > 0 ? "up" : "down";
    const staff = d.saved > 0 ? `スタッフ ${s.staff[0]}人 → ${s.staff[d.n]}人` : `スタッフは${s.staff[0]}人のまま`;
    const back = st.pay === "rent" ? "" : d.back ? `・初めの${plain(d.c.first)}は約${d.back}か月で取り戻す` : `・初めの${plain(d.c.first)}は取り戻せない`;
    return `<div class="row"><span class="n">${d.n}台</span>
      <div><div class="axis"><span class="fill ${cls || "up"}" style="width:${cls ? w : 0}%"></span></div>
      <div class="sub">${staff}・費用 月${plain(d.c.month)}・浮く人件費 月${plain(d.labor)}${back}</div></div>
      <div class="net ${cls}">${man(d.net)}<small>ひと月の差し引き</small></div></div>`;
  }).join("");
  const best = data.reduce((a, b) => (b.net > a.net ? b : a));
  const name = `${s.l}（${s.tables}卓）・${CROWD[s.crowd]}（1時間に${s.arr}組）`;
  document.getElementById("note").textContent = data.every(d => d.saved <= 0)
    ? `${name}では、ロボットを1〜3台のどれにしても、店が回る最少のスタッフは${s.staff[0]}人のままです。人件費は浮かず、どの払い方でもロボットの費用がそのまま出ていきます。`
    : best.net > 0
      ? `${name}では、${best.n}台のときに差し引きが一番大きく、月${man(best.net)}です。${best.n === 1 && data[1].saved === data[0].saved ? "2台目を足しても減る人数は変わらず、費用だけが増えます。" : ""}`
      : `${name}では、人は減りますが、この払い方ではどの台数でも費用の方が多くなります。`;
}
group("store", STORES, "store");
group("crowd", CROWD.map((l, i) => [String(i), l]), "crowd");
group("pay", [["rent", "月額で借りる"], ["buy", "買う"], ["sub", "買う＋補助金"]], "pay");
requestAnimationFrame(() => requestAnimationFrame(render));
</script>
<script>(function(){var last=0;
function measure(){var b=document.body;if(!b)return 0;var cs=getComputedStyle(b);var bottom=0;
for(var i=0;i<b.children.length;i++){var el=b.children[i];var s=getComputedStyle(el);if(s.position==='fixed'||s.display==='none'||el.tagName==='SCRIPT'||el.tagName==='STYLE')continue;
var r=el.getBoundingClientRect();var mb=parseFloat(s.marginBottom)||0;if(r.bottom+mb>bottom)bottom=r.bottom+mb;}
return Math.ceil(bottom+window.scrollY+(parseFloat(cs.paddingBottom)||0)+(parseFloat(cs.marginBottom)||0));}
function send(){var h=measure();if(h>0&&Math.abs(h-last)>1){last=h;parent.postMessage({p2mHeight:h},'*');}}
window.addEventListener('load',send);window.addEventListener('resize',send);
if(window.ResizeObserver&&document.body){new ResizeObserver(send).observe(document.body);}setInterval(send,1000);send();})();</script></body>
</html>
