/* Shared visual rhythm and accessible contrast, applied after the legacy theme. */
body[data-theme=dark]{--text-2:#c1cadd;--text-3:#a2adc5;--ui-shadow:0 8px 26px #00000012;--ui-accent:#45d5c5}
body[data-theme=light]{--text-2:#44516c;--text-3:#596780;--ui-shadow:0 6px 20px #162c5010;--ui-accent:#087e75}
.product-ui .appbar{gap:12px;padding-block:22px 18px;align-items:center}
.product-ui .appbar>div:first-child{min-width:0;flex:1}.product-ui .appbar h2{line-height:1.55;font-size:21px;overflow-wrap:anywhere}
.product-ui .appbar .sub{font-size:11px;line-height:1.8;margin-top:5px;color:var(--text-3)}
.product-ui .sect{margin-top:25px;margin-bottom:13px;gap:12px}.product-ui .sect h3{font-size:15px;line-height:1.7}
.product-ui .card{border-radius:23px;box-shadow:var(--ui-shadow)}
.product-ui a.card,.product-ui a.row,.product-ui a.artrow,.product-ui a.errrow{color:var(--text-1);text-decoration:none}
.product-ui .row,.product-ui .artrow,.product-ui .errrow{border-radius:18px;min-width:0;gap:12px}
.product-ui .row .rl,.product-ui .artrow .rl,.product-ui .errrow .rl{min-width:0;flex:1}
.product-ui .rl b{font-weight:700;line-height:1.7;overflow-wrap:anywhere}
.product-ui .rl>span{display:block;color:var(--text-3);font-size:11px;line-height:1.8;margin-top:5px}
.product-ui .tiny,.product-ui .t-caption{line-height:1.85}
.product-ui .btn,.product-ui .field{border-radius:15px}.product-ui .btn{font-weight:700;box-shadow:none;line-height:1.7}
.product-ui .btn-primary{background:linear-gradient(110deg,#087c89,#4855c7);color:#fff!important;border:1px solid transparent}
.product-ui .btn-ghost{border:1px solid var(--stroke);background:var(--surface);color:var(--text-1)}
.product-ui .field{border:1px solid var(--stroke);background:var(--surface);min-width:0;line-height:1.7}
.product-ui input::placeholder,.product-ui textarea::placeholder{color:var(--text-3);opacity:1}
.product-ui .iconbtn,.product-ui .cbtn{border-radius:13px}.product-ui .chipbtn{min-height:44px;border:1px solid var(--stroke);font-size:12px}
.product-ui button:disabled{cursor:not-allowed}.product-ui button[aria-busy=true]{cursor:wait}
.product-ui .ic{stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.product-ui .sect h3>.ic,.product-ui .appbar h2>.ic{color:var(--ui-accent)}
.product-ui .iconbox,.product-ui .di,.product-ui .ci{color:var(--ui-accent)}
.product-ui .form-error{color:var(--text-1);border-inline-start:3px solid #d76175;background:#c5455c0c;border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.8}
.product-ui .form-error:empty{display:none}.text-action{border:0;background:none;color:var(--ui-accent);padding:8px;min-height:44px;font-size:12px}
.ui-state{display:flex;flex-direction:column;align-items:center;gap:12px;padding:30px 22px;border:1px dashed var(--stroke);border-radius:22px;text-align:center;background:var(--surface)}
.ui-state>.ic{width:34px;height:34px;color:var(--text-3)}.ui-state h3{margin:0;font-size:16px}.ui-state p{font-size:12px;line-height:1.9;color:var(--text-3);margin:0}.ui-state .btn{width:100%;max-width:270px}.ui-state.compact{padding:18px}
.product-ui .empty-state,.product-ui .emptystate{line-height:1.9;color:var(--text-3)}
.product-ui .emptystate>b{display:block;margin-bottom:8px;color:var(--text-1)}
.product-ui .flame-body{fill:url(#flame-tint);stroke:currentColor;stroke-width:1.6}
.product-ui .flame-core{fill:currentColor;stroke:none}
.product-ui .streak-stat{color:var(--text-1);background:var(--surface);border-color:var(--stroke)}
.product-ui .streak-stat svg.ic{color:var(--ui-accent);fill:none;width:24px;height:24px;flex:0 0 24px;stroke-width:1.75;transform:none}
.product-ui .hero-kicker{color:var(--ui-accent)}.product-ui .lesson-hero-ic .ic{color:white!important}
.product-ui .tab .lb{font-size:11px}.product-ui .tab.on{color:var(--ui-accent)}
/* Directory cards must shrink inside their grid instead of forcing horizontal overflow. */
[data-page=explore] .dirlist{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:0}
[data-page=explore] .dircell{padding:15px 12px;gap:11px;min-width:0;min-height:104px;align-items:flex-start}
[data-page=explore] .dircell .di{width:40px!important;height:40px!important;flex-basis:40px;border-radius:13px!important}
[data-page=explore] .dircell .di .ic{width:24px;height:24px}
[data-page=explore] .dt{min-width:0;flex:1}[data-page=explore] .dt b{line-height:1.8;white-space:normal}[data-page=explore] .dt span{line-height:1.8;white-space:normal;font-size:10px}
[data-page=explore] .dircell.disabled{opacity:.65}
/* Reading libraries and exercises. */
.product-ui .artrow{padding:17px;display:flex;align-items:center}.product-ui .artrow .ac{width:42px;height:48px;flex:0 0 42px;border-radius:13px;color:var(--ui-accent)}
.product-ui .errrow{padding:15px;align-items:center}.product-ui .ipabox{width:43px;height:43px;flex:0 0 43px;display:grid;place-items:center;border-radius:13px;overflow:hidden;color:var(--ui-accent)}
.product-ui .ipabox .ic{width:24px;height:24px}
[data-page=reader] .card .en{font-size:16px;line-height:2!important}
[data-page=grammar_lesson] .card .en{line-height:1.9}.grammar-quiz{margin-top:24px}
[data-page=pronunciation_item] .card:first-child .en:first-child{font-size:30px!important;line-height:1.5;overflow-wrap:anywhere}
[data-page=pronunciation_item] #rec-status{font-size:12px;line-height:1.9}
/* Lookup and note-taking: one clear search row, then the content. */
[data-page=dictionary] #dict-result>.card{background:linear-gradient(145deg,#1ba99b0e,#6573c60c)!important;border-color:var(--stroke)!important}
[data-page=dictionary] #dict-result .en{font-family:var(--f-en,sans-serif);text-align:left!important}
[data-page=dictionary] #dict-result .en[style*="gold"]{color:var(--text-3)!important}
[data-page=dictionary] #dict-result .en:first-child{line-height:1.6;overflow-wrap:anywhere}
.dict-word-head{display:flex;direction:ltr;justify-content:space-between;align-items:flex-start}
[data-page=dictionary] #dict-go{background:linear-gradient(135deg,#087c89,#4855c7);color:white;box-shadow:none}
[data-page=dictionary] #recent-slot button{cursor:pointer;min-height:40px;padding:7px 13px}
[data-page=notes] #search-actions{border:0;background:none;padding:0;box-shadow:none;justify-content:flex-start}
[data-page=notes] .searchbar input{min-width:0}[data-page=notes] .note-card{display:block;text-decoration:none}.note-card .bidi-line{font-size:13px}
/* Compact, legible metrics and achievement cards. */
.progress-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.progress-stats .mini{padding:15px 10px;margin:0;min-width:0}.progress-stats .mv{color:var(--text-1)!important;font-size:23px}.progress-stats .ml{font-size:11px;color:var(--text-3)}
[data-page=progress] .bdggrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
[data-page=progress] .bcell{padding:18px 12px;min-height:135px;aspect-ratio:auto;opacity:1;background:var(--surface);border:1px solid var(--stroke);border-radius:19px;cursor:default}
[data-page=progress] .bcell.lock2{border-style:dashed;color:var(--text-3)}[data-page=progress] .bcell .be{background:#cfa65512;border:1px solid #cfa65533;border-radius:15px;width:46px;height:46px;display:grid;place-items:center;color:#b5822d}
[data-page=progress] .bcell small,[data-page=progress] .bcell p{font-size:10px;color:var(--text-3);line-height:1.8;margin-top:5px}
/* Settings retain native keyboard behaviour with clear switch states. */
[data-page=settings] .setrow{padding-block:14px;gap:14px}
[data-page=settings] .setrow input[type=checkbox]{appearance:none;width:42px;height:25px;flex:0 0 42px;border-radius:20px;border:1px solid var(--stroke);background:var(--surface-2);position:relative;cursor:pointer;transition:background .2s}
[data-page=settings] .setrow input[type=checkbox]:after{content:'';position:absolute;width:17px;height:17px;top:3px;right:3px;background:var(--text-3);border-radius:50%;transition:transform .2s}
[data-page=settings] .setrow input[type=checkbox]:checked{background:#087c74;border-color:#087c74}
[data-page=settings] .setrow input[type=checkbox]:checked:after{background:white;transform:translateX(-17px)}
[data-page=settings] .setrow input[type=checkbox]:focus-visible{outline:3px solid var(--ui-accent);outline-offset:3px}
[data-page=login] .welcome-theme,[data-page=register] .welcome-theme{justify-content:flex-end;padding:16px 20px}
[data-page=login] #welcome-theme button,[data-page=register] #welcome-theme button{border-color:var(--stroke);border-radius:14px;background:var(--surface);color:var(--text-2)}
[data-page=login] #email,[data-page=register] #email{direction:ltr;text-align:left}
.live-level{appearance:none;border:0;border-radius:8px;overflow:hidden;background:var(--surface-2);height:5px}.live-level::-webkit-progress-bar{background:var(--surface-2)}.live-level::-webkit-progress-value{background:var(--ui-accent);border-radius:8px}
.live-level::-webkit-meter-bar{background:var(--surface-2);border:0;border-radius:8px;height:5px;box-shadow:none}.live-level::-webkit-meter-optimum-value{background:var(--ui-accent);border-radius:8px}.live-level::-moz-meter-bar{background:var(--ui-accent);border-radius:8px}
@media(max-width:360px){[data-page=explore] .dircell{flex-direction:column;gap:9px;padding:13px;min-height:135px}[data-page=explore] .dircell .di{flex-basis:40px}.product-ui .appbar h2{font-size:19px}.product-ui .appbar{gap:8px}}
@media(min-width:900px){.phone{max-width:720px}.product-ui .screen>.pad,.product-ui .screen>.sect,.product-ui .screen>.appbar{padding-inline:30px}.product-ui .screen{scrollbar-gutter:stable}.product-ui .dirlist{grid-template-columns:repeat(3,minmax(0,1fr))}[data-page=explore] .dirlist{grid-template-columns:repeat(3,minmax(0,1fr))}.product-ui .bigtile{padding-block:20px}.product-ui .sheet{max-width:680px}.chat-page #chat-messages{padding-inline:28px!important}.profile-page{max-width:660px;margin-inline:auto}.flashcard-stage{max-width:560px;margin-inline:auto}.flashcard-grades{max-width:560px;margin-inline:auto}.live-hero{max-width:560px;margin-inline:auto}.audio-player{max-width:520px}[data-page=progress] .progress-stats{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(min-width:900px){.phone{max-width:720px!important}.phone:before{display:none}[data-page=explore] .dirlist{grid-template-columns:repeat(4,minmax(0,1fr))}[data-page=explore] .dircell{flex-direction:column;min-height:130px;gap:10px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}
/* Weekly activity: real calendar dates and an explicit today marker. */
.product-ui .weekly-card{background:linear-gradient(135deg,#18b8a509,transparent),var(--surface);padding:20px}
.week-summary{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:22px;font-size:12px;color:var(--text-2)}.week-summary>b{font-size:20px;color:var(--text-1)}.week-summary small{font-size:11px;font-weight:500;color:var(--text-3)}
.week-calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:7px;direction:rtl}
.week-day{display:flex;flex-direction:column;align-items:center;gap:10px;min-width:0;animation:week-appear .45s both;animation-delay:var(--day-delay)}
.week-name{font-size:11px;color:var(--text-3)}.week-date{position:relative;width:38px;height:42px;display:grid;place-items:center;border:1px solid var(--stroke);border-radius:14px;font-size:13px;font-weight:700;color:var(--text-2);background:var(--surface-2)}
.week-status{font-size:9px;min-height:16px;color:var(--text-3);white-space:nowrap}
.week-day.current .week-date{background:#087f78;color:white;border-color:#087f78;box-shadow:0 0 0 4px #18b8a512;animation:week-today 3s ease-in-out infinite}
.week-day.current .week-name,.week-day.current .week-status{color:var(--ui-accent);font-weight:700}
.week-day.complete .week-date{background:#159e8e18;color:var(--ui-accent);border-color:#159e8e55}.week-day.complete.current .week-date{background:#087f78;color:white}.week-date .ic{width:20px;height:20px}
.week-day.future .week-date{background:transparent;border-style:dashed;color:var(--text-3)}
.weekly-card>.muted{font-size:11px;border-top:1px solid var(--stroke);padding-top:15px;margin-top:15px!important}
/* The lesson trail uses actual task skills and completion states. */
.product-ui .steps5{display:block!important;margin:18px 0 8px;padding:0;min-height:0;overflow:visible}
.lesson-trail{border:1px solid var(--stroke);border-radius:22px;overflow:hidden;background:radial-gradient(ellipse at 85% 0%,#11b9a51a,transparent 70%),var(--surface)}
.trail-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:16px 16px 0;color:var(--text-2);font-size:11px}.trail-heading b{font-size:20px;color:var(--ui-accent)}.trail-heading small{font-size:10px;font-weight:500;color:var(--text-2)}
.trail-scroll{overflow-x:auto;direction:rtl;scrollbar-width:thin;scrollbar-color:var(--stroke) transparent;outline-offset:-3px}
.trail-map{position:relative;height:214px;width:100%;margin-inline:auto;direction:ltr;max-width:none}
.trail-lines{position:absolute;inset:0;width:100%;height:214px;fill:none;stroke-width:3;stroke-linecap:round}
.trail-landscape{fill:#12b7a507;stroke:none}.trail-contour{stroke:#12b7a50c;stroke-width:1}.trail-track{stroke:var(--stroke);stroke-width:6;opacity:.55}.trail-fill{stroke:var(--ui-accent);stroke-width:4;stroke-dasharray:100;stroke-dashoffset:100;transition:stroke-dashoffset 1.4s cubic-bezier(.25,.7,.3,1);transition-delay:var(--trail-delay)}.progress-visible .trail-fill.filled{stroke-dashoffset:0}
.trail-spark{fill:var(--ui-accent);stroke:var(--surface);stroke-width:2;filter:drop-shadow(0 0 4px #10b8a5);opacity:0}.progress-visible .trail-spark{opacity:1}
.trail-stop{position:absolute;transform:translate(-50%,-25px);display:flex;align-items:center;flex-direction:column;gap:12px;width:70px;direction:rtl;z-index:1}
.trail-symbol{position:relative;display:grid;place-items:center;width:50px;height:50px;border-radius:50%;border:1px solid var(--stroke);color:var(--text-3);background:var(--surface);box-shadow:0 5px 0 var(--surface-2),0 9px 16px #0000000c}
.trail-symbol>.ic{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.progress-visible .trail-stop{animation:trail-arrive .65s cubic-bezier(.2,.75,.25,1) both;animation-delay:var(--stop-delay)}
.trail-label{font-size:10px;color:var(--text-2);white-space:nowrap;background:var(--surface);border-radius:7px;padding:2px 5px}.trail-stop.complete .trail-symbol{color:var(--ui-accent);background:linear-gradient(145deg,var(--surface),var(--surface-2));border:2px solid #0db4a270}
.trail-check{position:absolute;bottom:-2px;left:-2px;width:18px;height:18px;border-radius:50%;display:grid;place-items:center;background:#087f78;color:white;border:2px solid var(--surface)}.trail-check .ic{width:10px;height:10px}
.trail-stop.current .trail-symbol{color:white;background:linear-gradient(145deg,#1bb9a2,#08736e);border:2px solid #72e4ce;box-shadow:0 5px 0 #075f59,0 10px 20px #07857c35}
.trail-stop.current .trail-symbol:before{content:'';position:absolute;inset:-7px;border:2px solid transparent;border-top-color:var(--ui-accent);border-bottom-color:#14b8a525;border-radius:50%;opacity:.7}.progress-visible .trail-stop.current .trail-symbol:before{animation:trail-orbit 7s linear infinite}
.progress-visible .trail-stop.current .trail-symbol{animation:trail-beacon 3s ease-in-out infinite}.trail-stop.current .trail-label{color:var(--ui-accent);font-weight:700}
.trail-stop.finish .trail-symbol{border-style:dashed;background:var(--surface-2)}.trail-stop.finish.complete .trail-symbol{background:#087f78;color:white;border-style:solid;animation:trail-celebrate .7s ease-out}
.product-ui .trail-stop .trail-here{position:absolute;bottom:calc(100% + 15px);font-size:9px;font-weight:700;white-space:nowrap;padding:4px 9px;border-radius:8px;background:#087f78;color:#fff;box-shadow:0 3px 10px #087f7818}.trail-here:after{content:"";position:absolute;top:100%;left:calc(50% - 3px);border:3px solid transparent;border-top-color:#087f78}
.trail-next{display:flex;gap:12px;align-items:center;margin:0 12px 12px;padding:12px;border:1px solid var(--stroke);border-radius:15px;background:var(--surface)}.trail-next>.ic{width:18px;height:18px;padding:8px;box-sizing:content-box;flex-shrink:0;border-radius:11px;background:#14b8a510;color:var(--ui-accent)}.trail-next>div{min-width:0}.trail-next small{display:block;font-size:10px;color:var(--ui-accent);margin-bottom:4px}.trail-next strong{display:block;font-size:12px;line-height:1.9;color:var(--text-1);overflow-wrap:anywhere}
@keyframes trail-arrive{from{opacity:0;translate:0 8px}to{opacity:1;translate:0 0}}
@keyframes trail-orbit{to{rotate:360deg}}
@keyframes trail-beacon{50%{box-shadow:0 5px 0 #075f59,0 12px 28px #07857c50}}
@keyframes trail-celebrate{0%{scale:.8}60%{scale:1.12}100%{scale:1}}
@media(prefers-reduced-motion:reduce){.trail-spark{display:none}.trail-stop.current .trail-symbol:before{animation:none!important}}
.reduce-motion .trail-spark{display:none}
@keyframes week-appear{from{opacity:0;translate:0 6px}to{opacity:1;translate:0 0}}
@keyframes week-today{50%{box-shadow:0 0 0 6px #18b8a525}}
@media(max-width:350px){.product-ui .weekly-card{padding:16px 12px}.week-calendar{gap:3px}.week-date{width:30px;height:36px;border-radius:11px}.week-status{font-size:8px}.week-summary{font-size:11px}}
