/* الهوية العُمانية × الرياضيات — لوحة A4 عمودية 1240×1754 */
@font-face{font-family:'NotoNaskhLocal';src:url('fonts/NotoNaskhArabic-Regular.ttf') format('truetype');font-weight:400;font-display:swap}
@font-face{font-family:'NotoNaskhLocal';src:url('fonts/NotoNaskhArabic-Bold.ttf') format('truetype');font-weight:700;font-display:swap}
@font-face{font-family:'NotoKufiLocal';src:url('fonts/NotoKufiArabic-Bold.ttf') format('truetype');font-weight:700;font-display:swap}
@font-face{font-family:'NotoSansArLocal';src:url('fonts/NotoSansArabic-Bold.ttf') format('truetype');font-weight:700;font-display:swap}

:root{
  --red:#A6192E; --red-d:#7A1226; --green:#0E6B45; --green-d:#0B5D3B;
  --gold:#C9A227; --gold-l:#E8D08A; --teal:#10646B; --ink:#22251F;
  --cream:#FBF6EA; --paper:#FDFBF4;
  --f-head:'Cairo','NotoKufiLocal','Noto Sans Arabic',system-ui,sans-serif;
  --f-body:'NotoNaskhLocal','Noto Naskh Arabic','Cairo','NotoSansArLocal',serif;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{background:#E9E2D2;font-family:var(--f-body);color:var(--ink);
  display:flex;justify-content:center;padding:18px 0;overflow-x:auto}
.defs{position:absolute;width:0;height:0;overflow:hidden}
svg.fig{display:block;width:100%;height:auto;direction:ltr}
svg.ico{width:1em;height:1em;flex:0 0 auto}

/* ---------- sheet + ornamental frame ---------- */
.sheet{width:1240px;height:1754px;position:relative;flex:0 0 auto}
.frame{position:absolute;inset:0;background:
    repeating-linear-gradient(45deg,rgba(201,162,39,.055) 0 2px,transparent 2px 16px),
    repeating-linear-gradient(-45deg,rgba(14,107,69,.045) 0 2px,transparent 2px 16px),
    var(--paper);
  border:3px solid var(--gold);border-radius:8px;padding:18px 20px 16px;
  display:flex;flex-direction:column;gap:13px;
  box-shadow:inset 0 0 0 5px rgba(255,255,255,.85),inset 0 0 0 7px rgba(201,162,39,.35)}
.corner{position:absolute;width:14px;height:14px;background:var(--gold);transform:rotate(45deg);opacity:.9;border-radius:2px}
.c-tl{top:7px;right:7px} .c-tr{top:7px;left:7px}
.c-bl{bottom:7px;right:7px} .c-br{bottom:7px;left:7px}

/* ---------- header ---------- */
.head{display:flex;align-items:center;gap:16px;position:relative;
  background:linear-gradient(115deg,var(--green-d) 0%,var(--green) 55%,#0F7A4E 100%);
  border:2px solid var(--gold);border-radius:10px;padding:14px 20px;color:var(--cream);
  box-shadow:0 2px 0 rgba(0,0,0,.12)}
.flagbar{display:flex;flex-direction:column;gap:3px;align-self:stretch;width:14px}
.flagbar i{flex:1;border-radius:2px;display:block}
.fr{background:#DB161B} .fw{background:#fff} .fg{background:#00843D}
.headText{flex:1;min-width:0}
.sultan{font:700 13.5px/1 var(--f-head);color:var(--gold-l);letter-spacing:.4px;margin-bottom:5px}
.head h1{margin:0;font:900 40px/1.15 var(--f-head);letter-spacing:-.5px;
  text-shadow:0 2px 0 rgba(0,0,0,.18)}
.head h1 .x{color:var(--gold-l);font-weight:700;padding:0 4px}
.sub{margin:6px 0 0;font:400 13.5px/1.6 var(--f-body);color:rgba(255,255,255,.92);max-width:830px}
.headIco{width:74px;height:74px;color:var(--gold-l);opacity:.95;flex:0 0 auto}

/* ---------- panels ---------- */
.grid{flex:1;min-height:0;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:13px}
.card{background:#fff;border:2px solid rgba(201,162,39,.85);border-radius:10px;
  display:flex;flex-direction:column;overflow:hidden;
  box-shadow:0 2px 0 rgba(201,162,39,.25),0 1px 4px rgba(0,0,0,.06)}
.cardbar{display:flex;align-items:center;gap:9px;padding:8px 13px;
  background:linear-gradient(95deg,var(--green-d),var(--green));color:var(--cream);
  border-bottom:2px solid var(--gold)}
.cardbar .ico{width:20px;height:20px;color:var(--gold-l)}
.cardbar h2{margin:0;flex:1;font:800 19px/1.25 var(--f-head);letter-spacing:-.2px}
.badge{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;
  background:var(--gold-l);color:var(--red-d);font:800 15px/1 var(--f-head);
  box-shadow:0 0 0 2px rgba(255,255,255,.55)}
.c1 .badge{background:var(--gold-l);color:var(--red-d)}
.c2 .badge{background:#BFE3E6;color:#08454A}
.c3 .badge{background:#F3C6C6;color:var(--red-d)}
.c4 .badge{background:#E7D6A8;color:#5B4711}
.figbox{height:466px;flex:0 0 auto;display:flex;align-items:center;justify-content:center;padding:2px 10px;background:
  repeating-linear-gradient(0deg,rgba(201,162,39,.05) 0 1px,transparent 1px 22px),
  repeating-linear-gradient(90deg,rgba(201,162,39,.05) 0 1px,transparent 1px 22px)}

/* SVG text classes */
.fig text{font-family:var(--f-head)}
.tNum{font-size:13px;font-weight:700;fill:#22251F}
.tCap{font-size:12px;font-weight:600;fill:#0B5D3B}
.tCapS{font-size:11px;font-weight:600;fill:#4A4F45}
.tBig{font-size:26px;font-weight:900}
.fig64{display:none}

/* ---------- facts + chips ---------- */
.facts{list-style:none;margin:0;padding:8px 16px 4px;display:flex;flex-direction:column;gap:7px}
.facts li{position:relative;padding-right:18px;font:400 15.5px/1.62 var(--f-body);color:#2B2E27}
.facts li::before{content:'';position:absolute;right:2px;top:.62em;width:8px;height:8px;
  background:var(--gold);transform:rotate(45deg);border-radius:1px}
.facts b{color:var(--green-d);font-weight:700}
.facts b+.facts b{color:var(--red-d)}
.chips{display:flex;flex-wrap:wrap;gap:7px;padding:8px 16px 12px;margin-top:auto}
.chip{font:700 13px/1 var(--f-head);background:#F4EFE0;border:1px solid rgba(201,162,39,.6);
  color:#4A3B10;padding:6px 11px;border-radius:999px}

/* ---------- footer ---------- */
.foot{display:flex;align-items:center;justify-content:center;gap:20px;
  background:linear-gradient(115deg,var(--red-d),var(--red));color:var(--cream);
  border:2px solid var(--gold);border-radius:10px;padding:9px 18px}
.foot .ico{width:22px;height:22px;color:var(--gold-l);opacity:.9}
.plate{background:rgba(255,255,255,.10);border:1.5px dashed var(--gold-l);border-radius:9px;
  padding:5px 34px;text-align:center}
.plateLbl{font:700 11.5px/1.4 var(--f-head);color:var(--gold-l);letter-spacing:.3px}
.plateName{font:900 26px/1.3 var(--f-head);color:#fff;text-shadow:0 2px 0 rgba(0,0,0,.15)}
.fMeta{font:400 12px/1.5 var(--f-body);color:rgba(255,255,255,.9);max-width:330px}

@media print{
  @page{size:1240px 1754px;margin:0}
  body{background:#fff;padding:0;display:block;overflow:visible}
  .frame{box-shadow:inset 0 0 0 5px rgba(255,255,255,.85),inset 0 0 0 7px rgba(201,162,39,.35)}
}

/* ---------- export mode: ?export=2 renders an exact 2480x3508 PNG ---------- */
body.export{display:block;background:#fff;padding:0;margin:0;overflow:visible;
  width:1240px;height:1754px}
body.export .sheet{margin:0;position:static}
/* ============ صفحة الفلج (لوحة أفقية 1754×1240 تقريبًا) ============ */
.sheet.land{width:1754px;height:auto;min-height:1240px}
.sheet.land .frame{position:relative;inset:auto}
.fltop{display:grid;grid-template-columns:920px 1fr;gap:13px;align-items:start}
.flbot{display:grid;grid-template-columns:1fr 1fr 1.15fr;gap:13px;align-items:stretch;margin-top:13px}
.scenebox{margin:0;height:591px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(180deg,#FBF3E2,#F6EFE0);border-bottom:1px solid rgba(201,162,39,.35)}
svg.fallg{display:block;width:100%;height:auto;direction:ltr;border-radius:6px}
.chartbox{display:flex;align-items:center;justify-content:center;padding:6px 10px 2px;height:352px}
svg.fchart{display:block;height:100%;width:auto;max-width:100%;direction:ltr}
.fallg text,.fchart text{font-family:var(--f-head)}
.fcap{font-family:var(--f-head)}
.ftable{width:100%;border-collapse:separate;border-spacing:0;margin:10px 13px 6px;width:calc(100% - 26px)}
.ftable th{background:linear-gradient(95deg,var(--green-d),var(--green));color:var(--cream);
  font:700 15px/1.35 var(--f-head);padding:9px 8px;border-bottom:2px solid var(--gold)}
.ftable th:first-child{border-radius:0 8px 0 0}
.ftable th:last-child{border-radius:8px 0 0 0}
.ftable td{font:400 16px/1.4 var(--f-body);padding:8px;text-align:center;
  border-bottom:1px solid rgba(201,162,39,.35)}
.ftable tbody tr:nth-child(odd){background:rgba(201,162,39,.07)}
.ftable td.s{font-weight:700;color:var(--green-d)}
.ftable td.p{font:800 16px/1 var(--f-head);color:var(--red)}
.ftable tfoot td{font-weight:700;color:var(--red-d);background:rgba(166,25,46,.07);
  border-top:2px solid rgba(166,25,46,.45)}
.swatch{display:inline-block;width:12px;height:12px;border-radius:3px;margin-left:7px;vertical-align:-1px}
.notes{padding:6px 15px 12px;display:flex;flex-direction:column;gap:8px}
.note{background:#F7F2E2;border:1px solid rgba(201,162,39,.55);border-right:5px solid var(--gold);
  border-radius:8px;padding:9px 12px;font:400 15.5px/1.6 var(--f-body);color:#2B2E27}
.note b{color:var(--green-d)}
.note .k{color:var(--red-d);font-weight:700}
.legendbar{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;padding:0 14px 12px}
.lg{font:700 13.5px/1 var(--f-head);color:#3D3312;background:#F4EFE0;
  border:1px solid rgba(201,162,39,.6);border-radius:999px;padding:7px 12px}
.credits{display:flex;gap:12px;align-items:center;justify-content:center;padding:2px 0 8px;
  font:700 13.5px/1 var(--f-head);color:#4A3B10}

/* رابط الانتقال إلى لوحة الفلج */
.chip.flink{background:linear-gradient(95deg,var(--green-d),var(--green));color:var(--cream);
  border-color:var(--gold);text-decoration:none;display:inline-flex;align-items:center}
.chip.flink:hover{transform:translateY(-1px);box-shadow:0 2px 6px rgba(0,0,0,.18)}
a{color:inherit}
/* وضع التصدير للّوحة الأفقية الفلجية */
body.export .sheet.land{width:1754px;height:auto;min-height:1100px;margin:0;position:static}
body.export{width:auto;height:auto;overflow:visible}
