:root {
  --bg: #F2F8FF;
  --card: #FFFFFF;
  --sky: #4DB6F0;
  --sky-soft: #E3F3FE;
  --sky-line: #CFE6FA;
  --blue: #2563D9;
  --blue-dark: #1A4FB5;
  --ink: #14325A;
  --ink-soft: #3D6A99;
  --warn-bg: #FFF6D6;
  --warn-ink: #6B4A00;
  --danger-bg: #FDE7E7;
  --danger-ink: #9B1C1C;
  --radius: 20px;
  --font-title: 'Jua', 'Gowun Dodum', sans-serif;
  --font-body: 'NanumSquareRound', 'Gowun Dodum', 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 20px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}
#app { max-width: 520px; margin: 0 auto; padding: 16px 16px 48px; }
h1, h2, h3, .title { font-family: var(--font-title); font-weight: 400; margin: 0; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.15rem; }
a { color: var(--blue); }
button { font: inherit; color: inherit; cursor: pointer; }
.ti { line-height: 1; }

.hdr { display: flex; align-items: center; gap: 8px; min-height: 56px; margin-bottom: 8px; }
.hdr .back { width: 56px; height: 56px; border: none; background: none; font-size: 1.4rem; border-radius: 16px; margin-left: -12px; }
.hdr .back:active { background: var(--sky-soft); }

.big {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 68px; margin-top: 12px; padding: 0 20px;
  border-radius: 20px; border: 2px solid var(--sky-line); background: var(--card);
  font-family: var(--font-title); font-size: 1.1rem; text-align: left;
}
.big .ti { font-size: 1.4rem; color: #2E9BE0; }
.big.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.big.primary .ti { color: #fff; }
.big.center { justify-content: center; }
.big:active { transform: scale(0.98); }
.big.primary:active { background: var(--blue-dark); }
.big.ghost { background: transparent; border-color: transparent; color: var(--blue); min-height: 56px; font-size: 1rem; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px 18px; margin-top: 12px; border: 1px solid #DCEBFA; }
.card .label { font-size: 0.8rem; color: var(--ink-soft); }
.card .num { font-size: 1.1rem; font-weight: 800; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin-top: 0; }

.hero {
  background: linear-gradient(135deg, #7FD3FA, var(--blue));
  border-radius: 24px; padding: 18px 20px; color: #fff; margin-bottom: 12px;
}
.hero .row { display: flex; justify-content: space-between; align-items: center; }
.hero .dday { background: #fff; color: var(--blue); border-radius: 999px; padding: 4px 14px; font-family: var(--font-title); }
.hero .what { font-family: var(--font-title); font-size: 1.2rem; margin-top: 2px; }
.hero .go { display: block; width: 100%; margin-top: 12px; min-height: 56px; border: none; border-radius: 16px; background: #fff; color: var(--ink); font-family: var(--font-title); font-size: 1rem; }

.warn { display: flex; gap: 10px; align-items: flex-start; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; font-size: 0.85rem; border: none; width: 100%; text-align: left; }
.warn.urgent { background: var(--danger-bg); color: var(--danger-ink); }
.warn.caution { background: var(--warn-bg); color: var(--warn-ink); }
.warn.info { background: var(--sky-soft); color: var(--ink); }

.field { margin-top: 18px; }
.field > .label { display: block; font-family: var(--font-title); font-size: 1rem; margin-bottom: 8px; }
.money {
  width: 100%; min-height: 68px; padding: 0 18px;
  border-radius: 18px; border: 2px solid var(--sky-line); background: var(--card);
  font-family: var(--font-body); font-size: 1.4rem; font-weight: 800; color: var(--blue);
}
.money:focus, .text:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px var(--sky-soft); }
.text { width: 100%; min-height: 64px; padding: 0 16px; border-radius: 18px; border: 2px solid var(--sky-line); background: var(--card); font: inherit; color: var(--ink); }
.error { color: var(--danger-ink); font-size: 0.85rem; margin-top: 6px; min-height: 1.2em; }

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips.three { grid-template-columns: 1fr 1fr 1fr; }
.chip { min-height: 64px; border-radius: 16px; border: 2px solid var(--sky-line); background: var(--card); font-family: var(--font-title); font-size: 0.95rem; padding: 4px; }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }

.calc { background: var(--sky-soft); border-radius: var(--radius); padding: 14px 18px; margin-top: 14px; }
.calc .line { display: flex; justify-content: space-between; padding: 4px 0; }
.calc .total { border-top: 2px dashed #9CCFF2; margin-top: 8px; padding-top: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.calc .total b { font-size: 1.25rem; }
.note { font-size: 0.75rem; color: var(--ink-soft); margin-top: 8px; }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 16px; padding: 12px 14px; margin-top: 12px; font-size: 0.8rem; }

.list { margin-top: 12px; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--card); border-radius: 16px; padding: 12px 14px; margin-top: 8px; border: 1px solid #DCEBFA; width: 100%; text-align: left; min-height: 64px; }
.row-item .sub { font-size: 0.75rem; color: var(--ink-soft); }
.row-item.done { opacity: 0.6; }
.badge { font-family: var(--font-title); border-radius: 999px; padding: 2px 12px; background: var(--sky-soft); color: var(--blue); white-space: nowrap; }
.badge.urgent { background: var(--danger-bg); color: var(--danger-ink); }

.numrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #EEF5FD; }
.numrow:last-child { border-bottom: none; }
.copy { min-height: 48px; min-width: 64px; border-radius: 12px; border: 2px solid var(--sky-line); background: var(--card); font-family: var(--font-title); font-size: 0.8rem; }

.step { background: var(--card); border-radius: var(--radius); padding: 18px; margin-top: 12px; border: 2px solid var(--sky-line); }
.step .count { color: var(--ink-soft); font-size: 0.8rem; }
.step h2 { margin: 4px 0 8px; }
.step p { margin: 0; white-space: pre-line; }
.nav2 { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.nav2 .big { margin-top: 12px; justify-content: center; }

.say { background: var(--card); border: 2px solid var(--sky); border-radius: var(--radius); padding: 18px; font-size: 1.2rem; line-height: 1.6; margin-top: 10px; }
.foot { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.foot button { border: none; background: none; color: var(--ink-soft); min-height: 48px; padding: 0 10px; font-size: 0.8rem; text-decoration: underline; }
.rulesinfo { text-align: center; font-size: 0.7rem; color: var(--ink-soft); margin-top: 8px; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toggle input { width: 32px; height: 32px; accent-color: var(--blue); }
.photo-thumb { width: 100%; max-height: 200px; object-fit: cover; border-radius: 16px; margin-top: 8px; }
.monthbar { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; text-align: center; }
.monthbar button { min-height: 56px; border: none; background: var(--card); border-radius: 16px; font-size: 1.2rem; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(150%);
  background: var(--ink); color: #fff; border-radius: 16px; padding: 12px 16px;
  display: flex; gap: 14px; align-items: center; transition: transform .2s; max-width: 92vw; font-size: 0.9rem;
}
#toast { visibility: hidden; }
#toast.show { transform: translateX(-50%) translateY(0); visibility: visible; }
#toast button { background: none; border: 2px solid #fff; color: #fff; border-radius: 12px; min-height: 44px; padding: 0 12px; font-family: var(--font-title); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#toast span, #toast button { white-space: nowrap; }
