/* ちょきんぶた 見た目 */
:root {
  --bg: #fff7f9;
  --ink: #5a4a52;
  --ink-soft: #9a8890;
  --line: #f3e3e8;
  --card: #ffffff;
  --main: #ff8fb1;
  --deep: #e8648d;
  --soft: #ffe3ec;
  --pale: #fff0f5;
  --ok: #4cc38a;
  --warn: #ffb84d;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(232, 100, 141, .12), 0 10px 24px rgba(90, 74, 82, .06);
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'BIZ UDPGothic', sans-serif;
}
.t-pink     { --main: #ff8fb1; --deep: #e8648d; --soft: #ffe3ec; --pale: #fff0f5; }
.t-mint     { --main: #5cc9a7; --deep: #2fa583; --soft: #d7f4ea; --pale: #effbf6; }
.t-lavender { --main: #b39cf0; --deep: #8b6fe0; --soft: #ebe3ff; --pale: #f6f2ff; }
.t-sky      { --main: #6cb8f2; --deep: #3d93d6; --soft: #ddeefd; --pale: #f0f7ff; }
.t-lemon    { --main: #f5c64a; --deep: #d9a21a; --soft: #fff3c9; --pale: #fffaea; }
.t-peach    { --main: #ffa77a; --deep: #f07e48; --soft: #ffe6d8; --pale: #fff4ee; }
.t-blue     { --main: #7aa7e8; --deep: #4f83cf; --soft: #e1ebfa; --pale: #f3f7fd; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
/* スマホで横にずれない・ゆれない・勝手に拡大しない */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; overflow-x: hidden; }
body { overflow-x: hidden; overscroll-behavior-x: none; width: 100%; position: relative; }
#app { overflow-x: clip; }
input, select, textarea { font-size: 16px; }
body { min-height: 100vh; font-size: 16px; line-height: 1.5; }
#app { max-width: 560px; margin: 0 auto; padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); min-height: 100vh; }
.page { background: linear-gradient(180deg, var(--pale) 0, var(--bg) 360px); min-height: 100vh; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select { font: inherit; color: var(--ink); }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.num { font-feature-settings: 'tnum'; }

/* 水玉の背景 */
.dots { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--soft) 2.5px, transparent 3px); background-size: 34px 34px; opacity: .7; }

/* ヘッダー */
.top { display: flex; align-items: center; gap: 10px; margin: 4px 2px 14px; }
.top .title { font-weight: 800; font-size: 20px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-btn { background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 700;
  box-shadow: 0 3px 0 var(--line); color: var(--ink-soft); }
.chip-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

/* カード */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { font-size: 17px; font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.card h2 .badge { margin-left: auto; }

/* だれがつかう？ */
.hello { text-align: center; padding: 18px 0 6px; }
.hello h1 { font-size: 30px; font-weight: 800; color: var(--deep); letter-spacing: .04em; }
.hello p { color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.hello .pig { width: 150px; margin: 0 auto -6px; animation: bob 3s ease-in-out infinite; }
.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.who { background: var(--card); border-radius: 26px; padding: 18px 10px 14px; text-align: center; box-shadow: 0 6px 0 var(--soft), 0 10px 20px rgba(90,74,82,.06); transition: transform .1s; }
.who:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--soft); }
.who .face { width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-size: 38px; background: var(--soft); }
.who .name { font-weight: 800; font-size: 20px; }
.who .sub { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.who.parent .face { font-size: 30px; }
.section-label { font-weight: 800; color: var(--ink-soft); font-size: 13px; margin: 22px 4px 0; letter-spacing: .08em; }

/* ぶたの貯金箱 */
.bank { text-align: center; position: relative; overflow: hidden; }
.bank .pig { width: 210px; margin: -4px auto -4px; display: block; }
.bank .pig.wiggle { animation: wiggle .7s ease; }
.bank .label { font-weight: 800; color: var(--ink-soft); font-size: 14px; }
.bank .amount { font-size: 44px; font-weight: 800; color: var(--deep); line-height: 1.1; }
.bank .amount small { font-size: 20px; margin-left: 2px; }
.goal { margin-top: 12px; background: var(--pale); border-radius: 18px; padding: 10px 14px; text-align: left; }
.goal .row { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.goal .row .edit { margin-left: auto; font-size: 12px; color: var(--ink-soft); text-decoration: underline; }
.bar { height: 14px; background: #fff; border-radius: 999px; margin-top: 8px; overflow: hidden; box-shadow: inset 0 0 0 2px var(--soft); }
.bar > i { display: block; height: 100%; background: repeating-linear-gradient(45deg, var(--main) 0 10px, var(--deep) 10px 20px); border-radius: 999px; transition: width .8s cubic-bezier(.3,1.4,.5,1); }
.goal .rest { font-size: 13px; margin-top: 6px; color: var(--ink-soft); font-weight: 700; }
.goal-empty { display: block; width: 100%; margin-top: 12px; padding: 12px; border: 2px dashed var(--main); border-radius: 18px; color: var(--deep); font-weight: 800; }

.stats { display: flex; gap: 10px; margin-top: 12px; }
.stat { flex: 1; background: var(--pale); border-radius: 16px; padding: 8px 6px; }
.stat b { display: block; font-size: 19px; white-space: nowrap; color: var(--deep); }
.stat span { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.streak b { color: #ff8a3d; }

/* お手伝いボタン */
.chores { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.chore { display: flex; align-items: flex-start; gap: 12px; background: var(--pale); border-radius: 20px; padding: 12px; }
.chore .ic { width: 56px; height: 56px; border-radius: 18px; background: #fff; display: grid; place-items: center; font-size: 32px; flex: none; box-shadow: 0 3px 0 var(--soft); }
.chore .body { flex: 1; min-width: 0; }
.chore .nm { font-weight: 800; font-size: 16px; }
.chore .yen { white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--deep); }
.chore .row2 { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.chore .info { flex: 1; min-width: 0; }
.chore .marks { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.mark { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.mark.wait { background: #fff4dc; color: #c88a12; }
.mark.ok { background: #dcf6e8; color: #2a9d65; }
.mark.wait button { font-size: 11px; color: #c88a12; text-decoration: underline; margin-left: 4px; font-weight: 800; }
.did { flex: none; background: var(--main); color: #fff; font-weight: 800; font-size: 17px; padding: 12px 16px; border-radius: 18px; box-shadow: 0 5px 0 var(--deep); transition: transform .08s; min-width: 96px; white-space: nowrap; }
.did:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--deep); }
.did:disabled { background: #eee3e7; color: var(--ink-soft); box-shadow: 0 5px 0 #e2d4d9; font-size: 13px; padding: 12px 10px; }
.kana .chore .nm { font-size: 18px; }
.kana .did { font-size: 19px; padding: 14px 16px; }

/* タブ */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255,255,255,.95); backdrop-filter: blur(8px);
  border-top: 2px solid var(--line); display: flex; justify-content: center; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tabs .in { display: flex; width: 100%; max-width: 560px; }
.tab { flex: 1; text-align: center; padding: 4px 0; font-size: 11px; font-weight: 800; color: var(--ink-soft); border-radius: 14px; }
.tab .e { font-size: 24px; display: block; line-height: 1.2; filter: grayscale(.6); opacity: .7; }
.tab.on { color: var(--deep); background: var(--pale); }
.tab.on .e { filter: none; opacity: 1; transform: scale(1.1); }
.tab .dot { display: inline-block; min-width: 18px; padding: 0 5px; height: 18px; border-radius: 9px; background: #ff6b6b; color: #fff; font-size: 11px; line-height: 18px; margin-left: 2px; }

/* カレンダー */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 18px; font-weight: 800; }
.cal-head button { width: 40px; height: 40px; border-radius: 50%; background: var(--pale); font-size: 18px; font-weight: 800; color: var(--deep); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .w { text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-soft); padding: 4px 0; }
.cal .w.sun { color: #f07e7e; } .cal .w.sat { color: #6ca3e8; }
.cal .d { aspect-ratio: 1; border-radius: 14px; background: var(--pale); position: relative; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.cal .d .n { position: absolute; top: 3px; left: 6px; }
.cal .d.today { box-shadow: inset 0 0 0 2px var(--main); }
.cal .d.blank { background: transparent; }
.cal .d .stamp { width: 66%; height: auto; margin-top: 8px; animation: pop .4s cubic-bezier(.3,1.6,.5,1) both; }
.cal .d .cnt { position: absolute; right: 2px; bottom: 1px; background: var(--deep); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 5px; font-weight: 800; }
.cal-sum { display: flex; gap: 10px; margin-top: 12px; }

/* 通帳 */
.book { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: auto; }
.book td:nth-child(2) { word-break: break-all; }
.book th { font-size: 12px; color: var(--ink-soft); text-align: left; font-weight: 800; padding: 6px 4px; border-bottom: 2px solid var(--line); }
.book td { padding: 9px 3px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.book td.r, .book th.r { text-align: right; white-space: nowrap; }
.book .in { color: #2a9d65; font-weight: 800; }
.book .out { color: #e0556d; font-weight: 800; }
.book .bal { font-weight: 800; }
.book .date { white-space: nowrap; color: var(--ink-soft); font-size: 12px; }
.book .x { color: var(--ink-soft); font-size: 12px; text-decoration: underline; }
.empty { text-align: center; color: var(--ink-soft); padding: 22px 10px; font-weight: 700; }
.empty .big { font-size: 40px; display: block; }

/* 記録の一覧 */
.hist-day { margin-bottom: 14px; }
.hist-day:last-child { margin-bottom: 0; }
.hist-head { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 10px; background: var(--pale); border-radius: 12px; margin-bottom: 4px; }
.hist-head b { font-size: 15px; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.hist-row:last-child { border-bottom: 0; }
.hist-row .ic { font-size: 24px; width: 32px; text-align: center; }
.hist-row .body { flex: 1; min-width: 0; }
.hist-row .amt { font-weight: 800; color: #2a9d65; white-space: nowrap; }
.hist-row.rejected { opacity: .55; }
.hist-row .mark { margin-left: 4px; }
.mark.ng { background: #f3e9ec; color: #b07a8a; }
.filter { display: flex; gap: 8px; margin-bottom: 14px; }
.filter button { flex: 1; padding: 10px 6px; border-radius: 999px; background: var(--card); font-weight: 800; box-shadow: 0 3px 0 var(--line); color: var(--ink-soft); }
.filter button.on { background: var(--main); color: #fff; box-shadow: 0 3px 0 var(--deep); }
.book.sum { margin-top: 10px; }
.book.sum tr.total td { border-top: 2px solid var(--line); border-bottom: 0; }

/* 子どもの一覧 */
.tally { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.tally .t { border-radius: 14px; padding: 8px 2px; text-align: center; background: var(--pale); }
.tally .t b { display: block; font-size: 24px; line-height: 1.2; }
.tally .t span { font-size: 11px; font-weight: 800; color: var(--ink-soft); line-height: 1.3; display: block; }
.tally .t-did b { color: var(--deep); }
.tally .t-ok { background: #e3f7ec; } .tally .t-ok b { color: #2a9d65; }
.tally .t-wait { background: #fff4dc; } .tally .t-wait b { color: #c88a12; }
.tally .t-ng { background: #f5eef0; } .tally .t-ng b { color: #b07a8a; }
.got { margin-top: 10px; font-weight: 700; font-size: 14px; }
.got b { font-size: 20px; color: #2a9d65; }
.book.sum .ok-c { color: #2a9d65; font-weight: 800; }
.book.sum .wait-c { color: #c88a12; font-weight: 800; }
.day-pick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.day-pick button { flex: none; background: var(--pale); border-radius: 14px; padding: 8px 12px; font-weight: 700; font-size: 14px; line-height: 1.3; }
.day-pick button b { display: block; font-size: 12px; color: var(--deep); }
.day-pick button.on { background: var(--main); color: #fff; }
.day-pick button.on b { color: #fff; }
.chore-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chore-pick button { background: var(--pale); border-radius: 16px; padding: 10px 6px; font-weight: 800; font-size: 14px; }
.chore-pick button .e { display: block; font-size: 28px; }
.chore-pick button.on { background: var(--main); color: #fff; box-shadow: 0 4px 0 var(--deep); }
.btn:disabled { cursor: default; }

/* 親の画面 */
.pin { text-align: center; }
.pin .dots4 { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin .dots4 i { width: 18px; height: 18px; border-radius: 50%; background: var(--line); transition: .15s; }
.pin .dots4 i.on { background: var(--deep); transform: scale(1.15); }
.pin .pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.pin .pad button { height: 64px; border-radius: 22px; background: var(--card); font-size: 26px; font-weight: 800; box-shadow: 0 4px 0 var(--line); }
.pin .pad button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.pin .who-pick { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.pin .who-pick button { padding: 10px 22px; border-radius: 999px; background: var(--card); font-weight: 800; box-shadow: 0 3px 0 var(--line); }
.pin .who-pick button.on { background: var(--main); color: #fff; box-shadow: 0 3px 0 var(--deep); }
.shake { animation: shake .4s; }

.pending-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pending-row:last-child { border-bottom: 0; }
.pending-row .ic { font-size: 28px; }
.pending-row .body { flex: 1; min-width: 0; }
.pending-row .body b { display: block; }
.who-tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--deep); margin-right: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 10px 16px; border-radius: 16px; font-weight: 800; background: var(--main); color: #fff; box-shadow: 0 4px 0 var(--deep); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep); }
.btn.sub { background: var(--pale); color: var(--deep); box-shadow: 0 4px 0 var(--soft); }
.btn.ok { background: var(--ok); box-shadow: 0 4px 0 #2a9d65; }
.btn.no { background: #f3e9ec; color: #b07a8a; box-shadow: 0 4px 0 #e5d3d9; padding: 10px 12px; }
.btn.wide { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-row .btn { flex: 1 1 auto; font-size: 14px; padding: 10px 10px; }

.kid-card .head { display: flex; align-items: center; gap: 10px; }
.kid-card .face { width: 48px; height: 48px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 26px; }
.kid-card .head b { font-size: 18px; }
.kid-card .bal { margin-left: auto; text-align: right; }
.kid-card .bal b { font-size: 26px; color: var(--deep); display: block; line-height: 1.1; }
.kid-card .bal span { font-size: 11px; color: var(--ink-soft); font-weight: 700; }

.close-card { background: linear-gradient(135deg, #fff8e6, #fff0f5); border: 2px solid #ffe2a8; }
.close-card .kid { margin-bottom: 8px; }
.close-card ul { margin: 6px 0 0; padding-left: 0; list-style: none; font-size: 14px; }
.close-card li { display: flex; justify-content: space-between; padding: 2px 0; }

.edit-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.edit-table td { padding: 4px 2px; }
.edit-table input[type=text], .edit-table input[type=number] { width: 100%; font-size: 16px; padding: 8px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.edit-table .ic input { width: 48px; text-align: center; font-size: 20px; padding: 4px; }
.edit-table .n input { width: 72px; }
.edit-table .l input { width: 52px; }
.edit-item { background: var(--pale); border-radius: 16px; padding: 8px; margin-bottom: 8px; }
.edit-item.off { opacity: .5; }

/* モーダル */
.modal-bg { position: fixed; inset: 0; background: rgba(90, 74, 82, .35); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 28px 28px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .25s cubic-bezier(.3,1.3,.5,1); max-height: 90vh; overflow: auto; }
.modal h3 { font-size: 19px; font-weight: 800; margin-bottom: 12px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; font-weight: 800; color: var(--ink-soft); margin-bottom: 4px; }
.field input, .field select { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 16px; font-size: 18px; background: #fff; }
.field input:focus, .field select:focus { outline: none; border-color: var(--main); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.quick button { background: var(--pale); color: var(--deep); font-weight: 800; padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 46px; height: 46px; border-radius: 50%; background: var(--main); box-shadow: 0 4px 0 var(--deep); }
.colors button.on { outline: 4px solid var(--ink); outline-offset: 3px; }

/* トースト */
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; z-index: 80; pointer-events: none; transition: .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* お祝い */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }
.party { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; background: rgba(255,247,249,.93); animation: fade .2s; }
.party .box { text-align: center; animation: pop .5s cubic-bezier(.3,1.6,.5,1); }
.party .pig { width: 170px; margin: 0 auto; animation: bob 1.2s ease-in-out infinite; }
.party .plus { font-size: 54px; font-weight: 800; color: var(--deep); text-shadow: 0 4px 0 #fff, 0 6px 0 var(--soft); }
.party .msg { font-size: 22px; font-weight: 800; }
.party .sub { font-size: 14px; color: var(--ink-soft); font-weight: 700; margin-top: 4px; }
.coin { position: absolute; font-size: 28px; animation: coin 1s ease-in forwards; }

@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
@keyframes wiggle { 0%,100% { transform: rotate(0) } 20% { transform: rotate(-6deg) } 40% { transform: rotate(5deg) } 60% { transform: rotate(-3deg) } 80% { transform: rotate(2deg) } }
@keyframes pop { from { transform: scale(.3); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(100%) } }
@keyframes shake { 20%,60% { transform: translateX(-8px) } 40%,80% { transform: translateX(8px) } }
@keyframes coin { 0% { transform: translateY(-40px) scale(.6); opacity: 0 } 20% { opacity: 1 } 100% { transform: translateY(120px) scale(1); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
