/* 생각 쑥쑥 독서장 — 초3 아이가 휴대폰·태블릿으로 쓴다. 큰 글씨, 큰 단추, 보라 외곽선과 파스텔. */
:root {
  --ink: #3b2f4a;
  --ink-soft: #6c5f7c;
  --paper: #FFF8F1;
  --card: #ffffff;
  --peach: #FFDCC7;
  --peach-deep: #E8896A;
  --imagine: #CFC6F5;
  --imagine-deep: #6E5BC8;
  --ideas: #B8EBD5;
  --ideas-deep: #2E8C67;
  --star: #FFE08A;
  --star-deep: #9A6B00;
  --talk: #A9D4FF;
  --talk-deep: #2F6FB0;
  --red: #E2574C;
  --radius: 22px;
  --tabs-h: 72px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Jua', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 19px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
h1, h2, h3, b, strong { font-weight: normal; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

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

/* ---------- 공통 단추 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 22px; border: 3px solid var(--ink); border-radius: 999px;
  background: #fff; font-size: 20px; box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s;
  text-decoration: none; color: var(--ink);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.big { min-height: 64px; font-size: 23px; width: 100%; }
.btn.main { background: var(--peach); }
.btn.go { background: var(--ideas); }
.btn.small { min-height: 42px; padding: 0 14px; font-size: 17px; box-shadow: 0 3px 0 var(--ink); }
.btn.ghost { box-shadow: none; border-width: 2px; background: transparent; }
.btn.danger { color: var(--red); border-color: var(--red); box-shadow: 0 3px 0 var(--red); }
.btn[disabled] { opacity: .45; cursor: default; }
.icon-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink); background: #fff;
  display: inline-grid; place-items: center; box-shadow: 0 3px 0 var(--ink); font-size: 22px; padding: 0;
  color: var(--ink); text-decoration: none; flex: none;
}
a { color: var(--ink); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- 머리 ---------- */
.top { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 8px; }
.top .dodam { width: 92px; height: 92px; flex: none; cursor: pointer; }
.bubble {
  position: relative; flex: 1; background: #fff; border: 3px solid var(--ink); border-radius: 22px;
  padding: 10px 16px; font-size: 21px; margin-bottom: 18px;
}
.bubble::before {
  content: ''; position: absolute; left: -13px; bottom: 16px; width: 18px; height: 18px; background: #fff;
  border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg);
}
.app-name { font-size: 15px; color: var(--ink-soft); margin: 0 0 2px; display: flex; justify-content: space-between; align-items: center; }
.bar { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.bar h1 { margin: 0; font-size: 26px; line-height: 1.2; flex: 1; min-width: 0; }

/* ---------- 책장 ---------- */
h2.sec { font-size: 22px; margin: 24px 0 10px; display: flex; align-items: center; gap: 8px; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.book-card {
  display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 3px solid var(--ink); border-radius: var(--radius);
  background: #fff; text-decoration: none; color: inherit; box-shadow: 0 4px 0 var(--ink); position: relative;
}
.book-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.cover {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; border: 2px solid var(--ink); object-fit: cover; background: #FFF1E6;
  display: grid; place-items: center; overflow: hidden;
}
.cover.none { color: var(--peach-deep); font-size: 40px; }
.book-card .t { font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.book-card .a { font-size: 14px; color: var(--ink-soft); }
.chips { display: flex; gap: 4px; }
.chip-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; background: #f1ecf4; }
.chip-dot svg { width: 22px; height: 22px; }
.chip-dot.off svg { opacity: .3; filter: grayscale(1); }
.chip-dot.imagine:not(.off) { background: var(--imagine); }
.chip-dot.ideas:not(.off) { background: var(--ideas); }
.chip-dot.star:not(.off) { background: var(--star); }
.chip-dot.talk:not(.off) { background: var(--talk); }
.book-card .badge { position: absolute; top: -12px; right: -10px; width: 50px; height: 50px; }

/* ---------- 책 넣기 ---------- */
.field { display: block; }
.field > span { display: block; margin-bottom: 6px; font-size: 18px; }
.input, textarea.input {
  width: 100%; min-height: 56px; padding: 12px 16px; border: 3px solid var(--ink); border-radius: 18px; background: #fff;
  font-size: 20px; outline: none;
}
.input:focus { box-shadow: 0 0 0 4px #FFD66B; }
textarea.input { min-height: 150px; resize: vertical; line-height: 1.55; }
.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; min-width: 0; }
.results { display: grid; gap: 10px; }
.result {
  display: flex; gap: 12px; align-items: center; padding: 10px; border: 3px solid var(--ink); border-radius: 18px; background: #fff;
  text-align: left; width: 100%; box-shadow: 0 3px 0 var(--ink); text-decoration: none; color: inherit;
}
.result img, .result .cover { width: 58px; flex: none; aspect-ratio: 3/4; }
.result .t { font-size: 19px; line-height: 1.25; }
.result .a { font-size: 14px; color: var(--ink-soft); }
.note-box { padding: 14px 16px; border: 3px dashed var(--ink-soft); border-radius: 18px; background: #fff; }
.photo-pick { display: flex; gap: 12px; align-items: center; }
.photo-pick img { width: 90px; border-radius: 12px; border: 2px solid var(--ink); }

/* ---------- 책 화면 ---------- */
.book-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.book-head .cover { width: 108px; flex: none; }
.book-head .t { font-size: 25px; line-height: 1.25; overflow-wrap: anywhere; }
.book-head .a { font-size: 16px; color: var(--ink-soft); }
.areas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 420px) {
  .areas { gap: 12px; }
  .area-card { min-height: 136px !important; padding: 12px !important; }
  .area-card .n { font-size: 21px !important; }
}
.area-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 3px solid var(--ink);
  border-radius: var(--radius); text-decoration: none; color: inherit; box-shadow: 0 4px 0 var(--ink); min-height: 150px;
}
.area-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.area-card.imagine { background: var(--imagine); }
.area-card.ideas { background: var(--ideas); }
.area-card.star { background: var(--star); }
.area-card.talk { background: var(--talk); }
.area-art { width: 52px; height: 52px; }
.area-card .n { font-size: 23px; }
.area-card .s { font-size: 14px; opacity: .8; }
.area-card .state { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; display: grid; place-items: center; font-size: 22px; }
.area-card .state.todo { background: rgba(255,255,255,.5); border-style: dashed; }
.parent-only { border: 3px dashed var(--ink-soft); border-radius: 18px; padding: 12px 14px; background: #fff; }
.parent-only > .lbl { font-size: 15px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }

/* ---------- 영역 화면 ---------- */
.area-top { padding: 14px 16px; border: 3px solid var(--ink); border-radius: var(--radius); margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
.area-top.imagine { background: var(--imagine); }
.area-top.ideas { background: var(--ideas); }
.area-top.star { background: var(--star); }
.area-top.talk { background: var(--talk); }
.area-top .n { font-size: 25px; line-height: 1.2; }
.area-top .g { font-size: 17px; }
.pick-title { font-size: 21px; margin: 4px 0 10px; }
.q-card {
  display: block; width: 100%; text-align: left; padding: 16px; border: 3px solid var(--ink); border-radius: 20px; background: #fff;
  box-shadow: 0 4px 0 var(--ink); font-size: 21px; line-height: 1.45;
}
.q-card + .q-card { margin-top: 12px; }
.q-card.on { background: #FFF4C7; box-shadow: 0 0 0 4px #FFD66B, 0 4px 0 var(--ink); }
.hint { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 16px; color: var(--ink-soft); }
.hint .ic { color: var(--star-deep); margin-top: 2px; }
.q-now { font-size: 22px; line-height: 1.45; padding: 14px 16px; background: #fff; border: 3px solid var(--ink); border-radius: 20px; }
.idea-list { display: grid; gap: 10px; }
.idea { display: flex; gap: 10px; align-items: center; }
.num { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 3px solid var(--ink); background: var(--ideas); display: grid; place-items: center; font-size: 19px; }
.idea .input { min-height: 52px; }
.count-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.count-pick button { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; font-size: 21px; }
.count-pick button.on { background: var(--ideas); box-shadow: 0 0 0 4px #FFD66B; }
.err { color: var(--red); font-size: 18px; min-height: 1.4em; }
.err:empty { display: none; }
.answer-show { padding: 16px; border: 3px solid var(--ink); border-radius: 20px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 20px; }
.answer-show ol { margin: 0; padding-left: 1.6em; }
.answer-photo { display: block; width: 100%; max-width: 520px; border-radius: 16px; border: 3px solid var(--ink); margin-top: 10px; }

/* ---------- 도장 ---------- */
.stamp {
  display: inline-grid; place-items: center; width: 104px; height: 104px; border-radius: 50%;
  border: 4px double var(--red); color: var(--red); transform: rotate(-12deg); text-align: center; font-size: 19px; line-height: 1.15;
  padding: 10px; background: rgba(255,255,255,.75);
}
.stamp.sm { width: 62px; height: 62px; font-size: 12px; border-width: 3px; padding: 4px; }
.stamp-note { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.stamp-note .say { flex: 1; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 10px 14px; font-size: 18px; }
.area-card .stamp.sm { position: absolute; right: 8px; bottom: 8px; }
.stamp-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.stamp-pick button { border: 3px solid var(--red); color: var(--red); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 16px; }
.stamp-pick button.on { background: #FFE3DF; box-shadow: 0 0 0 3px #FFB3A7; }

/* ---------- 발표 무대 ---------- */
.topic { display: flex; gap: 12px; align-items: center; }
.frame-part { padding: 14px; border: 3px solid var(--ink); border-radius: 20px; background: #fff; }
.frame-part + .frame-part { margin-top: 12px; }
.frame-part .name { display: inline-block; font-size: 20px; padding: 2px 12px; border-radius: 999px; background: var(--talk); border: 2px solid var(--ink); }
.frame-part .guide { font-size: 17px; margin: 8px 0; }
.starter {
  display: block; width: 100%; text-align: left; margin: 0 0 8px; padding: 8px 12px; border: 2px dashed var(--talk-deep); border-radius: 14px;
  background: #EEF6FF; color: var(--talk-deep); font-size: 16px;
}
.frame-part textarea.input { min-height: 90px; font-size: 19px; }
.times { display: flex; gap: 10px; }
.times button { flex: 1; min-height: 56px; border-radius: 18px; border: 3px solid var(--ink); background: #fff; font-size: 21px; }
.times button.on { background: var(--talk); box-shadow: 0 0 0 4px #FFD66B; }
.prompter { padding: 16px; border: 3px solid var(--ink); border-radius: 20px; background: #fff; font-size: 22px; line-height: 1.55; }
.prompter p { margin: 0; }
.prompter p + p { margin-top: 10px; }
.prompter .k { display: inline-block; font-size: 15px; padding: 0 10px; margin-right: 6px; border-radius: 999px; background: var(--talk); border: 2px solid var(--ink); vertical-align: 3px; }
.clock { display: flex; align-items: center; gap: 16px; justify-content: center; margin: 16px 0 8px; }
.clock .time { font-size: 52px; line-height: 1; min-width: 4.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.clock .meter { flex: 1; max-width: 320px; height: 22px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.clock .meter i { display: block; height: 100%; width: 0; background: var(--talk); transition: width .25s linear; }
.clock .meter.over i { background: #FFD66B; }
.rec-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.reached { text-align: center; font-size: 21px; color: var(--talk-deep); min-height: 1.5em; margin: 6px 0 12px; }
.rec-list { display: grid; gap: 10px; }
.rec-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; }
.rec-item .d { flex: 1; }

/* ---------- 스티커판·성장 ---------- */
.title-now { display: flex; gap: 16px; align-items: center; padding: 16px; border: 3px solid var(--ink); border-radius: var(--radius); background: #fff; }
.title-art { width: 84px; height: 84px; flex: none; }
.title-now .n { font-size: 27px; }
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 14px; border: 3px solid var(--ink); border-radius: var(--radius); background: #FFF1E6; }
.slot { aspect-ratio: 1; border-radius: 50%; border: 3px dashed #d9c7bb; display: grid; place-items: center; position: relative; }
.slot.full { border: none; }
.slot .sticker-art { width: 100%; height: 100%; }
.slot .milestone { position: absolute; inset: 0; display: grid; place-items: center; opacity: .35; }
.slot .milestone .title-art { width: 70%; height: 70%; }
.titles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; text-align: center; font-size: 15px; }
.titles .title-art { width: 100%; height: auto; max-width: 64px; }
.titles .off { opacity: .35; filter: grayscale(.8); }
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { padding: 14px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; }
.stat .v { font-size: 34px; line-height: 1.1; }
.stat .l { font-size: 15px; color: var(--ink-soft); }
.months { display: grid; gap: 14px; padding: 14px; border: 3px solid var(--ink); border-radius: var(--radius); background: #fff; }
.month { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; }
.month .m { font-size: 17px; }
.bars { display: grid; gap: 4px; }
.bars .r { display: flex; align-items: center; gap: 8px; }
.bars .b { display: block; height: 16px; border-radius: 999px; border: 2px solid var(--ink); min-width: 14px; }
.bars .b.zero { border-style: dashed; opacity: .35; background: transparent !important; }
.bars .v { font-size: 15px; min-width: 1.2em; }
.month.empty .none { font-size: 15px; color: var(--ink-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 15px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }

/* ---------- 부모 ---------- */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0; }
.pin-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.keypad button { height: 66px; border-radius: 20px; border: 3px solid var(--ink); background: #fff; font-size: 28px; box-shadow: 0 3px 0 var(--ink); }
.keypad button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.menu { display: grid; gap: 12px; }
.menu .btn { justify-content: flex-start; width: 100%; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 16px; font-size: 17px; }
.seg button.on { background: var(--peach); }
.collect { display: grid; gap: 12px; }
.collect .item { padding: 14px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; }
.collect .q { font-size: 16px; color: var(--ink-soft); }
.collect .ans { font-size: 19px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 6px; }
.collect .meta { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.collect img { max-width: 240px; border-radius: 12px; border: 2px solid var(--ink); display: block; margin-top: 8px; }
.tag { display: inline-block; font-size: 14px; padding: 1px 10px; border-radius: 999px; border: 2px solid var(--ink); }
.tag.imagine { background: var(--imagine); }
.tag.ideas { background: var(--ideas); }
.tag.star { background: var(--star); }
.tag.talk { background: var(--talk); }
.qedit { padding: 12px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; }
.qedit + .qedit { margin-top: 10px; }
.qedit .input { font-size: 17px; min-height: 46px; padding: 8px 12px; }
.qedit textarea.input { min-height: 70px; }
.qedit.hidden-q { opacity: .55; }
.qedit .orig { font-size: 14px; color: var(--ink-soft); margin: 4px 0 8px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 17px; }
.check input { width: 22px; height: 22px; }

/* ---------- 아래 탭 ---------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: #fff; border-top: 3px solid var(--ink); padding-bottom: env(safe-area-inset-bottom);
}
#tabs a {
  flex: 1; max-width: 190px; height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--ink-soft); font-size: 16px;
}
#tabs a .ic { width: 28px; height: 28px; }
#tabs a.on { color: var(--ink); }
#tabs a.on .ic { color: var(--peach-deep); }

/* ---------- 도담 칭찬 ---------- */
#buddy {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom)); z-index: 40; transform: translateX(-50%);
  width: min(560px, calc(100% - 24px)); display: flex; align-items: flex-end; gap: 10px; pointer-events: none;
  animation: pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
#buddy .dodam { width: 120px; height: 120px; flex: none; animation: bounce 1s ease-in-out infinite; }
#buddy .bubble { font-size: 23px; margin-bottom: 30px; box-shadow: 0 5px 0 var(--ink); pointer-events: auto; }
@keyframes pop { from { transform: translate(-50%, 40px) scale(.7); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes bounce { 50% { transform: translateY(-8px); } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
#toast {
  position: fixed; left: 50%; top: 18px; z-index: 60; transform: translate(-50%, -150%); max-width: calc(100% - 32px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 18px; font-size: 18px; transition: transform .25s;
}
#toast.show { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  #buddy, #buddy .dodam { animation: none; }
}

/* ---------- 독서록 인쇄 ---------- */
.print-tools { display: flex; gap: 10px; margin-bottom: 14px; }
.sheet { background: #fff; color: #222; padding: 14mm 14mm; border: 1px solid #ccc; max-width: 210mm; margin: 0 auto; font-size: 12pt; line-height: 1.5; }
.sheet h1 { font-size: 20pt; margin: 0 0 2mm; }
.sheet .info { display: flex; gap: 6mm; align-items: flex-start; margin-bottom: 5mm; }
.sheet .info img { width: 28mm; border: 1px solid #999; border-radius: 2mm; }
.sheet .info .m { color: #555; font-size: 11pt; }
.sheet .part { border: 1.5px solid #444; border-radius: 4mm; padding: 4mm 5mm; margin-bottom: 4mm; break-inside: avoid; position: relative; }
.sheet .part h2 { font-size: 14pt; margin: 0 0 2mm; display: flex; gap: 3mm; align-items: center; }
.sheet .part h2 small { font-size: 10pt; color: #666; }
.sheet .part .q { color: #444; margin-bottom: 2mm; }
.sheet .part .a { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 14mm; }
.sheet .part img.ph { max-width: 70mm; max-height: 70mm; border: 1px solid #999; border-radius: 2mm; margin-top: 2mm; }
.sheet .part .stamp.sm { position: absolute; right: 4mm; top: 3mm; width: 18mm; height: 18mm; font-size: 8pt; }
.sheet .part .pn { color: #666; font-size: 10pt; margin-top: 2mm; }
.sheet .foot { text-align: right; color: #888; font-size: 9pt; }
@page { size: A4 portrait; margin: 0; }
@media print {
  body { background: #fff; padding: 0; }
  #tabs, #buddy, #toast, #confetti, .print-tools, .no-print { display: none !important; }
  #app { max-width: none; padding: 0; }
  .sheet { border: 0; max-width: none; margin: 0; }
  .stamp { background: transparent; }
}
