@import url('https://fonts.googleapis.com/css2?family=Reem+Kufi+Fun:wght@500;600;700&display=swap');

:root{
  --black:#080808;
  --paper:#eeeae2;
  --paper2:#e5e0d7;
  --ink:#111;
  --muted:#77736c;
  --line:rgba(17,17,17,.14);
  --bronze:#966c47;
  --header-h:68px;
}

*{box-sizing:border-box}

html{
  min-width:320px;
  background:var(--paper);
}

body{
  margin:0;
  min-width:320px;
  min-height:100%;
  color:var(--ink);
  font-family:"Segoe UI","Noto Sans Arabic",Arial,sans-serif;
  -webkit-font-smoothing:antialiased;

  background:
    linear-gradient(rgba(142,103,66,.055) 1px,transparent 1px),
    linear-gradient(90deg,rgba(142,103,66,.05) 1px,transparent 1px),
    radial-gradient(circle at 16% 18%,rgba(151,108,67,.13),transparent 28%),
    radial-gradient(circle at 83% 76%,rgba(151,108,67,.09),transparent 28%),
    var(--paper);

  background-size:
    38px 38px,
    38px 38px,
    auto,
    auto,
    auto;
}

button,input,textarea{font:inherit}
button,a{-webkit-tap-highlight-color:transparent}
button{cursor:pointer}
button:disabled{cursor:not-allowed;opacity:.45}
a{text-decoration:none;color:inherit}

.header{
  position:fixed;
  inset:0 0 auto;
  height:var(--header-h);
  z-index:100;
  display:flex;
  align-items:center;
  background:rgba(8,8,8,.92);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  border-bottom:1px solid rgba(255,255,255,.08);
}

.nav{
  width:min(1440px,94%);
  margin:auto;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  direction:ltr;
}

.nav-side{
  display:flex;
  align-items:center;
  gap:14px;
}

.nav-side.right{
  justify-content:flex-end;
}

.nav-link,.nav-label{
  color:#aaa;
  font-size:11px;
  letter-spacing:.08em;
}

.nav-link:hover{color:#fff}

.logo{
  display:inline-flex;
  align-items:baseline;
  direction:ltr;
  font-size:22px;
  font-weight:800;
  letter-spacing:-.035em;
  line-height:1;
  color:#fff;
  white-space:nowrap;
}

.logo-dot{
  position:relative;
  display:inline-block;
  width:.22em;
  margin:0 .015em;
  color:var(--paper);
  text-align:center;
}

.logo-dot::after{
  content:"";
  position:absolute;
  left:50%;
  top:58%;
  width:.34em;
  height:.34em;
  border:1px solid rgba(238,234,226,.7);
  border-radius:50%;
  transform:translate(-50%,-50%) scale(.25);
  opacity:0;
  animation:afaqPulse 4.6s ease-out infinite;
}

@keyframes afaqPulse{
  0%,72%,100%{
    transform:translate(-50%,-50%) scale(.25);
    opacity:0;
  }
  76%{opacity:.65}
  88%{
    transform:translate(-50%,-50%) scale(2.6);
    opacity:0;
  }
}

.page{
  width:min(1440px,calc(100% - 32px));
  margin:auto;
  padding:calc(var(--header-h) + 44px) 0 44px;
}

.hero{
  max-width:900px;
  margin:16px auto 30px;
  text-align:center;
}

.eyebrow{
  margin-bottom:10px;
  color:var(--muted);
  font-size:11px;
  font-weight:700;
  letter-spacing:.16em;
  direction:ltr;
}

h1{
  margin:0;
  font-family:"Reem Kufi Fun","Segoe UI",sans-serif;
  font-size:clamp(34px,6vw,64px);
  font-weight:700;
  letter-spacing:-.025em;
  line-height:1.15;
}

.hero p{
  max-width:720px;
  margin:14px auto 0;
  color:var(--muted);
  font-size:15px;
  line-height:1.9;
}

.runtime-strip{
  width:fit-content;
  max-width:100%;
  margin:20px auto 0;
  padding:9px 13px;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:9px 16px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(255,255,255,.23);
  color:var(--muted);
  font-size:12px;
}

.runtime-state{
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:var(--ink);
  font-weight:700;
}

.status-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#a17c4d;
  box-shadow:0 0 0 4px rgba(161,124,77,.10);
}

.status-dot[data-state="ready"]{
  background:#3e7a5b;
  box-shadow:0 0 0 4px rgba(62,122,91,.10);
}

.status-dot[data-state="error"]{
  background:#9a4d45;
  box-shadow:0 0 0 4px rgba(154,77,69,.10);
}

.tool-shell{
  overflow:hidden;
  border:1px solid rgba(17,17,17,.16);
  border-radius:26px;
  background:rgba(255,255,255,.18);
  box-shadow:0 22px 70px rgba(0,0,0,.07);
}

.tool-toolbar{
  padding:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(17,17,17,.12);
  background:rgba(238,234,226,.80);
  backdrop-filter:blur(10px);
}

.file-group,.action-group{
  min-width:0;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
}

.filename{
  width:170px;
  max-width:44vw;
  height:42px;
  padding:0 12px;
  border:1px solid rgba(17,17,17,.16);
  border-radius:11px;
  outline:0;
  background:rgba(255,255,255,.46);
  color:var(--ink);
  direction:ltr;
  text-align:left;
  font-family:Consolas,monospace;
  font-size:13px;
}

.filename:focus{
  border-color:rgba(17,17,17,.48);
}

.btn{
  min-height:42px;
  padding:8px 13px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  border:1px solid rgba(17,17,17,.18);
  border-radius:11px;
  background:rgba(255,255,255,.34);
  color:var(--ink);
  transition:.15s ease;
}

.btn:hover:not(:disabled){
  transform:translateY(-1px);
  background:rgba(255,255,255,.68);
  border-color:rgba(17,17,17,.36);
}

.btn.primary{
  background:var(--black);
  color:#fff;
  border-color:var(--black);
  font-weight:750;
}

.btn.stop{
  color:#7c352f;
  border-color:rgba(124,53,47,.30);
}

.workspace{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  min-width:760px;
  direction:ltr;
  align-items:stretch;
}

.pane{
  min-width:0;
  direction:rtl;
  display:flex;
  flex-direction:column;
}

.code-pane{
  border-inline-end:1px solid rgba(17,17,17,.12);
}

.editor-host{
  flex:1;
}

.editor-host > .cm-editor{
  height:100%;
}

.output{
  flex:1;
}

.pane-head{
  min-height:54px;
  padding:10px 15px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(17,17,17,.10);
}

.pane-title{
  font-size:13px;
  font-weight:800;
}

.pane-meta{
  color:var(--muted);
  font-size:11px;
}

.editor-host{
  min-height:460px;
  direction:ltr;
  text-align:left;
  background:#0b0b0b;
}

.output{
  min-height:460px;
  max-height:650px;
  margin:0;
  padding:18px;
  overflow:auto;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  direction:ltr;
  text-align:left;
  background:#111;
  color:var(--paper);
  font-family:Consolas,monospace;
  font-size:13px;
  line-height:1.75;
}

.stdin-panel{
  border-top:1px solid rgba(17,17,17,.11);
  background:rgba(238,234,226,.52);
}

.stdin-panel summary{
  padding:14px 16px;
  cursor:pointer;
  font-size:13px;
  font-weight:750;
}

.stdin-help{
  margin:-2px 16px 10px;
  color:var(--muted);
  font-size:12px;
  line-height:1.7;
}

#stdin{
  display:block;
  width:calc(100% - 32px);
  min-height:100px;
  margin:0 16px 16px;
  padding:12px;
  resize:vertical;
  border:1px solid rgba(17,17,17,.16);
  border-radius:11px;
  outline:0;
  background:rgba(255,255,255,.48);
  direction:ltr;
  text-align:left;
  font-family:Consolas,monospace;
  font-size:13px;
}

.figures{
  padding:14px;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
  border-top:1px solid rgba(17,17,17,.10);
}

.figures[hidden]{display:none}

.figures figure{
  margin:0;
  padding:9px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.52);
}

.figures img{
  display:block;
  width:100%;
  height:auto;
  border-radius:9px;
}

.figures figcaption{
  padding:8px 4px 2px;
  color:var(--muted);
  font-size:11px;
}

.notes{
  margin-top:18px;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
}

.note{
  padding:15px 16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:rgba(255,255,255,.18);
  color:var(--muted);
  font-size:12px;
  line-height:1.75;
}

.note strong{
  display:block;
  margin-bottom:3px;
  color:var(--ink);
  font-size:13px;
}

.footer{
  margin-top:32px;
  padding-top:18px;
  border-top:1px solid rgba(17,17,17,.12);
  text-align:center;
  color:#625f59;
  font-size:11px;
  line-height:1.9;
}


.guide{
  margin-top:18px;
  padding:22px;
  border:1px solid var(--line);
  border-radius:20px;
  background:rgba(255,255,255,.22);
}

.guide h2{
  margin:0 0 6px;
  font-size:20px;
}

.guide-intro{
  margin:0 0 16px;
  color:var(--muted);
  font-size:13px;
  line-height:1.8;
}

.guide-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
}

.guide-step{
  padding:14px;
  border:1px solid rgba(17,17,17,.12);
  border-radius:14px;
  background:rgba(255,255,255,.30);
  line-height:1.7;
  font-size:12px;
  color:var(--muted);
}

.guide-step b{
  display:block;
  margin-bottom:4px;
  color:var(--ink);
  font-size:13px;
}

@media(max-width:900px){
  .guide-grid{
    grid-template-columns:repeat(2,1fr);
  }
}

@media(max-width:520px){
  .guide-grid{
    grid-template-columns:1fr;
  }
}

@media(max-width:900px){
  .workspace{
    grid-template-columns:repeat(2,minmax(360px,1fr));
    min-width:760px;
  }

  .notes{
    grid-template-columns:1fr;
  }

  .tool-toolbar{
    align-items:stretch;
    flex-direction:column;
  }

  .file-group,.action-group{
    width:100%;
  }
}

@media(max-width:620px){
  :root{--header-h:62px}

  .page{
    width:calc(100% - 18px);
    padding-top:calc(var(--header-h) + 28px);
  }

  .nav-side .nav-label{display:none}

  h1{font-size:36px}

  .runtime-strip{
    border-radius:18px;
  }

  .tool-shell{
    border-radius:20px;
  }

  .filename{
    width:100%;
    max-width:none;
  }

  .file-group .btn,
  .action-group .btn{
    flex:1 1 auto;
  }

  .editor-host,.output{
    min-height:360px;
  }

  .output{
    max-height:500px;
  }
}

@media(prefers-reduced-motion:reduce){
  .logo-dot::after{
    animation:none;
  }

  .btn{
    transition:none;
  }
}


/* =========================================================
   AFAQ PYTHON LAB — FINAL BALANCED DESKTOP WORKSPACE
   Code = LEFT 50% | Output = RIGHT 50%
   ========================================================= */

.workspace{
  display:grid !important;
  grid-template-columns:50% 50% !important;
  width:100% !important;
  min-width:0 !important;
  height:620px !important;
  gap:0 !important;
  direction:ltr !important;
  align-items:stretch !important;
  overflow:hidden !important;
}

.workspace > .pane{
  width:100% !important;
  min-width:0 !important;
  height:620px !important;
  min-height:620px !important;
  max-height:620px !important;

  display:grid !important;
  grid-template-rows:64px minmax(0,1fr) !important;

  direction:rtl !important;
  overflow:hidden !important;
}

.workspace > .code-pane{
  border-inline-end:0 !important;
  border-bottom:0 !important;
  border-right:1px solid rgba(17,17,17,.14) !important;
}

.workspace .pane-head{
  width:100% !important;
  height:64px !important;
  min-height:64px !important;
  max-height:64px !important;

  padding:10px 14px !important;

  overflow:hidden !important;
}

.workspace .pane-head .action-group{
  flex-wrap:nowrap !important;
}

.workspace .pane-head .btn{
  min-height:38px !important;
  padding:7px 10px !important;
  font-size:12px !important;
  white-space:nowrap !important;
}

.editor-host{
  width:100% !important;
  min-width:0 !important;
  min-height:0 !important;
  height:100% !important;
  max-height:none !important;
  overflow:hidden !important;
}

.editor-host > .cm-editor{
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
}

.editor-host .cm-scroller{
  height:100% !important;
  overflow:auto !important;
}

.output{
  width:100% !important;
  min-width:0 !important;
  min-height:0 !important;
  height:100% !important;
  max-height:none !important;

  margin:0 !important;

  overflow:auto !important;
}

.after-workspace{
  width:100%;
  border-top:1px solid rgba(17,17,17,.12);
  background:rgba(238,234,226,.58);
}

.after-workspace .stdin-panel{
  border-top:0 !important;
}

.after-workspace .figures{
  width:100%;
  border-top:1px solid rgba(17,17,17,.12);
}

@media(max-width:900px){

  .tool-shell{
    overflow-x:auto !important;
  }

  .workspace{
    width:760px !important;
    min-width:760px !important;
    height:540px !important;
  }

  .workspace > .pane{
    height:540px !important;
    min-height:540px !important;
    max-height:540px !important;
  }
}

@media(max-width:620px){

  .workspace{
    width:720px !important;
    min-width:720px !important;
    height:480px !important;
  }

  .workspace > .pane{
    height:480px !important;
    min-height:480px !important;
    max-height:480px !important;
  }
}


/* AFAQ PYTHON LAB — VISUAL LOCK FINAL */

.workspace{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
  grid-template-areas:"code result" !important;

  width:100% !important;
  min-width:0 !important;

  height:clamp(420px,calc(100vh - 285px),540px) !important;

  direction:ltr !important;
  gap:0 !important;

  align-items:stretch !important;
  overflow:hidden !important;
}

.workspace > .code-pane{
  grid-area:code !important;

  width:100% !important;
  height:100% !important;

  border-right:1px solid rgba(17,17,17,.14) !important;
  border-inline-end:0 !important;
}

.workspace > .output-pane{
  grid-area:result !important;

  width:100% !important;
  height:100% !important;
}

.workspace > .pane{
  min-width:0 !important;

  height:100% !important;
  min-height:0 !important;
  max-height:none !important;

  display:grid !important;
  grid-template-rows:58px minmax(0,1fr) !important;

  overflow:hidden !important;
  direction:rtl !important;
}

.workspace .pane-head{
  height:58px !important;
  min-height:58px !important;
  max-height:58px !important;

  padding:8px 14px !important;
}

.editor-host,
.output{
  width:100% !important;

  height:100% !important;
  min-height:0 !important;
  max-height:none !important;

  overflow:auto !important;
}

.editor-host > .cm-editor{
  height:100% !important;
}

.editor-host .cm-scroller{
  height:100% !important;
  overflow:auto !important;
}

@media(max-width:760px){

  .tool-shell{
    overflow-x:auto !important;
  }

  .workspace{
    width:720px !important;
    min-width:720px !important;

    height:440px !important;

    grid-template-columns:360px 360px !important;
  }
}


/* AFAQ Python Lab — runtime mode selector */
.runtime-mode-switch{
  display:inline-flex;
  align-items:center;
  gap:3px;
  padding:3px;
  border:1px solid rgba(17,17,17,.14);
  border-radius:999px;
  background:rgba(255,255,255,.32);
}

.runtime-mode-btn{
  appearance:none;
  border:0;
  border-radius:999px;
  padding:7px 11px;
  background:transparent;
  color:var(--muted);
  font:inherit;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
  transition:
    background .18s ease,
    color .18s ease,
    transform .18s ease;
}

.runtime-mode-btn:hover{
  transform:translateY(-1px);
}

.runtime-mode-btn.active{
  background:#0b0b0b;
  color:#f3efe7;
}

.runtime-mode-btn:focus-visible{
  outline:2px solid currentColor;
  outline-offset:2px;
}

@media (max-width:760px){
  .runtime-mode-switch{
    width:100%;
    justify-content:center;
  }

  .runtime-mode-btn{
    flex:1;
  }
}


/* AFAQ Python Lab — three-panel desktop UI */

/* Runtime environment cards */
.runtime-strip{
  display:grid !important;
  grid-template-columns:auto auto 1fr !important;
  align-items:center !important;
  gap:10px 14px !important;
}

.runtime-mode-switch{
  grid-column:1 / -1;
  width:100%;
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:8px !important;
  padding:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
}

.runtime-mode-btn{
  width:100%;
  min-height:58px;
  display:flex !important;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:11px 14px !important;
  border:1px solid rgba(17,17,17,.14) !important;
  border-radius:14px !important;
  background:rgba(255,255,255,.28) !important;
  color:var(--ink) !important;
  text-align:right;
  transform:none !important;
}

.runtime-mode-btn:hover{
  background:rgba(255,255,255,.48) !important;
}

.runtime-mode-btn.active{
  border-color:rgba(17,17,17,.42) !important;
  background:#0b0b0b !important;
  color:#f3efe7 !important;
}

.runtime-mode-title{
  flex:0 0 130px;
  font-size:13px;
  font-weight:900;
  white-space:nowrap;
}

.runtime-mode-copy{
  flex:1;
  direction:rtl;
  text-align:left;
  font-size:11px;
  font-weight:600;
  line-height:1.55;
  opacity:.72;
}

.runtime-mode-btn.active .runtime-mode-copy{
  opacity:.82;
}

/* Compact first-glance workflow */
.quick-guide{
  width:min(1180px,calc(100% - 32px));
  margin:14px auto;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  background:rgba(255,255,255,.20);
}

.quick-guide span{
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:8px 12px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}

.quick-guide span + span{
  border-right:1px solid var(--line);
}

.quick-guide b{
  width:22px;
  height:22px;
  display:inline-grid;
  place-items:center;
  border-radius:50%;
  background:#111;
  color:#f5f1e9;
  font-size:10px;
}

/* Three equal desktop panes */
.workspace{
  grid-template-columns:
    minmax(0,1fr)
    minmax(0,1fr)
    minmax(0,1fr) !important;
  grid-template-areas:
    "code result preview" !important;
  min-width:1080px !important;
  height:560px !important;
  direction:ltr !important;
  align-items:stretch !important;
}

.workspace > .pane{
  width:100% !important;
  height:560px !important;
  min-height:560px !important;
  max-height:560px !important;
}

.workspace > .code-pane{
  grid-area:code !important;
}

.workspace > .output-pane{
  grid-area:result !important;
}

.workspace > .preview-pane{
  grid-area:preview !important;
}

.preview-pane{
  border-right:1px solid var(--line);
}

.preview-body{
  min-width:0;
  min-height:0;
  height:100%;
  overflow:auto;
  position:relative;
  background:rgba(255,255,255,.13);
}

.preview-empty{
  min-height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:28px;
  text-align:center;
  direction:rtl;
  color:var(--muted);
}

.preview-empty strong{
  color:var(--ink);
  font-size:15px;
}

.preview-empty span{
  max-width:260px;
  font-size:11px;
  line-height:1.8;
}

.preview-body:has(.figures:not([hidden])) .preview-empty{
  display:none;
}

.preview-pane .figures{
  width:100% !important;
  min-height:100%;
  padding:12px !important;
  border-top:0 !important;
  grid-template-columns:1fr !important;
  align-content:start;
}

.preview-pane .figures figure{
  width:100%;
}

.preview-pane .figures img{
  width:100%;
  max-height:390px;
  object-fit:contain;
  background:#fff;
}

/* Input remains full width below the three panes */
.after-workspace{
  width:100%;
}

.after-workspace .stdin-panel{
  width:100%;
}

/* Tablet/mobile: keep functionality readable */
@media(max-width:980px){

  .runtime-strip{
    grid-template-columns:1fr !important;
  }

  .runtime-mode-copy{
    text-align:right;
  }

  .quick-guide{
    grid-template-columns:repeat(2,1fr);
  }

  .quick-guide span:nth-child(3){
    border-top:1px solid var(--line);
  }

  .quick-guide span:nth-child(4){
    border-top:1px solid var(--line);
  }

  .workspace{
    width:100% !important;
    min-width:0 !important;
    height:auto !important;
    grid-template-columns:1fr !important;
    grid-template-areas:
      "code"
      "result"
      "preview" !important;
  }

  .workspace > .pane{
    height:430px !important;
    min-height:430px !important;
    max-height:430px !important;
  }

  .preview-pane{
    border-right:0;
    border-top:1px solid var(--line);
  }
}

@media(max-width:620px){

  .quick-guide{
    width:min(100% - 20px,1180px);
    grid-template-columns:1fr 1fr;
  }

  .quick-guide span{
    font-size:11px;
    padding:7px 6px;
  }

  .runtime-mode-btn{
    align-items:flex-start;
    flex-direction:column;
    gap:4px;
  }

  .runtime-mode-title{
    flex:auto;
  }

  .runtime-mode-copy{
    text-align:right;
  }
}


/* AFAQ Python Lab — compact visual pass */

.page{
  padding:
    calc(var(--header-h) + 14px)
    0
    28px !important;
}

.hero{
  max-width:1180px !important;
  margin:4px auto 8px !important;
  text-align:right !important;
}

.hero h1{
  margin:0 0 8px !important;
  font-size:clamp(30px,4.4vw,54px) !important;
  line-height:1.05 !important;
}

.hero .eyebrow,
.hero > p{
  display:none !important;
}

/* Hide technical detail from the visual header only.
   JS still keeps these elements updated internally. */
#pythonVersion,
#runtimeEngine{
  display:none !important;
}

.runtime-strip{
  width:100% !important;
  max-width:none !important;
  margin:0 !important;
  padding:0 !important;

  display:flex !important;
  flex-direction:row !important;
  flex-wrap:wrap !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:8px 18px !important;

  direction:rtl !important;

  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;

  font-size:12px !important;
}

.runtime-state{
  min-height:30px;
  gap:6px !important;
  font-size:12px !important;
}

.status-dot{
  width:7px !important;
  height:7px !important;
  box-shadow:none !important;
}

.runtime-mode-switch{
  width:auto !important;
  grid-column:auto !important;

  display:inline-flex !important;
  flex-direction:row !important;
  align-items:center !important;
  gap:18px !important;

  padding:0 !important;
  border:0 !important;
  background:transparent !important;
}

.runtime-mode-btn{
  width:auto !important;
  min-height:30px !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:6px !important;

  padding:0 !important;

  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;

  color:var(--muted) !important;

  font-size:12px !important;
  font-weight:800 !important;

  transform:none !important;
}

.runtime-mode-btn:hover{
  background:transparent !important;
  color:var(--ink) !important;
  transform:none !important;
}

.runtime-mode-btn::before{
  content:"";
  width:14px;
  height:14px;
  flex:0 0 14px;

  display:inline-grid;
  place-items:center;

  border:1px solid rgba(17,17,17,.28);
  border-radius:50%;

  background:transparent;
  color:#fff;

  font-size:9px;
  line-height:1;
}

.runtime-mode-btn.active{
  background:transparent !important;
  color:var(--ink) !important;
}

.runtime-mode-btn.active::before{
  content:"✓";
  border-color:#2f6b4f;
  background:#2f6b4f;
}

.runtime-mode-title{
  flex:auto !important;
  font-size:12px !important;
  font-weight:800 !important;
}

.runtime-mode-copy{
  display:none !important;
}

/* Tiny workflow strip */
.quick-guide{
  width:min(1180px,100%) !important;
  margin:4px auto 8px !important;

  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:6px 18px !important;

  direction:rtl;

  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  overflow:visible !important;
}

.quick-guide span{
  min-height:24px !important;
  padding:0 !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:5px !important;

  border:0 !important;

  color:var(--muted);
  font-size:11px !important;
  font-weight:700;
}

.quick-guide span + span{
  border:0 !important;
}

.quick-guide b{
  width:17px !important;
  height:17px !important;

  border-radius:50%;

  font-size:9px !important;
  font-weight:800 !important;
}

/* Pull the actual lab upward */
.tool-shell{
  margin-top:0 !important;
}

.tool-toolbar{
  padding:9px 11px !important;
}

.workspace{
  height:540px !important;
}

.workspace > .pane{
  height:540px !important;
  min-height:540px !important;
  max-height:540px !important;
}

/* Bottom explanatory cards are intentionally removed */
.notes{
  display:none !important;
}

.footer{
  margin-top:20px !important;
}

@media(max-width:980px){

  .hero{
    text-align:right !important;
  }

  .runtime-strip{
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
  }

  .runtime-mode-switch{
    display:inline-flex !important;
    width:auto !important;
  }

  .quick-guide{
    display:flex !important;
    flex-wrap:wrap !important;
  }

  .workspace{
    height:auto !important;
  }
}

@media(max-width:620px){

  .page{
    padding-top:
      calc(var(--header-h) + 10px) !important;
  }

  .hero h1{
    font-size:30px !important;
  }

  .runtime-strip{
    gap:6px 12px !important;
  }

  .runtime-mode-switch{
    gap:12px !important;
  }

  .runtime-mode-btn{
    flex-direction:row !important;
    align-items:center !important;
  }

  .quick-guide{
    gap:4px 12px !important;
  }

  .quick-guide span{
    font-size:10px !important;
  }
}


/* AFAQ Python Lab — single top desktop row */

.hero{
  width:min(1240px,100%) !important;
  max-width:none !important;
  margin:2px auto 7px !important;

  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:14px !important;

  direction:rtl !important;
  white-space:nowrap;
}

.hero h1{
  flex:0 0 auto;
  margin:0 !important;
  font-size:clamp(28px,3vw,40px) !important;
  line-height:1 !important;
}

.hero .runtime-strip{
  flex:0 0 auto !important;
  width:auto !important;
  margin:0 !important;

  display:inline-flex !important;
  flex-wrap:nowrap !important;
  align-items:center !important;
  gap:8px 14px !important;
}

.hero .runtime-mode-switch{
  display:inline-flex !important;
  flex-wrap:nowrap !important;
  gap:14px !important;
}

.hero .quick-guide{
  flex:1 1 auto !important;
  width:auto !important;
  margin:0 !important;

  display:flex !important;
  flex-wrap:nowrap !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:5px 13px !important;

  overflow:visible !important;
}

.hero .quick-guide span{
  flex:0 0 auto;
  min-height:26px !important;
  font-size:10.5px !important;
}

.hero .quick-guide b{
  width:16px !important;
  height:16px !important;
  font-size:8px !important;
}

.tool-shell{
  margin-top:0 !important;
}

@media(min-width:981px){
  .page{
    padding-top:
      calc(var(--header-h) + 9px) !important;
  }
}

@media(max-width:1100px){
  .hero{
    flex-wrap:wrap !important;
    white-space:normal;
  }

  .hero .quick-guide{
    flex-basis:100% !important;
  }
}

@media(max-width:620px){
  .hero{
    align-items:flex-start !important;
    gap:7px !important;
  }

  .hero h1{
    width:100%;
  }

  .hero .runtime-strip,
  .hero .quick-guide{
    flex-wrap:wrap !important;
  }
}


/* AFAQ Python Lab — file tools inside code header */

.code-pane .pane-head{
  display:grid !important;
  grid-template-columns:
    auto
    minmax(0,1fr)
    auto !important;
  align-items:center !important;
  gap:7px !important;
  direction:rtl !important;
}

.code-pane .file-group{
  min-width:0;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:4px !important;
  overflow-x:auto;
  scrollbar-width:none;
  direction:rtl;
}

.code-pane .file-group::-webkit-scrollbar{
  display:none;
}

.code-pane .filename{
  width:84px !important;
  min-width:84px !important;
  height:30px !important;
  padding:5px 7px !important;
  font-size:10px !important;
}

.code-pane .file-group .btn{
  min-height:30px !important;
  padding:5px 7px !important;
  font-size:10px !important;
  white-space:nowrap;
}

.code-pane #saveState{
  white-space:nowrap;
  font-size:10px !important;
}

@media(max-width:980px){
  .code-pane .pane-head{
    grid-template-columns:auto 1fr !important;
  }

  .code-pane #saveState{
    display:none;
  }
}


/* AFAQ Python Lab — integrated code toolbar */

/* The former standalone toolbar is gone. */
.tool-toolbar{
  display:none !important;
}

/* Language + file identity in the global top row */
.top-language-control{
  display:inline-flex !important;
  align-items:center !important;
  gap:5px !important;
  min-height:26px !important;
  padding:0 !important;
  border:0 !important;
  white-space:nowrap;
}

.top-language-control label{
  color:var(--muted);
  font-size:10px;
  font-weight:800;
}

#languageSelect{
  height:25px;
  padding:2px 20px 2px 6px;
  border:1px solid rgba(17,17,17,.14);
  border-radius:8px;
  outline:0;
  background:rgba(255,255,255,.34);
  color:var(--ink);
  font:inherit;
  font-size:10px;
  font-weight:800;
  cursor:pointer;
}

.top-filename{
  width:72px !important;
  min-width:72px !important;
  height:25px !important;
  padding:3px 6px !important;
  border-radius:8px !important;
  font-size:10px !important;
}

/* Code pane header becomes the complete action bar */
.code-action-head{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  padding:6px 7px !important;
  direction:rtl !important;
  overflow:hidden;
}

.code-actions{
  width:100%;
  min-width:0;

  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:3px;

  overflow-x:auto;
  scrollbar-width:none;
  direction:rtl;
}

.code-actions::-webkit-scrollbar{
  display:none;
}

.code-actions .btn{
  flex:0 0 auto;
  min-height:29px !important;
  padding:4px 6px !important;
  border-radius:8px !important;
  font-size:9.5px !important;
  line-height:1 !important;
  white-space:nowrap;
}

.code-actions .btn.primary{
  padding-inline:8px !important;
}

/* Keep saveState alive for JS, invisible to users. */
.code-action-head #saveState{
  display:none !important;
}

/* Compact all pane headers and give content more room. */
.workspace > .pane{
  grid-template-rows:
    43px
    minmax(0,1fr) !important;
}

.workspace .pane-head{
  min-height:43px !important;
  height:43px !important;
  padding-top:6px !important;
  padding-bottom:6px !important;
}

.output-pane .pane-head,
.preview-pane .pane-head{
  padding-inline:9px !important;
}

.output-pane .pane-head .btn{
  min-height:28px !important;
  padding:4px 6px !important;
  font-size:9.5px !important;
}

/* Workspace now starts immediately after the top line */
.tool-shell{
  margin-top:0 !important;
}

@media(max-width:1100px){

  .top-language-control{
    order:10;
  }

  .code-actions{
    justify-content:flex-start;
  }
}

@media(max-width:620px){

  .top-language-control{
    width:auto !important;
  }

  .code-actions .btn{
    font-size:9px !important;
  }
}


/* AFAQ Python Lab — action order refinement */

/* Requested visual order: left → right */
.code-actions{
  direction:ltr !important;
  justify-content:flex-start !important;
}

.code-actions #runBtn{
  order:1;
}

.code-actions #stopBtn{
  order:2;
}

.code-actions #clearBtn{
  order:3;
}

.code-actions #exampleBtn{
  order:4;
}

.code-actions #copyBtn{
  order:5;
}

.code-actions #exportBtn{
  order:6;
}

.code-actions #importBtn{
  order:7;
}

/* Keep Arabic button labels naturally readable */
.code-actions .btn{
  direction:rtl;
}

/* Filename remains available to JS but is not visual UI */
#filename[type="hidden"]{
  display:none !important;
}

.top-language-control{
  gap:6px !important;
}


/* AFAQ Python Lab — unified action buttons */

.code-actions{
  gap:4px !important;
}

/* Equal compact buttons */
.code-actions .btn{
  width:82px !important;
  min-width:82px !important;
  max-width:82px !important;

  height:27px !important;
  min-height:27px !important;
  max-height:27px !important;

  padding:0 6px !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;

  border-radius:7px !important;
  border:1px solid rgba(17,17,17,.16) !important;

  background:rgba(255,255,255,.42) !important;
  color:var(--ink) !important;

  font-size:9.5px !important;
  font-weight:800 !important;
  line-height:1 !important;

  box-shadow:none !important;
  transform:none !important;
}

.code-actions .btn:hover{
  background:rgba(255,255,255,.68) !important;
  transform:none !important;
}

/* Run — black */
.code-actions #runBtn{
  background:#0b0b0b !important;
  border-color:#0b0b0b !important;
  color:#f7f3eb !important;
}

.code-actions #runBtn:hover{
  background:#1a1a1a !important;
}

/* Stop — red */
.code-actions #stopBtn{
  background:#a83f36 !important;
  border-color:#a83f36 !important;
  color:#fff !important;
}

.code-actions #stopBtn:hover{
  background:#94372f !important;
}

/* Disabled keeps identity but looks disabled */
.code-actions #runBtn:disabled,
.code-actions #stopBtn:disabled{
  opacity:.42 !important;
  cursor:not-allowed !important;
}

/* Slightly tighter code-pane header */
.code-action-head{
  min-height:39px !important;
  height:39px !important;
  padding:5px 6px !important;
}

.workspace > .code-pane{
  grid-template-rows:
    39px
    minmax(0,1fr) !important;
}


/* AFAQ Python Lab — mini action buttons */

.code-actions{
  gap:3px !important;
}

.code-actions .btn{
  width:48px !important;
  min-width:48px !important;
  max-width:48px !important;

  height:22px !important;
  min-height:22px !important;
  max-height:22px !important;

  padding:0 3px !important;

  border-radius:6px !important;

  font-size:8.5px !important;
  font-weight:800 !important;
}

.code-action-head{
  min-height:31px !important;
  height:31px !important;
  padding:4px 5px !important;
}

.workspace > .code-pane{
  grid-template-rows:
    31px
    minmax(0,1fr) !important;
}


/* AFAQ Python Lab — equal pane header alignment */

/* All three panes must start their content at exactly the same height. */
.workspace > .pane{
  grid-template-rows:
    31px
    minmax(0,1fr) !important;
}

.workspace .pane-head{
  height:31px !important;
  min-height:31px !important;
  max-height:31px !important;
  padding:4px 6px !important;
  box-sizing:border-box !important;
}

/* Code action row stays compact. */
.code-action-head{
  height:31px !important;
  min-height:31px !important;
  max-height:31px !important;
}

/* Result header controls also fit inside the same 31px line. */
.output-pane .pane-head .btn{
  height:22px !important;
  min-height:22px !important;
  max-height:22px !important;
  padding:0 5px !important;
  font-size:8.5px !important;
  border-radius:6px !important;
}

.output-pane .pane-meta,
.preview-pane .pane-meta,
.output-pane .pane-title,
.preview-pane .pane-title{
  font-size:10px !important;
  line-height:1 !important;
}


/* AFAQ Python Lab — output buttons match code buttons */

.output-pane .pane-head .action-group{
  display:flex !important;
  align-items:center !important;
  gap:3px !important;
}

.output-pane #clearOutputBtn,
.output-pane #exportOutputBtn{
  width:48px !important;
  min-width:48px !important;
  max-width:48px !important;

  height:22px !important;
  min-height:22px !important;
  max-height:22px !important;

  padding:0 3px !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;

  border:1px solid rgba(17,17,17,.16) !important;
  border-radius:6px !important;

  background:rgba(255,255,255,.42) !important;
  color:var(--ink) !important;

  font-size:8.5px !important;
  font-weight:800 !important;
  line-height:1 !important;

  box-shadow:none !important;
  transform:none !important;
}

.output-pane #clearOutputBtn:hover,
.output-pane #exportOutputBtn:hover{
  background:rgba(255,255,255,.68) !important;
  transform:none !important;
}


/* AFAQ Python Lab — exact output button match */
.output-pane #clearOutputBtn,
.output-pane #exportOutputBtn{
  appearance:none !important;

  width:48px !important;
  min-width:48px !important;
  max-width:48px !important;

  height:22px !important;
  min-height:22px !important;
  max-height:22px !important;

  padding:0 3px !important;
  margin:0 !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;

  box-sizing:border-box !important;

  border:1px solid rgba(17,17,17,.16) !important;
  border-radius:6px !important;

  background:rgba(255,255,255,.42) !important;
  color:var(--ink) !important;

  font-family:inherit !important;
  font-size:8.5px !important;
  font-weight:800 !important;
  line-height:1 !important;

  white-space:nowrap !important;

  box-shadow:none !important;
  transform:none !important;
}

/* FINAL: lock result buttons to exact code-button size */
.output-pane .pane-head .action-group{
  flex:0 0 auto !important;
}

.output-pane #clearOutputBtn,
.output-pane #exportOutputBtn{
  flex:0 0 48px !important;

  width:48px !important;
  min-width:48px !important;
  max-width:48px !important;

  height:22px !important;
  min-height:22px !important;
  max-height:22px !important;

  padding:0 3px !important;
  margin:0 !important;

  box-sizing:border-box !important;

  border-radius:6px !important;

  font-size:8.5px !important;
  font-weight:800 !important;
  line-height:1 !important;

  white-space:nowrap !important;
}


/* AFAQ Python Lab — one exact mini-button system */
.mini-tool-btn{
  appearance:none !important;

  flex:0 0 48px !important;
  inline-size:48px !important;
  min-inline-size:48px !important;
  max-inline-size:48px !important;

  block-size:22px !important;
  min-block-size:22px !important;
  max-block-size:22px !important;

  width:48px !important;
  min-width:48px !important;
  max-width:48px !important;

  height:22px !important;
  min-height:22px !important;
  max-height:22px !important;

  margin:0 !important;
  padding:0 3px !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;

  box-sizing:border-box !important;

  border:1px solid rgba(17,17,17,.16) !important;
  border-radius:6px !important;

  background:rgba(255,255,255,.42) !important;
  color:var(--ink) !important;

  font-family:inherit !important;
  font-size:8.5px !important;
  font-weight:800 !important;
  line-height:1 !important;

  white-space:nowrap !important;

  box-shadow:none !important;
  transform:none !important;
}

/* تشغيل */
#runBtn.mini-tool-btn{
  background:#0b0b0b !important;
  border-color:#0b0b0b !important;
  color:#fff !important;
}

/* إيقاف */
#stopBtn.mini-tool-btn{
  background:#a83f36 !important;
  border-color:#a83f36 !important;
  color:#fff !important;
}

#runBtn.mini-tool-btn:disabled,
#stopBtn.mini-tool-btn:disabled{
  opacity:.42 !important;
}

.output-pane .pane-head .action-group{
  flex:0 0 auto !important;
  width:auto !important;
  min-width:0 !important;
  gap:3px !important;
}


/* AFAQ Python Lab — shared account link */
.nav-side.right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
}

.account-link{
  color:inherit;
  text-decoration:none;
  font-size:10px;
  font-weight:700;
  white-space:nowrap;
  opacity:.64;
  transition:opacity .18s ease;
}

.account-link:hover{
  opacity:1;
}

@media(max-width:700px){
  .nav-side.right{
    gap:7px;
  }

  .account-link{
    font-size:9px;
  }
}


/* AFAQ Python Lab — My Works */

.top-works-control{
  display:inline-flex;
  align-items:center;
  gap:4px;
  min-width:0;
}

.top-works-control button{
  appearance:none;
  border:1px solid rgba(17,17,17,.16);
  border-radius:6px;
  background:rgba(255,255,255,.34);
  color:var(--ink);
  height:22px;
  min-height:22px;
  padding:0 7px;
  font:inherit;
  font-size:8.5px;
  font-weight:800;
  line-height:1;
  cursor:pointer;
  white-space:nowrap;
}

.top-works-control button:hover{
  background:rgba(255,255,255,.64);
}

#saveWorkBtn{
  background:#0b0b0b;
  border-color:#0b0b0b;
  color:#fff;
}

.current-work-label{
  display:inline-block;
  max-width:130px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:9px;
  font-weight:700;
  opacity:.62;
}

.work-state-text{
  min-width:0;
  font-size:8px;
  opacity:.55;
  white-space:nowrap;
}

.works-modal[hidden]{
  display:none !important;
}

.works-modal{
  position:fixed;
  inset:0;
  z-index:3000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(8,8,8,.72);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}

.works-modal-card{
  width:min(720px,100%);
  max-height:min(78vh,720px);
  display:flex;
  flex-direction:column;
  overflow:hidden;

  border:1px solid rgba(17,17,17,.15);
  border-radius:22px;

  background:var(--paper);
  color:var(--ink);

  box-shadow:0 32px 100px rgba(0,0,0,.34);
}

.works-modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  padding:22px 24px 17px;
  border-bottom:1px solid rgba(17,17,17,.12);
}

.works-modal-head small{
  display:block;
  direction:ltr;
  margin-bottom:5px;
  font-size:8px;
  letter-spacing:.16em;
  opacity:.45;
}

.works-modal-head h2{
  margin:0;
  font-size:28px;
  line-height:1;
}

.works-close{
  width:30px;
  height:30px;
  display:grid;
  place-items:center;
  padding:0;

  border:1px solid rgba(17,17,17,.16);
  border-radius:50%;
  background:transparent;
  color:var(--ink);

  font-size:20px;
  line-height:1;
  cursor:pointer;
}

.works-list{
  min-height:180px;
  overflow-y:auto;
  padding:12px;
}

.works-empty{
  min-height:180px;
  display:grid;
  place-items:center;
  padding:30px;
  text-align:center;
  font-size:13px;
  line-height:1.9;
  opacity:.58;
}

.work-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:14px;

  padding:13px 14px;
  border-bottom:1px solid rgba(17,17,17,.1);
}

.work-row:last-child{
  border-bottom:0;
}

.work-row-main{
  min-width:0;
}

.work-row-title{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:14px;
  font-weight:750;
}

.work-row-date{
  display:block;
  margin-top:4px;
  direction:rtl;
  font-size:9px;
  opacity:.48;
}

.work-row-actions{
  display:flex;
  align-items:center;
  gap:4px;
}

.work-row-actions button{
  height:24px;
  min-width:46px;
  padding:0 7px;

  border:1px solid rgba(17,17,17,.16);
  border-radius:6px;
  background:rgba(255,255,255,.35);
  color:var(--ink);

  font:inherit;
  font-size:8.5px;
  font-weight:800;

  cursor:pointer;
}

.work-row-actions .work-delete{
  color:#8c312c;
}

@media(max-width:800px){
  .top-works-control{
    gap:3px;
  }

  .current-work-label{
    max-width:78px;
  }

  .work-state-text{
    display:none;
  }

  .work-row{
    grid-template-columns:1fr;
  }

  .work-row-actions{
    justify-content:flex-start;
  }
}

/* AFAQ Python Lab — My Works visual refinement */

.works-modal{
  padding:18px !important;
  background:rgba(8,8,8,.84) !important;
}

.works-modal-card{
  width:min(940px,96vw) !important;
  max-height:86vh !important;

  background:#eeeae2 !important;
  color:#111 !important;

  border:1px solid rgba(17,17,17,.34) !important;
  border-radius:20px !important;

  box-shadow:0 34px 110px rgba(0,0,0,.48) !important;
}

.works-modal-head{
  padding:24px 28px 19px !important;
  border-bottom:1px solid rgba(17,17,17,.22) !important;
}

.works-modal-head small{
  color:#4f4b45 !important;
  opacity:1 !important;
  font-size:9px !important;
  font-weight:700 !important;
}

.works-modal-head h2{
  color:#111 !important;
  font-size:32px !important;
  font-weight:800 !important;
}

.works-close{
  color:#111 !important;
  border-color:rgba(17,17,17,.32) !important;
  background:#e4ded4 !important;
  font-weight:800 !important;
}

.works-list{
  padding:14px 18px 20px !important;
  background:#eeeae2 !important;
}

.works-empty{
  color:#111 !important;
  opacity:1 !important;
  font-size:14px !important;
  font-weight:600 !important;
}

.work-row{
  min-height:72px !important;
  padding:15px 12px !important;
  border-bottom:1px solid rgba(17,17,17,.18) !important;
}

.work-row-title{
  color:#111 !important;
  font-size:16px !important;
  font-weight:800 !important;
}

.work-row-date{
  color:#514d47 !important;
  opacity:1 !important;
  font-size:10.5px !important;
  font-weight:600 !important;
}

.work-row-actions{
  gap:6px !important;
}

.work-row-actions button{
  min-width:54px !important;
  height:29px !important;
  padding:0 9px !important;

  color:#111 !important;
  background:#e5dfd5 !important;

  border:1px solid rgba(17,17,17,.30) !important;
  border-radius:7px !important;

  font-size:10px !important;
  font-weight:800 !important;
}

.work-row-actions button:hover{
  background:#dcd5ca !important;
}

.work-row-actions .work-edit{
  background:#111 !important;
  border-color:#111 !important;
  color:#fff !important;
}

.work-row-actions .work-delete{
  color:#922f29 !important;
  background:#eadbd7 !important;
}

.current-work-label.editing{
  color:#111 !important;
  opacity:1 !important;
  font-weight:800 !important;
}

@media(max-width:700px){
  .works-modal{
    padding:8px !important;
  }

  .works-modal-card{
    width:100% !important;
    max-height:90vh !important;
  }

  .works-modal-head{
    padding:18px !important;
  }

  .work-row-actions{
    flex-wrap:wrap;
  }
}
