:root {
  color-scheme: light;
  --paper: #fbf6ea; --card: #fffdf8; --ink: #26323b; --soft: #5d6a73; --line: #e4dac5;
  --blue: #2f6690; --blue-d: #234e70; --blue-l: #e6f0f7;
  --orange: #b9540c; --orange-l: #fff0de;
  --green: #2c6e49; --green-l: #e6f4ea;
  --red: #b3372f; --red-l: #fdeceA;
  --series: #2a78d6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 18px/1.65 system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}
.wrap {
  width: 100%; max-width: 840px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
main.wrap { padding-top: 18px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.top { background: var(--blue); color: #fff; padding-top: env(safe-area-inset-top); }
.top .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 52px; gap: 12px; }
h1 { font-size: 1.6rem; line-height: 1.35; margin: 0 0 8px; }
h2 { font-size: 1.15rem; line-height: 1.4; margin: 0 0 10px; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
.en { font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif; }
.soft { color: var(--soft); font-size: .9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin: 0 0 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grow { flex: 1 1 200px; min-width: 0; }
.hidden { display: none !important; }

button, .btn {
  font: inherit; font-weight: 600; min-height: 48px; padding: 8px 18px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
  touch-action: manipulation; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--blue); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, svg:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 2px;
}
button:disabled { cursor: default; }
.pri { background: var(--blue); border-color: var(--blue); color: #fff; }
.pri:hover:not(:disabled) { background: var(--blue-d); border-color: var(--blue-d); }
.big { width: 100%; min-height: 64px; font-size: 1.25rem; }
.sound { background: var(--orange-l); border-color: var(--orange); color: var(--orange); }
.link { border: 0; background: none; color: var(--soft); text-decoration: underline; font-weight: 400; font-size: .9rem; padding: 8px; min-height: 44px; }
input, select {
  font: inherit; min-height: 52px; padding: 8px 14px; width: 100%;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input.bigin { font-size: 1.4rem; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
summary::before { content: "▸"; margin-right: 8px; }
details[open] > summary::before { content: "▾"; }

/* 首頁 */
.users button[aria-pressed="true"] { background: var(--blue-l); border-color: var(--blue); }
.users button:disabled { opacity: .55; }
.steps { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.steps li { text-align: center; font-size: .85rem; padding: 8px 2px; border-radius: 12px; background: var(--blue-l); line-height: 1.4; }
.steps li.done { background: var(--green-l); }
.steps span { display: block; font-size: 1.4rem; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal div { border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: 6px 0; font-size: .78rem; line-height: 1.4; }
.cal b { display: block; font-size: 1.05rem; min-height: 1.5em; }
.cal .done { background: var(--green-l); }
.cal .part { background: var(--orange-l); }
.cal .today { border: 2px solid var(--blue); }

/* 練習 */
.prog { display: flex; gap: 4px; margin-bottom: 6px; }
.prog i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.prog i b { display: block; height: 100%; width: 0; background: var(--green); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.ask { font-size: 1.15rem; font-weight: 700; margin-top: 14px; }
.word { font-size: 2.2rem; line-height: 1.3; font-weight: 700; margin: 6px 0 12px; overflow-wrap: anywhere; }
.tag { display: inline-block; background: var(--orange-l); color: var(--orange); border-radius: 8px; padding: 0 8px; font-size: .85rem; font-weight: 600; }
.opts { display: grid; gap: 10px; margin: 14px 0; }
.opt { justify-content: flex-start; text-align: left; gap: 12px; min-height: 58px; width: 100%; font-size: 1.1rem; }
.opt kbd { font: inherit; color: var(--soft); flex: none; min-width: 1.2em; }
.opt.right { background: var(--green-l); border-color: var(--green); color: var(--ink); }
.opt.wrong { background: var(--red-l); border-color: var(--red); color: var(--ink); }
.opt.off { opacity: .4; text-decoration: line-through; }
.note { border-radius: 12px; padding: 12px 14px; margin: 12px 0; border-left: 5px solid var(--green); background: var(--green-l); }
.note.good { border-color: var(--green); background: var(--green-l); }
.note.bad { border-color: var(--red); background: var(--red-l); }
.note.tip { border-color: var(--orange); background: var(--orange-l); }
.note ul { margin: 0; padding-left: 1.2em; }
.note .en { font-size: 1.2rem; font-weight: 600; }
.passage { font-size: 1.25rem; line-height: 1.95; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 10px 0 16px; }
.passage h2 { margin-bottom: 4px; }
.passage mark { background: #ffe08a; color: inherit; border-radius: 4px; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tiles button { min-width: 52px; font-size: 1.4rem; padding: 4px 12px; }
.tiles button:disabled { opacity: .25; }
.built { min-height: 60px; border-bottom: 3px solid var(--blue); font-size: 1.8rem; letter-spacing: .08em; padding: 4px 8px; }
.bank span { display: inline-block; background: var(--blue-l); border-radius: 8px; padding: 2px 12px; margin: 0 8px 8px 0; }
#check { margin: 14px 0; }
.lines { display: grid; gap: 10px; margin: 12px 0; }
.lines > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.tasks { padding-left: 1.5em; margin: 12px 0; }
.tasks li { margin-bottom: 14px; padding-left: 4px; }

/* 家長頁 */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 14px; }
.chart { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fcfcfb; min-width: 0; }
.chart h3 { font-size: 1rem; margin: 0; display: flex; justify-content: space-between; gap: 8px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart svg text { font-size: 11px; fill: #52514e; font-family: inherit; }
.chart .tipbox {
  position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: .8rem; line-height: 1.4; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); white-space: nowrap;
}
.chart .tipbox b { display: block; font-size: 1rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
textarea.report {
  width: 100%; height: 320px; font: .9rem/1.6 inherit; font-family: inherit; padding: 12px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}

@media (max-width: 560px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 14px; }
  .word { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .prog i b { transition: width .3s; }
}
