/* 白地に黒。宣材と同じく、階層は色でなく大きさと余白で作る。スマホを片手で持って親指で押す前提 */
:root {
  --ink: #111;
  --paper: #fff;
  --line: #dedcd6;
  --soft: #f3f2ee;
  --warn: #b42318;
  --ok: #2f6b3a;
  --bar: 148px;  /* 下に固定した合計と支払いの帯の高さ（縦向き） */
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; font-feature-settings: "palt"; overscroll-behavior-y: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.link { text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; font-size: 15px; }

#app { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* 上の帯：monode-sign POS system と合計（または戻る）、その下にイベント名・入力中の名前・送信の状態 */
.top { position: sticky; top: 0; z-index: 3; background: var(--paper); padding: calc(8px + env(safe-area-inset-top)) 0 8px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.brand .logo { height: 14px; width: auto; flex: none; }
.brand .link { margin-left: auto; font-weight: 600; padding: 4px 0; }
.who { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; font-size: 14px; min-width: 0; }
.who .title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .user { white-space: nowrap; }
.who .sync { margin-left: auto; font-size: 13px; white-space: nowrap; }
.who .sync.ok { color: var(--ok); }
.who .sync.warn { color: var(--warn); font-weight: 600; }
.alert { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: #fdecea; color: var(--warn); font-size: 14px; }

/* 品目：なるべくスクロールせずに見渡せるグリッド（縦向きのスマホで 3 列）。タイルを押すと 1 つ増え、選んだタイルには数と − が出る */
.input { padding: 8px 0 calc(var(--bar) + 12px + env(safe-area-inset-bottom)); }
.items { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.item { position: relative; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.item.on { border-color: var(--ink); background: var(--soft); }
.pick { width: 100%; height: 100%; min-height: 100px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px; text-align: left; }
.pick:active { background: var(--soft); }
.pick img, .pick .noimg { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--soft); margin-bottom: 2px; }
.pick .name { font-size: 14px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: normal; line-break: strict; overflow-wrap: anywhere; }
.pick .no { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px; margin-right: 4px; border-radius: 3px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.pick .price { margin-top: auto; font-size: 13px; color: #55534d; }
.pick .left { font-size: 12px; }
.pick .left.out { color: var(--warn); font-weight: 600; }
/* 数は右上に ×2 と大きく、減らすボタンは右下の丸い − に（「− 2」と続けて読まれないよう離す） */
.item .count { position: absolute; top: 6px; right: 8px; font-size: 22px; font-weight: 700; line-height: 1; pointer-events: none; }
.item .minus { position: absolute; right: 6px; bottom: 6px; width: 36px; height: 36px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--paper); font-size: 20px; line-height: 1; display: grid; place-items: center; }
.item .minus:active { background: var(--soft); }
.item.on .price, .item.on .left { padding-right: 34px; }

/* 記録した直後の知らせ。取り消しはここで 1 回押せばよい */
.done { margin: 4px 0 10px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: var(--paper); }
.done-row { display: flex; align-items: center; gap: 12px; }
.done-main { flex: 1; min-width: 0; font-weight: 600; }
.received { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 15px; }
.received input { flex: 1; min-width: 0; padding: 10px 12px; border: 0; border-radius: 10px; font-size: 18px; color: var(--ink); background: var(--paper); }
.change { margin-top: 6px; font-size: 15px; min-height: 1em; }
.change:empty { display: none; }
.change strong { font-size: 30px; font-weight: 700; margin-left: 4px; }
.change .short { color: #ffb4a8; font-weight: 600; }
.done .seq { margin-right: 8px; font-size: 13px; opacity: 0.8; }
/* 取り消しは目立たせない。押すと「もう一度押すと取り消し」に変わり、2 度目で取り消す */
.undo-link { flex: none; padding: 8px 4px; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.undo-link.armed { padding: 8px 12px; border-radius: 8px; background: var(--warn); color: #fff; text-decoration: none; font-weight: 600; }

/* 下の帯：点数・合計と、支払いの 2 つのボタン */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; background: var(--paper); border-top: 1.5px solid var(--ink);
  padding: 8px max(16px, calc((100vw - 728px) / 2)) calc(10px + env(safe-area-inset-bottom)); }
.sum-line { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.count-text { font-size: 15px; }
.sum-line .total { margin-left: auto; font-size: 32px; font-weight: 700; line-height: 1.1; }
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay button { height: 60px; border-radius: 12px; font-size: 18px; font-weight: 700; background: var(--ink); color: var(--paper); }
.pay button:disabled { background: var(--soft); color: #9a978f; }
.pay button:not(:disabled):active { opacity: 0.8; }
.pay .back { background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); }
.ask { margin: -2px 0 8px; font-size: 16px; font-weight: 600; }
.ask strong { font-size: 20px; }

/* 合計の画面 */
.sum { padding: 12px 0 calc(24px + env(safe-area-inset-bottom)); }
.big { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; }
.big strong { font-size: 34px; font-weight: 700; }
.big.small strong { font-size: 26px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 14px; }
.split > div { padding: 10px 12px; border-radius: 10px; background: var(--soft); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.split strong { font-size: 20px; }
table { width: 100%; border-collapse: collapse; }
td { padding: 9px 0; border-bottom: 1px solid var(--line); }
td:first-child { width: 2em; font-weight: 700; }
td.r { text-align: right; padding-left: 12px; }
tr.zero td { color: #9a978f; }
h2 { font-size: 17px; margin: 22px 0 6px; }
.stock input { width: 5.5em; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 16px; text-align: right; }
.stock td:nth-child(2) { width: 100%; max-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock td.r { white-space: nowrap; }
.stock-save { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.float { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.float input { width: 9em; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 18px; text-align: right; }
.list { list-style: none; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list .body { flex: 1; min-width: 0; }
.list li.void .body { text-decoration: line-through; opacity: 0.45; }
.meta { font-size: 13px; color: #55534d; }

.tools { display: grid; gap: 8px; margin-top: 22px; }
.secondary { padding: 14px; border: 1.5px solid var(--ink); border-radius: 12px; font-weight: 600; }

/* 始める画面 */
.setup { padding: calc(32px + env(safe-area-inset-top)) 0 24px; display: grid; gap: 16px; }
.setup h1 { display: flex; align-items: center; gap: 12px; font-size: 22px; }
.setup h1 img { height: 22px; width: auto; }
.setup label { display: grid; gap: 6px; font-weight: 600; }
.setup input { padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 18px; font-weight: 400; background: var(--paper); }
.primary { height: 60px; border-radius: 12px; font-size: 18px; font-weight: 700; background: var(--ink); color: var(--paper); }

/* 横向きのスマホ（背が低い）は、下の帯を 1 行にして品目を見える範囲を広げる */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --bar: 64px; }
  .bar { display: flex; align-items: center; gap: 12px; padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .sum-line { margin: 0; flex: 1; }
  .sum-line .total { font-size: 26px; }
  .pay { flex: none; width: 360px; }
  .pay button { height: 48px; font-size: 16px; }
  .pick { min-height: 86px; padding: 6px 8px; }
  .pick img, .pick .noimg { width: 28px; height: 28px; }
}
