.stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:24px 0}.stat-card{padding:24px;background:var(--card);border:1px solid var(--line);border-radius:24px}.stat-card strong{display:block;font-size:34px;line-height:1.25;color:var(--green)}.stat-card span{display:block;color:var(--muted);font-size:15px;margin-top:8px}.activity-days{display:grid;grid-template-columns:repeat(14,minmax(0,1fr));gap:8px;margin-top:22px}.day{text-align:center;padding:13px 2px;border-radius:12px;background:#f4f0e8}.day.practiced{background:#dce9d8;color:var(--green)}.day strong{display:block;font-size:21px}.day time{font-size:12px}.memory-row{padding:25px 0;border-top:1px solid var(--line)}.memory-row:first-child{border-top:0;padding-top:0}.memory-row:last-child{padding-bottom:0}.memory-row .section-heading{margin-bottom:13px}.memory-row h3{margin-bottom:10px}.evidence{border-left:3px solid #d7dfcf;padding:5px 0 5px 15px;margin:16px 0}.evidence a{text-decoration:underline;text-underline-offset:3px}.evidence blockquote{margin:8px 0;white-space:pre-wrap}.evidence p{font-size:15px}.word-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:23px}.word-card{margin:0;display:flex;flex-direction:column}.word-card h2{font-size:32px}.pinyin{color:var(--green);font-size:19px}.translation{font-size:20px;margin:5px 0 18px}.word-card details{margin-bottom:20px}.word-status{margin-top:auto}.word-status select{flex:1;min-width:120px;width:auto}.word-status label{font-size:14px}.goal-note{padding:17px 22px;background:#e6eddf;border-radius:18px}.panel summary{cursor:pointer;font-size:19px;font-weight:600;padding:7px 0}.panel details[open]>summary{margin-bottom:13px}input[type=checkbox]{width:20px;height:20px;vertical-align:middle}.chat-heading h1{font-size:32px}.chat-heading{margin-bottom:16px}.lesson-note{margin:14px 0;padding:15px 22px}.lesson-note summary{font-size:16px}.chat-panel{padding:0;overflow:hidden;margin:18px 0;border:1px solid var(--line)}.chat-scroll{height:clamp(280px,49vh,650px);overflow-y:auto;padding:24px;overscroll-behavior:contain;scrollbar-gutter:stable}.chat-message{max-width:88%;padding:18px 21px;border-radius:21px;background:#f1eee5;margin:0 auto 20px 0;overflow-wrap:anywhere}.chat-message.user-message{margin-left:auto;margin-right:0;background:#e3ecdd;border-bottom-right-radius:5px}.chat-message.assistant-message{border-bottom-left-radius:5px}.chat-message header{display:flex;align-items:center;gap:14px;justify-content:space-between;font-size:14px;margin-bottom:10px}.chat-message header time{font-size:12px;color:var(--muted)}.chat-message .prose{white-space:normal}.chat-composer{padding:18px 24px;border-top:1px solid var(--line);background:var(--card)}.chat-composer form p{margin:0 0 10px}.chat-composer textarea{min-height:84px;max-height:180px}.chat-composer .notice{margin-bottom:13px;font-size:14px}.composer-actions{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-top:10px}.composer-actions small{font-size:13px}.lesson-tools{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:12px 0}.lesson-tools .btn{padding:9px 18px;font-size:14px;min-height:42px}.new-messages{display:block;margin:0 auto 12px}.network-status{color:var(--wine);font-size:14px;padding:0 24px 10px}.chat-status{font-size:14px;color:var(--muted);padding:0 24px 12px}.chat-composer button:disabled{opacity:.6;cursor:wait}[hidden]{display:none!important}.chat-empty{padding:50px 15px;text-align:center;color:var(--muted)}
@media(max-width:1050px){.stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.activity-days{grid-template-columns:repeat(7,minmax(0,1fr))}}
@media(max-width:600px){.stat-card{padding:17px}.stat-card strong{font-size:28px}.stat-card span{font-size:13px}.stat-grid{gap:10px}.word-grid{grid-template-columns:1fr}.activity-days{gap:5px}.day time{font-size:11px}.chat-message{max-width:96%;padding:14px}.chat-scroll{padding:14px;height:48dvh;min-height:270px}.chat-composer{padding:15px}.chat-heading h1{font-size:28px}.composer-actions{align-items:flex-end}.composer-actions small{max-width:55%}.chat-message header{gap:8px}.chat-message header time{font-size:11px}.memory-row .section-heading{gap:13px}.word-card .section-heading{flex-wrap:nowrap}.word-card .badge{white-space:nowrap}}
.chat-panel{border-radius:24px}

/* Escaped AI message formatting, shared by initial render and chat polling. */
.chat-message .lesson-rich-text p{margin:0 0 .8em;line-height:inherit}
.chat-message .lesson-rich-text ul,.chat-message .lesson-rich-text ol{margin:.65em 0 .9em;padding-left:1.6em}
.chat-message .lesson-rich-text ul{list-style:disc outside}
.chat-message .lesson-rich-text ol{list-style:decimal outside}
.chat-message .lesson-rich-text li{display:list-item;margin:.35em 0;padding-left:.15em}
.chat-message .lesson-rich-text strong{font-weight:700}
.chat-message .lesson-rich-text .lesson-message-heading{margin-top:1em}
.chat-message .lesson-rich-text>:first-child{margin-top:0}
.chat-message .lesson-rich-text>:last-child{margin-bottom:0}
