[hidden] { display: none !important; }
:root {
  --bg: #f5f3ee; --card: #fff; --ink: #24303a; --muted: #6b7680; --line: #e3e0d8;
  --main: #3d6b8f; --main-soft: #e3edf5; --good: #3f8a5a; --good-soft: #e3f2e8; --warn: #b5562f; --warn-soft: #f8e6dd;
  --gold: #c98d1b; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
#app { max-width: 760px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 16px 6px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; color: var(--main); font-size: 18px; }
.kids { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 2px; }
.kids button, .chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 14px; white-space: nowrap; cursor: pointer; }
.kids button.on, .chip.on { background: var(--main); border-color: var(--main); color: #fff; }
main { padding: 12px 16px; }
nav#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav#tabs button { flex: 1; max-width: 152px; border: 0; background: none; padding: 7px 0 8px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; }
nav#tabs button span { font-size: 20px; line-height: 1.2; }
nav#tabs button.on { color: var(--main); font-weight: 700; }
.banner { background: var(--warn-soft); color: var(--warn); padding: 8px 16px; font-size: 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 17px; margin: 0 0 10px; }
.card h3 { font-size: 15px; margin: 14px 0 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.btn.main { background: var(--main); border-color: var(--main); color: #fff; font-weight: 700; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; font-weight: 700; }
.btn.warn { color: var(--warn); border-color: #e7c2b2; }
.btn.small { padding: 4px 10px; font-size: 14px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=month], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; }
textarea { min-height: 60px; resize: vertical; }
label.f { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.tag { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 13px; margin: 2px 4px 2px 0; background: var(--main-soft); color: var(--main); }
.tag.rec { background: var(--good-soft); color: var(--good); }
.tag.gray { background: #eee; color: var(--muted); }
.book-title { font-weight: 700; font-size: 17px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 11px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 700; }
.stars button { border: 0; background: none; font-size: 26px; padding: 0 2px; cursor: pointer; color: #d5d0c4; }
.stars button.on { color: var(--gold); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; overflow-wrap: anywhere; }
.month-head { font-weight: 700; margin: 14px 0 4px; color: var(--main); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 24px; color: var(--main); }
.stat span { font-size: 13px; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar { display: grid; grid-template-columns: 74px 1fr 56px; gap: 8px; align-items: center; font-size: 13px; }
.bar .track { background: #eeebe4; border-radius: 6px; height: 16px; overflow: hidden; }
.bar .fill { background: var(--main); height: 100%; border-radius: 6px; }
.bar .fill.en { background: #6f9bc0; }
.bar .fill.study { background: var(--good); }
.bar .n { text-align: right; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; }
table.t td.n, table.t th.n { text-align: right; }
.tablewrap { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal .h { text-align: center; font-size: 12px; color: var(--muted); }
.cal .d { min-height: 58px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px; font-size: 11px; cursor: pointer; overflow: hidden; }
.cal .d.empty { background: none; border: 0; cursor: default; }
.cal .d.today { border-color: var(--main); }
.cal .d.sel { outline: 2px solid var(--main); }
.cal .d .num { font-weight: 700; font-size: 12px; }
.cal .d .b { color: var(--main); }
.cal .d .m { color: var(--good); }
#scanBox { position: relative; margin: 10px 0; border-radius: 12px; overflow: hidden; background: #000; }
#scanBox video { width: 100%; display: block; max-height: 55vh; object-fit: cover; }
#scanBox .guide { position: absolute; left: 5%; right: 5%; top: 25%; bottom: 25%; border: 2px solid rgba(255,255,255,.8); border-radius: 10px; pointer-events: none; }
#scanHint { color: #fff; background: rgba(0,0,0,.55); position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; font-size: 13px; }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #24303a; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; font-size: 15px; }
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 15; display: flex; align-items: flex-end; justify-content: center; }
#sheet .sheet-in { background: var(--bg); width: 100%; max-width: 760px; max-height: 88vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth h1 { color: var(--main); text-align: center; margin: 0 0 4px; }
.consent { background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0 6px; }
.consent label { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-weight: 700; }
.consent input { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.code { font: 700 20px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 2px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
@media (min-width: 700px) { main { padding: 18px 20px; } }
@media print {
  header, nav#tabs, .noprint, .banner { display: none !important; }
  body, html { background: #fff; }
  #app { padding: 0; max-width: none; }
  .card { border: 0; padding: 0; break-inside: avoid; }
  .cal .d { min-height: 70px; }
}
