/* ===== الوضع الليلي + أيقونات 3D ===== */
.thm-btn{width:38px;height:38px;border-radius:12px;border:1.5px solid rgba(37,99,235,.18);background:#fff;font-size:18px;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;flex:none;box-shadow:0 2px 8px rgba(6,43,120,.08);transition:transform .15s}
.thm-btn{position:relative;overflow:hidden}
.thm-btn:hover{transform:scale(1.08)}
.thm-i{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transition:transform .55s cubic-bezier(.5,1.6,.4,1),opacity .35s}
.thm-moon{transform:translateY(0) rotate(0);opacity:1}.thm-sun{transform:translateY(120%) rotate(-90deg);opacity:0}
html.dark .thm-moon{transform:translateY(-120%) rotate(90deg);opacity:0}html.dark .thm-sun{transform:translateY(0) rotate(0);opacity:1}
.thm-btn.spin{animation:thmPop .55s ease}
@keyframes thmPop{40%{transform:scale(.82) rotate(-20deg)}100%{transform:scale(1) rotate(0)}}
html.thm-anim,html.thm-anim *{transition:background-color .5s ease,color .5s ease,border-color .5s ease,box-shadow .5s ease!important}
::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}
@media (prefers-reduced-motion:reduce){.thm-i,.thm-btn.spin{transition:none;animation:none}}
.thm-btn.float{position:fixed;top:14px;left:14px;z-index:60}
.thm-btn.incard{position:absolute;top:14px;left:14px;z-index:2}
.anav .thm-btn{align-self:flex-start;margin:4px 6px}
@media print{.thm-btn{display:none}}

/* أيقونات المواد 3D */
.em3d{background:radial-gradient(120% 120% at 30% 15%,#fff 0%,var(--tile,#EEF3FF) 55%,color-mix(in srgb,var(--tile,#EEF3FF) 80%,#7C93C9) 100%)!important;box-shadow:inset 0 2px 0 rgba(255,255,255,.9),inset 0 -3px 6px rgba(20,40,100,.10),0 6px 14px -6px rgba(20,40,100,.35);border:1px solid rgba(255,255,255,.7)}
.em3d .ic3d{display:block;width:78%;height:78%;object-fit:contain;filter:drop-shadow(0 3px 3px rgba(0,0,0,.18));transition:transform .2s}
.em3d .ic3d-e{font-size:1.15em;filter:drop-shadow(0 2px 2px rgba(0,0,0,.2))}
a:hover .em3d .ic3d,.subj:hover .em3d .ic3d{transform:translateY(-2px) rotate(-6deg) scale(1.06)}
.cards .em3d{width:52px;height:52px;border-radius:15px;display:flex;align-items:center;justify-content:center}
.subj .em3d{width:50px;height:50px;border-radius:15px}

/* ---------- الليلي ---------- */
html.dark{color-scheme:dark;
  --bg:#0B1222;--card:#141D33;--line:#26345A;--mut:#9AA8C9;--navy:#E3EAFF;--navy2:#E3EAFF;--ink:#E6EAF7;
  --blue:#5B8CFF;--sky:#38D3FF;--orL:#3A2414;--priL:#262352;--okL:#12301F;--warnL:#33290F;--badL:#3A1A18;--priD:#C9C0FF;--warn:#F3C35B}
html.dark body{background:var(--bg)!important;color:#E3EAFF}
html.dark .thm-btn{background:#1B2643;border-color:#2E3E68}
/* اللوجو: بوكس أبيض على قده */
html.dark img[src*="logo-horizontal"]{background:#fff;border-radius:12px;padding:3px 8px;box-sizing:content-box;box-shadow:0 2px 10px rgba(0,0,0,.35)}
html.dark .em3d{background:radial-gradient(120% 120% at 30% 15%,#2B3A63 0%,#1B2643 60%,#121A30 100%)!important;border-color:#2E3E68;box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 6px 14px -6px rgba(0,0,0,.6)}

/* أسطح بيضا → كروت غامقة */
html.dark :is(.card,.box,.auth-card,.anav,.kpis div,.hdr,.sub,.cloud,.quiz,.typer,.recbar,.cmp,.sel,.subjsel,.trk,.tb,.end span,.planbar.off,.plc,.ans,.me,.p,.cnt,.st,.stg,.pc,.chat,.badge,details,.kid,.to,.tr,.plan,.save,.cards a,ol.ls,.ctabs a,.code,.k div,.it small i,.ansb,.talk button,.hint,.final,.soon,.pit,.m.ai){background-color:var(--card)!important;border-color:var(--line)!important;color:inherit}
html.dark :is(.nav,header.nav){background:rgba(11,18,34,.85)!important;border-color:var(--line)!important}
html.dark footer{background:#08101F!important;border-color:var(--line)!important}
html.dark :is(.tab.on,.anav a.on,.qa button.on,.roles a.on,.ln.on,.stg.live,.subs label:has(input:checked)){background:#1E2B52!important;color:#9DB8FF!important}
html.dark :is(.anav a:hover,.bline:hover,.step:hover,.ln:hover,.cmpb:hover,.endb:hover){background:#1B2643!important}
html.dark :is(input,select,textarea){background:#0F1830!important;color:#E3EAFF!important;border-color:#2E3E68!important}
html.dark ::placeholder{color:#6F7FA6}
html.dark :is(.btn.sec,.btn.ghost,.btn.sm.sec){background:#1B2643!important;color:#DCE6FF!important;border-color:#2E3E68!important}
html.dark .alert.ok,html.dark .flash{background:#12301F!important;color:#9BE3B5!important;border-color:#1F5235!important}
html.dark .alert.bad{background:#3A1A18!important;color:#FFB4AA!important;border-color:#5E2A26!important}
html.dark :is(.pill,.tag,.pill.b,.pill.o,.pill.r,.pill.g){filter:saturate(1.1) brightness(.9)}
html.dark .planbar{background:#2A2340!important;color:#E8DEFF!important}
/* نصوص كانت متثبتة غامق */
html.dark :is(p,li,td,th,small,label,summary,dd,dt,.lead,.muted,.hint){color:inherit}
html.dark :is(.lead,.muted,small,.hint,.crumb,.upd){color:var(--mut)!important}
html.dark :is(.legal p,.legal li,.box p,.box li,.anav a,.mh .lead){color:#C7D2EE!important}
html.dark [style*="color:#33437A"],html.dark [style*="color:#4A4766"],html.dark [style*="color:#062B78"],html.dark [style*="color:var(--navy)"]{color:#DCE6FF!important}
html.dark [style*="background:#fff"],html.dark [style*="background: #fff"],html.dark [style*="background:#FFF"],html.dark [style*="background:white"]{background:var(--card)!important}
html.dark hr{border-color:var(--line)}
html.dark table.t tr:nth-child(even) td{background:rgba(255,255,255,.02)}
/* السبورة والشهادة يفضلوا ورق أبيض زي الحقيقة */
html.dark :is(.board,.paper,.cert){color-scheme:light}
html.dark .tch{background:linear-gradient(135deg,#1E2550,#141D33)!important}
html.dark .plc{background:linear-gradient(135deg,#221F48,#14233F)!important;border-color:#3A3470!important}
.mh-top{gap:10px}
@media(max-width:700px){.hdr .thm-btn,.nav .thm-btn{width:32px;height:32px;font-size:15px;border-radius:10px}}
html.dark [style*="solid #F"],html.dark [style*="solid #E"],html.dark [style*="solid #D"]{border-color:var(--line)!important}
/* ===== الرئيسية في الليلي ===== */
html.dark .nav nav{color:#C7D2EE}
html.dark .nav nav a:hover{color:#8FB0FF}
html.dark .hero p.lead{color:#B9C6E6}
html.dark .hero h1 u:after{background:#7A3E12;opacity:.85}
html.dark .pill{background:#141D33}
html.dark .fi{background:linear-gradient(145deg,#22305A,#172243)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.08)}
html.dark .demo{background:linear-gradient(180deg,#0E1730,var(--bg))!important}
html.dark .st:before{background:linear-gradient(135deg,#3B6CF0,#2563EB)!important;color:#fff!important}
html.dark .ac{background:var(--card)!important;border:1px solid var(--line);color:#E3EAFF!important}
html.dark .ac *{color:inherit}
html.dark .ac li:before{color:#4ADE80}
html.dark .stg.live{background:#10291C!important;border-color:#1F6B3E!important}
html.dark .tag.g{background:#14361F;color:#86EFAC}html.dark .tag.o{background:#3A2414;color:#FDBA74}
html.dark .m.ai{background:#1B2643!important}
html.dark .hint{background:#0F1830!important;border-color:#2E3E68!important}
html.dark .final{background:var(--card)!important;box-shadow:none}
html.dark .pc li.x{color:#6F7FA6}
/* السبورة: ورقة فاتحة بخط غامق في الوضعين */
html.dark .board,html.dark .paper{--navy:#062B78;--navy2:#0B1F4D;--ink:#26233F;--mut:#5B6B95;--line:#E3EAF8;color:#0B1F4D!important;background-color:#fff!important}
html.dark .board :is(h1,h2,h3,h4,p,span,div,b,small){color:inherit}
html.dark .board .hlY,html.dark .board .ln.on{background:#FFF1B0!important;color:#0B1F4D!important}
html.dark .board .ln:hover{background:#F2F6FF!important}
html.dark .board .hint{background:#F5F8FF!important;border-color:#C7D5F2!important;color:#5B6B95!important}
html.dark .board .ansb{background:#FFF7D6!important}
html.dark .board .mth{color:#1E3A8A}
html.dark .board [style*="color:#33437A"],html.dark .paper [style*="color:#33437A"]{color:#33437A!important}

html.dark .thm-lt{color:#DCE6FF!important}
html.dark .roles a{color:#B9C6E6}html.dark .roles a.on{color:#9DB8FF!important;background:#1E2B52!important}
html.dark .qa button{color:#C7D2EE!important;background:#16203A!important}
html.dark .qa button.on{background:#3A2F12!important;color:#F7D774!important;border-color:#7A6320!important}
html.dark .plc b,html.dark .plc p{color:#DCE6FF!important}
html.dark .plc .btn-s{background:#1B2643!important;color:#DCE6FF!important}
html.dark #ttsB{color:#C9C0FF!important;background:#221F48!important}
html.dark .tch b{color:#E6EAF7!important}

.roles a{display:flex;align-items:center;justify-content:center;gap:7px}
.roles .ri{width:19px;height:19px;flex:none;transition:transform .2s}
.roles a.on .ri{transform:scale(1.12)}
html.dark .board .sub,html.dark .board .sub *{color:#DCE6FF!important}
html.dark .board .sub{background:#141D33!important}

/* أيقونات السبورة والكتابة (SVG) */
.t svg{width:18px;height:18px}.cmpb svg{width:22px;height:22px}.mic svg{width:30px;height:30px}.voice .mic svg{width:24px;height:24px}
.t{transition:background .15s,color .15s}.t:hover{background:var(--priL);color:var(--pri)}
.t.on{background:var(--pri)!important;color:#fff!important;box-shadow:0 4px 12px rgba(108,85,232,.35)}
.cmpb{color:var(--pri);transition:transform .15s,background .15s}.cmpb:hover{background:var(--priL);transform:scale(1.06)}
html.dark .t{color:#B8B2FF}
html.dark .t:hover{background:#26245A;color:#E1DCFF}
html.dark .t.on{background:linear-gradient(135deg,#8D7BFF,#6C55E8)!important;box-shadow:0 0 14px rgba(141,123,255,.6)}
html.dark .cmpb{color:#9EE7FF;filter:drop-shadow(0 0 6px rgba(56,211,255,.45))}
html.dark .cmpb:hover{background:#13304A}
html.dark .mic{background:linear-gradient(135deg,#A797FF,#6C55E8);box-shadow:0 0 0 6px rgba(141,123,255,.18),0 0 26px rgba(141,123,255,.55)!important}
html.dark .mic.send{background:linear-gradient(135deg,#38D3FF,#2563EB);box-shadow:0 0 0 6px rgba(56,211,255,.16),0 0 26px rgba(56,211,255,.5)!important}
html.dark .mic.rec{background:linear-gradient(135deg,#FFAA7F,#F4794A);box-shadow:0 0 0 6px rgba(244,121,74,.2),0 0 26px rgba(244,121,74,.55)!important}
/* ألوان القلم */
html.dark .tb .c{border-color:#0F1830;box-shadow:0 0 0 1px #3A4A72}
html.dark .tb .c.on{box-shadow:0 0 0 2px #A797FF,0 0 10px rgba(167,151,255,.7)}

/* زرار الإرسال: طيارة ورق مليانة ومتجهة لليسار (عربي) */
.mic.send svg{transform:scaleX(-1) translateX(1px)}
/* إنهاء الحصة في الليلي: نيون بينك، إطار أبيض، من غير خلفية */
html.dark .endb{background:transparent!important;color:#FF5FA2!important;border:1.5px solid #fff!important;
  text-shadow:0 0 4px #FF5FA2,0 0 10px rgba(255,95,162,.8),0 0 18px rgba(255,95,162,.5);
  box-shadow:0 0 6px rgba(255,255,255,.55),0 0 14px rgba(255,95,162,.35),inset 0 0 6px rgba(255,255,255,.25)}
html.dark .endb:hover{background:transparent!important;box-shadow:0 0 10px rgba(255,255,255,.8),0 0 22px rgba(255,95,162,.6),inset 0 0 8px rgba(255,255,255,.35)}
/* أدوات السبورة بيضا في الليلي */
html.dark .tb .t{color:#fff!important}
html.dark .tb .t:hover{background:rgba(255,255,255,.1)!important}
html.dark .tb .t.on{background:linear-gradient(135deg,#8D7BFF,#6C55E8)!important;color:#fff!important}
/* ألوان القلم: لازم تفضل بلونها الحقيقي */
html.dark .tb .c[data-c="#2B3A7A"]{background:#2B3A7A!important;box-shadow:0 0 0 1.5px #8EA0E8}
html.dark .tb .c[data-c="#E5484D"]{background:#E5484D!important}
html.dark .tb .c[data-c="#2F7BEA"]{background:#2F7BEA!important}
html.dark .tb .c[data-c="#1E9E6A"]{background:#1C9A6A!important}

/* المايك: كبسولة لامعة مع حلقة بتنبض */
.mic:not(.send):not(.rec){background:radial-gradient(120% 120% at 30% 20%,#B3A6FF 0%,#7C66F0 45%,#5A43D6 100%)!important}
.mic:not(.send):not(.rec):before{content:"";position:absolute;inset:4px;border-radius:50%;background:linear-gradient(180deg,rgba(255,255,255,.35),rgba(255,255,255,0) 55%);pointer-events:none}
.mic:not(.send):not(.rec):after{content:"";position:absolute;inset:-6px;border-radius:50%;border:2px solid rgba(124,102,240,.45);animation:micPulse 2.4s ease-out infinite;pointer-events:none}
@keyframes micPulse{0%{transform:scale(.92);opacity:.9}70%{transform:scale(1.18);opacity:0}100%{opacity:0}}
.mic svg{filter:drop-shadow(0 2px 3px rgba(40,20,120,.35));position:relative;z-index:1}
.mic:active{transform:scale(.94)}
html.dark .mic:not(.send):not(.rec):after{border-color:rgba(167,151,255,.6)}
@media (prefers-reduced-motion:reduce){.mic:after{animation:none!important}}
.mic:not(.send):not(.rec) svg{width:34px;height:34px}.voice .mic:not(.send):not(.rec) svg{width:28px;height:28px}
html.dark .cmp input{background:transparent!important;border:0!important}

/* شارة التجربة في هيدر الطالب */
.pro.trialb{background:linear-gradient(135deg,#0EA5E9,#14B8A6)!important;color:#fff!important;border-color:transparent!important;box-shadow:0 3px 12px rgba(14,165,233,.35)}
.pro.trialb svg{animation:hg 3s ease-in-out infinite}@keyframes hg{0%,70%{transform:rotate(0)}85%,100%{transform:rotate(180deg)}}
html.dark .pro.trialb{box-shadow:0 0 14px rgba(20,184,166,.55)}
