/* ひとりいくら？｜レイアウト共通。色・書体は各案の theme.css */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 18px; line-height: 1.5; color: var(--fg); background: var(--bg); overflow-x: hidden; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.app { max-width: 480px; margin: 0 auto; padding: 16px 16px 64px; }
/* ロゴは左右の中心（前川さんの指示 2026-09-06）。音のボタンは右上に浮かせる */
header.top { position: relative; display: block; text-align: center; padding: 14px 0 22px; }
header.top h1 { font-size: 22px; margin: 0; letter-spacing: .02em; }
header.top h1.brand { line-height: 0; }
.app-logo { display: block; width: 240px; max-width: 76vw; height: auto; margin: 0 auto; }
header.top .ver { display: block; margin-top: 6px; font-size: 12px; opacity: .6; }
header.top .sound-toggle { position: absolute; top: 8px; right: 0; }
section { margin-bottom: 20px; }
.block-title { font-size: 15px; font-weight: 700; opacity: .75; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.block-title .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 14px; }
/* ① 金額 */
.receipt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.receipt-field { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.receipt-row .yen, .fixed-row .yen { font-size: 22px; opacity: .7; width: 1em; text-align: center; }
.receipt-row input { flex: 1 1 0; min-width: 0; height: 60px; font-size: 30px; font-weight: 700; text-align: right; padding: 0 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--field); }
.receipt-row input:focus, .card .fixed:focus, .card .name:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.text-btn { height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--accent); font-weight: 700; border-radius: var(--radius); }
.total-line { font-size: 16px; opacity: .8; min-height: 1.5em; margin: 2px 0 0 34px; }
/* ② 人数 */
.stepper { display: flex; align-items: center; justify-content: center; gap: 12px; }
.stepper button { width: 60px; height: 60px; font-size: 32px; font-weight: 700; border: 2px solid var(--line); background: var(--field); border-radius: var(--radius); }
.stepper .count { font-size: 34px; font-weight: 700; min-width: 2.2em; text-align: center; }
.stepper .unit-label { font-size: 16px; opacity: .8; margin-left: -6px; }
/* ③ 結果 */
.headline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius); background: var(--hero-bg); color: var(--hero-fg); margin-bottom: 12px; min-height: 84px; }
.headline .lead { font-size: 18px; opacity: .85; }
.headline .big { font-size: 44px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.headline .note { font-size: 15px; }
.headline .error { color: var(--danger); font-weight: 700; font-size: 16px; }
.is-idle .headline { opacity: .55; }
.card { border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 8px; padding: 6px 8px; }
.card.is-adjusted { border-color: var(--accent); }
.card.is-open { box-shadow: 0 0 0 3px var(--accent-soft); }
.card-main { display: flex; align-items: center; gap: 6px; min-height: 48px; }
.payer-mark { display: grid; place-items: center; width: 28px; flex: 0 0 auto; color: var(--accent); }
.slot { width: 44px; flex: 0 0 auto; }
.chips-row2 { display: flex; gap: 8px; width: 100%; flex-wrap: wrap; }
.chips-row2 .chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: 15px; }
.chips-row2 .payer-btn { flex: 1 1 auto; }
.chip-remove { border-style: dashed; opacity: .8; }
.payer-btn[aria-pressed="true"] { opacity: 1; background: var(--accent-soft); }
.card .name { flex: 1 1 0; min-width: 0; height: 44px; border: 0; background: transparent; padding: 0 4px; font-size: 18px; border-bottom: 1px dashed var(--line); }
.card .amount { font-size: 22px; font-weight: 800; white-space: nowrap; min-width: 4.5em; text-align: right; font-variant-numeric: tabular-nums; }
.label-btn { height: 44px; padding: 0 8px 0 12px; border: 2px solid var(--line); background: var(--field); border-radius: 22px; font-size: 15px; white-space: nowrap; color: var(--fg); display: inline-flex; align-items: center; gap: 3px; }
.label-btn .ico { width: .75em; height: .75em; opacity: .75; }
.label-btn[aria-expanded="true"] .ico { transform: rotate(180deg); }
.hint { font-size: 14px; line-height: 1.7; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--field); border: 1px dashed var(--line); }
.hint-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border: 2px solid var(--line); border-radius: 20px; background: var(--card); font-size: 13px; white-space: nowrap; }
.hint-chip .ico { width: .75em; height: .75em; }
.is-adjusted .label-btn { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; opacity: .5; flex: 0 0 auto; }
.paid-btn { width: 44px; height: 44px; border: 0; background: transparent; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; color: var(--fg); opacity: .45; }
.paid-btn[aria-pressed="true"] { opacity: 1; color: var(--ok, var(--accent)); }
.svg-note { display: none; }
.ico { width: 1.15em; height: 1.15em; display: block; }
.ico-slot { display: inline-grid; place-items: center; }
.collect .done { display: inline-flex; align-items: center; gap: 6px; color: var(--ok, var(--accent)); }
.text-btn { display: inline-flex; align-items: center; gap: 8px; }
.actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.stepper button { display: grid; place-items: center; font-size: 20px; }

.icon-btn { display: grid; place-items: center; font-size: 16px; }
.paid-btn[disabled] { opacity: .3; cursor: default; }
.card.is-paid { opacity: .72; }
.card.is-paid .amount { text-decoration: line-through; }

.collect { font-size: 17px; font-weight: 700; margin-top: 6px; min-height: 1.5em; }
.icon-btn:hover { opacity: 1; }
.absorb { font-size: 14px; opacity: .85; padding: 0 6px 6px 34px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 4px 10px; border-top: 1px solid var(--line); margin-top: 4px; }
.chip { height: 44px; padding: 0 16px; border-radius: 22px; border: 2px solid var(--line); background: var(--field); font-size: 16px; font-weight: 700; }
.chip.is-on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.fixed-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.card .fixed { flex: 1 1 0; min-width: 0; height: 48px; font-size: 22px; font-weight: 700; text-align: right; padding: 0 12px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--field); }
.units-wrap { margin-top: 16px; }
.units-wrap .block-title { margin-bottom: 6px; }
#units { display: flex; gap: 8px; flex-wrap: wrap; }
#units .chip { flex: 1 1 0; padding: 0 8px; text-align: center; }
.summary { font-size: 16px; margin-top: 10px; min-height: 1.5em; opacity: .9; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.actions button { height: 52px; border-radius: var(--radius); border: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 17px; }
.actions #reset { grid-column: 1 / -1; background: transparent; color: var(--fg); border-color: var(--line); }
.sound-toggle { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: grid; place-items: center; padding: 0; }
.sound-toggle .ico { width: 20px; height: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 24px; font-size: 15px; max-width: 92vw; text-align: center; z-index: 9; }
footer.foot { font-size: 13px; opacity: .85; margin-top: 32px; }
@media (max-width: 360px) { .headline .big { font-size: 38px; } .card .amount { font-size: 20px; } .label-btn { padding: 0 8px; } }

/* ── 動きと押した感触（2026-09-06 追加） ───────────────── */
/* 押した所から広がる輪。専用の層に閉じ込めるので、ボタンの幅は変わらない */
button { position: relative; }
.fx-layer { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.fx-ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .22; transform: scale(0);
  animation: fx-ripple .5s ease-out forwards;
}
@keyframes fx-ripple { to { transform: scale(1); opacity: 0; } }
button:active { transform: scale(.97); }
.chip, .label-btn, .actions button, .stepper button, .paid-btn { transition: transform .12s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease; }

/* ひと跳ね */
@keyframes fx-pop { 0% { transform: scale(1); } 38% { transform: scale(1.14); } 100% { transform: scale(1); } }
.fx-pop { animation: fx-pop .34s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes fx-bump { 0% { transform: scale(1); } 30% { transform: scale(1.035); } 100% { transform: scale(1); } }
.fx-bump { animation: fx-bump .42s cubic-bezier(.3, 1.3, .5, 1); }

/* 金額が転がって増える。最後の値は先に入っているので、読み取りは常に正しい */
.big { position: relative; }
.big.is-rolling { color: transparent; }
.fx-roll { position: absolute; left: 0; right: 0; top: 0; color: inherit; text-shadow: inherit; }

/* カードが下から現れる */
@keyframes fx-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card { animation: fx-in .28s ease both; }
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 28ms; }
.card:nth-child(3) { animation-delay: 56ms; }
.card:nth-child(4) { animation-delay: 84ms; }
.card:nth-child(5) { animation-delay: 112ms; }
.card:nth-child(n+6) { animation-delay: 140ms; }
.chips { animation: fx-in .2s ease both; }

/* 受け取ったときに弾ける粒 */
.fx-burst { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 20; }
.fx-burst i {
  position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 2px;
  background: var(--accent); opacity: 0; animation: fx-burst .78s cubic-bezier(.2, .8, .3, 1) forwards;
}
.fx-burst i:nth-child(3n) { background: var(--ok, #0a7d55); border-radius: 50%; }
.fx-burst i:nth-child(3n+1) { background: var(--sky-1, var(--accent)); }
@keyframes fx-burst {
  0% { opacity: 1; transform: translate(0, 0) scale(.6) rotate(0deg); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 26px)) scale(1) rotate(220deg); }
}

/* 「動きを減らす」設定の端末では、動きを止める（音の設定とは別） */
@media (prefers-reduced-motion: reduce) {
  .card, .chips { animation: none; }
  .fx-ripple, .fx-burst { display: none; }
  .fx-pop, .fx-bump { animation: none; }
  button:active { transform: none; }
  .chip, .label-btn, .actions button, .stepper button, .paid-btn { transition: none; }
}

/* ── サイトのフッターと応援欄（ほかのBRIDGEのサービスと同じ並び） ───────── */
#sitefoot { margin-top: 8px; }
.support {
  max-width: 480px; margin: 0 auto; padding: 20px 20px 24px;
  border-left: 5px solid var(--accent); background: var(--card); text-align: center;
}
/* 画面が480pxより狭いときだけ、端に寄りすぎないよう内側で逃がす */
@media (max-width: 519px) { .support { margin-left: 20px; margin-right: 20px; } }
.support__lead { font-size: 14px; line-height: 1.95; margin: 0 0 4px; }
.support__actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 10px; justify-content: center; }
.support__btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0 22px; border: 0; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--accent); color: var(--on-accent); text-decoration: none; cursor: pointer;
}
.support__btn--sub { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.support__note { font-size: 13px; line-height: 1.9; margin: 0; }
.sitefoot {
  background: #232323; color: #c4c4c4; padding: 34px 20px 40px;
  text-align: center; font-size: 13px; line-height: 1.9;
}
.sitefoot a { color: #7fd8e6; }
.sitefoot__brand { margin: 0; font-size: 12px; letter-spacing: .08em; color: #a8a8a8; }
.sitefoot__brand a {
  color: #fff; font-weight: 700; letter-spacing: .16em; margin-left: .35em;
  text-decoration: underline; text-underline-offset: 4px;
}
.sitefoot__links { margin: 14px 0 0; display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; align-items: center; }
.sitefoot__links a, .btn-install { font-size: 13px; }
.btn-install {
  font-family: inherit; color: #7fd8e6; background: transparent;
  border: 1px solid #7fd8e6; border-radius: 999px; padding: 7px 18px;
  text-decoration: none; display: inline-block; min-height: 34px; cursor: pointer;
}
.sitefoot__version { margin: 12px 0 0; font-size: 11px; }
.sitefoot__version a { color: #9a9a9a; }

/* 支払い設定は名前・金額の下に1行で置く（横に並べると小さい画面で収まらない） */
/* 2行目：左に支払い設定、右に支払確認 */
.card-setting { display: flex; align-items: center; gap: 8px; padding: 0 0 6px 2px; flex-wrap: wrap; }
.card-setting .paid-btn {
  margin-left: auto; width: auto; height: 44px; padding: 0 12px; opacity: 1;
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
}
.paid-text { font-size: 14px; }
/* 支払い設定と支払確認は、小さい端末でも1行に収める（2026-09-06 前川さんの指摘）。
   320pxで2行に折り返していた。余白と記号を詰め、押せる高さ（44px）は保つ */
.card-setting { flex-wrap: nowrap; }
.card-setting .label-btn { min-width: 0; flex: 0 1 auto; }
.card-setting .paid-btn { flex: 0 0 auto; }
@media (max-width: 400px) {
  .card-setting { gap: 5px; }
  .card-setting .label-btn { font-size: 13px; padding: 0 6px 0 10px; }
  .card-setting .label-btn .ico { width: .7em; height: .7em; }
  .card-setting .paid-btn { font-size: 13px; padding: 0 9px; gap: 4px; }
  .card-setting .paid-btn .ico { width: 15px; height: 15px; }
  .card-setting .paid-text { font-size: 13px; }
}
@media (max-width: 340px) {
  .card-setting .label-btn { font-size: 12px; padding: 0 5px 0 8px; }
  .card-setting .paid-btn { font-size: 12px; padding: 0 7px; }
  .card-setting .paid-text { font-size: 12px; }
}
.chips-title { width: 100%; margin: 0 0 2px; font-size: 12px; letter-spacing: .08em; opacity: .75; }

/* 入力をお願いする欄の文字。ブラウザ標準のプレースホルダーは点滅させられないので、
   自前の文字を重ねてゆっくり明滅させる。指の操作は下の入力欄へ素通りさせる */
.receipt-field, .fixed-row { position: relative; }
.ph {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  pointer-events: none; font-size: 20px; font-weight: 400; color: #9db4c2;
  animation: ph-blink 2.6s ease-in-out infinite;
}
.fixed-row .ph { font-size: 17px; right: 12px; }
@keyframes ph-blink { 0%, 100% { opacity: 1; } 50% { opacity: .34; } }
@media (prefers-reduced-motion: reduce) { .ph { animation: none; } }
