/* 퀘스트 코인 — 아이는 게임처럼, 부모는 깔끔하게 */
:root {
  --bg: #fff8ec;
  --paper: #ffffff;
  --ink: #2b2748;
  --muted: #8b87a3;
  --line: #ece6f5;
  --pri: #7c5cff;
  --pri-d: #5a3ee0;
  --pri-soft: #f0ebff;
  --gold: #ffc531;
  --gold-d: #c98a00;
  --gold-soft: #fff6d8;
  --hot: #ff4d4f;
  --hot-d: #d62f33;
  --hot-soft: #fff0ef;
  --ok: #14a88f;
  --ok-soft: #e4f7f3;
  --warn: #f08c00;
  --radius: 18px;
  --shadow: 0 2px 0 rgba(43, 39, 72, .06), 0 6px 18px rgba(43, 39, 72, .06);
  --font-head: 'Jua', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-body: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --tabbar-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--font-body);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
body[data-mode='parent'] { --bg: #f6f5fb; }
body.no-scroll, body.popup-on { overflow: hidden; }
body.busy { cursor: progress; }
body.busy .btn, body.busy [data-act] { pointer-events: none; }
h1, h2, h3, b, .btn, .tabbar button, .seg button, legend { font-family: var(--font-head); font-weight: 400; }
h1, h2, h3 { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
small { font-size: 13px; color: var(--muted); }
code { font-family: ui-monospace, monospace; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 4px 4px 0; margin: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0; }
[hidden] { display: none !important; }

/* ---------- 코인 ---------- */
.coin-ic {
  display: inline-block; width: 1.05em; height: 1.05em; border-radius: 50%; vertical-align: -0.16em; position: relative; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff3b0 0 18%, var(--gold) 45%, #f2a900 100%);
  box-shadow: inset 0 0 0 .09em #e59b00, inset 0 0 0 .17em #ffd95a;
}
.coin-ic::after { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; font-size: .55em; color: #c98100; font-style: normal; line-height: 1; }
.coin-ic.big { font-size: 1.4em; }
.coin-ic.huge { font-size: 2.6em; }
.coin-ic.spin { animation: spin 3s ease-in-out infinite; }
@keyframes spin { 0%, 60% { transform: rotateY(0) } 80% { transform: rotateY(180deg) } 100% { transform: rotateY(360deg) } }
.coin-amt { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-head); color: var(--gold-d); white-space: nowrap; }
.coin-amt.sm { font-size: 14px; }
.coin-amt.lg { font-size: 22px; }
.coin-amt.xl { font-size: 34px; }

/* ---------- 버튼 ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 10px 16px; background: var(--pri-soft); color: var(--pri-d);
  font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .08s, filter .15s; touch-action: manipulation;
}
.btn:active { transform: translateY(2px) scale(.98); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--pri); color: #fff; box-shadow: 0 4px 0 var(--pri-d); }
.btn.primary:active { box-shadow: 0 2px 0 var(--pri-d); }
.btn.go { background: var(--ok); color: #fff; box-shadow: 0 4px 0 #0c8571; padding: 8px 14px; }
.btn.go:active { box-shadow: 0 2px 0 #0c8571; }
.btn.hot { background: var(--hot); color: #fff; box-shadow: 0 4px 0 var(--hot-d); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { color: var(--hot); }
.btn.ghost.danger { color: var(--hot); }
.btn.big { width: 100%; padding: 14px 18px; font-size: 18px; }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.glow { animation: glow 1.4s ease-in-out infinite; background: linear-gradient(90deg, #ffb800, #ff7a00); box-shadow: 0 4px 0 #c45c00; }
@keyframes glow { 50% { filter: brightness(1.15); transform: scale(1.04); } }
.link { background: none; border: 0; padding: 4px; color: var(--pri-d); font-size: 13px; text-decoration: underline; }
.link.danger { color: var(--hot); }
.icon-btn { border: 0; background: var(--line); width: 38px; height: 38px; border-radius: 12px; font-size: 18px; flex: none; }
.icon-btn.yes { background: var(--ok); color: #fff; }
.icon-btn.no { background: var(--hot-soft); color: var(--hot); }
.chip { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 12px; font-size: 14px; }

/* ---------- 시작 화면 ---------- */
.gate { max-width: 440px; margin: 0 auto; padding: 56px 20px 40px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.gate h1 { font-size: 34px; color: var(--pri-d); }
.gate-logo { font-size: 32px; perspective: 400px; }
.gate-sub { color: var(--muted); margin: 0; font-size: 17px; }
.gate-actions { display: grid; gap: 10px; width: 100%; margin-top: 12px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; width: 100%; margin: 10px 0; }
.who-grid.sm { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.who-card {
  border: 0; background: var(--paper); border-radius: 22px; padding: 18px 8px 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 8px; border-bottom: 4px solid var(--kc, var(--line));
}
.who-card b { font-size: 20px; }
.who-card.parent { --kc: #b8b3cc; }

/* ---------- 아바타 ---------- */
.avatar {
  --kc: #b8b3cc; display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: color-mix(in srgb, var(--kc) 22%, white); box-shadow: 0 0 0 2.5px var(--kc); font-size: 20px; line-height: 1;
}
.avatar.sm { width: 26px; height: 26px; font-size: 14px; box-shadow: 0 0 0 2px var(--kc); }
.avatar.lg { width: 46px; height: 46px; font-size: 26px; }
.avatar.xl { width: 76px; height: 76px; font-size: 44px; box-shadow: 0 0 0 4px var(--kc); }

/* ---------- 공통 레이아웃 ---------- */
.page { max-width: 600px; margin: 0 auto; padding: 14px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button { flex: 1; max-width: 120px; border: 0; background: none; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: var(--muted); }
.tabbar button.on { color: var(--pri-d); }
.tab-ic { font-size: 22px; position: relative; filter: grayscale(.8); opacity: .7; transition: transform .15s; }
.tabbar button.on .tab-ic { filter: none; opacity: 1; transform: translateY(-2px) scale(1.12); }
.badge { position: absolute; top: -4px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hot); color: #fff; font: 12px/18px var(--font-head); font-style: normal; filter: none; }
.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty-ic { font-size: 46px; }
.empty p { margin: 6px 0 2px; font-family: var(--font-head); font-size: 18px; color: var(--ink); }
.sec-title { font-size: 22px; margin: 4px 2px 12px; }
.seg { display: flex; gap: 4px; background: #ece8f6; border-radius: 14px; padding: 4px; margin: 0 0 14px; }
.seg button, .seg label { flex: 1; border: 0; background: none; border-radius: 10px; padding: 8px 4px; font-size: 15px; color: var(--muted); text-align: center; }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.seg.small { margin: 0; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap label { flex: 1 0 28%; }
.seg label { position: relative; padding: 0; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { display: block; padding: 8px 4px; border-radius: 10px; font-family: var(--font-head); }
.seg label input:checked + span { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.seg label input:focus-visible + span { outline: 2px solid var(--pri); }
.bar { height: 12px; border-radius: 6px; background: #ece8f6; overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--pri), #b06bff); transition: width .5s; }
.bar.full i { background: linear-gradient(90deg, #ffb800, #ff7a00); }

/* ---------- 아이: 헤더 ---------- */
.kid-head {
  --kc: var(--pri);
  background: linear-gradient(135deg, var(--kc), color-mix(in srgb, var(--kc) 55%, #ff7aa8));
  color: #fff; padding: calc(14px + env(safe-area-inset-top)) 16px 26px; border-radius: 0 0 28px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 10;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--kc) 35%, transparent);
}
.who-btn { border: 0; background: none; display: flex; align-items: center; gap: 10px; padding: 0; text-align: left; color: inherit; }
.who-btn small { display: block; color: inherit; opacity: .8; font-size: 12px; }
.who-btn b { font-size: 21px; }
.kid-head .avatar { box-shadow: 0 0 0 3px #fff; background: rgba(255, 255, 255, .9); }
.wallet-pill {
  background: rgba(255, 255, 255, .95); color: var(--gold-d); border-radius: 999px; padding: 6px 16px 6px 8px;
  display: flex; align-items: center; gap: 6px; font: 24px var(--font-head); box-shadow: 0 4px 0 rgba(0, 0, 0, .12); cursor: pointer;
}
.wallet-pill.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.15); } }
.kid-page { margin-top: -12px; position: relative; }

/* ---------- 아이: 미션 ---------- */
.today-head { display: flex; align-items: center; justify-content: space-between; background: var(--paper); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.today-head h2 { font-size: 22px; }
.ring { --p: 0; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ok) calc(var(--p) * 1%), #ece8f6 0); }
.ring b { width: 46px; height: 46px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-size: 16px; }
.mission-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mission { display: flex; align-items: center; gap: 12px; background: var(--paper); border-radius: var(--radius); padding: 12px 12px 12px 14px; box-shadow: var(--shadow); border-left: 5px solid var(--pri); }
.mission.pending { border-left-color: var(--warn); }
.mission.approved { border-left-color: var(--ok); opacity: .72; }
.mission.approved b { text-decoration: line-through; text-decoration-color: var(--ok); }
.mission.rejected { border-left-color: var(--hot); }
.m-emoji { font-size: 32px; width: 44px; text-align: center; flex: none; }
.m-emoji.sm { font-size: 24px; width: 32px; }
.m-body { flex: 1; min-width: 0; }
.m-body b { font-size: 18px; display: block; }
.m-memo { margin: 4px 0 0; font-size: 14px; color: #5d5878; }
.m-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.st { font: 14px var(--font-head); border-radius: 10px; padding: 6px 10px; border: 0; white-space: nowrap; }
.st.done { color: var(--ok); background: var(--ok-soft); }
.st.wait { color: var(--warn); background: #fff3e0; }
.st.no { color: var(--muted); background: #f1eff6; }
.warn { color: var(--hot); font-style: normal; }
.cheer { text-align: center; font-family: var(--font-head); font-size: 20px; color: var(--ok); }
.later { background: var(--paper); border-radius: var(--radius); margin-top: 14px; padding: 4px 14px; box-shadow: var(--shadow); }
.later summary { padding: 10px 0; font-family: var(--font-head); cursor: pointer; }
.later ul { list-style: none; margin: 0 0 10px; padding: 0; }
.later li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.later li span { flex: 1; }

/* ---------- 아이: 돌발 미션 ---------- */
.surprise-zone { margin-bottom: 16px; }
.zone-title { font-size: 20px; color: var(--hot-d); margin: 4px 2px 8px; display: flex; align-items: center; gap: 6px; }
.siren { display: inline-block; animation: wobble .8s ease-in-out infinite; }
@keyframes wobble { 25% { transform: rotate(-14deg) scale(1.1); } 75% { transform: rotate(14deg) scale(1.1); } }
.surprise {
  position: relative; border-radius: var(--radius); padding: 14px; margin-bottom: 10px; color: var(--ink);
  background: var(--paper); box-shadow: 0 0 0 3px var(--hot), var(--shadow);
}
.surprise::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px; border-radius: var(--radius) var(--radius) 0 0;
  background: repeating-linear-gradient(-45deg, #ffcc00 0 10px, #2b2748 10px 20px);
}
.surprise.todo, .surprise.rejected { animation: pulse-red 1.6s ease-in-out infinite; }
@keyframes pulse-red { 50% { box-shadow: 0 0 0 3px var(--hot), 0 0 22px rgba(255, 77, 79, .55); } }
.surprise.approved { box-shadow: 0 0 0 3px var(--ok), var(--shadow); }
.surprise.approved::before { background: var(--ok); }
.s-top { display: flex; gap: 12px; margin-top: 6px; }
.s-emoji { font-size: 40px; }
.s-top b { font-size: 20px; display: block; }
.s-top p { margin: 2px 0; font-size: 14px; }
.s-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.timer { font-family: ui-monospace, monospace; font-weight: 700; color: var(--hot-d); }
.timer.urgent { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* 돌발 미션 팝업 */
.popup-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(20, 10, 30, .72); animation: fade-in .2s; }
.popup-flash { position: absolute; inset: 0; pointer-events: none; animation: flash 1s ease-in-out 3; }
@keyframes flash { 50% { background: rgba(255, 50, 50, .35); } }
.popup {
  position: relative; width: min(360px, 100%); background: var(--paper); border-radius: 26px; padding: 22px 20px 16px; text-align: center;
  box-shadow: 0 0 0 5px var(--hot), 0 20px 60px rgba(0, 0, 0, .4); animation: shake .55s .15s both;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.popup::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px; border-radius: 26px 26px 0 0; background: repeating-linear-gradient(-45deg, #ffcc00 0 12px, #2b2748 12px 24px); }
@keyframes shake { 0% { transform: scale(.4) rotate(-8deg); opacity: 0; } 40% { transform: scale(1.08) rotate(4deg); opacity: 1; } 55% { transform: rotate(-4deg); } 70% { transform: rotate(3deg); } 85% { transform: rotate(-2deg); } 100% { transform: none; } }
.popup-alarm { margin-top: 10px; font: 20px var(--font-head); color: var(--hot); animation: blink 0.8s steps(2) infinite; }
.popup-emoji { font-size: 64px; animation: wobble 1.2s ease-in-out infinite; }
.popup h2 { font-size: 26px; }
.popup p { margin: 0; color: #5d5878; }
.popup-reward { font: 18px var(--font-head); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.popup-meta { font-size: 15px; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- 아이: 퀘스트 ---------- */
.quest-list { display: grid; gap: 12px; }
.quest { background: var(--paper); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 2px solid transparent; position: relative; overflow: hidden; }
.quest.ready { border-color: #ffb800; background: linear-gradient(180deg, #fffaf0, #fff); }
.quest.claimed { opacity: .8; }
.q-head { display: flex; align-items: center; gap: 10px; }
.q-head > div { flex: 1; min-width: 0; }
.q-head b { font-size: 19px; display: block; }
.q-emoji { font-size: 36px; }
.quest.ready .q-emoji { animation: wobble 1.2s ease-in-out infinite; }
.q-prog { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; }
.q-prog span { font: 15px var(--font-head); min-width: 52px; text-align: right; }
.q-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.q-left { margin: 0; font-size: 16px; }
.q-left b { font: 22px var(--font-head); color: var(--pri-d); }
.dday { font: 15px var(--font-head); color: var(--hot-d); background: var(--hot-soft); border-radius: 8px; padding: 2px 8px; }
.stamp { margin-left: auto; font: 22px var(--font-head); color: var(--hot); border: 3px solid var(--hot); border-radius: 10px; padding: 0 10px; transform: rotate(-8deg); letter-spacing: 2px; }

/* ---------- 아이: 상점 ---------- */
.cat-title { font-size: 17px; margin: 14px 2px 8px; }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gift {
  border: 0; background: var(--paper); border-radius: var(--radius); padding: 14px 10px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; text-align: center;
}
.gift b { font-size: 16px; }
.g-emoji { font-size: 44px; line-height: 1.1; }
.g-emoji.xl { font-size: 72px; }
.gift.lack { opacity: .6; }
.gift.soldout { opacity: .45; filter: grayscale(1); }
.gift .tag { position: absolute; top: 8px; right: 8px; font: 11px var(--font-head); font-style: normal; background: var(--hot-soft); color: var(--hot-d); border-radius: 6px; padding: 1px 6px; }
.gift small { font-size: 12px; }
.panel { background: var(--paper); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.panel .lead { margin: 0 0 12px; text-align: center; color: #5d5878; }
.rate { text-align: center; margin: 0 0 10px; font-size: 17px; }
.stepper { display: flex; gap: 8px; margin-top: 4px; }
.stepper button { width: 48px; border: 0; border-radius: 12px; background: var(--pri-soft); color: var(--pri-d); font-size: 24px; }
.stepper input { flex: 1; text-align: center; font: 26px var(--font-head); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.won-out { text-align: center; margin: 4px 0; font-size: 17px; }
.won-out b { font-size: 26px; color: var(--ok); }
.buy-preview { text-align: center; }
.buy-preview h3 { font-size: 24px; }
.buy-preview p { color: #5d5878; }
.calc { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }

/* ---------- 아이: 지갑 ---------- */
.wallet-card { text-align: center; background: linear-gradient(135deg, #ffe58a, #ffc531); border-radius: 22px; padding: 18px; margin-bottom: 14px; box-shadow: 0 6px 0 #e5a800; }
.wallet-card small { color: #7a5600; }
.big-bal { font: 46px var(--font-head); color: #6b4a00; display: flex; align-items: center; justify-content: center; gap: 10px; }
.big-bal .coin-ic { font-size: 44px; }
.coupons { display: grid; gap: 10px; }
.coupon { display: flex; background: var(--paper); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.c-left { width: 72px; display: grid; place-items: center; font-size: 34px; background: var(--pri-soft); border-right: 2px dashed var(--line); flex: none; }
.coupon.cash .c-left { background: var(--ok-soft); }
.coupon.proxy .c-left { background: var(--gold-soft); }
.coupon.no { opacity: .6; }
.c-main { flex: 1; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.c-main b { font-size: 17px; }
.c-main .note { color: var(--pri-d); }
.c-right { padding: 10px 12px 10px 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.barcode { width: 64px; height: 22px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px); opacity: .8; }
.history { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.history li { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.history li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history b { font-size: 17px; }
.plus { color: var(--ok); }
.minus { color: var(--hot); }

/* ---------- 부모 ---------- */
.parent-head {
  background: var(--paper); padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.parent-head .who-btn small { color: var(--muted); }
.demo-tag { font: 13px var(--font-head); background: var(--gold-soft); color: var(--gold-d); border-radius: 8px; padding: 4px 10px; }
.p-sec { margin-bottom: 20px; }
.p-sec > h2 { font-size: 19px; display: flex; align-items: center; gap: 8px; margin: 6px 2px 10px; }
.p-sec > h2 .btn { margin-left: auto; }
.count { font: 14px var(--font-head); background: var(--pri-soft); color: var(--pri-d); border-radius: 8px; padding: 1px 8px; }
.p-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.p-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.p-list .p-row:first-child { border-top: 0; }
button.p-row { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); border: 0; }
.p-row.tap, .p-row .tap { cursor: pointer; }
.p-row.off { opacity: .5; }
.p-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-row .grow b { font-size: 16px; }
.p-row .col { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.p-row.req { align-items: flex-start; }
.code { background: var(--pri-soft); color: var(--pri-d); border-radius: 6px; padding: 1px 6px; letter-spacing: .12em; }
.kid-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kid-stat { border: 0; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; border-top: 4px solid var(--kc); }
.kid-stat .bar { width: 100%; flex: none; height: 8px; }
.kid-stat .bar i { background: var(--kc); }
.surprise-launch {
  width: 100%; border: 0; border-radius: 20px; padding: 16px; margin-bottom: 18px; color: #fff; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; text-align: left;
  background: linear-gradient(135deg, #ff4d4f, #ff7a00); box-shadow: 0 5px 0 #c2272a;
}
.surprise-launch .siren { font-size: 36px; grid-row: span 2; }
.surprise-launch b { font-size: 22px; }
.surprise-launch small { color: rgba(255, 255, 255, .85); }
.quick-launch {
  width: 100%; border: 0; border-radius: 20px; padding: 14px 16px; margin: -6px 0 18px; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; text-align: left;
  background: var(--paper); box-shadow: var(--shadow); border-left: 5px solid var(--ok);
}
.quick-launch span { font-size: 30px; grid-row: span 2; }
.quick-launch b { font-size: 18px; }
.quick-btn { margin-top: 12px; background: var(--ok-soft); color: #0c7463; }
.surprise-row { border-left: 4px solid var(--hot) !important; }
.p-quests { display: grid; gap: 10px; }
.p-quest { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; cursor: pointer; display: grid; gap: 8px; }
.p-quest.off { opacity: .5; }
.p-quest .q-emoji { font-size: 28px; }
.p-quest .q-head b { font-size: 17px; }
.q-kid { display: flex; align-items: center; gap: 8px; }
.q-kid > span:last-child { font: 14px var(--font-head); min-width: 56px; text-align: right; }

/* ---------- 시트 / 폼 ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#sheet-root.open { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: rgba(30, 20, 50, .4); animation: fade-in .15s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto; background: var(--bg);
  border-radius: 24px 24px 0 0; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); animation: up .22s ease-out;
  max-width: 560px; margin: 0 auto;
}
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.sheet.hot { box-shadow: 0 -4px 0 var(--hot); }
.sheet-head { position: sticky; top: 0; background: var(--bg); display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; z-index: 1; }
.sheet-head h2 { font-size: 21px; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; font-family: var(--font-head); font-size: 15px; }
.form label small { font-family: var(--font-body); }
.form input[type=text], .form input[type=number], .form input[type=password], .form input[type=date], .form textarea, .dlg-input {
  width: 100%; border: 2px solid var(--line); background: var(--paper); border-radius: 12px; padding: 11px 12px; font-size: 16px; font-family: var(--font-body);
}
.form input:focus, .form textarea:focus, .dlg-input:focus { outline: 0; border-color: var(--pri); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
legend { font-size: 15px; padding: 0; margin-bottom: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 10px; }
.form-actions .btn.big { flex: 1; }
.emoji-pick, .kid-pick, .days, .color-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick label, .kid-pick label, .days label, .color-pick label { position: relative; display: block; }
.emoji-pick input, .kid-pick input, .days input, .color-pick input { position: absolute; opacity: 0; pointer-events: none; }
.emoji-pick span { display: grid; place-items: center; width: 42px; height: 42px; font-size: 24px; border-radius: 12px; background: var(--paper); border: 2px solid var(--line); }
.kid-pick span, .days span { display: block; padding: 7px 12px; border-radius: 999px; background: var(--paper); border: 2px solid var(--line); font-family: var(--font-body); font-size: 15px; }
.days span { width: 42px; text-align: center; padding: 7px 0; }
.color-pick span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.emoji-pick input:checked + span, .kid-pick input:checked + span, .days input:checked + span { border-color: var(--pri); background: var(--pri-soft); }
.color-pick input:checked + span { box-shadow: 0 0 0 3px var(--ink); }
.emoji-pick input:focus-visible + span, .kid-pick input:focus-visible + span, .days input:focus-visible + span, .color-pick input:focus-visible + span { outline: 2px solid var(--pri); outline-offset: 2px; }
.switch { display: flex !important; align-items: center; gap: 10px; cursor: pointer; font-family: var(--font-body) !important; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #d9d4e8; position: relative; flex: none; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
#dialog-root { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; padding: 20px; }
#dialog-root.open { display: grid; }
.backdrop.dim { background: rgba(30, 20, 50, .5); }
.dialog { position: relative; background: var(--paper); border-radius: 22px; padding: 20px; width: min(360px, 100%); display: grid; gap: 10px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.dialog h3 { font-size: 20px; }
.dialog p { margin: 0; color: #5d5878; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 80;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 15px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; width: max-content; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--hot-d); }
#toast.ok { background: #1f7a6b; }

/* ---------- 효과 ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.fx-coin { position: absolute; top: -40px; font-size: 30px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.fx-gain { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; animation: gain 2.2s ease-out forwards; }
.fx-gain .coin-ic { font-size: 70px; }
.fx-gain b { font: 54px var(--font-head); color: var(--gold-d); text-shadow: 0 3px 0 #fff, 0 0 20px #fff; }
.fx-gain span { font: 22px var(--font-head); color: var(--ink); background: #fff; border-radius: 12px; padding: 2px 12px; }
@keyframes gain { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }
.fx-conf { position: absolute; top: 40%; width: 10px; height: 14px; border-radius: 2px; animation: conf 2s ease-out forwards; }
@keyframes conf { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 70vh) rotate(var(--rot)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 24px; animation: fade-in .15s; }
}

/* ---------- 용돈 한도 · 보내기 · 같이 모으기 ---------- */
.limit-box { background: #f6f3ff; border-radius: 14px; padding: 10px 12px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.limit-box .bar { flex: none; }
.limit-box small { color: var(--muted); }
.limit-row { display: flex; justify-content: space-between; align-items: center; }
.limit-row b { font-size: 18px; color: var(--pri); }
.limit-done { text-align: center; font-family: var(--font-head); font-size: 20px; margin: 6px 0; }
.center-row { justify-content: center; }
.full-w { width: 100%; }
.send-btn { margin-top: 10px; background: #fff8dc; color: #7a5600; box-shadow: 0 3px 0 #e5a800; }
.goal-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.goal { background: var(--paper); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.goal.full { outline: 3px solid #ffc531; }
.goal.done, .goal.canceled { opacity: .6; }
.goal-head { display: flex; align-items: center; gap: 10px; }
.goal-head .g-emoji { font-size: 34px; }
.goal-head .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.goal-head small { color: var(--muted); }
.goal-pct { font-family: var(--font-head); font-size: 20px; color: var(--pri); }
.goal .q-prog { display: flex; align-items: center; gap: 8px; }
.goal .q-prog span { font-size: 14px; white-space: nowrap; }
.goal-parts { display: flex; flex-wrap: wrap; gap: 6px; }
.goal-part { border-radius: 999px; padding: 3px 10px; font-size: 13px; background: color-mix(in srgb, var(--kc) 22%, white); }
.goal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }

.warn-box { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--hot-soft); color: var(--hot-d); font-size: 14px; line-height: 1.5; }
.warn-box b { font-family: ui-monospace, monospace; font-weight: 700; }

/* ---------- 알림 ---------- */
.head-right { display: flex; align-items: center; gap: 8px; }
.bell { border: 0; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .25); font-size: 20px; display: grid; place-items: center; }
.bell.on { background: rgba(255, 255, 255, .9); }
.push-banner {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; margin-bottom: 14px;
  background: var(--paper); border-radius: var(--radius); padding: 12px 10px 12px 14px; box-shadow: var(--shadow); border: 2px solid var(--pri-soft);
}
.push-banner .pb-ic { font-size: 26px; animation: wobble 1.6s ease-in-out infinite; display: inline-block; }
.push-banner b { display: block; font-size: 16px; }
.push-banner small { display: block; line-height: 1.35; }
.icon-btn.sm { width: 30px; height: 30px; font-size: 14px; border-radius: 10px; }
.p-row .switch { flex: none; }

/* ---------- 인증 사진 ---------- */
.go-row { display: flex; align-items: center; gap: 6px; }
.cam-btn { border: 0; width: 38px; height: 38px; border-radius: 12px; background: var(--ok-soft); font-size: 18px; flex: none; }
.thumb { border: 0; padding: 0; width: 46px; height: 46px; border-radius: 10px; overflow: hidden; background: var(--line); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.gone { display: none; }
.thumb.wide { width: 120px; height: 90px; margin-top: 6px; border-radius: 12px; }
.photo-big { display: grid; place-items: center; }
.photo-big img { max-width: 100%; max-height: 72vh; border-radius: 16px; }
.ps-head { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
.ps-head > div { flex: 1; min-width: 0; }
.ps-head b { display: block; font-size: 17px; }
.photo-pick { position: relative; display: grid !important; place-items: center; min-height: 220px; border: 3px dashed var(--line); border-radius: 18px; background: var(--paper); cursor: pointer; overflow: hidden; }
.ps-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 44px; text-align: center; }
.ps-empty b { font-size: 18px; }
.ps-preview { width: 100%; max-height: 50vh; object-fit: contain; display: block; }

.dialog p { white-space: pre-line; max-height: 60vh; overflow: auto; }

/* ---------- 쿠폰함 ---------- */
.cp-title { font-size: 17px; margin: 14px 2px 8px; display: flex; align-items: center; gap: 6px; }
.coupon.ready { border: 2px solid var(--ok); }
.coupon.ready .c-left { background: var(--ok-soft); }
.coupon.ready .barcode { margin-top: 4px; }
.coupon.past { opacity: .7; }
.used-stamp { display: inline-block; margin-top: 2px; transform: rotate(-8deg); font: 16px var(--font-head); color: var(--hot); border: 2.5px solid var(--hot); border-radius: 8px; padding: 1px 8px; opacity: .6; pointer-events: none; white-space: nowrap; }
.later.past .coupons { margin-bottom: 10px; }
.st.ready { color: var(--ok); background: var(--ok-soft); }
