/* ============================================================
   مختبر نور الهندسي — هوية «دفتر مختبر ورقي مضيء»
   ============================================================ */

:root{
  --paper:#FDF7EC;
  --grid:#E7DECB;
  --ink:#1F4E4A;
  --ink-soft:rgba(31,78,74,.62);
  --ink-line:rgba(31,78,74,.22);
  --teal:#2AA79B;
  --teal-dk:#238F85;
  --coral:#F2765B;
  --mustard:#F2C14E;
  --violet:#7B6FA8;
  --card:#FFFCF3;
  --shadow:0 4px 0 rgba(31,78,74,.12);
  --shadow-btn:0 4px 0 rgba(31,78,74,.25);
  --r:16px;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}

body{
  font-family:'IBM Plex Sans Arabic',system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:17px;
  line-height:1.7;
  color:var(--ink);
  background-color:var(--paper);
  background-image:
    linear-gradient(to right, rgba(231,222,203,.75) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(231,222,203,.75) 1px, transparent 1px);
  background-size:26px 26px;
  -webkit-tap-highlight-color:transparent;
  min-height:100vh;
  overflow-x:hidden;
}

button, input, textarea{font-family:inherit;}
button{user-select:none;-webkit-user-select:none;}
.hidden{display:none !important;}
.small{font-size:14px;}
.muted{color:var(--ink-soft);}

h1,h2,h3{margin:0;line-height:1.35;font-weight:700;}
p{margin:0;}

.ico{width:22px;height:22px;display:inline-block;vertical-align:-4px;flex:none;}

/* ---------------- HEADER ---------------- */
.app-header{
  position:sticky;top:0;z-index:40;
  background:rgba(253,247,236,.94);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  border-bottom:2px solid var(--ink);
  padding:9px 13px 11px;
}
.header-top{display:flex;align-items:center;gap:10px;justify-content:space-between;}
.brand{display:flex;align-items:center;gap:9px;min-width:0;}
.brand-mark{
  width:38px;height:38px;flex:none;border-radius:12px;
  background:var(--teal);color:#fff;border:2px solid var(--ink);
  display:grid;place-items:center;box-shadow:0 3px 0 rgba(31,78,74,.2);
}
.brand-mark .ico{width:22px;height:22px;vertical-align:middle;}
.brand-text{min-width:0;}
.brand-text h1{font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.brand-text p{font-size:11.5px;color:var(--ink-soft);line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

.student-chip{
  display:flex;flex-direction:column;align-items:flex-end;
  max-width:42%;background:var(--mustard);border:2px solid var(--ink);
  border-radius:12px;padding:3px 10px;box-shadow:0 3px 0 rgba(31,78,74,.16);
}
.sc-name{font-size:12.5px;font-weight:700;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}
.sc-class{font-size:10.5px;color:var(--ink-soft);line-height:1.3;white-space:nowrap;}

.progress{display:flex;gap:6px;margin-top:9px;}
.step{
  flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;
  background:transparent;border:2px solid var(--ink-line);border-radius:12px;
  padding:4px 2px;color:var(--ink-soft);font-size:11px;font-weight:600;cursor:pointer;
  transition:background .18s,color .18s,border-color .18s,box-shadow .18s;
}
.step .dot{
  width:22px;height:22px;border-radius:50%;border:2px solid currentColor;
  display:grid;place-items:center;font-size:11px;font-weight:700;line-height:1;
}
.step .dot .ico{width:13px;height:13px;vertical-align:0;}
.step .slabel{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}
.step.current{border-color:var(--ink);background:#fff;color:var(--ink);box-shadow:0 3px 0 rgba(31,78,74,.18);}
.step.done{border-color:var(--ink);background:var(--mustard);color:var(--ink);}
.step.done .dot{background:var(--ink);color:var(--mustard);border-color:var(--ink);}

/* ---------------- LAYOUT ---------------- */
main{max-width:940px;margin:0 auto;padding:16px 13px 56px;}
.screen{animation:fadeUp .32s ease-out both;}
@keyframes fadeUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}

.card{
  position:relative;background:var(--card);border:2px solid var(--ink);
  border-radius:var(--r);box-shadow:var(--shadow);padding:16px;margin-bottom:14px;
}
.card-title{font-size:18px;display:flex;align-items:center;gap:8px;margin-bottom:8px;}
.card-title .ico{color:var(--teal);}

.tape::before{
  content:'';position:absolute;top:-10px;inset-inline-start:20px;
  width:62px;height:18px;background:rgba(242,193,78,.72);
  border:1px solid rgba(31,78,74,.18);border-radius:3px;
  transform:rotate(-4deg);pointer-events:none;
}

.tag{
  display:inline-block;background:var(--mustard);border:2px solid var(--ink);
  border-radius:999px;padding:1px 12px;font-size:12.5px;font-weight:700;
  margin-bottom:6px;box-shadow:0 2px 0 rgba(31,78,74,.15);
}
.tag-teal{background:var(--teal);color:#fff;}

/* ---------------- PROGRAM BANNER ---------------- */
.program-banner{
  position:relative;overflow:hidden;display:flex;flex-direction:column;
  align-items:center;gap:1px;text-align:center;
  background:var(--ink);color:var(--paper);
  border:2px solid var(--ink);border-radius:var(--r);
  padding:13px 16px 15px;margin-bottom:14px;
  box-shadow:var(--shadow);
}
.program-banner::after{
  content:'';position:absolute;inset-inline:0;bottom:0;height:5px;
  background:linear-gradient(90deg,var(--mustard),var(--teal),var(--coral),var(--violet));
}
.pb-line{font-size:12.5px;font-weight:700;color:var(--mustard);line-height:1.5;}
.pb-title{font-size:19px;font-weight:700;line-height:1.45;}
.pb-sub{font-size:13px;font-weight:600;color:rgba(253,247,236,.82);line-height:1.5;}

.station-head{margin-bottom:14px;}
.station-head h2{font-size:25px;margin:2px 0 4px;}
.station-head p{font-size:15.5px;color:var(--ink-soft);}

/* ---------------- BUTTONS ---------------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  min-height:50px;padding:11px 20px;border-radius:999px;
  border:2px solid var(--ink);background:#fff;color:var(--ink);
  font-size:16.5px;font-weight:700;cursor:pointer;
  box-shadow:var(--shadow-btn);
  transition:transform .12s ease,box-shadow .12s ease,background .16s ease,color .16s ease,opacity .16s;
  -webkit-user-select:none;user-select:none;
}
.btn:active{transform:translateY(3px);box-shadow:0 1px 0 rgba(31,78,74,.25);}
.btn:focus-visible{outline:3px solid var(--violet);outline-offset:2px;}
.btn-primary{background:var(--teal);color:#fff;}
.btn-primary:hover{background:var(--teal-dk);}
.btn-secondary{background:#fff;color:var(--ink);}
.btn-secondary:hover{background:#f4efe3;}
.btn-danger{color:var(--coral);border-color:var(--coral);}
.btn-danger:hover{background:rgba(242,118,91,.1);}
.btn-sm{min-height:44px;font-size:14.5px;padding:8px 15px;}
.btn-block{width:100%;}
.btn:disabled{opacity:.42;cursor:not-allowed;box-shadow:none;transform:none;}

/* ---------------- FIELDS ---------------- */
.field{margin-bottom:16px;}
.field-label{display:block;font-weight:700;font-size:15px;margin-bottom:6px;}
.input{
  width:100%;padding:12px 14px;font-size:16.5px;color:var(--ink);
  background:#fff;border:2px solid var(--ink);border-radius:12px;
  box-shadow:inset 0 2px 0 rgba(31,78,74,.06);
  transition:box-shadow .16s,border-color .16s;
}
.input::placeholder{color:rgba(31,78,74,.36);}
.input:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 4px rgba(42,167,155,.18);}
textarea.input{resize:vertical;line-height:1.7;min-height:110px;}
.counter{text-align:end;font-size:13px;color:var(--ink-soft);margin-top:4px;}
.err{color:var(--coral);font-weight:700;font-size:14.5px;margin-top:6px;}

.class-row{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;}
.class-btn{
  min-height:50px;padding:8px 4px;border-radius:12px;border:2px solid var(--ink-line);
  background:#fff;color:var(--ink);font-size:14px;font-weight:700;cursor:pointer;
  transition:.16s;
}
.class-btn.sel{background:var(--teal);color:#fff;border-color:var(--ink);box-shadow:0 3px 0 rgba(31,78,74,.22);}

/* ---------------- HERO / START ---------------- */
.hero{display:flex;gap:14px;align-items:center;background:linear-gradient(180deg,#FFFDF6,#FFF7E7);}
.noor-hero{
  width:118px;height:118px;object-fit:contain;flex:none;border-radius:50%;
  background:radial-gradient(circle at 50% 44%, rgba(242,193,78,.38), rgba(255,252,243,0) 70%);
  filter:drop-shadow(0 4px 0 rgba(31,78,74,.10));
}
.hero-txt h2{font-size:21px;margin:2px 0 6px;}
.hero-txt p{font-size:15px;color:var(--ink-soft);}

/* ---------------- MACHINE TABS ---------------- */
.machine-tabs{display:flex;gap:7px;margin-bottom:12px;}
.mtab{
  flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:3px;
  padding:8px 4px;min-height:60px;justify-content:center;
  border:2px solid var(--ink-line);border-radius:12px;background:#fff;color:var(--ink-soft);
  font-size:12.5px;font-weight:700;cursor:pointer;transition:.16s;
}
.mtab .ico{width:22px;height:22px;}
.mtab.active{background:var(--card);border-color:var(--ink);color:var(--ink);box-shadow:0 3px 0 rgba(31,78,74,.16);}
.mtab.active .ico{color:var(--teal);}

.machine-sub{font-size:14.5px;color:var(--ink-soft);margin-bottom:8px;}

.stage-wrap{
  background:#fff;border:2px solid var(--ink-line);border-radius:12px;
  padding:6px;margin-bottom:10px;
}
.svg-stage{display:block;width:100%;height:auto;touch-action:none;font-family:inherit;}
#circuitSvg{touch-action:pan-y;}
.plug{cursor:grab;touch-action:none;}
.plug:active{cursor:grabbing;}
#swHit{cursor:pointer;}

.hint-line{font-size:13.5px;color:var(--violet);font-weight:600;margin-bottom:10px;}

.readouts{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px;}
.ro{
  flex:1 1 120px;background:rgba(123,111,168,.09);border:2px solid rgba(123,111,168,.3);
  border-radius:12px;padding:6px 10px;display:flex;flex-direction:column;
}
.ro span{font-size:11.5px;color:var(--ink-soft);line-height:1.4;}
.ro b{font-size:16px;}

.slider-row{margin-bottom:10px;}
.slider-row label{display:block;font-size:13.5px;font-weight:600;margin-bottom:4px;color:var(--ink-soft);}
input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:12px;border-radius:999px;
  background:#fff;border:2px solid var(--ink);outline:none;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:26px;height:26px;border-radius:50%;
  background:var(--mustard);border:2px solid var(--ink);cursor:pointer;
  box-shadow:0 2px 0 rgba(31,78,74,.2);
}
input[type=range]::-moz-range-thumb{
  width:24px;height:24px;border-radius:50%;background:var(--mustard);
  border:2px solid var(--ink);cursor:pointer;
}

.machine-actions{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px;}

.shape-func{
  background:rgba(123,111,168,.09);
  border-inline-start:4px solid var(--violet);
  border-radius:12px;padding:10px 12px;font-size:14.5px;line-height:1.7;
}

.circuit-status{
  display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px;font-size:13.5px;font-weight:700;
}
.circuit-status span{
  background:#fff;border:2px solid var(--ink-line);border-radius:999px;padding:2px 11px;
}
.circuit-status span.ok{background:rgba(42,167,155,.15);border-color:var(--teal);color:var(--teal-dk);}
.circuit-status span.off{background:rgba(242,118,91,.12);border-color:var(--coral);color:#c9553c;}

/* ---------------- STATION FOOT ---------------- */
.station-foot{
  display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;
  gap:10px;padding:13px 16px;
}
.foot-hint{font-size:14px;color:var(--ink-soft);flex:1 1 180px;}
.foot-actions{display:flex;gap:8px;flex-wrap:wrap;}

/* ---------------- LAB ---------------- */
.problem-cards{display:grid;gap:10px;margin-bottom:14px;}
.problem-card{
  display:flex;gap:11px;align-items:center;text-align:start;
  background:var(--card);border:2px solid var(--ink);border-radius:var(--r);
  box-shadow:var(--shadow);padding:11px 13px;cursor:pointer;
  transition:.16s;color:var(--ink);
}
.problem-card:hover{background:#FFFDF6;}
.problem-card .pc-ico{
  width:44px;height:44px;flex:none;border-radius:12px;display:grid;place-items:center;
  background:rgba(42,167,155,.14);border:2px solid var(--teal);color:var(--teal-dk);
}
.problem-card .pc-ico .ico{width:24px;height:24px;}
.problem-card b{display:block;font-size:16px;}
.problem-card small{display:block;font-size:13px;color:var(--ink-soft);line-height:1.5;}
.problem-card.sel{background:var(--mustard);box-shadow:0 4px 0 rgba(31,78,74,.24);}
.problem-card.sel .pc-ico{background:#fff;border-color:var(--ink);color:var(--ink);}

.lab-grid{display:grid;gap:14px;}
.tools{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin:10px 0;}
.tool{
  display:flex;align-items:center;gap:7px;justify-content:flex-start;
  min-height:56px;padding:8px 11px;background:#fff;border:2px solid var(--ink);
  border-radius:12px;font-size:14px;font-weight:700;color:var(--ink);
  cursor:grab;touch-action:none;box-shadow:0 3px 0 rgba(31,78,74,.13);
  transition:transform .12s,box-shadow .12s;
}
.tool:active{transform:translateY(2px);box-shadow:0 1px 0 rgba(31,78,74,.13);}
.tool .ico{color:var(--violet);}
.tool.used{opacity:.4;pointer-events:none;}
.shelf.locked .tool{opacity:.45;pointer-events:none;}

.design-area{min-height:230px;display:flex;flex-direction:column;}
.design-problem{font-size:14.5px;color:var(--ink-soft);margin-bottom:9px;}
.dropzone{
  flex:1;background:rgba(42,167,155,.05);border:2.5px dashed rgba(42,167,155,.6);
  border-radius:12px;padding:12px;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:8px;min-height:140px;transition:.16s;
}
.dropzone.over{background:rgba(242,193,78,.22);border-color:var(--ink);}
.dz-empty{font-size:14px;color:var(--ink-soft);text-align:center;}
.placed{display:flex;flex-wrap:wrap;gap:7px;justify-content:center;}
.placed-chip{
  display:inline-flex;align-items:center;gap:6px;min-height:44px;
  padding:6px 12px;border-radius:999px;border:2px solid var(--ink);
  background:var(--mustard);color:var(--ink);font-size:14px;font-weight:700;cursor:pointer;
  box-shadow:0 2px 0 rgba(31,78,74,.18);
}
.placed-chip .ico{width:18px;height:18px;}
.placed-chip .x{font-size:15px;opacity:.7;}

.verdict{
  margin-top:11px;border-radius:12px;padding:11px 13px;font-size:14.5px;
  border:2px solid var(--ink);font-weight:600;
}
.verdict.ok{background:rgba(42,167,155,.16);border-color:var(--teal);}
.verdict.partial{background:rgba(242,193,78,.2);border-color:var(--mustard);}
.verdict.warn{background:rgba(242,118,91,.12);border-color:var(--coral);}
.verdict b{display:block;font-size:15.5px;margin-bottom:3px;}

/* ---------------- FILE PREVIEW ---------------- */
.file-preview{margin-top:12px;}
.attach-media{
  display:block;width:100%;max-height:320px;object-fit:contain;
  border:2px solid var(--ink);border-radius:12px;background:#fff;
}
.attach-file{
  display:flex;align-items:center;gap:10px;padding:12px;border:2px solid var(--ink);
  border-radius:12px;background:#fff;color:var(--ink);text-decoration:none;
  font-weight:700;font-size:14.5px;word-break:break-word;
}
.attach-file .ico{color:var(--coral);}
.file-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;}
.file-meta{font-size:13px;color:var(--ink-soft);margin-top:6px;word-break:break-word;}

/* ---------------- ASSESSMENT ---------------- */
.crit-card{margin-bottom:14px;}
.crit-head{display:flex;align-items:center;gap:9px;margin-bottom:9px;}
.crit-head .cnum{
  width:28px;height:28px;flex:none;border-radius:50%;background:var(--violet);color:#fff;
  display:grid;place-items:center;font-size:13px;font-weight:700;
}
.crit-head h3{font-size:17px;}
.levels{display:grid;gap:7px;}
.level{
  display:flex;gap:10px;align-items:flex-start;width:100%;text-align:start;
  background:#fff;border:2px solid var(--ink-line);border-radius:12px;
  padding:9px 11px;color:var(--ink);cursor:pointer;transition:.15s;
  min-height:52px;font-size:14px;
}
.level:hover{border-color:var(--teal);}
.level .lv{
  flex:none;width:28px;height:28px;border-radius:50%;border:2px solid currentColor;
  display:grid;place-items:center;font-size:13px;font-weight:700;color:var(--ink-soft);
}
.level .ltxt b{display:block;font-size:14.5px;line-height:1.45;}
.level .ltxt small{display:block;font-size:13px;line-height:1.55;color:var(--ink-soft);}
.level.sel{background:rgba(42,167,155,.13);border-color:var(--teal);box-shadow:0 3px 0 rgba(42,167,155,.22);}
.level.sel .lv{background:var(--teal);color:#fff;border-color:var(--teal);}
.level.sel .ltxt small{color:var(--ink);}

.score-bar{
  position:sticky;bottom:8px;display:flex;flex-wrap:wrap;gap:10px;
  align-items:center;justify-content:space-between;z-index:20;
  background:var(--card);box-shadow:0 -2px 0 rgba(31,78,74,.08),var(--shadow);
}
.sb-left{display:flex;align-items:center;gap:11px;min-width:0;}
.sb-score{display:flex;align-items:baseline;gap:2px;}
.sb-score #scoreNum{font-size:30px;font-weight:700;line-height:1;color:var(--teal);}
.sb-of{font-size:15px;color:var(--ink-soft);font-weight:700;}
.sb-meta b{display:block;font-size:14.5px;}
.sb-meta small{display:block;font-size:12.5px;color:var(--ink-soft);line-height:1.4;}

/* ---------------- RESULT / CERTIFICATE ---------------- */
.result-head{text-align:center;margin-bottom:14px;}
.result-head h2{font-size:24px;}
.result-head p{font-size:14.5px;color:var(--ink-soft);}

.ach-wrap{display:flex;justify-content:center;}
.ach-card{
  position:relative;width:100%;max-width:560px;background:var(--card);
  border:2.5px solid var(--ink);border-radius:20px;overflow:hidden;
  box-shadow:0 6px 0 rgba(31,78,74,.16);
}
.ach-band{background:var(--teal);color:#fff;padding:16px 18px;text-align:center;border-bottom:2.5px solid var(--ink);}
.ach-kicker{font-size:12.5px;opacity:.92;}
.ach-band h2{font-size:28px;margin-top:1px;}
.ach-program{font-size:11.5px;opacity:.88;margin-top:2px;}
.ach-body{padding:16px 16px 0;}
.ach-id{display:grid;grid-template-columns:1fr 1fr;gap:8px 12px;margin-bottom:12px;}
.ach-id > div:first-child{grid-column:1 / -1;}
.lbl{display:block;font-size:11.5px;color:var(--ink-soft);}
.val{display:block;font-size:17px;word-break:break-word;}
.ach-id > div:first-child .val{font-size:22px;}

.ach-rows{border-top:2px dashed rgba(31,78,74,.25);padding-top:11px;display:grid;gap:9px;}
.ach-row span{display:block;font-size:11.5px;color:var(--ink-soft);}
.ach-row b{display:block;font-size:14.5px;line-height:1.6;word-break:break-word;}

.ach-score{
  display:flex;align-items:center;gap:14px;margin:14px 0 12px;
  background:rgba(242,193,78,.22);border:2px solid var(--ink);border-radius:14px;padding:11px 13px;
}
.score-circle{
  width:78px;height:78px;flex:none;border-radius:50%;background:var(--mustard);
  border:3px solid var(--ink);display:flex;flex-direction:column;align-items:center;justify-content:center;
  line-height:1;
}
.score-circle b{font-size:27px;}
.score-circle span{font-size:11px;color:var(--ink-soft);margin-top:2px;}
.ach-score-txt b{font-size:17px;display:block;}
.ach-score-txt p{font-size:12.5px;color:var(--ink-soft);}


.ach-crit{display:flex;justify-content:space-between;gap:8px;font-size:13px;border-bottom:1px dotted rgba(31,78,74,.25);padding-bottom:4px;}
.ach-crit b{color:var(--teal-dk);}

.ach-foot{
  border-top:2px solid var(--ink);margin:0 -16px;padding:9px 16px;
  text-align:center;font-size:11.5px;color:var(--ink-soft);background:rgba(231,222,203,.35);
}
.ach-tape{
  position:absolute;top:8px;inset-inline-start:-16px;width:76px;height:20px;
  background:rgba(242,193,78,.8);border:1px solid rgba(31,78,74,.2);
  transform:rotate(-38deg);pointer-events:none;
}
.ach-actions{display:flex;flex-wrap:wrap;gap:9px;justify-content:center;margin-top:18px;}
.ach-actions .btn{flex:1 1 160px;}

/* ---------------- TOAST ---------------- */
.toast{
  position:fixed;z-index:80;bottom:16px;left:50%;transform:translate(-50%,14px);
  display:flex;align-items:center;gap:10px;max-width:min(94vw,430px);
  background:var(--card);border:2px solid var(--ink);border-radius:16px;
  padding:9px 14px 9px 10px;box-shadow:0 6px 0 rgba(31,78,74,.22);
  opacity:0;transition:opacity .24s ease,transform .24s ease;pointer-events:none;
}
.toast.show{opacity:1;transform:translate(-50%,0);}
.toast img{
  width:54px;height:54px;object-fit:contain;flex:none;border-radius:50%;
  background:radial-gradient(circle at 50% 44%, rgba(242,193,78,.4), rgba(255,252,243,0) 72%);
}
.toast p{font-size:14.5px;font-weight:600;line-height:1.55;}

.drag-ghost{
  position:fixed;z-index:90;pointer-events:none;transform:translate(-50%,-50%);
  background:var(--mustard);border:2px solid var(--ink);border-radius:999px;
  padding:7px 14px;font-size:14px;font-weight:700;display:flex;align-items:center;gap:6px;
  box-shadow:0 4px 0 rgba(31,78,74,.25);
}

/* ---------------- RESPONSIVE ---------------- */
@media (min-width:720px){
  main{padding:22px 22px 64px;}
  .brand-text h1{font-size:20px;}
  .brand-text p{font-size:12.5px;}
  .hero-txt h2{font-size:25px;}
  .station-head h2{font-size:30px;}
  .problem-cards{grid-template-columns:repeat(3,1fr);}
  .problem-card{flex-direction:column;align-items:flex-start;gap:8px;}
  .lab-grid{grid-template-columns:1fr 1.25fr;align-items:start;}
  .tools{grid-template-columns:repeat(2,1fr);}
  .ach-actions{justify-content:center;}
  .ach-actions .btn{flex:0 0 auto;}
}

@media (max-width:430px){
  .brand-text h1{font-size:15.5px;}
  .brand-text p{font-size:10.5px;}
  .step{font-size:10px;padding:4px 1px;}
  .step .dot{width:20px;height:20px;font-size:10px;}
  .noor-hero{width:96px;}
  .hero-txt h2{font-size:19px;}
  .station-head h2{font-size:22px;}
  .card{padding:14px;}
  .tools{grid-template-columns:repeat(2,1fr);}
  .tool{font-size:13px;padding:7px 9px;min-height:52px;}
  .tool .ico{width:19px;height:19px;}
  .ro{flex:1 1 100%;}
}

@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important;}
}

/* ============================================================
   تحديث: خلفية علمية · إرشادات · أصوات · لوحة المتسابقين
   ============================================================ */

body{
  background-color:#EDF5F3;
  background-image:
    linear-gradient(rgba(241,248,247,.90), rgba(237,245,244,.95)),
    url('assets/science-bg.png'),
    radial-gradient(900px 520px at 92% -12%, rgba(42,167,155,.20), transparent 72%),
    radial-gradient(760px 480px at 0% 6%, rgba(123,111,168,.16), transparent 72%),
    linear-gradient(to right, rgba(31,78,74,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(31,78,74,.05) 1px, transparent 1px);
  background-size:auto, cover, auto, auto, 26px 26px, 26px 26px;
  background-position:center, center, center, center, top left, top left;
  background-repeat:no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
  background-attachment:fixed, fixed, fixed, fixed, fixed, fixed;
}
.app-header{background:rgba(241,248,247,.94);}

.header-tools{display:flex;align-items:center;gap:8px;min-width:0;}
.sound-btn{
  width:42px;height:42px;flex:none;border-radius:50%;
  border:2px solid var(--ink);background:var(--mustard);color:var(--ink);
  display:grid;place-items:center;cursor:pointer;
  box-shadow:0 3px 0 rgba(31,78,74,.22);
  transition:transform .12s,box-shadow .12s,background .16s,color .16s;
}
.sound-btn:active{transform:translateY(2px);box-shadow:0 1px 0 rgba(31,78,74,.22);}
.sound-btn .ico{width:21px;height:21px;vertical-align:middle;}
.sound-btn.off{background:#fff;color:var(--ink-soft);}

/* إرشادات المحطة */
.guide{
  display:flex;gap:10px;align-items:flex-start;
  background:rgba(42,167,155,.10);
  border:2px dashed rgba(42,167,155,.58);
  border-radius:var(--r);padding:10px 12px;margin-bottom:14px;
}
.guide-tag{
  width:34px;height:34px;flex:none;border-radius:10px;display:grid;place-items:center;
  background:var(--teal);color:#fff;border:2px solid var(--ink);
}
.guide-tag .ico{width:19px;height:19px;vertical-align:middle;}
.guide-steps{
  margin:0;padding-inline-start:18px;font-size:14px;line-height:1.65;color:var(--ink);
  display:grid;gap:3px;
}
.guide-steps li::marker{color:var(--teal);font-weight:700;}

/* علامة ✓ على الآلة المُجرّبة */
.mtab{position:relative;}
.mtab.tried::after{
  content:'✓';position:absolute;top:3px;inset-inline-start:5px;
  width:17px;height:17px;border-radius:50%;background:var(--teal);color:#fff;
  font-size:11px;font-weight:700;display:grid;place-items:center;line-height:1;
}

/* زر الانتقال الجاهز */
.btn.ready{animation:readyPulse 1.7s ease-in-out infinite;}
@keyframes readyPulse{
  0%,100%{box-shadow:0 4px 0 rgba(31,78,74,.25);}
  50%{box-shadow:0 4px 0 rgba(31,78,74,.25),0 0 0 6px rgba(42,167,155,.22);}
}

/* لوحة المتسابقين الأوائل */
.board{margin-top:16px;}
.board-list{display:grid;gap:7px;margin-top:8px;}
.board-empty{
  font-size:14px;color:var(--ink-soft);text-align:center;
  padding:14px 8px;border:2px dashed var(--ink-line);border-radius:12px;
}
.board-row{
  display:flex;align-items:center;gap:10px;
  background:#fff;border:2px solid var(--ink-line);border-radius:12px;padding:7px 10px;
}
.board-row.me{border-color:var(--teal);background:rgba(42,167,155,.10);}
.brank{
  width:28px;height:28px;flex:none;border-radius:50%;display:grid;place-items:center;
  font-size:13px;font-weight:700;background:rgba(31,78,74,.08);color:var(--ink);
  border:2px solid var(--ink-line);
}
.brank.gold{background:var(--mustard);border-color:var(--ink);}
.brank.silver{background:#E3E7EA;border-color:var(--ink);}
.brank.bronze{background:#E8C9A6;border-color:var(--ink);}
.bname{
  flex:1;min-width:0;font-size:14px;font-weight:700;line-height:1.35;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.bname small{display:block;font-size:11.5px;font-weight:500;color:var(--ink-soft);}
.bscore{font-size:16px;font-weight:700;color:var(--teal-dk);display:flex;align-items:baseline;gap:1px;}
.bscore small{font-size:11px;color:var(--ink-soft);font-weight:600;}

/* كونفيتي الاحتفال */
.confetti{
  position:fixed;top:20%;left:50%;z-index:95;pointer-events:none;border-radius:2px;
  animation:confFall 1.15s cubic-bezier(.2,.7,.4,1) forwards;
}
@keyframes confFall{
  from{transform:translate(-50%,-50%) rotate(0deg) scale(1);opacity:1;}
  to{transform:translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(.55);opacity:0;}
}

@media (max-width:430px){
  .student-chip{max-width:34%;}
  .sound-btn{width:38px;height:38px;}
  .sound-btn .ico{width:19px;height:19px;}
  .guide{padding:9px 10px;gap:8px;}
  .guide-steps{font-size:13px;}
  .bname{font-size:13px;}
}

@media (prefers-reduced-motion:reduce){
  .confetti{display:none !important;}
  .btn.ready{animation:none !important;}
}

/* ---------------- PRINT ---------------- */
@media print{
  @page{size:A4;margin:12mm;}
  body{background:#fff !important;background-image:none !important;color:#1F4E4A;}
  .app-header,.no-print,.toast,.drag-ghost{display:none !important;}
  main{padding:0;max-width:none;}
  .screen{display:none !important;}
  #screen-result{display:block !important;}
  .ach-card{max-width:none;box-shadow:none;border-width:3px;break-inside:avoid;}
  .ach-band{background:#2AA79B !important;-webkit-print-color-adjust:exact;print-color-adjust:exact;}
  .score-circle{background:#F2C14E !important;-webkit-print-color-adjust:exact;print-color-adjust:exact;}
  .ach-foot{background:#F4EEDF !important;-webkit-print-color-adjust:exact;print-color-adjust:exact;}
}