:root {
  --bg: #f3f5fa; --card: #fff; --ink: #1d2433; --sub: #6b7385; --line: #dfe3ec;
  --pri: #3867f4; --ok: #15924b; --ok-bg: #e5f6ec; --no: #d93f32; --no-bg: #fdebe9;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.6 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  word-break: keep-all;
}
#app { max-width: 600px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 8px 0 4px; }
h2 { font-size: 1rem; color: var(--sub); margin: 20px 0 8px; }
.sub { color: var(--sub); font-size: .9rem; margin: 0; }

button, input { font: inherit; color: inherit; }
button {
  cursor: pointer; min-height: 48px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
button:focus-visible, input:focus-visible { outline: 3px solid var(--pri); outline-offset: 2px; }
button.pri { background: var(--pri); border-color: var(--pri); color: #fff; font-weight: 700; }
button:disabled { cursor: default; }
.answer button:disabled { opacity: .4; }

/* 오늘의 미션 */
.progress { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; margin: 12px 0 4px; }
.progress i { display: block; height: 100%; background: var(--pri); border-radius: 7px; transition: width .3s; }
.plan { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.plan li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card); border: 2px solid transparent; border-radius: 12px; }
.plan li.now { border-color: var(--pri); }
.plan li.done { color: var(--sub); }
.plan b { flex: 1; }
.plan small { color: var(--sub); }
button.wide { width: 100%; font-size: 1.2rem; min-height: 60px; }
.links { text-align: center; margin-top: 24px; }
.links button { border: 0; background: none; color: var(--sub); text-decoration: underline; min-height: 40px; }
.center { text-align: center; }
.stamp { font-size: 5rem; line-height: 1.2; text-align: center; }
.stamp p { font-size: 1.2rem; font-weight: 700; margin: 0; }
.timer { font-size: 3.5rem; font-weight: 700; margin: 16px 0; font-variant-numeric: tabular-nums; }

/* 도장 달력 */
.month { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 1.2rem; }
.month button { font-size: 1.4rem; width: 48px; padding: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal b { color: var(--sub); font-size: .85rem; padding: 4px 0; }
.cal span { min-height: 64px; border-radius: 10px; background: var(--bg); font-size: 1.6rem; line-height: 1.3; }
.cal span:empty { background: none; }
.cal span.today { outline: 2px solid var(--pri); }
.cal small { display: block; font-size: .75rem; color: var(--sub); }

/* 부모님 화면 */
section.card { margin-bottom: 12px; }
section.card h2 { margin: 0 0 8px; color: var(--ink); font-size: 1.1rem; }
h2 small, td small { color: var(--sub); font-weight: 400; font-size: .8rem; }
td small { display: block; }
.status { font-size: 1.3rem; font-weight: 700; margin: 0 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
th { color: var(--sub); font-weight: 400; font-size: .85rem; }
th:first-child, td:first-child { text-align: left; }
.wrongs { list-style: none; padding: 0; margin: 0; font-size: .95rem; }
.wrongs li { padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.wrongs li:last-child { border: 0; }
.wrongs small { color: var(--sub); }
b.ok { color: var(--ok); }
b.no { color: var(--no); }

.answer input.link, .answer input.code { flex: 1; width: auto; min-width: 0; font-size: .9rem; font-weight: 400; text-align: left; }
p.no { color: var(--no); }

/* 문제 미리보기 */
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.types button { text-align: left; line-height: 1.3; }
.types small { display: block; color: var(--sub); }

/* 문제 화면 */
header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: .9rem; }
header .grow { flex: 1; }
header button { min-height: 40px; padding: 4px 12px; }
.levels button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.card { background: var(--card); border-radius: 16px; padding: 20px; box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.prompt { font-size: 1.1rem; }
.big { font-size: 2rem; font-weight: 700; text-align: center; margin: 16px 0; line-height: 1.5; }
.box { background: var(--bg); border-radius: 12px; padding: 12px 16px; margin: 12px 0; font-weight: 700; }
.lines { width: fit-content; margin: 12px auto; font-size: 1.25rem; font-weight: 700; }
.figure { text-align: center; margin: 12px 0; }
.figure svg, .options svg { max-width: 100%; height: auto; vertical-align: middle; }
.emoji { font-size: 2.6rem; line-height: 1.2; vertical-align: middle; }
.big .emoji { font-size: 1.3em; }
.emoji-row { font-size: 2.6rem; text-align: center; margin: 8px 0 0; }
.letters { font-size: 1.5rem; letter-spacing: .15em; }
.box small { font-weight: 400; color: var(--sub); }
.box:has(.letters) { text-align: center; }
.figure .arrow { font-size: 1.6rem; margin: 0 12px; vertical-align: middle; }

/* 분수: 세로로 쌓고 가운데 줄은 테두리로 그림 (글자 "/"는 기록용으로만 남김) */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.2; font-size: .85em; }
.frac .bar { font-size: 0; align-self: stretch; border-top: 2px solid currentColor; margin: 2px 0; }

.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 20px; }
.options button { font-size: 1.15rem; font-weight: 700; padding: 12px; }
.options button.right { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.options button.wrong { background: var(--no-bg); border-color: var(--no); color: var(--no); }

.answer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; font-size: 1.15rem; }
.answer label { display: flex; align-items: center; gap: 6px; }
.answer input {
  width: 8em; min-height: 48px; padding: 4px 8px; text-align: center; font-size: 1.3rem; font-weight: 700;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card);
}
.answer input:disabled { background: var(--bg); }
.answer .frac { font-size: 1em; gap: 2px; }
.answer .frac input, .answer input.whole { width: 3.2em; }
.hint { color: var(--sub); font-size: .85rem; text-align: center; margin: 8px 0 0; }

.result { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding: 12px 16px; border-radius: 12px; font-weight: 700; }
.result[hidden] { display: none; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.no { background: var(--no-bg); color: var(--no); }
.result b { color: var(--ink); font-size: 1.15rem; }

@media (max-width: 480px) {
  .big { font-size: 1.6rem; }
  .card { padding: 16px; }
}
