.tj-screen{position:fixed;inset:0;z-index:20;display:flex;flex-direction:column;gap:4px;box-sizing:border-box;overflow:hidden;padding:max(5px,env(safe-area-inset-top)) 8px max(5px,env(safe-area-inset-bottom));background:radial-gradient(circle at 50% 10%,#faffdb 0,#d8f2dc 46%,#a8dbc9 100%);font-family:system-ui,sans-serif;color:#295349}
.tj-screen button{cursor:pointer;touch-action:manipulation}
.tj-head{display:flex;align-items:center;justify-content:space-between;gap:8px;width:min(100%,1100px);margin:0 auto;min-height:46px}
.tj-head p{margin:0;text-align:center;font-size:clamp(12px,2.3vw,19px);font-weight:800;line-height:1.2}
.tj-back,.tj-case button{flex:none;border:2px solid #fff;border-radius:14px;background:#fffdf1;color:#29605e;padding:8px 11px;font-weight:800;box-shadow:0 3px 8px #2e695c33}
.tj-case{display:flex;gap:3px;flex:none}.tj-case button[aria-pressed=true]{background:#1984ad;color:white}
.tj-scene{position:relative;flex:1;min-height:0;width:min(100%,1100px);margin:0 auto;overflow:hidden;border:4px solid #f5e4a9;border-radius:26px;background:radial-gradient(ellipse at 50% 80%,#96ce81 0,#b9e2a0 53%,#ddf4c7 100%);box-shadow:inset 0 8px 24px #588e6f30,0 5px 18px #3771653d}
.tj-scene:after{content:'';position:absolute;inset:auto 0 0;height:16%;pointer-events:none;background:linear-gradient(transparent,#669f7950)}
.tj-arrows{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;opacity:.72}.tj-arrows>path{fill:none;stroke:#6e947f;stroke-width:5;stroke-dasharray:13 13;marker-end:url(#tj-tip)}
.tj-platform{position:absolute;z-index:2;display:flex;align-items:center;justify-content:center;gap:0;width:clamp(90px,22%,190px);height:clamp(60px,14%,110px);padding:0;border:3px solid #f8f4db;border-radius:19px;box-shadow:0 10px 0 #426a7a,0 17px 15px #294c454e;transform:translateX(-50%);transition:filter .2s,transform .2s}
.tj-platform:not(:disabled):hover{filter:brightness(1.06);transform:translateX(-50%) translateY(-3px)}.tj-platform:disabled{cursor:default;opacity:1}
.tj-platform.single{left:77%;bottom:55%;background:linear-gradient(160deg,#a7e8fb,#269dd0 70%,#0879b4)}
.tj-platform.syllable{left:77%;bottom:17%;width:clamp(120px,29%,250px);background:linear-gradient(160deg,#a5e5f9,#278ec8 65%,#096fa7)}
.tj-platform.start{left:21%;bottom:35%;background:linear-gradient(160deg,#ffc5b9,#f16c68 65%,#c83f4f);box-shadow:0 10px 0 #a13748,0 17px 15px #294c454e}
.tj-cell{display:inline-flex;align-items:center;justify-content:center;font-size:clamp(37px,7vw,70px);font-weight:1000;line-height:1;text-shadow:0 2px 2px #2f415755}.tj-platform .tj-cell{color:#fff;flex:1}.tj-platform.syllable .tj-cell+.tj-cell{border-left:2px solid #fff9;height:78%}.tj-platform.syllable .tj-cell.vowel{background:#ed7177;border-radius:0 14px 14px 0}
.tj-hero{position:absolute;z-index:3;left:21%;bottom:49%;width:clamp(82px,15%,150px);height:clamp(120px,31%,245px);transform:translateX(-50%);display:flex;align-items:end;justify-content:center;pointer-events:none;filter:drop-shadow(0 8px 4px #416d534c)}
.tj-hero .avatar{width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain}
.tj-scene.phase-jump.route-at .tj-hero{animation:tj-hop-upper .82s ease-in-out both}.tj-scene.phase-jump.route-ata .tj-hero{animation:tj-hop-lower .82s ease-in-out both}
.tj-scene.phase-show.route-at .tj-hero{left:77%;bottom:69%}.tj-scene.phase-show.route-ata .tj-hero{left:77%;bottom:31%}
.tj-scene.phase-return.route-at .tj-hero{animation:tj-back-upper .72s ease-in-out both}.tj-scene.phase-return.route-ata .tj-hero{animation:tj-back-lower .72s ease-in-out both}
@keyframes tj-hop-upper{0%{left:21%;bottom:49%;transform:translateX(-50%) scale(1)}50%{left:49%;bottom:78%;transform:translateX(-50%) scale(1.06)}100%{left:77%;bottom:69%;transform:translateX(-50%) scale(1)}}
@keyframes tj-hop-lower{0%{left:21%;bottom:49%;transform:translateX(-50%) scale(1)}50%{left:49%;bottom:62%;transform:translateX(-50%) scale(1.06)}100%{left:77%;bottom:31%;transform:translateX(-50%) scale(1)}}
@keyframes tj-back-upper{0%{left:77%;bottom:69%;transform:translateX(-50%)}50%{left:49%;bottom:78%;transform:translateX(-50%)}100%{left:21%;bottom:49%;transform:translateX(-50%)}}
@keyframes tj-back-lower{0%{left:77%;bottom:31%;transform:translateX(-50%)}50%{left:49%;bottom:62%;transform:translateX(-50%)}100%{left:21%;bottom:49%;transform:translateX(-50%)}}
.tj-result{position:absolute;z-index:4;top:1%;left:50%;width:min(45%,370px);height:44%;min-height:130px;display:flex;flex-direction:column;align-items:center;transform:translateX(-50%);opacity:0;pointer-events:none}.tj-result.visible{opacity:1;animation:tj-reveal .35s ease-out}.tj-scene.phase-return .tj-result.visible{animation:tj-fade .72s ease-in both}@keyframes tj-reveal{from{opacity:0;transform:translateX(-50%) scale(.82)}to{opacity:1;transform:translateX(-50%) scale(1)}}@keyframes tj-fade{from{opacity:1}to{opacity:0}}
.tj-word{display:flex;align-items:center;justify-content:center;color:#fff;gap:2px;filter:drop-shadow(0 2px 2px #1e4a4b6b)}.tj-word .tj-cell{font-size:clamp(43px,8vw,84px)}.tj-word .vowel{color:#ea4478}.tj-word .consonant{color:#117bca}.tj-syllable{display:inline-flex;align-items:center;padding:0 5px;border:3px solid #2f96c7;border-radius:14px;background:#ffffffb8}.tj-syllable-hint{font-size:clamp(10px,2vw,16px);font-weight:800;color:#385b5e;line-height:1}
.tj-picture{flex:1;min-height:0;width:min(100%,290px);margin-top:0;background-repeat:no-repeat}.tj-picture.horse{background-image:url('assets/lesson-cards.png');background-size:200% 200%;background-position:0 0;mix-blend-mode:multiply;mask-image:radial-gradient(ellipse 70% 70% at 50% 50%,#000 55%,transparent 100%)}.tj-picture.grandfather img{width:100%;height:100%;object-fit:contain}
.tj-bottom{display:flex;align-items:center;justify-content:space-between;gap:10px;width:min(100%,1100px);margin:0 auto;min-height:25px;font-size:clamp(11px,2vw,14px);font-weight:700}.tj-bottom span:last-child{font-size:clamp(10px,1.8vw,13px);opacity:.76;text-align:right}
@media(max-width:600px){.tj-head{min-height:50px;flex-wrap:wrap;justify-content:center}.tj-head p{order:3;flex:1 0 100%;font-size:12px}.tj-back,.tj-case button{padding:4px 7px;font-size:12px}.tj-scene{border-width:3px;border-radius:18px}.tj-platform{height:clamp(54px,12%,80px)}.tj-platform.start{left:22%;bottom:35%}.tj-platform.single{left:77%;bottom:55%}.tj-platform.syllable{left:77%;bottom:17%}.tj-hero{left:22%;bottom:43%;width:clamp(74px,21%,110px);height:clamp(105px,28%,170px)}.tj-scene.phase-show.route-at .tj-hero{left:77%;bottom:63%}.tj-scene.phase-show.route-ata .tj-hero{left:77%;bottom:25%}.tj-result{width:55%;height:37%}.tj-word .tj-cell{font-size:clamp(40px,12vw,62px)}.tj-picture{width:min(100%,180px)}.tj-bottom{align-items:start}.tj-bottom span:last-child{max-width:45%}}
@media(max-width:600px){@keyframes tj-hop-upper{0%{left:22%;bottom:43%;transform:translateX(-50%)}50%{left:49%;bottom:78%;transform:translateX(-50%)}100%{left:77%;bottom:63%;transform:translateX(-50%)}}@keyframes tj-hop-lower{0%{left:22%;bottom:43%;transform:translateX(-50%)}50%{left:49%;bottom:62%;transform:translateX(-50%)}100%{left:77%;bottom:25%;transform:translateX(-50%)}}@keyframes tj-back-upper{0%{left:77%;bottom:63%;transform:translateX(-50%)}50%{left:49%;bottom:78%;transform:translateX(-50%)}100%{left:22%;bottom:43%;transform:translateX(-50%)}}@keyframes tj-back-lower{0%{left:77%;bottom:25%;transform:translateX(-50%)}50%{left:49%;bottom:62%;transform:translateX(-50%)}100%{left:22%;bottom:43%;transform:translateX(-50%)}}}
@media(max-height:620px){.tj-head p{font-size:11px}.tj-result{height:35%;min-height:90px}.tj-platform{height:54px}.tj-hero{height:30%}.tj-bottom{min-height:19px}}
@media(prefers-reduced-motion:reduce){.tj-scene.phase-jump .tj-hero,.tj-scene.phase-return .tj-hero,.tj-result.visible{animation-duration:.01ms!important}}

.tj-book .tj-picture{display:flex;align-items:center;justify-content:center}.tj-book .tj-picture .book-picture{width:100%;height:100%;object-fit:contain;mix-blend-mode:multiply}.tj-equation{position:absolute;bottom:calc(100% + 9px);left:50%;transform:translateX(-50%);white-space:nowrap;color:#28586b;background:#fffff0e8;border-radius:10px;padding:3px 8px;font-size:clamp(16px,2.6vw,25px);font-weight:850;pointer-events:none}.tj-book .wide-start{width:clamp(115px,25%,220px)}.tj-book .tj-platform.single{width:clamp(115px,25%,220px)}.tj-book .tj-platform.start .consonant{background:#208db8;border-radius:12px}.tj-book .tj-platform.single .vowel{background:#ed7177;border-radius:12px}.tj-book .phase-prepare .tj-platform.start{outline:4px solid #ffe38b;outline-offset:4px}.tj-book .tj-result{left:46%;width:41%}

/* T: grasp the hero; large associations stay in their corresponding reading row. */
.tj-touch .tj-hero{pointer-events:auto;touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none}
.tj-touch .tj-hero *{pointer-events:none;-webkit-user-drag:none}
.tj-touch .tj-hero[aria-disabled=true]{pointer-events:none}
.tj-touch .tj-hero:focus-visible{outline:4px solid #e3a82d;outline-offset:4px;border-radius:20px}
.tj-touch .tj-dragging .tj-hero{cursor:grabbing;transition:none;animation:none}
.tj-touch .tj-result{left:35%;width:66%;height:61%;min-height:0;top:1%;background:radial-gradient(ellipse,#fffdeccf,transparent 72%);border-radius:24px}
.tj-touch .route-ata .tj-result{top:auto;bottom:0}
.tj-touch .tj-picture{width:100%;max-width:none;min-height:0;display:flex;justify-content:center;align-items:center;background:none;mask-image:none;mix-blend-mode:multiply}
.tj-touch .tj-picture :is(img,svg){width:100%;height:100%;object-fit:contain}
.tj-touch .tj-word .tj-cell{font-size:clamp(46px,9vw,88px)}
.tj-touch .phase-show .tj-arrows{opacity:.18}
.tj-touch .phase-show.route-at .syllable,.tj-touch .phase-show.route-ata .single{opacity:.22}
.tj-touch .tj-bottom{min-height:25px}
@media(max-width:600px){.tj-touch .tj-result{width:73%;left:37%;height:61%}.tj-touch .tj-word .tj-cell{font-size:clamp(42px,12vw,64px)}}

.tj-touch .phase-show .tj-hero{z-index:5}

@media(max-height:500px) and (min-width:600px){.tj-touch .tj-head{min-height:28px}.tj-touch .tj-back,.tj-touch .tj-case button{padding:4px 8px}.tj-touch .tj-word .tj-cell{font-size:34px}.tj-touch .tj-syllable-hint{font-size:10px}.tj-touch .tj-result{height:61%}.tj-touch .tj-picture{flex:1;min-height:0}}
