/* محاكاة الصف والقاعة: تُحمَّل في /demo/ فقط */
.dm [hidden],.dm-frame [hidden],.dm-after[hidden],.dm-frame[hidden]{display:none!important}
.dm-hero{padding:46px 0 10px;text-align:center}
.dm-hero h1{font-size:clamp(30px,4.4vw,48px);margin:10px 0 12px}
.dm-hero p{max-width:680px;margin:0 auto;color:var(--muted);font-size:17px;line-height:1.9}
.dm{padding:22px 0 40px}
.dm-tabs{display:flex;gap:8px;justify-content:center;margin:0 auto 18px;flex-wrap:wrap}
.dm-tabs button{border:0;font:inherit;font-family:'Rubik';font-weight:600;font-size:15px;color:var(--navy);background:#fff;padding:12px 20px;border-radius:12px;cursor:pointer;box-shadow:inset 0 0 0 1.5px var(--line),inset 0 -3px 0 #d3d6e1;transition:background .15s,color .15s,transform .12s}
.dm-tabs button[aria-selected=true]{background:var(--navy);color:#fff;box-shadow:inset 0 -3px 0 #120e33}
.dm-tabs button:active{transform:translateY(1px)}

/* الإطار */
.dm-frame{position:relative;background:#1d1747;border-radius:26px;padding:12px;color:#fff;box-shadow:0 30px 60px -30px rgba(29,23,71,.6);max-width:1100px;margin:0 auto;overflow:hidden}
.dm-top{display:flex;align-items:center;gap:12px;padding:6px 8px 12px;flex-wrap:wrap}
.dm-live{display:flex;align-items:center;gap:8px;background:rgba(255,255,255,.08);border-radius:10px;padding:7px 11px;font-family:'Rubik';font-size:13.5px}
.dm-live i{width:9px;height:9px;border-radius:50%;background:#ef4444;animation:dmBlink 1.4s infinite}
@keyframes dmBlink{50%{opacity:.35}}
.dm-title{flex:1;display:flex;flex-direction:column;min-width:160px}.dm-title b{font-family:'Rubik';font-size:16px}.dm-title small{color:rgba(255,255,255,.65);font-size:12.5px}
.dm-att{display:flex;align-items:center;gap:8px;background:rgba(74,222,128,.12);color:#bff5d3;border-radius:10px;padding:7px 11px;font-size:13px;position:relative}
.dm-att i{width:9px;height:9px;border-radius:50%;background:#4ade80;box-shadow:0 0 0 4px rgba(74,222,128,.2)}
.dm-att b{font-family:'Rubik';color:#fff}
.dm-main{display:grid;grid-template-columns:1fr 290px;gap:10px;min-height:400px}
.dm-board{position:relative;background:#fffdf6;border-radius:18px;color:var(--navy);display:flex;flex-direction:column;overflow:hidden;background-image:linear-gradient(#eef0f3 1px,transparent 1px),linear-gradient(90deg,#eef0f3 1px,transparent 1px);background-size:28px 28px}
.dm-board-h{display:flex;justify-content:space-between;gap:8px;padding:10px 14px;font-size:13px;color:var(--muted);background:rgba(255,255,255,.85);border-bottom:1px solid #eceef4;flex-wrap:wrap}
.dm-code{font-family:"Rubik";font-weight:600;color:var(--navy);background:var(--sun);border-radius:8px;padding:2px 8px}
.dm-svg{flex:1;width:100%;height:auto;display:block;direction:ltr}
.dm-svg text{font-family:'Rubik',sans-serif;font-weight:500}
.ink-in{animation:inkIn .9s steps(18,end) both}
@keyframes inkIn{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0 0 0)}}
.ink-draw{stroke-dasharray:var(--l);stroke-dashoffset:var(--l);animation:inkDraw 1s ease forwards}
@keyframes inkDraw{to{stroke-dashoffset:0}}
#dmPen{transition:transform .8s cubic-bezier(.5,0,.3,1)}

/* الاستطلاع */
.dm-poll{position:absolute;inset-inline:16px;bottom:16px;background:#fff;border-radius:16px;padding:16px;box-shadow:0 18px 40px -16px rgba(29,23,71,.45),inset 0 0 0 1.5px var(--line);animation:dmPop .35s cubic-bezier(.34,1.56,.64,1)}
@keyframes dmPop{from{transform:translateY(16px) scale(.96);opacity:0}}
.dm-poll b{font-family:'Rubik';font-size:16px;display:block;margin-bottom:10px}
.dm-opts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.dm-opts button{position:relative;overflow:hidden;border:0;font:inherit;font-family:'Rubik';font-weight:700;font-size:20px;color:var(--navy);background:var(--paper);padding:12px;border-radius:12px;cursor:pointer;box-shadow:inset 0 -3px 0 #d3d6e1;direction:ltr;isolation:isolate}
.dm-opts button:hover{box-shadow:inset 0 0 0 2px var(--navy),inset 0 -3px 0 #d3d6e1}
.dm-opts button i{position:absolute;inset-block:0;left:0;width:0;background:#dcd9f0;z-index:-1;transition:width .8s ease}
.dm-opts button em{display:block;font-style:normal;font-size:12px;font-weight:500;color:var(--muted)}
.dm-opts button.right{background:#dcf3e5;box-shadow:inset 0 0 0 2px #2fbf71}.dm-opts button.right i{background:#bfe9cf}
.dm-opts button.wrong{box-shadow:inset 0 0 0 2px #f3b49a}
.dm-opts[data-done] button{cursor:default}
.dm-poll small{display:block;margin-top:8px;color:var(--muted);font-size:13px}

/* الجانب */
.dm-side{background:rgba(255,255,255,.05);border-radius:18px;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.dm-side-tabs{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:6px}
.dm-side-tabs button{border:0;font:inherit;font-family:'Rubik';font-weight:600;font-size:13.5px;color:rgba(255,255,255,.7);background:transparent;padding:9px;border-radius:10px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px}
.dm-side-tabs button.on{background:rgba(255,255,255,.1);color:#fff;box-shadow:inset 0 -2px 0 rgba(0,0,0,.3)}
.dm-side-tabs em{font-style:normal;background:var(--orange);color:#fff;font-size:11px;min-width:18px;height:18px;border-radius:9px;display:inline-grid;place-items:center;padding:0 5px}
.dm-people{list-style:none;margin:0;padding:6px 10px 10px;display:flex;flex-direction:column;gap:6px;overflow:auto}
.dm-people li{display:flex;align-items:center;gap:10px;padding:7px 8px;border-radius:12px;font-size:14px;transition:background .3s}
.dm-people li.me{background:rgba(255,255,255,.06)}
.dm-av{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;font-family:'Rubik';font-weight:700;flex:none;position:relative;color:#fff;transition:box-shadow .2s}
.dm-people li.talk .dm-av{box-shadow:0 0 0 3px #4ade80;animation:dmTalk .9s ease-in-out infinite}
@keyframes dmTalk{50%{box-shadow:0 0 0 6px rgba(74,222,128,.35)}}
.dm-people .nm{flex:1;display:flex;flex-direction:column;line-height:1.3}.dm-people .nm small{color:rgba(255,255,255,.55);font-size:11.5px}
.dm-people .st{display:flex;gap:6px;align-items:center;color:rgba(255,255,255,.55)}
.dm-people .st svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.dm-people .st .on{color:#4ade80}.dm-people .st .hand{color:var(--sun);animation:dmWave .8s ease-in-out infinite;transform-origin:50% 90%}
@keyframes dmWave{50%{transform:rotate(14deg)}}
.dm-chat{display:flex;flex-direction:column;min-height:0;flex:1}
.dm-chat ol{list-style:none;margin:0;padding:6px 12px;display:flex;flex-direction:column;gap:8px;overflow:auto;flex:1;max-height:330px}
.dm-chat li{font-size:13.5px;line-height:1.6;background:rgba(255,255,255,.07);border-radius:12px;padding:7px 10px;animation:dmPop .3s ease}
.dm-chat li b{display:block;font-family:'Rubik';font-size:12px;color:var(--celadon)}.dm-chat li.t b{color:var(--sun)}.dm-chat li.me{background:rgba(242,100,25,.18)}.dm-chat li.me b{color:#ffb489}
.dm-chat form{display:flex;gap:6px;padding:8px}
.dm-chat input{flex:1;min-width:0;border:0;border-radius:10px;padding:10px 12px;font:inherit;font-size:14px;background:rgba(255,255,255,.1);color:#fff}
.dm-chat input::placeholder{color:rgba(255,255,255,.5)}
.dm-chat form button{border:0;border-radius:10px;background:var(--orange);color:#fff;font:inherit;font-family:'Rubik';font-weight:600;font-size:13.5px;padding:0 14px;cursor:pointer;box-shadow:inset 0 -3px 0 #c94e0c}

/* الأدوات */
.dm-tools{display:flex;justify-content:center;gap:8px;padding:12px 4px 4px;flex-wrap:wrap}
.dt{border:0;font:inherit;color:#fff;background:rgba(255,255,255,.08);border-radius:14px;padding:9px 14px;min-width:84px;display:flex;flex-direction:column;align-items:center;gap:4px;cursor:pointer;font-size:12.5px;font-family:'Rubik';font-weight:500;box-shadow:inset 0 0 0 1px rgba(255,255,255,.12),inset 0 -3px 0 rgba(0,0,0,.35);transition:background .15s,transform .12s}
.dt svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.dt:hover{background:rgba(255,255,255,.14)}
.dt:active{transform:translateY(1px);box-shadow:inset 0 0 0 1px rgba(255,255,255,.12),inset 0 -1px 0 rgba(0,0,0,.35)}
.dt[aria-pressed=true]{background:var(--orange);box-shadow:inset 0 -3px 0 #c94e0c}
.dt-exit{color:#fecaca}.dt-exit:hover{background:rgba(239,68,68,.25)}
.room-only{display:none}.dm-frame[data-mode=room] .room-only{display:flex}
.dm-toast{position:absolute;top:70px;inset-inline:0;margin:auto;width:max-content;max-width:90%;background:#fff;color:var(--navy);font-size:14px;font-weight:500;border-radius:12px;padding:10px 16px;box-shadow:0 14px 30px -12px rgba(0,0,0,.5);animation:dmPop .3s ease;z-index:5;text-align:center}
.dm-end{position:absolute;inset:0;background:rgba(29,23,71,.88);display:grid;place-items:center;padding:20px;z-index:6;text-align:center;animation:dmFade .3s ease}
@keyframes dmFade{from{opacity:0}}
.dm-end>div{max-width:460px}.dm-end b{font-family:'Rubik';font-size:24px}.dm-end p{color:rgba(255,255,255,.8);margin:8px 0 18px;line-height:1.8}
.dm-end-a{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}

/* شرح الأجزاء */
.dm-help{max-width:1100px;margin:14px auto 0;text-align:center}
.dm-tips-btn{border:0;font:inherit;font-family:'Rubik';font-weight:600;font-size:14.5px;color:var(--navy);background:#fff;border-radius:12px;padding:10px 16px;display:inline-flex;align-items:center;gap:8px;cursor:pointer;box-shadow:inset 0 0 0 1.5px var(--line),inset 0 -3px 0 #d3d6e1}
.dm-tips-btn svg{width:20px;height:20px;fill:none;stroke:var(--orange);stroke-width:2;stroke-linecap:round}
.dm-tips-btn[aria-pressed=true]{background:var(--navy);color:#fff;box-shadow:inset 0 -3px 0 #120e33}
.dm-legend{list-style:none;margin:14px 0 0;padding:0;display:grid;grid-template-columns:repeat(5,1fr);gap:10px;text-align:start}
.dm-legend li{background:#fff;border-radius:16px;padding:14px;display:flex;flex-direction:column;gap:4px;position:relative;padding-top:38px;box-shadow:inset 0 0 0 1px #e6e8ef}
.dm-legend li::before,[data-tip].tips-on::after{content:attr(data-n);position:absolute;top:10px;inset-inline-start:12px;width:24px;height:24px;border-radius:8px;background:var(--orange);color:#fff;font-family:'Rubik';font-weight:700;font-size:13px;display:grid;place-items:center}
.dm-legend li b{font-family:'Rubik';color:var(--navy)}.dm-legend li span{font-size:13.5px;color:var(--muted);line-height:1.7}
[data-tip].tips-on{position:relative;outline:2px dashed var(--orange);outline-offset:-2px}
[data-tip].tips-on::after{content:attr(data-tip);z-index:4;box-shadow:0 0 0 3px #1d1747}
.dm-top [data-tip].tips-on::after,.dm-att.tips-on::after{top:-8px;inset-inline-start:-8px}

/* القاعة: لون مختلف للإطار */
.dm-frame[data-mode=room]{background:#173e3a}
.dm-frame[data-mode=room] .dm-att{background:rgba(255,255,255,.1);color:#fff}

/* بعد الحصة */
.dm-after{max-width:1000px;margin:0 auto;display:grid;grid-template-columns:340px 1fr;gap:34px;align-items:center}
.dm-phone{background:var(--navy);border-radius:32px;padding:16px;box-shadow:0 30px 60px -30px rgba(29,23,71,.6),inset 0 0 0 6px #120e33;display:flex;flex-direction:column;gap:10px}
.dp-top{color:#fff;padding:8px 8px 4px;display:flex;justify-content:space-between;align-items:baseline}.dp-top b{font-family:'Rubik'}.dp-top small{color:rgba(255,255,255,.6);font-size:12px}
.dp-card{background:#fff;border-radius:16px;padding:12px 14px;display:flex;flex-direction:column;gap:2px;animation:dmPop .4s ease both}
.dp-card:nth-child(3){animation-delay:.12s}.dp-card:nth-child(4){animation-delay:.24s}.dp-card:nth-child(5){animation-delay:.36s}
.dp-card small{font-size:11.5px;color:var(--muted);font-family:'Rubik';font-weight:600}.dp-card b{font-family:'Rubik';color:var(--navy);font-size:15px}.dp-card span{font-size:12.5px;color:var(--muted)}
.dp-card.ok{box-shadow:inset 4px 0 0 #2fbf71}
.dp-days{display:flex;gap:5px;margin:4px 0}.dp-days i{width:22px;height:22px;border-radius:6px;background:#dcf3e5}.dp-days i.l{background:#fff1d6}.dp-days i.a{background:#fde3d6}
.dm-after-t h2{font-size:28px;margin-bottom:14px}
.dm-list{list-style:none;margin:0 0 20px;padding:0;display:flex;flex-direction:column;gap:14px}
.dm-list li{display:flex;flex-direction:column;gap:2px;padding-inline-start:16px;border-inline-start:3px solid var(--orange)}
.dm-list b{font-family:'Rubik';color:var(--navy)}.dm-list span{color:var(--muted);line-height:1.8}

/* القاعات */
.dm-rooms{background:#fff}
.dm-tiers{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
.dm-tier{background:var(--paper);border-radius:20px;padding:20px;display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.dm-tier b{font-family:'Rubik';font-size:18px;color:var(--navy)}.dm-tier span{color:var(--muted);font-size:14.5px;line-height:1.7}.dm-tier small{font-family:'Rubik';color:var(--navy);font-size:13px;margin-bottom:8px}
.dm-tier .btn{margin-top:auto}

@media (max-width:900px){
  .dm-main{grid-template-columns:1fr}
  .dm-side{max-height:260px}
  .dm-legend{grid-template-columns:1fr 1fr}
  .dm-after{grid-template-columns:1fr}.dm-phone{max-width:360px;margin:0 auto;width:100%}
  .dm-tiers{grid-template-columns:1fr}
}
@media (max-width:640px){
  .dm-hero{padding:28px 0 0}.dm-hero p{font-size:15.5px}
  .dm-frame{border-radius:20px;padding:8px;margin-inline:-6px}
  .dm-top{gap:8px;padding:4px 4px 8px}.dm-title{order:-1;flex-basis:100%}
  .dm-main{min-height:0}.dm-board{min-height:240px}
  .dm-tabs button{padding:10px 14px;font-size:14px;flex:1}
  .dm-tools{gap:5px}.dt{min-width:0;flex:1;padding:8px 4px;font-size:11px}.dt svg{width:20px;height:20px}
  .dm-legend{grid-template-columns:1fr}
  .dm-opts button{font-size:18px;padding:10px}
}
@media (prefers-reduced-motion:reduce){.ink-in,.ink-draw,.dm-live i,.dm-people li.talk .dm-av,.dp-card{animation:none!important;clip-path:none;stroke-dashoffset:0}}
#dmClock{direction:ltr;unicode-bidi:isolate}
@media (max-width:640px){
  .dm-tabs{flex-wrap:nowrap;gap:6px}.dm-tabs button{white-space:nowrap;padding:10px 8px;font-size:13.5px}
  .dm-side{max-height:210px}.dm-people li{padding:5px 6px}.dm-av{width:32px;height:32px;border-radius:10px}
  .dm-board-h{font-size:12px;padding:8px 10px}
  .dm-poll{inset-inline:8px;bottom:8px;padding:12px}
}
