:root {
  --bg: #FBF7F0;
  --ink: #3B2F25;
  --muted: #8A7B6C;
  --accent: #C8742B;
  --card: #FFFFFF;
  --line: #EDE4D8;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 152px;
}
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.temple-name { font-size: 22px; font-weight: 600; line-height: 1.4; margin: 0; }
.assistant { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.assistant svg { width: 34px; height: 34px; flex: 0 0 34px; }
.langs { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 20px; padding: 2px; background: var(--card); }
.lang-btn { min-width: 44px; height: 36px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); border-radius: 18px; font-size: 12px; cursor: pointer; font-family: inherit; }
.lang-btn.on { background: var(--accent); color: #FFFFFF; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 22px; }
.card-label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.pali { font-family: Georgia, "Times New Roman", serif; font-size: 14px; color: var(--muted); margin: 12px 0 10px; line-height: 1.6; }
.gist { font-size: 20px; line-height: 1.7; margin: 0 0 10px; }
.note { font-size: 14px; color: var(--muted); margin: 12px 0 0; line-height: 1.7; }
.main-btn { width: 100%; min-height: 52px; margin-top: 26px; border: 0; border-radius: 14px; background: var(--accent); color: #FFFFFF; font-size: 17px; font-weight: 600; font-family: inherit; cursor: pointer; }
.opts { margin-top: 14px; }
.opt { width: 100%; min-height: 48px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin-bottom: 8px; color: var(--ink); font-size: 16px; font-family: inherit; cursor: pointer; }
.opt.open { border-color: var(--accent); }
.opt-panel { padding: 4px 0 12px 4px; }
.tip { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.qbtn { display: block; width: 100%; min-height: 44px; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--line); padding: 10px 8px; color: var(--ink); font-size: 15px; font-family: inherit; cursor: pointer; }
.qbtn::before { content: "· "; color: var(--accent); }
.placeholder { margin-top: 40px; color: var(--muted); text-align: center; }
.privacy { text-align: center; font-size: 11px; line-height: 1.6; color: var(--muted); padding: 6px 16px 0; margin-top: 28px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: 76px; display: flex; background: var(--card); border-top: 1px solid var(--line); }
.tab { flex: 1; min-height: 76px; border: 0; background: transparent; color: var(--muted); font-size: 14px; line-height: 1.4; font-family: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px; }
.tab.on { color: var(--accent); }
.tab svg { width: 22px; height: 22px; display: block; }
.examples { margin-top: 10px; }
.think { color: var(--muted); font-size: 15px; padding: 8px 0; }
.answer { font-size: 16px; line-height: 1.8; white-space: pre-wrap; }
.ask-q { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.cites { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.cite { font-size: 13px; color: var(--accent); text-decoration: none; }
.ask-form { position: fixed; left: 0; right: 0; bottom: 76px; display: flex; gap: 8px; padding: 10px 16px; background: var(--card); border-top: 1px solid var(--line); z-index: 5; }
.ask-input { flex: 1; min-width: 0; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--bg); color: var(--ink); font-family: inherit; font-size: 16px; }
.ask-send { min-height: 48px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-family: inherit; font-size: 15px; cursor: pointer; }
body:has(.ask-form) #app { padding-bottom: 200px; }
.ask-examples { margin-top: 4px; }
.cite-item { display: flex; flex-direction: column; gap: 4px; }
.cite-detail { padding: 8px 10px; margin: 2px 0 6px; background: var(--bg); border-radius: 8px; }
.cite-block { margin-bottom: 6px; }
.cite-block p { margin: 4px 0 0; font-size: 13px; line-height: 1.6; word-break: break-word; }
.steps { margin: 12px 0 0; padding-left: 22px; font-size: 14px; line-height: 1.8; color: var(--muted); }
.steps li { padding: 2px 0; }
.steps li.step-on { color: var(--accent); font-weight: 600; }
.section-title { font-size: 19px; margin: 0 0 10px; }
.about { font-size: 14px; line-height: 1.75; margin: 8px 0 0; }
.durations { display: flex; gap: 8px; margin: 12px 0; }
.dur { flex: 1; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted); font-family: inherit; font-size: 14px; cursor: pointer; }
.dur.on { border-color: var(--accent); color: var(--accent); }
.timer { font-size: 44px; font-weight: 600; text-align: center; letter-spacing: .04em; margin: 20px 0 6px; font-variant-numeric: tabular-nums; }
.breath { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.controls { display: flex; gap: 8px; }
.ctrl { flex: 1; min-height: 48px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-family: inherit; font-size: 16px; cursor: pointer; }
.ctrl.ghost { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.info-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pill { font-size: 12px; color: var(--accent); border: 1px solid var(--accent); border-radius: 20px; padding: 2px 8px; white-space: nowrap; }
.traditions { display: flex; gap: 4px; margin-top: 6px; }
.trad-btn { min-height: 26px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--muted); font-family: inherit; font-size: 12px; cursor: pointer; }
.trad-btn.on { border-color: var(--accent); color: var(--accent); }
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(59,47,37,.45); }
.modal-card { width: 100%; max-width: 360px; background: var(--card); border-radius: 16px; padding: 20px; }
.modal-title { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.opt-desc { display: block; font-size: 12px; color: var(--muted); }
.link-btn { border: 0; background: transparent; color: var(--accent); font-family: inherit; font-size: 11px; text-decoration: underline; cursor: pointer; padding: 0 2px; }
.draft-tag { font-size: 11px; color: var(--muted); }
.passage { padding: 12px 0; border-top: 1px solid var(--line); }
.passage-on { background: #FFF4DC; border-left: 3px solid var(--accent); padding-left: 10px; }
.global-teacher { margin: 14px 0 4px; text-align: right; }
body.silent { background: #000; }
body.silent #app { padding: 0; background: #000; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
body.silent .top, body.silent .tabs, body.silent .privacy, body.silent .global-teacher, body.silent .timer-card > *:not(#timer) { display: none; }
body.silent .timer-card { background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; }
body.silent #timer { color: #FFF; font-size: 72px; opacity: .65; margin: 0; }

/* v3：今天功课主线 */
body.large-font { font-size: 19px; }
body.large-font .opt, body.large-font .todo, body.large-font input, body.large-font textarea { font-size: 18px; }
h2, h3 { line-height: 1.45; }
h2 { font-size: 21px; margin: 10px 0 12px; }
h3 { font-size: 16px; margin: 20px 0 8px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.todo { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 50px; padding: 12px 2px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; line-height: 1.5; }
.todo:last-child { border-bottom: 0; }
.ok { color: #467451; font-weight: 600; }
.greet { margin: 22px 0 0; color: var(--accent); font-size: 20px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.plan-row > span:first-child { flex: 1; }
.plan-row > span:last-child { display: flex; gap: 3px; }
.mini { min-width: 34px; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.opt-inline { flex: 1; min-width: 70px; min-height: 42px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.opt-inline.on { border-color: var(--accent); color: var(--accent); background: #FFF9F3; }
#timer { display: block; width: 100%; margin: 24px 0 10px; border: 0; background: transparent; color: inherit; text-align: center; font: inherit; font-size: 52px; line-height: 1.2; font-weight: 600; letter-spacing: .04em; font-variant-numeric: tabular-nums; cursor: pointer; }
.guide-step { min-height: 74px; margin: 18px 0; text-align: center; font-size: 22px; line-height: 1.65; }
.quote { margin: 16px 0; padding: 14px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--bg); }
.quote-text { font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.quote-src { margin-top: 9px; color: var(--muted); font-size: 12px; }
.quote-src a { color: var(--accent); }
.takeaway { margin: 16px 0 4px; padding: 12px 14px; border-radius: 10px; background: #FFF4E8; color: var(--ink); font-weight: 600; }
.chant-line { padding: 18px 0; border-bottom: 1px solid var(--line); }
.chant-line .pali { color: var(--ink); font-size: 16px; }
.chant-line .thai { margin: 4px 0; line-height: 1.9; }
.chant-zh { font-size: 18px; line-height: 1.9; }
.mean { padding: 8px 10px; color: var(--muted); font-size: 14px; }
.counter { margin: 20px 0 4px; text-align: center; }
.counter .main-btn { margin-top: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 16px; text-align: center; }
.cal span { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 50%; color: var(--muted); font-size: 13px; }
.cal span.did { background: var(--accent); color: #FFF; font-weight: 600; }
.bubble { max-width: 88%; margin: 10px 0; padding: 10px 13px; border-radius: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { margin-left: auto; background: #F2E4D5; }
.bubble.assistant { margin-right: auto; background: var(--bg); }
.askbox { display: flex; align-items: stretch; gap: 8px; margin-top: 16px; }
.askbox.ask-form { max-width: 480px; margin: 0 auto; }
.askbox input { flex: 1; min-width: 0; }
.askbox .main-btn { flex: 0 0 auto; width: auto; min-height: 48px; margin: 0; padding: 0 16px; }
input, textarea { border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; }
input { min-height: 46px; padding: 8px 12px; }
textarea { display: block; width: 100%; min-height: 110px; margin-top: 16px; padding: 12px; resize: vertical; }
#weekly-note { width: 100%; margin-top: 8px; }
.teacher-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.teacher-row p { margin: 0 0 8px; white-space: pre-wrap; }
.teacher-row input { width: 100%; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 48px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.check input { flex: 0 0 auto; width: 22px; min-height: 22px; margin-top: 3px; accent-color: var(--accent); }
.crisis { padding: 14px; border-radius: 10px; background: #FFF0E8; color: #8A321D; font-weight: 600; }
.passage.mark { padding-left: 10px; border-left: 3px solid var(--accent); background: #FFF4DC; }
.passage a { color: var(--accent); font-size: 13px; }
.source-link { color: var(--accent); font-size: 12px; overflow-wrap: anywhere; }
.modal-box { width: 100%; max-width: 360px; padding: 22px; border-radius: 16px; background: var(--card); box-shadow: 0 12px 40px rgba(59,47,37,.18); }
.modal-box h2 { margin-top: 0; }
.modal-box .link-btn { display: block; margin: 14px auto 0; }
.link-btn { min-height: 34px; padding: 5px 4px; font-size: 13px; }
.tabs { max-width: 480px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tab { text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(200,116,43,.35); outline-offset: 2px; }
@media (max-width: 360px) {
  #app { padding-left: 12px; padding-right: 12px; }
  .card { padding: 16px; }
  .temple-name { font-size: 19px; }
  .lang-btn { min-width: 39px; padding: 0 6px; }
  .guide-step { font-size: 20px; }
}

/* v3-F 内容页 */
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.stat b { font-weight: 600; font-variant-numeric: tabular-nums; }
.top-kind { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: #FFF4E8; font-size: 15px; }
.row.wrap { align-items: stretch; }
.row.wrap .opt-inline { flex: 1 1 42%; }
.trouble-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.trouble-row p { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.todo.locked { color: var(--muted); opacity: .75; }
.steps { margin: 8px 0 0; padding-left: 20px; }
.steps li { margin: 8px 0; line-height: 1.75; }
.gloss { padding: 11px 0; border-bottom: 1px solid var(--line); }
.gloss-main { font-size: 16px; }
.gloss-sub { margin-top: 3px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.gloss-input { width: 100%; min-height: 46px; padding: 8px 12px; }
.link-btn.inline { display: inline; min-height: 0; padding: 0; font-size: 12px; }
.todo.resume { background: #FFF9F3; }
