/* ==========================================================
   طلاب العراق — الدعم والتواصل
   هوية: دفتر مدرسي — ورق مسطّر أزرق فاتح، وأزرار ملموسة كالملصقات
   ========================================================== */
:root{
  --paper:#eef4ff;      /* خلفية الورق */
  --rule:#d9e5fb;       /* سطور الدفتر */
  --sheet:#ffffff;
  --ink:#1b2a4a;        /* لون الكتابة */
  --ink-2:#4a5a7a;
  --muted:#7a88a5;
  --line:#dfe6f3;
  --blue:#2f6bff;  --blue-d:#1d4fd1;  --blue-s:#e5edff;
  --yellow:#ffc93c; --yellow-d:#e0a400; --yellow-s:#fff5d9;
  --green:#1fa971; --green-s:#dff6ec;
  --amber:#c27400; --amber-s:#fff1d6;
  --grey:#62708c;  --grey-s:#edf0f6;
  --red:#e2454d;   --red-s:#ffe9ea;
  --r-lg:26px; --r:18px; --r-sm:14px;
  --display:"Baloo Bhaijaan 2","Readex Pro",system-ui,sans-serif;
  --body:"Readex Pro",system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif;
}
@media (prefers-color-scheme:dark){:root{
  --paper:#0f1a33; --rule:#16244a; --sheet:#16223f; --ink:#eaf0ff; --ink-2:#bac6e3; --muted:#8796b8; --line:#26365e;
  --blue:#4f84ff; --blue-d:#2b5fd9; --blue-s:#1b2d5c; --yellow-s:#3a3014;
  --green-s:#0f3326; --amber:#f2b24c; --amber-s:#3a2a0f; --grey:#a3afc9; --grey-s:#22304f; --red-s:#3d1a1d;
}}
*{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%;overflow-x:hidden}
body{margin:0;min-height:100vh;display:flex;flex-direction:column;overflow-x:hidden;
  font-family:var(--body);font-size:16.5px;line-height:1.75;color:var(--ink);
  background-color:var(--paper);
  background-image:linear-gradient(var(--rule) 1.5px,transparent 1.5px);
  background-size:100% 34px}
main{flex:1}
a{color:var(--blue)}
img{max-width:100%;display:block}
svg{width:22px;height:22px;flex:none}
h1,h2{font-family:var(--display);font-weight:800;line-height:1.3;margin:0}
.num{font-variant-numeric:tabular-nums}
.muted{color:var(--muted)}
.wrap{width:100%;max-width:1040px;margin:0 auto;padding:0 16px}
.narrow{max-width:580px}
.page{padding:22px 0 40px}
.hp{position:absolute!important;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);opacity:0;pointer-events:none}
:focus-visible{outline:3px solid var(--blue);outline-offset:3px}

/* ---------- الشريط العلوي ---------- */
.topbar{background:var(--sheet);border-bottom:2px solid var(--line)}
.topbar-in{display:flex;align-items:center;justify-content:space-between;height:64px;gap:12px}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink)}
.brand-mark{width:42px;height:42px;border-radius:14px;background:var(--blue);color:#fff;display:grid;place-items:center;box-shadow:0 4px 0 var(--blue-d)}
.brand-txt{display:flex;flex-direction:column;line-height:1.15}
.brand-txt b{font-family:var(--display);font-size:20px;font-weight:800}
.brand-txt small{font-size:12.5px;color:var(--muted)}
.back-home{display:flex;align-items:center;gap:4px;text-decoration:none;color:var(--ink-2);font-weight:600;font-size:15px;padding:8px 12px;border-radius:12px}
.back-home:hover{background:var(--paper)}
.back-home svg{width:18px;height:18px}

/* ---------- الأزرار الملموسة (العنصر المميز) ---------- */
.key{--c:var(--blue);--d:var(--blue-d);--t:#fff;
  display:flex;align-items:center;justify-content:center;gap:10px;width:100%;
  font-family:var(--display);font-weight:800;font-size:20px;line-height:1.2;
  padding:16px 20px 15px;border:0;border-radius:var(--r);cursor:pointer;text-decoration:none;
  background:var(--c);color:var(--t);box-shadow:0 6px 0 var(--d);
  transform:translateY(0);transition:transform .08s ease,box-shadow .08s ease,filter .15s}
.key:hover{filter:brightness(1.05)}
.key:active{transform:translateY(5px);box-shadow:0 1px 0 var(--d)}
.key[disabled]{opacity:.7;cursor:progress}
.key svg{width:24px;height:24px}
.key-blue{--c:var(--blue);--d:var(--blue-d);--t:#fff}
.key-yellow{--c:var(--yellow);--d:var(--yellow-d);--t:#1b2a4a}
.key-white{--c:var(--sheet);--d:var(--line);--t:var(--ink);border:2px solid var(--line)}
.key-ink{--c:var(--ink);--d:#0a1430;--t:#fff}
.key-sm{width:auto;font-size:16px;padding:10px 18px;box-shadow:0 4px 0 var(--d)}
.key-sm:active{transform:translateY(3px)}
.stack{display:flex;flex-direction:column;gap:16px;margin-top:26px}
.stack-out{margin-top:6px}
.spin{width:20px;height:20px;border:3px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- الشاشة الأولى ---------- */
.home{padding-top:18px;max-width:760px}
.home-head{text-align:center;margin-bottom:28px}
.bubbles svg{width:120px;height:90px;margin:0 auto 6px;display:block}
.home-head h1{font-size:clamp(32px,7vw,46px)}
.home-head p{margin:2px 0 0;color:var(--ink-2);font-size:18px}
.choices{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.choice{display:flex;flex-direction:column;align-items:flex-start;gap:16px;padding:26px 24px 24px;
  border-radius:var(--r-lg);text-decoration:none;min-height:210px;
  transition:transform .08s ease,box-shadow .08s ease}
.choice:active{transform:translateY(6px)}
.choice-blue{background:var(--blue);color:#fff;box-shadow:0 8px 0 var(--blue-d)}
.choice-blue:active{box-shadow:0 2px 0 var(--blue-d)}
.choice-yellow{background:var(--yellow);color:#1b2a4a;box-shadow:0 8px 0 var(--yellow-d)}
.choice-yellow:active{box-shadow:0 2px 0 var(--yellow-d)}
.choice-ico{width:64px;height:64px;border-radius:20px;display:grid;place-items:center;background:rgba(255,255,255,.22)}
.choice-yellow .choice-ico{background:rgba(255,255,255,.55)}
.choice-ico svg{width:34px;height:34px}
.choice-txt{display:flex;flex-direction:column;gap:4px}
.choice-txt b{font-family:var(--display);font-size:clamp(23px,4.6vw,28px);font-weight:800;line-height:1.3}
.choice-txt small{font-size:15.5px;opacity:.88}

/* ---------- الورقة (البطاقة) ---------- */
.js #formView[data-closed]{display:none}
.link-back{display:none}
.js .link-back{display:inline-flex;align-items:center;gap:4px;background:none;border:0;font:inherit;font-weight:600;color:var(--ink-2);cursor:pointer;padding:6px 8px;margin-bottom:8px;border-radius:10px}
.link-back:hover{background:var(--sheet)}
.link-back svg{width:18px;height:18px}
.sheet{background:var(--sheet);border:2px solid var(--line);border-radius:var(--r-lg);padding:26px 24px;margin-bottom:20px}
.sheet-head{display:flex;align-items:center;gap:14px;margin-bottom:22px}
.sheet-head h1{font-size:28px}
.sheet-head p{margin:0;color:var(--ink-2);font-size:15px}
.sheet-ico{width:56px;height:56px;border-radius:18px;display:grid;place-items:center;flex:none}
.sheet-ico svg{width:30px;height:30px}
.sheet-ico-blue{background:var(--blue);color:#fff;box-shadow:0 4px 0 var(--blue-d)}
.sheet-ico-yellow{background:var(--yellow);color:#1b2a4a;box-shadow:0 4px 0 var(--yellow-d)}

/* ---------- الحقول ---------- */
.field{margin-bottom:20px}
.field label,.label{display:block;font-weight:600;font-size:16.5px;margin-bottom:8px}
.label small,.field label small{color:var(--muted);font-weight:400}
.input{width:100%;font:inherit;font-size:17px;color:var(--ink);background:var(--paper);
  border:2px solid var(--line);border-radius:var(--r-sm);padding:14px 16px;outline:none;transition:border-color .15s,background .15s}
.input::placeholder{color:var(--muted);opacity:.9}
.input:focus{border-color:var(--blue);background:var(--sheet)}
textarea.input{resize:vertical;min-height:130px}
.field.is-invalid .input{border-color:var(--red);background:var(--red-s)}
.err{color:var(--red);font-size:14.5px;font-weight:600;margin:6px 0 0}
.err:empty{display:none}
.drop{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font:inherit;font-weight:600;color:var(--ink-2);
  background:var(--sheet);border:2px dashed var(--line);border-radius:var(--r-sm);padding:16px;cursor:pointer}
.drop:hover{border-color:var(--blue);color:var(--blue);background:var(--blue-s)}
.drop svg{color:var(--blue)}
.drop-sm{padding:12px;font-size:15px}
.thumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:10px;margin-top:10px}
.thumbs:empty{display:none}
.thumb{position:relative;aspect-ratio:1;border-radius:14px;overflow:hidden;border:2px solid var(--line)}
.thumb img{width:100%;height:100%;object-fit:cover}
.thumb button{position:absolute;top:5px;left:5px;width:28px;height:28px;border-radius:50%;border:0;background:rgba(27,42,74,.8);color:#fff;font-size:18px;line-height:1;cursor:pointer}
.form-msg{padding:12px 16px;border-radius:var(--r-sm);font-weight:600;margin-top:4px}
.form-msg.bad{background:var(--red-s);color:var(--red)}
.progress{height:8px;border-radius:9px;background:var(--paper);overflow:hidden;margin-top:14px}
.progress i{display:block;height:100%;width:0;background:var(--blue);transition:width .2s}

/* ---------- بعد الإرسال ---------- */
.success{text-align:center;outline:none}
.success h1{font-size:30px;margin-top:6px}
.success>p{margin:2px 0 0}
.check{width:86px;height:86px;margin:0 auto}
.check svg{width:86px;height:86px}
.check circle{fill:var(--green-s);stroke:var(--green);stroke-width:2.5;stroke-dasharray:160;stroke-dashoffset:160;animation:draw .7s ease forwards}
.check path{fill:none;stroke:var(--green);stroke-width:4.5;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:40;stroke-dashoffset:40;animation:draw .45s .55s ease forwards}
@keyframes draw{to{stroke-dashoffset:0}}
.ticket-stub{position:relative;margin:24px auto 0;max-width:400px;padding:20px 18px 22px;border-radius:var(--r);
  background:var(--yellow-s);border:2px dashed var(--yellow-d);display:flex;flex-direction:column;align-items:center;gap:6px}
.ticket-stub::before,.ticket-stub::after{content:"";position:absolute;top:50%;width:22px;height:22px;margin-top:-11px;border-radius:50%;background:var(--sheet);border:2px dashed var(--yellow-d)}
.ticket-stub::before{right:-13px;border-left-color:transparent;border-bottom-color:transparent;transform:rotate(45deg)}
.ticket-stub::after{left:-13px;border-right-color:transparent;border-top-color:transparent;transform:rotate(45deg)}
.ticket-stub>span{font-weight:600;color:var(--ink-2);font-size:15px}
.code{font-family:var(--display);font-size:clamp(46px,13vw,62px);font-weight:800;letter-spacing:clamp(6px,2.4vw,12px);line-height:1.1;font-variant-numeric:tabular-nums;padding-inline-start:.2em;margin-bottom:6px}
.key-ink.copied{--c:var(--green);--d:#14805a}
.keynote{max-width:440px;margin:18px auto 0;font-size:15.5px;color:var(--ink-2);background:var(--blue-s);padding:12px 16px;border-radius:var(--r-sm);text-align:start}
.keynote b{color:var(--ink)}
.warn{background:var(--amber-s);color:var(--amber);padding:10px 14px;border-radius:12px;font-size:14.5px;margin:12px auto 0;max-width:440px}

/* ---------- التتبع ---------- */
.track-form .code-input{text-align:center;font-family:var(--display);font-size:34px;font-weight:800;letter-spacing:12px;padding:12px;background:var(--sheet)}
.track-form .code-input::placeholder{color:var(--line);opacity:1}
.captcha{margin-top:16px;padding:16px;border-radius:var(--r);background:var(--blue-s);text-align:center}
.captcha p{margin:0 0 10px;font-weight:600;font-size:15px}
.cap-row{display:flex;align-items:center;justify-content:center;gap:10px;margin-bottom:10px}
.cap-row img{border-radius:12px;border:2px solid var(--line);background:#fff}
.cap-input{text-align:center;font-size:24px;font-weight:700;letter-spacing:8px;max-width:220px;margin:0 auto;display:block;background:var(--sheet)}
.icon-btn{width:42px;height:42px;border-radius:12px;border:2px solid var(--line);background:var(--sheet);color:var(--ink-2);display:inline-grid;place-items:center;cursor:pointer;font-size:22px}
.icon-btn:hover{border-color:var(--blue);color:var(--blue)}
.icon-sm{width:32px;height:32px;border-radius:9px;vertical-align:middle}
.icon-sm svg{width:16px;height:16px}
.recent{margin-top:22px;padding-top:18px;border-top:2px dashed var(--line);text-align:center;font-size:14.5px;color:var(--ink-2)}
.recent div{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:8px}
.recent a{text-decoration:none;font-weight:700;letter-spacing:2px;direction:ltr;padding:5px 14px;border-radius:999px;background:var(--blue-s);color:var(--blue)}
.recent a:hover{background:var(--blue);color:#fff}

.alert{padding:14px 18px;border-radius:var(--r);margin-bottom:16px;font-weight:600;border:2px solid transparent}
.alert-err{background:var(--red-s);color:var(--red);border-color:color-mix(in srgb,var(--red) 25%,transparent)}
.alert-ok{background:var(--green-s);color:var(--green);border-color:color-mix(in srgb,var(--green) 25%,transparent)}

.badge{display:inline-flex;align-items:center;gap:6px;padding:3px 12px;border-radius:999px;font-size:14px;font-weight:600}
.t-blue .badge,.badge.t-blue{background:var(--blue-s);color:var(--blue)}
.badge.t-amber{background:var(--amber-s);color:var(--amber)}
.badge.t-green{background:var(--green-s);color:var(--green)}
.badge.t-gray{background:var(--grey-s);color:var(--grey)}

.status-sheet{border-top-width:8px}
.status-sheet.t-blue{border-top-color:var(--blue)}
.status-sheet.t-amber{border-top-color:var(--yellow-d)}
.status-sheet.t-green{border-top-color:var(--green)}
.status-sheet.t-gray{border-top-color:var(--grey)}
.status-hero{display:flex;gap:16px;align-items:flex-start}
.status-emoji{font-size:46px;line-height:1}
.status-hero h1{font-size:30px;margin-top:6px}
.status-hero p{margin:2px 0 0;color:var(--ink-2)}

.stepper{list-style:none;padding:0;margin:24px 0;display:grid;grid-template-columns:repeat(4,1fr)}
.stepper li{position:relative;display:flex;flex-direction:column;align-items:center;gap:6px;font-size:13.5px;font-weight:600;color:var(--muted);text-align:center}
.stepper li::before{content:"";position:absolute;top:10px;left:50%;width:100%;height:4px;border-radius:4px;background:var(--line)}
.stepper li:first-child::before{display:none}
.stepper i{position:relative;z-index:1;width:24px;height:24px;border-radius:50%;background:var(--sheet);border:4px solid var(--line)}
.stepper li.done,.stepper li.now{color:var(--ink)}
.stepper li.done i{background:var(--green);border-color:var(--green)}
.stepper li.done::before,.stepper li.now::before{background:var(--green)}
.stepper li.now i{background:var(--blue);border-color:var(--blue-s);box-shadow:0 0 0 3px var(--blue)}

.facts{display:flex;flex-direction:column;border:2px solid var(--line);border-radius:var(--r);overflow:hidden}
.facts div{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:11px 16px;border-top:2px solid var(--line)}
.facts div:first-child{border-top:0}
.facts span{color:var(--muted);font-size:14.5px;flex:none}
.facts b{font-weight:600;text-align:left;overflow-wrap:anywhere}
.facts b.num{font-family:var(--display);font-size:20px;letter-spacing:2px;display:flex;align-items:center;gap:8px}

.thread h2{font-size:24px;margin-bottom:16px}
.msg{border-radius:var(--r);padding:14px 16px;margin-bottom:12px;max-width:92%}
.msg-student{background:var(--paper);margin-inline-end:auto;border-top-right-radius:6px}
.msg-admin{background:var(--blue-s);margin-inline-start:auto;border-top-left-radius:6px}
.msg-who{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}
.msg-who b{font-weight:600}
.msg-admin .msg-who b{color:var(--blue)}
.msg-who time{margin-inline-start:auto;font-size:12.5px;color:var(--muted)}
.avatar{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:var(--sheet);font-weight:700;font-size:15px}
.msg-admin .avatar{background:var(--blue);color:#fff}
.msg-body{overflow-wrap:anywhere}
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:8px;margin-top:10px}
.gallery a{aspect-ratio:1;border-radius:12px;overflow:hidden}
.gallery img{width:100%;height:100%;object-fit:cover}
.reply{display:flex;flex-direction:column;gap:12px;margin-top:20px;padding-top:20px;border-top:2px dashed var(--line)}
.reply .label{margin:0}
.reply .alert{margin:0}
.reply .key{margin-top:6px}
.verify{background:var(--yellow-s);border-radius:var(--r-sm);padding:12px 14px}
.verify p{display:flex;align-items:center;gap:6px;margin:0 0 8px;font-size:14.5px;font-weight:600}
.verify svg{width:18px;height:18px}
.verify .input{background:var(--sheet)}
.closed-note{margin-top:12px;padding:14px;border-radius:var(--r-sm);background:var(--grey-s);text-align:center;font-weight:600;color:var(--ink-2)}

.lightbox{position:fixed;inset:0;background:rgba(12,20,40,.92);z-index:100;display:grid;place-items:center;padding:20px}
.lightbox img{max-height:90vh;max-width:100%;border-radius:12px}
.lightbox button{position:absolute;top:14px;left:14px;width:46px;height:46px;border-radius:50%;border:0;background:rgba(255,255,255,.15);color:#fff;font-size:28px;cursor:pointer}
.toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%,30px);background:var(--ink);color:var(--sheet);padding:12px 22px;border-radius:14px;font-weight:600;opacity:0;pointer-events:none;transition:.25s;z-index:200}
.toast.show{opacity:1;transform:translate(-50%,0)}
.foot{text-align:center;padding:22px 0 28px;font-size:14px;color:var(--muted)}
.foot a{color:var(--ink-2);font-weight:600;text-decoration:none}

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width:640px){
  body{font-size:16px}
  .page{padding-top:14px}
  .choices{grid-template-columns:1fr;gap:18px}
  .choice{flex-direction:row;align-items:center;min-height:0;padding:20px 18px}
  .choice-ico{width:58px;height:58px;flex:none}
  .sheet{padding:20px 16px;border-radius:22px}
  .sheet-head h1{font-size:25px}
  .status-hero h1{font-size:26px}
  .status-emoji{font-size:38px}
  .key{font-size:19px}
  .msg{max-width:100%}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
