:root {
  --bg: #fff8ec; --wall: #fdf1d6; --floor: #d9b98c; --ink: #3b3024; --muted: #8a7a66;
  --card: #ffffff; --line: #e8dcc5;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 18px 20px 6px; max-width: 960px; margin: 0 auto; flex-wrap: wrap; }
h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; margin: 0 0 10px; color: var(--muted); }
.date { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #c2572a; }
main { max-width: 960px; margin: 0 auto; padding: 0 16px 60px; }
.stage-wrap { position: relative; background: var(--wall); border-radius: 20px; overflow: hidden;
  box-shadow: inset 0 -12px 0 var(--floor); }
#stage { width: 100%; height: auto; display: block; }
#confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.piece { position: absolute; width: 10px; height: 14px; border-radius: 2px; top: -20px;
  animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(640px) rotate(720deg); opacity: 0; } }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; }
button { border: 0; border-radius: 999px; padding: 10px 18px; font-size: 1rem; font-weight: 700;
  background: #fff; color: var(--ink); box-shadow: 0 2px 0 var(--line); cursor: pointer; }
button.big { background: #ff7a59; color: #fff; box-shadow: 0 3px 0 #c2572a; font-size: 1.1rem; }
button:active { transform: translateY(2px); box-shadow: none; }
.speed { font-size: .9rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
select { border-radius: 8px; border: 1px solid var(--line); padding: 6px 8px; font-size: .95rem; }
#scrub { flex: 1 1 100%; accent-color: #ff7a59; height: 28px; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 12px 0 24px; }
.card { background: var(--card); border-radius: 16px; padding: 14px 16px; border-top: 6px solid var(--c, #ccc);
  box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.card .name { font-weight: 800; }
.card .now { font-size: 1.8rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.card .now small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.card .grew { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.card .badge { display: inline-block; margin-top: 6px; font-size: .8rem; background: #fff3c4; border-radius: 999px; padding: 2px 8px; }
.chart-wrap, .table-wrap { background: var(--card); border-radius: 16px; padding: 16px; margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05); }
#chart { width: 100%; height: auto; display: block; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .95rem; }
th, td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
td.delta { color: var(--muted); font-size: .8rem; }
@media (max-width: 600px) { h1 { font-size: 1.3rem; } .date { font-size: 1.2rem; } }
.note { color: var(--muted); font-size: .8rem; margin: 10px 0 0; }
.table-wrap { overflow-x: auto; }
th { font-weight: 700; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.card .age { font-weight: 600; font-size: .8rem; color: var(--muted); margin-left: 4px; }
#ageChart { width: 100%; height: auto; display: block; margin-bottom: 12px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.band-key { padding-left: 20px; position: relative; font-weight: 700; }
.band-key::before { content: ""; position: absolute; left: 0; top: 2px; width: 14px; height: 14px; border-radius: 4px; }
.band-key.boys::before { background: rgba(79,163,255,.35); }
.band-key.girls::before { background: rgba(255,122,160,.35); }
.band-toggle button { padding: 4px 10px; font-size: .8rem; margin-left: 4px; box-shadow: none; border: 1px solid var(--line); }
.band-toggle button.on { background: #3b3024; color: #fff; border-color: #3b3024; }
.card .pct { font-size: .85rem; margin-top: 4px; }
.card .pct b { color: var(--c); }

/* ---------- 표 (모바일 우선) ---------- */
.age-table { table-layout: fixed; width: 100%; }
.age-table th:first-child, .age-table td:first-child { width: 18%; white-space: nowrap; }
.age-table th { text-align: center; font-size: .95rem; }
.age-table td { text-align: center; vertical-align: top; padding: 8px 4px; }
.age-table .v b { display: block; font-size: 1.05rem; font-weight: 800; }
.age-table .v small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.25; margin-top: 2px; }
.rec-table th:first-child, .rec-table td:first-child { width: 26%; font-size: .85rem; }
.chart-wrap { overflow: hidden; }
.note a { word-break: break-all; }
@media (max-width: 600px) {
  main { padding: 0 10px 40px; }
  .top { padding: 14px 12px 4px; }
  .chart-wrap, .table-wrap { padding: 12px 10px; border-radius: 12px; }
  .legend-row { font-size: .72rem; gap: 6px 10px; }
  .band-toggle { flex-basis: 100%; }
  .band-toggle button { margin-left: 0; margin-right: 4px; }
  .card { padding: 12px 12px; }
  .card .now { font-size: 1.5rem; }
  .card .grew, .card .pct { font-size: .8rem; }
  .rec-table th:first-child, .rec-table td:first-child { font-size: .72rem; width: 24%; }
  th, td { padding: 5px 6px; }
  .age-table td { padding: 7px 2px; }
  .age-table .v b { font-size: .95rem; }
  .age-table .v small { font-size: .66rem; }
  button { padding: 9px 14px; font-size: .95rem; }
}
