/* Stable handwriting geometry and one whole-window audio target. */
#learningTaskDialog:has(.learning-writing-board){margin-block-start:min(6dvh,48px)!important;margin-block-end:auto!important;position:fixed}
#learningTaskDialog .learning-writing-board{position:relative;width:min(260px,70vw)!important;aspect-ratio:1;contain:layout paint;touch-action:none}
#learningTaskDialog .writing-task-status{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}
.writing-task-close{position:absolute;right:10px;top:10px;background:transparent!important;border:0!important;box-shadow:none!important;font:24px/1 system-ui!important;min-height:32px;min-width:32px;padding:3px!important;color:inherit}
.stroke-choice-preview{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.stroke-teaching-tools button{transition:none!important}.learning-writing-board canvas{display:block;touch-action:none;max-width:100%}.learning-writing-board canvas[hidden]{display:none}
#reviewView .sentence-content,#detail .sentence-content{padding-top:0!important}.sentence-card,.word-card,.expression{touch-action:manipulation}.word-card{cursor:pointer}
.topic-study-entry{display:flex;gap:8px;align-items:center;margin:0 0 8px;flex:none}.topic-study-entry button{flex:1;min-width:0;font:650 13px/1.2 system-ui;min-height:38px;padding:5px 8px}.topic-study-entry .primary{margin:0!important;box-shadow:none!important}
.mode-tabs .study-locked{position:relative;opacity:.5}.mode-tabs .study-locked::after{content:'🔒';position:absolute;right:4px;top:4px;font:10px/1 system-ui}.topic-practice-choices{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:12px auto}.topic-practice-choices p{flex-basis:100%}.topic-practice-choices button{min-height:44px;margin:0!important;font-size:14px}
#lesson #back{border:1px solid var(--lotus-line);border-radius:10px;min-height:34px;padding:5px 8px;font-size:13px;font-weight:700;white-space:nowrap}
@media(max-height:650px){#learningTaskDialog .learning-writing-board{width:min(210px,60vw)!important}.topic-study-entry{margin-bottom:5px}.topic-study-entry button{min-height:32px;font-size:12px}}
#reviewView .word-card,#detailWords .word-card{grid-template-rows:minmax(0,1fr) auto auto!important}#reviewView .word-card>.nl-help,#detailWords .word-card>.nl-help{grid-row:3!important}

.writing-board{position:relative;contain:layout paint;touch-action:none}.no-picture{display:none!important}.word-card:has(.no-picture) .word-line{grid-row:1!important}.word-card:has(.no-picture)>.nl-help{grid-row:2!important}.writing-status,.stroke-status{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip-path:inset(50%)}

.stroke-name-current{display:block;min-height:32px!important;margin:4px auto 6px!important;padding:3px 14px!important;font:650 16px/1.3 system-ui!important;color:var(--lotus-ink,#31583b);background:transparent!important;box-shadow:none!important;border:0!important}.stroke-option-name{display:block;font:650 10px/1.3 system-ui;padding:0 0 3px;color:inherit;white-space:nowrap}.stroke-choice-panel button{display:flex;flex-direction:column;align-items:center;justify-content:center}.stroke-choice-panel button svg{max-height:68px}.stroke-choice-preview path{pointer-events:visiblePainted}.stroke-demo-hit{position:absolute;inset:0;width:100%;height:100%;touch-action:manipulation}.stroke-demo-hit path{pointer-events:all}

@media(max-height:430px) and (orientation:landscape){#learningTaskDialog:has(.learning-writing-board){inset:8px 0 auto!important;margin:0 auto!important;max-width:620px!important;display:grid;grid-template-columns:1fr 1fr;gap:4px 12px;max-height:calc(100dvh - 16px)!important}#learningTaskDialog:has(.learning-writing-board)>h2{grid-column:1;grid-row:1;font-size:30px!important;margin:0!important}#learningTaskDialog .stroke-teaching-tools{grid-column:1;grid-row:2;margin:0!important}#learningTaskDialog .stroke-name-current{grid-column:1;grid-row:3}#learningTaskDialog .learning-writing-board{grid-column:2;grid-row:1/6;width:min(220px,58dvh)!important;align-self:center;justify-self:center}#learningTaskDialog .stroke-choice-panel{grid-column:1;grid-row:4;margin:0!important}#learningTaskDialog:has(.learning-writing-board)>.learning-task-actions{grid-column:1;grid-row:5;margin:0!important}}
@media(max-height:430px) and (orientation:landscape){#questionBody:has(>.writing-board){display:grid!important;grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto auto;gap:4px 12px!important;align-content:center!important;justify-items:center!important;min-height:0!important;height:100%!important;padding:4px!important}#questionBody:has(>.writing-board)>.writing-heading{grid-column:1;grid-row:1;margin:0!important}#questionBody:has(>.writing-board)>.stroke-teaching-tools{grid-column:1;grid-row:2;margin:0!important}#questionBody:has(>.writing-board)>.stroke-name-current{grid-column:1;grid-row:3}#questionBody:has(>.writing-board)>.stroke-choice-panel{grid-column:1;grid-row:4;margin:0!important}#questionBody:has(>.writing-board)>.writing-board{grid-column:2;grid-row:1/5;align-self:center;width:min(240px,65dvh)!important;height:auto!important;aspect-ratio:1}}
/* All three modes keep the same rows and the same character origin. */
.stroke-teaching-tools{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;max-width:360px;gap:6px;min-height:44px;margin:6px auto!important}.stroke-teaching-tools button{width:100%;min-width:0!important;min-height:44px!important;padding:4px 3px!important;font-size:12px!important;line-height:1.15!important;transition:none!important;transform:none!important}.stroke-name-current{height:32px!important;min-height:32px!important;white-space:nowrap;line-height:24px!important}.stroke-choice-panel,.stroke-choice-panel[hidden]{display:flex!important;align-items:center;justify-content:center;min-height:94px!important;height:94px!important;flex-shrink:0;margin:6px 0!important;gap:8px}.stroke-choice-panel[hidden]{visibility:hidden!important;pointer-events:none!important}.stroke-choice-panel button{width:84px!important;height:88px!important;min-height:88px!important;flex:none;gap:3px;padding:4px!important;transition:none!important;transform:none!important}.stroke-choice-panel button svg{height:56px!important;width:76px!important;max-height:56px!important;flex:none;overflow:visible}.stroke-option-name{font-size:11px!important;line-height:16px!important;min-height:16px}.stroke-choice-preview,.stroke-demo-hit{pointer-events:none}.stroke-choice-preview path,.stroke-demo-hit path{pointer-events:visiblePainted}.learning-writing-board canvas,.writing-board canvas{image-rendering:auto;max-width:none!important}.sentence-navigation{display:none!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-card:not(.sentence-current){display:grid!important}
.custom-study-change{font:650 13px/1.3 system-ui!important;min-height:28px;padding:3px 6px!important;margin:2px 0!important;box-shadow:none!important;border:1px solid var(--lotus-line);border-radius:8px}.custom-study-dialog{box-sizing:border-box;width:min(560px,calc(100vw - 20px));max-height:calc(100dvh - 24px);padding:14px;border:1px solid var(--lotus-line);border-radius:22px;color:var(--lotus-ink);background:white;overflow:hidden}.custom-study-dialog h2{font:750 22px/1.2 system-ui;margin:0 0 4px}.custom-study-dialog>p{font:14px/1.2 system-ui;margin:0 0 8px}.custom-study-dialog input{box-sizing:border-box;width:100%;height:34px;padding:5px 10px;border:1px solid var(--lotus-line);border-radius:10px;font-size:16px;margin-bottom:8px}.custom-study-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px}.custom-study-tile{min-width:0;min-height:46px;padding:2px;border:1px solid var(--lotus-line);border-radius:9px;display:flex;flex-direction:column;align-items:center;background:transparent;box-shadow:none!important}.custom-study-tile>span{font:30px/1.1 LotusKai,serif}.custom-study-tile>small{font:10px/1.2 system-ui}.custom-study-tile[aria-pressed=true]{background:#e8f2d9!important;border-color:#76a25e!important;outline:1px solid #76a25e}.custom-study-tile:disabled{opacity:.3}.custom-study-pager{display:flex;align-items:center;justify-content:center;gap:14px;margin:6px 0}.custom-study-pager button{min-width:42px;min-height:30px;padding:2px}.custom-study-selected{display:flex;gap:4px;align-items:center;justify-content:center;min-height:38px;margin:4px 0}.custom-study-selected button{font:26px/1 LotusKai,serif;min-width:34px;min-height:34px;padding:2px;border-radius:8px}.custom-study-selected>span{font:12px system-ui;white-space:nowrap;margin-right:3px}.custom-study-actions{display:grid;grid-template-columns:1fr 2fr;gap:8px}.custom-study-actions button{min-height:40px;padding:6px;margin:0!important;font-size:14px}html[data-appearance=night] .custom-study-dialog{background:var(--night-panel);color:var(--night-text)}html[data-appearance=night] .custom-study-tile[aria-pressed=true]{background:var(--night-raised)!important}
@media(max-width:599px){.custom-study-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.custom-study-dialog{padding:12px}.custom-study-tile{min-height:42px}.custom-study-tile>span{font-size:28px}}
@media(max-height:449px) and (orientation:landscape){.custom-study-grid{grid-template-columns:repeat(7,minmax(0,1fr))}.custom-study-dialog{padding:9px}.custom-study-dialog>p{display:none}.custom-study-tile{min-height:36px}.custom-study-tile>span{font-size:25px}.custom-study-dialog input{margin-bottom:4px;height:30px}.custom-study-dialog h2{font-size:20px}.custom-study-pager{margin:3px 0}.custom-study-selected{margin:2px 0}.custom-study-actions button{min-height:34px}}

.stroke-choice-preview,.stroke-demo-hit{inset:1px!important;width:calc(100% - 2px)!important;height:calc(100% - 2px)!important}
@media(max-width:599px) and (max-height:700px){html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .review-grid{grid-template-rows:56px 132px minmax(0,1fr)!important;gap:7px!important;height:100%!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-list{grid-template-rows:56px 38px 28px!important;gap:3px 6px!important;height:132px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-card{grid-row:1/4!important;grid-template-rows:subgrid!important;padding:3px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-photo{height:56px!important;max-height:56px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-card>.nl-help{font-size:11px!important;min-height:0!important;line-height:13px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-list{grid-template-rows:repeat(var(--sentence-rows,2),minmax(0,1fr))!important;gap:6px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-card{min-height:0!important;padding:5px!important;grid-template-columns:38px minmax(0,1fr)!important;gap:5px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-picture{width:38px!important;height:38px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-words .char-sound,html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-words .punctuation{font-size:26px!important;line-height:1.2!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-content{min-height:0!important;padding:0!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-content>.nl-help{font-size:12px!important;line-height:1.2!important;margin:4px 0 0!important;min-height:0!important}}

html[data-appearance=night] .stroke-choice-panel button svg{background:#edf2e8;border-radius:8px}
@media(max-width:599px) and (max-height:700px){html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-list{grid-template-rows:44px 52px 24px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-photo{height:44px!important;max-height:44px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-line{height:52px!important;min-height:0!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-line .word-reading{line-height:1!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-line .word-hanzi{line-height:1.15!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-line .char-sound{font-size:28px!important;line-height:1.15!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-words{gap:2px 0!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-words .unit-block{margin:0!important;padding:0!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .sentence-words .unit-gloss{display:none!important}}
@media(max-width:599px) and (max-height:700px){html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-list{grid-template-rows:132px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-card{display:grid!important;grid-row:1!important;grid-template-rows:44px 44px 24px!important;height:132px!important;box-sizing:border-box;gap:3px!important;align-content:space-between!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-photo{min-height:0!important;height:44px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-line{height:44px!important}html body[data-view=play][data-study-phase=learn] #play #reviewView:not([hidden]) .word-card>.nl-help{align-self:center;line-height:11.5px!important}}
