* { box-sizing: border-box; }
html, body { margin: 0; background: #F6F6F3; color: #1A1A1A; font-family: 'PingFang TC', 'Noto Sans TC', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input { font-family: inherit; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.plan, .soon { padding-bottom: calc(84px + env(safe-area-inset-bottom)); padding-left: 12px; padding-right: 12px; }
.grow { flex-grow: 1; }
.muted { color: #5C5C5C; font-size: 14px; }
.xs { font-size: 12px; }
.big { font-size: 18px; font-weight: 700; margin: 12px 0 4px; }
h1 { margin: 16px 0 4px; font-size: 24px; }
h2 { margin: 0; font-size: 20px; }
.sub { margin: 0; font-size: 14px; color: #5C5C5C; }
.hint { margin: 8px 4px 0; font-size: 12px; color: #8A8A85; }
.lbl { margin: 22px 0 8px; font-size: 14px; font-weight: 700; }
.opt { font-weight: 400; color: #8A8A85; font-size: 12px; }

/* 設定 */
.top { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.bar { flex-grow: 1; display: flex; gap: 6px; }
.seg { flex-grow: 1; height: 4px; border-radius: 4px; background: #E4E4DF; }
.seg.on { background: #2563EB; }
.icon { width: 40px; height: 40px; margin-left: -8px; border: none; background: none; display: flex; align-items: center; justify-content: center; color: #1A1A1A; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 10px; }
.chip { height: 44px; border-radius: 11px; border: 1.5px solid #E4E4DF; background: #fff; color: #5C5C5C; font-size: 15px; font-weight: 500; }
.chip.on { border-color: #2563EB; background: #EEF3FE; color: #1D4ED8; font-weight: 700; }
.chip.sm { height: 36px; font-size: 14px; }
.chip.mini { height: 30px; padding: 0 7px; font-size: 13px; border-radius: 8px; border-width: 1px; }
.field { width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid #E4E4DF; background: #fff; padding: 0 14px; font-size: 16px; }
.card { background: #fff; border-radius: 14px; padding: 12px; border: none; text-align: left; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.date { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #5C5C5C; }
.date input { height: 44px; border-radius: 10px; border: 1px solid #E4E4DF; padding: 0 8px; font-size: 15px; background: #fff; color: #1A1A1A; width: 100%; }
.subj { display: flex; flex-direction: column; gap: 10px; }
.subj.off { opacity: .6; }
.subj-top { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.box { width: 26px; height: 26px; border-radius: 7px; border: 2px solid #B8B8B2; background: #fff; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.box.on { border-color: #2563EB; background: #2563EB; }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.tag.gray { background: #EFEFEC; color: #3F3F3C; }
.link { border: none; background: none; color: #2563EB; font-size: 14px; padding: 8px 4px; min-height: 36px; }
.link.sm { font-size: 13px; color: #5C5C5C; }
.trow { display: flex; align-items: center; gap: 8px; }
.trow b { width: 36px; }
.trow2 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: #5C5C5C; }
.tbox { height: 40px; border-radius: 9px; border: 1px solid #E4E4DF; padding: 0 8px; font-size: 15px; background: #fff; color: #1A1A1A; }
.step { display: flex; align-items: center; border: 1px solid #E4E4DF; border-radius: 9px; height: 40px; background: #fff; }
.step button { width: 36px; height: 38px; border: none; background: none; font-size: 18px; color: #5C5C5C; }
.step span { min-width: 58px; text-align: center; font-size: 15px; color: #1A1A1A; }
.primary { height: 52px; border-radius: 14px; border: none; background: #2563EB; color: #fff; font-size: 17px; font-weight: 700; margin-top: 20px; width: 100%; }
.secondary { height: 44px; border-radius: 12px; border: 1.5px solid #E4E4DF; background: #fff; font-size: 15px; padding: 0 14px; }
.danger { margin-top: 24px; height: 44px; border: none; background: none; color: #A12C28; font-size: 15px; }
.linkrow { font-size: 15px; min-height: 48px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.row-btns .primary { margin-top: 0; flex: 2; }
.row-btns .secondary { flex: 1; min-height: 52px; }

/* 計畫 */
.phead { display: flex; align-items: center; gap: 8px; padding: 0 4px; min-height: 40px; }
.ptitle { font-size: 22px; font-weight: 700; }
.pill { font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 999px; }
.pill.red { color: #A12C28; background: #FBE4E3; }
.week { margin-top: 10px; background: #fff; border-radius: 14px; padding: 8px 6px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.col { border: none; background: none; border-radius: 10px; padding: 4px 2px 6px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-height: 120px; }
.col.sel { background: #EEF3FE; }
.col .w { text-align: center; font-size: 12px; font-weight: 500; }
.col.today .w { color: #2563EB; font-weight: 700; }
.col .dt { text-align: center; font-size: 11px; color: #5C5C5C; margin-bottom: 2px; }
.cell { position: relative; height: 48px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.cell b { font-size: 15px; }
.cell span { font-size: 11px; }
.cell .dot { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 7px; background: #2F9E6A; display: flex; align-items: center; justify-content: center; }
.cell .dot svg { width: 9px; height: 9px; }
.banner { margin-top: 8px; background: #fff; border-radius: 12px; padding: 8px 12px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: #3F3F3C; flex-wrap: wrap; }
.banner svg { flex-shrink: 0; }
.banner span { flex: 1; min-width: 120px; }
.banner.warn { background: #FBE4E3; color: #A12C28; }
.panel { margin-top: 10px; background: #fff; border-radius: 14px; padding: 12px 14px; }
.ptitle2 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.slot { padding: 8px 0; border-top: 1px solid #F0F0EC; }
.slot:first-of-type { border-top: none; }
.shead { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.go { height: 36px; padding: 0 16px; border-radius: 10px; border: none; background: #2563EB; color: #fff; font-size: 14px; font-weight: 700; }
.why { display: flex; align-items: flex-start; gap: 5px; font-size: 13px; color: #5C5C5C; padding: 2px 0 4px; }
.why svg { margin-top: 3px; flex-shrink: 0; }
.task { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.tick { width: 24px; height: 24px; flex-shrink: 0; border-radius: 999px; border: 2px solid #B8B8B2; background: #fff; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #5C5C5C; }
.tick.on { border-color: #2F9E6A; background: #2F9E6A; }
.ttype { font-size: 12px; color: #5C5C5C; width: 56px; flex-shrink: 0; }
.ttext { flex: 1; min-width: 0; font-size: 15px; }
.task.done .ttext { color: #8A8A85; text-decoration: line-through; }

/* 時段模式 */
.session { background: #F6F6F3; }
.shead2 { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.timer { position: relative; width: 220px; height: 220px; margin: 20px auto 8px; color: #2563EB; }
.timer.rest { color: #2F9E6A; }
.tcenter { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tlabel { font-size: 15px; font-weight: 700; }
.tnum { font-size: 48px; font-weight: 700; font-variant-numeric: tabular-nums; color: #1A1A1A; }
.steps { background: #fff; border-radius: 14px; padding: 4px 14px 8px; margin-top: 12px; }
.steps .lbl { margin: 10px 0 2px; }

/* 分頁、底部表單 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-top: 1px solid #E4E4DF; padding: 6px 0 calc(10px + env(safe-area-inset-bottom)); }
.tabs button { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: #5C5C5C; min-height: 48px; }
.tabs button.on { color: #2563EB; font-weight: 700; }
.soon { align-items: center; text-align: center; }
.soon .ptitle { align-self: flex-start; }
.scrim { position: fixed; inset: 0; background: rgba(20, 20, 19, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; background: #fff; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }

/* 解題 */
.solve { padding-bottom: calc(84px + env(safe-area-inset-bottom)); padding-left: 12px; padding-right: 12px; }
.camera { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 12px; border: 2px dashed #C9D6F5; background: #F7F9FE; cursor: pointer; text-align: center; }
.camera b { font-size: 18px; }
.camicon { color: #2563EB; }
.album { align-self: center; margin-top: 6px; cursor: pointer; }
.list.tight { margin-top: 0; gap: 6px; }
.qrow { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.qtxt { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot { margin-top: 12px; padding: 6px; }
.shot img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 10px; display: block; }
.busy { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; font-size: 15px; color: #3F3F3C; }
.busy.sm { justify-content: flex-start; font-size: 13px; margin: 6px 0; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #C9D6F5; border-top-color: #2563EB; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.filebtn { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.seen { margin-top: 8px; }
.seenhead { display: flex; align-items: center; min-height: 32px; }
.qtext { font-size: 16px; line-height: 1.7; word-break: break-word; }
.qtext .katex, .msg .katex, .fstep .katex, .hint2 .katex, .final .katex { font-size: 1.05em; }
.fig { margin: 6px 0 0; }
.area { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.status { margin-top: 10px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; align-self: flex-start; background: #EFEFEC; color: #3F3F3C; }
.status.ok { background: #DDF3E8; color: #1D6B47; }
.status.mid { background: #FDF3DC; color: #8A5A00; }
.status.warn { background: #FBE4E3; color: #A12C28; }
.hsteps { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.hbtn { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; border: 1.5px solid #E4E4DF; border-radius: 11px; background: #fff; padding: 6px 10px; text-align: left; font-size: 15px; }
.hstep.open .hbtn { border-color: #2563EB; background: #EEF3FE; }
.num { width: 22px; height: 22px; border-radius: 11px; background: #EFEFEC; color: #3F3F3C; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hint2 { margin: 6px 4px 4px 32px; font-size: 14px; line-height: 1.6; color: #1D4ED8; }
.ansrow { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.ansrow .field { height: 44px; flex: 1; min-width: 0; }
.ansrow .go { height: 44px; flex-shrink: 0; }
.go:disabled { opacity: .5; }
.good { color: #1D6B47; font-weight: 700; margin: 8px 0 0; }
.secondary.locked { width: 100%; margin-top: 12px; height: 52px; color: #8A8A85; }
.fstep { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid #F0F0EC; font-size: 15px; line-height: 1.6; }
.fstep:first-of-type { border-top: none; }
.final { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #EEF3FE; font-weight: 700; font-size: 16px; }
.msgs { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; background: #F0F0EC; font-size: 15px; line-height: 1.5; align-self: flex-start; }
.msg.me { align-self: flex-end; background: #2563EB; color: #fff; }
.report { align-self: center; margin-top: 6px; }
.mtxt { font-family: 'Times New Roman', serif; font-style: italic; }
