/* One stable card, two distinct faces; drag translates the card itself. */
#wordGrid>#flashcard,#wordGrid>#nextFlashcard{display:block!important;position:relative!important;grid-template-rows:none!important;overflow:hidden!important;transition:transform 90ms ease-out,opacity 90ms ease-out!important;touch-action:none!important;user-select:none;-webkit-user-select:none;cursor:grab}
#wordGrid>#flashcard:active{cursor:grabbing}#wordGrid>#flashcard[data-dragging=true]{transition:none!important}
#wordGrid .flashcard>.flash-art{position:absolute!important;inset:50px 12px 32px!important;width:auto!important;height:auto!important;display:flex!important;align-items:center!important;justify-content:center!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important;visibility:visible!important}
#wordGrid .flashcard>.flash-art img{width:100%!important;height:100%!important;object-fit:contain!important}
#wordGrid .flashcard.flipped>.flash-art{visibility:hidden!important;pointer-events:none!important}
#wordGrid .flashcard>.flash-answer{position:absolute!important;inset:48px 12px 32px!important;height:auto!important;min-height:0!important;width:auto!important;margin:0!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:12px!important}
#wordGrid .flashcard:not(.flipped)>.flash-answer{visibility:hidden!important;pointer-events:none!important}
#wordGrid .flashcard .flash-back-picture{width:100%!important;height:42%!important;max-height:180px!important;object-fit:contain!important;flex:0 1 42%;min-height:0!important;pointer-events:none}
#wordGrid .flash-answer .chinese-line,#wordGrid .flash-answer .word-unit{justify-content:center!important;flex-wrap:nowrap!important;width:auto!important;max-width:100%!important}
#wordGrid .flash-answer .hanzi{font-size:clamp(34px,10vw,62px)!important;line-height:1.2!important}
#wordGrid .flash-answer .meaning{font-size:18px!important;line-height:1.25!important;margin:0!important;text-align:center}
#wordGrid .flash-answer .meaning:empty{display:none!important}.flash-face-hint{position:absolute;bottom:9px;left:8px;right:8px;text-align:center;color:#718269;font:500 12px/1.2 system-ui;pointer-events:none}
#wordGrid .flashcard>.flash-art.has-family-relation{padding-bottom:32px!important}#wordGrid .flashcard>.flash-answer.has-family-relation{padding-bottom:30px!important}
#flashActions button{font:800 30px/1 system-ui!important;touch-action:manipulation!important}
#wordGrid .flashcard,#question .catalogue-card,#question .catalogue-grid{animation:none!important}.catalogue-card img{background:transparent!important}
.family-tree-entry{font-size:14px!important;min-height:34px!important;grid-column:1/-1!important;padding:5px!important}.family-tree-dialog{width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 24px);box-sizing:border-box;padding:14px;border:1px solid #bed3ae;border-radius:24px;background:#fbfdf8;color:#284f38;overflow:auto}.family-tree-dialog::backdrop{background:#203c3355}.family-tree-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.family-tree-heading h2{font-size:22px;margin:0}.family-tree-heading button{width:36px;height:36px;min-height:36px;padding:0;border-radius:12px}.family-tree-note{text-align:center;font-size:13px;margin:7px 0;color:#658063}.family-tree-map{width:100%;aspect-ratio:400/440;position:relative;max-height:530px;min-height:310px}.family-tree-map svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}.family-tree-node{position:absolute!important;width:22%!important;height:22%!important;min-height:0!important;padding:4px!important;transform:translateX(-50%);border:1px solid #ccddbf!important;border-radius:16px!important;background:#fff!important;box-shadow:none!important;display:flex!important;flex-direction:column;justify-content:center;align-items:center;gap:3px;overflow:hidden}.family-tree-node img{height:46%!important;width:100%!important;object-fit:contain;min-height:0}.family-tree-node strong{font:700 clamp(18px,5vw,25px)/1.2 system-ui;white-space:nowrap}.family-tree-node small{font-size:10px;line-height:1.2;white-space:normal;color:#668061}.family-tree-node .family-relation{display:none!important}.family-tree-node.has-family-relation{padding:4px!important}.family-tree-node[data-family-node=我]{height:15%!important;background:#e8f3da!important}.family-tree-side{position:absolute;top:0;width:50%;text-align:center;font-size:13px;font-weight:700;color:#5e7854}.family-tree-side.mother{left:50%}html[data-appearance=night] .family-tree-dialog{background:var(--night-bg);color:var(--night-text)}html[data-appearance=night] .family-tree-node{background:var(--night-raised)!important;color:var(--night-text)!important}
@media(max-height:680px){#wordGrid .flashcard>.flash-answer{gap:7px!important}#wordGrid .flashcard .flash-back-picture{max-height:130px!important}#wordGrid .flash-answer .meaning{font-size:15px!important}.flash-face-hint{font-size:11px}}
@media(max-height:430px) and (orientation:landscape){#wordGrid .flashcard>.flash-answer{inset:36px 12px 20px!important;flex-direction:row!important;gap:12px!important}#wordGrid .flashcard .flash-back-picture{width:35%!important;height:100%!important;flex:0 1 35%!important}#wordGrid .flash-answer .hanzi{font-size:34px!important}.family-tree-dialog{width:min(500px,calc(100vw - 24px))}.family-tree-map{min-height:300px}}
@media(prefers-reduced-motion:reduce){#wordGrid>#flashcard,#wordGrid>#nextFlashcard{transition:none!important}}
.family-tree-side.father{left:0!important}.family-tree-side.mother{left:50%!important}
@media(max-height:430px) and (orientation:landscape){.family-tree-map{height:220px!important;min-height:220px!important;aspect-ratio:auto}.family-tree-node img{display:none!important}.family-tree-node strong{font-size:18px!important}.family-tree-note{margin:3px 0!important}.family-tree-dialog{padding:10px!important}}

/* Five siblings share one generation and one parental branch. */
.family-tree-map{aspect-ratio:400/480!important;min-height:350px!important}.family-tree-node{height:19%!important}.family-tree-node[data-family-role=sibling]{width:18%!important;height:22%!important;gap:2px!important;padding:3px!important}.family-tree-node[data-family-role=sibling] strong{font-size:clamp(17px,4.7vw,23px)!important}.family-tree-node[data-family-role=sibling] small{font-size:10px!important;white-space:nowrap}.family-tree-node[data-family-node=我]{border:2px solid #78a45d!important;background:#e8f3da!important}.family-tree-note{line-height:1.35!important}.family-tree-node small{flex:none}.family-tree-node img{flex:0 1 43%!important;height:43%!important}
@media(max-height:430px) and (orientation:landscape){.family-tree-map{height:220px!important;min-height:220px!important;aspect-ratio:auto!important}.family-tree-node[data-family-role=sibling] strong{font-size:17px!important}.family-tree-note{font-size:11px!important}.family-tree-node[data-family-role=sibling]{gap:1px!important}}
@media(max-width:360px){.family-tree-node:not([data-family-role]){padding:3px!important;gap:2px!important}.family-tree-node:not([data-family-role]) img{height:20px!important;flex:0 0 20px!important}.family-tree-node:not([data-family-role]) strong{font-size:17px!important}.family-tree-node:not([data-family-role]) small{font-size:9px!important;white-space:nowrap!important}}
/* Picture first, reveal the word on demand; one visible pinyin lamp on the card. */
body[data-learning-area=topics][data-view=lesson][data-activity=explore] #globalPinyin{display:none!important}
#wordGrid .flashcard .flash-tools{position:absolute!important;right:9px!important;top:9px!important;z-index:8;display:block!important;pointer-events:auto!important}
#wordGrid .flashcard .card-pinyin-button{width:38px!important;height:38px!important;min-height:38px!important;padding:5px!important;border:1px solid #d5e4c9!important;border-radius:12px!important;background:#f5faef!important;box-shadow:none!important;touch-action:manipulation!important}
#wordGrid .flashcard .card-pinyin-button img{width:27px!important;height:27px!important;object-fit:contain!important}#wordGrid .card-pinyin-button[aria-pressed=false]{opacity:.5}#wordGrid .card-pinyin-button[aria-pressed=true]{background:#e8f3d9!important;border-color:#95b775!important}
html body[data-learning-area=topics] #wordGrid .flashcard .flash-answer rt{visibility:hidden!important}html body[data-learning-area=topics] #wordGrid .flashcard.flipped.show-card-pinyin .flash-answer rt{visibility:visible!important}
#wordGrid .flash-answer .flash-relation-reading{font:650 16px/1.3 system-ui!important;color:#55734a;margin:5px 0!important;text-align:center}
#wordGrid .flashcard>.flash-answer{gap:15px!important}#wordGrid .flash-answer .hanzi{font-size:clamp(40px,11vw,70px)!important}#wordGrid .flash-answer rt{font-size:clamp(17px,4vw,25px)!important;line-height:1.5!important}
.word-picker-open{grid-column:1/-1;min-height:32px!important;padding:4px!important;font-size:14px!important}.topic-word-picker{box-sizing:border-box;width:min(620px,calc(100vw - 20px));height:min(680px,calc(100dvh - 20px));max-height:calc(100dvh - 20px);padding:12px;border:1px solid #bed3ae;border-radius:23px;background:#fbfdf8;color:#284f38;overflow:hidden}.topic-word-picker[open]{display:flex;flex-direction:column;gap:7px}.topic-word-picker::backdrop{background:#203c3355}.word-picker-summary{font:500 13px/1.3 system-ui;margin:0;text-align:center;color:#667e5b}.word-picker-grid{flex:1;min-height:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:7px}.word-picker-card{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:0!important;min-width:0;padding:5px!important;border:1px solid #d3e2ca;border-radius:17px;background:#fff;box-shadow:none!important;gap:3px}.word-picker-card img{height:calc(100% - 24px);width:100%;min-height:0;object-fit:contain;pointer-events:none}.word-picker-card strong{font:650 17px/1.2 system-ui;flex:none}.word-picker-card[aria-pressed=true]{border:2px solid #73a451;background:#edf6df}.word-picker-card[aria-pressed=true]:after{content:'✓';position:absolute;top:4px;right:5px;display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#3e7950;color:#fff;font:700 15px system-ui}.word-picker-card:disabled{opacity:.4}.word-picker-card .family-relation{display:none!important}.word-picker-card.has-family-relation{padding:5px!important}.word-picker-pager{flex:none}.word-picker-pager .page-dock{margin:0!important;height:31px!important;min-height:31px!important}.word-picker-pager button{height:31px!important;min-height:31px!important;padding:2px!important}.word-picker-start{height:43px!important;min-height:43px!important;flex:none;margin:0!important}.topic-word-picker .family-tree-heading{flex:none}.topic-word-picker h2{font-size:20px!important}.topic-word-picker .family-tree-heading button{height:31px!important;min-height:31px!important;width:31px!important}
html[data-appearance=night] .topic-word-picker{background:var(--night-bg);color:var(--night-text)}html[data-appearance=night] .word-picker-card{background:var(--night-panel)!important;color:var(--night-text)!important}html[data-appearance=night] .word-picker-card[aria-pressed=true]{background:var(--night-raised)!important}
@media(max-height:430px) and (orientation:landscape){.word-picker-grid{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr))}.topic-word-picker{gap:3px;padding:8px}.word-picker-summary{font-size:11px}.word-picker-card strong{font-size:14px}.word-picker-start{height:32px!important;min-height:32px!important}#wordGrid .flashcard>.flash-answer{gap:7px!important}#wordGrid .flash-answer .hanzi{font-size:36px!important}}
.word-picker-card:before{display:none!important;content:none!important}
#topicPreferences .round-counts{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:6px!important}

#question .topic-study-entry:has(#familyTreeOpen) #topicWordPickerOpen,#question .topic-study-entry:has(#familyTreeOpen) #familyTreeOpen{grid-column:auto!important}
